diff --git a/web/js/components/image-download/image-download-panel.js b/web/js/components/image-download/image-download-panel.js index f6475c86df..75b0f29a96 100644 --- a/web/js/components/image-download/image-download-panel.js +++ b/web/js/components/image-download/image-download-panel.js @@ -1,8 +1,8 @@ import React, { useState, useEffect } from 'react'; import { useSelector } from 'react-redux'; -import { getActivePalettes } from '../../modules/palettes/selectors'; import PropTypes from 'prop-types'; import googleTagManager from 'googleTagManager'; +import { getActivePalettes } from '../../modules/palettes/selectors'; import { imageSizeValid, getDimensions, diff --git a/web/js/containers/toolbar.js b/web/js/containers/toolbar.js index f77f4d960d..f55953e5f2 100644 --- a/web/js/containers/toolbar.js +++ b/web/js/containers/toolbar.js @@ -21,7 +21,7 @@ import { requestNotifications, setNotifications, } from '../modules/notifications/actions'; -import { clearCustoms, refreshPalettes } from '../modules/palettes/actions'; +import { refreshPalettes } from '../modules/palettes/actions'; import { clearRotate, refreshRotation } from '../modules/map/actions'; import { showLayers, hideLayers, diff --git a/web/js/modules/image-download/util.js b/web/js/modules/image-download/util.js index 77b01ba722..14c143f076 100644 --- a/web/js/modules/image-download/util.js +++ b/web/js/modules/image-download/util.js @@ -1,5 +1,4 @@ import { - each as lodashEach, get as lodashGet, } from 'lodash'; import { transform } from 'ol/proj'; @@ -189,7 +188,7 @@ export function imageUtilGetLayers(products, proj, activePalettes) { } else if (layer.projections[proj].layer) { layerId = layer.projections[proj].layer; } - const disabled = activePalettes[layer.id]?.maps?.[0]?.disabled; + const disabled = activePalettes?.[layer.id]?.maps?.[0]?.disabled; if (Array.isArray(disabled)) { return `${layerId}(disabled=${disabled.join('-')})`; } @@ -333,12 +332,14 @@ export function getDownloadUrl(url, proj, layerDefs, bbox, dimensions, dateTime, `BBOX=${bboxWMS13(bbox, crs)}`, `CRS=${crs}`, `LAYERS=${layersArray.join(',')}`, - `colormaps=${colormaps.join(',')}`, `WRAP=${layerWraps.join(',')}`, `FORMAT=${imgFormat}`, `WIDTH=${width}`, `HEIGHT=${height}`, ]; + if (Array.isArray(colormaps) && colormaps.length > 0) { + params.push(`colormaps=${colormaps.join(',')}`); + } if (granuleDates.length > 0) { params.push(`granule_dates=${granuleDates}`); } diff --git a/web/js/modules/image-download/util.test.js b/web/js/modules/image-download/util.test.js index f791c7a497..e422b96b96 100644 --- a/web/js/modules/image-download/util.test.js +++ b/web/js/modules/image-download/util.test.js @@ -218,7 +218,7 @@ test('Download URL [imagedownload-url]', () => { { id: 1, longitude: 2.7117, latitude: -19.1609 }, { id: 2, longitude: 71.173, latitude: -39.0961 }, ]; - const dlURL = getDownloadUrl(url, proj, mockLayerDefs, lonlats, dimensions, dateTime, false, false, locationMarkers); + const dlURL = getDownloadUrl(url, proj, mockLayerDefs, lonlats, dimensions, dateTime, false, false, locationMarkers, undefined); const expectedURL = 'http://localhost:3002/api/v1/snapshot' + '?REQUEST=GetSnapshot' + '&TIME=2019-06-24T00:00:00Z' @@ -228,6 +228,7 @@ test('Download URL [imagedownload-url]', () => { + '&WRAP=day' + '&FORMAT=image/jpeg' + '&WIDTH=300&HEIGHT=300' + + '&colormaps=' + '&MARKER=2.7117,-19.1609,71.173,-39.0961'; expect(dlURL.includes(expectedURL)).toBe(true); });