diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bccd948..81fc5cb7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,14 +9,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed ### Removed ### Fixed +- issue-65: Fixed footprints and previews disappearing from map when not intended and staying on too long. -## [4.17.1] +## [4.17.2] ### Added ### Changed ### Removed ### Fixed - issue-44: Fixed footprints and previews stay on map when not intended +- issue-65: Fixed footprints and previews disappearing from map when not intended ## [4.17.0] ### Added @@ -28,6 +30,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 diff --git a/cmr/ops_associations.txt b/cmr/ops_associations.txt index 67eea9f7..b76c4fb7 100644 --- a/cmr/ops_associations.txt +++ b/cmr/ops_associations.txt @@ -9,11 +9,7 @@ C2205618339-POCLOUD C2205121384-POCLOUD C2205121394-POCLOUD C2208421887-POCLOUD -C2152045877-POCLOUD C2205121315-POCLOUD -C2152044763-POCLOUD -C2152046451-POCLOUD -C2147947806-POCLOUD C2254232941-POCLOUD C2251465126-POCLOUD C2075141524-POCLOUD @@ -26,7 +22,6 @@ C2036880717-POCLOUD C2183155461-POCLOUD C2075141638-POCLOUD C2036880640-POCLOUD -C2274919215-POCLOUD C2036879048-POCLOUD C2036882048-POCLOUD C2075141605-POCLOUD @@ -62,3 +57,17 @@ C2068529568-POCLOUD C2832196001-POCLOUD C2147478146-POCLOUD C2147480877-POCLOUD +C2832221740-POCLOUD +C2205553958-POCLOUD +C2205121400-POCLOUD +C2730520815-POCLOUD +C2706513160-POCLOUD +C2036877495-POCLOUD +C2706520933-POCLOUD +C2754895884-POCLOUD +C2847232153-POCLOUD +C2036877502-POCLOUD +C2646932894-POCLOUD +C2274919215-POCLOUD +C2036877509-POCLOUD +C2847232536-POCLOUD diff --git a/cmr/uat_associations.txt b/cmr/uat_associations.txt index aa07f2fa..a7c8d5a6 100644 --- a/cmr/uat_associations.txt +++ b/cmr/uat_associations.txt @@ -3,7 +3,6 @@ C1234208437-POCLOUD C1234208438-POCLOUD C1234724470-POCLOUD C1234724471-POCLOUD -C1234071416-POCLOUD C1940473819-POCLOUD C1940475563-POCLOUD C1940466008-POCLOUD @@ -13,12 +12,8 @@ C1240739577-POCLOUD C1240739709-POCLOUD C1240739734-POCLOUD C1240739726-POCLOUD -C1242387592-POCLOUD -C1242387601-POCLOUD C1238658389-POCLOUD C1243175554-POCLOUD -C1242387586-POCLOUD -C1242387621-POCLOUD C1244810554-POCLOUD C1256420925-POCLOUD C1256507988-POCLOUD @@ -90,3 +85,10 @@ C1244459498-POCLOUD C1261591414-POCLOUD C1257081728-POCLOUD C1256981321-POCLOUD +C1262623432-POCLOUD +C1261794337-POCLOUD +C1263085435-POCLOUD +C1258237271-POCLOUD +C1263085942-POCLOUD +C1263085937-POCLOUD +C1262314990-POCUMULUS diff --git a/package-lock.json b/package-lock.json index 0658f2b8..d5b229a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@gov.nasa.jpl.podaac/hitide-ui", - "version": "4.17.1", + "version": "4.17.2-rc.11", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 96a4d861..c56b6428 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@gov.nasa.jpl.podaac/hitide-ui", "title": "HiTIDE", "description": "High Level Tool for Interactive Data Extraction", - "version": "4.17.1", + "version": "4.17.2-rc.11", "scripts": { "build": "grunt --force; npm run copy", "copy": "node scripts/copy-files.js", diff --git a/src/hitideConfig.js b/src/hitideConfig.js index 43686899..26cab1cd 100644 --- a/src/hitideConfig.js +++ b/src/hitideConfig.js @@ -1,4 +1,5 @@ var hitideProfileOrigin = "https://hitide.profile.podaac.uat.earthdatacloud.nasa.gov/hitide/api"; +// var hitideProfileOrigin = "http://localhost:8080/hitide/api"; window.hitideConfig = { paletteService: "https://hitide.podaac.earthdatacloud.nasa.gov/palettes", @@ -10,7 +11,7 @@ window.hitideConfig = { cmrVariableService: hitideProfileOrigin + "/cmr/graphql", crossOriginCmrCookies: true, - authCodeUrl: "https://uat.urs.earthdata.nasa.gov/oauth/authorize", + authCodeUrl: "https://urs.earthdata.nasa.gov/oauth/authorize", loginUrl: hitideProfileOrigin + "/session/login", logoutUrl: hitideProfileOrigin + "/session/logout", @@ -24,5 +25,5 @@ window.hitideConfig = { datasetSearchServiceItemsPerPage: 200, maxGranulesPerDownload: 999999999, googleTagManagerId: "GTM-M5D83V6", - earthDataAppClientId: "dxpH2WeN_f8IpNLgHwplsg" + earthDataAppClientId: "mn6VmRfej3U2Tm0UhbC1jw" }; diff --git a/src/index.html b/src/index.html index 85d655ba..a888c372 100755 --- a/src/index.html +++ b/src/index.html @@ -29,6 +29,8 @@ +
diff --git a/src/jpl/dijit/GranulesController.js b/src/jpl/dijit/GranulesController.js index e3bcd8b8..5894a75f 100644 --- a/src/jpl/dijit/GranulesController.js +++ b/src/jpl/dijit/GranulesController.js @@ -78,6 +78,9 @@ define([ _granuleSearchInProgress: false, loadingGranulesMessage: '
Loading Granules...
', noGranulesMessage: '
No Granules Found
', + scrollLoadInProgress: false, + addedFootprintStore: {}, + addedPreviewStore: {}, constructor: function() { this.datasetVariables = {}; @@ -363,7 +366,18 @@ define([ var node = this.getParent().currentTarget; var selectedGranules = Object.keys(_context.granuleGrid.selection); var granuleObjs = selectedGranules.map(function(x) { - return _context.granuleGrid.row(x).data; + var objectData = _context.granuleGrid.row(x).data + if(!objectData.footprint) { + objectData.footprint = true + _context.gridStore.put(objectData) + _context.updateStateStoreObj(objectData); + _context.toggleFootprintDisplay(objectData); + return objectData; + } else { + return null + } + }).filter(function(x) { + x !== null }) _context.toggleFootprints(granuleObjs, true); } @@ -374,8 +388,27 @@ define([ onClick: function(evt) { var node = this.getParent().currentTarget; var selectedGranules = Object.keys(_context.granuleGrid.selection); + var granuleObjNames = []; var granuleObjs = selectedGranules.map(function(x) { - return _context.granuleGrid.row(x).data; + var objectData = _context.granuleGrid.row(x).data + if(objectData.footprint) { + granuleObjNames.push(objectData["Granule-Name"]) + objectData.footprint = false + _context.gridStore.put(objectData) + _context.updateStateStoreObj(objectData); + _context.toggleFootprintDisplay(objectData); + return objectData; + } else { + return null + } + }).filter(function(x) { + x !== null + }) + // deactivate granules from addedFootprints + Object.values(_context.addedFootprintStore).forEach(function(x) { + if(granuleObjNames.includes(x["Granule-Name"])) { + granuleObjs.push(x); + } }) _context.toggleFootprints(granuleObjs, false); } @@ -383,8 +416,31 @@ define([ contextMenu.addChild(new MenuItem({ label: "Clear all footprints", iconClass: "fa fa-trash color-orange", + // .concat(Object.values(_context.addedFootprintStore)) onClick: function(evt) { - _context.hideAllFootprints(); + var stateStoreObjects = Array.from(_context.stateStore.query()).map(function(obj){ + obj.footprint = false + _context.gridStore.put(obj) + _context.updateStateStoreObj(obj); + _context.toggleFootprintDisplay(obj); + return obj + }) + var gridStoreObjects = Array.from(_context.gridStore.query()).map(function(obj){ + obj.footprint = false + _context.gridStore.put(obj) + _context.updateStateStoreObj(obj); + return obj + }) + var addedFootprintObjects = Object.values(_context.addedFootprintStore).map(function(obj){ + obj.footprint = false + _context.gridStore.put(obj) + _context.updateStateStoreObj(obj); + _context.toggleFootprintDisplay(obj); + + return obj + }) + _context.toggleFootprints(stateStoreObjects.concat(gridStoreObjects).concat(addedFootprintObjects), false); + _context.addedFootprintStore = {}; } })); contextMenu.addChild(new MenuSeparator()); @@ -395,7 +451,18 @@ define([ var node = this.getParent().currentTarget; var selectedGranules = Object.keys(_context.granuleGrid.selection); var granuleObjs = selectedGranules.map(function(x) { - return _context.granuleGrid.row(x).data; + var objectData = _context.granuleGrid.row(x).data + if(!objectData.preview) { + objectData.preview = true + _context.gridStore.put(objectData) + _context.updateStateStoreObj(objectData); + _context.togglePreviewDisplay(objectData); + return objectData; + }else { + return null + } + }).filter(function(x) { + x !== null }) _context.togglePreviews(granuleObjs, true); } @@ -406,8 +473,27 @@ define([ onClick: function(evt) { var node = this.getParent().currentTarget; var selectedGranules = Object.keys(_context.granuleGrid.selection); + var granuleObjNames = []; var granuleObjs = selectedGranules.map(function(x) { - return _context.granuleGrid.row(x).data; + var objectData = _context.granuleGrid.row(x).data + if(objectData.preview) { + granuleObjNames.push(objectData["Granule-Name"]); + objectData.preview = false + _context.gridStore.put(objectData) + _context.updateStateStoreObj(objectData); + _context.togglePreviewDisplay(objectData); + return objectData; + }else { + return null + } + }).filter(function(x) { + x !== null + }) + // deactivate granules from addedPreviews + Object.values(_context.addedPreviewStore).forEach(function(x) { + if(granuleObjNames.includes(x["Granule-Name"])) { + granuleObjs.push(x); + } }) _context.togglePreviews(granuleObjs, false); } @@ -416,7 +502,29 @@ define([ label: "Clear all image previews", iconClass: "fa fa-trash color-orange", onClick: function(evt) { - _context.hideAllPreviews(); + var stateStoreObjects = Array.from(_context.stateStore.query()).map(function(obj){ + obj.preview = false + _context.gridStore.put(obj) + _context.updateStateStoreObj(obj); + _context.togglePreviewDisplay(obj); + return obj + }) + var gridStoreObjects = Array.from(_context.gridStore.query()).map(function(obj){ + obj.preview = false + _context.gridStore.put(obj) + _context.updateStateStoreObj(obj); + return obj + }) + var addedPreviewObjects = Object.values(_context.addedPreviewStore).map(function(obj){ + obj.preview = false + _context.gridStore.put(obj) + _context.updateStateStoreObj(obj); + _context.togglePreviewDisplay(obj); + return obj + }) + _context.togglePreviews(stateStoreObjects.concat(gridStoreObjects).concat(addedPreviewObjects), false); + // remove from addedPreviews + _context.addedPreviewStore = {}; } })); }, @@ -746,40 +854,77 @@ define([ postGranulesFetch: function(response) { this.availableGranules = response.hits; var _context = this; - + var currentStateStore = _context.stateStore.query() + var acceptableStateStoreIds = [] + var stateStoreItemsToRemove = [] + for(var i=0; i 0.90) { this.currentSolrIdx += this.itemsPerPage; + this.scrollLoadInProgress = true; this.fetchGranules(); } }, @@ -903,7 +1052,6 @@ define([ toggleFootprintDisplay: function(obj) { if (obj.footprint) { - // if (!this.footprintGraphics[obj["Granule-Id"]]) { var rgb = this.hexToRgb(this.datasetColor); var borderColor = [rgb.r, rgb.g, rgb.b, 0.7]; var fillColor = [rgb.r, rgb.g, rgb.b, 0.00]; @@ -912,26 +1060,27 @@ define([ border: borderColor, fill: fillColor }); + // add to my separate store + this.addedFootprintStore[obj["Granule-Name"]] = obj; } else { topic.publish(GranuleSelectionEvent.prototype.REMOVE_GRANULE_FOOTPRINT, { granuleObj: obj }); + // remove object from addedFootprintStore + topic.publish(GranuleSelectionEvent.prototype.REMOVE_GRANULE_FOOTPRINT, { + granuleObj: this.addedFootprintStore[obj["Granule-Name"]] + }); + delete this.addedFootprintStore[obj["Granule-Name"]]; } }, - toggleFootprints: function(granuleObjs, active, inStoreAlready) { - // if obj already in grid store, update and don't put - inStoreAlready = inStoreAlready || false + toggleFootprints: function(granuleObjs, active) { 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; - if (!inStoreAlready) { - this.gridStore.put(obj); - } this.updateStateStoreObj(obj); // Update fp @@ -942,18 +1091,13 @@ define([ } }, - togglePreviews: function(granuleObjs, active, inStoreAlready) { - // if obj already in grid store, update and don't put - inStoreAlready = inStoreAlready || false + togglePreviews: function(granuleObjs, active) { 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; - if (!inStoreAlready) { - this.gridStore.put(obj); - } this.updateStateStoreObj(obj); // Update preview @@ -968,19 +1112,31 @@ define([ topic.publish(GranuleSelectionEvent.prototype.ADD_GRANULE_PREVIEW, { granuleObj: obj }); + // add to my separate store + this.addedPreviewStore[obj["Granule-Name"]] = obj; } else { topic.publish(GranuleSelectionEvent.prototype.REMOVE_GRANULE_PREVIEW, { granuleObj: obj }); + // remove object from addedPreviewStore + topic.publish(GranuleSelectionEvent.prototype.REMOVE_GRANULE_PREVIEW, { + granuleObj: obj + }); + topic.publish(GranuleSelectionEvent.prototype.REMOVE_GRANULE_PREVIEW, { + granuleObj: this.addedPreviewStore[obj["Granule-Name"]] + }); + delete this.addedPreviewStore[obj["Granule-Name"]]; } }, hideAllPreviews: function() { - this.togglePreviews(this.stateStore.query(), false); + var stateStoreObjects = Array.from(this.stateStore.query()).concat(Object.values(this.addedPreviewStore)) + this.togglePreviews(stateStoreObjects, false); }, hideAllFootprints: function() { - this.toggleFootprints(this.stateStore.query(), false); + var stateStoreObjects = Array.from(this.stateStore.query()).concat(Object.values(this.addedFootprintStore)) + this.toggleFootprints(stateStoreObjects, false); }, resize: function() { diff --git a/src/jpl/dijit/templates/HelpDialog.html b/src/jpl/dijit/templates/HelpDialog.html index d73f5873..9774b386 100644 --- a/src/jpl/dijit/templates/HelpDialog.html +++ b/src/jpl/dijit/templates/HelpDialog.html @@ -127,10 +127,10 @@
version #.#
- Version 4.17.1 (3/13/2024) + Version 4.17.2 (8/31/2024)
    -
  • Fixed Security and bug fixes.
  • +
  • Fixed Fixed granule selection's footprint and preview behavior.
diff --git a/src/jpl/utils/SearchDatasets.js b/src/jpl/utils/SearchDatasets.js index 5707cd87..b5e6f50a 100644 --- a/src/jpl/utils/SearchDatasets.js +++ b/src/jpl/utils/SearchDatasets.js @@ -123,57 +123,73 @@ define([ return datasets; } - function getCmrSpatialExtent(datasetObject){ - var conceptId = datasetObject["Dataset-PersistentId"] - var secondURL = config.hitide.externalConfigurables.cmrCollectionSearchService + "/" + conceptId + ".umm_json" - return request(secondURL, { + function getAdditionalCmrMetadata(collectionObjectArray) { + var graphqlURL = config.hitide.externalConfigurables.cmrVariableService + var collectionIds = collectionObjectArray.map(function(collectionObject) { + return '"' + collectionObject["Dataset-PersistentId"] + '"' + }) + var templateQuery = "{\n collections (conceptId: [{COLLECTION_ID}], limit: 2000) {\n items {\n conceptId\n spatialExtent\n relatedUrls\n }\n }\n}" + var query = templateQuery.replace("{COLLECTION_ID}", collectionIds); + var updatedCollectionObjects = request.post(graphqlURL, { handleAs: 'json', + withCredentials: config.hitide.externalConfigurables.crossOriginCmrCookies, headers: { - "X-Requested-With": null + "X-Requested-With": null, + "Content-Type": "application/json" }, - withCredentials: config.hitide.externalConfigurables.crossOriginCmrCookies + data: JSON.stringify({ query: query }) }).then(function(response) { - datasetObject["Dataset-Resolution"] = [] - var resolutionAndCoordinateSystemObject = response.SpatialExtent.HorizontalSpatialDomain.ResolutionAndCoordinateSystem - var relatedUrlsArray = response.RelatedUrls - if (resolutionAndCoordinateSystemObject) { - var resolutionObjects = resolutionAndCoordinateSystemObject.HorizontalDataResolution.GenericResolutions - if (resolutionObjects) { - resolutionObjects.forEach(function(resolutionObject) { - var acrossTrack = resolutionObject.XDimension - var alongTrack = resolutionObject.YDimension - var unit = resolutionObject.Unit + return collectionObjectArray.map(function(collectionObject) { + collectionObject["Dataset-ImageUrl"] = 'https://podaac.jpl.nasa.gov/Podaac/thumbnails/image_not_available.jpg' + var objectWithMetadata = response.data.collections.items.find(function (metadataItem) { return metadataItem.conceptId === collectionObject["Dataset-PersistentId"] }) + var databaseCollectionObjectToReturn = collectionObject + if(objectWithMetadata) { + databaseCollectionObjectToReturn = getCmrSpatialExtent(collectionObject, objectWithMetadata) + } + return databaseCollectionObjectToReturn + }) + }) + return all(updatedCollectionObjects).then(function(resolvedPromises) { + return resolvedPromises + }) + } + + function getCmrSpatialExtent(datasetObject, additionalMetadataObject){ + datasetObject["Dataset-Resolution"] = [] + var resolutionAndCoordinateSystemObject = additionalMetadataObject.spatialExtent.horizontalSpatialDomain.resolutionAndCoordinateSystem + var relatedUrlsArray = additionalMetadataObject.relatedUrls + if (resolutionAndCoordinateSystemObject) { + var resolutionObjects = resolutionAndCoordinateSystemObject.horizontalDataResolution + if (resolutionObjects) { + if(resolutionObjects.genericResolutions) { + resolutionObjects.genericResolutions.forEach(function(resolutionObject) { + var acrossTrack = resolutionObject.xdimension + var alongTrack = resolutionObject.ydimension + var unit = resolutionObject.unit datasetObject["Dataset-Resolution"].push({"Dataset-AcrossTrackResolution": acrossTrack, "Dataset-AlongTrackResolution": alongTrack, "Unit": unit}) }); } else { - // Resolution not available by error datasetObject["Dataset-Resolution"].push({"error": "Not Available"}) } } else { - // Key [Collection]/SpatialExtent/HorizontalSpatialDomain/ResolutionAndCoordinateSystem does not exist. This likely was intentional to indicate resolution is not applicable to this collection. - datasetObject["Dataset-Resolution"].push({"error": "Not Applicable"}) + // Resolution not available by error. + datasetObject["Dataset-Resolution"].push({"error": "Not Available"}) } - if (relatedUrlsArray) { - var urlDatasetImageUrl = 'https://podaac.jpl.nasa.gov/Podaac/thumbnails/image_not_available.jpg' - for(var i=0; i < relatedUrlsArray.length; i++) { - var currentRelatedUrlObject = relatedUrlsArray[i] - if (currentRelatedUrlObject['Description'] === 'Thumbnail') { - urlDatasetImageUrl = currentRelatedUrlObject['URL'] - } + } else { + // Key [Collection]/SpatialExtent/HorizontalSpatialDomain/ResolutionAndCoordinateSystem does not exist. This likely was intentional to indicate resolution is not applicable to this collection. + datasetObject["Dataset-Resolution"].push({"error": "Not Applicable"}) + } + if (relatedUrlsArray) { + var urlDatasetImageUrl = 'https://podaac.jpl.nasa.gov/Podaac/thumbnails/image_not_available.jpg' + for(var i=0; i < relatedUrlsArray.length; i++) { + var currentRelatedUrlObject = relatedUrlsArray[i] + if (currentRelatedUrlObject.description === 'Thumbnail') { + urlDatasetImageUrl = currentRelatedUrlObject.url } - datasetObject["Dataset-ImageUrl"] = urlDatasetImageUrl - } - return datasetObject - }) - } - - function getAdditionalCmrMetadata(collectionObjectArray) { - var promises = collectionObjectArray.map(function(collectionObject) { - return getCmrSpatialExtent(collectionObject) - }) - return all(promises).then(function(resolvedPromises) { - return resolvedPromises - }) + } + datasetObject["Dataset-ImageUrl"] = urlDatasetImageUrl + } + return datasetObject } function extractCmrFacets(response) {