Skip to content

Commit

Permalink
[Backport 3.3.x][Fixes #756] Timing issues with timeline histogram in…
Browse files Browse the repository at this point in the history
…itialization (#761)

* include epics needed for timeline at app initialization

* update client bundle
  • Loading branch information
allyoucanmap authored Jan 28, 2022
1 parent 1cf0b71 commit 7392ac9
Show file tree
Hide file tree
Showing 300 changed files with 160 additions and 137 deletions.
22 changes: 13 additions & 9 deletions geonode_mapstore_client/client/js/apps/gn-dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ import {
setupConfiguration,
getVersion,
initializeApp,
getPluginsConfiguration
getPluginsConfiguration,
storeEpicsCache
} from '@js/utils/AppUtils';
import pluginsDefinition from '@js/plugins/index';
import ReactSwipe from 'react-swipeable-views';
Expand Down Expand Up @@ -87,6 +88,16 @@ document.addEventListener('DOMContentLoaded', function() {
permissions
} = setupConfiguration({ localConfig, user });

const appEpics = {
...configEpics,
// epics related to dashboard are imported at root levele
// because of the use of initial action
// in particular `dashboardLoaded`
...widgetsEpics,
...dashboardEpics
};
storeEpicsCache(appEpics);

main({
targetId,
appComponent: withRoutes(routes)(ConnectedRouter),
Expand Down Expand Up @@ -125,14 +136,7 @@ document.addEventListener('DOMContentLoaded', function() {
maptype,
widgets
},
appEpics: {
...configEpics,
// epics related to dashboard are imported at root levele
// because of the use of initial action
// in particular `dashboardLoaded`
...widgetsEpics,
...dashboardEpics
},
appEpics,
onStoreInit,
initialActions: [
// add some settings in the global state to make them accessible in the monitor state
Expand Down
11 changes: 7 additions & 4 deletions geonode_mapstore_client/client/js/apps/gn-geostory.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ import {
setupConfiguration,
getVersion,
initializeApp,
getPluginsConfiguration
getPluginsConfiguration,
storeEpicsCache
} from '@js/utils/AppUtils';
import pluginsDefinition from '@js/plugins/index';
import ReactSwipe from 'react-swipeable-views';
Expand Down Expand Up @@ -147,6 +148,10 @@ document.addEventListener('DOMContentLoaded', function() {
}
: geoNodePageConfig.resourceConfig;

const appEpics = {
...configEpics
};
storeEpicsCache(appEpics);
main({
targetId,
appComponent: withRoutes(routes)(ConnectedRouter),
Expand Down Expand Up @@ -197,9 +202,7 @@ document.addEventListener('DOMContentLoaded', function() {
security,
maptype
},
appEpics: {
...configEpics
},
appEpics,
onStoreInit,
initialActions: [
// add some settings in the global state to make them accessible in the monitor state
Expand Down
25 changes: 16 additions & 9 deletions geonode_mapstore_client/client/js/apps/gn-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ import {
setupConfiguration,
getVersion,
initializeApp,
getPluginsConfiguration
getPluginsConfiguration,
storeEpicsCache
} from '@js/utils/AppUtils';

import {
Expand All @@ -62,6 +63,7 @@ import {
gnCheckSelectedLayerPermissions,
gnSetLayersPermissions
} from '@js/epics';
import timelineEpics from '@mapstore/framework/epics/timeline';
import maplayout from '@mapstore/framework/reducers/maplayout';
import 'react-widgets/dist/css/react-widgets.css';
import 'react-select/dist/react-select.css';
Expand Down Expand Up @@ -115,6 +117,18 @@ document.addEventListener('DOMContentLoaded', function() {
const mapLayout = getConfigProp('mapLayout') || {};
setConfigProp('mapLayout', mapLayout[query.theme] || mapLayout[pluginsConfigKey] || mapLayout.viewer);

const appEpics = {
...standardEpics,
...configEpics,
updateMapLayoutEpic,
gnCheckSelectedLayerPermissions,
gnSetLayersPermissions,
...pluginsDefinition.epics,
// needed to initialize the correct time range
...timelineEpics
};

storeEpicsCache(appEpics);
// register custom arcgis layer
import('@js/components/' + mapType + '/ArcGisMapServer')
.then(() => {
Expand Down Expand Up @@ -178,14 +192,7 @@ document.addEventListener('DOMContentLoaded', function() {
annotations,
...pluginsDefinition.reducers
},
appEpics: {
...standardEpics,
...configEpics,
updateMapLayoutEpic,
gnCheckSelectedLayerPermissions,
gnSetLayersPermissions,
...pluginsDefinition.epics
},
appEpics,
initialActions: [
// add some settings in the global state to make them accessible in the monitor state
// later we could use expression in localConfig
Expand Down
6 changes: 3 additions & 3 deletions geonode_mapstore_client/client/js/hooks/useLazyPlugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import isEmpty from 'lodash/isEmpty';
import { getPlugins, createPlugin, isMapStorePlugin } from '@mapstore/framework/utils/PluginsUtils';
import { augmentStore } from '@mapstore/framework/utils/StateUtils';
import join from 'lodash/join';
import { getEpicCache, setEpicCache } from '@js/utils/AppUtils';

function filterRemoved(registry, removed = []) {
return Object.keys(registry).reduce((acc, p) => {
Expand All @@ -26,7 +27,6 @@ function filterRemoved(registry, removed = []) {

let storedPlugins = {};
const pluginsCache = {};
const epicsCache = {};
const reducersCache = {};

function useLazyPlugins({
Expand Down Expand Up @@ -78,10 +78,10 @@ function useLazyPlugins({
// so we need to filter out the one previously added and include only new one
const filterOutExistingEpics = Object.keys(epics)
.reduce((acc, key) => {
if (epicsCache[key]) {
if (getEpicCache(key)) {
return acc;
}
epicsCache[key] = true;
setEpicCache(key);
return {
...acc,
[key]: epics[key]
Expand Down
10 changes: 10 additions & 0 deletions geonode_mapstore_client/client/js/utils/AppUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,18 @@ import isString from 'lodash/isString';
import url from 'url';
import axios from '@mapstore/framework/libs/ajax';

let epicsCache = {};
let actionListeners = {};

export const storeEpicsCache = (epics) => {
Object.keys(epics).forEach((key) => {
epicsCache[key] = true;
});
};

export const getEpicCache = (name) => epicsCache[name];
export const setEpicCache = (name) => { epicsCache[name] = true; };

export function getVersion() {
if (!__DEVTOOLS__) {
return __MAPSTORE_PROJECT_CONFIG__.version;
Expand Down
2 changes: 1 addition & 1 deletion geonode_mapstore_client/client/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
geonode-mapstore-client-v3.3.0-2ac0b447edf34d25283fd67ffbdcc3f0d8082b73
geonode-mapstore-client-v3.3.0-91f1e52b3b182838c3e9d304be9e3a7afac70942

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

Loading

0 comments on commit 7392ac9

Please sign in to comment.