Skip to content

Commit

Permalink
Issue/hitide UI 44 (#57)
Browse files Browse the repository at this point in the history
* issue/hitide-ui-44: fixed footprints staying on screen

* issue/hitide-ui-44: fixed footprint/preview staying on map

* issue/hitide-ui-44: cleaned up footprint/preview display code

---------

Co-authored-by: jbyrne <[email protected]>
  • Loading branch information
jbyrne6 and jbyrne committed Mar 12, 2024
1 parent 418c190 commit b561e9f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,6 @@ jobs:
run: |
npm install
npm run build
- name: Make Config Files
run: |
cat ./configs/hitideConfig-${{ env.THE_ENV }}.js > ./dist/hitideConfig.js
## Deployment
- name: Deploy Env Override
Expand All @@ -206,6 +202,10 @@ jobs:
echo "THE_ENV=${override_env}" >> $GITHUB_ENV
echo "TARGET_ENV_UPPERCASE=${override_env_upper}" >> $GITHUB_ENV
- name: Make Config Files
run: |
cat ./configs/hitideConfig-${{ env.THE_ENV }}.js > ./dist/hitideConfig.js
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- issue-48: Fixed collection resolution error handling
- issue-49: Removed unused Docker and Jenkins folders/files from HiTIDE-UI
- issue-52: Fixed missing thumbnail placeholder
- issue-44: Fixed footprints and previews stay on map when not intended

## [4.16.2]
### Added
Expand Down
31 changes: 26 additions & 5 deletions src/jpl/dijit/GranulesController.js
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,7 @@ define([
postGranulesFetch: function(response) {
this.availableGranules = response.hits;
var _context = this;

response.items.map(function(x) {
GranuleMetadata.convertFootprintAndImageFromCMR(x);
var granule_id = x["meta"]["concept-id"];
Expand All @@ -766,6 +767,19 @@ define([
_context.gridStore.add(x)
});

// remove footprints and preview from displaying on the map if they are not in the current page of the granule table
var currentlyVisibleFootprints = {}
var currentlyVisiblePreviews = {}

for (var i=0; i<this.stateStore.data.length; i++) {
var currentVisibleGranule = this.stateStore.data[i]
if (currentVisibleGranule.footprint) currentlyVisibleFootprints[currentVisibleGranule["Granule-Name"]] = currentVisibleGranule
if (currentVisibleGranule.preview) currentlyVisiblePreviews[currentVisibleGranule["Granule-Name"]] = currentVisibleGranule
}

_context.toggleFootprints(Object.values(currentlyVisibleFootprints), false, true)
_context.togglePreviews(Object.values(currentlyVisiblePreviews), false, true)

this.granulesInGrid = this.gridStore.query().length;

// Set no data message accordingly
Expand Down Expand Up @@ -857,7 +871,6 @@ define([
}
return value.toISOString().slice(0, 16);
},

updateStateStoreObj: function(obj) {
// If obj has no active states, remove it else upsert
if (!obj.footprint && !obj.preview) {
Expand Down Expand Up @@ -906,15 +919,19 @@ define([
}
},

toggleFootprints: function(granuleObjs, active) {
toggleFootprints: function(granuleObjs, active, inStoreAlready) {
// if obj already in grid store, update and don't put
inStoreAlready = inStoreAlready || false
for (var i = 0; i < granuleObjs.length; i++) {
// Update store
var obj = granuleObjs[i];

if (obj.footprint != active) {
if(obj["Granule-Footprint"]){
obj.footprint = active;
this.gridStore.put(obj);
if (!inStoreAlready) {
this.gridStore.put(obj);
}
this.updateStateStoreObj(obj);

// Update fp
Expand All @@ -925,14 +942,18 @@ define([
}
},

togglePreviews: function(granuleObjs, active) {
togglePreviews: function(granuleObjs, active, inStoreAlready) {
// if obj already in grid store, update and don't put
inStoreAlready = inStoreAlready || false
for (var i = 0; i < granuleObjs.length; i++) {
// Update store
var obj = granuleObjs[i];
if (obj.preview != active) {
if(obj.has_image){
obj.preview = active;
this.gridStore.put(obj);
if (!inStoreAlready) {
this.gridStore.put(obj);
}
this.updateStateStoreObj(obj);

// Update preview
Expand Down

0 comments on commit b561e9f

Please sign in to comment.