Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

retain data-download in permalink -- redux

Benjamin King00a9d5576004
diff --git a/web/js/location.js b/web/js/location.js
index ecb553c4b..ca59f0b6d 100644
--- a/web/js/location.js
+++ b/web/js/location.js
@@ -366,7 +366,8 @@ const getParameters = function(config, parameters) {
return id;
},
serialize: (currentItemState, state) => {
- if (!state.sidebar.activeTab !== 'download') return undefined;
+ if (state.sidebar.activeTab !== 'download') return undefined;
+ console.log(encode(currentItemState));
return encode(currentItemState);
}
}
diff --git a/web/js/map/data/cmr.js b/web/js/map/data/cmr.js
index 257a27a44..e045c6cd6 100644
--- a/web/js/map/data/cmr.js
+++ b/web/js/map/data/cmr.js
@@ -23,7 +23,7 @@ export function dataCmrClient(spec, store) {
};
var init = function() {
- ns.ajax = util.ajaxCache();
+ ns.ajax = util.ajaxCache(100);
};
self.submit = function(parameters) {
@@ -57,7 +57,6 @@ export function dataCmrClient(spec, store) {
59
)
);
-
startTime = startTime.toISOString();
endTime = endTime.toISOString();
queryParameters.data.temporal = startTime + ',' + endTime;
diff --git a/web/js/map/data/ui.js b/web/js/map/data/ui.js
index 55860a6c6..8f37c5ec4 100644
--- a/web/js/map/data/ui.js
+++ b/web/js/map/data/ui.js
@@ -118,11 +118,13 @@ export function dataUi(store, ui, config) {
}
};
var init = function() {
+ const sidebarState = store.getState().sidebar;
store.subscribe(subscribeToStore);
self.events.on('query', onQuery)
.on('queryResults', onQueryResults)
.on('queryError', onQueryError)
.on('queryTimeout', onQueryTimeout);
+ if (sidebarState.activeTab === 'download') onActivate();
};
self.onViewChange = function() {
const state = store.getState();
diff --git a/web/js/map/model.js b/web/js/map/model.js
index 8d2ad1a01..a08d2a260 100644
--- a/web/js/map/model.js
+++ b/web/js/map/model.js
@@ -4,7 +4,6 @@ import { register } from 'ol/proj/proj4';
import proj4 from 'proj4';
import lodashClone from 'lodash/clone';
import { intersects } from 'ol/extent';
-import Cache from 'cachai';
export function mapModel(models, config) {
var self = {};
@@ -12,7 +11,6 @@ export function mapModel(models, config) {
self.extent = null;
self.selectedMap = null;
self.events = util.events();
- self.cache = new Cache(400);
self.ui = null;
self.rotation = 0;
const init = function() {
diff --git a/web/js/map/ui.js b/web/js/map/ui.js
index 37cb2288f..ca4d57af8 100644
--- a/web/js/map/ui.js
+++ b/web/js/map/ui.js
@@ -31,6 +31,7 @@ import { CALCULATE_RESPONSIVE_STATE } from 'redux-responsive';
import { LOCATION_POP_ACTION } from '../redux-location-state-customs';
import { CHANGE_PROJECTION } from '../modules/projection/constants';
import { SELECT_DATE } from '../modules/date/constants';
+import Cache from 'cachai';
import * as layerConstants from '../modules/layers/constants';
import * as compareConstants from '../modules/compare/constants';
import * as paletteConstants from '../modules/palettes/constants';
@@ -51,7 +52,7 @@ export function mapui(models, config, store, ui) {
var selector = '#' + id;
var animationDuration = 250;
var self = {};
- var cache = models.map.cache;// Save layers from days visited
+ var cache;
var rotation = new MapRotate(self, models, store);
var dateline = mapDateLineBuilder(models, config, store);
var precache = mapPrecacheTile(models, config, cache, self);
@@ -61,6 +62,7 @@ export function mapui(models, config, store, ui) {
compareMapUi,
store
));
+ cache = self.cache = new Cache(400);
self.mapIsbeingDragged = false;
self.mapIsbeingZoomed = false;
self.proj = {}; // One map for each projection
diff --git a/web/js/modules/map/util.js b/web/js/modules/map/util.js
index 30d878f86..7ec04d90f 100644
--- a/web/js/modules/map/util.js
+++ b/web/js/modules/map/util.js
@@ -119,9 +119,9 @@ export function promiseImageryForTime(date, layers, state) {
var pixelRatio;
var promiseArray;
const map = state.legacy.map;
- var cache = map.cache;
+ var cache = map.ui.cache;
var mapUi = map.ui;
- var selectedMap = map.selectedMap;
+ var selectedMap = map.ui.selected;
frameState = selectedMap.frameState_; // OL object describing the current map frame
pixelRatio = frameState.pixelRatio;