Skip to content

Commit

Permalink
WV-2887 Preload Tour Story Imagery (no custom palettes) (#4935)
Browse files Browse the repository at this point in the history
* Most stories preloaded

* Custom palette issues

* Custom palette implemented

* Preloaded tour story imagery

* Changed variable names

* Refactored

* Preload only 1 step ahead

* Squashed commit of the following:

commit 8e1c506
Author: Ryan Weiler <[email protected]>
Date:   Fri Jan 26 07:53:29 2024 -0500

    dependency updates 1-19-24 (#4948)

commit f208caf
Author: Ryan Weiler <[email protected]>
Date:   Thu Jan 25 12:28:20 2024 -0500

    adjusting static map logic for EIC (#4949)

commit adfce43
Author: Ryan Weiler <[email protected]>
Date:   Thu Jan 25 11:30:51 2024 -0500

    Adding conditionals for E2E test notifications  (#4950)

    * refactoring e2e tests

    * update animation-test

    * update layer-picker-mobile-test

    * fix about modal test

commit eef0628
Merge: cffaddb f00bd59
Author: Tom Cariello <[email protected]>
Date:   Wed Jan 17 11:55:03 2024 -0500

    Merge pull request #4938 from nasa-gibs/main

    Main to Develop

commit f00bd59
Merge: c284750 cffaddb
Author: Tom Cariello <[email protected]>
Date:   Wed Jan 17 11:54:40 2024 -0500

    Merge branch 'develop' into main

commit c284750
Merge: dc8a020 f9f78fc
Author: Tom Cariello <[email protected]>
Date:   Wed Jan 17 11:51:09 2024 -0500

    Merge pull request #4937 from nasa-gibs/release

    Release to Main

commit cffaddb
Author: Ryan Weiler <[email protected]>
Date:   Wed Jan 17 10:48:33 2024 -0500

    WV-2957 Code Coverage Documentation (#4936)

    * e2e code coverage test documentation

    * remove nyc ouput

commit f9f78fc
Merge: 0f0c1b0 16bc2db
Author: Tom Cariello <[email protected]>
Date:   Tue Jan 16 13:57:35 2024 -0500

    Merge pull request #4933 from nasa-gibs/UAT-v4.24.0

    UAT v4.24.0

commit 16bc2db
Author: Tom Cariello <[email protected]>
Date:   Tue Jan 16 13:36:01 2024 -0500

    v4.24.0

commit a633c3a
Author: minniewong <[email protected]>
Date:   Tue Jan 16 10:40:38 2024 -0500

    Further updates to steps (#4932)

commit d7c4ddd
Author: minniewong <[email protected]>
Date:   Tue Jan 16 10:21:35 2024 -0500

    WV-3013: Fix dois and short names for AMSR-E and AMSR2 NSIDC layers (#4931)

    * Fix dois and short names

    * Update AU_OCEAN doi to working link

commit 6e749a1
Author: Ryan Weiler <[email protected]>
Date:   Fri Jan 12 13:28:06 2024 -0500

    update dependencies 1-12-24 (#4930)

commit 3719d40
Author: minniewong <[email protected]>
Date:   Fri Jan 12 12:19:32 2024 -0500

    WW-2655: OPERA Surface Water Extent story (#4921)

    * Initial steps

    * update story steps

    * hide surface water extent story in tour story box

    * update story text

    * Fix typos and add correct link for Step 5

    ---------

    Co-authored-by: ryanweiler92 <[email protected]>

commit 7485dfe
Merge: d355e56 7be844e
Author: Ryan Weiler <[email protected]>
Date:   Fri Jan 12 12:08:08 2024 -0500

    Merge pull request #4917 from nasa-gibs/wv-gitc-temp-measurement-settings-layers

    WV GITC Fix for measurement settings layers & handle errors when adjustingStart dates on load

commit 7be844e
Author: ryanweiler92 <[email protected]>
Date:   Wed Jan 10 12:05:33 2024 -0500

    handle adjusting startDate errors

commit d355e56
Merge: 7a82ea2 dc8a020
Author: Ryan Weiler <[email protected]>
Date:   Mon Jan 8 16:05:57 2024 -0500

    Merge pull request #4920 from nasa-gibs/main

    Main to Develop v4.23.1

commit dc8a020
Merge: bc7625a 0f0c1b0
Author: Ryan Weiler <[email protected]>
Date:   Mon Jan 8 15:29:48 2024 -0500

    Merge pull request #4919 from nasa-gibs/release

    Release to Main v4.23.1

commit 7a82ea2
Author: Patrick Moulden <[email protected]>
Date:   Mon Jan 8 13:57:54 2024 -0500

    Dependency Updates 01-05-2024 (#4918)

commit effb47d
Author: ryanweiler92 <[email protected]>
Date:   Mon Jan 8 12:37:45 2024 -0500

    check for layers in settings array that dont exist in config

commit 0f0c1b0
Merge: 94c3465 b0a36ce
Author: Ryan Weiler <[email protected]>
Date:   Mon Jan 8 11:59:57 2024 -0500

    Merge pull request #4916 from nasa-gibs/UAT-v4.23.1

    UAT-v4.23.1 to Release

commit b0a36ce
Author: ryanweiler92 <[email protected]>
Date:   Mon Jan 8 11:58:28 2024 -0500

    v4.23.1

commit b9a6ba0
Author: minniewong <[email protected]>
Date:   Mon Jan 8 10:33:28 2024 -0500

    Fixes for typos, extra spaces, missing parentheses (#4914)

    * Fixes for typos, extra spaces, missing parentheses

    * Update VIIRS_SNPP_Ice_Surface_Temp_Night.md

commit dc1a710
Author: Ryan Weiler <[email protected]>
Date:   Mon Jan 8 09:47:15 2024 -0500

    update axios (#4915)

commit b290693
Merge: 5a86501 bc7625a
Author: Ryan Weiler <[email protected]>
Date:   Wed Jan 3 14:56:07 2024 -0500

    Merge pull request #4908 from nasa-gibs/main

    Main to Develop v4.23.0

commit bc7625a
Merge: dee0b72 94c3465
Author: Ryan Weiler <[email protected]>
Date:   Wed Jan 3 14:52:23 2024 -0500

    Merge pull request #4907 from nasa-gibs/release

    Release to Main v4.23.0

commit 94c3465
Merge: 4a3e814 68b503a
Author: Ryan Weiler <[email protected]>
Date:   Wed Jan 3 13:12:34 2024 -0500

    Merge pull request #4906 from nasa-gibs/UAT-v4.23.0

    UAT v4.23.0 to Release

commit 68b503a
Author: ryanweiler92 <[email protected]>
Date:   Wed Jan 3 13:09:59 2024 -0500

    v4.23.0

commit 5a86501
Author: minniewong <[email protected]>
Date:   Wed Jan 3 12:18:37 2024 -0500

    update SMAP dois for new versions (#4905)

commit 97fe1c0
Author: Ryan Weiler <[email protected]>
Date:   Tue Jan 2 16:02:58 2024 -0500

    WV-2985: Removing Date for EIC Static Map Mode (#4904)

    * add resolutions section to package.json for follow-redirects version 1.15.4

    * hide date during eic static map

commit 0112037
Author: Ryan Weiler <[email protected]>
Date:   Tue Jan 2 14:45:53 2024 -0500

    WV-2981: Dynamically update subdomains for collection updates feature for GITC deployments (#4886)

    * use correct subdomain in collection updates for gitc deployments

    * update layer source lookup to use regex for subdomain resolver

commit ecb0ebe
Author: Ryan Weiler <[email protected]>
Date:   Tue Jan 2 10:20:43 2024 -0500

    add resolutions section to package.json for follow-redirects version 1.15.4 (#4903)

commit e8c5124
Author: christof-wittreich <[email protected]>
Date:   Fri Dec 29 10:07:41 2023 -0600

    dependabot updates 12-29-23 (#4902)

commit 61b6132
Author: minniewong <[email protected]>
Date:   Thu Dec 28 10:16:35 2023 -0500

    WV-2960: remove deployment link (#4891)

    * Removed deployment page and link; updated other misc

    * Update license.md

commit e5aa6c5
Author: minniewong <[email protected]>
Date:   Tue Dec 26 15:31:04 2023 -0500

    Update broken links (#4890)

    * Update broken links

    * Update MODIS_Aqua_L3_SST_MidIR_4km_Night_8Day.md

commit 0948ef8
Author: minniewong <[email protected]>
Date:   Tue Dec 26 14:48:59 2023 -0500

    WV-2571: Update copyright info to 2024 (#4889)

    * Update copyright info to 2024

    * Update LICENSE.md

commit e896b36
Author: Patrick Moulden <[email protected]>
Date:   Fri Dec 22 16:49:06 2023 -0500

    fix unrelated zots (#4885)

commit 1d38456
Author: Patrick Moulden <[email protected]>
Date:   Fri Dec 22 16:48:49 2023 -0500

    update local state with prop (#4884)

commit 37178cd
Author: Patrick Moulden <[email protected]>
Date:   Fri Dec 22 16:48:34 2023 -0500

    Wv 2977 comparison available imagery (#4887)

    * fix comparison mode

    * lint fix

commit 268e7c4
Author: minniewong <[email protected]>
Date:   Fri Dec 22 16:42:57 2023 -0500

    WV-2975: Add 4 TRMM/TMI and AMSRE LPRM soil moisture layers (#4888)

    * Add 4 LPRM and TMI Soil Moisture layers

    * Add LPRM descriptions

commit e53ac04
Author: minniewong <[email protected]>
Date:   Fri Dec 22 16:04:22 2023 -0500

    Update HLS Sentinel band combo; change title of EIC NOAA-20 fires (#4879)

commit f77d427
Author: Ryan Weiler <[email protected]>
Date:   Fri Dec 22 12:25:22 2023 -0500

    dependency updates 12-22-23 (#4883)

commit d578425
Merge: 8e21d62 dee0b72
Author: Tom Cariello <[email protected]>
Date:   Tue Dec 19 10:47:28 2023 -0500

    Merge pull request #4877 from nasa-gibs/main

    Main to Develop

commit dee0b72
Merge: 54d5419 4a3e814
Author: Tom Cariello <[email protected]>
Date:   Tue Dec 19 10:44:40 2023 -0500

    Merge pull request #4876 from nasa-gibs/release

    Release to main

commit 4a3e814
Merge: 419c90b 1efa98b
Author: Tom Cariello <[email protected]>
Date:   Tue Dec 19 08:44:30 2023 -0500

    Merge pull request #4875 from nasa-gibs/UAT-v4.22.0

    UAT v4.22.0

commit 1efa98b
Author: Thomas Cariello <[email protected]>
Date:   Tue Dec 19 08:42:42 2023 -0500

    v4.22.0

commit 8e21d62
Author: Patrick Moulden <[email protected]>
Date:   Mon Dec 18 21:19:59 2023 -0500

    Wv 2749 locate ddv imagery (#4614)

    * first pass at imagery search

    * lint fixes

    * add ImagerySearch to other layers

    * lint fixes

    * look for imagery closest to selected date

    * lint fix

    * sort dates and ensure closest img dates shown

    * tweak styles

    * remove true color presets

    * CR changes

    * lint fixes

    * css fix

    * lazy-load list for imagery dates

    * lint fixes

    * load dates seperately

    * remove old method

    * iteration on date lazy loading

    * remove trailing spaces

    * underzoom zot

    * imagery search enhancements

    * Zots and alerts

    * lint fixes

    * "destroy is not a function" fix

    * make zot lighter

    * resolve e2e zot test

    * modal

    * spacing fixes

    * tweak granule params

    * validate entries

    * zero out datetime

    * data to imagery

    * text changes

    * requested changes

    * shorten notices and enable opera layer

    * change how we get the concept id

    * style adjustments

    * update notice on date change

    * differentiate lazy-load list

    * remove notice after being dismissed once

    * only check visible layers

    * add divider

    * lint fix

    * Zoom alert modal

    * son't show granule alert if zoom alert is showing

    * clamp max extent and improved error handling

    * lint fixes

    * check for granules on visibility change

    * fix underzoom issue

    * structure changes

commit acbbfcc
Author: christof-wittreich <[email protected]>
Date:   Fri Dec 15 08:23:13 2023 -0600

    dependabot updates 12-15-23 (#4874)
  • Loading branch information
christof-wittreich authored Jan 29, 2024
1 parent 1ffea3f commit 755c0cc
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 6 deletions.
59 changes: 56 additions & 3 deletions web/js/containers/tour.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ import {
import {
clearCustoms,
} from '../modules/palettes/actions';
import { BULK_PALETTE_RENDERING_SUCCESS } from '../modules/palettes/constants';
import {
BULK_PALETTE_RENDERING_SUCCESS,
BULK_PALETTE_PRELOADING_SUCCESS,
} from '../modules/palettes/constants';
import { stop as stopAnimation } from '../modules/animation/actions';
import { onClose as closeModal } from '../modules/modal/actions';
import { LOCATION_POP_ACTION } from '../redux-location-state-customs';
Expand All @@ -39,6 +42,7 @@ import { changeTab as changeTabAction } from '../modules/sidebar/actions';
import ErrorBoundary from './error-boundary';
import history from '../main';
import util from '../util/util';
import { promiseImageryForTour } from '../modules/map/util';

const { HIDE_TOUR } = safeLocalStorage.keys;

Expand All @@ -51,6 +55,14 @@ const getTransitionAttr = function(transition) {
return '';
};

const prepareLayersList = function(layersString, config) {
let layers;
layers = layersParse12(layersString, config);
layers = uniqBy(layers, 'id');
layers = layers.filter((layer) => !layer.custom && !layer.disabled);
return layers;
};

class Tour extends React.Component {
constructor(props) {
super(props);
Expand Down Expand Up @@ -138,7 +150,7 @@ class Tour extends React.Component {

selectTour(e, currentStory, currentStoryIndex, currentStoryId) {
const {
config, renderedPalettes, selectTour, processStepLink, isKioskModeActive, isEmbedModeActive,
config, renderedPalettes, selectTour, processStepLink, isKioskModeActive, isEmbedModeActive, preProcessStepLink, promiseImageryForTour,
} = this.props;
if (e) e.preventDefault();
const kioskParam = this.getKioskParam(isKioskModeActive);
Expand All @@ -165,6 +177,11 @@ class Tour extends React.Component {
config,
renderedPalettes,
);
preProcessStepLink(
`${currentStory.steps[1].stepLink}&tr=${currentStoryId}${transitionParam}${kioskParam}&em=${isEmbedModeActive}`,
config,
promiseImageryForTour,
);
}

fetchMetadata(currentStory, stepIndex) {
Expand Down Expand Up @@ -243,7 +260,7 @@ class Tour extends React.Component {
currentStoryId,
} = this.state;
const {
config, renderedPalettes, processStepLink, isKioskModeActive, activeTab, changeTab, isEmbedModeActive,
config, renderedPalettes, processStepLink, isKioskModeActive, activeTab, changeTab, isEmbedModeActive, preProcessStepLink, promiseImageryForTour,
} = this.props;
const kioskParam = this.getKioskParam(isKioskModeActive);

Expand All @@ -264,6 +281,13 @@ class Tour extends React.Component {
config,
renderedPalettes,
);
if (currentStep + 2 <= totalSteps) {
preProcessStepLink(
`${currentStory.steps[newStep].stepLink}&tr=${currentStoryId}${transitionParam}${kioskParam}&em=${isEmbedModeActive}`,
config,
promiseImageryForTour,
);
}
}
if (currentStep + 1 === totalSteps + 1) {
this.toggleModalInProgress(e);
Expand Down Expand Up @@ -522,6 +546,33 @@ const mapDispatchToProps = (dispatch) => ({
dispatch({ type: LOCATION_POP_ACTION, payload: location });
}
},
preProcessStepLink: async (search, config, promiseImageryForTour) => {
search = search.split('/?').pop();
const parameters = util.fromQueryString(search);
let layersA = [];
let layersB = [];
const promisesParams = [];

if (parameters.l) {
layersA = prepareLayersList(parameters.l, config);
promisesParams.push({ layers: layersA, dateString: parameters.t });
}
if (parameters.l1) {
layersB = prepareLayersList(parameters.l1, config);
promisesParams.push({ layers: layersB, dateString: parameters.t1, activeString: 'activeB' });
}
preloadPalettes([...layersA, ...layersB], {}, false).then(async (obj) => {
await dispatch({
type: BULK_PALETTE_PRELOADING_SUCCESS,
tourStoryPalettes: obj.rendered,
});
const promises = [];
promisesParams.forEach((set) => {
promises.push(promiseImageryForTour(set.layers, set.dateString, set.activeString));
});
await Promise.all(promises);
});
},
startTour: () => {
dispatch(startTourAction());
},
Expand Down Expand Up @@ -561,6 +612,7 @@ const mapStateToProps = (state) => {
screenHeight,
renderedPalettes: palettes.rendered,
activeTab: sidebar.activeTab,
promiseImageryForTour: (layers, dateString, activeString) => promiseImageryForTour(state, layers, dateString, activeString),
};
};

Expand All @@ -582,6 +634,7 @@ Tour.propTypes = {
isActive: PropTypes.bool,
isKioskModeActive: PropTypes.bool,
processStepLink: PropTypes.func,
preProcessStepLink: PropTypes.func,
renderedPalettes: PropTypes.object,
resetProductPicker: PropTypes.func,
screenHeight: PropTypes.number,
Expand Down
2 changes: 1 addition & 1 deletion web/js/map/layerbuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ export default function mapLayerBuilder(config, cache, store) {
previousDate,
} = getRequestDates(def, options);
const date = closestDate;
if (date) {
if (date && !options.date) {
options.date = date;
}
const dateOptions = { date, nextDate, previousDate };
Expand Down
41 changes: 41 additions & 0 deletions web/js/modules/map/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import OlRendererCanvasTileLayer from 'ol/renderer/canvas/TileLayer';
import Promise from 'bluebird';
import { encode } from '../link/util';
import { getActiveVisibleLayersAtDate } from '../layers/selectors';
import { tryCatchDate } from '../date/util';

/*
* Set default extent according to time of day:
Expand Down Expand Up @@ -305,3 +306,43 @@ export async function promiseImageryForTime(state, date, activeString) {
selected.getView().changed();
return date;
}

/**
* Trigger tile requests for all given layers on a given date.
* @method promiseImageryForTour
*/
export async function promiseImageryForTour(state, layers, dateString, activeString) {
const { map } = state;
if (!map.ui.proj) return;
const {
cache, selected, createLayer, layerKey,
} = map.ui;
const appNow = lodashGet(state, 'date.appNow');
const date = tryCatchDate(dateString, appNow);
await Promise.all(layers.map(async (layer) => {
if (layer.type === 'granule' || layer.type === 'ttiler') {
return Promise.resolve();
}
const options = { date, group: activeString || 'active' };
const keys = [];
if (layer.custom) {
keys.push(`palette=${layer.custom}`);
}
if (layer.min) {
keys.push(`min=${layer.min}`);
}
if (layer.max) {
keys.push(`max=${layer.max}`);
}
if (layer.squash) {
keys.push('squash');
}
if (keys.length > 0) {
options.style = keys.join(',');
}

const key = layerKey(layer, options, state);
const layerGroup = cache.getItem(key) || await createLayer(layer, options);
return promiseLayerGroup(layerGroup, selected);
}));
}
1 change: 1 addition & 0 deletions web/js/modules/palettes/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const CLEAR_CUSTOMS = 'PALETTES/CLEAR_CUSTOMS';
export const SET_CUSTOM = 'PALETTES/SET_CUSTOM';
export const LOADED_CUSTOM_PALETTES = 'PALETTES/LOADED_CUSTOM_PALETTES';
export const BULK_PALETTE_RENDERING_SUCCESS = 'PALETTES/BULK_PALETTE_RENDERING_SUCCESS';
export const BULK_PALETTE_PRELOADING_SUCCESS = 'PALETTES/BULK_PALETTE_PRELOADING_SUCCESS';

export const PALETTE_STRINGS_PERMALINK_ARRAY = [
'palette',
Expand Down
6 changes: 6 additions & 0 deletions web/js/modules/palettes/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
SET_THRESHOLD_RANGE_AND_SQUASH,
LOADED_CUSTOM_PALETTES,
BULK_PALETTE_RENDERING_SUCCESS,
BULK_PALETTE_PRELOADING_SUCCESS,
CLEAR_CUSTOM,
SET_DISABLED_CLASSIFICATION,
} from './constants';
Expand All @@ -23,6 +24,7 @@ export const defaultPaletteState = {
active: {},
activeB: {},
isLoading: {},
tourStoryPalettes: {},
};
export function getInitialPaletteState(config) {
const rendered = lodashGet(config, 'palettes.rendered') || {};
Expand All @@ -46,6 +48,10 @@ export function paletteReducer(state = defaultPaletteState, action) {
return update(state, {
rendered: { $merge: action.rendered || {} },
});
case BULK_PALETTE_PRELOADING_SUCCESS:
return update(state, {
tourStoryPalettes: { $merge: action.tourStoryPalettes || {} },
});
case REQUEST_PALETTE_SUCCESS: {
const isLoading = update(state.isLoading, { $unset: [action.id] });
return lodashAssign({}, state, {
Expand Down
5 changes: 3 additions & 2 deletions web/js/modules/palettes/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,15 +350,16 @@ export function getKey(layerId, groupStr, state) {
return '';
}
const def = getPalette(layerId, undefined, groupStr, state);
const { values } = getPalette(layerId, 0, groupStr, state).entries;
const keys = [];
if (def.custom) {
keys.push(`palette=${def.custom}`);
}
if (def.min) {
keys.push(`min=${def.min}`);
keys.push(`min=${getMinValue(values[def.min])}`);
}
if (def.max) {
keys.push(`max=${def.max}`);
keys.push(`max=${getMinValue(values[def.max])}`);
}
if (def.squash) {
keys.push('squash');
Expand Down

0 comments on commit 755c0cc

Please sign in to comment.