@opengeoweb/workspace 9.29.1 → 9.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.js +142 -119
- package/package.json +1 -1
- package/src/index.d.ts +1 -1
- package/src/lib/store/workspace/reducer.d.ts +2 -2
- package/src/lib/store/workspace/types.d.ts +4 -0
- package/src/lib/store/workspaceList/listener.d.ts +1 -1
- package/src/lib/store/workspaceList/types.d.ts +13 -2
- package/src/lib/store/workspaceList/utils.d.ts +8 -4
- package/src/lib/utils/i18n.d.ts +2 -2
package/index.esm.js
CHANGED
|
@@ -4,20 +4,20 @@ import { syncGroupsTypes, syncGroupsActions, layerActions, mapStoreActions, uiAc
|
|
|
4
4
|
import { createApiInstance, createNonAuthApiInstance, getApi, createFakeApiInstance, ApiProvider, useApiContext } from '@opengeoweb/api';
|
|
5
5
|
import { getLeaves, MosaicContext, getAndAssertNodeAtPathExists, createBalancedTreeFromLeaves, MosaicWindow, Mosaic } from 'react-mosaic-component';
|
|
6
6
|
import { timeSeriesActions, TimeSeriesTypes, timeSeriesSelectors, timeSeriesModuleConfig } from '@opengeoweb/timeseries';
|
|
7
|
-
import {
|
|
7
|
+
import { PROJECTION, getAxiosErrorMessage, isAxiosAuthError, isAxiosError as isAxiosError$1, SHARED_NAMESPACE, sharedTranslations, withEggs, ConfirmationServiceProvider, useConfirmationDialog, CustomIconButton, AlertBanner, CustomTooltip, SearchHighlight, ToggleMenu, DEFAULT_FILTER_HEIGHT, usePrevious, Filter, Resizable, ToolContainer, renderCounter, CustomToggleButton, ConfirmationDialog } from '@opengeoweb/shared';
|
|
8
8
|
import { snackbarTypes, snackbarActions, SnackbarWrapperConnect } from '@opengeoweb/snackbar';
|
|
9
|
-
import i18n from 'i18next';
|
|
10
|
-
import { WEBMAP_REACT_NAMESPACE, webmapReactTranslations } from '@opengeoweb/webmap-react';
|
|
11
|
-
import { initReactI18next, useTranslation, I18nextProvider } from 'react-i18next';
|
|
12
|
-
import { CORE_NAMESPACE, coreTranslations } from '@opengeoweb/core';
|
|
13
|
-
import { FORM_FIELDS_NAMESPACE, formFieldsTranslations, ReactHookFormTextField, ReactHookFormHiddenInput, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
|
|
14
9
|
import { isAxiosError } from 'axios';
|
|
15
10
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
16
11
|
import { ThemeWrapper, lightTheme, SplitVertical, SplitHorizontal, Expand, UnExpand, Close, Delete, Preset, PresetWorkspace, PresetTiles, CloudLoading, CloudIdle, WebAssetOff, Exclamation } from '@opengeoweb/theme';
|
|
17
12
|
import { Provider, useDispatch, useSelector, useStore, shallowEqual } from 'react-redux';
|
|
13
|
+
import { initReactI18next, useTranslation, I18nextProvider } from 'react-i18next';
|
|
18
14
|
import { AuthenticationProvider, useAuthenticationContext, GEOWEB_ROLE_PRESETS_ADMIN } from '@opengeoweb/authentication';
|
|
19
15
|
import { createStore } from '@redux-eggs/redux-toolkit';
|
|
20
16
|
import { produce } from 'immer';
|
|
17
|
+
import i18n from 'i18next';
|
|
18
|
+
import { WEBMAP_REACT_NAMESPACE, webmapReactTranslations } from '@opengeoweb/webmap-react';
|
|
19
|
+
import { CORE_NAMESPACE, coreTranslations } from '@opengeoweb/core';
|
|
20
|
+
import { FORM_FIELDS_NAMESPACE, formFieldsTranslations, ReactHookFormTextField, ReactHookFormHiddenInput, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
|
|
21
21
|
import * as React from 'react';
|
|
22
22
|
import React__default, { useCallback } from 'react';
|
|
23
23
|
import { LinearProgress, Typography, ListItem, ListItemButton, ListItemIcon, ListItemText, Grid2, Box, Backdrop, Menu, ListSubheader, MenuItem, useTheme, FormGroup, FormControlLabel, Checkbox, Tabs } from '@mui/material';
|
|
@@ -3633,53 +3633,6 @@ const getPresetTitle = (title, hasChanges, isNew, t) => {
|
|
|
3633
3633
|
return `${title} (${suffix})`;
|
|
3634
3634
|
};
|
|
3635
3635
|
|
|
3636
|
-
const WORKSPACE_NAMESPACE = 'workspace';
|
|
3637
|
-
const initWorkspaceTestI18n = () => {
|
|
3638
|
-
i18n.use(initReactI18next).init({
|
|
3639
|
-
lng: 'en',
|
|
3640
|
-
ns: WORKSPACE_NAMESPACE,
|
|
3641
|
-
interpolation: {
|
|
3642
|
-
escapeValue: false
|
|
3643
|
-
},
|
|
3644
|
-
resources: {
|
|
3645
|
-
en: {
|
|
3646
|
-
[WORKSPACE_NAMESPACE]: workspaceTranslations.en,
|
|
3647
|
-
[SHARED_NAMESPACE]: sharedTranslations.en,
|
|
3648
|
-
[CORE_NAMESPACE]: coreTranslations.en,
|
|
3649
|
-
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.en,
|
|
3650
|
-
[FORM_FIELDS_NAMESPACE]: formFieldsTranslations.en
|
|
3651
|
-
},
|
|
3652
|
-
fi: {
|
|
3653
|
-
[WORKSPACE_NAMESPACE]: workspaceTranslations.fi,
|
|
3654
|
-
[SHARED_NAMESPACE]: sharedTranslations.fi,
|
|
3655
|
-
[CORE_NAMESPACE]: coreTranslations.fi,
|
|
3656
|
-
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.fi,
|
|
3657
|
-
[FORM_FIELDS_NAMESPACE]: formFieldsTranslations.fi
|
|
3658
|
-
},
|
|
3659
|
-
no: {
|
|
3660
|
-
[WORKSPACE_NAMESPACE]: workspaceTranslations.no,
|
|
3661
|
-
[SHARED_NAMESPACE]: sharedTranslations.no,
|
|
3662
|
-
[CORE_NAMESPACE]: coreTranslations.no,
|
|
3663
|
-
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.no,
|
|
3664
|
-
[FORM_FIELDS_NAMESPACE]: formFieldsTranslations.no
|
|
3665
|
-
},
|
|
3666
|
-
nl: {
|
|
3667
|
-
[WORKSPACE_NAMESPACE]: workspaceTranslations.nl,
|
|
3668
|
-
[SHARED_NAMESPACE]: sharedTranslations.nl,
|
|
3669
|
-
[CORE_NAMESPACE]: coreTranslations.nl,
|
|
3670
|
-
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.nl,
|
|
3671
|
-
[FORM_FIELDS_NAMESPACE]: formFieldsTranslations.nl
|
|
3672
|
-
}
|
|
3673
|
-
}
|
|
3674
|
-
});
|
|
3675
|
-
};
|
|
3676
|
-
initWorkspaceTestI18n();
|
|
3677
|
-
const ns = [WORKSPACE_NAMESPACE, SHARED_NAMESPACE];
|
|
3678
|
-
const translateKeyOutsideComponents = (key, params = undefined) => i18n.t(key, Object.assign({
|
|
3679
|
-
ns
|
|
3680
|
-
}, params));
|
|
3681
|
-
const useWorkspaceTranslation = () => useTranslation(ns);
|
|
3682
|
-
|
|
3683
3636
|
const getSnackbarMessage$1 = (action, title) => {
|
|
3684
3637
|
// Trim and add quotes
|
|
3685
3638
|
const trimmedTitle = `${title.trim()}`;
|
|
@@ -3742,51 +3695,53 @@ const getSnackbarMessage$1 = (action, title) => {
|
|
|
3742
3695
|
};
|
|
3743
3696
|
}
|
|
3744
3697
|
};
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3698
|
+
function getEmptyWorkspaceListItem(t) {
|
|
3699
|
+
return {
|
|
3700
|
+
id: undefined,
|
|
3701
|
+
title: t ? t('workspace-new') : undefined,
|
|
3702
|
+
scope: 'system',
|
|
3703
|
+
abstract: '',
|
|
3704
|
+
viewType: 'singleWindow'
|
|
3705
|
+
};
|
|
3706
|
+
}
|
|
3707
|
+
function getEmptyMapWorkspace(t) {
|
|
3708
|
+
return Object.assign(Object.assign({}, getEmptyWorkspaceListItem(t)), {
|
|
3709
|
+
views: {
|
|
3710
|
+
allIds: ['1_screen'],
|
|
3711
|
+
byId: {
|
|
3712
|
+
'1_screen': {
|
|
3713
|
+
title: t ? t('workspace-mappreset-new') : undefined,
|
|
3714
|
+
componentType: 'Map',
|
|
3715
|
+
initialProps: {
|
|
3716
|
+
mapPreset: {
|
|
3717
|
+
layers: [],
|
|
3718
|
+
proj: {
|
|
3719
|
+
bbox: {
|
|
3720
|
+
left: 58703.6377,
|
|
3721
|
+
bottom: 6408480.4514,
|
|
3722
|
+
right: 3967387.5161,
|
|
3723
|
+
top: 11520588.9031
|
|
3724
|
+
},
|
|
3725
|
+
srs: PROJECTION.EPSG_3857.value
|
|
3768
3726
|
},
|
|
3769
|
-
|
|
3727
|
+
shouldShowLayerManager: true,
|
|
3728
|
+
dockedLayerManagerSize: 'sizeSmall'
|
|
3770
3729
|
},
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
},
|
|
3774
|
-
syncGroupsIds: []
|
|
3730
|
+
syncGroupsIds: []
|
|
3731
|
+
}
|
|
3775
3732
|
}
|
|
3776
3733
|
}
|
|
3777
|
-
}
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
}
|
|
3734
|
+
},
|
|
3735
|
+
mosaicNode: '1_screen'
|
|
3736
|
+
});
|
|
3737
|
+
}
|
|
3781
3738
|
const getEmptyWorkspacePreset = () => ({
|
|
3782
|
-
title: translateKeyOutsideComponents('workspace-new'),
|
|
3783
3739
|
scope: 'system',
|
|
3784
3740
|
abstract: '',
|
|
3785
3741
|
views: {
|
|
3786
3742
|
allIds: ['1_screen'],
|
|
3787
3743
|
byId: {
|
|
3788
3744
|
'1_screen': {
|
|
3789
|
-
title: translateKeyOutsideComponents('workspace-mappreset-new'),
|
|
3790
3745
|
componentType: 'Map',
|
|
3791
3746
|
initialProps: {
|
|
3792
3747
|
mapPreset: {
|
|
@@ -3811,12 +3766,16 @@ const getEmptyWorkspacePreset = () => ({
|
|
|
3811
3766
|
mosaicNode: '1_screen',
|
|
3812
3767
|
viewType: 'singleWindow'
|
|
3813
3768
|
});
|
|
3814
|
-
const createCustomEmptyMapWorkspace = customMapPreset => {
|
|
3769
|
+
const createCustomEmptyMapWorkspace = (emptyWorkspaceTitle, emptyMapWorkspaceTitle, customMapPreset) => {
|
|
3815
3770
|
const customEmptyMapWorkspace = cloneDeep(getEmptyWorkspacePreset());
|
|
3816
3771
|
if (customMapPreset) {
|
|
3817
3772
|
customEmptyMapWorkspace.views.byId['1_screen'].initialProps.mapPreset = customMapPreset;
|
|
3818
3773
|
}
|
|
3819
|
-
|
|
3774
|
+
customEmptyMapWorkspace.views.byId['1_screen'].title = emptyMapWorkspaceTitle;
|
|
3775
|
+
const emptyWorkspacePreset = Object.assign(Object.assign({}, customEmptyMapWorkspace), {
|
|
3776
|
+
title: emptyWorkspaceTitle
|
|
3777
|
+
});
|
|
3778
|
+
return emptyWorkspacePreset;
|
|
3820
3779
|
};
|
|
3821
3780
|
const constructFilterParams$1 = (filters, searchQuery) => {
|
|
3822
3781
|
// get filters
|
|
@@ -3948,7 +3907,9 @@ const slice$1 = createSlice({
|
|
|
3948
3907
|
draft.scope = workspacePreset.scope;
|
|
3949
3908
|
draft.syncGroups = [];
|
|
3950
3909
|
},
|
|
3951
|
-
changeToEmptyMapWorkspace: draft
|
|
3910
|
+
changeToEmptyMapWorkspace: (draft,
|
|
3911
|
+
// eslint-disable-next-line no-unused-vars
|
|
3912
|
+
action) => {
|
|
3952
3913
|
return draft;
|
|
3953
3914
|
},
|
|
3954
3915
|
setPreset: (draft, action) => {
|
|
@@ -4046,9 +4007,9 @@ const slice$1 = createSlice({
|
|
|
4046
4007
|
// Remove the id, rename to empty workspace and set it has changes
|
|
4047
4008
|
if ((action.payload.action === WorkspacePresetAction.DELETE || action.payload.action === WorkspacePresetAction.DELETE_SYSTEM_PRESET) && action.payload.workspaceId === draft.id) {
|
|
4048
4009
|
delete draft.id;
|
|
4049
|
-
draft.title =
|
|
4050
|
-
draft.abstract =
|
|
4051
|
-
draft.scope =
|
|
4010
|
+
draft.title = action.payload.emptyWorkspacePresetTitle;
|
|
4011
|
+
draft.abstract = getEmptyMapWorkspace().abstract;
|
|
4012
|
+
draft.scope = getEmptyMapWorkspace().scope;
|
|
4052
4013
|
draft.hasChanges = true;
|
|
4053
4014
|
}
|
|
4054
4015
|
}).addCase(viewPresetActions.fetchedViewPreset, (draft, action) => {
|
|
@@ -8800,12 +8761,16 @@ workspaceListener.startListening({
|
|
|
8800
8761
|
});
|
|
8801
8762
|
workspaceListener.startListening({
|
|
8802
8763
|
actionCreator: workspaceActions.changeToEmptyMapWorkspace,
|
|
8803
|
-
effect: (
|
|
8764
|
+
effect: (action, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8765
|
+
const {
|
|
8766
|
+
newMapPresetText,
|
|
8767
|
+
newWorkspaceText
|
|
8768
|
+
} = action.payload;
|
|
8804
8769
|
// Cancel any in-progress instances of this listener
|
|
8805
8770
|
listenerApi.cancelActiveListeners();
|
|
8806
8771
|
const intialViewMapPreset = getInitialViewMapPreset(listenerApi.getState());
|
|
8807
8772
|
listenerApi.dispatch(workspaceActions.changePreset({
|
|
8808
|
-
workspacePreset: createCustomEmptyMapWorkspace(intialViewMapPreset)
|
|
8773
|
+
workspacePreset: createCustomEmptyMapWorkspace(newWorkspaceText, newMapPresetText, intialViewMapPreset)
|
|
8809
8774
|
}));
|
|
8810
8775
|
})
|
|
8811
8776
|
});
|
|
@@ -9054,7 +9019,7 @@ const getWorkspaceListSearchQuery = createSelector(getWorkspaceListStore, store
|
|
|
9054
9019
|
return (state === null || state === void 0 ? void 0 : state.searchQuery) || '';
|
|
9055
9020
|
}, selectorMemoizationOptions);
|
|
9056
9021
|
|
|
9057
|
-
const emptyWorkspaceBEData = Object.assign(Object.assign({},
|
|
9022
|
+
const emptyWorkspaceBEData = Object.assign(Object.assign({}, getEmptyMapWorkspace()), {
|
|
9058
9023
|
views: [{
|
|
9059
9024
|
mosaicNodeId: '1_screen',
|
|
9060
9025
|
viewPresetId: 'emptyMap'
|
|
@@ -9183,12 +9148,14 @@ workspaceListListener.startListening({
|
|
|
9183
9148
|
payload
|
|
9184
9149
|
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9185
9150
|
listenerApi.cancelActiveListeners();
|
|
9186
|
-
const workspaceApi =
|
|
9151
|
+
const workspaceApi = getWorkspaceApi();
|
|
9187
9152
|
try {
|
|
9188
9153
|
const {
|
|
9189
9154
|
presetId,
|
|
9190
9155
|
presetAction,
|
|
9191
|
-
data
|
|
9156
|
+
data,
|
|
9157
|
+
emptyMapPresetTitle,
|
|
9158
|
+
emptyWorkspacePresetTitle
|
|
9192
9159
|
} = payload;
|
|
9193
9160
|
const scope = data.scope || 'user';
|
|
9194
9161
|
// save as
|
|
@@ -9203,7 +9170,7 @@ workspaceListListener.startListening({
|
|
|
9203
9170
|
}
|
|
9204
9171
|
// duplicate
|
|
9205
9172
|
if (presetAction === WorkspacePresetAction.DUPLICATE) {
|
|
9206
|
-
const isNewWorkspace = presetId ===
|
|
9173
|
+
const isNewWorkspace = presetId === getEmptyMapWorkspace().id;
|
|
9207
9174
|
const {
|
|
9208
9175
|
data: presetToDuplicate
|
|
9209
9176
|
} = isNewWorkspace ? {
|
|
@@ -9227,7 +9194,8 @@ workspaceListListener.startListening({
|
|
|
9227
9194
|
action: presetAction,
|
|
9228
9195
|
title: data.title,
|
|
9229
9196
|
currentActiveWorkspaceId: selectedWorkspace.id,
|
|
9230
|
-
scope
|
|
9197
|
+
scope,
|
|
9198
|
+
emptyWorkspacePresetTitle
|
|
9231
9199
|
}));
|
|
9232
9200
|
}
|
|
9233
9201
|
// edit
|
|
@@ -9258,9 +9226,9 @@ workspaceListListener.startListening({
|
|
|
9258
9226
|
// get all views
|
|
9259
9227
|
const views = getViewPresets(listenerApi.getState());
|
|
9260
9228
|
const {
|
|
9261
|
-
emptyMapPresetTitle
|
|
9229
|
+
emptyMapPresetTitle: _emptyMapPresetTitle
|
|
9262
9230
|
} = payload;
|
|
9263
|
-
const savedViewPresetResult = yield Promise.all(views.map(view => saveAllViewPresets(view, data.title, listenerApi,
|
|
9231
|
+
const savedViewPresetResult = yield Promise.all(views.map(view => saveAllViewPresets(view, data.title, listenerApi, _emptyMapPresetTitle)));
|
|
9264
9232
|
const errorMessage = savedViewPresetResult.find(viewPresetResult => typeof viewPresetResult === 'string');
|
|
9265
9233
|
if (errorMessage) {
|
|
9266
9234
|
throw new Error(JSON.stringify(errorMessage));
|
|
@@ -9357,8 +9325,11 @@ workspaceListListener.startListening({
|
|
|
9357
9325
|
// Reset
|
|
9358
9326
|
if (presetAction === WorkspacePresetAction.RESET) {
|
|
9359
9327
|
// In case we're resetting the `New workspace` preset
|
|
9360
|
-
if (presetId ===
|
|
9361
|
-
listenerApi.dispatch(workspaceActions.changeToEmptyMapWorkspace(
|
|
9328
|
+
if (presetId === getEmptyMapWorkspace().id) {
|
|
9329
|
+
listenerApi.dispatch(workspaceActions.changeToEmptyMapWorkspace({
|
|
9330
|
+
newMapPresetText: emptyMapPresetTitle,
|
|
9331
|
+
newWorkspaceText: emptyWorkspacePresetTitle
|
|
9332
|
+
}));
|
|
9362
9333
|
} else {
|
|
9363
9334
|
listenerApi.dispatch(workspaceActions.fetchWorkspace({
|
|
9364
9335
|
workspaceId: presetId
|
|
@@ -9461,6 +9432,50 @@ const store = createStore({
|
|
|
9461
9432
|
devTools: devToolsStateSanitizer
|
|
9462
9433
|
});
|
|
9463
9434
|
|
|
9435
|
+
const WORKSPACE_NAMESPACE = 'workspace';
|
|
9436
|
+
const initWorkspaceTestI18n = () => {
|
|
9437
|
+
i18n.use(initReactI18next).init({
|
|
9438
|
+
lng: 'en',
|
|
9439
|
+
ns: WORKSPACE_NAMESPACE,
|
|
9440
|
+
interpolation: {
|
|
9441
|
+
escapeValue: false
|
|
9442
|
+
},
|
|
9443
|
+
resources: {
|
|
9444
|
+
en: {
|
|
9445
|
+
[WORKSPACE_NAMESPACE]: workspaceTranslations.en,
|
|
9446
|
+
[SHARED_NAMESPACE]: sharedTranslations.en,
|
|
9447
|
+
[CORE_NAMESPACE]: coreTranslations.en,
|
|
9448
|
+
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.en,
|
|
9449
|
+
[FORM_FIELDS_NAMESPACE]: formFieldsTranslations.en
|
|
9450
|
+
},
|
|
9451
|
+
fi: {
|
|
9452
|
+
[WORKSPACE_NAMESPACE]: workspaceTranslations.fi,
|
|
9453
|
+
[SHARED_NAMESPACE]: sharedTranslations.fi,
|
|
9454
|
+
[CORE_NAMESPACE]: coreTranslations.fi,
|
|
9455
|
+
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.fi,
|
|
9456
|
+
[FORM_FIELDS_NAMESPACE]: formFieldsTranslations.fi
|
|
9457
|
+
},
|
|
9458
|
+
no: {
|
|
9459
|
+
[WORKSPACE_NAMESPACE]: workspaceTranslations.no,
|
|
9460
|
+
[SHARED_NAMESPACE]: sharedTranslations.no,
|
|
9461
|
+
[CORE_NAMESPACE]: coreTranslations.no,
|
|
9462
|
+
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.no,
|
|
9463
|
+
[FORM_FIELDS_NAMESPACE]: formFieldsTranslations.no
|
|
9464
|
+
},
|
|
9465
|
+
nl: {
|
|
9466
|
+
[WORKSPACE_NAMESPACE]: workspaceTranslations.nl,
|
|
9467
|
+
[SHARED_NAMESPACE]: sharedTranslations.nl,
|
|
9468
|
+
[CORE_NAMESPACE]: coreTranslations.nl,
|
|
9469
|
+
[WEBMAP_REACT_NAMESPACE]: webmapReactTranslations.nl,
|
|
9470
|
+
[FORM_FIELDS_NAMESPACE]: formFieldsTranslations.nl
|
|
9471
|
+
}
|
|
9472
|
+
}
|
|
9473
|
+
});
|
|
9474
|
+
};
|
|
9475
|
+
initWorkspaceTestI18n();
|
|
9476
|
+
const ns = [WORKSPACE_NAMESPACE, SHARED_NAMESPACE];
|
|
9477
|
+
const useWorkspaceTranslation = () => useTranslation(ns);
|
|
9478
|
+
|
|
9464
9479
|
const WorkspaceThemeProvider = ({
|
|
9465
9480
|
children,
|
|
9466
9481
|
theme: _theme = lightTheme
|
|
@@ -10060,13 +10075,14 @@ const WorkspaceSelectList = ({
|
|
|
10060
10075
|
isEditable,
|
|
10061
10076
|
isAdmin,
|
|
10062
10077
|
searchQuery,
|
|
10063
|
-
newPreset
|
|
10078
|
+
newPreset,
|
|
10064
10079
|
testIdPrefix: _testIdPrefix = 'workspace'
|
|
10065
10080
|
}) => {
|
|
10066
10081
|
const {
|
|
10067
10082
|
t
|
|
10068
10083
|
} = useWorkspaceTranslation();
|
|
10069
|
-
const
|
|
10084
|
+
const newPresetTruthy = newPreset || getEmptyWorkspaceListItem(t);
|
|
10085
|
+
const items = React.useMemo(() => !hideNewWorkspace ? [newPresetTruthy, ...workspacePresets] : workspacePresets, [hideNewWorkspace, newPresetTruthy, workspacePresets]);
|
|
10070
10086
|
return jsxs(Box, Object.assign({
|
|
10071
10087
|
"data-testid": `${_testIdPrefix}-selectList`,
|
|
10072
10088
|
sx: {
|
|
@@ -10307,7 +10323,7 @@ const ViewPresetMenuListConnect = ({
|
|
|
10307
10323
|
currentSelectedId: activeViewPresetId || undefined,
|
|
10308
10324
|
onClickPreset: selectViewPreset,
|
|
10309
10325
|
onClickWorkspacePresetOption: onClickViewPresetOption,
|
|
10310
|
-
newPreset: Object.assign(Object.assign({}, getEmptyWorkspaceListItem()), {
|
|
10326
|
+
newPreset: Object.assign(Object.assign({}, getEmptyWorkspaceListItem(t)), {
|
|
10311
10327
|
title: t('workspace-mappreset-new')
|
|
10312
10328
|
}),
|
|
10313
10329
|
isEditable: isEditable,
|
|
@@ -11056,6 +11072,9 @@ const WorkspaceSelectListConnect = () => {
|
|
|
11056
11072
|
isLoggedIn
|
|
11057
11073
|
} = useAuthenticationContext();
|
|
11058
11074
|
const dispatch = useDispatch();
|
|
11075
|
+
const {
|
|
11076
|
+
t
|
|
11077
|
+
} = useWorkspaceTranslation();
|
|
11059
11078
|
const fetchWorkspaceList = React.useCallback(() => {
|
|
11060
11079
|
const filterParams = constructFilterParams$1(workspaceListFilters, workspaceSearchQuery);
|
|
11061
11080
|
dispatch(workspaceListActions.fetchWorkspaceList(filterParams));
|
|
@@ -11097,10 +11116,13 @@ const WorkspaceSelectListConnect = () => {
|
|
|
11097
11116
|
dispatch(workspaceListActions.toggleWorkspaceDialog({
|
|
11098
11117
|
isWorkspaceListDialogOpen: false
|
|
11099
11118
|
}));
|
|
11100
|
-
dispatch(workspaceActions.changeToEmptyMapWorkspace(
|
|
11101
|
-
|
|
11119
|
+
dispatch(workspaceActions.changeToEmptyMapWorkspace({
|
|
11120
|
+
newMapPresetText: t('workspace-mappreset-new'),
|
|
11121
|
+
newWorkspaceText: t('workspace-new')
|
|
11122
|
+
}));
|
|
11123
|
+
}, [dispatch, t]);
|
|
11102
11124
|
const onClickWorkspace = id => {
|
|
11103
|
-
if (id ===
|
|
11125
|
+
if (id === getEmptyMapWorkspace(t).id) {
|
|
11104
11126
|
onClickNewPreset();
|
|
11105
11127
|
} else if (!isFetching) {
|
|
11106
11128
|
fetchWorkspace(id);
|
|
@@ -11117,7 +11139,7 @@ const WorkspaceSelectListConnect = () => {
|
|
|
11117
11139
|
};
|
|
11118
11140
|
const onClickWorkspacePresetOption = (presetId, workspaceAction) => {
|
|
11119
11141
|
// If affectedPreset is the FE defined `New workspace` - use the definition from FE instead of BE
|
|
11120
|
-
const affectedPreset = presetId ===
|
|
11142
|
+
const affectedPreset = presetId === getEmptyMapWorkspace(t).id ? getEmptyMapWorkspace(t) : workspacePresets.find(preset => preset.id === presetId);
|
|
11121
11143
|
const presetTitle = affectedPreset === null || affectedPreset === void 0 ? void 0 : affectedPreset.title;
|
|
11122
11144
|
switch (workspaceAction) {
|
|
11123
11145
|
case WorkspacePresetAction.DUPLICATE:
|
|
@@ -11177,9 +11199,6 @@ const WorkspaceSelectListConnect = () => {
|
|
|
11177
11199
|
};
|
|
11178
11200
|
const isAllSelected = workspaceListFilters.every(filter => filter.isSelected);
|
|
11179
11201
|
const shouldHideNewWorkspace = !isAllSelected || workspaceSearchQuery.length > 0;
|
|
11180
|
-
const {
|
|
11181
|
-
t
|
|
11182
|
-
} = useWorkspaceTranslation();
|
|
11183
11202
|
return jsxs("div", Object.assign({
|
|
11184
11203
|
"data-testid": "workspace-selectlist-connect",
|
|
11185
11204
|
style: {
|
|
@@ -11900,7 +11919,8 @@ const WorkspaceTabConnect = ({
|
|
|
11900
11919
|
presetAction,
|
|
11901
11920
|
presetId,
|
|
11902
11921
|
data,
|
|
11903
|
-
emptyMapPresetTitle: t('workspace-mappreset-new')
|
|
11922
|
+
emptyMapPresetTitle: t('workspace-mappreset-new'),
|
|
11923
|
+
emptyWorkspacePresetTitle: t('workspace-new')
|
|
11904
11924
|
}));
|
|
11905
11925
|
};
|
|
11906
11926
|
const presetId = typeof dialogDetails === 'object' && dialogDetails.presetId;
|
|
@@ -12242,8 +12262,11 @@ const WorkspaceDetail = ({
|
|
|
12242
12262
|
}));
|
|
12243
12263
|
}, [dispatch, workspaceData]);
|
|
12244
12264
|
const changeToEmptyMapWorkspace = React.useCallback(() => {
|
|
12245
|
-
dispatch(workspaceActions.changeToEmptyMapWorkspace(
|
|
12246
|
-
|
|
12265
|
+
dispatch(workspaceActions.changeToEmptyMapWorkspace({
|
|
12266
|
+
newMapPresetText: t('workspace-mappreset-new'),
|
|
12267
|
+
newWorkspaceText: t('workspace-new')
|
|
12268
|
+
}));
|
|
12269
|
+
}, [dispatch, t]);
|
|
12247
12270
|
const navigateToUrl = React.useCallback(url => {
|
|
12248
12271
|
dispatch(routerActions.navigateToUrl({
|
|
12249
12272
|
url
|
|
@@ -12254,7 +12277,7 @@ const WorkspaceDetail = ({
|
|
|
12254
12277
|
navigateToUrl(routes.root);
|
|
12255
12278
|
};
|
|
12256
12279
|
React.useEffect(() => {
|
|
12257
|
-
const idToFetch =
|
|
12280
|
+
const idToFetch = workspaceId || initialWorkspaceId;
|
|
12258
12281
|
if (!idToFetch) {
|
|
12259
12282
|
setEmptyWorkSpace();
|
|
12260
12283
|
} else {
|
|
@@ -12323,4 +12346,4 @@ const WorkspaceDetail = ({
|
|
|
12323
12346
|
}));
|
|
12324
12347
|
};
|
|
12325
12348
|
|
|
12326
|
-
export { ComponentsLookUpWrapper, DemoWrapper, WORKSPACE_NAMESPACE, WorkspaceDetail, WorkspaceErrorType, WorkspaceI18nProvider, WorkspaceModuleProvider, WorkspacePresetAction, WorkspaceTopBar, WorkspaceViewConnect, WorkspaceWrapperProviderWithStore, workspaceActions as actions, createBalancedMosaicNode, createCustomEmptyMapWorkspace, defaultAuthConfig,
|
|
12349
|
+
export { ComponentsLookUpWrapper, DemoWrapper, WORKSPACE_NAMESPACE, WorkspaceDetail, WorkspaceErrorType, WorkspaceI18nProvider, WorkspaceModuleProvider, WorkspacePresetAction, WorkspaceTopBar, WorkspaceViewConnect, WorkspaceWrapperProviderWithStore, workspaceActions as actions, createBalancedMosaicNode, createCustomEmptyMapWorkspace, defaultAuthConfig, getEmptyMapWorkspace, getWorkspaceRouteUrl, selectors$1 as selectors, viewPresetActions, workspaceListActions, workspaceModuleConfig, reducer$1 as workspaceReducer, routes as workspaceRoutes, workspaceTranslations };
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ export * from './lib/components/WorkspaceDetail';
|
|
|
13
13
|
export { WORKSPACE_NAMESPACE } from './lib/utils/i18n';
|
|
14
14
|
export { workspaceTranslations };
|
|
15
15
|
export { routes as workspaceRoutes, getWorkspaceRouteUrl, } from './lib/utils/routes';
|
|
16
|
-
export {
|
|
16
|
+
export { getEmptyMapWorkspace, createCustomEmptyMapWorkspace, } from './lib/store/workspaceList/utils';
|
|
17
17
|
export type { WorkspaceModuleStore } from './lib/store/types';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Reducer } from '@reduxjs/toolkit';
|
|
2
|
-
import { WorkspaceAddViewPayload, WorkspaceDeleteViewPayload, WorkspaceState, WorkspaceSetPresetPayload, WorkspaceSetPreventCloseViewPayload, WorkspaceUpdateViewPayload, WorkspaceUpdateViewsPayload, WorkspaceErrorWorkspacePayload, WorkspaceFetchedWorkspacePayload, WorkspaceFetchWorkspacePayload, WorkspaceFetchWorkspaceViewPresetPayload, WorkspaceSaveWorkspacePresetPayload, WorkspaceSetInitialViewMapPresetPayload, WorkspaceSetNewViewPayload } from './types';
|
|
2
|
+
import { WorkspaceAddViewPayload, WorkspaceDeleteViewPayload, WorkspaceState, WorkspaceSetPresetPayload, WorkspaceSetPreventCloseViewPayload, WorkspaceUpdateViewPayload, WorkspaceUpdateViewsPayload, WorkspaceErrorWorkspacePayload, WorkspaceFetchedWorkspacePayload, WorkspaceFetchWorkspacePayload, WorkspaceFetchWorkspaceViewPresetPayload, WorkspaceSaveWorkspacePresetPayload, WorkspaceSetInitialViewMapPresetPayload, WorkspaceSetNewViewPayload, WorkspaceChangeToEmptyMapWorkspacePayload } from './types';
|
|
3
3
|
export declare const initialState: WorkspaceState;
|
|
4
4
|
export declare const reducer: Reducer<WorkspaceState>;
|
|
5
5
|
export declare const workspaceActions: {
|
|
@@ -10,7 +10,7 @@ export declare const workspaceActions: {
|
|
|
10
10
|
updateWorkspaceViews: import("@reduxjs/toolkit").ActionCreatorWithPayload<WorkspaceUpdateViewsPayload, "workspace/updateWorkspaceViews">;
|
|
11
11
|
updateWorkspaceView: import("@reduxjs/toolkit").ActionCreatorWithPayload<WorkspaceUpdateViewPayload, "workspace/updateWorkspaceView">;
|
|
12
12
|
changePreset: import("@reduxjs/toolkit").ActionCreatorWithPayload<WorkspaceSetPresetPayload, "workspace/changePreset">;
|
|
13
|
-
changeToEmptyMapWorkspace: import("@reduxjs/toolkit").
|
|
13
|
+
changeToEmptyMapWorkspace: import("@reduxjs/toolkit").ActionCreatorWithPayload<WorkspaceChangeToEmptyMapWorkspacePayload, "workspace/changeToEmptyMapWorkspace">;
|
|
14
14
|
setPreset: import("@reduxjs/toolkit").ActionCreatorWithPayload<WorkspaceSetPresetPayload, "workspace/setPreset">;
|
|
15
15
|
setPreventCloseView: import("@reduxjs/toolkit").ActionCreatorWithPayload<WorkspaceSetPreventCloseViewPayload, "workspace/setPreventCloseView">;
|
|
16
16
|
fetchWorkspace: import("@reduxjs/toolkit").ActionCreatorWithPayload<WorkspaceFetchWorkspacePayload, "workspace/fetchWorkspace">;
|
|
@@ -96,6 +96,10 @@ export interface WorkspaceUpdateViewPayload {
|
|
|
96
96
|
mosaicNodeId: string;
|
|
97
97
|
viewPreset: WorkspaceViewType;
|
|
98
98
|
}
|
|
99
|
+
export interface WorkspaceChangeToEmptyMapWorkspacePayload {
|
|
100
|
+
newMapPresetText: string;
|
|
101
|
+
newWorkspaceText: string;
|
|
102
|
+
}
|
|
99
103
|
export interface WorkspaceSetPresetPayload {
|
|
100
104
|
workspacePreset: WorkspacePreset;
|
|
101
105
|
}
|
|
@@ -2,7 +2,7 @@ import { ToolkitStore } from '@reduxjs/toolkit/dist/configureStore';
|
|
|
2
2
|
import { WorkspacePresetFromBE } from '../workspace/types';
|
|
3
3
|
import { ViewPresetEntity } from '../viewPresets/types';
|
|
4
4
|
import { WorkspaceModuleStore } from '../types';
|
|
5
|
-
export declare const emptyWorkspaceBEData: WorkspacePresetFromBE
|
|
5
|
+
export declare const emptyWorkspaceBEData: Omit<WorkspacePresetFromBE, 'title'>;
|
|
6
6
|
export declare const saveAllViewPresets: (viewPresetEntity: ViewPresetEntity, workspaceTitle: string, store: ToolkitStore, emptyMapPresetTitle: string) => Promise<{
|
|
7
7
|
mosaicNodeId: string;
|
|
8
8
|
viewPresetId: string;
|
|
@@ -86,15 +86,26 @@ export interface SubmitFormWorkspaceActionDialogPayload {
|
|
|
86
86
|
presetId: string;
|
|
87
87
|
data: WorkspacePresetFromBE;
|
|
88
88
|
emptyMapPresetTitle: string;
|
|
89
|
+
emptyWorkspacePresetTitle: string;
|
|
89
90
|
}
|
|
90
|
-
export interface
|
|
91
|
+
export interface OnNonDeleteSuccesWorkspacePresetActionPayload {
|
|
91
92
|
workspaceId: string;
|
|
92
|
-
action: WorkspacePresetAction
|
|
93
|
+
action: Exclude<WorkspacePresetAction, WorkspacePresetAction.DELETE | WorkspacePresetAction.DELETE_SYSTEM_PRESET>;
|
|
94
|
+
title: string;
|
|
95
|
+
abstract?: string;
|
|
96
|
+
currentActiveWorkspaceId?: string;
|
|
97
|
+
scope: PresetScope;
|
|
98
|
+
}
|
|
99
|
+
export interface OnDeleteSuccesWorkspacePresetActionPayload {
|
|
100
|
+
workspaceId: string;
|
|
101
|
+
action: WorkspacePresetAction.DELETE | WorkspacePresetAction.DELETE_SYSTEM_PRESET;
|
|
93
102
|
title: string;
|
|
94
103
|
abstract?: string;
|
|
95
104
|
currentActiveWorkspaceId?: string;
|
|
96
105
|
scope: PresetScope;
|
|
106
|
+
emptyWorkspacePresetTitle: string;
|
|
97
107
|
}
|
|
108
|
+
export type OnSuccesWorkspacePresetActionPayload = OnNonDeleteSuccesWorkspacePresetActionPayload | OnDeleteSuccesWorkspacePresetActionPayload;
|
|
98
109
|
export interface OnErrorWorkspacePresetActionPayload {
|
|
99
110
|
error: WorkspaceListError;
|
|
100
111
|
}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { MapPreset } from '@opengeoweb/store';
|
|
2
2
|
import { snackbarTypes } from '@opengeoweb/snackbar';
|
|
3
|
+
import { TFunction } from 'i18next';
|
|
3
4
|
import { WorkspacePreset, WorkspacePresetAction, WorkspacePresetListItem } from '../workspace/types';
|
|
4
5
|
import { FetchWorkspaceParams, WorkspaceListFilter } from './types';
|
|
5
6
|
export declare const getSnackbarMessage: (action: WorkspacePresetAction, title: string) => snackbarTypes.TranslatableMessage;
|
|
6
|
-
export declare
|
|
7
|
-
export declare
|
|
8
|
-
export declare
|
|
9
|
-
export declare
|
|
7
|
+
export declare function getEmptyWorkspaceListItem(): Omit<WorkspacePresetListItem, 'title'>;
|
|
8
|
+
export declare function getEmptyWorkspaceListItem(t: TFunction): WorkspacePresetListItem;
|
|
9
|
+
export declare function getEmptyWorkspaceListItem(t?: TFunction): Omit<WorkspacePresetListItem, 'title'> | WorkspacePresetListItem;
|
|
10
|
+
export declare function getEmptyMapWorkspace(): Omit<WorkspacePreset, 'title'>;
|
|
11
|
+
export declare function getEmptyMapWorkspace(t: TFunction): WorkspacePreset;
|
|
12
|
+
export declare const getEmptyWorkspacePreset: () => Omit<WorkspacePreset, 'title'>;
|
|
13
|
+
export declare const createCustomEmptyMapWorkspace: (emptyWorkspaceTitle: string, emptyMapWorkspaceTitle: string, customMapPreset?: MapPreset) => WorkspacePreset;
|
|
10
14
|
export declare const constructFilterParams: (filters: WorkspaceListFilter[], searchQuery: string) => FetchWorkspaceParams;
|
|
11
15
|
export declare const generateUID: () => string;
|
|
12
16
|
export declare const getGeneratedViewPresetTitle: (workspaceTitle: string, uid: string) => string;
|
package/src/lib/utils/i18n.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import i18n from 'i18next';
|
|
1
|
+
import i18n, { TFunction } from 'i18next';
|
|
2
2
|
import { UseTranslationResponse } from 'react-i18next';
|
|
3
3
|
export declare const WORKSPACE_NAMESPACE = "workspace";
|
|
4
4
|
export declare const initWorkspaceTestI18n: () => void;
|
|
5
|
-
export declare const translateKeyOutsideComponents: (key: string, params?: Record<string, string | number> | undefined) => string;
|
|
5
|
+
export declare const translateKeyOutsideComponents: (t: TFunction, key: string, params?: Record<string, string | number> | undefined) => string;
|
|
6
6
|
export declare const useWorkspaceTranslation: () => UseTranslationResponse<typeof WORKSPACE_NAMESPACE, typeof i18n>;
|
|
7
7
|
export { i18n };
|