From 3606172c0a1cf429eb57152c4ec85b8a0703b12f Mon Sep 17 00:00:00 2001 From: Jimmy Date: Mon, 20 May 2024 16:54:32 -0700 Subject: [PATCH] Issue/hitide UI 68 - fix dataset ui crash bug (#69) --------- Co-authored-by: jbyrne --- src/jpl/utils/SearchDatasets.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/src/jpl/utils/SearchDatasets.js b/src/jpl/utils/SearchDatasets.js index 83302fca..b5e6f50a 100644 --- a/src/jpl/utils/SearchDatasets.js +++ b/src/jpl/utils/SearchDatasets.js @@ -159,16 +159,20 @@ define([ var resolutionAndCoordinateSystemObject = additionalMetadataObject.spatialExtent.horizontalSpatialDomain.resolutionAndCoordinateSystem var relatedUrlsArray = additionalMetadataObject.relatedUrls if (resolutionAndCoordinateSystemObject) { - var resolutionObjects = resolutionAndCoordinateSystemObject.horizontalDataResolution.genericResolutions + var resolutionObjects = resolutionAndCoordinateSystemObject.horizontalDataResolution if (resolutionObjects) { - resolutionObjects.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}) - }); + 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 { + datasetObject["Dataset-Resolution"].push({"error": "Not Available"}) + } } else { - // Resolution not available by error + // Resolution not available by error. datasetObject["Dataset-Resolution"].push({"error": "Not Available"}) } } else {