Skip to content

Commit 6a92a81

Browse files
authored
#2119 - Update client to show exported data from layer download (#2120)
1 parent c8696da commit 6a92a81

File tree

2 files changed

+33
-7
lines changed

2 files changed

+33
-7
lines changed

geonode_mapstore_client/client/js/plugins/ActionNavbar/buttons.jsx

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
import React, { useRef } from 'react';
99
import { PropTypes } from 'prop-types';
1010
import { connect } from 'react-redux';
11-
import { createSelector } from 'reselect';
11+
import { createSelector, createStructuredSelector } from 'reselect';
1212
import usePluginItems from '@mapstore/framework/hooks/usePluginItems';
1313
import {
14-
setControlProperty
14+
setControlProperty,
15+
toggleControl
1516
} from '@mapstore/framework/actions/controls';
1617
import {
1718
toggleFullscreen
@@ -27,6 +28,10 @@ import { isDashboardEditing } from '@mapstore/framework/selectors/dashboard';
2728
import { createWidget } from '@mapstore/framework/actions/widgets';
2829
import { getResourceData, getSelectedLayerDataset } from '@js/selectors/resource';
2930
import { GXP_PTYPES } from '@js/utils/ResourceUtils';
31+
import { exportDataResultsControlEnabledSelector, checkingExportDataEntriesSelector, exportDataResultsSelector } from '@mapstore/framework/selectors/layerdownload';
32+
import { currentLocaleSelector } from '@mapstore/framework/selectors/locale';
33+
import { checkExportDataEntries, removeExportDataResult } from '@mapstore/framework/actions/layerdownload';
34+
import ExportDataResultsComponent from '@mapstore/framework/components/data/download/ExportDataResultsComponent';
3035

3136
// buttons override to use in ActionNavbar for plugin imported from mapstore
3237

@@ -129,6 +134,17 @@ export const LayerDownloadActionButton = connect(
129134
{ onClick: setControlProperty.bind(null, 'layerdownload', 'enabled', true, true) }
130135
)(LayerDownloadActionButtonComponent);
131136

137+
export const LayerDownloadExportDataResultsComponent = connect(createStructuredSelector({
138+
active: exportDataResultsControlEnabledSelector,
139+
checkingExportDataEntries: checkingExportDataEntriesSelector,
140+
results: exportDataResultsSelector,
141+
currentLocale: currentLocaleSelector
142+
}), {
143+
onToggle: toggleControl.bind(null, 'exportDataResults', 'enabled'),
144+
onActive: checkExportDataEntries,
145+
onRemoveResult: removeExportDataResult
146+
})(ExportDataResultsComponent);
147+
132148
export const FilterLayerActionButton = connect(
133149
(state) => ({
134150
layer: getSelectedLayer(state)

geonode_mapstore_client/client/js/plugins/index.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import {
1111
LayerDownloadActionButton,
1212
FilterLayerActionButton,
1313
FullScreenActionButton,
14-
AddWidgetActionButton
14+
AddWidgetActionButton,
15+
LayerDownloadExportDataResultsComponent
1516
} from '@js/plugins/ActionNavbar/buttons';
1617
import { getPluginsContext } from '@js/utils/PluginsContextUtils';
1718
import { toModulePlugin as msToModulePlugin } from '@mapstore/framework/utils/ModulePluginsUtils';
@@ -89,10 +90,18 @@ export const plugins = {
8990
Component: LayerDownloadActionButton,
9091
position: 11
9192
},
92-
ActionNavbar: {
93-
name: 'LayerDownload',
94-
Component: LayerDownloadActionButton
95-
}
93+
ActionNavbar: [
94+
{
95+
name: 'LayerDownload',
96+
Component: LayerDownloadActionButton
97+
},
98+
{
99+
name: 'LayerDownload',
100+
Component: LayerDownloadExportDataResultsComponent,
101+
position: 1,
102+
target: 'right-menu'
103+
}
104+
]
96105
}
97106
}
98107
}
@@ -169,6 +178,7 @@ export const plugins = {
169178
name: 'FullScreen',
170179
Component: FullScreenActionButton,
171180
priority: 5,
181+
position: 2,
172182
target: 'right-menu'
173183
}
174184
}

0 commit comments

Comments
 (0)