From 8c1dbb102b8effe393079f3bbbb2bc463ab5e416 Mon Sep 17 00:00:00 2001 From: Patrick Moulden <4834892+PatchesMaps@users.noreply.github.com> Date: Fri, 6 Dec 2024 09:24:26 -0500 Subject: [PATCH 1/2] =?UTF-8?q?Revert=20"WV-2870=20Allow=20users=20to=20cr?= =?UTF-8?q?eate=20image=20snapshots=20of=20modified=20classificat=E2=80=A6?= =?UTF-8?q?"=20(#5600)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 276d48c6a6b9019de1584aa01a4748ae6d5a07a0. --- .../image-download/unsupported-test.spec.js | 27 +++++++++++++++++- .../image-download/image-download-panel.js | 4 --- web/js/containers/toolbar.js | 3 +- web/js/modules/image-download/util.js | 28 ++++++++----------- web/js/modules/image-download/util.test.js | 3 +- web/js/modules/palettes/selectors.js | 4 --- 6 files changed, 40 insertions(+), 29 deletions(-) diff --git a/e2e/features/image-download/unsupported-test.spec.js b/e2e/features/image-download/unsupported-test.spec.js index 2ca858547e..cce0c6a185 100644 --- a/e2e/features/image-download/unsupported-test.spec.js +++ b/e2e/features/image-download/unsupported-test.spec.js @@ -1,7 +1,7 @@ // @ts-check const { test, expect } = require('@playwright/test') const createSelectors = require('../../test-utils/global-variables/selectors') -const { closeModal } = require('../../test-utils/hooks/wvHooks') +const { closeImageDownloadPanel, closeModal } = require('../../test-utils/hooks/wvHooks') const { joinUrl } = require('../../test-utils/hooks/basicHooks') let page @@ -28,6 +28,31 @@ test.afterAll(async () => { await page.close() }) +test('Custom palettes are not supported dialog', async () => { + const { snapshotToolbarButton } = selectors + const url = await joinUrl(startParams, '&l=MODIS_Terra_Aerosol(palette=red_1)') + await page.goto(url) + await closeModal(page) + await snapshotToolbarButton.click() + await expect(notify).toBeVisible() +}) + +test('Custom palettes: Cancel button', async () => { + await cancelNotify.click() + await expect(notify).not.toBeVisible() + await expect(toolbarSnapshot).not.toBeVisible() +}) + +test('Custom palettes: OK button brings up download panel', async () => { + const { snapshotToolbarButton } = selectors + await snapshotToolbarButton.click() + await expect(notify).toBeVisible() + await acceptNotify.click() + await expect(notify).not.toBeVisible() + await expect(toolbarSnapshot).toBeVisible() + await closeImageDownloadPanel(page) +}) + test('Rotation is not supported dialog', async () => { const { snapshotToolbarButton } = selectors const url = await joinUrl(startParams, '&p=arctic&r=18') diff --git a/web/js/components/image-download/image-download-panel.js b/web/js/components/image-download/image-download-panel.js index 75b0f29a96..8dc415a734 100644 --- a/web/js/components/image-download/image-download-panel.js +++ b/web/js/components/image-download/image-download-panel.js @@ -1,8 +1,6 @@ import React, { useState, useEffect } from 'react'; -import { useSelector } from 'react-redux'; import PropTypes from 'prop-types'; import googleTagManager from 'googleTagManager'; -import { getActivePalettes } from '../../modules/palettes/selectors'; import { imageSizeValid, getDimensions, @@ -59,7 +57,6 @@ function ImageDownloadPanel(props) { const [currResolution, setResolution] = useState(resolution); const [debugUrl, setDebugUrl] = useState(''); const [showGranuleWarning, setShowGranuleWarning] = useState(false); - const activePalettes = useSelector((state) => getActivePalettes(state, state.compare.activeString)); useEffect(() => { const layerList = getLayers(); @@ -86,7 +83,6 @@ function ImageDownloadPanel(props) { currFileType, currFileType === 'application/vnd.google-earth.kmz' ? false : currIsWorldfile, markerCoordinates, - activePalettes, ); window.open(dlURL, '_blank'); diff --git a/web/js/containers/toolbar.js b/web/js/containers/toolbar.js index f55953e5f2..816fd9cd4b 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 { refreshPalettes } from '../modules/palettes/actions'; +import { clearCustoms, refreshPalettes } from '../modules/palettes/actions'; import { clearRotate, refreshRotation } from '../modules/map/actions'; import { showLayers, hideLayers, @@ -136,6 +136,7 @@ class toolbarContainer extends Component { const nonDownloadableLayers = hasNonDownloadableLayer ? getNonDownloadableLayers(visibleLayersForProj) : null; const paletteStore = lodashCloneDeep(activePalettes); toggleDialogVisible(false); + await this.getPromise(hasCustomPalette, 'palette', clearCustoms, 'Notice'); await this.getPromise(isRotated, 'rotate', clearRotate, 'Reset rotation'); await this.getPromise(hasNonDownloadableLayer, 'layers', hideLayers, 'Remove Layers?'); await openModal( diff --git a/web/js/modules/image-download/util.js b/web/js/modules/image-download/util.js index 14c143f076..c975bb458e 100644 --- a/web/js/modules/image-download/util.js +++ b/web/js/modules/image-download/util.js @@ -1,4 +1,5 @@ import { + each as lodashEach, get as lodashGet, } from 'lodash'; import { transform } from 'ol/proj'; @@ -178,21 +179,18 @@ export function imageUtilCalculateResolution( * @returns {array} array of layer ids * */ -export function imageUtilGetLayers(products, proj, activePalettes) { - const layers = products.map((layer) => { - let layerId = layer.id; +export function imageUtilGetLayers(products, proj) { + const layers = []; + lodashEach(products, (layer) => { if (layer.downloadId) { - layerId = layer.downloadId; + layers.push(layer.downloadId); } else if (layer.projections[proj].id) { - layerId = layer.projections[proj].id; + layers.push(layer.projections[proj].id); } else if (layer.projections[proj].layer) { - layerId = layer.projections[proj].layer; - } - const disabled = activePalettes?.[layer.id]?.maps?.[0]?.disabled; - if (Array.isArray(disabled)) { - return `${layerId}(disabled=${disabled.join('-')})`; + layers.push(layer.projections[proj].layer); + } else { + layers.push(layer.id); } - return layerId; }); return layers; } @@ -308,7 +306,7 @@ export function getTruncatedGranuleDates(layerDefs) { * @param {Boolean} isWorldfile * @param {Array} markerCoordinates */ -export function getDownloadUrl(url, proj, layerDefs, bbox, dimensions, dateTime, fileType, isWorldfile, markerCoordinates, activePalettes) { +export function getDownloadUrl(url, proj, layerDefs, bbox, dimensions, dateTime, fileType, isWorldfile, markerCoordinates) { const { crs } = proj.selected; const { layersArray, @@ -316,7 +314,7 @@ export function getDownloadUrl(url, proj, layerDefs, bbox, dimensions, dateTime, opacities, } = imageUtilProcessWrap( fileType, - imageUtilGetLayers(layerDefs, proj.id, activePalettes), + imageUtilGetLayers(layerDefs, proj.id), imageUtilGetLayerWrap(layerDefs), imageUtilGetLayerOpacities(layerDefs), ); @@ -325,7 +323,6 @@ export function getDownloadUrl(url, proj, layerDefs, bbox, dimensions, dateTime, const { height, width } = dimensions; const snappedDateTime = getLatestIntervalTime(layerDefs, dateTime); const granuleDates = getTruncatedGranuleDates(layerDefs).value; - const colormaps = layerDefs.map((layer) => layer.palette?.id); const params = [ 'REQUEST=GetSnapshot', `TIME=${util.toISOStringSeconds(snappedDateTime)}`, @@ -337,9 +334,6 @@ export function getDownloadUrl(url, proj, layerDefs, bbox, dimensions, dateTime, `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 e422b96b96..f791c7a497 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, undefined); + const dlURL = getDownloadUrl(url, proj, mockLayerDefs, lonlats, dimensions, dateTime, false, false, locationMarkers); const expectedURL = 'http://localhost:3002/api/v1/snapshot' + '?REQUEST=GetSnapshot' + '&TIME=2019-06-24T00:00:00Z' @@ -228,7 +228,6 @@ 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); }); diff --git a/web/js/modules/palettes/selectors.js b/web/js/modules/palettes/selectors.js index bc37141fe0..e3962bdba0 100644 --- a/web/js/modules/palettes/selectors.js +++ b/web/js/modules/palettes/selectors.js @@ -504,7 +504,3 @@ export function isPaletteAllowed(layerId, config) { } return Boolean(config.layers[layerId].palette); } - -export function getActivePalettes (state, activeString) { - return state.palettes[activeString]; -} From d2ad36d7bfb15e5be20e5ee2c9ed6d060d5cff33 Mon Sep 17 00:00:00 2001 From: PatchesMaps Date: Fri, 6 Dec 2024 09:29:00 -0500 Subject: [PATCH 2/2] v4.53.0-1 --- package-lock.json | 63 +++++++++++++++++++++++++++++++++++++++-------- package.json | 2 +- 2 files changed, 54 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 83ca8fb037..4b0ff1cf51 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "worldview", - "version": "4.52.0", + "version": "4.53.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "worldview", - "version": "4.52.0", + "version": "4.53.0", "hasInstallScript": true, "license": "NASA-1.3", "dependencies": { @@ -3207,7 +3207,9 @@ } }, "node_modules/@petamoriken/float16": { - "version": "3.7.1", + "version": "3.8.7", + "resolved": "https://registry.npmjs.org/@petamoriken/float16/-/float16-3.8.7.tgz", + "integrity": "sha512-/Ri4xDDpe12NT6Ex/DRgHzLlobiQXEW/hmG08w1wj/YU7hLemk97c+zHQFp0iZQ9r7YqgLEXZR2sls4HxBf9NA==", "license": "MIT" }, "node_modules/@pkgjs/parseargs": { @@ -5897,7 +5899,9 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "license": "MIT", "dependencies": { "path-key": "^3.1.0", @@ -6821,6 +6825,8 @@ }, "node_modules/earcut": { "version": "2.2.4", + "resolved": "https://registry.npmjs.org/earcut/-/earcut-2.2.4.tgz", + "integrity": "sha512-/pjZsA1b4RPHbeWZQn66SWS8nZZWLQQ23oE3Eam7aroEFGEvwKAsJfZ9ytiEMycfzXWpca4FA9QIOehf7PocBQ==", "license": "ISC" }, "node_modules/eastasianwidth": { @@ -8697,7 +8703,9 @@ "license": "MIT" }, "node_modules/geotiff": { - "version": "2.0.7", + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/geotiff/-/geotiff-2.1.3.tgz", + "integrity": "sha512-PT6uoF5a1+kbC3tHmZSUsLHBp2QJlHasxxxxPW47QIY1VBKpFB+FcDvX+MxER6UzgLQZ0xDzJ9s48B9JbOCTqA==", "license": "MIT", "dependencies": { "@petamoriken/float16": "^3.4.7", @@ -8706,7 +8714,8 @@ "parse-headers": "^2.0.2", "quick-lru": "^6.1.1", "web-worker": "^1.2.0", - "xml-utils": "^1.0.2" + "xml-utils": "^1.0.2", + "zstddec": "^0.1.0" }, "engines": { "node": ">=10.19" @@ -8714,10 +8723,14 @@ }, "node_modules/geotiff/node_modules/pako": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/pako/-/pako-2.1.0.tgz", + "integrity": "sha512-w+eufiZ1WuJYgPXbV/PO3NCMEc3xqylkKHzp8bxp1uW4qaSNQUkwmLLEc3kKsfz8lpV1F8Ht3U1Cm+9Srog2ug==", "license": "(MIT AND Zlib)" }, "node_modules/geotiff/node_modules/quick-lru": { - "version": "6.1.1", + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/quick-lru/-/quick-lru-6.1.2.tgz", + "integrity": "sha512-AAFUA5O1d83pIHEhJwWCq/RQcRukCkn/NSm2QsTEMle5f2hP0ChI2+3Xb051PZCkLryI/Ir1MVKviT2FIloaTQ==", "license": "MIT", "engines": { "node": ">=12" @@ -9307,6 +9320,8 @@ }, "node_modules/ieee754": { "version": "1.2.1", + "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", + "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", "funding": [ { "type": "github", @@ -11952,6 +11967,8 @@ }, "node_modules/lerc": { "version": "3.0.0", + "resolved": "https://registry.npmjs.org/lerc/-/lerc-3.0.0.tgz", + "integrity": "sha512-Rm4J/WaHhRa93nCN2mwWDZFoRVF18G1f47C+kvQWyHGEZxFpTUi73p7lMVSAndyxGt6lJ2/CFbOcf9ra5p8aww==", "license": "Apache-2.0" }, "node_modules/leven": { @@ -12764,7 +12781,9 @@ } }, "node_modules/npm-run-all/node_modules/cross-spawn": { - "version": "6.0.5", + "version": "6.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.6.tgz", + "integrity": "sha512-VqCUuhcd1iB+dsv8gxPttb5iZh/D0iubSP21g36KXdEuf6I5JiioesUVjpCdHV9MZRUfVFlvwtIUyPfxo5trtw==", "dev": true, "license": "MIT", "dependencies": { @@ -12961,6 +12980,8 @@ }, "node_modules/ol": { "version": "8.2.0", + "resolved": "https://registry.npmjs.org/ol/-/ol-8.2.0.tgz", + "integrity": "sha512-/m1ddd7Jsp4Kbg+l7+ozR5aKHAZNQOBAoNZ5pM9Jvh4Etkf0WGkXr9qXd7PnhmwiC1Hnc2Toz9XjCzBBvexfXw==", "license": "BSD-2-Clause", "dependencies": { "color-rgba": "^3.0.0", @@ -13179,6 +13200,8 @@ }, "node_modules/parse-headers": { "version": "2.0.5", + "resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.5.tgz", + "integrity": "sha512-ft3iAoLOB/MlwbNXgzy43SWGP6sQki2jQvAyBg/zDFAgr9bfNWZIUj42Kw2eJIl8kEi4PbgE6U1Zau/HwI75HA==", "license": "MIT" }, "node_modules/parse-import": { @@ -13466,6 +13489,8 @@ }, "node_modules/pbf": { "version": "3.2.1", + "resolved": "https://registry.npmjs.org/pbf/-/pbf-3.2.1.tgz", + "integrity": "sha512-ClrV7pNOn7rtmoQVF4TS1vyU0WhYRnP92fzbfF75jAIwpnzdJXf8iTd4CMEqO4yUenH6NDqLiwjqlh6QgZzgLQ==", "license": "BSD-3-Clause", "dependencies": { "ieee754": "^1.1.12", @@ -14326,6 +14351,8 @@ }, "node_modules/protocol-buffers-schema": { "version": "3.6.0", + "resolved": "https://registry.npmjs.org/protocol-buffers-schema/-/protocol-buffers-schema-3.6.0.tgz", + "integrity": "sha512-TdDRD+/QNdrCGCE7v8340QyuXd4kIWIgapsE2+n/SaGiSSbomYl4TjHlvIoCWRpE7wFt02EpB35VVA2ImcBVqw==", "license": "MIT" }, "node_modules/proxy-addr": { @@ -14429,6 +14456,8 @@ }, "node_modules/quickselect": { "version": "2.0.0", + "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz", + "integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==", "license": "ISC" }, "node_modules/quill-delta": { @@ -14480,6 +14509,8 @@ }, "node_modules/rbush": { "version": "3.0.1", + "resolved": "https://registry.npmjs.org/rbush/-/rbush-3.0.1.tgz", + "integrity": "sha512-XRaVO0YecOpEuIvbhbpTrZgoiI6xBlz6hnlr6EHhd+0x9ase6EmeN+hdwwUaJvLcsFFQ8iWVF1GAK1yB0BWi0w==", "license": "MIT", "dependencies": { "quickselect": "^2.0.0" @@ -15364,6 +15395,8 @@ }, "node_modules/resolve-protobuf-schema": { "version": "2.1.0", + "resolved": "https://registry.npmjs.org/resolve-protobuf-schema/-/resolve-protobuf-schema-2.1.0.tgz", + "integrity": "sha512-kI5ffTiZWmJaS/huM8wZfEMer1eRd7oJQhDuxeCLe3t7N7mX3z94CN0xPxBQxFYQTSNz9T0i+v6inKqSdK8xrQ==", "license": "MIT", "dependencies": { "protocol-buffers-schema": "^3.3.1" @@ -17639,7 +17672,9 @@ } }, "node_modules/web-worker": { - "version": "1.2.0", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/web-worker/-/web-worker-1.3.0.tgz", + "integrity": "sha512-BSR9wyRsy/KOValMgd5kMyr3JzpdeoR9KVId8u5GVlTTAtNChlsE4yTxeY7zMdNSyOmoKBv8NH2qeRY9Tg+IaA==", "license": "Apache-2.0" }, "node_modules/webidl-conversions": { @@ -18416,7 +18451,9 @@ } }, "node_modules/xml-utils": { - "version": "1.3.0", + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/xml-utils/-/xml-utils-1.10.1.tgz", + "integrity": "sha512-Dn6vJ1Z9v1tepSjvnCpwk5QqwIPcEFKdgnjqfYOABv1ngSofuAhtlugcUC3ehS1OHdgDWSG6C5mvj+Qm15udTQ==", "license": "CC0-1.0" }, "node_modules/xml2js": { @@ -18506,6 +18543,12 @@ "funding": { "url": "https://github.com/sponsors/sindresorhus" } + }, + "node_modules/zstddec": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/zstddec/-/zstddec-0.1.0.tgz", + "integrity": "sha512-w2NTI8+3l3eeltKAdK8QpiLo/flRAr2p8AGeakfMZOXBxOg9HIu4LVDxBi81sYgVhFhdJjv1OrB5ssI8uFPoLg==", + "license": "MIT AND BSD-3-Clause" } } } diff --git a/package.json b/package.json index 71367768e6..518a2449b9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "worldview", - "version": "4.52.0", + "version": "4.53.0", "description": "Interactive interface for browsing full-resolution, global satellite imagery", "keywords": [ "NASA",