Skip to content

Kepler.gl is a powerful open source geospatial analysis tool for large-scale data sets.

[Enhancement]: Added uiStateUpdater showDatasetTable in order to intercept showDatasetTable action (#1363)

Shan Hec77266806804
diff --git a/src/components/side-panel.js b/src/components/side-panel.js
index 20f97c184..0ec4c2f00 100644
--- a/src/components/side-panel.js
+++ b/src/components/side-panel.js
@@ -36,7 +36,6 @@ import CustomPanelsFactory from './side-panel/custom-panel';
import {
ADD_DATA_ID,
ADD_MAP_STYLE_ID,
- DATA_TABLE_ID,
EXPORT_DATA_ID,
EXPORT_MAP_ID,
SHARE_MAP_ID,
@@ -132,9 +131,7 @@ export default function SidePanelFactory(
};
_showDatasetTable = dataId => {
- // this will open data table modal
this.props.visStateActions.showDatasetTable(dataId);
- this.props.uiStateActions.toggleModal(DATA_TABLE_ID);
};
_showAddDataModal = () => {
diff --git a/src/reducers/ui-state-updaters.d.ts b/src/reducers/ui-state-updaters.d.ts
index 313cefe0a..c8842f988 100644
--- a/src/reducers/ui-state-updaters.d.ts
+++ b/src/reducers/ui-state-updaters.d.ts
@@ -174,6 +174,9 @@ export function setExportMapHTMLModeUpdater(
state: UiState,
action: UiStateActions.SetExportHTMLMapModeUpdaterAction
): UiState;
+export function showDatasetTableUpdater(
+ state: UiState
+)
export function setLocaleUpdater(
state: UiState,
action: UiStateActions.SetLocaleUpdaterAction
diff --git a/src/reducers/ui-state-updaters.js b/src/reducers/ui-state-updaters.js
index 4349cacf2..8561c839d 100644
--- a/src/reducers/ui-state-updaters.js
+++ b/src/reducers/ui-state-updaters.js
@@ -21,6 +21,7 @@
// @ts-nocheck
import {
ADD_DATA_ID,
+ DATA_TABLE_ID,
DEFAULT_NOTIFICATION_TOPICS,
DELETE_DATA_ID,
EXPORT_DATA_TYPE,
@@ -704,6 +705,16 @@ export const toggleSplitMapUpdater = state => ({
)
});
+/**
+ * Toggle modal data
+ * @memberof uiStateUpdaters
+ * @param state
+ * @returns nextState
+ * @type {typeof import('./ui-state-updaters').showDatasetTableUpdater}
+ * @public
+ */
+export const showDatasetTableUpdater = state => toggleModalUpdater(state, {payload: DATA_TABLE_ID});
+
/**
* Set the locale of the UI
* @memberof uiStateUpdaters
diff --git a/src/reducers/ui-state.js b/src/reducers/ui-state.js
index 3185adc13..4fdb91dd8 100644
--- a/src/reducers/ui-state.js
+++ b/src/reducers/ui-state.js
@@ -56,6 +56,7 @@ const actionHandler = {
[ActionTypes.LOAD_FILES_ERR]: uiStateUpdaters.loadFilesErrUpdater,
[ActionTypes.TOGGLE_SPLIT_MAP]: uiStateUpdaters.toggleSplitMapUpdater,
+ [ActionTypes.SHOW_DATASET_TABLE]: uiStateUpdaters.showDatasetTableUpdater,
[ActionTypes.SET_LOCALE]: uiStateUpdaters.setLocaleUpdater
};