@opengeoweb/workspace 14.2.1 → 14.3.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 +2559 -1249
- package/package.json +17 -17
- package/src/lib/api/workspace-api/api.d.ts +2 -1
- package/src/lib/api/workspace-api/hooks.d.ts +3 -2
- package/src/lib/components/WorkspaceOptions/WorkspaceOptions.d.ts +2 -0
- package/src/lib/components/WorkspaceOptions/WorkspaceOptionsConnect.d.ts +1 -1
- package/src/lib/components/WorkspacePresetsFormDialog/WorkspacePresetLabelsPanel.d.ts +8 -0
- package/src/lib/components/WorkspacePresetsFormDialog/WorkspacePresetsForm.d.ts +8 -2
- package/src/lib/components/WorkspacePresetsFormDialog/WorkspacePresetsFormDialog.d.ts +2 -1
- package/src/lib/components/WorkspacePresetsFormDialog/WorkspacePresetsFormDialog.stories.d.ts +0 -1
- package/src/lib/components/WorkspaceSelectList/WorkspaceSelectListRow.d.ts +1 -1
- package/src/lib/components/WorkspaceTab/WorkspaceTabConnect.d.ts +1 -1
- package/src/lib/store/workspace/listener.d.ts +1 -1
- package/src/lib/store/workspace/reducer.d.ts +3 -2
- package/src/lib/store/workspace/selectors.d.ts +173 -68
- package/src/lib/store/workspace/types.d.ts +31 -6
- package/src/lib/store/workspace/utils.d.ts +9 -8
- package/src/lib/store/workspaceList/selectors.d.ts +103 -48
- package/src/lib/store/workspaceList/types.d.ts +8 -4
- package/src/lib/utils/labels.config.d.ts +9 -0
- package/src/lib/components/WorkspacePresetsFormDialog/WorkspaceViewPresetsFormFields.d.ts +0 -8
- /package/src/lib/components/WorkspacePresetsFormDialog/{WorkspaceViewPresetsFormFields.spec.d.ts → WorkspacePresetLabelsPanel.spec.d.ts} +0 -0
package/index.esm.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, isAnyOf, combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
2
2
|
import { syncGroupsTypes, syncGroupsActions, layerActions, mapActions, uiActions, genericActions, layerTypes, mapEnums, selectorMemoizationOptions, genericSelectors, mapSelectors, syncGroupsSelectors, routerActions, createViewObjectForNewMap, mapListener, serviceListener, layersListener, syncGroupsListener, openlayersListener, uiReducer, loadingIndicatorReducer, syncGroupsReducer, layerReducer, serviceReducer, mapReducer, loadingIndicatorSelectors, uiTypes, linkComponentTypesConstants, uiSelectors } from '@opengeoweb/store';
|
|
3
|
-
import {
|
|
4
|
-
import { chunk, cloneDeep, union, pick, isEmpty, isEqual, isString } from 'lodash';
|
|
3
|
+
import { chunk, union, cloneDeep, pick, isEmpty, isEqual, isString } from 'lodash';
|
|
5
4
|
import { getLeaves, createBalancedTreeFromLeaves, MosaicContext, getAndAssertNodeAtPathExists, MosaicWindow, Mosaic } from 'react-mosaic-component';
|
|
5
|
+
import { createApiInstance, createNonAuthApiInstance, getApi, createFakeApiInstance, ApiProvider, getHeaders, handleResponse, useApiContext, useAuthenticationContext as useAuthenticationContext$1, GEOWEB_ROLE_PRESETS_ADMIN as GEOWEB_ROLE_PRESETS_ADMIN$1 } from '@opengeoweb/api';
|
|
6
6
|
import { timeSeriesActions, TimeSeriesTypes, timeSeriesSelectors, timeSeriesReducer } from '@opengeoweb/time-series';
|
|
7
|
-
import { publicWarningActions, warningsTranslations, WARN_NAMESPACE
|
|
7
|
+
import { publicWarningActions, publicWarningsSelectors, warningsTranslations, WARN_NAMESPACE } from '@opengeoweb/warnings';
|
|
8
8
|
import { snackbarTypes, snackbarActions, snackbarListener, snackbarReducer, SnackbarWrapperConnect } from '@opengeoweb/snackbar';
|
|
9
|
-
import { getAxiosErrorMessage,
|
|
10
|
-
import { isAxiosError } from 'axios';
|
|
9
|
+
import { getAxiosErrorMessage, isAxiosError, isAxiosAuthError, safelyInitI18nForTestsAndStories, sharedTranslations, SHARED_NAMESPACE, ConfirmationServiceProvider, usePrevious, AlertBanner, sessionStorageProvider, SystemScope, CustomTooltip, SearchHighlight, ToggleMenu, CustomIconButton, Filter, LastUpdateTime, renderCounter, CustomDialog, ToolContainer, CustomToggleButton, useConfirmationDialog, CustomAccordion, ConfirmationButtons } from '@opengeoweb/shared';
|
|
10
|
+
import { isAxiosError as isAxiosError$1 } from 'axios';
|
|
11
11
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
12
|
-
import { ThemeWrapper, lightTheme,
|
|
12
|
+
import { ThemeWrapper, lightTheme, Delete, WorkspacePresetsSystemIcon, SharedPresetsMyUser, SharedPresetsOtherUsers, WorkspacePresetsMyIcon, BackdropStyle, CloudLoading, CloudIdle, Options, Link, LinkOff, SplitVertical, SplitHorizontal, Expand, UnExpand, Close, WebAssetOff, ChevronUp, ChevronDown, LockLocked, Exclamation } from '@opengeoweb/theme';
|
|
13
13
|
import { Provider, useDispatch, useSelector, useStore, shallowEqual } from 'react-redux';
|
|
14
14
|
import { useTranslation, I18nextProvider } from 'react-i18next';
|
|
15
15
|
import { AuthenticationProvider, useAuthenticationContext, GEOWEB_ROLE_PRESETS_ADMIN } from '@opengeoweb/authentication';
|
|
16
|
-
import { QueryClient, QueryClientProvider, useMutation } from '@tanstack/react-query';
|
|
16
|
+
import { QueryClient, QueryClientProvider, useMutation, useQuery } from '@tanstack/react-query';
|
|
17
17
|
import i18n from 'i18next';
|
|
18
18
|
import { webmapReactTranslations, WEBMAP_REACT_NAMESPACE } from '@opengeoweb/webmap-react';
|
|
19
19
|
import { coreTranslations, CORE_NAMESPACE, LoadingIndicatorProgressBar } from '@opengeoweb/core';
|
|
20
|
-
import { formFieldsTranslations, FORM_FIELDS_NAMESPACE,
|
|
20
|
+
import { formFieldsTranslations, FORM_FIELDS_NAMESPACE, ReactHookFormHiddenInput, ReactHookFormTextField, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
|
|
21
21
|
import * as React from 'react';
|
|
22
22
|
import React__default, { useCallback, useEffect } from 'react';
|
|
23
|
-
import { LinearProgress, Typography,
|
|
23
|
+
import { LinearProgress, Typography, ListItem, ListItemButton, ListItemIcon, ListItemText, Grid, Box, useTheme, Menu, ListSubheader, MenuItem, List, Checkbox, Button, Stack, FormControlLabel, Chip, Tabs } from '@mui/material';
|
|
24
24
|
import 'react-mosaic-component/react-mosaic-component.css';
|
|
25
25
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
26
26
|
import { FixedSizeList } from 'react-window';
|
|
27
|
-
import { useFormContext } from 'react-hook-form';
|
|
27
|
+
import { useFormContext, useWatch } from 'react-hook-form';
|
|
28
28
|
|
|
29
29
|
var en = {
|
|
30
30
|
"workspace-menu": "Workspace menu",
|
|
@@ -37,6 +37,7 @@ var en = {
|
|
|
37
37
|
"workspace-save": "Save",
|
|
38
38
|
"workspace-save-as": "Save as",
|
|
39
39
|
"workspace-edit": "Edit (name and abstract)",
|
|
40
|
+
"workspace-edit-title": "Edit title",
|
|
40
41
|
"workspace-share": "Share",
|
|
41
42
|
"workspace-stop-share": "Unshare",
|
|
42
43
|
"geoweb-welcome": "Welcome to GeoWeb. Please use one of the presets to open up new views",
|
|
@@ -113,7 +114,20 @@ var en = {
|
|
|
113
114
|
"workspace-loading-indicator-loading": "Loading",
|
|
114
115
|
"workspace-loading-indicator-idle": "Loaded",
|
|
115
116
|
"workspace-open-tab": "Open in new tab",
|
|
116
|
-
"workspace-currently": "Currently"
|
|
117
|
+
"workspace-currently": "Currently",
|
|
118
|
+
"workspace-presets-form-labels-info": "View type will not be cleared.",
|
|
119
|
+
"workspace-presets-form-labels-clearAll": "Clear all filters ({{count}})",
|
|
120
|
+
"workspace-presets-form-labels-collapseAll": "Collapse",
|
|
121
|
+
"workspace-presets-form-labels-expandAll": "Expand all",
|
|
122
|
+
"workspace-presets-form-labels-header": "Labels",
|
|
123
|
+
"workspace-labels-purpose": "Purpose",
|
|
124
|
+
"workspace-labels-parameters": "Parameters",
|
|
125
|
+
"workspace-labels-phenomena": "Phenomenon",
|
|
126
|
+
"workspace-labels-dataType": "Data Type",
|
|
127
|
+
"workspace-labels-dataSource": "Data Source",
|
|
128
|
+
"workspace-labels-viewType": "View Type",
|
|
129
|
+
"workspace-presets-form-active-labels": "Active labels ({{count}})",
|
|
130
|
+
"workspace-label-active": "ACTIVE"
|
|
117
131
|
};
|
|
118
132
|
var fi = {
|
|
119
133
|
"workspace-menu": "Workspace menu",
|
|
@@ -126,6 +140,7 @@ var fi = {
|
|
|
126
140
|
"workspace-save": "Tallenna",
|
|
127
141
|
"workspace-save-as": "Tallenna nimellä",
|
|
128
142
|
"workspace-edit": "Muokkaa (nimeä ja tiivistelmää)",
|
|
143
|
+
"workspace-edit-title": "Muokkaa otsikkoa",
|
|
129
144
|
"workspace-share": "Missing-translation",
|
|
130
145
|
"workspace-stop-share": "Missing-translation",
|
|
131
146
|
"geoweb-welcome": "Tervetuloa Geoweb-sovellukseen. Valitse jokin preset avataksesi uusia näkymiä",
|
|
@@ -197,7 +212,20 @@ var fi = {
|
|
|
197
212
|
"workspace-viewpreset-success-unshare": "ei käännetty",
|
|
198
213
|
"workspace-loading-indicator-loading": "Ladataan",
|
|
199
214
|
"workspace-loading-indicator-idle": "Ladattu",
|
|
200
|
-
"workspace-currently": "Nykyinen"
|
|
215
|
+
"workspace-currently": "Nykyinen",
|
|
216
|
+
"workspace-presets-form-labels-info": "ei käännetty",
|
|
217
|
+
"workspace-presets-form-labels-clearAll": "ei käännetty ({{count}})",
|
|
218
|
+
"workspace-presets-form-labels-collapseAll": "ei käännetty",
|
|
219
|
+
"workspace-presets-form-labels-expandAll": "ei käännetty",
|
|
220
|
+
"workspace-presets-form-labels-header": "ei käännetty",
|
|
221
|
+
"workspace-labels-purpose": "ei käännetty",
|
|
222
|
+
"workspace-labels-parameters": "ei käännetty",
|
|
223
|
+
"workspace-labels-phenomena": "ei käännetty",
|
|
224
|
+
"workspace-labels-dataType": "ei käännetty",
|
|
225
|
+
"workspace-labels-dataSource": "ei käännetty",
|
|
226
|
+
"workspace-labels-viewType": "ei käännetty",
|
|
227
|
+
"workspace-presets-form-active-labels": "ei käännetty ({{count}})",
|
|
228
|
+
"workspace-label-active": "ACTIVE"
|
|
201
229
|
};
|
|
202
230
|
var no = {
|
|
203
231
|
"workspace-menu": "Arbeidsflater",
|
|
@@ -210,6 +238,7 @@ var no = {
|
|
|
210
238
|
"workspace-save": "Lagre",
|
|
211
239
|
"workspace-save-as": "Lagre som",
|
|
212
240
|
"workspace-edit": "Endre (navn og sammendrag)",
|
|
241
|
+
"workspace-edit-title": "Endre tittel",
|
|
213
242
|
"workspace-share": "Del",
|
|
214
243
|
"workspace-stop-share": "Stopp deling",
|
|
215
244
|
"geoweb-welcome": "Velkommen til GeoWeb. Åpne et forhåndsvalg for å åpne nye vinduer",
|
|
@@ -282,7 +311,20 @@ var no = {
|
|
|
282
311
|
"workspace-viewpreset-success-unshare": "Vinduet \"{{TITLE}}\" deles ikke lenger",
|
|
283
312
|
"workspace-loading-indicator-loading": "Laster inn",
|
|
284
313
|
"workspace-loading-indicator-idle": "Lastet inn",
|
|
285
|
-
"workspace-currently": "Nåværende"
|
|
314
|
+
"workspace-currently": "Nåværende",
|
|
315
|
+
"workspace-presets-form-labels-info": "Komponent blir ikke fjernet.",
|
|
316
|
+
"workspace-presets-form-labels-clearAll": "Fjern alle filtre ({{count}})",
|
|
317
|
+
"workspace-presets-form-labels-collapseAll": "Lukk",
|
|
318
|
+
"workspace-presets-form-labels-expandAll": "Utvid alle",
|
|
319
|
+
"workspace-presets-form-labels-header": "Nøkkelord",
|
|
320
|
+
"workspace-labels-purpose": "Formål",
|
|
321
|
+
"workspace-labels-parameters": "Parametere",
|
|
322
|
+
"workspace-labels-phenomena": "Fenomen",
|
|
323
|
+
"workspace-labels-dataType": "Datatype",
|
|
324
|
+
"workspace-labels-dataSource": "Datakilde",
|
|
325
|
+
"workspace-labels-viewType": "Komponent",
|
|
326
|
+
"workspace-presets-form-active-labels": "Aktive valg ({{count}})",
|
|
327
|
+
"workspace-label-active": "AKTIV"
|
|
286
328
|
};
|
|
287
329
|
var nl = {
|
|
288
330
|
"workspace-menu": "Workspace menu",
|
|
@@ -295,6 +337,7 @@ var nl = {
|
|
|
295
337
|
"workspace-save": "Opslaan",
|
|
296
338
|
"workspace-save-as": "Opslaan als",
|
|
297
339
|
"workspace-edit": "Aanpassen (naam en abstract)",
|
|
340
|
+
"workspace-edit-title": "Titel bewerken",
|
|
298
341
|
"workspace-share": "Delen",
|
|
299
342
|
"workspace-stop-share": "Stoppen met delen",
|
|
300
343
|
"geoweb-welcome": "Welkom bij GeoWeb. Kies een van de presets om een nieuw venster te openen",
|
|
@@ -370,7 +413,20 @@ var nl = {
|
|
|
370
413
|
"workspace-loading-indicator-loading": "Aan het laden",
|
|
371
414
|
"workspace-loading-indicator-idle": "Klaar met laden",
|
|
372
415
|
"workspace-open-tab": "Open in nieuw tabblad",
|
|
373
|
-
"workspace-currently": "Huidig"
|
|
416
|
+
"workspace-currently": "Huidig",
|
|
417
|
+
"workspace-presets-form-labels-info": "niet vertaald",
|
|
418
|
+
"workspace-presets-form-labels-clearAll": "niet vertaald ({{count}})",
|
|
419
|
+
"workspace-presets-form-labels-collapseAll": "niet vertaald",
|
|
420
|
+
"workspace-presets-form-labels-expandAll": "niet vertaald",
|
|
421
|
+
"workspace-presets-form-labels-header": "niet vertaald",
|
|
422
|
+
"workspace-labels-purpose": "niet vertaald",
|
|
423
|
+
"workspace-labels-parameters": "niet vertaald",
|
|
424
|
+
"workspace-labels-phenomena": "niet vertaald",
|
|
425
|
+
"workspace-labels-dataType": "niet vertaald",
|
|
426
|
+
"workspace-labels-dataSource": "niet vertaald",
|
|
427
|
+
"workspace-labels-viewType": "niet vertaald",
|
|
428
|
+
"workspace-presets-form-active-labels": "niet vertaald ({{count}})",
|
|
429
|
+
"workspace-label-active": "ACTIVE"
|
|
374
430
|
};
|
|
375
431
|
var workspaceTranslations = {
|
|
376
432
|
en: en,
|
|
@@ -749,19 +805,31 @@ var getViewPresetState = function getViewPresetState(viewPresetId, mosaicNodeId,
|
|
|
749
805
|
};
|
|
750
806
|
var getLoadingWorkspace = function getLoadingWorkspace(workspacePreset) {
|
|
751
807
|
var views = workspacePreset.views.reduce(function (object, viewDetails) {
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
}
|
|
808
|
+
// If the view has a linked preset → use loading placeholder
|
|
809
|
+
if (viewDetails.viewPresetId) {
|
|
810
|
+
// eslint-disable-next-line no-param-reassign
|
|
811
|
+
object.byId[viewDetails.mosaicNodeId] = getViewPresetState(viewDetails.viewPresetId, viewDetails.mosaicNodeId, 'loading');
|
|
812
|
+
} else {
|
|
813
|
+
var _viewDetails$componen, _viewDetails$initialP;
|
|
814
|
+
// Inline view — hydrate it directly
|
|
815
|
+
// eslint-disable-next-line no-param-reassign
|
|
816
|
+
object.byId[viewDetails.mosaicNodeId] = {
|
|
817
|
+
id: viewDetails.mosaicNodeId,
|
|
818
|
+
mosaicNodeId: viewDetails.mosaicNodeId,
|
|
819
|
+
title: viewDetails.title,
|
|
820
|
+
componentType: (_viewDetails$componen = viewDetails.componentType) != null ? _viewDetails$componen : '',
|
|
821
|
+
initialProps: (_viewDetails$initialP = viewDetails.initialProps) != null ? _viewDetails$initialP : {}
|
|
822
|
+
};
|
|
823
|
+
}
|
|
824
|
+
object.allIds.push(viewDetails.mosaicNodeId);
|
|
825
|
+
return object;
|
|
757
826
|
}, {
|
|
758
827
|
allIds: [],
|
|
759
828
|
byId: {}
|
|
760
829
|
});
|
|
761
|
-
|
|
830
|
+
return Object.assign({}, workspacePreset, {
|
|
762
831
|
views: views
|
|
763
832
|
});
|
|
764
|
-
return combinedWorkspacePreset;
|
|
765
833
|
};
|
|
766
834
|
var BATCH_SIZE = 3;
|
|
767
835
|
var getListInChunks = function getListInChunks(views) {
|
|
@@ -779,9 +847,10 @@ var getSyncGroups = function getSyncGroups(syncGroups) {
|
|
|
779
847
|
syncGroups = [];
|
|
780
848
|
}
|
|
781
849
|
var presetSyncGroups = syncGroups.map(function (syncGroup) {
|
|
850
|
+
var _syncGroup$title;
|
|
782
851
|
return {
|
|
783
852
|
groupId: syncGroup.id,
|
|
784
|
-
title: syncGroup.title
|
|
853
|
+
title: (_syncGroup$title = syncGroup.title) != null ? _syncGroup$title : syncGroup.id,
|
|
785
854
|
type: syncGroup.type
|
|
786
855
|
};
|
|
787
856
|
});
|
|
@@ -820,56 +889,56 @@ var getErrorMessage = function getErrorMessage(error) {
|
|
|
820
889
|
var suffix = (_error$response = error.response) == null || (_error$response = _error$response.data) == null ? void 0 : _error$response.message;
|
|
821
890
|
return suffix ? prefix + ": " + suffix : prefix;
|
|
822
891
|
};
|
|
823
|
-
var
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
case 6:
|
|
846
|
-
if (!shouldUpdateView) {
|
|
847
|
-
_context.next = 9;
|
|
848
|
-
break;
|
|
849
|
-
}
|
|
850
|
-
_payload = {
|
|
851
|
-
panelId: view.mosaicNodeId,
|
|
852
|
-
viewPresetId: '',
|
|
853
|
-
viewPreset: Object.assign({}, viewPresetEntity, {
|
|
854
|
-
// update scope
|
|
855
|
-
scope: scope
|
|
856
|
-
})
|
|
857
|
-
};
|
|
858
|
-
return _context.abrupt("return", saveViewPreset({
|
|
859
|
-
payload: _payload
|
|
860
|
-
}, true));
|
|
861
|
-
case 9:
|
|
862
|
-
return _context.abrupt("return", viewPresetEntity);
|
|
863
|
-
case 10:
|
|
864
|
-
case "end":
|
|
865
|
-
return _context.stop();
|
|
866
|
-
}
|
|
867
|
-
}, _callee);
|
|
868
|
-
}));
|
|
869
|
-
return function (_x) {
|
|
870
|
-
return _ref.apply(this, arguments);
|
|
892
|
+
var toViewsArray = function toViewsArray(wsViews) {
|
|
893
|
+
if (!wsViews) {
|
|
894
|
+
return [];
|
|
895
|
+
}
|
|
896
|
+
if (Array.isArray(wsViews)) {
|
|
897
|
+
return wsViews;
|
|
898
|
+
}
|
|
899
|
+
var allIds = wsViews.allIds,
|
|
900
|
+
byId = wsViews.byId;
|
|
901
|
+
if (!allIds || !byId) {
|
|
902
|
+
return [];
|
|
903
|
+
}
|
|
904
|
+
return allIds.map(function (id) {
|
|
905
|
+
var _byId$id;
|
|
906
|
+
var view = (_byId$id = byId[id]) != null ? _byId$id : {};
|
|
907
|
+
return {
|
|
908
|
+
mosaicNodeId: id,
|
|
909
|
+
title: view.title,
|
|
910
|
+
componentType: view.componentType,
|
|
911
|
+
initialProps: view.initialProps,
|
|
912
|
+
viewPresetId: view.viewPresetId,
|
|
913
|
+
originalViewPresetId: view.originalViewPresetId
|
|
871
914
|
};
|
|
872
|
-
}
|
|
915
|
+
});
|
|
916
|
+
};
|
|
917
|
+
|
|
918
|
+
/* *
|
|
919
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
920
|
+
* you may not use this file except in compliance with the License.
|
|
921
|
+
* You may obtain a copy of the License at
|
|
922
|
+
*
|
|
923
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
924
|
+
*
|
|
925
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
926
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
927
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
928
|
+
* See the License for the specific language governing permissions and
|
|
929
|
+
* limitations under the License.
|
|
930
|
+
*
|
|
931
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
932
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
933
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
934
|
+
* */
|
|
935
|
+
var routes = {
|
|
936
|
+
root: '/',
|
|
937
|
+
workspace: '/workspace',
|
|
938
|
+
workspaceDetail: '/workspace/:workspaceId'
|
|
939
|
+
};
|
|
940
|
+
var getWorkspaceRouteUrl = function getWorkspaceRouteUrl(workspaceId) {
|
|
941
|
+
return workspaceId ? routes.workspaceDetail.replace(':workspaceId', workspaceId) : routes.workspace;
|
|
873
942
|
};
|
|
874
943
|
|
|
875
944
|
/* *
|
|
@@ -902,6 +971,7 @@ var WorkspacePresetAction;
|
|
|
902
971
|
WorkspacePresetAction["DELETE_SYSTEM_PRESET"] = "DELETE_SYSTEM_PRESET";
|
|
903
972
|
WorkspacePresetAction["SHARE"] = "SHARE";
|
|
904
973
|
WorkspacePresetAction["OPEN_TAB"] = "OPEN_TAB";
|
|
974
|
+
WorkspacePresetAction["EDIT_TITLE"] = "EDIT_TITLE";
|
|
905
975
|
})(WorkspacePresetAction || (WorkspacePresetAction = {}));
|
|
906
976
|
var WorkspaceErrorType;
|
|
907
977
|
(function (WorkspaceErrorType) {
|
|
@@ -1469,11 +1539,40 @@ var slice$2 = createSlice({
|
|
|
1469
1539
|
});
|
|
1470
1540
|
}
|
|
1471
1541
|
});
|
|
1542
|
+
builder.addCase(workspaceListActions.onSuccessWorkspacePresetAction, function (draft, action) {
|
|
1543
|
+
var _action$payload12 = action.payload,
|
|
1544
|
+
wsAction = _action$payload12.action,
|
|
1545
|
+
views = _action$payload12.views;
|
|
1546
|
+
var shouldClear = wsAction === WorkspacePresetAction.SAVE || wsAction === WorkspacePresetAction.SAVE_AS || wsAction === WorkspacePresetAction.SAVE_SYSTEM_PRESET || wsAction === WorkspacePresetAction.SAVE_SYSTEM_PRESET_AS || wsAction === WorkspacePresetAction.EDIT;
|
|
1547
|
+
if (!shouldClear) {
|
|
1548
|
+
return;
|
|
1549
|
+
}
|
|
1550
|
+
var viewIds = (views != null ? views : []).map(function (view) {
|
|
1551
|
+
return view.mosaicNodeId;
|
|
1552
|
+
}).filter(Boolean);
|
|
1553
|
+
if (viewIds.length) {
|
|
1554
|
+
viewIds.forEach(function (panelId) {
|
|
1555
|
+
var entity = draft.entities[panelId];
|
|
1556
|
+
if (entity) {
|
|
1557
|
+
entity.hasChanges = false;
|
|
1558
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
1559
|
+
}
|
|
1560
|
+
});
|
|
1561
|
+
return;
|
|
1562
|
+
}
|
|
1563
|
+
Object.values(draft.entities).forEach(function (entity) {
|
|
1564
|
+
if (entity) {
|
|
1565
|
+
// eslint-disable-next-line no-param-reassign
|
|
1566
|
+
entity.hasChanges = false;
|
|
1567
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
1568
|
+
}
|
|
1569
|
+
});
|
|
1570
|
+
});
|
|
1472
1571
|
warningsPresetChangeActions.map(function (warningsAction) {
|
|
1473
1572
|
return builder.addCase(warningsAction, function (draft, action) {
|
|
1474
|
-
var _action$
|
|
1475
|
-
systemUpdate = _action$
|
|
1476
|
-
panelId = _action$
|
|
1573
|
+
var _action$payload13 = action.payload,
|
|
1574
|
+
systemUpdate = _action$payload13.systemUpdate,
|
|
1575
|
+
panelId = _action$payload13.panelId;
|
|
1477
1576
|
if (!systemUpdate && panelId) {
|
|
1478
1577
|
var entity = draft.entities[panelId];
|
|
1479
1578
|
if (entity && !(entity != null && entity.hasChanges)) {
|
|
@@ -1485,9 +1584,9 @@ var slice$2 = createSlice({
|
|
|
1485
1584
|
});
|
|
1486
1585
|
syncGroupChangeActions.map(function (syncGroupAction) {
|
|
1487
1586
|
return builder.addCase(syncGroupAction, function (draft, action) {
|
|
1488
|
-
var _action$
|
|
1489
|
-
origin = _action$
|
|
1490
|
-
targetId = _action$
|
|
1587
|
+
var _action$payload14 = action.payload,
|
|
1588
|
+
origin = _action$payload14.origin,
|
|
1589
|
+
targetId = _action$payload14.targetId;
|
|
1491
1590
|
if (origin === 'user') {
|
|
1492
1591
|
var entity = draft.entities[targetId];
|
|
1493
1592
|
if (entity && !(entity != null && entity.hasChanges)) {
|
|
@@ -1499,9 +1598,9 @@ var slice$2 = createSlice({
|
|
|
1499
1598
|
});
|
|
1500
1599
|
mapPresetChangeActions.map(function (mapPresetAction) {
|
|
1501
1600
|
return builder.addCase(mapPresetAction, function (draft, action) {
|
|
1502
|
-
var _action$
|
|
1503
|
-
mapId = _action$
|
|
1504
|
-
origin = _action$
|
|
1601
|
+
var _action$payload15 = action.payload,
|
|
1602
|
+
mapId = _action$payload15.mapId,
|
|
1603
|
+
origin = _action$payload15.origin;
|
|
1505
1604
|
var isChangeOriginSupported = supportedMapActionOrigins.indexOf(origin) >= 0;
|
|
1506
1605
|
if (isChangeOriginSupported && mapId) {
|
|
1507
1606
|
var entity = draft.entities[mapId];
|
|
@@ -1514,9 +1613,9 @@ var slice$2 = createSlice({
|
|
|
1514
1613
|
});
|
|
1515
1614
|
timeSeriesPresetChangeActions.map(function (timeSeriesPresetAction) {
|
|
1516
1615
|
return builder.addCase(timeSeriesPresetAction, function (draft, action) {
|
|
1517
|
-
var _action$
|
|
1518
|
-
panelId = _action$
|
|
1519
|
-
origin = _action$
|
|
1616
|
+
var _action$payload16 = action.payload,
|
|
1617
|
+
panelId = _action$payload16.panelId,
|
|
1618
|
+
origin = _action$payload16.origin;
|
|
1520
1619
|
var isChangeOriginSupported = supportedTimeSeriesActionOrigins.indexOf(origin) >= 0;
|
|
1521
1620
|
var changesRelevantProperties = timeSeriesPresetAction.type === timeSeriesActions.patchParameter.type ? Object.keys(action.payload.parameter).filter(function (key) {
|
|
1522
1621
|
return key !== 'id' && key !== 'instanceId';
|
|
@@ -1690,6 +1789,7 @@ function getEmptyWorkspaceListItem(t) {
|
|
|
1690
1789
|
return {
|
|
1691
1790
|
id: undefined,
|
|
1692
1791
|
title: t ? t('workspace-new') : undefined,
|
|
1792
|
+
labels: undefined,
|
|
1693
1793
|
scope: 'system',
|
|
1694
1794
|
"abstract": '',
|
|
1695
1795
|
viewType: 'singleWindow'
|
|
@@ -1868,6 +1968,7 @@ var slice$1 = createSlice({
|
|
|
1868
1968
|
draft.id = '';
|
|
1869
1969
|
draft.title = workspacePreset.title;
|
|
1870
1970
|
draft["abstract"] = workspacePreset["abstract"];
|
|
1971
|
+
draft.labels = workspacePreset.labels;
|
|
1871
1972
|
draft.scope = workspacePreset.scope;
|
|
1872
1973
|
draft.syncGroups = [];
|
|
1873
1974
|
},
|
|
@@ -1902,6 +2003,7 @@ var slice$1 = createSlice({
|
|
|
1902
2003
|
draft.scope = action.payload.workspacePreset.scope;
|
|
1903
2004
|
draft.viewType = action.payload.workspacePreset.viewType;
|
|
1904
2005
|
draft.isTimeScrollingEnabled = action.payload.workspacePreset.isTimeScrollingEnabled;
|
|
2006
|
+
draft.labels = action.payload.workspacePreset.labels;
|
|
1905
2007
|
return draft;
|
|
1906
2008
|
},
|
|
1907
2009
|
setPreventCloseView: function setPreventCloseView(draft, action) {
|
|
@@ -1920,11 +2022,56 @@ var slice$1 = createSlice({
|
|
|
1920
2022
|
loadedWorkspace: function loadedWorkspace(draft, action) {
|
|
1921
2023
|
var _action$payload3;
|
|
1922
2024
|
draft.isLoading = false;
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
2025
|
+
var ws = (_action$payload3 = action.payload) == null ? void 0 : _action$payload3.workspace;
|
|
2026
|
+
if (!ws) {
|
|
2027
|
+
return;
|
|
2028
|
+
}
|
|
2029
|
+
draft.title = ws.title;
|
|
2030
|
+
draft["abstract"] = ws["abstract"];
|
|
2031
|
+
draft.labels = ws.labels;
|
|
2032
|
+
var wsViews = ws.views;
|
|
2033
|
+
var viewsArray = [];
|
|
2034
|
+
if (Array.isArray(wsViews)) {
|
|
2035
|
+
viewsArray = wsViews;
|
|
2036
|
+
} else if (wsViews != null && wsViews.byId && Array.isArray(wsViews.allIds)) {
|
|
2037
|
+
viewsArray = wsViews.allIds.map(function (id) {
|
|
2038
|
+
var _wsViews$byId$id;
|
|
2039
|
+
var viewData = (_wsViews$byId$id = wsViews.byId[id]) != null ? _wsViews$byId$id : {};
|
|
2040
|
+
return {
|
|
2041
|
+
mosaicNodeId: id,
|
|
2042
|
+
title: viewData.title,
|
|
2043
|
+
componentType: viewData.componentType,
|
|
2044
|
+
initialProps: viewData.initialProps,
|
|
2045
|
+
viewPresetId: viewData.viewPresetId,
|
|
2046
|
+
originalViewPresetId: viewData.originalViewPresetId,
|
|
2047
|
+
"abstract": viewData["abstract"],
|
|
2048
|
+
scope: viewData.scope
|
|
2049
|
+
};
|
|
2050
|
+
});
|
|
2051
|
+
} else {
|
|
2052
|
+
viewsArray = [];
|
|
1927
2053
|
}
|
|
2054
|
+
draft.views = {
|
|
2055
|
+
byId: {},
|
|
2056
|
+
allIds: []
|
|
2057
|
+
};
|
|
2058
|
+
viewsArray.forEach(function (view) {
|
|
2059
|
+
var _view$componentType, _view$initialProps;
|
|
2060
|
+
var key = view.mosaicNodeId;
|
|
2061
|
+
if (!key) {
|
|
2062
|
+
return;
|
|
2063
|
+
}
|
|
2064
|
+
draft.views.byId[key] = {
|
|
2065
|
+
id: key,
|
|
2066
|
+
mosaicNodeId: key,
|
|
2067
|
+
title: typeof view.title === 'string' && view.title.trim().length ? view.title : key,
|
|
2068
|
+
componentType: (_view$componentType = view.componentType) != null ? _view$componentType : 'Map',
|
|
2069
|
+
initialProps: (_view$initialProps = view.initialProps) != null ? _view$initialProps : {}
|
|
2070
|
+
};
|
|
2071
|
+
draft.views.allIds.push(key);
|
|
2072
|
+
});
|
|
2073
|
+
draft.hasChanges = false;
|
|
2074
|
+
draft.error = undefined;
|
|
1928
2075
|
},
|
|
1929
2076
|
errorWorkspace: function errorWorkspace(draft, action) {
|
|
1930
2077
|
var error = action.payload.error;
|
|
@@ -1935,6 +2082,9 @@ var slice$1 = createSlice({
|
|
|
1935
2082
|
saveWorkspacePreset: function saveWorkspacePreset(draft, _action) {
|
|
1936
2083
|
draft.isLoading = true;
|
|
1937
2084
|
draft.error = undefined;
|
|
2085
|
+
},
|
|
2086
|
+
markWorkspaceChanged: function markWorkspaceChanged(draft) {
|
|
2087
|
+
draft.hasChanges = true;
|
|
1938
2088
|
}
|
|
1939
2089
|
},
|
|
1940
2090
|
extraReducers: function extraReducers(builder) {
|
|
@@ -1943,15 +2093,29 @@ var slice$1 = createSlice({
|
|
|
1943
2093
|
draft.id = action.payload.workspaceId;
|
|
1944
2094
|
draft.title = action.payload.title;
|
|
1945
2095
|
draft["abstract"] = action.payload["abstract"];
|
|
2096
|
+
draft.labels = action.payload.labels;
|
|
1946
2097
|
draft.hasChanges = false;
|
|
1947
2098
|
draft.scope = action.payload.scope || 'user';
|
|
1948
2099
|
}
|
|
1949
|
-
if (action.payload.action === WorkspacePresetAction.EDIT && action.payload.workspaceId === draft.id) {
|
|
1950
|
-
|
|
1951
|
-
|
|
2100
|
+
if ((action.payload.action === WorkspacePresetAction.EDIT || action.payload.action === WorkspacePresetAction.EDIT_TITLE) && action.payload.workspaceId === draft.id) {
|
|
2101
|
+
var _draft$views;
|
|
2102
|
+
// Only EDIT updates ws title/abstract
|
|
2103
|
+
if (action.payload.action === WorkspacePresetAction.EDIT) {
|
|
2104
|
+
draft.title = action.payload.title;
|
|
2105
|
+
draft["abstract"] = action.payload["abstract"];
|
|
2106
|
+
draft.labels = action.payload.labels;
|
|
2107
|
+
}
|
|
2108
|
+
var changedViews = action.payload.views;
|
|
2109
|
+
if (changedViews && (_draft$views = draft.views) != null && _draft$views.byId) {
|
|
2110
|
+
changedViews.forEach(function (view) {
|
|
2111
|
+
var key = view.mosaicNodeId;
|
|
2112
|
+
if (key && draft.views.byId[key]) {
|
|
2113
|
+
var _view$title;
|
|
2114
|
+
draft.views.byId[key].title = (_view$title = view.title) != null ? _view$title : draft.views.byId[key].title;
|
|
2115
|
+
}
|
|
2116
|
+
});
|
|
2117
|
+
}
|
|
1952
2118
|
}
|
|
1953
|
-
// If current selected workspace is deleted
|
|
1954
|
-
// Remove the id, rename to empty workspace and set it has changes
|
|
1955
2119
|
if ((action.payload.action === WorkspacePresetAction.DELETE || action.payload.action === WorkspacePresetAction.DELETE_SYSTEM_PRESET) && action.payload.workspaceId === draft.id) {
|
|
1956
2120
|
delete draft.id;
|
|
1957
2121
|
draft.title = action.payload.emptyWorkspacePresetTitle;
|
|
@@ -2012,121 +2176,6 @@ var slice$1 = createSlice({
|
|
|
2012
2176
|
var workspaceReducer = slice$1.reducer;
|
|
2013
2177
|
var workspaceActions = Object.assign({}, slice$1.actions);
|
|
2014
2178
|
|
|
2015
|
-
/* *
|
|
2016
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2017
|
-
* you may not use this file except in compliance with the License.
|
|
2018
|
-
* You may obtain a copy of the License at
|
|
2019
|
-
*
|
|
2020
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2021
|
-
*
|
|
2022
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2023
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2024
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2025
|
-
* See the License for the specific language governing permissions and
|
|
2026
|
-
* limitations under the License.
|
|
2027
|
-
*
|
|
2028
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2029
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2030
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2031
|
-
* */
|
|
2032
|
-
var getViewPresetsStore = function getViewPresetsStore(store) {
|
|
2033
|
-
if (store && store.viewPresets) {
|
|
2034
|
-
return store.viewPresets;
|
|
2035
|
-
}
|
|
2036
|
-
return initialState$2;
|
|
2037
|
-
};
|
|
2038
|
-
var EMPTY_VIEW_PRESETS = {
|
|
2039
|
-
entities: {},
|
|
2040
|
-
ids: []
|
|
2041
|
-
};
|
|
2042
|
-
var selectors$2 = viewPresetsAdapter.getSelectors(function (state) {
|
|
2043
|
-
var _state$viewPresets;
|
|
2044
|
-
return (_state$viewPresets = state == null ? void 0 : state.viewPresets) != null ? _state$viewPresets : EMPTY_VIEW_PRESETS;
|
|
2045
|
-
});
|
|
2046
|
-
var getViewPresets = selectors$2.selectAll,
|
|
2047
|
-
getViewPresetById = selectors$2.selectById;
|
|
2048
|
-
var getViewPresetsIsFetching = createSelector(getViewPresetById, function (_store, panelId) {
|
|
2049
|
-
return panelId;
|
|
2050
|
-
}, function (viewPreset) {
|
|
2051
|
-
return (viewPreset == null ? void 0 : viewPreset.isFetching) || false;
|
|
2052
|
-
}, selectorMemoizationOptions);
|
|
2053
|
-
var getViewPresetsError = createSelector(getViewPresetById, function (_store, panelId) {
|
|
2054
|
-
return panelId;
|
|
2055
|
-
}, function (viewPreset) {
|
|
2056
|
-
return viewPreset == null ? void 0 : viewPreset.error;
|
|
2057
|
-
}, selectorMemoizationOptions);
|
|
2058
|
-
var getViewPresetDetailError = createSelector(getViewPresetsError, function (_store, panelId) {
|
|
2059
|
-
return panelId;
|
|
2060
|
-
}, function (error) {
|
|
2061
|
-
if (error && error.component === 'PRESET_DETAIL') {
|
|
2062
|
-
return error.message;
|
|
2063
|
-
}
|
|
2064
|
-
return undefined;
|
|
2065
|
-
}, selectorMemoizationOptions);
|
|
2066
|
-
var getViewPresetHasChanges = createSelector(getViewPresetById, function (_store, panelId) {
|
|
2067
|
-
return panelId;
|
|
2068
|
-
}, function (viewPreset) {
|
|
2069
|
-
return viewPreset == null ? void 0 : viewPreset.hasChanges;
|
|
2070
|
-
}, selectorMemoizationOptions);
|
|
2071
|
-
var getViewPresetActiveId = createSelector(getViewPresetById, function (_store, panelId) {
|
|
2072
|
-
return panelId;
|
|
2073
|
-
}, function (viewPreset) {
|
|
2074
|
-
return viewPreset == null ? void 0 : viewPreset.activeViewPresetId;
|
|
2075
|
-
}, selectorMemoizationOptions);
|
|
2076
|
-
createSelector(getViewPresets, function (store, mapId) {
|
|
2077
|
-
return mapId;
|
|
2078
|
-
}, function (viewPresets, mapId) {
|
|
2079
|
-
var _viewPresets$find$pan, _viewPresets$find;
|
|
2080
|
-
return (_viewPresets$find$pan = (_viewPresets$find = viewPresets.find(function (preset) {
|
|
2081
|
-
return preset.activeViewPresetId === mapId;
|
|
2082
|
-
})) == null ? void 0 : _viewPresets$find.panelId) != null ? _viewPresets$find$pan : '';
|
|
2083
|
-
}, selectorMemoizationOptions);
|
|
2084
|
-
var getDialogOptions = createSelector(getViewPresetsStore, function (store) {
|
|
2085
|
-
return store;
|
|
2086
|
-
}, function (store) {
|
|
2087
|
-
return store.viewPresetDialog || undefined;
|
|
2088
|
-
}, selectorMemoizationOptions);
|
|
2089
|
-
var getIsViewPresetListDialogOpen = createSelector(getViewPresetById, function (_store, panelId) {
|
|
2090
|
-
return panelId;
|
|
2091
|
-
}, function (viewPreset) {
|
|
2092
|
-
return (viewPreset == null ? void 0 : viewPreset.isViewPresetListDialogOpen) || false;
|
|
2093
|
-
}, selectorMemoizationOptions);
|
|
2094
|
-
var getViewPresetListFiltersForView = createSelector(getViewPresetById, function (_store, _panelId, scope) {
|
|
2095
|
-
return scope;
|
|
2096
|
-
}, function (_store, _panelId, _scope, isAdmin) {
|
|
2097
|
-
return isAdmin;
|
|
2098
|
-
}, function (viewPreset, _scope, isAdmin) {
|
|
2099
|
-
var filters = (viewPreset == null ? void 0 : viewPreset.filters) || [];
|
|
2100
|
-
if (isAdmin) {
|
|
2101
|
-
// Admin users: Only system and shared filters
|
|
2102
|
-
return filters.filter(function (filter) {
|
|
2103
|
-
return filter.id === 'system' || filter.id === 'shared';
|
|
2104
|
-
}).map(function (filter) {
|
|
2105
|
-
return Object.assign({}, filter, {
|
|
2106
|
-
isDisabled: false
|
|
2107
|
-
});
|
|
2108
|
-
});
|
|
2109
|
-
}
|
|
2110
|
-
// Regular users
|
|
2111
|
-
return filters.map(function (filter) {
|
|
2112
|
-
return Object.assign({}, filter, {
|
|
2113
|
-
isDisabled: false
|
|
2114
|
-
});
|
|
2115
|
-
});
|
|
2116
|
-
}, selectorMemoizationOptions);
|
|
2117
|
-
var getViewPresetListSearchQueryForView = createSelector(getViewPresetById, function (_store, panelId) {
|
|
2118
|
-
return panelId;
|
|
2119
|
-
}, function (viewPreset) {
|
|
2120
|
-
return (viewPreset == null ? void 0 : viewPreset.searchQuery) || '';
|
|
2121
|
-
}, selectorMemoizationOptions);
|
|
2122
|
-
// Used to retrieve the filtered view preset list for your view - if no filters/search applied it will be empty
|
|
2123
|
-
// To ensure you retrieve the view preset list specific for your view (incl and excl filters), use getFilteredViewPresetListForView
|
|
2124
|
-
var getViewPresetListFilterResultsForView = createSelector(getViewPresetById, function (viewPresetById) {
|
|
2125
|
-
var filteredResults = (viewPresetById == null ? void 0 : viewPresetById.filterResults) || {
|
|
2126
|
-
entities: {}};
|
|
2127
|
-
return Object.values(filteredResults.entities);
|
|
2128
|
-
}, selectorMemoizationOptions);
|
|
2129
|
-
|
|
2130
2179
|
/* *
|
|
2131
2180
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2132
2181
|
* you may not use this file except in compliance with the License.
|
|
@@ -2253,7 +2302,8 @@ var emptyViewPreset = function emptyViewPreset(componentType) {
|
|
|
2253
2302
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2254
2303
|
* */
|
|
2255
2304
|
var getWorkspaceState = function getWorkspaceState(store) {
|
|
2256
|
-
|
|
2305
|
+
var _store$workspace;
|
|
2306
|
+
return (_store$workspace = store == null ? void 0 : store.workspace) != null ? _store$workspace : initialState$1;
|
|
2257
2307
|
};
|
|
2258
2308
|
/**
|
|
2259
2309
|
* Gets component types from the views used in the workspace
|
|
@@ -2266,8 +2316,8 @@ var getComponentTypesFromActiveViews = createSelector([function (state) {
|
|
|
2266
2316
|
}], function (workspace) {
|
|
2267
2317
|
var viewIds = workspace == null ? void 0 : workspace.views.allIds; // Assuming you have all view IDs here
|
|
2268
2318
|
var componentTypes = viewIds == null ? void 0 : viewIds.map(function (viewId) {
|
|
2269
|
-
var _workspace$views;
|
|
2270
|
-
return (workspace == null || (_workspace$views = workspace.views) == null || (_workspace$views = _workspace$views.byId) == null || (_workspace$views = _workspace$views[viewId]) == null ? void 0 : _workspace$views.componentType)
|
|
2319
|
+
var _workspace$views$byId, _workspace$views;
|
|
2320
|
+
return (_workspace$views$byId = workspace == null || (_workspace$views = workspace.views) == null || (_workspace$views = _workspace$views.byId) == null || (_workspace$views = _workspace$views[viewId]) == null ? void 0 : _workspace$views.componentType) != null ? _workspace$views$byId : '';
|
|
2271
2321
|
});
|
|
2272
2322
|
return componentTypes;
|
|
2273
2323
|
});
|
|
@@ -2278,7 +2328,7 @@ var getComponentTypesFromActiveViews = createSelector([function (state) {
|
|
|
2278
2328
|
* @returns {MosaicNode<string>} returnType: MosaicNode<string>
|
|
2279
2329
|
*/
|
|
2280
2330
|
var getMosaicNode = createSelector(getWorkspaceState, function (state) {
|
|
2281
|
-
return state
|
|
2331
|
+
return state == null ? void 0 : state.mosaicNode;
|
|
2282
2332
|
}, selectorMemoizationOptions);
|
|
2283
2333
|
/**
|
|
2284
2334
|
* Gets view from workspace state
|
|
@@ -2313,10 +2363,12 @@ var getViewIds = createSelector(getWorkspaceState, function (store) {
|
|
|
2313
2363
|
* @returns {boolean} returnType: boolean
|
|
2314
2364
|
*/
|
|
2315
2365
|
var getShouldPreventClose = createSelector(getViewById, function (store) {
|
|
2316
|
-
|
|
2366
|
+
var _store$shouldPreventC;
|
|
2367
|
+
return (_store$shouldPreventC = store == null ? void 0 : store.shouldPreventClose) != null ? _store$shouldPreventC : false;
|
|
2317
2368
|
}, selectorMemoizationOptions);
|
|
2318
2369
|
var isWorkspaceLoading = createSelector(getWorkspaceState, function (store) {
|
|
2319
|
-
|
|
2370
|
+
var _store$isLoading;
|
|
2371
|
+
return (_store$isLoading = store == null ? void 0 : store.isLoading) != null ? _store$isLoading : false;
|
|
2320
2372
|
}, selectorMemoizationOptions);
|
|
2321
2373
|
var getWorkspaceError = createSelector(getWorkspaceState, function (store) {
|
|
2322
2374
|
return store == null ? void 0 : store.error;
|
|
@@ -2328,10 +2380,11 @@ var getWorkspaceError = createSelector(getWorkspaceState, function (store) {
|
|
|
2328
2380
|
* @returns {string} returnType: string
|
|
2329
2381
|
*/
|
|
2330
2382
|
var getSelectedWorkspaceTitle = createSelector(getWorkspaceState, function (store) {
|
|
2331
|
-
return store
|
|
2383
|
+
return (store == null ? void 0 : store.title) || '';
|
|
2332
2384
|
}, selectorMemoizationOptions);
|
|
2333
2385
|
var hasWorkspaceChanges = createSelector(getWorkspaceState, function (store) {
|
|
2334
|
-
|
|
2386
|
+
var _store$hasChanges;
|
|
2387
|
+
return (_store$hasChanges = store == null ? void 0 : store.hasChanges) != null ? _store$hasChanges : false;
|
|
2335
2388
|
}, selectorMemoizationOptions);
|
|
2336
2389
|
/**
|
|
2337
2390
|
* Gets selected viewType
|
|
@@ -2340,7 +2393,8 @@ var hasWorkspaceChanges = createSelector(getWorkspaceState, function (store) {
|
|
|
2340
2393
|
* @returns {string} returnType: string
|
|
2341
2394
|
*/
|
|
2342
2395
|
var getViewType = createSelector(getWorkspaceState, function (store) {
|
|
2343
|
-
|
|
2396
|
+
var _store$viewType;
|
|
2397
|
+
return (_store$viewType = store == null ? void 0 : store.viewType) != null ? _store$viewType : '';
|
|
2344
2398
|
}, selectorMemoizationOptions);
|
|
2345
2399
|
/**
|
|
2346
2400
|
* Gets selected workspace scope
|
|
@@ -2349,7 +2403,8 @@ var getViewType = createSelector(getWorkspaceState, function (store) {
|
|
|
2349
2403
|
* @returns {string} returnType: string
|
|
2350
2404
|
*/
|
|
2351
2405
|
var getSelectedWorkspaceScope = createSelector(getWorkspaceState, function (store) {
|
|
2352
|
-
|
|
2406
|
+
var _store$scope;
|
|
2407
|
+
return (_store$scope = store == null ? void 0 : store.scope) != null ? _store$scope : 'system';
|
|
2353
2408
|
}, selectorMemoizationOptions);
|
|
2354
2409
|
/**
|
|
2355
2410
|
* Gets workspace data to send to the backend
|
|
@@ -2357,7 +2412,7 @@ var getSelectedWorkspaceScope = createSelector(getWorkspaceState, function (stor
|
|
|
2357
2412
|
* @param {object} store store: object - Store object
|
|
2358
2413
|
* @returns {object} returnType: object - WorkspacePresetFromBE
|
|
2359
2414
|
*/
|
|
2360
|
-
var getWorkspaceData = createSelector(getWorkspaceState,
|
|
2415
|
+
var getWorkspaceData = createSelector(getWorkspaceState, genericSelectors.getSynchronizationGroupStore, function (workspaceStore, syncGroupsStore) {
|
|
2361
2416
|
var syncGroups = (syncGroupsStore == null ? void 0 : syncGroupsStore.groups.allIds.map(function (id) {
|
|
2362
2417
|
var type = syncGroupsStore.groups.byId[id].type;
|
|
2363
2418
|
return {
|
|
@@ -2365,51 +2420,67 @@ var getWorkspaceData = createSelector(getWorkspaceState, getViewPresetsStore, ge
|
|
|
2365
2420
|
type: type
|
|
2366
2421
|
};
|
|
2367
2422
|
})) || [];
|
|
2368
|
-
var views =
|
|
2369
|
-
var
|
|
2370
|
-
var
|
|
2423
|
+
var views = workspaceStore.views.allIds.map(function (mosaicNodeId) {
|
|
2424
|
+
var _view$componentType, _view$title, _view$id;
|
|
2425
|
+
var view = workspaceStore.views.byId[mosaicNodeId];
|
|
2371
2426
|
return {
|
|
2372
2427
|
mosaicNodeId: mosaicNodeId,
|
|
2373
|
-
|
|
2428
|
+
componentType: (_view$componentType = view == null ? void 0 : view.componentType) != null ? _view$componentType : 'Map',
|
|
2429
|
+
title: (_view$title = view == null ? void 0 : view.title) != null ? _view$title : mosaicNodeId,
|
|
2430
|
+
originalViewPresetId: (_view$id = view == null ? void 0 : view.id) != null ? _view$id : undefined
|
|
2374
2431
|
};
|
|
2375
2432
|
});
|
|
2376
|
-
var linkedState = pick(syncGroupsStore == null ? void 0 : syncGroupsStore.linkedState.links,
|
|
2433
|
+
var linkedState = pick(syncGroupsStore == null ? void 0 : syncGroupsStore.linkedState.links, workspaceStore.views.allIds);
|
|
2377
2434
|
return {
|
|
2378
|
-
id:
|
|
2379
|
-
title:
|
|
2435
|
+
id: workspaceStore.id,
|
|
2436
|
+
title: workspaceStore.title,
|
|
2380
2437
|
syncGroups: syncGroups,
|
|
2381
2438
|
views: views,
|
|
2382
|
-
viewType:
|
|
2383
|
-
scope:
|
|
2384
|
-
"abstract":
|
|
2385
|
-
mosaicNode:
|
|
2439
|
+
viewType: workspaceStore.viewType,
|
|
2440
|
+
scope: workspaceStore.scope,
|
|
2441
|
+
"abstract": workspaceStore["abstract"],
|
|
2442
|
+
mosaicNode: workspaceStore.mosaicNode,
|
|
2386
2443
|
isTimeScrollingEnabled: (syncGroupsStore == null ? void 0 : syncGroupsStore.isTimeScrollingEnabled) || false,
|
|
2387
|
-
linking: linkedState
|
|
2444
|
+
linking: linkedState,
|
|
2445
|
+
labels: workspaceStore.labels
|
|
2388
2446
|
};
|
|
2389
2447
|
}, selectorMemoizationOptions);
|
|
2390
2448
|
var getViewComponentType = createSelector(getViewById, function (store) {
|
|
2391
|
-
|
|
2449
|
+
var _store$componentType;
|
|
2450
|
+
return (_store$componentType = store == null ? void 0 : store.componentType) != null ? _store$componentType : 'Map';
|
|
2392
2451
|
}, selectorMemoizationOptions);
|
|
2393
|
-
var getViewPresetToSendToBackend = createSelector(getViewById, getViewComponentType, mapSelectors.getMapPreset, syncGroupsSelectors.getAllTargetGroupsForSource, timeSeriesSelectors.getTimeSeriesPreset,
|
|
2452
|
+
var getViewPresetToSendToBackend = createSelector(getViewById, getViewComponentType, mapSelectors.getMapPreset, syncGroupsSelectors.getAllTargetGroupsForSource, timeSeriesSelectors.getTimeSeriesPreset, publicWarningsSelectors.getWarningsPresetById, mapSelectors.getMultiMapInitialProps, mapSelectors.getTimeSliderInitialProps, function (store) {
|
|
2453
|
+
return store;
|
|
2454
|
+
}, function (panelId) {
|
|
2455
|
+
return panelId;
|
|
2456
|
+
}, function (workspaceView, viewComponentType, mapPreset, syncGroupsIds, timeSeriesPreset, warningsPreset, multiMapPreset, timeSliderPreset, store, panelId) {
|
|
2457
|
+
var _workspaceView$scope, _initialPropsByCompon;
|
|
2394
2458
|
var title = workspaceView == null ? void 0 : workspaceView.title;
|
|
2395
|
-
var scope = (workspaceView == null ? void 0 : workspaceView.scope)
|
|
2459
|
+
var scope = (_workspaceView$scope = workspaceView == null ? void 0 : workspaceView.scope) != null ? _workspaceView$scope : 'system';
|
|
2396
2460
|
var defaultInitialProps = {
|
|
2397
2461
|
mapPreset: mapPreset,
|
|
2398
2462
|
syncGroupsIds: syncGroupsIds
|
|
2399
2463
|
};
|
|
2464
|
+
var harmonieProps = mapSelectors.getHarmonieInitialProps(store, panelId, workspaceView == null ? void 0 : workspaceView.initialProps, syncGroupsIds);
|
|
2400
2465
|
var initialPropsByComponentType = {
|
|
2401
2466
|
Map: defaultInitialProps,
|
|
2402
|
-
TimeSeries: timeSeriesPreset
|
|
2467
|
+
TimeSeries: timeSeriesPreset,
|
|
2468
|
+
WarningList: warningsPreset,
|
|
2469
|
+
MultiMap: multiMapPreset != null ? multiMapPreset : defaultInitialProps,
|
|
2470
|
+
HarmonieTempAndPrecipPreset: harmonieProps != null && harmonieProps.layers ? {
|
|
2471
|
+
layers: harmonieProps.layers
|
|
2472
|
+
} : undefined,
|
|
2473
|
+
TimeSlider: timeSliderPreset
|
|
2403
2474
|
};
|
|
2404
2475
|
return Object.assign({}, emptyViewPreset(viewComponentType), {
|
|
2405
2476
|
id: workspaceView == null ? void 0 : workspaceView.id,
|
|
2406
2477
|
scope: scope,
|
|
2407
2478
|
title: title,
|
|
2408
|
-
initialProps: initialPropsByComponentType[viewComponentType]
|
|
2479
|
+
initialProps: (_initialPropsByCompon = initialPropsByComponentType[viewComponentType]) != null ? _initialPropsByCompon : defaultInitialProps
|
|
2409
2480
|
});
|
|
2410
2481
|
}, selectorMemoizationOptions);
|
|
2411
2482
|
|
|
2412
|
-
var selectors$
|
|
2483
|
+
var selectors$2 = /*#__PURE__*/Object.freeze({
|
|
2413
2484
|
__proto__: null,
|
|
2414
2485
|
getComponentTypesFromActiveViews: getComponentTypesFromActiveViews,
|
|
2415
2486
|
getMosaicNode: getMosaicNode,
|
|
@@ -2446,44 +2517,133 @@ var selectors$1 = /*#__PURE__*/Object.freeze({
|
|
|
2446
2517
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2447
2518
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2448
2519
|
* */
|
|
2449
|
-
var
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2520
|
+
var getViewPresetsStore = function getViewPresetsStore(store) {
|
|
2521
|
+
if (store && store.viewPresets) {
|
|
2522
|
+
return store.viewPresets;
|
|
2523
|
+
}
|
|
2524
|
+
return initialState$2;
|
|
2453
2525
|
};
|
|
2454
|
-
var
|
|
2455
|
-
|
|
2526
|
+
var EMPTY_VIEW_PRESETS = {
|
|
2527
|
+
entities: {},
|
|
2528
|
+
ids: []
|
|
2456
2529
|
};
|
|
2457
|
-
|
|
2458
|
-
var
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2530
|
+
var selectors$1 = viewPresetsAdapter.getSelectors(function (state) {
|
|
2531
|
+
var _state$viewPresets;
|
|
2532
|
+
return (_state$viewPresets = state == null ? void 0 : state.viewPresets) != null ? _state$viewPresets : EMPTY_VIEW_PRESETS;
|
|
2533
|
+
});
|
|
2534
|
+
var getViewPresets = selectors$1.selectAll,
|
|
2535
|
+
getViewPresetById = selectors$1.selectById;
|
|
2536
|
+
var getViewPresetsIsFetching = createSelector(getViewPresetById, function (_store, panelId) {
|
|
2537
|
+
return panelId;
|
|
2538
|
+
}, function (viewPreset) {
|
|
2539
|
+
return (viewPreset == null ? void 0 : viewPreset.isFetching) || false;
|
|
2540
|
+
}, selectorMemoizationOptions);
|
|
2541
|
+
var getViewPresetsError = createSelector(getViewPresetById, function (_store, panelId) {
|
|
2542
|
+
return panelId;
|
|
2543
|
+
}, function (viewPreset) {
|
|
2544
|
+
return viewPreset == null ? void 0 : viewPreset.error;
|
|
2545
|
+
}, selectorMemoizationOptions);
|
|
2546
|
+
var getViewPresetDetailError = createSelector(getViewPresetsError, function (_store, panelId) {
|
|
2547
|
+
return panelId;
|
|
2548
|
+
}, function (error) {
|
|
2549
|
+
if (error && error.component === 'PRESET_DETAIL') {
|
|
2550
|
+
return error.message;
|
|
2551
|
+
}
|
|
2552
|
+
return undefined;
|
|
2553
|
+
}, selectorMemoizationOptions);
|
|
2554
|
+
var getViewPresetHasChanges = createSelector(getViewPresetById, function (_store, panelId) {
|
|
2555
|
+
return panelId;
|
|
2556
|
+
}, function (viewPreset) {
|
|
2557
|
+
return viewPreset == null ? void 0 : viewPreset.hasChanges;
|
|
2558
|
+
}, selectorMemoizationOptions);
|
|
2559
|
+
var getViewPresetActiveId = createSelector(getViewPresetById, function (_store, panelId) {
|
|
2560
|
+
return panelId;
|
|
2561
|
+
}, function (viewPreset) {
|
|
2562
|
+
return viewPreset == null ? void 0 : viewPreset.activeViewPresetId;
|
|
2563
|
+
}, selectorMemoizationOptions);
|
|
2564
|
+
createSelector(getViewPresets, function (store, mapId) {
|
|
2565
|
+
return mapId;
|
|
2566
|
+
}, function (viewPresets, mapId) {
|
|
2567
|
+
var _viewPresets$find$pan, _viewPresets$find;
|
|
2568
|
+
return (_viewPresets$find$pan = (_viewPresets$find = viewPresets.find(function (preset) {
|
|
2569
|
+
return preset.activeViewPresetId === mapId;
|
|
2570
|
+
})) == null ? void 0 : _viewPresets$find.panelId) != null ? _viewPresets$find$pan : '';
|
|
2571
|
+
}, selectorMemoizationOptions);
|
|
2572
|
+
var getDialogOptions = createSelector(getViewPresetsStore, function (store) {
|
|
2573
|
+
return store;
|
|
2574
|
+
}, function (store) {
|
|
2575
|
+
return store.viewPresetDialog || undefined;
|
|
2576
|
+
}, selectorMemoizationOptions);
|
|
2577
|
+
var getIsViewPresetListDialogOpen = createSelector(getViewPresetById, function (_store, panelId) {
|
|
2578
|
+
return panelId;
|
|
2579
|
+
}, function (viewPreset) {
|
|
2580
|
+
return (viewPreset == null ? void 0 : viewPreset.isViewPresetListDialogOpen) || false;
|
|
2581
|
+
}, selectorMemoizationOptions);
|
|
2582
|
+
var getViewPresetListFiltersForView = createSelector(getViewPresetById, function (_store, _panelId, scope) {
|
|
2583
|
+
return scope;
|
|
2584
|
+
}, function (_store, _panelId, _scope, isAdmin) {
|
|
2585
|
+
return isAdmin;
|
|
2586
|
+
}, function (viewPreset, _scope, isAdmin) {
|
|
2587
|
+
var filters = (viewPreset == null ? void 0 : viewPreset.filters) || [];
|
|
2588
|
+
if (isAdmin) {
|
|
2589
|
+
// Admin users: Only system and shared filters
|
|
2590
|
+
return filters.filter(function (filter) {
|
|
2591
|
+
return filter.id === 'system' || filter.id === 'shared';
|
|
2592
|
+
}).map(function (filter) {
|
|
2593
|
+
return Object.assign({}, filter, {
|
|
2594
|
+
isDisabled: false
|
|
2595
|
+
});
|
|
2596
|
+
});
|
|
2597
|
+
}
|
|
2598
|
+
// Regular users
|
|
2599
|
+
return filters.map(function (filter) {
|
|
2600
|
+
return Object.assign({}, filter, {
|
|
2601
|
+
isDisabled: false
|
|
2602
|
+
});
|
|
2603
|
+
});
|
|
2604
|
+
}, selectorMemoizationOptions);
|
|
2605
|
+
var getViewPresetListSearchQueryForView = createSelector(getViewPresetById, function (_store, panelId) {
|
|
2606
|
+
return panelId;
|
|
2607
|
+
}, function (viewPreset) {
|
|
2608
|
+
return (viewPreset == null ? void 0 : viewPreset.searchQuery) || '';
|
|
2609
|
+
}, selectorMemoizationOptions);
|
|
2610
|
+
// Used to retrieve the filtered view preset list for your view - if no filters/search applied it will be empty
|
|
2611
|
+
// To ensure you retrieve the view preset list specific for your view (incl and excl filters), use getFilteredViewPresetListForView
|
|
2612
|
+
var getViewPresetListFilterResultsForView = createSelector(getViewPresetById, function (viewPresetById) {
|
|
2613
|
+
var filteredResults = (viewPresetById == null ? void 0 : viewPresetById.filterResults) || {
|
|
2614
|
+
entities: {}};
|
|
2615
|
+
return Object.values(filteredResults.entities);
|
|
2616
|
+
}, selectorMemoizationOptions);
|
|
2617
|
+
|
|
2618
|
+
var viewPresetsListFullContent = [
|
|
2619
|
+
{
|
|
2620
|
+
id: "radar",
|
|
2621
|
+
title: "Radar",
|
|
2622
|
+
abstract: "abstract radar",
|
|
2623
|
+
componentType: "Map",
|
|
2624
|
+
initialProps: {
|
|
2625
|
+
mapPreset: {
|
|
2626
|
+
layers: [
|
|
2627
|
+
{
|
|
2628
|
+
service: "https://geoservices.knmi.nl/wms?dataset=RADAR",
|
|
2629
|
+
name: "RAD_NL25_PCP_CM",
|
|
2630
|
+
format: "image/png",
|
|
2631
|
+
enabled: true,
|
|
2632
|
+
style: "radar/nearest",
|
|
2633
|
+
id: "layerid_8",
|
|
2634
|
+
layerType: "mapLayer"
|
|
2635
|
+
},
|
|
2636
|
+
{
|
|
2637
|
+
service: "https://openwms.fmi.fi/geoserver/wms?",
|
|
2638
|
+
name: "Radar:suomi_dbz_eureffin",
|
|
2639
|
+
format: "image/png",
|
|
2640
|
+
style: "Radar dbz Summer",
|
|
2641
|
+
enabled: true,
|
|
2642
|
+
layerType: "mapLayer"
|
|
2643
|
+
},
|
|
2644
|
+
{
|
|
2645
|
+
service: "https://geoservices.knmi.nl/wms?dataset=RADAR",
|
|
2646
|
+
name: "RAD_NL25_PCP_CM",
|
|
2487
2647
|
format: "image/png",
|
|
2488
2648
|
style: "precip-blue-transparent/nearest",
|
|
2489
2649
|
enabled: true,
|
|
@@ -3872,12 +4032,210 @@ var workspacePresetsListFullContent = [
|
|
|
3872
4032
|
viewType: "multiWindow",
|
|
3873
4033
|
views: [
|
|
3874
4034
|
{
|
|
3875
|
-
mosaicNodeId: "
|
|
3876
|
-
|
|
4035
|
+
mosaicNodeId: "viewA",
|
|
4036
|
+
componentType: "Map",
|
|
4037
|
+
initialProps: {
|
|
4038
|
+
mapPreset: {
|
|
4039
|
+
layers: [
|
|
4040
|
+
{
|
|
4041
|
+
name: "WorldMap_Light_Grey_Canvas",
|
|
4042
|
+
type: "twms",
|
|
4043
|
+
dimensions: [
|
|
4044
|
+
],
|
|
4045
|
+
id: "layerid_64",
|
|
4046
|
+
opacity: 1,
|
|
4047
|
+
acceptanceTimeInMinutes: 60,
|
|
4048
|
+
enabled: true,
|
|
4049
|
+
layerType: "baseLayer",
|
|
4050
|
+
status: "default",
|
|
4051
|
+
useLatestReferenceTime: true
|
|
4052
|
+
},
|
|
4053
|
+
{
|
|
4054
|
+
service: "https://geoservices.knmi.nl/wms?DATASET=baselayers&",
|
|
4055
|
+
name: "countryborders",
|
|
4056
|
+
format: "image/png",
|
|
4057
|
+
dimensions: [
|
|
4058
|
+
],
|
|
4059
|
+
id: "layerid_63",
|
|
4060
|
+
opacity: 1,
|
|
4061
|
+
acceptanceTimeInMinutes: 60,
|
|
4062
|
+
enabled: true,
|
|
4063
|
+
layerType: "overLayer",
|
|
4064
|
+
status: "default",
|
|
4065
|
+
useLatestReferenceTime: true
|
|
4066
|
+
},
|
|
4067
|
+
{
|
|
4068
|
+
name: "Radar:suomi_dbz_eureffin",
|
|
4069
|
+
style: "Radar dbz Summer",
|
|
4070
|
+
format: "image/png",
|
|
4071
|
+
service: "https://openwms.fmi.fi/geoserver/wms?",
|
|
4072
|
+
dimensions: [
|
|
4073
|
+
],
|
|
4074
|
+
id: "layerid_59",
|
|
4075
|
+
opacity: 1,
|
|
4076
|
+
acceptanceTimeInMinutes: 60,
|
|
4077
|
+
enabled: true,
|
|
4078
|
+
layerType: "mapLayer",
|
|
4079
|
+
status: "default",
|
|
4080
|
+
useLatestReferenceTime: true
|
|
4081
|
+
},
|
|
4082
|
+
{
|
|
4083
|
+
name: "radar_precipitation_intensity_nordic",
|
|
4084
|
+
style: "",
|
|
4085
|
+
format: "image/png",
|
|
4086
|
+
service: "https://public-wms.met.no/verportal/verportal.map?SERVICE=WMS&REQUEST=GetCapabilities",
|
|
4087
|
+
dimensions: [
|
|
4088
|
+
],
|
|
4089
|
+
id: "layerid_60",
|
|
4090
|
+
opacity: 1,
|
|
4091
|
+
acceptanceTimeInMinutes: 60,
|
|
4092
|
+
enabled: true,
|
|
4093
|
+
layerType: "mapLayer",
|
|
4094
|
+
status: "default",
|
|
4095
|
+
useLatestReferenceTime: true
|
|
4096
|
+
},
|
|
4097
|
+
{
|
|
4098
|
+
name: "RAD_NL25_PCP_CM",
|
|
4099
|
+
style: "precip-blue-transparent/nearest",
|
|
4100
|
+
format: "image/png",
|
|
4101
|
+
service: "https://geoservices.knmi.nl/wms?dataset=RADAR",
|
|
4102
|
+
dimensions: [
|
|
4103
|
+
],
|
|
4104
|
+
id: "layerid_61",
|
|
4105
|
+
opacity: 1,
|
|
4106
|
+
acceptanceTimeInMinutes: 60,
|
|
4107
|
+
enabled: true,
|
|
4108
|
+
layerType: "mapLayer",
|
|
4109
|
+
status: "default",
|
|
4110
|
+
useLatestReferenceTime: true
|
|
4111
|
+
}
|
|
4112
|
+
],
|
|
4113
|
+
proj: {
|
|
4114
|
+
bbox: {
|
|
4115
|
+
left: -4537320.252629031,
|
|
4116
|
+
bottom: 6408480.451399999,
|
|
4117
|
+
right: 8563411.406429032,
|
|
4118
|
+
top: 11520588.9031
|
|
4119
|
+
},
|
|
4120
|
+
srs: "EPSG:3857"
|
|
4121
|
+
},
|
|
4122
|
+
shouldAnimate: false,
|
|
4123
|
+
shouldAutoUpdate: false,
|
|
4124
|
+
showTimeSlider: true,
|
|
4125
|
+
displayMapPin: false,
|
|
4126
|
+
shouldShowZoomControls: true,
|
|
4127
|
+
animationPayload: {
|
|
4128
|
+
interval: 60,
|
|
4129
|
+
speed: 4,
|
|
4130
|
+
duration: 290
|
|
4131
|
+
},
|
|
4132
|
+
toggleTimestepAuto: true,
|
|
4133
|
+
toggleTimeSpanAuto: true,
|
|
4134
|
+
shouldShowLegend: false,
|
|
4135
|
+
timeSliderSpan: 86400,
|
|
4136
|
+
shouldShowDataExplorer: false,
|
|
4137
|
+
defaultOverlayer: "countryborders"
|
|
4138
|
+
},
|
|
4139
|
+
syncGroupsIds: [
|
|
4140
|
+
"Area_radarTemp",
|
|
4141
|
+
"Time_radarTemp"
|
|
4142
|
+
]
|
|
4143
|
+
},
|
|
4144
|
+
title: "Radar",
|
|
4145
|
+
originalViewPresetId: "Radar"
|
|
3877
4146
|
},
|
|
3878
4147
|
{
|
|
3879
|
-
mosaicNodeId: "
|
|
3880
|
-
|
|
4148
|
+
mosaicNodeId: "viewB",
|
|
4149
|
+
componentType: "Map",
|
|
4150
|
+
initialProps: {
|
|
4151
|
+
mapPreset: {
|
|
4152
|
+
layers: [
|
|
4153
|
+
{
|
|
4154
|
+
name: "WorldMap_Light_Grey_Canvas",
|
|
4155
|
+
type: "twms",
|
|
4156
|
+
dimensions: [
|
|
4157
|
+
],
|
|
4158
|
+
id: "layerid_71",
|
|
4159
|
+
opacity: 1,
|
|
4160
|
+
acceptanceTimeInMinutes: 60,
|
|
4161
|
+
enabled: true,
|
|
4162
|
+
layerType: "baseLayer",
|
|
4163
|
+
status: "default",
|
|
4164
|
+
useLatestReferenceTime: true
|
|
4165
|
+
},
|
|
4166
|
+
{
|
|
4167
|
+
service: "https://geoservices.knmi.nl/wms?DATASET=baselayers&",
|
|
4168
|
+
name: "countryborders",
|
|
4169
|
+
format: "image/png",
|
|
4170
|
+
dimensions: [
|
|
4171
|
+
],
|
|
4172
|
+
id: "layerid_70",
|
|
4173
|
+
opacity: 1,
|
|
4174
|
+
acceptanceTimeInMinutes: 60,
|
|
4175
|
+
enabled: true,
|
|
4176
|
+
layerType: "overLayer",
|
|
4177
|
+
status: "default",
|
|
4178
|
+
useLatestReferenceTime: true
|
|
4179
|
+
},
|
|
4180
|
+
{
|
|
4181
|
+
name: "10M/ta",
|
|
4182
|
+
service: "https://geoservices.knmi.nl/adagucserver?dataset=OBS",
|
|
4183
|
+
dimensions: [
|
|
4184
|
+
],
|
|
4185
|
+
id: "layerid_67",
|
|
4186
|
+
opacity: 1,
|
|
4187
|
+
acceptanceTimeInMinutes: 60,
|
|
4188
|
+
enabled: true,
|
|
4189
|
+
layerType: "mapLayer",
|
|
4190
|
+
status: "default",
|
|
4191
|
+
useLatestReferenceTime: true
|
|
4192
|
+
},
|
|
4193
|
+
{
|
|
4194
|
+
name: "t850_public",
|
|
4195
|
+
service: "https://eccharts.ecmwf.int/wms/?token=public",
|
|
4196
|
+
dimensions: [
|
|
4197
|
+
],
|
|
4198
|
+
id: "layerid_68",
|
|
4199
|
+
opacity: 0.8,
|
|
4200
|
+
acceptanceTimeInMinutes: 60,
|
|
4201
|
+
enabled: true,
|
|
4202
|
+
layerType: "mapLayer",
|
|
4203
|
+
status: "default",
|
|
4204
|
+
useLatestReferenceTime: true
|
|
4205
|
+
}
|
|
4206
|
+
],
|
|
4207
|
+
proj: {
|
|
4208
|
+
bbox: {
|
|
4209
|
+
left: -4537320.252629031,
|
|
4210
|
+
bottom: 6408480.451399999,
|
|
4211
|
+
right: 8563411.406429032,
|
|
4212
|
+
top: 11520588.9031
|
|
4213
|
+
},
|
|
4214
|
+
srs: "EPSG:3857"
|
|
4215
|
+
},
|
|
4216
|
+
shouldAnimate: false,
|
|
4217
|
+
shouldAutoUpdate: false,
|
|
4218
|
+
showTimeSlider: true,
|
|
4219
|
+
displayMapPin: false,
|
|
4220
|
+
shouldShowZoomControls: true,
|
|
4221
|
+
animationPayload: {
|
|
4222
|
+
interval: 60,
|
|
4223
|
+
speed: 4,
|
|
4224
|
+
duration: 290
|
|
4225
|
+
},
|
|
4226
|
+
toggleTimestepAuto: true,
|
|
4227
|
+
toggleTimeSpanAuto: true,
|
|
4228
|
+
shouldShowLegend: false,
|
|
4229
|
+
timeSliderSpan: 86400,
|
|
4230
|
+
shouldShowDataExplorer: false,
|
|
4231
|
+
defaultOverlayer: "countryborders"
|
|
4232
|
+
},
|
|
4233
|
+
syncGroupsIds: [
|
|
4234
|
+
"Area_radarTemp",
|
|
4235
|
+
"Time_radarTemp"
|
|
4236
|
+
]
|
|
4237
|
+
},
|
|
4238
|
+
title: "Temperature"
|
|
3881
4239
|
}
|
|
3882
4240
|
],
|
|
3883
4241
|
syncGroups: [
|
|
@@ -3939,11 +4297,249 @@ var workspacePresetsListFullContent = [
|
|
|
3939
4297
|
views: [
|
|
3940
4298
|
{
|
|
3941
4299
|
mosaicNodeId: "view-1",
|
|
3942
|
-
|
|
4300
|
+
componentType: "Map",
|
|
4301
|
+
initialProps: {
|
|
4302
|
+
mapPreset: {
|
|
4303
|
+
layers: [
|
|
4304
|
+
{
|
|
4305
|
+
name: "WorldMap_Light_Grey_Canvas",
|
|
4306
|
+
type: "twms",
|
|
4307
|
+
dimensions: [
|
|
4308
|
+
],
|
|
4309
|
+
id: "layerid_89",
|
|
4310
|
+
opacity: 1,
|
|
4311
|
+
acceptanceTimeInMinutes: 60,
|
|
4312
|
+
enabled: true,
|
|
4313
|
+
layerType: "baseLayer",
|
|
4314
|
+
status: "default",
|
|
4315
|
+
useLatestReferenceTime: true
|
|
4316
|
+
},
|
|
4317
|
+
{
|
|
4318
|
+
service: "https://geoservices.knmi.nl/wms?DATASET=baselayers&",
|
|
4319
|
+
name: "countryborders",
|
|
4320
|
+
format: "image/png",
|
|
4321
|
+
dimensions: [
|
|
4322
|
+
],
|
|
4323
|
+
id: "layerid_88",
|
|
4324
|
+
opacity: 1,
|
|
4325
|
+
acceptanceTimeInMinutes: 60,
|
|
4326
|
+
enabled: true,
|
|
4327
|
+
layerType: "overLayer",
|
|
4328
|
+
status: "default",
|
|
4329
|
+
useLatestReferenceTime: true
|
|
4330
|
+
},
|
|
4331
|
+
{
|
|
4332
|
+
name: "air_pressure_at_mean_sea_level_hagl",
|
|
4333
|
+
service: "https://geoservices.knmi.nl/adaguc-server?DATASET=uwcw_ha43_dini_5p5km",
|
|
4334
|
+
dimensions: [
|
|
4335
|
+
{
|
|
4336
|
+
name: "reference_time",
|
|
4337
|
+
units: "ISO8601",
|
|
4338
|
+
currentValue: "2025-11-03T08:00:00Z",
|
|
4339
|
+
maxValue: "2025-11-03T08:00:00Z",
|
|
4340
|
+
minValue: "2025-11-02T11:00:00Z",
|
|
4341
|
+
synced: false,
|
|
4342
|
+
values: "2025-11-02T11:00:00Z,2025-11-02T12:00:00Z,2025-11-02T13:00:00Z,2025-11-02T14:00:00Z,2025-11-02T15:00:00Z,2025-11-02T16:00:00Z,2025-11-02T17:00:00Z,2025-11-02T18:00:00Z,2025-11-02T19:00:00Z,2025-11-02T20:00:00Z,2025-11-02T21:00:00Z,2025-11-02T22:00:00Z,2025-11-02T23:00:00Z,2025-11-03T00:00:00Z,2025-11-03T01:00:00Z,2025-11-03T02:00:00Z,2025-11-03T03:00:00Z,2025-11-03T04:00:00Z,2025-11-03T05:00:00Z,2025-11-03T06:00:00Z,2025-11-03T07:00:00Z,2025-11-03T08:00:00Z",
|
|
4343
|
+
unitSymbol: ""
|
|
4344
|
+
},
|
|
4345
|
+
{
|
|
4346
|
+
name: "height_above_ground_level_in_m",
|
|
4347
|
+
units: "m",
|
|
4348
|
+
currentValue: "0",
|
|
4349
|
+
maxValue: "0",
|
|
4350
|
+
minValue: "0",
|
|
4351
|
+
synced: false,
|
|
4352
|
+
values: "0",
|
|
4353
|
+
unitSymbol: ""
|
|
4354
|
+
}
|
|
4355
|
+
],
|
|
4356
|
+
id: "layerid_84",
|
|
4357
|
+
opacity: 1,
|
|
4358
|
+
acceptanceTimeInMinutes: 60,
|
|
4359
|
+
enabled: true,
|
|
4360
|
+
layerType: "mapLayer",
|
|
4361
|
+
status: "default",
|
|
4362
|
+
useLatestReferenceTime: true
|
|
4363
|
+
},
|
|
4364
|
+
{
|
|
4365
|
+
name: "total_precipitation_rate_hagl",
|
|
4366
|
+
service: "https://geoservices.knmi.nl/adaguc-server?DATASET=uwcw_ha43_dini_5p5km",
|
|
4367
|
+
dimensions: [
|
|
4368
|
+
{
|
|
4369
|
+
name: "reference_time",
|
|
4370
|
+
units: "ISO8601",
|
|
4371
|
+
currentValue: "2025-11-03T08:00:00Z",
|
|
4372
|
+
maxValue: "2025-11-03T08:00:00Z",
|
|
4373
|
+
minValue: "2025-11-02T11:00:00Z",
|
|
4374
|
+
synced: false,
|
|
4375
|
+
values: "2025-11-02T11:00:00Z,2025-11-02T12:00:00Z,2025-11-02T13:00:00Z,2025-11-02T14:00:00Z,2025-11-02T15:00:00Z,2025-11-02T16:00:00Z,2025-11-02T17:00:00Z,2025-11-02T18:00:00Z,2025-11-02T19:00:00Z,2025-11-02T20:00:00Z,2025-11-02T21:00:00Z,2025-11-02T22:00:00Z,2025-11-02T23:00:00Z,2025-11-03T00:00:00Z,2025-11-03T01:00:00Z,2025-11-03T02:00:00Z,2025-11-03T03:00:00Z,2025-11-03T04:00:00Z,2025-11-03T05:00:00Z,2025-11-03T06:00:00Z,2025-11-03T07:00:00Z,2025-11-03T08:00:00Z",
|
|
4376
|
+
unitSymbol: ""
|
|
4377
|
+
},
|
|
4378
|
+
{
|
|
4379
|
+
name: "height_above_ground_level_in_m",
|
|
4380
|
+
units: "m",
|
|
4381
|
+
currentValue: "0",
|
|
4382
|
+
maxValue: "0",
|
|
4383
|
+
minValue: "0",
|
|
4384
|
+
synced: false,
|
|
4385
|
+
values: "0",
|
|
4386
|
+
unitSymbol: ""
|
|
4387
|
+
}
|
|
4388
|
+
],
|
|
4389
|
+
id: "layerid_85",
|
|
4390
|
+
opacity: 1,
|
|
4391
|
+
acceptanceTimeInMinutes: 60,
|
|
4392
|
+
enabled: true,
|
|
4393
|
+
layerType: "mapLayer",
|
|
4394
|
+
status: "default",
|
|
4395
|
+
useLatestReferenceTime: true
|
|
4396
|
+
},
|
|
4397
|
+
{
|
|
4398
|
+
name: "air_temperature_hagl",
|
|
4399
|
+
style: "temperature_wow/shaded",
|
|
4400
|
+
service: "https://geoservices.knmi.nl/adaguc-server?DATASET=uwcw_ha43_dini_5p5km",
|
|
4401
|
+
dimensions: [
|
|
4402
|
+
{
|
|
4403
|
+
name: "reference_time",
|
|
4404
|
+
units: "ISO8601",
|
|
4405
|
+
currentValue: "2025-11-03T08:00:00Z",
|
|
4406
|
+
maxValue: "2025-11-03T08:00:00Z",
|
|
4407
|
+
minValue: "2025-11-02T11:00:00Z",
|
|
4408
|
+
synced: false,
|
|
4409
|
+
values: "2025-11-02T11:00:00Z,2025-11-02T12:00:00Z,2025-11-02T13:00:00Z,2025-11-02T14:00:00Z,2025-11-02T15:00:00Z,2025-11-02T16:00:00Z,2025-11-02T17:00:00Z,2025-11-02T18:00:00Z,2025-11-02T19:00:00Z,2025-11-02T20:00:00Z,2025-11-02T21:00:00Z,2025-11-02T22:00:00Z,2025-11-02T23:00:00Z,2025-11-03T00:00:00Z,2025-11-03T01:00:00Z,2025-11-03T02:00:00Z,2025-11-03T03:00:00Z,2025-11-03T04:00:00Z,2025-11-03T05:00:00Z,2025-11-03T06:00:00Z,2025-11-03T07:00:00Z,2025-11-03T08:00:00Z",
|
|
4410
|
+
unitSymbol: ""
|
|
4411
|
+
},
|
|
4412
|
+
{
|
|
4413
|
+
name: "height_above_ground_level_in_m",
|
|
4414
|
+
units: "m",
|
|
4415
|
+
currentValue: "2",
|
|
4416
|
+
maxValue: "2",
|
|
4417
|
+
minValue: "2",
|
|
4418
|
+
synced: false,
|
|
4419
|
+
values: "2",
|
|
4420
|
+
unitSymbol: ""
|
|
4421
|
+
}
|
|
4422
|
+
],
|
|
4423
|
+
id: "layerid_86",
|
|
4424
|
+
opacity: 1,
|
|
4425
|
+
acceptanceTimeInMinutes: 60,
|
|
4426
|
+
enabled: true,
|
|
4427
|
+
layerType: "mapLayer",
|
|
4428
|
+
status: "default",
|
|
4429
|
+
useLatestReferenceTime: true
|
|
4430
|
+
}
|
|
4431
|
+
],
|
|
4432
|
+
proj: {
|
|
4433
|
+
bbox: {
|
|
4434
|
+
top: 7438773.776232235,
|
|
4435
|
+
left: -450651.2255879827,
|
|
4436
|
+
right: 1428345.8183648037,
|
|
4437
|
+
bottom: 6490531.093143953
|
|
4438
|
+
},
|
|
4439
|
+
srs: "EPSG:3857"
|
|
4440
|
+
},
|
|
4441
|
+
shouldAnimate: false,
|
|
4442
|
+
shouldAutoUpdate: false,
|
|
4443
|
+
showTimeSlider: true,
|
|
4444
|
+
displayMapPin: true,
|
|
4445
|
+
shouldShowZoomControls: true,
|
|
4446
|
+
animationPayload: {
|
|
4447
|
+
interval: 60,
|
|
4448
|
+
speed: 4,
|
|
4449
|
+
duration: 290
|
|
4450
|
+
},
|
|
4451
|
+
toggleTimestepAuto: true,
|
|
4452
|
+
toggleTimeSpanAuto: true,
|
|
4453
|
+
shouldShowLegend: false,
|
|
4454
|
+
timeSliderSpan: 86400,
|
|
4455
|
+
shouldShowDataExplorer: false,
|
|
4456
|
+
defaultOverlayer: "countryborders"
|
|
4457
|
+
},
|
|
4458
|
+
syncGroupsIds: [
|
|
4459
|
+
]
|
|
4460
|
+
},
|
|
4461
|
+
title: "KNMI WMS UWCW HA43 DINI forecast",
|
|
4462
|
+
originalViewPresetId: "view_knmi_timeseries_ha43_dini_wms"
|
|
3943
4463
|
},
|
|
3944
4464
|
{
|
|
3945
4465
|
mosaicNodeId: "view-2",
|
|
3946
|
-
|
|
4466
|
+
componentType: "TimeSeries",
|
|
4467
|
+
initialProps: {
|
|
4468
|
+
plotPreset: {
|
|
4469
|
+
mapId: "view_knmi_timeseries_ha43_dini_wms",
|
|
4470
|
+
plots: [
|
|
4471
|
+
{
|
|
4472
|
+
title: "HA43 Air pressure",
|
|
4473
|
+
plotId: "Plot_1"
|
|
4474
|
+
},
|
|
4475
|
+
{
|
|
4476
|
+
title: "HA43 Air temperature",
|
|
4477
|
+
plotId: "Plot_2"
|
|
4478
|
+
},
|
|
4479
|
+
{
|
|
4480
|
+
title: "HA43 precipitation",
|
|
4481
|
+
plotId: "Plot_3"
|
|
4482
|
+
},
|
|
4483
|
+
{
|
|
4484
|
+
title: "HA43 Relative humidity",
|
|
4485
|
+
plotId: "Plot_4"
|
|
4486
|
+
}
|
|
4487
|
+
],
|
|
4488
|
+
parameters: [
|
|
4489
|
+
{
|
|
4490
|
+
unit: "hPa",
|
|
4491
|
+
plotId: "Plot_1",
|
|
4492
|
+
plotType: "line",
|
|
4493
|
+
serviceId: "knmi_geoservices_edr",
|
|
4494
|
+
collectionId: "uwcw_ha43_dini_5p5km.hagl",
|
|
4495
|
+
propertyName: "air_pressure_at_mean_sea_level_hagl",
|
|
4496
|
+
id: "timeseriesparamid_2ceef258-edf0-4170-b8ec-a998e1175839",
|
|
4497
|
+
opacity: 70
|
|
4498
|
+
},
|
|
4499
|
+
{
|
|
4500
|
+
unit: "C",
|
|
4501
|
+
plotId: "Plot_2",
|
|
4502
|
+
plotType: "line",
|
|
4503
|
+
serviceId: "knmi_geoservices_edr",
|
|
4504
|
+
collectionId: "uwcw_ha43_dini_5p5km.hagl",
|
|
4505
|
+
propertyName: "air_temperature_hagl",
|
|
4506
|
+
id: "timeseriesparamid_fbbe34f2-2aaa-4636-9dae-6d9c6b8530db",
|
|
4507
|
+
opacity: 70
|
|
4508
|
+
},
|
|
4509
|
+
{
|
|
4510
|
+
unit: "mm/hr",
|
|
4511
|
+
plotId: "Plot_3",
|
|
4512
|
+
plotType: "bar",
|
|
4513
|
+
serviceId: "knmi_geoservices_edr",
|
|
4514
|
+
collectionId: "uwcw_ha43_dini_5p5km.hagl",
|
|
4515
|
+
propertyName: "total_precipitation_rate_hagl",
|
|
4516
|
+
id: "timeseriesparamid_7a02c8f2-8401-4231-81d7-5b1dc9c24fb1",
|
|
4517
|
+
opacity: 70
|
|
4518
|
+
},
|
|
4519
|
+
{
|
|
4520
|
+
unit: "%",
|
|
4521
|
+
plotId: "Plot_4",
|
|
4522
|
+
plotType: "line",
|
|
4523
|
+
serviceId: "knmi_geoservices_edr",
|
|
4524
|
+
collectionId: "uwcw_ha43_dini_5p5km.hagl",
|
|
4525
|
+
propertyName: "relative_humidity_hagl",
|
|
4526
|
+
id: "timeseriesparamid_7ef987eb-f244-4997-8a3d-8e099f3187cf",
|
|
4527
|
+
opacity: 70
|
|
4528
|
+
}
|
|
4529
|
+
]
|
|
4530
|
+
},
|
|
4531
|
+
services: [
|
|
4532
|
+
{
|
|
4533
|
+
name: "KNMI Geoservices",
|
|
4534
|
+
url: "https://geoservices.knmi.nl/edr",
|
|
4535
|
+
id: "knmi_geoservices_edr",
|
|
4536
|
+
description: "KNMI EDR on geoservices with UWCW HA43 DINI",
|
|
4537
|
+
type: "EDR",
|
|
4538
|
+
scope: "system"
|
|
4539
|
+
}
|
|
4540
|
+
]
|
|
4541
|
+
},
|
|
4542
|
+
title: "KNMI EDR UWCW HA43 DINI forecast"
|
|
3947
4543
|
}
|
|
3948
4544
|
],
|
|
3949
4545
|
syncGroups: [
|
|
@@ -4014,8 +4610,41 @@ var workspacePresetsListFullContent = [
|
|
|
4014
4610
|
viewType: "tiledWindow",
|
|
4015
4611
|
views: [
|
|
4016
4612
|
{
|
|
4017
|
-
mosaicNodeId: "
|
|
4018
|
-
|
|
4613
|
+
mosaicNodeId: "viewA",
|
|
4614
|
+
componentType: "ModelRunInterval",
|
|
4615
|
+
initialProps: {
|
|
4616
|
+
mapPreset: {
|
|
4617
|
+
layers: [
|
|
4618
|
+
],
|
|
4619
|
+
proj: {
|
|
4620
|
+
bbox: {
|
|
4621
|
+
},
|
|
4622
|
+
srs: ""
|
|
4623
|
+
},
|
|
4624
|
+
shouldAnimate: false,
|
|
4625
|
+
shouldAutoUpdate: false,
|
|
4626
|
+
showTimeSlider: true,
|
|
4627
|
+
displayMapPin: false,
|
|
4628
|
+
shouldShowZoomControls: true,
|
|
4629
|
+
animationPayload: {
|
|
4630
|
+
interval: 60,
|
|
4631
|
+
speed: 4,
|
|
4632
|
+
duration: 350
|
|
4633
|
+
},
|
|
4634
|
+
toggleTimestepAuto: false,
|
|
4635
|
+
toggleTimeSpanAuto: false,
|
|
4636
|
+
shouldShowLegend: false,
|
|
4637
|
+
timeSliderSpan: 86400,
|
|
4638
|
+
shouldShowDataExplorer: false,
|
|
4639
|
+
defaultOverlayer: "none"
|
|
4640
|
+
},
|
|
4641
|
+
syncGroupsIds: [
|
|
4642
|
+
"areaLayerGroupA",
|
|
4643
|
+
"layerGroupA"
|
|
4644
|
+
]
|
|
4645
|
+
},
|
|
4646
|
+
title: "Harmonie precipitation, pressure and wind all",
|
|
4647
|
+
originalViewPresetId: "screenRefTimeAll"
|
|
4019
4648
|
}
|
|
4020
4649
|
],
|
|
4021
4650
|
syncGroups: [
|
|
@@ -4408,6 +5037,129 @@ var workspacePresetsListFullContent = [
|
|
|
4408
5037
|
second: "view-2",
|
|
4409
5038
|
splitPercentage: 50
|
|
4410
5039
|
}
|
|
5040
|
+
},
|
|
5041
|
+
{
|
|
5042
|
+
id: "newFormatRadarView",
|
|
5043
|
+
abstract: "A radar view of hurricane Melissa",
|
|
5044
|
+
title: "Radar Melissa",
|
|
5045
|
+
isTimeScrollingEnabled: false,
|
|
5046
|
+
scope: "user",
|
|
5047
|
+
viewType: "singleWindow",
|
|
5048
|
+
views: [
|
|
5049
|
+
{
|
|
5050
|
+
title: "Radar view",
|
|
5051
|
+
abstract: "",
|
|
5052
|
+
componentType: "Map",
|
|
5053
|
+
initialProps: {
|
|
5054
|
+
mapPreset: {
|
|
5055
|
+
proj: {
|
|
5056
|
+
srs: "EPSG:3857",
|
|
5057
|
+
bbox: {
|
|
5058
|
+
top: 11520588.9031,
|
|
5059
|
+
left: 58703.6377,
|
|
5060
|
+
right: 3967387.5161,
|
|
5061
|
+
bottom: 6408480.4514
|
|
5062
|
+
}
|
|
5063
|
+
},
|
|
5064
|
+
layers: [
|
|
5065
|
+
{
|
|
5066
|
+
id: "layerid_75",
|
|
5067
|
+
name: "WorldMap_Light_Grey_Canvas",
|
|
5068
|
+
type: "twms",
|
|
5069
|
+
status: "default",
|
|
5070
|
+
enabled: true,
|
|
5071
|
+
opacity: 1,
|
|
5072
|
+
layerType: "baseLayer",
|
|
5073
|
+
dimensions: [
|
|
5074
|
+
],
|
|
5075
|
+
useLatestReferenceTime: true,
|
|
5076
|
+
acceptanceTimeInMinutes: 60
|
|
5077
|
+
},
|
|
5078
|
+
{
|
|
5079
|
+
id: "layerid_74",
|
|
5080
|
+
name: "countryborders",
|
|
5081
|
+
format: "image/png",
|
|
5082
|
+
status: "default",
|
|
5083
|
+
enabled: true,
|
|
5084
|
+
opacity: 1,
|
|
5085
|
+
service: "https://geoservices.knmi.nl/wms?DATASET=baselayers&",
|
|
5086
|
+
layerType: "overLayer",
|
|
5087
|
+
dimensions: [
|
|
5088
|
+
],
|
|
5089
|
+
useLatestReferenceTime: true,
|
|
5090
|
+
acceptanceTimeInMinutes: 60
|
|
5091
|
+
},
|
|
5092
|
+
{
|
|
5093
|
+
id: "layerid_70",
|
|
5094
|
+
name: "RAD_NL25_PCP_CM",
|
|
5095
|
+
style: "radar/nearest",
|
|
5096
|
+
format: "image/png",
|
|
5097
|
+
status: "default",
|
|
5098
|
+
enabled: true,
|
|
5099
|
+
opacity: 1,
|
|
5100
|
+
service: "https://geoservices.knmi.nl/wms?dataset=RADAR",
|
|
5101
|
+
layerType: "mapLayer",
|
|
5102
|
+
dimensions: [
|
|
5103
|
+
],
|
|
5104
|
+
useLatestReferenceTime: true,
|
|
5105
|
+
acceptanceTimeInMinutes: 60
|
|
5106
|
+
},
|
|
5107
|
+
{
|
|
5108
|
+
id: "layerid_71",
|
|
5109
|
+
name: "Radar:suomi_dbz_eureffin",
|
|
5110
|
+
style: "Radar dbz Summer",
|
|
5111
|
+
format: "image/png",
|
|
5112
|
+
status: "default",
|
|
5113
|
+
enabled: true,
|
|
5114
|
+
opacity: 1,
|
|
5115
|
+
service: "https://openwms.fmi.fi/geoserver/wms?",
|
|
5116
|
+
layerType: "mapLayer",
|
|
5117
|
+
dimensions: [
|
|
5118
|
+
],
|
|
5119
|
+
useLatestReferenceTime: true,
|
|
5120
|
+
acceptanceTimeInMinutes: 60
|
|
5121
|
+
},
|
|
5122
|
+
{
|
|
5123
|
+
id: "layerid_72",
|
|
5124
|
+
name: "radar_precipitation_intensity_nordic",
|
|
5125
|
+
style: "",
|
|
5126
|
+
format: "image/png",
|
|
5127
|
+
status: "default",
|
|
5128
|
+
enabled: true,
|
|
5129
|
+
opacity: 1,
|
|
5130
|
+
service: "https://public-wms.met.no/verportal/verportal.map?SERVICE=WMS&REQUEST=GetCapabilities",
|
|
5131
|
+
layerType: "mapLayer",
|
|
5132
|
+
dimensions: [
|
|
5133
|
+
],
|
|
5134
|
+
useLatestReferenceTime: true,
|
|
5135
|
+
acceptanceTimeInMinutes: 60
|
|
5136
|
+
}
|
|
5137
|
+
],
|
|
5138
|
+
displayMapPin: false,
|
|
5139
|
+
shouldAnimate: true,
|
|
5140
|
+
showTimeSlider: true,
|
|
5141
|
+
timeSliderSpan: 86400,
|
|
5142
|
+
animationPayload: {
|
|
5143
|
+
speed: 2,
|
|
5144
|
+
duration: 240,
|
|
5145
|
+
interval: 5
|
|
5146
|
+
},
|
|
5147
|
+
defaultOverlayer: "countryborders",
|
|
5148
|
+
shouldAutoUpdate: false,
|
|
5149
|
+
shouldShowLegend: false,
|
|
5150
|
+
toggleTimeSpanAuto: true,
|
|
5151
|
+
toggleTimestepAuto: false,
|
|
5152
|
+
shouldShowDataExplorer: false,
|
|
5153
|
+
shouldShowZoomControls: true
|
|
5154
|
+
},
|
|
5155
|
+
syncGroupsIds: [
|
|
5156
|
+
]
|
|
5157
|
+
},
|
|
5158
|
+
mosaicNodeId: "2_screen",
|
|
5159
|
+
originalViewPresetId: "radarView"
|
|
5160
|
+
}
|
|
5161
|
+
],
|
|
5162
|
+
mosaicNode: "radarView"
|
|
4411
5163
|
}
|
|
4412
5164
|
];
|
|
4413
5165
|
|
|
@@ -4697,46 +5449,462 @@ var createApi = function createApi() {
|
|
|
4697
5449
|
return getApiRoutes(instance);
|
|
4698
5450
|
};
|
|
4699
5451
|
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
|
|
4717
|
-
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4721
|
-
|
|
4722
|
-
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
|
|
4727
|
-
|
|
4728
|
-
|
|
4729
|
-
return effect;
|
|
4730
|
-
}()
|
|
5452
|
+
/* *
|
|
5453
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5454
|
+
* you may not use this file except in compliance with the License.
|
|
5455
|
+
* You may obtain a copy of the License at
|
|
5456
|
+
*
|
|
5457
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5458
|
+
*
|
|
5459
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5460
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5461
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5462
|
+
* See the License for the specific language governing permissions and
|
|
5463
|
+
* limitations under the License.
|
|
5464
|
+
*
|
|
5465
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5466
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
5467
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
5468
|
+
* */
|
|
5469
|
+
var getWorkspaceListStore = function getWorkspaceListStore(store) {
|
|
5470
|
+
if (store != null && store.workspaceList) {
|
|
5471
|
+
return store.workspaceList;
|
|
5472
|
+
}
|
|
5473
|
+
return null;
|
|
5474
|
+
};
|
|
5475
|
+
var selectors = workspaceListAdapter.getSelectors(function (state) {
|
|
5476
|
+
var _state$workspaceList;
|
|
5477
|
+
return (_state$workspaceList = state == null ? void 0 : state.workspaceList) != null ? _state$workspaceList : {
|
|
5478
|
+
entities: {},
|
|
5479
|
+
ids: []
|
|
5480
|
+
};
|
|
4731
5481
|
});
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
5482
|
+
var getWorkspaceList = selectors.selectAll;
|
|
5483
|
+
var getWorkspacePresetFromList = function getWorkspacePresetFromList(store, id) {
|
|
5484
|
+
return selectors.selectById(store, id);
|
|
5485
|
+
};
|
|
5486
|
+
var getIsWorkspaceListFetching = createSelector(getWorkspaceListStore, function (store) {
|
|
5487
|
+
return store;
|
|
5488
|
+
}, function (state) {
|
|
5489
|
+
return (state == null ? void 0 : state.isFetching) || false;
|
|
5490
|
+
}, selectorMemoizationOptions);
|
|
5491
|
+
var getWorkspaceDialogIsSaved = createSelector(getWorkspaceListStore, function (store) {
|
|
5492
|
+
return store;
|
|
5493
|
+
}, function (state) {
|
|
5494
|
+
var _state$workspaceActio, _state$workspaceActio2;
|
|
5495
|
+
return (_state$workspaceActio = state == null || (_state$workspaceActio2 = state.workspaceActionDialog) == null ? void 0 : _state$workspaceActio2.hasSaved) != null ? _state$workspaceActio : false;
|
|
5496
|
+
}, selectorMemoizationOptions);
|
|
5497
|
+
var getWorkspaceListError = createSelector(getWorkspaceListStore, function (store) {
|
|
5498
|
+
return store;
|
|
5499
|
+
}, function (state) {
|
|
5500
|
+
var _state$error;
|
|
5501
|
+
return (_state$error = state == null ? void 0 : state.error) != null ? _state$error : undefined;
|
|
5502
|
+
}, selectorMemoizationOptions);
|
|
5503
|
+
var getWorkspaceActionFormValues = createSelector(getWorkspaceListStore, function (store) {
|
|
5504
|
+
var _store$workspaceActio, _store$workspaceActio2;
|
|
5505
|
+
return (_store$workspaceActio = (_store$workspaceActio2 = store.workspaceActionDialog) == null ? void 0 : _store$workspaceActio2.formValues) != null ? _store$workspaceActio : {};
|
|
5506
|
+
}, selectorMemoizationOptions);
|
|
5507
|
+
var getWorkspaceActionDialogDetails = createSelector(getWorkspaceListStore, getWorkspaceState, function (workspaceListState, workspaceState) {
|
|
5508
|
+
var _workspaceListState$w;
|
|
5509
|
+
var dialog = (_workspaceListState$w = workspaceListState == null ? void 0 : workspaceListState.workspaceActionDialog) != null ? _workspaceListState$w : false;
|
|
5510
|
+
if (dialog) {
|
|
5511
|
+
var _dialog$formValues$vi;
|
|
5512
|
+
var views = (_dialog$formValues$vi = dialog.formValues.views) == null ? void 0 : _dialog$formValues$vi.map(function (view) {
|
|
5513
|
+
var workspaceView = workspaceState.views.byId[view.mosaicNodeId];
|
|
5514
|
+
return {
|
|
5515
|
+
mosaicNodeId: view.mosaicNodeId,
|
|
5516
|
+
title: view.title || workspaceView.title,
|
|
5517
|
+
"abstract": workspaceView["abstract"],
|
|
5518
|
+
componentType: workspaceView.componentType,
|
|
5519
|
+
scope: view.scope || workspaceView.scope,
|
|
5520
|
+
initialProps: view.initialProps,
|
|
5521
|
+
originalViewPresetId: view == null ? void 0 : view.originalViewPresetId
|
|
5522
|
+
};
|
|
5523
|
+
});
|
|
5524
|
+
return Object.assign({}, dialog, {
|
|
5525
|
+
formValues: Object.assign({}, dialog.formValues, views && {
|
|
5526
|
+
views: views
|
|
5527
|
+
})
|
|
5528
|
+
});
|
|
5529
|
+
}
|
|
5530
|
+
return dialog;
|
|
5531
|
+
}, selectorMemoizationOptions);
|
|
5532
|
+
var getIsWorkspaceListDialogOpen = createSelector(getWorkspaceListStore, function (store) {
|
|
5533
|
+
return store;
|
|
5534
|
+
}, function (state) {
|
|
5535
|
+
return (state == null ? void 0 : state.isWorkspaceListDialogOpen) || false;
|
|
5536
|
+
}, selectorMemoizationOptions);
|
|
5537
|
+
var getWorkspaceListFilters = createSelector(function (store) {
|
|
5538
|
+
return getWorkspaceListStore(store);
|
|
5539
|
+
}, function (_store, scope) {
|
|
5540
|
+
return scope;
|
|
5541
|
+
}, function (_store, _scope, isAdmin) {
|
|
5542
|
+
return isAdmin;
|
|
5543
|
+
}, function (state, _scope, isAdmin) {
|
|
5544
|
+
var _state$workspaceListF;
|
|
5545
|
+
var filters = (_state$workspaceListF = state == null ? void 0 : state.workspaceListFilters) != null ? _state$workspaceListF : [];
|
|
5546
|
+
if (isAdmin) {
|
|
5547
|
+
// Only return system and shared for admins
|
|
5548
|
+
return filters.filter(function (filter) {
|
|
5549
|
+
return filter.id === 'system' || filter.id === 'shared';
|
|
5550
|
+
}).map(function (filter) {
|
|
5551
|
+
return Object.assign({}, filter, {
|
|
5552
|
+
isDisabled: false
|
|
5553
|
+
});
|
|
5554
|
+
});
|
|
5555
|
+
}
|
|
5556
|
+
// Regular users: return all filters
|
|
5557
|
+
return filters.map(function (filter) {
|
|
5558
|
+
return Object.assign({}, filter, {
|
|
5559
|
+
isDisabled: false
|
|
5560
|
+
});
|
|
5561
|
+
});
|
|
5562
|
+
}, selectorMemoizationOptions);
|
|
5563
|
+
var getWorkspaceListSearchQuery = createSelector(getWorkspaceListStore, function (store) {
|
|
5564
|
+
return store;
|
|
5565
|
+
}, function (state) {
|
|
5566
|
+
var _state$searchQuery;
|
|
5567
|
+
return (_state$searchQuery = state == null ? void 0 : state.searchQuery) != null ? _state$searchQuery : '';
|
|
5568
|
+
}, selectorMemoizationOptions);
|
|
5569
|
+
|
|
5570
|
+
var emptyWorkspaceBEData = Object.assign({}, getEmptyMapWorkspace(), {
|
|
5571
|
+
views: [{
|
|
5572
|
+
mosaicNodeId: '1_screen',
|
|
5573
|
+
viewPresetId: 'emptyMap'
|
|
5574
|
+
}]
|
|
5575
|
+
});
|
|
5576
|
+
var workspaceListListener = createListenerMiddleware();
|
|
5577
|
+
workspaceListListener.startListening({
|
|
5578
|
+
actionCreator: workspaceListActions.fetchWorkspaceList,
|
|
5579
|
+
effect: function () {
|
|
5580
|
+
var _effect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref, listenerApi) {
|
|
5581
|
+
var workspaceFilterParams, workspaceApi, _yield$workspaceApi$g, data, isAuthError, workspaceListError;
|
|
5582
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5583
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5584
|
+
case 0:
|
|
5585
|
+
workspaceFilterParams = _ref.payload;
|
|
5586
|
+
listenerApi.cancelActiveListeners();
|
|
5587
|
+
_context.prev = 2;
|
|
5588
|
+
workspaceApi = getWorkspaceApi();
|
|
5589
|
+
_context.next = 6;
|
|
5590
|
+
return workspaceApi.getWorkspacePresets(workspaceFilterParams);
|
|
5591
|
+
case 6:
|
|
5592
|
+
_yield$workspaceApi$g = _context.sent;
|
|
5593
|
+
data = _yield$workspaceApi$g.data;
|
|
5594
|
+
if (!listenerApi.signal.aborted) {
|
|
5595
|
+
_context.next = 10;
|
|
5596
|
+
break;
|
|
5597
|
+
}
|
|
5598
|
+
return _context.abrupt("return");
|
|
5599
|
+
case 10:
|
|
5600
|
+
listenerApi.dispatch(workspaceListActions.fetchedWorkspaceList({
|
|
5601
|
+
workspaceList: data
|
|
5602
|
+
}));
|
|
5603
|
+
_context.next = 18;
|
|
5604
|
+
break;
|
|
5605
|
+
case 13:
|
|
5606
|
+
_context.prev = 13;
|
|
5607
|
+
_context.t0 = _context["catch"](2);
|
|
5608
|
+
isAuthError = isAxiosAuthError(_context.t0);
|
|
5609
|
+
workspaceListError = isAuthError ? {
|
|
5610
|
+
type: WorkspaceListErrorType.VERBATIM_ERROR,
|
|
5611
|
+
message: getAxiosErrorMessage(_context.t0),
|
|
5612
|
+
category: WorkspaceListErrorCategory.AUTH
|
|
5613
|
+
} : {
|
|
5614
|
+
type: WorkspaceListErrorType.TRANSLATABLE_ERROR,
|
|
5615
|
+
key: 'workspace-list-error',
|
|
5616
|
+
category: WorkspaceListErrorCategory.GENERIC
|
|
5617
|
+
};
|
|
5618
|
+
listenerApi.dispatch(workspaceListActions.errorWorkspaceList({
|
|
5619
|
+
error: workspaceListError
|
|
5620
|
+
}));
|
|
5621
|
+
case 18:
|
|
5622
|
+
case "end":
|
|
5623
|
+
return _context.stop();
|
|
5624
|
+
}
|
|
5625
|
+
}, _callee, null, [[2, 13]]);
|
|
5626
|
+
}));
|
|
5627
|
+
function effect(_x, _x2) {
|
|
5628
|
+
return _effect.apply(this, arguments);
|
|
5629
|
+
}
|
|
5630
|
+
return effect;
|
|
5631
|
+
}()
|
|
5632
|
+
});
|
|
5633
|
+
workspaceListListener.startListening({
|
|
5634
|
+
actionCreator: workspaceListActions.onSuccessWorkspacePresetAction,
|
|
5635
|
+
effect: function () {
|
|
5636
|
+
var _effect2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2, listenerApi) {
|
|
5637
|
+
var _listenerApi$getOrigi;
|
|
5638
|
+
var payload, currentWorkspaceId, action, workspaceId, title, is_shared, searchQuery;
|
|
5639
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
5640
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
5641
|
+
case 0:
|
|
5642
|
+
payload = _ref2.payload;
|
|
5643
|
+
listenerApi.cancelActiveListeners();
|
|
5644
|
+
currentWorkspaceId = (_listenerApi$getOrigi = listenerApi.getOriginalState().workspace) == null ? void 0 : _listenerApi$getOrigi.id;
|
|
5645
|
+
action = payload.action, workspaceId = payload.workspaceId, title = payload.title; // eslint-disable-next-line @typescript-eslint/naming-convention
|
|
5646
|
+
is_shared = 'is_shared' in payload ? payload.is_shared : undefined;
|
|
5647
|
+
listenerApi.dispatch(snackbarActions.openSnackbar(getSnackbarMessage$1(action, title, is_shared)));
|
|
5648
|
+
// if active workspace has been deleted, empty out url
|
|
5649
|
+
if ((action === WorkspacePresetAction.DELETE || action === WorkspacePresetAction.DELETE_SYSTEM_PRESET) && currentWorkspaceId && workspaceId === currentWorkspaceId) {
|
|
5650
|
+
listenerApi.dispatch(routerActions.navigateToUrl({
|
|
5651
|
+
url: getWorkspaceRouteUrl()
|
|
5652
|
+
}));
|
|
5653
|
+
}
|
|
5654
|
+
// For Save as, update url to include the new id
|
|
5655
|
+
if (action === WorkspacePresetAction.SAVE_AS) {
|
|
5656
|
+
listenerApi.dispatch(routerActions.navigateToUrl({
|
|
5657
|
+
url: getWorkspaceRouteUrl(workspaceId)
|
|
5658
|
+
}));
|
|
5659
|
+
}
|
|
5660
|
+
// Retrieve new list with current search query
|
|
5661
|
+
searchQuery = getWorkspaceListSearchQuery(listenerApi.getState());
|
|
5662
|
+
listenerApi.dispatch(workspaceListActions.fetchWorkspaceList(constructFilterParams([], searchQuery)));
|
|
5663
|
+
case 10:
|
|
5664
|
+
case "end":
|
|
5665
|
+
return _context2.stop();
|
|
5666
|
+
}
|
|
5667
|
+
}, _callee2);
|
|
5668
|
+
}));
|
|
5669
|
+
function effect(_x3, _x4) {
|
|
5670
|
+
return _effect2.apply(this, arguments);
|
|
5671
|
+
}
|
|
5672
|
+
return effect;
|
|
5673
|
+
}()
|
|
5674
|
+
});
|
|
5675
|
+
workspaceListListener.startListening({
|
|
5676
|
+
actionCreator: workspaceListActions.submitFormWorkspaceActionDialogOptions,
|
|
5677
|
+
effect: function () {
|
|
5678
|
+
var _effect3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref3, listenerApi) {
|
|
5679
|
+
var payload, workspaceApi, workspaceState, presetId, presetAction, data, emptyMapPresetTitle, emptyWorkspacePresetTitle, scope, _yield$workspaceApi$g2, originalData, workspaceDataNewTitle, _originalData$views, _data$views2, _yield$workspaceApi$g3, _originalData, mergedViews, payloadToSave, isSaveWorkspaceAction, isSaveAsWorkspaceAction, hasWorkspaceAlreadyBeenSaved, workspaceId, workspaceData, viewsWithInitialProps, newWorkspace, message, category;
|
|
5680
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
5681
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
5682
|
+
case 0:
|
|
5683
|
+
payload = _ref3.payload;
|
|
5684
|
+
listenerApi.cancelActiveListeners();
|
|
5685
|
+
workspaceApi = getWorkspaceApi();
|
|
5686
|
+
workspaceState = listenerApi.getState();
|
|
5687
|
+
_context3.prev = 4;
|
|
5688
|
+
presetId = payload.presetId, presetAction = payload.presetAction, data = payload.data, emptyMapPresetTitle = payload.emptyMapPresetTitle, emptyWorkspacePresetTitle = payload.emptyWorkspacePresetTitle;
|
|
5689
|
+
scope = data.scope || 'user'; // duplicate
|
|
5690
|
+
if (presetAction === WorkspacePresetAction.DUPLICATE) ;
|
|
5691
|
+
// delete
|
|
5692
|
+
if (presetAction === WorkspacePresetAction.DELETE || presetAction === WorkspacePresetAction.DELETE_SYSTEM_PRESET) ;
|
|
5693
|
+
// edit
|
|
5694
|
+
if (!(presetAction === WorkspacePresetAction.EDIT)) {
|
|
5695
|
+
_context3.next = 18;
|
|
5696
|
+
break;
|
|
5697
|
+
}
|
|
5698
|
+
_context3.next = 12;
|
|
5699
|
+
return workspaceApi.getWorkspacePreset(presetId);
|
|
5700
|
+
case 12:
|
|
5701
|
+
_yield$workspaceApi$g2 = _context3.sent;
|
|
5702
|
+
originalData = _yield$workspaceApi$g2.data;
|
|
5703
|
+
workspaceDataNewTitle = Object.assign({}, originalData, {
|
|
5704
|
+
title: data.title,
|
|
5705
|
+
"abstract": data["abstract"],
|
|
5706
|
+
labels: data.labels
|
|
5707
|
+
});
|
|
5708
|
+
_context3.next = 17;
|
|
5709
|
+
return workspaceApi.saveWorkspacePreset(presetId, workspaceDataNewTitle);
|
|
5710
|
+
case 17:
|
|
5711
|
+
listenerApi.dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
5712
|
+
workspaceId: presetId,
|
|
5713
|
+
action: presetAction,
|
|
5714
|
+
title: data.title,
|
|
5715
|
+
"abstract": data["abstract"],
|
|
5716
|
+
labels: data.labels,
|
|
5717
|
+
scope: scope
|
|
5718
|
+
}));
|
|
5719
|
+
case 18:
|
|
5720
|
+
if (!(presetAction === WorkspacePresetAction.EDIT_TITLE)) {
|
|
5721
|
+
_context3.next = 28;
|
|
5722
|
+
break;
|
|
5723
|
+
}
|
|
5724
|
+
_context3.next = 21;
|
|
5725
|
+
return workspaceApi.getWorkspacePreset(presetId);
|
|
5726
|
+
case 21:
|
|
5727
|
+
_yield$workspaceApi$g3 = _context3.sent;
|
|
5728
|
+
_originalData = _yield$workspaceApi$g3.data;
|
|
5729
|
+
// 2) Merge the single (or few) edited view titles from `data.views`
|
|
5730
|
+
mergedViews = ((_originalData$views = _originalData.views) != null ? _originalData$views : []).map(function (view) {
|
|
5731
|
+
var _data$views, _updated$title;
|
|
5732
|
+
var updated = ((_data$views = data.views) != null ? _data$views : []).find(function (vw) {
|
|
5733
|
+
return vw.mosaicNodeId === view.mosaicNodeId;
|
|
5734
|
+
});
|
|
5735
|
+
return updated ? Object.assign({}, view, {
|
|
5736
|
+
title: (_updated$title = updated.title) != null ? _updated$title : view.title
|
|
5737
|
+
}) : view;
|
|
5738
|
+
}); // 3) Save back WITHOUT changing workspace title/abstract
|
|
5739
|
+
payloadToSave = Object.assign({}, _originalData, {
|
|
5740
|
+
views: mergedViews
|
|
5741
|
+
});
|
|
5742
|
+
_context3.next = 27;
|
|
5743
|
+
return workspaceApi.saveWorkspacePreset(presetId, payloadToSave);
|
|
5744
|
+
case 27:
|
|
5745
|
+
// 4) Notify success so reducer updates local state
|
|
5746
|
+
listenerApi.dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
5747
|
+
workspaceId: presetId,
|
|
5748
|
+
action: WorkspacePresetAction.EDIT_TITLE,
|
|
5749
|
+
// keep original workspace title/abstract untouched
|
|
5750
|
+
title: _originalData.title,
|
|
5751
|
+
"abstract": _originalData["abstract"],
|
|
5752
|
+
scope: scope,
|
|
5753
|
+
// you can send only the edited ones, or the merged full list.
|
|
5754
|
+
// Reducer uses mosaicNodeId+title from `views` to patch state.
|
|
5755
|
+
views: (_data$views2 = data.views) != null ? _data$views2 : []
|
|
5756
|
+
}));
|
|
5757
|
+
case 28:
|
|
5758
|
+
// save (as) user/system presets
|
|
5759
|
+
isSaveWorkspaceAction = presetAction === WorkspacePresetAction.SAVE_SYSTEM_PRESET || presetAction === WorkspacePresetAction.SAVE;
|
|
5760
|
+
isSaveAsWorkspaceAction = presetAction === WorkspacePresetAction.SAVE_SYSTEM_PRESET_AS || presetAction === WorkspacePresetAction.SAVE_AS;
|
|
5761
|
+
if (!(isSaveWorkspaceAction || isSaveAsWorkspaceAction)) {
|
|
5762
|
+
_context3.next = 47;
|
|
5763
|
+
break;
|
|
5764
|
+
}
|
|
5765
|
+
hasWorkspaceAlreadyBeenSaved = getWorkspaceDialogIsSaved(workspaceState);
|
|
5766
|
+
workspaceId = presetId;
|
|
5767
|
+
workspaceData = getWorkspaceData(listenerApi.getState());
|
|
5768
|
+
viewsWithInitialProps = workspaceData.views.map(function (view) {
|
|
5769
|
+
var _presetLike$component, _presetLike$initialPr;
|
|
5770
|
+
var presetLike = getViewPresetToSendToBackend(listenerApi.getState(), view.mosaicNodeId);
|
|
5771
|
+
return Object.assign({}, view, {
|
|
5772
|
+
componentType: (_presetLike$component = presetLike.componentType) != null ? _presetLike$component : view.componentType,
|
|
5773
|
+
initialProps: (_presetLike$initialPr = presetLike.initialProps) != null ? _presetLike$initialPr : {}
|
|
5774
|
+
});
|
|
5775
|
+
});
|
|
5776
|
+
newWorkspace = Object.assign({}, workspaceData, {
|
|
5777
|
+
id: workspaceId,
|
|
5778
|
+
title: data.title,
|
|
5779
|
+
"abstract": data["abstract"],
|
|
5780
|
+
labels: data.labels,
|
|
5781
|
+
scope: scope,
|
|
5782
|
+
views: viewsWithInitialProps
|
|
5783
|
+
});
|
|
5784
|
+
if (!(!hasWorkspaceAlreadyBeenSaved && isSaveAsWorkspaceAction)) {
|
|
5785
|
+
_context3.next = 41;
|
|
5786
|
+
break;
|
|
5787
|
+
}
|
|
5788
|
+
_context3.next = 39;
|
|
5789
|
+
return workspaceApi.saveWorkspacePresetAs(newWorkspace);
|
|
5790
|
+
case 39:
|
|
5791
|
+
workspaceId = _context3.sent;
|
|
5792
|
+
newWorkspace = Object.assign({}, newWorkspace, {
|
|
5793
|
+
id: workspaceId
|
|
5794
|
+
});
|
|
5795
|
+
case 41:
|
|
5796
|
+
listenerApi.dispatch(workspaceListActions.onSuccessWorkspaceSaveDialog({
|
|
5797
|
+
presetId: workspaceId
|
|
5798
|
+
}));
|
|
5799
|
+
if (isSaveAsWorkspaceAction) {
|
|
5800
|
+
_context3.next = 45;
|
|
5801
|
+
break;
|
|
5802
|
+
}
|
|
5803
|
+
_context3.next = 45;
|
|
5804
|
+
return workspaceApi.saveWorkspacePreset(workspaceId, newWorkspace);
|
|
5805
|
+
case 45:
|
|
5806
|
+
listenerApi.dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
5807
|
+
action: presetAction,
|
|
5808
|
+
workspaceId: workspaceId,
|
|
5809
|
+
title: newWorkspace.title,
|
|
5810
|
+
"abstract": newWorkspace["abstract"],
|
|
5811
|
+
labels: newWorkspace.labels,
|
|
5812
|
+
scope: scope
|
|
5813
|
+
}));
|
|
5814
|
+
listenerApi.dispatch(routerActions.navigateToUrl({
|
|
5815
|
+
url: getWorkspaceRouteUrl(workspaceId)
|
|
5816
|
+
}));
|
|
5817
|
+
case 47:
|
|
5818
|
+
// Reset
|
|
5819
|
+
if (presetAction === WorkspacePresetAction.RESET) {
|
|
5820
|
+
// In case we're resetting the `New workspace` preset
|
|
5821
|
+
if (presetId === getEmptyMapWorkspace().id) {
|
|
5822
|
+
listenerApi.dispatch(workspaceActions.changeToEmptyMapWorkspace({
|
|
5823
|
+
newMapPresetText: emptyMapPresetTitle,
|
|
5824
|
+
newWorkspaceText: emptyWorkspacePresetTitle
|
|
5825
|
+
}));
|
|
5826
|
+
} else {
|
|
5827
|
+
listenerApi.dispatch(workspaceActions.fetchWorkspace({
|
|
5828
|
+
workspaceId: presetId
|
|
5829
|
+
}));
|
|
5830
|
+
}
|
|
5831
|
+
// workspace success handling
|
|
5832
|
+
listenerApi.dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
5833
|
+
action: WorkspacePresetAction.RESET,
|
|
5834
|
+
workspaceId: presetId,
|
|
5835
|
+
title: data.title,
|
|
5836
|
+
"abstract": data["abstract"],
|
|
5837
|
+
labels: data.labels,
|
|
5838
|
+
scope: scope
|
|
5839
|
+
}));
|
|
5840
|
+
}
|
|
5841
|
+
_context3.next = 55;
|
|
5842
|
+
break;
|
|
5843
|
+
case 50:
|
|
5844
|
+
_context3.prev = 50;
|
|
5845
|
+
_context3.t0 = _context3["catch"](4);
|
|
5846
|
+
message = isAxiosError(_context3.t0) ? getAxiosErrorMessage(_context3.t0) : _context3.t0.message;
|
|
5847
|
+
category = isAxiosAuthError(_context3.t0) ? WorkspaceListErrorCategory.AUTH : WorkspaceListErrorCategory.GENERIC;
|
|
5848
|
+
listenerApi.dispatch(workspaceListActions.onErrorWorkspacePresetAction({
|
|
5849
|
+
error: {
|
|
5850
|
+
type: WorkspaceListErrorType.VERBATIM_ERROR,
|
|
5851
|
+
category: category,
|
|
5852
|
+
message: message
|
|
5853
|
+
}
|
|
5854
|
+
}));
|
|
5855
|
+
case 55:
|
|
5856
|
+
case "end":
|
|
5857
|
+
return _context3.stop();
|
|
5858
|
+
}
|
|
5859
|
+
}, _callee3, null, [[4, 50]]);
|
|
5860
|
+
}));
|
|
5861
|
+
function effect(_x5, _x6) {
|
|
5862
|
+
return _effect3.apply(this, arguments);
|
|
5863
|
+
}
|
|
5864
|
+
return effect;
|
|
5865
|
+
}()
|
|
5866
|
+
});
|
|
5867
|
+
|
|
5868
|
+
var workspaceListener = createListenerMiddleware();
|
|
5869
|
+
workspaceListener.startListening({
|
|
5870
|
+
actionCreator: mapActions.registerMap,
|
|
5871
|
+
effect: function () {
|
|
5872
|
+
var _effect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref, listenerApi) {
|
|
5873
|
+
var payload, mapId, viewType, _workspaceState$views, _workspaceState$views2, workspaceState, mapPresetId;
|
|
5874
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5875
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5876
|
+
case 0:
|
|
5877
|
+
payload = _ref.payload;
|
|
5878
|
+
mapId = payload.mapId;
|
|
5879
|
+
viewType = getViewType(listenerApi.getState());
|
|
5880
|
+
if (viewType === 'tiledWindow') {
|
|
5881
|
+
workspaceState = getWorkspaceState(listenerApi.getState()); // if it can't find the id, it's a view with multiple maps
|
|
5882
|
+
mapPresetId = (_workspaceState$views = (_workspaceState$views2 = workspaceState.views.byId[mapId]) == null ? void 0 : _workspaceState$views2.id) != null ? _workspaceState$views : workspaceState.views.byId[workspaceState.views.allIds[0]].id;
|
|
5883
|
+
listenerApi.dispatch(viewPresetActions.registerViewPreset({
|
|
5884
|
+
panelId: mapId,
|
|
5885
|
+
viewPresetId: mapPresetId
|
|
5886
|
+
}));
|
|
5887
|
+
}
|
|
5888
|
+
case 4:
|
|
5889
|
+
case "end":
|
|
5890
|
+
return _context.stop();
|
|
5891
|
+
}
|
|
5892
|
+
}, _callee);
|
|
5893
|
+
}));
|
|
5894
|
+
function effect(_x, _x2) {
|
|
5895
|
+
return _effect.apply(this, arguments);
|
|
5896
|
+
}
|
|
5897
|
+
return effect;
|
|
5898
|
+
}()
|
|
5899
|
+
});
|
|
5900
|
+
workspaceListener.startListening({
|
|
5901
|
+
actionCreator: mapActions.unregisterMap,
|
|
5902
|
+
effect: function () {
|
|
5903
|
+
var _effect2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2, listenerApi) {
|
|
5904
|
+
var payload, mapId, viewType;
|
|
5905
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
5906
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
5907
|
+
case 0:
|
|
4740
5908
|
payload = _ref2.payload;
|
|
4741
5909
|
mapId = payload.mapId;
|
|
4742
5910
|
viewType = getViewType(listenerApi.getState());
|
|
@@ -4760,16 +5928,17 @@ workspaceListener.startListening({
|
|
|
4760
5928
|
workspaceListener.startListening({
|
|
4761
5929
|
actionCreator: workspaceActions.changePreset,
|
|
4762
5930
|
effect: function () {
|
|
4763
|
-
var _effect3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4764
|
-
var
|
|
4765
|
-
|
|
4766
|
-
|
|
5931
|
+
var _effect3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref3, listenerApi) {
|
|
5932
|
+
var _payload$workspacePre, _payload$workspacePre2;
|
|
5933
|
+
var payload, allSyncGroups, isTimeScrollingEnabled, views;
|
|
5934
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
5935
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
4767
5936
|
case 0:
|
|
4768
5937
|
payload = _ref3.payload;
|
|
4769
5938
|
// Cancel any in-progress instances of this listener
|
|
4770
5939
|
listenerApi.cancelActiveListeners();
|
|
4771
5940
|
// give react-mosaic-component time to clear the mosaicNode
|
|
4772
|
-
|
|
5941
|
+
_context4.next = 4;
|
|
4773
5942
|
return listenerApi.condition(function (_action, currentState) {
|
|
4774
5943
|
var _currentState$workspa;
|
|
4775
5944
|
return ((_currentState$workspa = currentState.workspace) == null ? void 0 : _currentState$workspa.mosaicNode) === '';
|
|
@@ -4782,17 +5951,51 @@ workspaceListener.startListening({
|
|
|
4782
5951
|
return listenerApi.dispatch(syncGroupsActions.syncGroupAddGroup(syncGroup));
|
|
4783
5952
|
});
|
|
4784
5953
|
listenerApi.dispatch(genericActions.setLinkedMap({
|
|
4785
|
-
newLinks: payload.workspacePreset.linking
|
|
5954
|
+
newLinks: (_payload$workspacePre = payload.workspacePreset.linking) != null ? _payload$workspacePre : {}
|
|
4786
5955
|
}));
|
|
4787
|
-
isTimeScrollingEnabled = payload.workspacePreset.isTimeScrollingEnabled
|
|
5956
|
+
isTimeScrollingEnabled = (_payload$workspacePre2 = payload.workspacePreset.isTimeScrollingEnabled) != null ? _payload$workspacePre2 : false;
|
|
4788
5957
|
listenerApi.dispatch(syncGroupsActions.syncGroupToggleIsTimeScrollingEnabled({
|
|
4789
5958
|
isTimeScrollingEnabled: isTimeScrollingEnabled
|
|
4790
5959
|
}));
|
|
4791
|
-
|
|
5960
|
+
views = toViewsArray(payload.workspacePreset.views);
|
|
5961
|
+
_context4.next = 14;
|
|
5962
|
+
return Promise.all(views.map(/*#__PURE__*/function () {
|
|
5963
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(view) {
|
|
5964
|
+
var _view$initialProps$sy, _view$initialProps;
|
|
5965
|
+
var syncGroupsIds;
|
|
5966
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
5967
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
5968
|
+
case 0:
|
|
5969
|
+
syncGroupsIds = (_view$initialProps$sy = (_view$initialProps = view.initialProps) == null ? void 0 : _view$initialProps.syncGroupsIds) != null ? _view$initialProps$sy : [];
|
|
5970
|
+
if (!(!syncGroupsIds.length || !view.mosaicNodeId)) {
|
|
5971
|
+
_context3.next = 3;
|
|
5972
|
+
break;
|
|
5973
|
+
}
|
|
5974
|
+
return _context3.abrupt("return");
|
|
5975
|
+
case 3:
|
|
5976
|
+
_context3.next = 5;
|
|
5977
|
+
return Promise.all(syncGroupsIds.map(function (groupId) {
|
|
5978
|
+
return listenerApi.dispatch(syncGroupsActions.syncGroupAddTarget({
|
|
5979
|
+
groupId: groupId,
|
|
5980
|
+
targetId: view.mosaicNodeId,
|
|
5981
|
+
linked: true
|
|
5982
|
+
}));
|
|
5983
|
+
}));
|
|
5984
|
+
case 5:
|
|
5985
|
+
case "end":
|
|
5986
|
+
return _context3.stop();
|
|
5987
|
+
}
|
|
5988
|
+
}, _callee3);
|
|
5989
|
+
}));
|
|
5990
|
+
return function (_x7) {
|
|
5991
|
+
return _ref4.apply(this, arguments);
|
|
5992
|
+
};
|
|
5993
|
+
}()));
|
|
5994
|
+
case 14:
|
|
4792
5995
|
case "end":
|
|
4793
|
-
return
|
|
5996
|
+
return _context4.stop();
|
|
4794
5997
|
}
|
|
4795
|
-
},
|
|
5998
|
+
}, _callee4);
|
|
4796
5999
|
}));
|
|
4797
6000
|
function effect(_x5, _x6) {
|
|
4798
6001
|
return _effect3.apply(this, arguments);
|
|
@@ -4801,12 +6004,12 @@ workspaceListener.startListening({
|
|
|
4801
6004
|
}()
|
|
4802
6005
|
});
|
|
4803
6006
|
var fetchWorkspaceViewPreset = /*#__PURE__*/function () {
|
|
4804
|
-
var
|
|
6007
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(dispatch, viewPresetId, mosaicNodeId) {
|
|
4805
6008
|
var _data$initialProps, workspaceApi, _yield$workspaceApi$g, data, syncGroupIds;
|
|
4806
|
-
return _regeneratorRuntime().wrap(function
|
|
4807
|
-
while (1) switch (
|
|
6009
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
6010
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
4808
6011
|
case 0:
|
|
4809
|
-
|
|
6012
|
+
_context5.prev = 0;
|
|
4810
6013
|
// set the view as loading
|
|
4811
6014
|
dispatch(workspaceActions.updateWorkspaceView({
|
|
4812
6015
|
mosaicNodeId: mosaicNodeId,
|
|
@@ -4814,10 +6017,10 @@ var fetchWorkspaceViewPreset = /*#__PURE__*/function () {
|
|
|
4814
6017
|
}));
|
|
4815
6018
|
// fetch view
|
|
4816
6019
|
workspaceApi = getWorkspaceApi();
|
|
4817
|
-
|
|
6020
|
+
_context5.next = 5;
|
|
4818
6021
|
return workspaceApi.getViewPreset(viewPresetId);
|
|
4819
6022
|
case 5:
|
|
4820
|
-
_yield$workspaceApi$g =
|
|
6023
|
+
_yield$workspaceApi$g = _context5.sent;
|
|
4821
6024
|
data = _yield$workspaceApi$g.data;
|
|
4822
6025
|
dispatch(viewPresetActions.fetchedViewPreset({
|
|
4823
6026
|
viewPreset: data,
|
|
@@ -4826,11 +6029,11 @@ var fetchWorkspaceViewPreset = /*#__PURE__*/function () {
|
|
|
4826
6029
|
}));
|
|
4827
6030
|
// sync all connected syncgroups of viewPreset to the store
|
|
4828
6031
|
syncGroupIds = ((_data$initialProps = data.initialProps) == null ? void 0 : _data$initialProps.syncGroupsIds) || [];
|
|
4829
|
-
if (!(syncGroupIds && syncGroupIds.length)) {
|
|
4830
|
-
|
|
6032
|
+
if (!(syncGroupIds != null && syncGroupIds.length)) {
|
|
6033
|
+
_context5.next = 12;
|
|
4831
6034
|
break;
|
|
4832
6035
|
}
|
|
4833
|
-
|
|
6036
|
+
_context5.next = 12;
|
|
4834
6037
|
return Promise.all(syncGroupIds.map(function (syncGroupId) {
|
|
4835
6038
|
return dispatch(syncGroupsActions.syncGroupAddTarget({
|
|
4836
6039
|
groupId: syncGroupId,
|
|
@@ -4844,44 +6047,44 @@ var fetchWorkspaceViewPreset = /*#__PURE__*/function () {
|
|
|
4844
6047
|
mosaicNodeId: mosaicNodeId,
|
|
4845
6048
|
viewPreset: data
|
|
4846
6049
|
}));
|
|
4847
|
-
|
|
6050
|
+
_context5.next = 18;
|
|
4848
6051
|
break;
|
|
4849
6052
|
case 15:
|
|
4850
|
-
|
|
4851
|
-
|
|
6053
|
+
_context5.prev = 15;
|
|
6054
|
+
_context5.t0 = _context5["catch"](0);
|
|
4852
6055
|
dispatch(workspaceActions.updateWorkspaceView({
|
|
4853
6056
|
mosaicNodeId: mosaicNodeId,
|
|
4854
6057
|
viewPreset: getViewPresetState(viewPresetId, mosaicNodeId, 'error')
|
|
4855
6058
|
}));
|
|
4856
6059
|
case 18:
|
|
4857
6060
|
case "end":
|
|
4858
|
-
return
|
|
6061
|
+
return _context5.stop();
|
|
4859
6062
|
}
|
|
4860
|
-
},
|
|
6063
|
+
}, _callee5, null, [[0, 15]]);
|
|
4861
6064
|
}));
|
|
4862
|
-
return function fetchWorkspaceViewPreset(
|
|
4863
|
-
return
|
|
6065
|
+
return function fetchWorkspaceViewPreset(_x8, _x9, _x0) {
|
|
6066
|
+
return _ref5.apply(this, arguments);
|
|
4864
6067
|
};
|
|
4865
6068
|
}();
|
|
4866
6069
|
workspaceListener.startListening({
|
|
4867
6070
|
actionCreator: workspaceActions.fetchWorkspaceViewPreset,
|
|
4868
6071
|
effect: function () {
|
|
4869
|
-
var _effect4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6072
|
+
var _effect4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref6, listenerApi) {
|
|
4870
6073
|
var payload, viewPresetId, mosaicNodeId;
|
|
4871
|
-
return _regeneratorRuntime().wrap(function
|
|
4872
|
-
while (1) switch (
|
|
6074
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
6075
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
4873
6076
|
case 0:
|
|
4874
|
-
payload =
|
|
6077
|
+
payload = _ref6.payload;
|
|
4875
6078
|
viewPresetId = payload.viewPresetId, mosaicNodeId = payload.mosaicNodeId;
|
|
4876
|
-
|
|
6079
|
+
_context6.next = 4;
|
|
4877
6080
|
return fetchWorkspaceViewPreset(listenerApi.dispatch, viewPresetId, mosaicNodeId);
|
|
4878
6081
|
case 4:
|
|
4879
6082
|
case "end":
|
|
4880
|
-
return
|
|
6083
|
+
return _context6.stop();
|
|
4881
6084
|
}
|
|
4882
|
-
},
|
|
6085
|
+
}, _callee6);
|
|
4883
6086
|
}));
|
|
4884
|
-
function effect(
|
|
6087
|
+
function effect(_x1, _x10) {
|
|
4885
6088
|
return _effect4.apply(this, arguments);
|
|
4886
6089
|
}
|
|
4887
6090
|
return effect;
|
|
@@ -4890,16 +6093,16 @@ workspaceListener.startListening({
|
|
|
4890
6093
|
workspaceListener.startListening({
|
|
4891
6094
|
matcher: isAnyOf(workspaceActions.fetchWorkspace, routerActions.navigateBackOrForward),
|
|
4892
6095
|
effect: function () {
|
|
4893
|
-
var _effect5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6096
|
+
var _effect5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(action, listenerApi) {
|
|
4894
6097
|
var payload, workspaceId, workspaceApi, _yield$workspaceApi$g2, workspaceData, fullLoadingWorkspace, workspaceIdsInBatches, actionsToDispatch, errorType;
|
|
4895
|
-
return _regeneratorRuntime().wrap(function
|
|
4896
|
-
while (1) switch (
|
|
6098
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
6099
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
4897
6100
|
case 0:
|
|
4898
6101
|
// Cancel any in-progress instances of this listener
|
|
4899
6102
|
listenerApi.cancelActiveListeners();
|
|
4900
6103
|
payload = action.payload;
|
|
4901
6104
|
workspaceId = payload.workspaceId;
|
|
4902
|
-
|
|
6105
|
+
_context9.prev = 3;
|
|
4903
6106
|
if (action.type === workspaceActions.fetchWorkspace.type) {
|
|
4904
6107
|
listenerApi.dispatch(routerActions.navigateToUrl({
|
|
4905
6108
|
url: getWorkspaceRouteUrl(workspaceId)
|
|
@@ -4910,13 +6113,13 @@ workspaceListener.startListening({
|
|
|
4910
6113
|
}));
|
|
4911
6114
|
// fetch workspace
|
|
4912
6115
|
workspaceApi = getWorkspaceApi();
|
|
4913
|
-
|
|
6116
|
+
_context9.next = 9;
|
|
4914
6117
|
return workspaceApi.getWorkspacePreset(workspaceId);
|
|
4915
6118
|
case 9:
|
|
4916
|
-
_yield$workspaceApi$g2 =
|
|
6119
|
+
_yield$workspaceApi$g2 = _context9.sent;
|
|
4917
6120
|
workspaceData = _yield$workspaceApi$g2.data;
|
|
4918
6121
|
if (workspaceData) {
|
|
4919
|
-
|
|
6122
|
+
_context9.next = 13;
|
|
4920
6123
|
break;
|
|
4921
6124
|
}
|
|
4922
6125
|
throw new Error(ERROR_NOT_FOUND);
|
|
@@ -4933,51 +6136,70 @@ workspaceListener.startListening({
|
|
|
4933
6136
|
// fetch all individual view presets in batches and collect all actions
|
|
4934
6137
|
workspaceIdsInBatches = getListInChunks(workspaceData.views);
|
|
4935
6138
|
actionsToDispatch = [];
|
|
4936
|
-
|
|
6139
|
+
_context9.next = 20;
|
|
4937
6140
|
return Promise.all(workspaceIdsInBatches.map(/*#__PURE__*/function () {
|
|
4938
|
-
var
|
|
4939
|
-
return _regeneratorRuntime().wrap(function
|
|
4940
|
-
while (1) switch (
|
|
6141
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(batchCall) {
|
|
6142
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
6143
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
4941
6144
|
case 0:
|
|
4942
|
-
|
|
4943
|
-
return Promise.all(batchCall.map(function (
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
6145
|
+
_context8.next = 2;
|
|
6146
|
+
return Promise.all(batchCall.map(/*#__PURE__*/function () {
|
|
6147
|
+
var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(view) {
|
|
6148
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
6149
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
6150
|
+
case 0:
|
|
6151
|
+
if (view.viewPresetId) {
|
|
6152
|
+
_context7.next = 2;
|
|
6153
|
+
break;
|
|
6154
|
+
}
|
|
6155
|
+
return _context7.abrupt("return");
|
|
6156
|
+
case 2:
|
|
6157
|
+
return _context7.abrupt("return", fetchWorkspaceViewPreset(function (thunkAction) {
|
|
6158
|
+
actionsToDispatch.push(thunkAction);
|
|
6159
|
+
}, view.viewPresetId, view.mosaicNodeId));
|
|
6160
|
+
case 3:
|
|
6161
|
+
case "end":
|
|
6162
|
+
return _context7.stop();
|
|
6163
|
+
}
|
|
6164
|
+
}, _callee7);
|
|
6165
|
+
}));
|
|
6166
|
+
return function (_x14) {
|
|
6167
|
+
return _ref8.apply(this, arguments);
|
|
6168
|
+
};
|
|
6169
|
+
}()));
|
|
4948
6170
|
case 2:
|
|
4949
6171
|
case "end":
|
|
4950
|
-
return
|
|
6172
|
+
return _context8.stop();
|
|
4951
6173
|
}
|
|
4952
|
-
},
|
|
6174
|
+
}, _callee8);
|
|
4953
6175
|
}));
|
|
4954
|
-
return function (
|
|
4955
|
-
return
|
|
6176
|
+
return function (_x13) {
|
|
6177
|
+
return _ref7.apply(this, arguments);
|
|
4956
6178
|
};
|
|
4957
6179
|
}()));
|
|
4958
6180
|
case 20:
|
|
4959
6181
|
// Trigger all actions at once
|
|
4960
6182
|
actionsToDispatch.map(listenerApi.dispatch);
|
|
4961
|
-
|
|
6183
|
+
_context9.next = 27;
|
|
4962
6184
|
break;
|
|
4963
6185
|
case 23:
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
errorType =
|
|
6186
|
+
_context9.prev = 23;
|
|
6187
|
+
_context9.t0 = _context9["catch"](3);
|
|
6188
|
+
errorType = _context9.t0.message === ERROR_NOT_FOUND ? WorkspaceErrorType.NOT_FOUND : WorkspaceErrorType.GENERIC;
|
|
4967
6189
|
listenerApi.dispatch(workspaceActions.errorWorkspace({
|
|
4968
6190
|
workspaceId: workspaceId,
|
|
4969
6191
|
error: {
|
|
4970
|
-
message: getErrorMessage(
|
|
6192
|
+
message: getErrorMessage(_context9.t0),
|
|
4971
6193
|
type: errorType
|
|
4972
6194
|
}
|
|
4973
6195
|
}));
|
|
4974
6196
|
case 27:
|
|
4975
6197
|
case "end":
|
|
4976
|
-
return
|
|
6198
|
+
return _context9.stop();
|
|
4977
6199
|
}
|
|
4978
|
-
},
|
|
6200
|
+
}, _callee9, null, [[3, 23]]);
|
|
4979
6201
|
}));
|
|
4980
|
-
function effect(
|
|
6202
|
+
function effect(_x11, _x12) {
|
|
4981
6203
|
return _effect5.apply(this, arguments);
|
|
4982
6204
|
}
|
|
4983
6205
|
return effect;
|
|
@@ -4986,18 +6208,18 @@ workspaceListener.startListening({
|
|
|
4986
6208
|
workspaceListener.startListening({
|
|
4987
6209
|
actionCreator: workspaceActions.saveWorkspacePreset,
|
|
4988
6210
|
effect: function () {
|
|
4989
|
-
var _effect6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4990
|
-
var payload, workspace, workspaceApi;
|
|
4991
|
-
return _regeneratorRuntime().wrap(function
|
|
4992
|
-
while (1) switch (
|
|
6211
|
+
var _effect6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee0(_ref9, listenerApi) {
|
|
6212
|
+
var payload, workspace, _workspace$scope, workspaceApi;
|
|
6213
|
+
return _regeneratorRuntime().wrap(function _callee0$(_context0) {
|
|
6214
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
4993
6215
|
case 0:
|
|
4994
|
-
payload =
|
|
6216
|
+
payload = _ref9.payload;
|
|
4995
6217
|
// Cancel any in-progress instances of this listener
|
|
4996
6218
|
listenerApi.cancelActiveListeners();
|
|
4997
6219
|
workspace = payload.workspace;
|
|
4998
|
-
|
|
6220
|
+
_context0.prev = 3;
|
|
4999
6221
|
workspaceApi = getWorkspaceApi();
|
|
5000
|
-
|
|
6222
|
+
_context0.next = 7;
|
|
5001
6223
|
return workspaceApi.saveWorkspacePreset(workspace.id, workspace);
|
|
5002
6224
|
case 7:
|
|
5003
6225
|
listenerApi.dispatch(workspaceActions.loadedWorkspace(undefined));
|
|
@@ -5005,27 +6227,28 @@ workspaceListener.startListening({
|
|
|
5005
6227
|
action: WorkspacePresetAction.SAVE,
|
|
5006
6228
|
workspaceId: workspace.id,
|
|
5007
6229
|
title: workspace.title,
|
|
5008
|
-
scope: workspace.scope
|
|
6230
|
+
scope: (_workspace$scope = workspace.scope) != null ? _workspace$scope : 'user',
|
|
6231
|
+
views: workspace.views || [emptyWorkspaceBEData]
|
|
5009
6232
|
}));
|
|
5010
|
-
|
|
6233
|
+
_context0.next = 14;
|
|
5011
6234
|
break;
|
|
5012
6235
|
case 11:
|
|
5013
|
-
|
|
5014
|
-
|
|
6236
|
+
_context0.prev = 11;
|
|
6237
|
+
_context0.t0 = _context0["catch"](3);
|
|
5015
6238
|
listenerApi.dispatch(workspaceActions.errorWorkspace({
|
|
5016
6239
|
workspaceId: workspace.id,
|
|
5017
6240
|
error: {
|
|
5018
|
-
message:
|
|
6241
|
+
message: _context0.t0.message,
|
|
5019
6242
|
type: WorkspaceErrorType.SAVE
|
|
5020
6243
|
}
|
|
5021
6244
|
}));
|
|
5022
6245
|
case 14:
|
|
5023
6246
|
case "end":
|
|
5024
|
-
return
|
|
6247
|
+
return _context0.stop();
|
|
5025
6248
|
}
|
|
5026
|
-
},
|
|
6249
|
+
}, _callee0, null, [[3, 11]]);
|
|
5027
6250
|
}));
|
|
5028
|
-
function effect(
|
|
6251
|
+
function effect(_x15, _x16) {
|
|
5029
6252
|
return _effect6.apply(this, arguments);
|
|
5030
6253
|
}
|
|
5031
6254
|
return effect;
|
|
@@ -5034,10 +6257,10 @@ workspaceListener.startListening({
|
|
|
5034
6257
|
workspaceListener.startListening({
|
|
5035
6258
|
actionCreator: workspaceActions.changeToEmptyMapWorkspace,
|
|
5036
6259
|
effect: function () {
|
|
5037
|
-
var _effect7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6260
|
+
var _effect7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee1(action, listenerApi) {
|
|
5038
6261
|
var _action$payload, newMapPresetText, newWorkspaceText, intialViewMapPreset;
|
|
5039
|
-
return _regeneratorRuntime().wrap(function
|
|
5040
|
-
while (1) switch (
|
|
6262
|
+
return _regeneratorRuntime().wrap(function _callee1$(_context1) {
|
|
6263
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
5041
6264
|
case 0:
|
|
5042
6265
|
_action$payload = action.payload, newMapPresetText = _action$payload.newMapPresetText, newWorkspaceText = _action$payload.newWorkspaceText; // Cancel any in-progress instances of this listener
|
|
5043
6266
|
listenerApi.cancelActiveListeners();
|
|
@@ -5047,11 +6270,11 @@ workspaceListener.startListening({
|
|
|
5047
6270
|
}));
|
|
5048
6271
|
case 4:
|
|
5049
6272
|
case "end":
|
|
5050
|
-
return
|
|
6273
|
+
return _context1.stop();
|
|
5051
6274
|
}
|
|
5052
|
-
},
|
|
6275
|
+
}, _callee1);
|
|
5053
6276
|
}));
|
|
5054
|
-
function effect(
|
|
6277
|
+
function effect(_x17, _x18) {
|
|
5055
6278
|
return _effect7.apply(this, arguments);
|
|
5056
6279
|
}
|
|
5057
6280
|
return effect;
|
|
@@ -5060,12 +6283,12 @@ workspaceListener.startListening({
|
|
|
5060
6283
|
workspaceListener.startListening({
|
|
5061
6284
|
actionCreator: workspaceActions.setNewWorkspaceView,
|
|
5062
6285
|
effect: function () {
|
|
5063
|
-
var _effect8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6286
|
+
var _effect8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref0, listenerApi) {
|
|
5064
6287
|
var payload, mosaicNodeId, componentType, newId, bbox, srs, mapPreset;
|
|
5065
|
-
return _regeneratorRuntime().wrap(function
|
|
5066
|
-
while (1) switch (
|
|
6288
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
6289
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
5067
6290
|
case 0:
|
|
5068
|
-
payload =
|
|
6291
|
+
payload = _ref0.payload;
|
|
5069
6292
|
mosaicNodeId = payload.mosaicNodeId, componentType = payload.componentType, newId = payload.newId; // TODO: this would be nice to move into the openlayers store
|
|
5070
6293
|
createViewObjectForNewMap(mosaicNodeId, newId);
|
|
5071
6294
|
// Note, at some point these might no longer be necessary
|
|
@@ -5087,11 +6310,11 @@ workspaceListener.startListening({
|
|
|
5087
6310
|
}));
|
|
5088
6311
|
case 7:
|
|
5089
6312
|
case "end":
|
|
5090
|
-
return
|
|
6313
|
+
return _context10.stop();
|
|
5091
6314
|
}
|
|
5092
|
-
},
|
|
6315
|
+
}, _callee10);
|
|
5093
6316
|
}));
|
|
5094
|
-
function effect(
|
|
6317
|
+
function effect(_x19, _x20) {
|
|
5095
6318
|
return _effect8.apply(this, arguments);
|
|
5096
6319
|
}
|
|
5097
6320
|
return effect;
|
|
@@ -5100,15 +6323,15 @@ workspaceListener.startListening({
|
|
|
5100
6323
|
workspaceListener.startListening({
|
|
5101
6324
|
actionCreator: workspaceActions.updateWorkspaceViews,
|
|
5102
6325
|
effect: function () {
|
|
5103
|
-
var _effect9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6326
|
+
var _effect9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_, listenerApi) {
|
|
5104
6327
|
var viewIds;
|
|
5105
|
-
return _regeneratorRuntime().wrap(function
|
|
5106
|
-
while (1) switch (
|
|
6328
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
6329
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
5107
6330
|
case 0:
|
|
5108
6331
|
// Cancel any in-progress instances of this listener
|
|
5109
6332
|
listenerApi.cancelActiveListeners();
|
|
5110
6333
|
// Delay before starting actual work
|
|
5111
|
-
|
|
6334
|
+
_context11.next = 3;
|
|
5112
6335
|
return listenerApi.delay(100);
|
|
5113
6336
|
case 3:
|
|
5114
6337
|
/* This will trigger all maps and other components
|
|
@@ -5116,149 +6339,33 @@ workspaceListener.startListening({
|
|
|
5116
6339
|
window.dispatchEvent(new Event('resize'));
|
|
5117
6340
|
// Adjust the bbox of the original view after the new map is added. This is a temporal solution until the OpenLayers ticket
|
|
5118
6341
|
// https://github.com/openlayers/openlayers/issues/16572 is solved.
|
|
5119
|
-
|
|
6342
|
+
_context11.next = 6;
|
|
5120
6343
|
return listenerApi.delay(10);
|
|
5121
6344
|
case 6:
|
|
5122
6345
|
viewIds = getViewIds(listenerApi.getState());
|
|
5123
6346
|
viewIds.forEach(function (viewId) {
|
|
5124
6347
|
var bbox = mapSelectors.getBbox(listenerApi.getState(), viewId);
|
|
5125
6348
|
var srs = mapSelectors.getSrs(listenerApi.getState(), viewId);
|
|
5126
|
-
if (bbox
|
|
6349
|
+
if ((bbox == null ? void 0 : bbox.left) !== undefined && srs) {
|
|
5127
6350
|
listenerApi.dispatch(mapActions.setBbox({
|
|
5128
6351
|
mapId: viewId,
|
|
5129
6352
|
bbox: bbox,
|
|
5130
6353
|
srs: srs
|
|
5131
6354
|
}));
|
|
5132
|
-
}
|
|
5133
|
-
});
|
|
5134
|
-
case 8:
|
|
5135
|
-
case "end":
|
|
5136
|
-
return
|
|
5137
|
-
}
|
|
5138
|
-
},
|
|
5139
|
-
}));
|
|
5140
|
-
function effect(
|
|
5141
|
-
return _effect9.apply(this, arguments);
|
|
5142
|
-
}
|
|
5143
|
-
return effect;
|
|
5144
|
-
}()
|
|
5145
|
-
});
|
|
5146
|
-
|
|
5147
|
-
/* *
|
|
5148
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5149
|
-
* you may not use this file except in compliance with the License.
|
|
5150
|
-
* You may obtain a copy of the License at
|
|
5151
|
-
*
|
|
5152
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5153
|
-
*
|
|
5154
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
5155
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5156
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5157
|
-
* See the License for the specific language governing permissions and
|
|
5158
|
-
* limitations under the License.
|
|
5159
|
-
*
|
|
5160
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5161
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
5162
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
5163
|
-
* */
|
|
5164
|
-
var getWorkspaceListStore = function getWorkspaceListStore(store) {
|
|
5165
|
-
if (store != null && store.workspaceList) {
|
|
5166
|
-
return store.workspaceList;
|
|
5167
|
-
}
|
|
5168
|
-
return null;
|
|
5169
|
-
};
|
|
5170
|
-
var selectors = workspaceListAdapter.getSelectors(function (state) {
|
|
5171
|
-
var _state$workspaceList;
|
|
5172
|
-
return (_state$workspaceList = state == null ? void 0 : state.workspaceList) != null ? _state$workspaceList : {
|
|
5173
|
-
entities: {},
|
|
5174
|
-
ids: []
|
|
5175
|
-
};
|
|
5176
|
-
});
|
|
5177
|
-
var getWorkspaceList = selectors.selectAll;
|
|
5178
|
-
var getWorkspacePresetFromList = function getWorkspacePresetFromList(store, id) {
|
|
5179
|
-
return selectors.selectById(store, id);
|
|
5180
|
-
};
|
|
5181
|
-
var getIsWorkspaceListFetching = createSelector(getWorkspaceListStore, function (store) {
|
|
5182
|
-
return store;
|
|
5183
|
-
}, function (state) {
|
|
5184
|
-
return (state == null ? void 0 : state.isFetching) || false;
|
|
5185
|
-
}, selectorMemoizationOptions);
|
|
5186
|
-
var getWorkspaceDialogIsSaved = createSelector(getWorkspaceListStore, function (store) {
|
|
5187
|
-
return store;
|
|
5188
|
-
}, function (state) {
|
|
5189
|
-
var _state$workspaceActio;
|
|
5190
|
-
return (state == null || (_state$workspaceActio = state.workspaceActionDialog) == null ? void 0 : _state$workspaceActio.hasSaved) || false;
|
|
5191
|
-
}, selectorMemoizationOptions);
|
|
5192
|
-
var getWorkspaceListError = createSelector(getWorkspaceListStore, function (store) {
|
|
5193
|
-
return store;
|
|
5194
|
-
}, function (state) {
|
|
5195
|
-
return (state == null ? void 0 : state.error) || undefined;
|
|
5196
|
-
}, selectorMemoizationOptions);
|
|
5197
|
-
var getWorkspaceActionFormValues = createSelector(getWorkspaceListStore, function (store) {
|
|
5198
|
-
var _store$workspaceActio;
|
|
5199
|
-
return ((_store$workspaceActio = store.workspaceActionDialog) == null ? void 0 : _store$workspaceActio.formValues) || {};
|
|
5200
|
-
}, selectorMemoizationOptions);
|
|
5201
|
-
var getWorkspaceActionDialogDetails = createSelector(getWorkspaceListStore, getWorkspaceState, getViewPresetsStore, function (workspaceListState, workspaceState, viewpresetState) {
|
|
5202
|
-
var dialog = (workspaceListState == null ? void 0 : workspaceListState.workspaceActionDialog) || false;
|
|
5203
|
-
if (dialog) {
|
|
5204
|
-
var _dialog$formValues$vi;
|
|
5205
|
-
var views = (_dialog$formValues$vi = dialog.formValues.views) == null ? void 0 : _dialog$formValues$vi.map(function (view) {
|
|
5206
|
-
var workspaceView = workspaceState.views.byId[view.mosaicNodeId];
|
|
5207
|
-
var viewComplete = viewpresetState.entities[view.mosaicNodeId];
|
|
5208
|
-
return {
|
|
5209
|
-
mosaicNodeId: view.mosaicNodeId,
|
|
5210
|
-
viewPresetId: (viewComplete == null ? void 0 : viewComplete.activeViewPresetId) || view.viewPresetId,
|
|
5211
|
-
isSelected: view.isSelected,
|
|
5212
|
-
title: view.title || workspaceView.title,
|
|
5213
|
-
error: viewComplete == null ? void 0 : viewComplete.error,
|
|
5214
|
-
isFetching: viewComplete == null ? void 0 : viewComplete.isFetching,
|
|
5215
|
-
hasChanges: viewComplete == null ? void 0 : viewComplete.hasChanges,
|
|
5216
|
-
scope: view.scope
|
|
5217
|
-
};
|
|
5218
|
-
});
|
|
5219
|
-
return Object.assign({}, dialog, {
|
|
5220
|
-
formValues: Object.assign({}, dialog.formValues, views && {
|
|
5221
|
-
views: views
|
|
5222
|
-
})
|
|
5223
|
-
});
|
|
5224
|
-
}
|
|
5225
|
-
return dialog;
|
|
5226
|
-
}, selectorMemoizationOptions);
|
|
5227
|
-
var getIsWorkspaceListDialogOpen = createSelector(getWorkspaceListStore, function (store) {
|
|
5228
|
-
return store;
|
|
5229
|
-
}, function (state) {
|
|
5230
|
-
return (state == null ? void 0 : state.isWorkspaceListDialogOpen) || false;
|
|
5231
|
-
}, selectorMemoizationOptions);
|
|
5232
|
-
var getWorkspaceListFilters = createSelector(function (store) {
|
|
5233
|
-
return getWorkspaceListStore(store);
|
|
5234
|
-
}, function (_store, scope) {
|
|
5235
|
-
return scope;
|
|
5236
|
-
}, function (_store, _scope, isAdmin) {
|
|
5237
|
-
return isAdmin;
|
|
5238
|
-
}, function (state, _scope, isAdmin) {
|
|
5239
|
-
var filters = (state == null ? void 0 : state.workspaceListFilters) || [];
|
|
5240
|
-
if (isAdmin) {
|
|
5241
|
-
// Only return system and shared for admins
|
|
5242
|
-
return filters.filter(function (filter) {
|
|
5243
|
-
return filter.id === 'system' || filter.id === 'shared';
|
|
5244
|
-
}).map(function (filter) {
|
|
5245
|
-
return Object.assign({}, filter, {
|
|
5246
|
-
isDisabled: false
|
|
5247
|
-
});
|
|
5248
|
-
});
|
|
5249
|
-
}
|
|
5250
|
-
// Regular users: return all filters
|
|
5251
|
-
return filters.map(function (filter) {
|
|
5252
|
-
return Object.assign({}, filter, {
|
|
5253
|
-
isDisabled: false
|
|
5254
|
-
});
|
|
5255
|
-
});
|
|
5256
|
-
}, selectorMemoizationOptions);
|
|
5257
|
-
var getWorkspaceListSearchQuery = createSelector(getWorkspaceListStore, function (store) {
|
|
5258
|
-
return store;
|
|
5259
|
-
}, function (state) {
|
|
5260
|
-
return (state == null ? void 0 : state.searchQuery) || '';
|
|
5261
|
-
}, selectorMemoizationOptions);
|
|
6355
|
+
}
|
|
6356
|
+
});
|
|
6357
|
+
case 8:
|
|
6358
|
+
case "end":
|
|
6359
|
+
return _context11.stop();
|
|
6360
|
+
}
|
|
6361
|
+
}, _callee11);
|
|
6362
|
+
}));
|
|
6363
|
+
function effect(_x21, _x22) {
|
|
6364
|
+
return _effect9.apply(this, arguments);
|
|
6365
|
+
}
|
|
6366
|
+
return effect;
|
|
6367
|
+
}()
|
|
6368
|
+
});
|
|
5262
6369
|
|
|
5263
6370
|
/* *
|
|
5264
6371
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -5355,7 +6462,7 @@ var getFilteredViewPresetListForView = createSelector(getViewPresetsList, getVie
|
|
|
5355
6462
|
}, selectorMemoizationOptions);
|
|
5356
6463
|
|
|
5357
6464
|
var processError = function processError(error, component, errorMessageKey) {
|
|
5358
|
-
var message = isAxiosError(error) ? getAxiosErrorMessage(error) : errorMessageKey;
|
|
6465
|
+
var message = isAxiosError$1(error) ? getAxiosErrorMessage(error) : errorMessageKey;
|
|
5359
6466
|
var errorType = isAxiosAuthError(error) ? ViewPresetErrorType.AUTH : ViewPresetErrorType.GENERIC;
|
|
5360
6467
|
return {
|
|
5361
6468
|
message: message,
|
|
@@ -5440,52 +6547,6 @@ viewPresetsListener.startListening({
|
|
|
5440
6547
|
return effect;
|
|
5441
6548
|
}()
|
|
5442
6549
|
});
|
|
5443
|
-
var saveViewPresetAsEffect = /*#__PURE__*/function () {
|
|
5444
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref2, listenerApi) {
|
|
5445
|
-
var payload, panelId, viewPreset, workspaceApi, viewPresetId;
|
|
5446
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
5447
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
5448
|
-
case 0:
|
|
5449
|
-
payload = _ref2.payload;
|
|
5450
|
-
listenerApi.cancelActiveListeners();
|
|
5451
|
-
panelId = payload.panelId, viewPreset = payload.viewPreset;
|
|
5452
|
-
_context3.prev = 3;
|
|
5453
|
-
workspaceApi = getWorkspaceApi();
|
|
5454
|
-
_context3.next = 7;
|
|
5455
|
-
return workspaceApi.saveViewPresetAs(viewPreset);
|
|
5456
|
-
case 7:
|
|
5457
|
-
viewPresetId = _context3.sent;
|
|
5458
|
-
listenerApi.dispatch(snackbarActions.openSnackbar(getSnackbarMessage(PresetAction.SAVE, viewPreset.title)));
|
|
5459
|
-
listenerApi.dispatch(viewPresetActions.savedViewPreset({
|
|
5460
|
-
panelId: panelId,
|
|
5461
|
-
viewPresetId: viewPresetId
|
|
5462
|
-
}));
|
|
5463
|
-
listenerApi.dispatch(viewPresetActions.fetchedViewPreset({
|
|
5464
|
-
panelId: panelId,
|
|
5465
|
-
viewPresetId: viewPresetId,
|
|
5466
|
-
viewPreset: viewPreset
|
|
5467
|
-
}));
|
|
5468
|
-
return _context3.abrupt("return", Object.assign({}, viewPreset, {
|
|
5469
|
-
id: viewPresetId
|
|
5470
|
-
}));
|
|
5471
|
-
case 14:
|
|
5472
|
-
_context3.prev = 14;
|
|
5473
|
-
_context3.t0 = _context3["catch"](3);
|
|
5474
|
-
listenerApi.dispatch(viewPresetActions.errorViewPreset({
|
|
5475
|
-
error: processError(_context3.t0, ViewPresetErrorComponent.PRESET_DETAIL, 'workspace-mappreset-error-save'),
|
|
5476
|
-
panelId: panelId
|
|
5477
|
-
}));
|
|
5478
|
-
return _context3.abrupt("return", _context3.t0);
|
|
5479
|
-
case 18:
|
|
5480
|
-
case "end":
|
|
5481
|
-
return _context3.stop();
|
|
5482
|
-
}
|
|
5483
|
-
}, _callee3, null, [[3, 14]]);
|
|
5484
|
-
}));
|
|
5485
|
-
return function saveViewPresetAsEffect(_x5, _x6) {
|
|
5486
|
-
return _ref3.apply(this, arguments);
|
|
5487
|
-
};
|
|
5488
|
-
}();
|
|
5489
6550
|
var saveViewPresetEffect = /*#__PURE__*/function () {
|
|
5490
6551
|
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref4, listenerApi) {
|
|
5491
6552
|
var payload, panelId, viewPreset, viewPresetId, workspaceApi;
|
|
@@ -5629,293 +6690,21 @@ viewPresetsListener.startListening({
|
|
|
5629
6690
|
}
|
|
5630
6691
|
if (action === PresetAction.SAVE_AS && viewPresetId) {
|
|
5631
6692
|
listenerApi.dispatch(viewPresetActions.setActiveViewPresetId({
|
|
5632
|
-
panelId: panelId,
|
|
5633
|
-
viewPresetId: viewPresetId
|
|
5634
|
-
}));
|
|
5635
|
-
}
|
|
5636
|
-
} catch (_error) {
|
|
5637
|
-
// TODO: use error handling of mapPreset https://gitlab.com/opengeoweb/opengeoweb/-/issues/3043
|
|
5638
|
-
}
|
|
5639
|
-
case 5:
|
|
5640
|
-
case "end":
|
|
5641
|
-
return _context6.stop();
|
|
5642
|
-
}
|
|
5643
|
-
}, _callee6);
|
|
5644
|
-
}));
|
|
5645
|
-
function effect(_x1, _x10) {
|
|
5646
|
-
return _effect4.apply(this, arguments);
|
|
5647
|
-
}
|
|
5648
|
-
return effect;
|
|
5649
|
-
}()
|
|
5650
|
-
});
|
|
5651
|
-
|
|
5652
|
-
var emptyWorkspaceBEData = Object.assign({}, getEmptyMapWorkspace(), {
|
|
5653
|
-
views: [{
|
|
5654
|
-
mosaicNodeId: '1_screen',
|
|
5655
|
-
viewPresetId: 'emptyMap'
|
|
5656
|
-
}]
|
|
5657
|
-
});
|
|
5658
|
-
var workspaceListListener = createListenerMiddleware();
|
|
5659
|
-
workspaceListListener.startListening({
|
|
5660
|
-
actionCreator: workspaceListActions.fetchWorkspaceList,
|
|
5661
|
-
effect: function () {
|
|
5662
|
-
var _effect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref, listenerApi) {
|
|
5663
|
-
var workspaceFilterParams, workspaceApi, _yield$workspaceApi$g, data, isAuthError, workspaceListError;
|
|
5664
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5665
|
-
while (1) switch (_context.prev = _context.next) {
|
|
5666
|
-
case 0:
|
|
5667
|
-
workspaceFilterParams = _ref.payload;
|
|
5668
|
-
listenerApi.cancelActiveListeners();
|
|
5669
|
-
_context.prev = 2;
|
|
5670
|
-
workspaceApi = getWorkspaceApi();
|
|
5671
|
-
_context.next = 6;
|
|
5672
|
-
return workspaceApi.getWorkspacePresets(workspaceFilterParams);
|
|
5673
|
-
case 6:
|
|
5674
|
-
_yield$workspaceApi$g = _context.sent;
|
|
5675
|
-
data = _yield$workspaceApi$g.data;
|
|
5676
|
-
if (!listenerApi.signal.aborted) {
|
|
5677
|
-
_context.next = 10;
|
|
5678
|
-
break;
|
|
5679
|
-
}
|
|
5680
|
-
return _context.abrupt("return");
|
|
5681
|
-
case 10:
|
|
5682
|
-
listenerApi.dispatch(workspaceListActions.fetchedWorkspaceList({
|
|
5683
|
-
workspaceList: data
|
|
5684
|
-
}));
|
|
5685
|
-
_context.next = 18;
|
|
5686
|
-
break;
|
|
5687
|
-
case 13:
|
|
5688
|
-
_context.prev = 13;
|
|
5689
|
-
_context.t0 = _context["catch"](2);
|
|
5690
|
-
isAuthError = isAxiosAuthError(_context.t0);
|
|
5691
|
-
workspaceListError = isAuthError ? {
|
|
5692
|
-
type: WorkspaceListErrorType.VERBATIM_ERROR,
|
|
5693
|
-
message: getAxiosErrorMessage(_context.t0),
|
|
5694
|
-
category: WorkspaceListErrorCategory.AUTH
|
|
5695
|
-
} : {
|
|
5696
|
-
type: WorkspaceListErrorType.TRANSLATABLE_ERROR,
|
|
5697
|
-
key: 'workspace-list-error',
|
|
5698
|
-
category: WorkspaceListErrorCategory.GENERIC
|
|
5699
|
-
};
|
|
5700
|
-
listenerApi.dispatch(workspaceListActions.errorWorkspaceList({
|
|
5701
|
-
error: workspaceListError
|
|
5702
|
-
}));
|
|
5703
|
-
case 18:
|
|
5704
|
-
case "end":
|
|
5705
|
-
return _context.stop();
|
|
5706
|
-
}
|
|
5707
|
-
}, _callee, null, [[2, 13]]);
|
|
5708
|
-
}));
|
|
5709
|
-
function effect(_x, _x2) {
|
|
5710
|
-
return _effect.apply(this, arguments);
|
|
5711
|
-
}
|
|
5712
|
-
return effect;
|
|
5713
|
-
}()
|
|
5714
|
-
});
|
|
5715
|
-
workspaceListListener.startListening({
|
|
5716
|
-
actionCreator: workspaceListActions.onSuccessWorkspacePresetAction,
|
|
5717
|
-
effect: function () {
|
|
5718
|
-
var _effect2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2, listenerApi) {
|
|
5719
|
-
var _listenerApi$getOrigi;
|
|
5720
|
-
var payload, currentWorkspaceId, action, workspaceId, title, is_shared, searchQuery;
|
|
5721
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
5722
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
5723
|
-
case 0:
|
|
5724
|
-
payload = _ref2.payload;
|
|
5725
|
-
listenerApi.cancelActiveListeners();
|
|
5726
|
-
currentWorkspaceId = (_listenerApi$getOrigi = listenerApi.getOriginalState().workspace) == null ? void 0 : _listenerApi$getOrigi.id;
|
|
5727
|
-
action = payload.action, workspaceId = payload.workspaceId, title = payload.title; // eslint-disable-next-line @typescript-eslint/naming-convention
|
|
5728
|
-
is_shared = 'is_shared' in payload ? payload.is_shared : undefined;
|
|
5729
|
-
listenerApi.dispatch(snackbarActions.openSnackbar(getSnackbarMessage$1(action, title, is_shared)));
|
|
5730
|
-
// if active workspace has been deleted, empty out url
|
|
5731
|
-
if ((action === WorkspacePresetAction.DELETE || action === WorkspacePresetAction.DELETE_SYSTEM_PRESET) && currentWorkspaceId && workspaceId === currentWorkspaceId) {
|
|
5732
|
-
listenerApi.dispatch(routerActions.navigateToUrl({
|
|
5733
|
-
url: getWorkspaceRouteUrl()
|
|
5734
|
-
}));
|
|
5735
|
-
}
|
|
5736
|
-
// For Save as, update url to include the new id
|
|
5737
|
-
if (action === WorkspacePresetAction.SAVE_AS) {
|
|
5738
|
-
listenerApi.dispatch(routerActions.navigateToUrl({
|
|
5739
|
-
url: getWorkspaceRouteUrl(workspaceId)
|
|
5740
|
-
}));
|
|
5741
|
-
}
|
|
5742
|
-
// Retrieve new list with current search query
|
|
5743
|
-
searchQuery = getWorkspaceListSearchQuery(listenerApi.getState());
|
|
5744
|
-
listenerApi.dispatch(workspaceListActions.fetchWorkspaceList(constructFilterParams([], searchQuery)));
|
|
5745
|
-
case 10:
|
|
5746
|
-
case "end":
|
|
5747
|
-
return _context2.stop();
|
|
5748
|
-
}
|
|
5749
|
-
}, _callee2);
|
|
5750
|
-
}));
|
|
5751
|
-
function effect(_x3, _x4) {
|
|
5752
|
-
return _effect2.apply(this, arguments);
|
|
5753
|
-
}
|
|
5754
|
-
return effect;
|
|
5755
|
-
}()
|
|
5756
|
-
});
|
|
5757
|
-
workspaceListListener.startListening({
|
|
5758
|
-
actionCreator: workspaceListActions.submitFormWorkspaceActionDialogOptions,
|
|
5759
|
-
effect: function () {
|
|
5760
|
-
var _effect3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref3, listenerApi) {
|
|
5761
|
-
var payload, workspaceApi, workspaceState, presetId, presetAction, data, emptyMapPresetTitle, emptyWorkspacePresetTitle, scope, _yield$workspaceApi$g2, originalData, workspaceDataNewTitle, isSaveWorkspaceAction, isSaveAsWorkspaceAction, hasWorkspaceAlreadyBeenSaved, workspaceId, saveViewPreset, getViewPresetEntity, viewPresetResults, hasError, _hasError$message, errorMessage, workspaceData, newWorkspace, message, category;
|
|
5762
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
5763
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
5764
|
-
case 0:
|
|
5765
|
-
payload = _ref3.payload;
|
|
5766
|
-
listenerApi.cancelActiveListeners();
|
|
5767
|
-
workspaceApi = getWorkspaceApi();
|
|
5768
|
-
workspaceState = listenerApi.getState();
|
|
5769
|
-
_context3.prev = 4;
|
|
5770
|
-
presetId = payload.presetId, presetAction = payload.presetAction, data = payload.data, emptyMapPresetTitle = payload.emptyMapPresetTitle, emptyWorkspacePresetTitle = payload.emptyWorkspacePresetTitle;
|
|
5771
|
-
scope = data.scope || 'user'; // duplicate
|
|
5772
|
-
if (presetAction === WorkspacePresetAction.DUPLICATE) ;
|
|
5773
|
-
// delete
|
|
5774
|
-
if (presetAction === WorkspacePresetAction.DELETE || presetAction === WorkspacePresetAction.DELETE_SYSTEM_PRESET) ;
|
|
5775
|
-
// edit
|
|
5776
|
-
if (!(presetAction === WorkspacePresetAction.EDIT)) {
|
|
5777
|
-
_context3.next = 18;
|
|
5778
|
-
break;
|
|
5779
|
-
}
|
|
5780
|
-
_context3.next = 12;
|
|
5781
|
-
return workspaceApi.getWorkspacePreset(presetId);
|
|
5782
|
-
case 12:
|
|
5783
|
-
_yield$workspaceApi$g2 = _context3.sent;
|
|
5784
|
-
originalData = _yield$workspaceApi$g2.data;
|
|
5785
|
-
workspaceDataNewTitle = Object.assign({}, originalData, {
|
|
5786
|
-
title: data.title,
|
|
5787
|
-
"abstract": data["abstract"]
|
|
5788
|
-
});
|
|
5789
|
-
_context3.next = 17;
|
|
5790
|
-
return workspaceApi.saveWorkspacePreset(presetId, workspaceDataNewTitle);
|
|
5791
|
-
case 17:
|
|
5792
|
-
listenerApi.dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
5793
|
-
workspaceId: presetId,
|
|
5794
|
-
action: presetAction,
|
|
5795
|
-
title: data.title,
|
|
5796
|
-
"abstract": data["abstract"],
|
|
5797
|
-
scope: scope
|
|
5798
|
-
}));
|
|
5799
|
-
case 18:
|
|
5800
|
-
// save (as) user/system presets
|
|
5801
|
-
isSaveWorkspaceAction = presetAction === WorkspacePresetAction.SAVE_SYSTEM_PRESET || presetAction === WorkspacePresetAction.SAVE;
|
|
5802
|
-
isSaveAsWorkspaceAction = presetAction === WorkspacePresetAction.SAVE_SYSTEM_PRESET_AS || presetAction === WorkspacePresetAction.SAVE_AS;
|
|
5803
|
-
if (!(isSaveWorkspaceAction || isSaveAsWorkspaceAction)) {
|
|
5804
|
-
_context3.next = 44;
|
|
5805
|
-
break;
|
|
5806
|
-
}
|
|
5807
|
-
hasWorkspaceAlreadyBeenSaved = getWorkspaceDialogIsSaved(workspaceState);
|
|
5808
|
-
workspaceId = presetId;
|
|
5809
|
-
if (!(!hasWorkspaceAlreadyBeenSaved && isSaveAsWorkspaceAction)) {
|
|
5810
|
-
_context3.next = 27;
|
|
5811
|
-
break;
|
|
5812
|
-
}
|
|
5813
|
-
_context3.next = 26;
|
|
5814
|
-
return workspaceApi.saveWorkspacePresetAs(data);
|
|
5815
|
-
case 26:
|
|
5816
|
-
workspaceId = _context3.sent;
|
|
5817
|
-
case 27:
|
|
5818
|
-
// lock the workspace
|
|
5819
|
-
listenerApi.dispatch(workspaceListActions.onSuccessWorkspaceSaveDialog({
|
|
5820
|
-
presetId: workspaceId
|
|
5821
|
-
}));
|
|
5822
|
-
saveViewPreset = function saveViewPreset(payloadAction, saveAs) {
|
|
5823
|
-
return saveAs ? saveViewPresetAsEffect(payloadAction, listenerApi) : saveViewPresetEffect(payloadAction, listenerApi);
|
|
5824
|
-
};
|
|
5825
|
-
getViewPresetEntity = function getViewPresetEntity(view) {
|
|
5826
|
-
return Object.assign({}, getViewPresetToSendToBackend(workspaceState, view.mosaicNodeId), {
|
|
5827
|
-
title: view.title
|
|
5828
|
-
}, view["abstract"] && {
|
|
5829
|
-
"abstract": view["abstract"]
|
|
5830
|
-
});
|
|
5831
|
-
};
|
|
5832
|
-
_context3.next = 32;
|
|
5833
|
-
return updateViewPresets(saveViewPreset, getViewPresetEntity, data, scope);
|
|
5834
|
-
case 32:
|
|
5835
|
-
viewPresetResults = _context3.sent;
|
|
5836
|
-
hasError = viewPresetResults.find(function (view) {
|
|
5837
|
-
return view.message;
|
|
5838
|
-
});
|
|
5839
|
-
if (!hasError) {
|
|
5840
|
-
_context3.next = 38;
|
|
5841
|
-
break;
|
|
5842
|
-
}
|
|
5843
|
-
// maybe we can use another action, but this resets fetching of the form
|
|
5844
|
-
errorMessage = (_hasError$message = hasError == null ? void 0 : hasError.message) != null ? _hasError$message : 'An error occurred';
|
|
5845
|
-
listenerApi.dispatch(workspaceListActions.onErrorWorkspacePresetAction({
|
|
5846
|
-
error: {
|
|
5847
|
-
type: WorkspaceListErrorType.VERBATIM_ERROR,
|
|
5848
|
-
message: errorMessage,
|
|
5849
|
-
category: WorkspaceListErrorCategory.GENERIC
|
|
5850
|
-
}
|
|
5851
|
-
}));
|
|
5852
|
-
return _context3.abrupt("return");
|
|
5853
|
-
case 38:
|
|
5854
|
-
workspaceData = getWorkspaceData(listenerApi.getState());
|
|
5855
|
-
newWorkspace = Object.assign({}, workspaceData, {
|
|
5856
|
-
id: workspaceId,
|
|
5857
|
-
title: data.title,
|
|
5858
|
-
"abstract": data["abstract"],
|
|
5859
|
-
scope: scope
|
|
5860
|
-
});
|
|
5861
|
-
_context3.next = 42;
|
|
5862
|
-
return workspaceApi.saveWorkspacePreset(workspaceId, newWorkspace);
|
|
5863
|
-
case 42:
|
|
5864
|
-
listenerApi.dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
5865
|
-
action: presetAction,
|
|
5866
|
-
workspaceId: workspaceId,
|
|
5867
|
-
title: newWorkspace.title,
|
|
5868
|
-
"abstract": newWorkspace["abstract"],
|
|
5869
|
-
scope: scope
|
|
5870
|
-
}));
|
|
5871
|
-
listenerApi.dispatch(routerActions.navigateToUrl({
|
|
5872
|
-
url: getWorkspaceRouteUrl(workspaceId)
|
|
5873
|
-
}));
|
|
5874
|
-
case 44:
|
|
5875
|
-
// Reset
|
|
5876
|
-
if (presetAction === WorkspacePresetAction.RESET) {
|
|
5877
|
-
// In case we're resetting the `New workspace` preset
|
|
5878
|
-
if (presetId === getEmptyMapWorkspace().id) {
|
|
5879
|
-
listenerApi.dispatch(workspaceActions.changeToEmptyMapWorkspace({
|
|
5880
|
-
newMapPresetText: emptyMapPresetTitle,
|
|
5881
|
-
newWorkspaceText: emptyWorkspacePresetTitle
|
|
5882
|
-
}));
|
|
5883
|
-
} else {
|
|
5884
|
-
listenerApi.dispatch(workspaceActions.fetchWorkspace({
|
|
5885
|
-
workspaceId: presetId
|
|
6693
|
+
panelId: panelId,
|
|
6694
|
+
viewPresetId: viewPresetId
|
|
5886
6695
|
}));
|
|
5887
6696
|
}
|
|
5888
|
-
|
|
5889
|
-
|
|
5890
|
-
action: WorkspacePresetAction.RESET,
|
|
5891
|
-
workspaceId: presetId,
|
|
5892
|
-
title: data.title,
|
|
5893
|
-
"abstract": data["abstract"],
|
|
5894
|
-
scope: scope
|
|
5895
|
-
}));
|
|
6697
|
+
} catch (_error) {
|
|
6698
|
+
// TODO: use error handling of mapPreset https://gitlab.com/opengeoweb/opengeoweb/-/issues/3043
|
|
5896
6699
|
}
|
|
5897
|
-
|
|
5898
|
-
break;
|
|
5899
|
-
case 47:
|
|
5900
|
-
_context3.prev = 47;
|
|
5901
|
-
_context3.t0 = _context3["catch"](4);
|
|
5902
|
-
message = isAxiosError$1(_context3.t0) ? getAxiosErrorMessage(_context3.t0) : _context3.t0.message;
|
|
5903
|
-
category = isAxiosAuthError(_context3.t0) ? WorkspaceListErrorCategory.AUTH : WorkspaceListErrorCategory.GENERIC;
|
|
5904
|
-
listenerApi.dispatch(workspaceListActions.onErrorWorkspacePresetAction({
|
|
5905
|
-
error: {
|
|
5906
|
-
type: WorkspaceListErrorType.VERBATIM_ERROR,
|
|
5907
|
-
category: category,
|
|
5908
|
-
message: message
|
|
5909
|
-
}
|
|
5910
|
-
}));
|
|
5911
|
-
case 52:
|
|
6700
|
+
case 5:
|
|
5912
6701
|
case "end":
|
|
5913
|
-
return
|
|
6702
|
+
return _context6.stop();
|
|
5914
6703
|
}
|
|
5915
|
-
},
|
|
6704
|
+
}, _callee6);
|
|
5916
6705
|
}));
|
|
5917
|
-
function effect(
|
|
5918
|
-
return
|
|
6706
|
+
function effect(_x1, _x10) {
|
|
6707
|
+
return _effect4.apply(this, arguments);
|
|
5919
6708
|
}
|
|
5920
6709
|
return effect;
|
|
5921
6710
|
}()
|
|
@@ -6118,12 +6907,12 @@ var WorkspaceModuleProvider = function WorkspaceModuleProvider(_ref) {
|
|
|
6118
6907
|
});
|
|
6119
6908
|
};
|
|
6120
6909
|
|
|
6121
|
-
var _excluded$
|
|
6910
|
+
var _excluded$4 = ["component", "payload"];
|
|
6122
6911
|
// takes a component and connects module methods with workspace store
|
|
6123
6912
|
var ComponentsLookUpWrapper = function ComponentsLookUpWrapper(_ref) {
|
|
6124
6913
|
var component = _ref.component,
|
|
6125
6914
|
payload = _ref.payload,
|
|
6126
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
6915
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
6127
6916
|
var RenderComponent = component;
|
|
6128
6917
|
var dispatch = useDispatch();
|
|
6129
6918
|
var viewId = payload.id;
|
|
@@ -6300,29 +7089,41 @@ var deleteViewPreset = function deleteViewPreset(viewPresetId, auth) {
|
|
|
6300
7089
|
};
|
|
6301
7090
|
|
|
6302
7091
|
var WORKSPACE_SELECT_LIST_ROW_HEIGHT = 46;
|
|
6303
|
-
var getPresetIcon = function getPresetIcon(preset) {
|
|
6304
|
-
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6313
|
-
|
|
6314
|
-
|
|
6315
|
-
|
|
6316
|
-
|
|
7092
|
+
var getPresetIcon = function getPresetIcon(preset, currentUsername) {
|
|
7093
|
+
if (preset.scope === 'system') {
|
|
7094
|
+
return jsx(WorkspacePresetsSystemIcon, {
|
|
7095
|
+
"data-testid": "systemPresetIcon",
|
|
7096
|
+
sx: {
|
|
7097
|
+
color: 'geowebColors.typographyAndIcons.systemScopeIcon'
|
|
7098
|
+
}
|
|
7099
|
+
});
|
|
7100
|
+
}
|
|
7101
|
+
if (preset.is_shared) {
|
|
7102
|
+
if (preset.username && preset.username === currentUsername) {
|
|
7103
|
+
return jsx(SharedPresetsMyUser, {
|
|
7104
|
+
"data-testid": "sharedByMeIcon",
|
|
7105
|
+
sx: {
|
|
7106
|
+
color: 'geowebColors.typographyAndIcons.userScopeIcon'
|
|
7107
|
+
}
|
|
6317
7108
|
});
|
|
7109
|
+
}
|
|
7110
|
+
return jsx(SharedPresetsOtherUsers, {
|
|
7111
|
+
"data-testid": "sharedByOtherIcon",
|
|
7112
|
+
sx: {
|
|
7113
|
+
color: 'geowebColors.typographyAndIcons.sharedByOthersIcon'
|
|
7114
|
+
}
|
|
7115
|
+
});
|
|
7116
|
+
}
|
|
7117
|
+
if (preset.username && preset.username === currentUsername) {
|
|
7118
|
+
return jsx(WorkspacePresetsMyIcon, {
|
|
7119
|
+
"data-testid": "myPrivatePresetIcon",
|
|
7120
|
+
sx: {
|
|
7121
|
+
color: 'geowebColors.typographyAndIcons.userScopeIcon'
|
|
7122
|
+
}
|
|
7123
|
+
});
|
|
6318
7124
|
}
|
|
7125
|
+
return null;
|
|
6319
7126
|
};
|
|
6320
|
-
var ShareIcon = styled(ListItemIcon)(function () {
|
|
6321
|
-
return {
|
|
6322
|
-
minWidth: '32px !important',
|
|
6323
|
-
paddingTop: '3px'
|
|
6324
|
-
};
|
|
6325
|
-
});
|
|
6326
7127
|
var WorkspaceSelectListRow = function WorkspaceSelectListRow(_ref) {
|
|
6327
7128
|
var workspacePreset = _ref.workspacePreset,
|
|
6328
7129
|
isSelected = _ref.isSelected,
|
|
@@ -6342,15 +7143,6 @@ var WorkspaceSelectListRow = function WorkspaceSelectListRow(_ref) {
|
|
|
6342
7143
|
auth = _useAuthenticationCon.auth;
|
|
6343
7144
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
6344
7145
|
t = _useWorkspaceTranslat.t;
|
|
6345
|
-
var shareIcon = React__default.useMemo(function () {
|
|
6346
|
-
if (workspacePreset.is_shared) {
|
|
6347
|
-
if (workspacePreset.username === (auth == null ? void 0 : auth.username)) {
|
|
6348
|
-
return jsx(SharedPresetsMyUser, {});
|
|
6349
|
-
}
|
|
6350
|
-
return jsx(SharedPresetsOtherUsers, {});
|
|
6351
|
-
}
|
|
6352
|
-
return null;
|
|
6353
|
-
}, [workspacePreset.is_shared, workspacePreset.username, auth == null ? void 0 : auth.username]);
|
|
6354
7146
|
var _onClick = function onClick(action) {
|
|
6355
7147
|
return onClickWorkspacePresetOption(workspacePreset.id, action, workspacePreset);
|
|
6356
7148
|
};
|
|
@@ -6424,9 +7216,7 @@ var WorkspaceSelectListRow = function WorkspaceSelectListRow(_ref) {
|
|
|
6424
7216
|
role: "listitem",
|
|
6425
7217
|
"aria-label": testIdPrefix,
|
|
6426
7218
|
children: [jsx(ListItemIcon, {
|
|
6427
|
-
children: getPresetIcon(workspacePreset)
|
|
6428
|
-
}), shareIcon && jsx(ShareIcon, {
|
|
6429
|
-
children: shareIcon
|
|
7219
|
+
children: getPresetIcon(workspacePreset, auth == null ? void 0 : auth.username)
|
|
6430
7220
|
}), jsx(CustomTooltip, {
|
|
6431
7221
|
title: workspacePreset.title,
|
|
6432
7222
|
children: jsx(ListItemText, {
|
|
@@ -6880,6 +7670,10 @@ var ViewPresetMenu = function ViewPresetMenu(_ref) {
|
|
|
6880
7670
|
* */
|
|
6881
7671
|
var config = sessionStorageProvider.getConfig();
|
|
6882
7672
|
var presetBaseUrl = (config == null ? void 0 : config.GW_PRESET_BACKEND_URL) || '';
|
|
7673
|
+
var labelsConfigUrl = '/assets/workspaceLabelsConfig.json';
|
|
7674
|
+
var getWorkspaceLabelsConfig = function getWorkspaceLabelsConfig() {
|
|
7675
|
+
return fetch(labelsConfigUrl).then(handleResponse);
|
|
7676
|
+
};
|
|
6883
7677
|
var getWorkspace = function getWorkspace(workspaceId, auth) {
|
|
6884
7678
|
return fetch(presetBaseUrl + "/workspacepreset/" + workspaceId, {
|
|
6885
7679
|
headers: getHeaders(auth)
|
|
@@ -6996,6 +7790,22 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect() {
|
|
|
6996
7790
|
toggleSelectFilterChip(id, shouldSelect);
|
|
6997
7791
|
}
|
|
6998
7792
|
};
|
|
7793
|
+
var currentViewsToBE = React.useCallback(function () {
|
|
7794
|
+
var _ws$views$allIds, _ws$views;
|
|
7795
|
+
var ws = currentView;
|
|
7796
|
+
var result = [];
|
|
7797
|
+
((_ws$views$allIds = ws == null || (_ws$views = ws.views) == null ? void 0 : _ws$views.allIds) != null ? _ws$views$allIds : []).forEach(function (id) {
|
|
7798
|
+
var _ws$views$byId$id;
|
|
7799
|
+
var view = (_ws$views$byId$id = ws.views.byId[id]) != null ? _ws$views$byId$id : {};
|
|
7800
|
+
result.push({
|
|
7801
|
+
mosaicNodeId: id,
|
|
7802
|
+
title: typeof view.title === 'string' && view.title.trim() ? view.title : id,
|
|
7803
|
+
componentType: view.componentType,
|
|
7804
|
+
initialProps: view.initialProps
|
|
7805
|
+
});
|
|
7806
|
+
});
|
|
7807
|
+
return result;
|
|
7808
|
+
}, [currentView]);
|
|
6999
7809
|
var onClickWorkspacePresetOption = function onClickWorkspacePresetOption(presetId, workspaceAction) {
|
|
7000
7810
|
// If affectedPreset is the FE defined `New workspace` - use the definition from FE instead of BE
|
|
7001
7811
|
var affectedPreset = presetId === getEmptyMapWorkspace(t).id ? getEmptyMapWorkspace(t) : workspacePresets.find(function (preset) {
|
|
@@ -7004,15 +7814,37 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect() {
|
|
|
7004
7814
|
var presetTitle = affectedPreset == null ? void 0 : affectedPreset.title;
|
|
7005
7815
|
switch (workspaceAction) {
|
|
7006
7816
|
case WorkspacePresetAction.DUPLICATE:
|
|
7817
|
+
{
|
|
7818
|
+
var _currentView$syncGrou;
|
|
7819
|
+
var currentViews = currentViewsToBE();
|
|
7820
|
+
setWorkspaceActionDialogOptions({
|
|
7821
|
+
action: workspaceAction,
|
|
7822
|
+
presetId: presetId,
|
|
7823
|
+
formValues: {
|
|
7824
|
+
title: presetTitle,
|
|
7825
|
+
"abstract": affectedPreset["abstract"],
|
|
7826
|
+
scope: scope,
|
|
7827
|
+
views: currentViews.length ? currentViews : [],
|
|
7828
|
+
mosaicNode: currentView.mosaicNode,
|
|
7829
|
+
viewType: currentView.viewType,
|
|
7830
|
+
syncGroups: (_currentView$syncGrou = currentView.syncGroups) != null ? _currentView$syncGrou : []
|
|
7831
|
+
}
|
|
7832
|
+
});
|
|
7833
|
+
break;
|
|
7834
|
+
}
|
|
7007
7835
|
case WorkspacePresetAction.EDIT:
|
|
7008
7836
|
{
|
|
7837
|
+
var views = currentViewsToBE();
|
|
7009
7838
|
setWorkspaceActionDialogOptions({
|
|
7010
7839
|
action: workspaceAction,
|
|
7011
7840
|
presetId: presetId,
|
|
7012
7841
|
formValues: {
|
|
7013
7842
|
title: presetTitle,
|
|
7014
7843
|
"abstract": affectedPreset["abstract"],
|
|
7015
|
-
|
|
7844
|
+
labels: affectedPreset.labels,
|
|
7845
|
+
mosaicNode: currentView.mosaicNode,
|
|
7846
|
+
scope: scope,
|
|
7847
|
+
views: views
|
|
7016
7848
|
}
|
|
7017
7849
|
});
|
|
7018
7850
|
break;
|
|
@@ -7195,9 +8027,9 @@ var WorkspaceMenu = function WorkspaceMenu(_ref) {
|
|
|
7195
8027
|
},
|
|
7196
8028
|
slotProps: {
|
|
7197
8029
|
backdrop: {
|
|
7198
|
-
style: {
|
|
8030
|
+
style: Object.assign({
|
|
7199
8031
|
top: 40
|
|
7200
|
-
}
|
|
8032
|
+
}, BackdropStyle())
|
|
7201
8033
|
},
|
|
7202
8034
|
root: {
|
|
7203
8035
|
style: {
|
|
@@ -7362,12 +8194,15 @@ var WorkspaceOptions = function WorkspaceOptions(_ref) {
|
|
|
7362
8194
|
handleSave = _ref.handleSave,
|
|
7363
8195
|
handleSaveAs = _ref.handleSaveAs,
|
|
7364
8196
|
handleEdit = _ref.handleEdit,
|
|
8197
|
+
handleEditTitle = _ref.handleEditTitle,
|
|
7365
8198
|
handleDelete = _ref.handleDelete,
|
|
7366
8199
|
handleReset = _ref.handleReset,
|
|
7367
8200
|
_ref$isDisabled = _ref.isDisabled,
|
|
7368
8201
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
7369
8202
|
_ref$isDefaultOpen = _ref.isDefaultOpen,
|
|
7370
|
-
isDefaultOpen = _ref$isDefaultOpen === void 0 ? false : _ref$isDefaultOpen
|
|
8203
|
+
isDefaultOpen = _ref$isDefaultOpen === void 0 ? false : _ref$isDefaultOpen,
|
|
8204
|
+
_ref$showEditTitleOpt = _ref.showEditTitleOption,
|
|
8205
|
+
showEditTitleOption = _ref$showEditTitleOpt === void 0 ? false : _ref$showEditTitleOpt;
|
|
7371
8206
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7372
8207
|
t = _useWorkspaceTranslat.t;
|
|
7373
8208
|
var theme = useTheme();
|
|
@@ -7387,13 +8222,16 @@ var WorkspaceOptions = function WorkspaceOptions(_ref) {
|
|
|
7387
8222
|
}, {
|
|
7388
8223
|
title: t('workspace-edit'),
|
|
7389
8224
|
callback: handleEdit
|
|
7390
|
-
}
|
|
8225
|
+
}].concat(showEditTitleOption ? [{
|
|
8226
|
+
title: t('workspace-edit-title'),
|
|
8227
|
+
callback: handleEditTitle
|
|
8228
|
+
}] : [], [{
|
|
7391
8229
|
title: t('workspace-reset'),
|
|
7392
8230
|
callback: handleReset
|
|
7393
8231
|
}, {
|
|
7394
8232
|
title: t('workspace-delete'),
|
|
7395
8233
|
callback: handleDelete
|
|
7396
|
-
}];
|
|
8234
|
+
}]);
|
|
7397
8235
|
var renderButton = function renderButton() {
|
|
7398
8236
|
return jsxs(CustomIconButton, {
|
|
7399
8237
|
onClick: handleClick,
|
|
@@ -7473,8 +8311,9 @@ var WorkspaceOptions = function WorkspaceOptions(_ref) {
|
|
|
7473
8311
|
});
|
|
7474
8312
|
};
|
|
7475
8313
|
|
|
7476
|
-
var _excluded$
|
|
8314
|
+
var _excluded$3 = ["title", "scope"];
|
|
7477
8315
|
var WorkspaceViewTitleConnectNoMemo = function WorkspaceViewTitleConnectNoMemo(_ref) {
|
|
8316
|
+
var _currentWorkspace$sco, _currentWorkspacePres;
|
|
7478
8317
|
var panelId = _ref.panelId,
|
|
7479
8318
|
isViewPresetDialogOpen = _ref.isViewPresetDialogOpen;
|
|
7480
8319
|
var dispatch = useDispatch();
|
|
@@ -7491,12 +8330,23 @@ var WorkspaceViewTitleConnectNoMemo = function WorkspaceViewTitleConnectNoMemo(_
|
|
|
7491
8330
|
var _ref2 = (_workspaceSelectors$g = getViewById(store, panelId)) != null ? _workspaceSelectors$g : {},
|
|
7492
8331
|
title = _ref2.title,
|
|
7493
8332
|
scope = _ref2.scope,
|
|
7494
|
-
restProps = _objectWithoutPropertiesLoose(_ref2, _excluded$
|
|
8333
|
+
restProps = _objectWithoutPropertiesLoose(_ref2, _excluded$3);
|
|
7495
8334
|
return Object.assign({
|
|
7496
8335
|
title: title,
|
|
7497
8336
|
scope: scope
|
|
7498
8337
|
}, restProps);
|
|
7499
8338
|
}, shallowEqual);
|
|
8339
|
+
// whole workspace (id/title/abstract/scope + views)
|
|
8340
|
+
var currentWorkspace = useSelector(function (store) {
|
|
8341
|
+
return getWorkspaceState(store);
|
|
8342
|
+
});
|
|
8343
|
+
var currentWorkspacePresetDetails = useSelector(function (store) {
|
|
8344
|
+
return currentWorkspace.id ? getWorkspacePresetFromList(store, currentWorkspace.id) : undefined;
|
|
8345
|
+
});
|
|
8346
|
+
var workspaceScope = (_currentWorkspace$sco = currentWorkspace == null ? void 0 : currentWorkspace.scope) != null ? _currentWorkspace$sco : 'user';
|
|
8347
|
+
var thisView = useSelector(function (store) {
|
|
8348
|
+
return getViewById(store, panelId);
|
|
8349
|
+
});
|
|
7500
8350
|
var viewComponentType = useSelector(function (store) {
|
|
7501
8351
|
return getViewComponentType(store, panelId);
|
|
7502
8352
|
});
|
|
@@ -7512,10 +8362,22 @@ var WorkspaceViewTitleConnectNoMemo = function WorkspaceViewTitleConnectNoMemo(_
|
|
|
7512
8362
|
var currentViewPreset = useSelector(function (store) {
|
|
7513
8363
|
return activeViewPresetId ? getViewPresetFromList(store, activeViewPresetId) : undefined;
|
|
7514
8364
|
});
|
|
8365
|
+
var looksLikeUuid = function looksLikeUuid(string) {
|
|
8366
|
+
return !!string && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(string);
|
|
8367
|
+
};
|
|
8368
|
+
var isPresetBacked = !!currentViewPreset || looksLikeUuid(activeViewPresetId) && activeViewPresetId !== panelId || looksLikeUuid(workspaceView == null ? void 0 : workspaceView.id) && (workspaceView == null ? void 0 : workspaceView.id) !== (workspaceView == null ? void 0 : workspaceView.mosaicNodeId);
|
|
8369
|
+
var isPlainWorkspaceView = !isPresetBacked;
|
|
8370
|
+
React.useEffect(function () {
|
|
8371
|
+
if (hasViewPresetChanges) {
|
|
8372
|
+
dispatch(workspaceActions.markWorkspaceChanged());
|
|
8373
|
+
}
|
|
8374
|
+
}, [hasViewPresetChanges, dispatch]);
|
|
7515
8375
|
var presetAbstract = workspaceView == null ? void 0 : workspaceView["abstract"];
|
|
7516
|
-
var isNewActive = activeViewPresetId === '';
|
|
7517
8376
|
var title = workspaceView.title || t('workspace-mappreset-new');
|
|
7518
|
-
var
|
|
8377
|
+
var isNewActive = activeViewPresetId === '';
|
|
8378
|
+
var showChangedInViewTitle = !!hasViewPresetChanges;
|
|
8379
|
+
var isNewForDisplay = isNewActive && !hasViewPresetChanges;
|
|
8380
|
+
var fullTitle = getPresetTitle(title, showChangedInViewTitle, isNewForDisplay, t);
|
|
7519
8381
|
var openViewPresetsDialog = React.useCallback(function (viewPresetDialogOptions) {
|
|
7520
8382
|
dispatch(viewPresetActions.openViewPresetDialog({
|
|
7521
8383
|
viewPresetDialog: viewPresetDialogOptions
|
|
@@ -7575,6 +8437,28 @@ var WorkspaceViewTitleConnectNoMemo = function WorkspaceViewTitleConnectNoMemo(_
|
|
|
7575
8437
|
}
|
|
7576
8438
|
});
|
|
7577
8439
|
}, [activeViewPresetId, constructInitialProps, openViewPresetsDialog, panelId, t, title, presetAbstract]);
|
|
8440
|
+
var handleEditTitle = React.useCallback(function () {
|
|
8441
|
+
var _ws$title, _view$mosaicNodeId, _ref3, _view$title;
|
|
8442
|
+
var ws = currentWorkspace;
|
|
8443
|
+
var view = thisView;
|
|
8444
|
+
if (!ws || !view) {
|
|
8445
|
+
return;
|
|
8446
|
+
}
|
|
8447
|
+
dispatch(workspaceListActions.openWorkspaceActionDialogOptions({
|
|
8448
|
+
action: WorkspacePresetAction.EDIT_TITLE,
|
|
8449
|
+
presetId: ws.id,
|
|
8450
|
+
formValues: {
|
|
8451
|
+
title: (_ws$title = ws.title) != null ? _ws$title : '',
|
|
8452
|
+
mosaicNode: ws.mosaicNode,
|
|
8453
|
+
views: [{
|
|
8454
|
+
mosaicNodeId: (_view$mosaicNodeId = view.mosaicNodeId) != null ? _view$mosaicNodeId : panelId,
|
|
8455
|
+
title: (_ref3 = (_view$title = view.title) != null ? _view$title : view.mosaicNodeId) != null ? _ref3 : panelId,
|
|
8456
|
+
componentType: view.componentType,
|
|
8457
|
+
initialProps: view.initialProps
|
|
8458
|
+
}]
|
|
8459
|
+
}
|
|
8460
|
+
}));
|
|
8461
|
+
}, [currentWorkspace, thisView, panelId, dispatch]);
|
|
7578
8462
|
var onEdit = React.useCallback(function () {
|
|
7579
8463
|
var formTitle = activeViewPresetId ? title : '';
|
|
7580
8464
|
openViewPresetsDialog({
|
|
@@ -7588,21 +8472,44 @@ var WorkspaceViewTitleConnectNoMemo = function WorkspaceViewTitleConnectNoMemo(_
|
|
|
7588
8472
|
"abstract": presetAbstract
|
|
7589
8473
|
}
|
|
7590
8474
|
});
|
|
7591
|
-
}, [activeViewPresetId,
|
|
8475
|
+
}, [activeViewPresetId, title, openViewPresetsDialog, panelId, constructInitialProps, presetAbstract, t]);
|
|
7592
8476
|
var onReset = React.useCallback(function () {
|
|
7593
|
-
|
|
7594
|
-
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
title: title
|
|
8477
|
+
if (isPlainWorkspaceView) {
|
|
8478
|
+
var _ws$title2, _view$mosaicNodeId2, _ref4, _view$title2;
|
|
8479
|
+
var ws = currentWorkspace;
|
|
8480
|
+
var view = thisView;
|
|
8481
|
+
if (!ws || !view) {
|
|
8482
|
+
return;
|
|
7600
8483
|
}
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
8484
|
+
dispatch(workspaceListActions.openWorkspaceActionDialogOptions({
|
|
8485
|
+
action: WorkspacePresetAction.RESET,
|
|
8486
|
+
presetId: ws.id,
|
|
8487
|
+
formValues: {
|
|
8488
|
+
title: (_ws$title2 = ws.title) != null ? _ws$title2 : '',
|
|
8489
|
+
mosaicNode: ws.mosaicNode,
|
|
8490
|
+
views: [{
|
|
8491
|
+
mosaicNodeId: (_view$mosaicNodeId2 = view.mosaicNodeId) != null ? _view$mosaicNodeId2 : panelId,
|
|
8492
|
+
title: (_ref4 = (_view$title2 = view.title) != null ? _view$title2 : view.mosaicNodeId) != null ? _ref4 : panelId,
|
|
8493
|
+
componentType: view.componentType,
|
|
8494
|
+
initialProps: view.initialProps
|
|
8495
|
+
}]
|
|
8496
|
+
}
|
|
8497
|
+
}));
|
|
8498
|
+
} else {
|
|
8499
|
+
openViewPresetsDialog({
|
|
8500
|
+
title: t('workspace-reset-title'),
|
|
8501
|
+
action: PresetAction.RESET,
|
|
8502
|
+
viewPresetId: activeViewPresetId,
|
|
8503
|
+
panelId: panelId,
|
|
8504
|
+
formValues: {
|
|
8505
|
+
title: title
|
|
8506
|
+
}
|
|
8507
|
+
});
|
|
8508
|
+
}
|
|
8509
|
+
}, [isPlainWorkspaceView, currentWorkspace, thisView, panelId, dispatch, openViewPresetsDialog, activeViewPresetId, title, t]);
|
|
8510
|
+
var toggleViewPresetDialog = React.useCallback(function (_ref5) {
|
|
8511
|
+
var panelId = _ref5.panelId,
|
|
8512
|
+
isViewPresetDialogOpen = _ref5.isViewPresetDialogOpen;
|
|
7606
8513
|
dispatch(viewPresetActions.toggleViewPresetListDialog({
|
|
7607
8514
|
panelId: panelId,
|
|
7608
8515
|
isViewPresetListDialogOpen: isViewPresetDialogOpen
|
|
@@ -7616,9 +8523,14 @@ var WorkspaceViewTitleConnectNoMemo = function WorkspaceViewTitleConnectNoMemo(_
|
|
|
7616
8523
|
}, [isViewPresetDialogOpen, panelId, toggleViewPresetDialog]);
|
|
7617
8524
|
renderCounter.count(WorkspaceViewTitleConnectNoMemo.name);
|
|
7618
8525
|
var viewpresetCreator = (currentViewPreset == null ? void 0 : currentViewPreset.username) || '';
|
|
7619
|
-
var
|
|
8526
|
+
var workspaceOwner = (_currentWorkspacePres = currentWorkspacePresetDetails == null ? void 0 : currentWorkspacePresetDetails.username) != null ? _currentWorkspacePres : undefined;
|
|
8527
|
+
var isUserPresetCreator = !isAdmin && !!(auth != null && auth.username) && auth.username === viewpresetCreator;
|
|
8528
|
+
var isWorkspaceOwner = !isAdmin && !!workspaceOwner && (auth == null ? void 0 : auth.username) === workspaceOwner;
|
|
7620
8529
|
var currentViewScope = (currentViewPreset == null ? void 0 : currentViewPreset.scope) || 'system';
|
|
7621
|
-
|
|
8530
|
+
// Regular viewPresets
|
|
8531
|
+
var isEnabled = !isPlainWorkspaceView && isLoggedIn && activeViewPresetId !== '' && (currentViewScope === 'user' && isUserPresetCreator || currentViewScope === 'system' && isAdmin);
|
|
8532
|
+
// Workspace views
|
|
8533
|
+
var canEditPlainView = isPlainWorkspaceView && isLoggedIn && (workspaceScope === 'user' && isWorkspaceOwner || workspaceScope === 'system' && isAdmin);
|
|
7622
8534
|
return (
|
|
7623
8535
|
// Zero-length string assignment prevents showing title as an empty object '[object Object]'.
|
|
7624
8536
|
// in child components. This is a workaround for a limitation in the Tooltip component.
|
|
@@ -7673,7 +8585,7 @@ var WorkspaceViewTitleConnectNoMemo = function WorkspaceViewTitleConnectNoMemo(_
|
|
|
7673
8585
|
textAlign: 'left',
|
|
7674
8586
|
fontSize: '12px',
|
|
7675
8587
|
fontWeight: 500,
|
|
7676
|
-
fontStyle: hasViewPresetChanges
|
|
8588
|
+
fontStyle: hasViewPresetChanges ? 'italic' : undefined,
|
|
7677
8589
|
height: 20,
|
|
7678
8590
|
overflow: 'hidden',
|
|
7679
8591
|
'&&': {
|
|
@@ -7712,10 +8624,12 @@ var WorkspaceViewTitleConnectNoMemo = function WorkspaceViewTitleConnectNoMemo(_
|
|
|
7712
8624
|
}), jsx(WorkspaceOptions, {
|
|
7713
8625
|
handleSave: isEnabled ? onSave : undefined,
|
|
7714
8626
|
handleDelete: isEnabled ? onDelete : undefined,
|
|
7715
|
-
handleSaveAs: isLoggedIn ? onSaveAs : undefined,
|
|
7716
8627
|
handleEdit: isEnabled ? onEdit : undefined,
|
|
8628
|
+
handleSaveAs: isLoggedIn ? onSaveAs : undefined,
|
|
8629
|
+
handleEditTitle: canEditPlainView ? handleEditTitle : undefined,
|
|
7717
8630
|
handleReset: onReset,
|
|
7718
|
-
id: viewPresetOptionId
|
|
8631
|
+
id: viewPresetOptionId,
|
|
8632
|
+
showEditTitleOption: true
|
|
7719
8633
|
})]
|
|
7720
8634
|
}), jsx(Box, {
|
|
7721
8635
|
sx: {
|
|
@@ -8412,10 +9326,13 @@ var WorkspaceViewConnect = function WorkspaceViewConnect(_ref) {
|
|
|
8412
9326
|
};
|
|
8413
9327
|
|
|
8414
9328
|
var WorkspaceOptionsConnect = function WorkspaceOptionsConnect(_ref) {
|
|
9329
|
+
var _currentWorkspacePres;
|
|
8415
9330
|
var title = _ref.title,
|
|
8416
9331
|
workspaceId = _ref.workspaceId;
|
|
8417
9332
|
var dispatch = useDispatch();
|
|
8418
9333
|
var store = useStore();
|
|
9334
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
9335
|
+
t = _useWorkspaceTranslat.t;
|
|
8419
9336
|
var _useAuthenticationCon = useAuthenticationContext(),
|
|
8420
9337
|
currentRole = _useAuthenticationCon.currentRole,
|
|
8421
9338
|
auth = _useAuthenticationCon.auth;
|
|
@@ -8431,14 +9348,14 @@ var WorkspaceOptionsConnect = function WorkspaceOptionsConnect(_ref) {
|
|
|
8431
9348
|
var currentWorkspacePreset = useSelector(function (store) {
|
|
8432
9349
|
return workspaceId ? getWorkspacePresetFromList(store, workspaceId) : undefined;
|
|
8433
9350
|
});
|
|
8434
|
-
var workspaceCreator = (currentWorkspacePreset == null ? void 0 : currentWorkspacePreset.username)
|
|
9351
|
+
var workspaceCreator = (_currentWorkspacePres = currentWorkspacePreset == null ? void 0 : currentWorkspacePreset.username) != null ? _currentWorkspacePres : '';
|
|
8435
9352
|
var viewIds = useSelector(function (store) {
|
|
8436
9353
|
return getViewIds(store);
|
|
8437
9354
|
});
|
|
8438
9355
|
var isNew = !workspaceId;
|
|
8439
9356
|
var isUserPreset = workspaceScope === 'user';
|
|
8440
9357
|
var isUserPresetCreator = (auth == null ? void 0 : auth.username) === workspaceCreator;
|
|
8441
|
-
var setWorkspaceActionDialogOptions =
|
|
9358
|
+
var setWorkspaceActionDialogOptions = React__default.useCallback(function (dialogOptions) {
|
|
8442
9359
|
dispatch(workspaceListActions.openWorkspaceActionDialogOptions(dialogOptions));
|
|
8443
9360
|
}, [dispatch]);
|
|
8444
9361
|
var onDelete = function onDelete() {
|
|
@@ -8454,13 +9371,16 @@ var WorkspaceOptionsConnect = function WorkspaceOptionsConnect(_ref) {
|
|
|
8454
9371
|
if (shouldIncludeViewPresetScope === void 0) {
|
|
8455
9372
|
shouldIncludeViewPresetScope = false;
|
|
8456
9373
|
}
|
|
9374
|
+
var emptyMapPresetTitle = t('workspace-mappreset-new');
|
|
8457
9375
|
var views = workspaceData.views.map(function (view) {
|
|
8458
|
-
var
|
|
8459
|
-
var
|
|
9376
|
+
var _getViewById$scope, _getViewById;
|
|
9377
|
+
var viewScope = (_getViewById$scope = (_getViewById = getViewById(store.getState(), view.mosaicNodeId)) == null ? void 0 : _getViewById.scope) != null ? _getViewById$scope : 'system';
|
|
9378
|
+
var normalizedTitle = !view.title || view.title === emptyMapPresetTitle ? view.mosaicNodeId : view.title;
|
|
8460
9379
|
return Object.assign({}, view, {
|
|
9380
|
+
title: normalizedTitle,
|
|
8461
9381
|
isSelected: false
|
|
8462
9382
|
}, shouldIncludeViewPresetScope && {
|
|
8463
|
-
scope:
|
|
9383
|
+
scope: viewScope
|
|
8464
9384
|
});
|
|
8465
9385
|
});
|
|
8466
9386
|
setWorkspaceActionDialogOptions({
|
|
@@ -8477,7 +9397,14 @@ var WorkspaceOptionsConnect = function WorkspaceOptionsConnect(_ref) {
|
|
|
8477
9397
|
return onSaveAction(WorkspacePresetAction.SAVE_AS, 'user', true);
|
|
8478
9398
|
};
|
|
8479
9399
|
var onSave = function onSave() {
|
|
8480
|
-
|
|
9400
|
+
// Save without opening dialog
|
|
9401
|
+
dispatch(workspaceListActions.submitFormWorkspaceActionDialogOptions({
|
|
9402
|
+
presetAction: WorkspacePresetAction.SAVE,
|
|
9403
|
+
presetId: workspaceId,
|
|
9404
|
+
data: Object.assign({}, workspaceData),
|
|
9405
|
+
emptyMapPresetTitle: t('workspace-mappreset-new'),
|
|
9406
|
+
emptyWorkspacePresetTitle: t('workspace-new')
|
|
9407
|
+
}));
|
|
8481
9408
|
};
|
|
8482
9409
|
var onEdit = function onEdit() {
|
|
8483
9410
|
setWorkspaceActionDialogOptions({
|
|
@@ -8542,12 +9469,12 @@ var WorkspaceOptionsConnect = function WorkspaceOptionsConnect(_ref) {
|
|
|
8542
9469
|
return isUserPreset && isUserPresetCreator ? onEdit : undefined;
|
|
8543
9470
|
};
|
|
8544
9471
|
return jsx(WorkspaceOptions, {
|
|
8545
|
-
|
|
9472
|
+
handleDelete: getOnDelete(),
|
|
9473
|
+
handleEdit: handleEdit(),
|
|
9474
|
+
handleReset: onReset,
|
|
8546
9475
|
handleSave: handleSave(),
|
|
8547
9476
|
handleSaveAs: handleSaveAs(),
|
|
8548
|
-
|
|
8549
|
-
handleDelete: getOnDelete(),
|
|
8550
|
-
handleReset: onReset
|
|
9477
|
+
isDisabled: !viewIds.length || !isLoggedIn
|
|
8551
9478
|
});
|
|
8552
9479
|
};
|
|
8553
9480
|
|
|
@@ -8661,159 +9588,420 @@ var WorkspaceTab = function WorkspaceTab(_ref) {
|
|
|
8661
9588
|
});
|
|
8662
9589
|
};
|
|
8663
9590
|
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
9591
|
+
/* *
|
|
9592
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9593
|
+
* you may not use this file except in compliance with the License.
|
|
9594
|
+
* You may obtain a copy of the License at
|
|
9595
|
+
*
|
|
9596
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9597
|
+
*
|
|
9598
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9599
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9600
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9601
|
+
* See the License for the specific language governing permissions and
|
|
9602
|
+
* limitations under the License.
|
|
9603
|
+
*
|
|
9604
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
9605
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
9606
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
9607
|
+
* */
|
|
9608
|
+
var useWorkspaceLabelsConfig = function useWorkspaceLabelsConfig() {
|
|
9609
|
+
return useQuery({
|
|
9610
|
+
queryKey: ['workspace-labels-config'],
|
|
9611
|
+
queryFn: getWorkspaceLabelsConfig
|
|
9612
|
+
});
|
|
8672
9613
|
};
|
|
8673
|
-
var
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
9614
|
+
var onWorkspaceApiError = function onWorkspaceApiError(dispatch, error, t) {
|
|
9615
|
+
dispatch(workspaceListActions.onErrorWorkspacePresetAction({
|
|
9616
|
+
error: {
|
|
9617
|
+
message: error.message + " " + t('workspace-error-generic'),
|
|
9618
|
+
type: WorkspaceListErrorType.VERBATIM_ERROR,
|
|
9619
|
+
category: error.message === 'Authentication context not found' ? WorkspaceListErrorCategory.AUTH : WorkspaceListErrorCategory.GENERIC
|
|
9620
|
+
}
|
|
9621
|
+
}));
|
|
8681
9622
|
};
|
|
8682
|
-
var
|
|
8683
|
-
var
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
9623
|
+
var useDeleteWorkspacePreset = function useDeleteWorkspacePreset() {
|
|
9624
|
+
var _useAuthenticationCon = useAuthenticationContext(),
|
|
9625
|
+
auth = _useAuthenticationCon.auth;
|
|
9626
|
+
var _useSelector = useSelector(getWorkspaceActionFormValues),
|
|
9627
|
+
title = _useSelector.title;
|
|
9628
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
9629
|
+
t = _useWorkspaceTranslat.t;
|
|
9630
|
+
var dispatch = useDispatch();
|
|
9631
|
+
return useMutation({
|
|
9632
|
+
mutationFn: function mutationFn(_ref) {
|
|
9633
|
+
var id = _ref.id;
|
|
9634
|
+
if (!auth) {
|
|
9635
|
+
throw new Error('Authentication context not found');
|
|
9636
|
+
}
|
|
9637
|
+
return deleteWorkspace(id, auth);
|
|
9638
|
+
},
|
|
9639
|
+
onSuccess: function onSuccess(data, variables) {
|
|
9640
|
+
dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
9641
|
+
workspaceId: variables.id,
|
|
9642
|
+
action: WorkspacePresetAction.DELETE,
|
|
9643
|
+
emptyWorkspacePresetTitle: t('workspace-new'),
|
|
9644
|
+
title: title
|
|
9645
|
+
}));
|
|
9646
|
+
},
|
|
9647
|
+
onError: function onError(error) {
|
|
9648
|
+
onWorkspaceApiError(dispatch, error, t);
|
|
9649
|
+
}
|
|
9650
|
+
});
|
|
9651
|
+
};
|
|
9652
|
+
var useCreateWorkspacePreset = function useCreateWorkspacePreset() {
|
|
9653
|
+
var _useAuthenticationCon2 = useAuthenticationContext(),
|
|
9654
|
+
auth = _useAuthenticationCon2.auth;
|
|
9655
|
+
var _useWorkspaceTranslat2 = useWorkspaceTranslation(),
|
|
9656
|
+
t = _useWorkspaceTranslat2.t;
|
|
9657
|
+
var dispatch = useDispatch();
|
|
9658
|
+
return useMutation({
|
|
9659
|
+
mutationFn: function mutationFn(_ref2) {
|
|
9660
|
+
var data = _ref2.data;
|
|
9661
|
+
if (!auth) {
|
|
9662
|
+
throw new Error('Authentication context not found');
|
|
9663
|
+
}
|
|
9664
|
+
return createWorkspace(data, auth);
|
|
9665
|
+
},
|
|
9666
|
+
onSuccess: function onSuccess(data, variables) {
|
|
9667
|
+
var location = data == null ? void 0 : data.get('location');
|
|
9668
|
+
var newId = getIdFromUrl(location);
|
|
9669
|
+
var scope = variables.data.scope || 'user';
|
|
9670
|
+
dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
9671
|
+
workspaceId: newId,
|
|
9672
|
+
action: variables.action || WorkspacePresetAction.SAVE_AS,
|
|
9673
|
+
title: variables.data.title,
|
|
9674
|
+
scope: scope
|
|
9675
|
+
}));
|
|
8689
9676
|
},
|
|
8690
|
-
|
|
9677
|
+
onError: function onError(error) {
|
|
9678
|
+
onWorkspaceApiError(dispatch, error, t);
|
|
9679
|
+
}
|
|
9680
|
+
});
|
|
9681
|
+
};
|
|
9682
|
+
|
|
9683
|
+
/* *
|
|
9684
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9685
|
+
* you may not use this file except in compliance with the License.
|
|
9686
|
+
* You may obtain a copy of the License at
|
|
9687
|
+
*
|
|
9688
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9689
|
+
*
|
|
9690
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9691
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9692
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9693
|
+
* See the License for the specific language governing permissions and
|
|
9694
|
+
* limitations under the License.
|
|
9695
|
+
*
|
|
9696
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
9697
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
9698
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
9699
|
+
* */
|
|
9700
|
+
var LABELS_CONFIG_DEFAULT = {
|
|
9701
|
+
purpose: ['Aviation', 'Monitor', 'Public', 'Maritime', 'Warning', 'Media', 'Nowcasting (0–12h)'],
|
|
9702
|
+
parameters: ['Pressure', 'Temperature', 'Wind', 'Humidity', 'Water vapour', 'Visibility', 'Geopotential', 'Snow', 'Cloud', 'Waves', 'Index', 'Precipitation'],
|
|
9703
|
+
phenomena: ['Turbulence', 'MTW', 'CAT', 'Icing', 'Freezing rain', 'FlashFlood', 'Wind gust', 'Rain', 'Snow', 'Road ice', 'Lightning strike', 'Drifting snow', 'Wave height + water level', 'Forest fire', 'Polar Low', 'Heat wave', 'Gale warning'],
|
|
9704
|
+
dataType: ['observation', 'forecast', 'archive'],
|
|
9705
|
+
dataSource: ['Meps', 'Arome Arctic', 'Ecmwf', 'Ensemble', 'AIFS', 'BRIS', 'radar', 'satellite', 'synop']
|
|
9706
|
+
};
|
|
9707
|
+
|
|
9708
|
+
var normalize = function normalize(labels) {
|
|
9709
|
+
var _labels$purpose, _labels$parameters, _labels$phenomena, _labels$dataType, _labels$dataSource, _labels$viewType;
|
|
9710
|
+
return {
|
|
9711
|
+
purpose: (_labels$purpose = labels == null ? void 0 : labels.purpose) != null ? _labels$purpose : [],
|
|
9712
|
+
parameters: (_labels$parameters = labels == null ? void 0 : labels.parameters) != null ? _labels$parameters : [],
|
|
9713
|
+
phenomena: (_labels$phenomena = labels == null ? void 0 : labels.phenomena) != null ? _labels$phenomena : [],
|
|
9714
|
+
dataType: (_labels$dataType = labels == null ? void 0 : labels.dataType) != null ? _labels$dataType : [],
|
|
9715
|
+
dataSource: (_labels$dataSource = labels == null ? void 0 : labels.dataSource) != null ? _labels$dataSource : [],
|
|
9716
|
+
viewType: (_labels$viewType = labels == null ? void 0 : labels.viewType) != null ? _labels$viewType : []
|
|
9717
|
+
};
|
|
9718
|
+
};
|
|
9719
|
+
var humanize = function humanize(value) {
|
|
9720
|
+
return value.replace(/[_-]+/g, ' ').replace(/\s+/g, ' ').trim().replace(/\b\w/g, function (match) {
|
|
9721
|
+
return match.toUpperCase();
|
|
8691
9722
|
});
|
|
8692
9723
|
};
|
|
8693
|
-
var
|
|
8694
|
-
var
|
|
8695
|
-
|
|
8696
|
-
viewPreset = _ref2.viewPreset,
|
|
8697
|
-
_ref2$isLoading = _ref2.isLoading,
|
|
8698
|
-
isLoading = _ref2$isLoading === void 0 ? false : _ref2$isLoading,
|
|
8699
|
-
_ref2$isAdmin = _ref2.isAdmin,
|
|
8700
|
-
isAdmin = _ref2$isAdmin === void 0 ? true : _ref2$isAdmin;
|
|
9724
|
+
var WorkspacePresetLabelsPanel = function WorkspacePresetLabelsPanel(_ref) {
|
|
9725
|
+
var labelsConfig = _ref.labelsConfig,
|
|
9726
|
+
onActiveLabelsChange = _ref.onActiveLabelsChange;
|
|
8701
9727
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
8702
9728
|
t = _useWorkspaceTranslat.t;
|
|
8703
9729
|
var _useFormContext = useFormContext(),
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
var
|
|
8711
|
-
|
|
8712
|
-
|
|
8713
|
-
|
|
8714
|
-
|
|
8715
|
-
var
|
|
8716
|
-
|
|
8717
|
-
|
|
8718
|
-
var
|
|
8719
|
-
|
|
8720
|
-
|
|
8721
|
-
|
|
9730
|
+
control = _useFormContext.control,
|
|
9731
|
+
setValue = _useFormContext.setValue;
|
|
9732
|
+
var watchedLabels = useWatch({
|
|
9733
|
+
control: control,
|
|
9734
|
+
name: 'labels'
|
|
9735
|
+
});
|
|
9736
|
+
var watchedViews = useWatch({
|
|
9737
|
+
control: control,
|
|
9738
|
+
name: 'views'
|
|
9739
|
+
});
|
|
9740
|
+
var labels = normalize(watchedLabels);
|
|
9741
|
+
var availableLabels = labelsConfig != null ? labelsConfig : LABELS_CONFIG_DEFAULT;
|
|
9742
|
+
// viewType is actually something else (singleWindow, multiWindow), but users call componentType for viewType
|
|
9743
|
+
var componentTypes = React__default.useMemo(function () {
|
|
9744
|
+
var viewsArray = Array.isArray(watchedViews) ? watchedViews : [];
|
|
9745
|
+
return Array.from(new Set(viewsArray.map(function (view) {
|
|
9746
|
+
return view == null ? void 0 : view.componentType;
|
|
9747
|
+
}).filter(function (value) {
|
|
9748
|
+
return Boolean(value);
|
|
9749
|
+
})));
|
|
9750
|
+
}, [watchedViews]);
|
|
9751
|
+
// keep locked "viewType" labels in sync with componentTypes
|
|
8722
9752
|
React__default.useEffect(function () {
|
|
8723
|
-
|
|
8724
|
-
|
|
9753
|
+
if (!componentTypes.length) {
|
|
9754
|
+
return;
|
|
9755
|
+
}
|
|
9756
|
+
var currentViewType = labels.viewType;
|
|
9757
|
+
var sameLength = currentViewType.length === componentTypes.length;
|
|
9758
|
+
var sameValues = sameLength && currentViewType.every(function (val, idx) {
|
|
9759
|
+
return val === componentTypes[idx];
|
|
9760
|
+
});
|
|
9761
|
+
if (sameValues) {
|
|
9762
|
+
return;
|
|
9763
|
+
}
|
|
9764
|
+
setValue('labels.viewType', componentTypes, {
|
|
9765
|
+
shouldDirty: true
|
|
9766
|
+
});
|
|
9767
|
+
}, [componentTypes, labels.viewType, setValue]);
|
|
9768
|
+
var totalActive = React__default.useMemo(function () {
|
|
9769
|
+
return Object.values(labels).reduce(function (sum, arr) {
|
|
9770
|
+
return sum + arr.length;
|
|
9771
|
+
}, 0);
|
|
9772
|
+
}, [labels]);
|
|
9773
|
+
var activeNonViewType = Math.max(0, totalActive - labels.viewType.length);
|
|
8725
9774
|
React__default.useEffect(function () {
|
|
8726
|
-
|
|
8727
|
-
|
|
8728
|
-
|
|
8729
|
-
|
|
9775
|
+
onActiveLabelsChange == null || onActiveLabelsChange(totalActive);
|
|
9776
|
+
}, [totalActive, onActiveLabelsChange]);
|
|
9777
|
+
var clearAll = function clearAll() {
|
|
9778
|
+
var newLabels = Object.assign({}, labels);
|
|
9779
|
+
Object.keys(availableLabels).forEach(function (key) {
|
|
9780
|
+
if (key !== 'viewType') {
|
|
9781
|
+
newLabels[key] = [];
|
|
9782
|
+
}
|
|
9783
|
+
});
|
|
9784
|
+
setValue('labels', newLabels, {
|
|
9785
|
+
shouldDirty: true
|
|
9786
|
+
});
|
|
9787
|
+
};
|
|
9788
|
+
var toggle = function toggle(key, item, locked) {
|
|
9789
|
+
var _labels$key, _Object$assign;
|
|
9790
|
+
if (locked) {
|
|
9791
|
+
return;
|
|
9792
|
+
}
|
|
9793
|
+
var currentGroup = (_labels$key = labels[key]) != null ? _labels$key : [];
|
|
9794
|
+
var nextGroup = currentGroup.includes(item) ? currentGroup.filter(function (label) {
|
|
9795
|
+
return label !== item;
|
|
9796
|
+
}) : [].concat(currentGroup, [item]);
|
|
9797
|
+
var newLabels = Object.assign({}, labels, (_Object$assign = {}, _Object$assign[key] = nextGroup, _Object$assign));
|
|
9798
|
+
setValue('labels', newLabels, {
|
|
9799
|
+
shouldDirty: true,
|
|
9800
|
+
shouldTouch: true
|
|
9801
|
+
});
|
|
9802
|
+
};
|
|
9803
|
+
var groups = [{
|
|
9804
|
+
key: 'purpose',
|
|
9805
|
+
title: t('workspace-labels-purpose'),
|
|
9806
|
+
items: availableLabels.purpose
|
|
9807
|
+
}, {
|
|
9808
|
+
key: 'parameters',
|
|
9809
|
+
title: t('workspace-labels-parameters'),
|
|
9810
|
+
items: availableLabels.parameters
|
|
9811
|
+
}, {
|
|
9812
|
+
key: 'phenomena',
|
|
9813
|
+
title: t('workspace-labels-phenomena'),
|
|
9814
|
+
items: availableLabels.phenomena
|
|
9815
|
+
}, {
|
|
9816
|
+
key: 'dataType',
|
|
9817
|
+
title: t('workspace-labels-dataType'),
|
|
9818
|
+
items: availableLabels.dataType
|
|
9819
|
+
}, {
|
|
9820
|
+
key: 'dataSource',
|
|
9821
|
+
title: t('workspace-labels-dataSource'),
|
|
9822
|
+
items: availableLabels.dataSource
|
|
9823
|
+
}, {
|
|
9824
|
+
key: 'viewType',
|
|
9825
|
+
title: t('workspace-labels-viewType'),
|
|
9826
|
+
items: componentTypes,
|
|
9827
|
+
locked: true
|
|
9828
|
+
}];
|
|
9829
|
+
var _React$useState = React__default.useState(false),
|
|
9830
|
+
expandAll = _React$useState[0],
|
|
9831
|
+
setExpandAll = _React$useState[1];
|
|
9832
|
+
var _React$useState2 = React__default.useState(0),
|
|
9833
|
+
resetKey = _React$useState2[0],
|
|
9834
|
+
setResetKey = _React$useState2[1];
|
|
9835
|
+
var toggleAll = function toggleAll() {
|
|
9836
|
+
setExpandAll(function (vi) {
|
|
9837
|
+
return !vi;
|
|
9838
|
+
});
|
|
9839
|
+
setResetKey(function (key) {
|
|
9840
|
+
return key + 1;
|
|
9841
|
+
});
|
|
9842
|
+
};
|
|
9843
|
+
var labelFor = function labelFor(group, value) {
|
|
9844
|
+
if (group === 'parameters') {
|
|
9845
|
+
var key = "workspace-labels-parameters-" + value;
|
|
9846
|
+
var translated = t(key);
|
|
9847
|
+
if (translated !== key) {
|
|
9848
|
+
return translated;
|
|
9849
|
+
}
|
|
9850
|
+
return humanize(value);
|
|
8730
9851
|
}
|
|
8731
|
-
|
|
8732
|
-
|
|
8733
|
-
|
|
8734
|
-
|
|
8735
|
-
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
|
|
8741
|
-
|
|
8742
|
-
|
|
8743
|
-
component: "span",
|
|
8744
|
-
sx: {
|
|
8745
|
-
color: 'geowebColors.captions.captionStatus.rgba'
|
|
8746
|
-
},
|
|
8747
|
-
children: " " + viewPreset.mosaicNodeId
|
|
8748
|
-
})]
|
|
8749
|
-
}),
|
|
8750
|
-
onChange: function onChange(_, isChecked) {
|
|
8751
|
-
setValue("views." + index + ".isSelected", isChecked);
|
|
9852
|
+
return humanize(value);
|
|
9853
|
+
};
|
|
9854
|
+
return jsxs(Box, {
|
|
9855
|
+
sx: {
|
|
9856
|
+
py: 1
|
|
9857
|
+
},
|
|
9858
|
+
children: [jsx(Typography, {
|
|
9859
|
+
variant: "subtitle1",
|
|
9860
|
+
sx: {
|
|
9861
|
+
px: 2,
|
|
9862
|
+
mb: 1,
|
|
9863
|
+
mt: 1
|
|
8752
9864
|
},
|
|
8753
|
-
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
|
|
8758
|
-
|
|
8759
|
-
|
|
8760
|
-
|
|
8761
|
-
|
|
8762
|
-
|
|
8763
|
-
|
|
8764
|
-
|
|
9865
|
+
children: t('workspace-presets-form-labels-header')
|
|
9866
|
+
}), jsxs(Box, {
|
|
9867
|
+
sx: {
|
|
9868
|
+
px: 2,
|
|
9869
|
+
display: 'grid',
|
|
9870
|
+
rowGap: 1,
|
|
9871
|
+
mb: 2
|
|
9872
|
+
},
|
|
9873
|
+
children: [jsx(Button, {
|
|
9874
|
+
variant: "contained",
|
|
9875
|
+
size: "small",
|
|
9876
|
+
color: "secondary",
|
|
9877
|
+
onClick: clearAll,
|
|
9878
|
+
disabled: activeNonViewType === 0,
|
|
8765
9879
|
sx: {
|
|
8766
|
-
|
|
9880
|
+
justifySelf: 'start',
|
|
9881
|
+
letterSpacing: 0.2,
|
|
9882
|
+
boxShadow: 'none',
|
|
9883
|
+
textTransform: 'none'
|
|
8767
9884
|
},
|
|
8768
|
-
|
|
8769
|
-
|
|
8770
|
-
|
|
8771
|
-
|
|
8772
|
-
|
|
8773
|
-
|
|
9885
|
+
children: t('workspace-presets-form-labels-clearAll', {
|
|
9886
|
+
count: totalActive
|
|
9887
|
+
})
|
|
9888
|
+
}), jsx(Typography, {
|
|
9889
|
+
variant: "caption",
|
|
9890
|
+
sx: {
|
|
9891
|
+
color: 'text.secondary'
|
|
8774
9892
|
},
|
|
8775
|
-
|
|
8776
|
-
|
|
8777
|
-
|
|
9893
|
+
children: t('workspace-presets-form-labels-info')
|
|
9894
|
+
}), jsx(Button, {
|
|
9895
|
+
variant: "outlined",
|
|
9896
|
+
size: "small",
|
|
9897
|
+
onClick: toggleAll,
|
|
8778
9898
|
sx: {
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
|
|
9899
|
+
justifySelf: 'start',
|
|
9900
|
+
textTransform: 'none',
|
|
9901
|
+
minWidth: 120,
|
|
9902
|
+
maxWidth: 120
|
|
9903
|
+
},
|
|
9904
|
+
endIcon: expandAll ? jsx(ChevronUp, {}) : jsx(ChevronDown, {}),
|
|
9905
|
+
children: expandAll ? t('workspace-presets-form-labels-collapseAll') : t('workspace-presets-form-labels-expandAll')
|
|
8783
9906
|
})]
|
|
8784
|
-
}),
|
|
8785
|
-
|
|
8786
|
-
|
|
8787
|
-
|
|
8788
|
-
}
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
|
|
8792
|
-
|
|
8793
|
-
|
|
8794
|
-
|
|
8795
|
-
|
|
8796
|
-
|
|
8797
|
-
|
|
8798
|
-
|
|
8799
|
-
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
8803
|
-
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
9907
|
+
}), jsx(Stack, {
|
|
9908
|
+
spacing: 1,
|
|
9909
|
+
sx: {
|
|
9910
|
+
px: 1
|
|
9911
|
+
},
|
|
9912
|
+
children: groups.map(function (_ref2) {
|
|
9913
|
+
var key = _ref2.key,
|
|
9914
|
+
title = _ref2.title,
|
|
9915
|
+
items = _ref2.items,
|
|
9916
|
+
locked = _ref2.locked;
|
|
9917
|
+
var safeItems = items != null ? items : [];
|
|
9918
|
+
var active = key === 'viewType' ? componentTypes.length : labels[key].length;
|
|
9919
|
+
return jsx(CustomAccordion, {
|
|
9920
|
+
defaultExpanded: expandAll,
|
|
9921
|
+
"data-testid": "workspace-labels-drawer-" + key,
|
|
9922
|
+
sx: {
|
|
9923
|
+
border: 'none',
|
|
9924
|
+
width: '100%',
|
|
9925
|
+
boxShadow: 'none',
|
|
9926
|
+
'&::before': {
|
|
9927
|
+
display: 'none'
|
|
9928
|
+
},
|
|
9929
|
+
'& .MuiPaper-root, & .MuiAccordion-root': {
|
|
9930
|
+
boxShadow: 'none'
|
|
9931
|
+
},
|
|
9932
|
+
'& .MuiAccordionSummary-content, & .MuiAccordionSummary-content.Mui-expanded': {
|
|
9933
|
+
marginY: 0
|
|
9934
|
+
},
|
|
9935
|
+
'& .MuiAccordionDetails-root': {
|
|
9936
|
+
paddingTop: 0.25,
|
|
9937
|
+
paddingBottom: 0.75
|
|
9938
|
+
},
|
|
9939
|
+
'& .MuiAccordionSummary-root.Mui-expanded': {
|
|
9940
|
+
borderBottom: 'none'
|
|
9941
|
+
}
|
|
9942
|
+
},
|
|
9943
|
+
title: jsxs(Stack, {
|
|
9944
|
+
direction: "row",
|
|
9945
|
+
alignItems: "center",
|
|
9946
|
+
sx: {
|
|
9947
|
+
flexGrow: 1,
|
|
9948
|
+
minWidth: 0
|
|
9949
|
+
},
|
|
9950
|
+
children: [jsxs(Stack, {
|
|
9951
|
+
direction: "row",
|
|
9952
|
+
spacing: 1,
|
|
9953
|
+
alignItems: "center",
|
|
9954
|
+
children: [jsx(Typography, {
|
|
9955
|
+
children: title + " (" + safeItems.length + ")"
|
|
9956
|
+
}), locked && jsx(LockLocked, {
|
|
9957
|
+
fontSize: "small"
|
|
9958
|
+
})]
|
|
9959
|
+
}), active > 0 && jsx(Chip, {
|
|
9960
|
+
size: "small",
|
|
9961
|
+
label: active + " " + t('workspace-label-active'),
|
|
9962
|
+
color: "primary",
|
|
9963
|
+
variant: "outlined",
|
|
9964
|
+
sx: {
|
|
9965
|
+
ml: 'auto',
|
|
9966
|
+
fontWeight: 500,
|
|
9967
|
+
border: 'none',
|
|
9968
|
+
position: 'absolute',
|
|
9969
|
+
right: 35,
|
|
9970
|
+
cursor: 'default',
|
|
9971
|
+
pointerEvents: 'none',
|
|
9972
|
+
'&:hover': {
|
|
9973
|
+
backgroundColor: 'transparent',
|
|
9974
|
+
boxShadow: 'none'
|
|
9975
|
+
}
|
|
9976
|
+
}
|
|
9977
|
+
})]
|
|
9978
|
+
}),
|
|
9979
|
+
children: jsx(Stack, {
|
|
9980
|
+
spacing: 0.2,
|
|
9981
|
+
children: safeItems.map(function (it) {
|
|
9982
|
+
return jsx(FormControlLabel, {
|
|
9983
|
+
disabled: locked,
|
|
9984
|
+
control: jsx(Checkbox, {
|
|
9985
|
+
size: "small",
|
|
9986
|
+
checked: labels[key].includes(it),
|
|
9987
|
+
onChange: function onChange() {
|
|
9988
|
+
return toggle(key, it, locked);
|
|
9989
|
+
}
|
|
9990
|
+
}),
|
|
9991
|
+
label: jsx(Typography, {
|
|
9992
|
+
variant: "body2",
|
|
9993
|
+
children: labelFor(key, it)
|
|
9994
|
+
})
|
|
9995
|
+
}, it);
|
|
9996
|
+
})
|
|
9997
|
+
})
|
|
9998
|
+
}, resetKey + "-" + key + "-" + expandAll);
|
|
9999
|
+
})
|
|
8812
10000
|
})]
|
|
8813
|
-
})
|
|
10001
|
+
});
|
|
8814
10002
|
};
|
|
8815
10003
|
|
|
8816
|
-
var _excluded$
|
|
10004
|
+
var _excluded$2 = ["title", "abstract"];
|
|
8817
10005
|
var ERROR_DUPLICATE_TITLE_BE = 'Preset title already in use, please choose a different title';
|
|
8818
10006
|
var ERROR_LONG_TITLE_BE = 'Preset title cannot exceed 100 characters';
|
|
8819
10007
|
var validateTitle$1 = function validateTitle(value) {
|
|
@@ -8835,7 +10023,14 @@ var WorkspacePresetsForm = function WorkspacePresetsForm(_ref) {
|
|
|
8835
10023
|
_ref$isLoading = _ref.isLoading,
|
|
8836
10024
|
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
8837
10025
|
_ref$hasSavedWorkspac = _ref.hasSavedWorkspace,
|
|
8838
|
-
hasSavedWorkspace = _ref$hasSavedWorkspac === void 0 ? false : _ref$hasSavedWorkspac
|
|
10026
|
+
hasSavedWorkspace = _ref$hasSavedWorkspac === void 0 ? false : _ref$hasSavedWorkspac,
|
|
10027
|
+
_ref$showInlineAction = _ref.showInlineActions,
|
|
10028
|
+
showInlineActions = _ref$showInlineAction === void 0 ? false : _ref$showInlineAction,
|
|
10029
|
+
confirmLabel = _ref.confirmLabel,
|
|
10030
|
+
cancelLabel = _ref.cancelLabel,
|
|
10031
|
+
onClose = _ref.onClose,
|
|
10032
|
+
dialogTitle = _ref.dialogTitle,
|
|
10033
|
+
labelsConfig = _ref.labelsConfig;
|
|
8839
10034
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
8840
10035
|
t = _useWorkspaceTranslat.t;
|
|
8841
10036
|
var _useFormContext = useFormContext(),
|
|
@@ -8844,7 +10039,13 @@ var WorkspacePresetsForm = function WorkspacePresetsForm(_ref) {
|
|
|
8844
10039
|
var _emptyWorkspacePreset = Object.assign({}, emptyWorkspacePreset, formValues),
|
|
8845
10040
|
title = _emptyWorkspacePreset.title,
|
|
8846
10041
|
_abstract = _emptyWorkspacePreset["abstract"],
|
|
8847
|
-
otherFormValues = _objectWithoutPropertiesLoose(_emptyWorkspacePreset, _excluded$
|
|
10042
|
+
otherFormValues = _objectWithoutPropertiesLoose(_emptyWorkspacePreset, _excluded$2);
|
|
10043
|
+
var _React$useState = React__default.useState(0),
|
|
10044
|
+
activeLabelsCount = _React$useState[0],
|
|
10045
|
+
setActiveLabelsCount = _React$useState[1];
|
|
10046
|
+
var _formValues$views = formValues.views,
|
|
10047
|
+
views = _formValues$views === void 0 ? [] : _formValues$views;
|
|
10048
|
+
var isViewsOnly = action === WorkspacePresetAction.EDIT_TITLE;
|
|
8848
10049
|
var hiddenFields = Object.keys(otherFormValues).map(function (name) {
|
|
8849
10050
|
return {
|
|
8850
10051
|
name: name,
|
|
@@ -8869,10 +10070,10 @@ var WorkspacePresetsForm = function WorkspacePresetsForm(_ref) {
|
|
|
8869
10070
|
event.preventDefault();
|
|
8870
10071
|
onSubmit();
|
|
8871
10072
|
};
|
|
8872
|
-
var hasFormInput = action === WorkspacePresetAction.DUPLICATE || action === WorkspacePresetAction.SAVE || action === WorkspacePresetAction.SAVE_AS || action === WorkspacePresetAction.EDIT || action === WorkspacePresetAction.SAVE_SYSTEM_PRESET || action === WorkspacePresetAction.SAVE_SYSTEM_PRESET_AS;
|
|
10073
|
+
var hasFormInput = action === WorkspacePresetAction.DUPLICATE || action === WorkspacePresetAction.SAVE || action === WorkspacePresetAction.SAVE_AS || action === WorkspacePresetAction.EDIT || action === WorkspacePresetAction.EDIT_TITLE || action === WorkspacePresetAction.SAVE_SYSTEM_PRESET || action === WorkspacePresetAction.SAVE_SYSTEM_PRESET_AS;
|
|
8873
10074
|
// disable form inputs
|
|
8874
10075
|
var isDisabled = hasSavedWorkspace || isLoading;
|
|
8875
|
-
var
|
|
10076
|
+
var shouldShowLabelsForm = action === WorkspacePresetAction.SAVE_SYSTEM_PRESET_AS || action === WorkspacePresetAction.SAVE_AS || action === WorkspacePresetAction.EDIT;
|
|
8876
10077
|
return jsxs(Fragment, {
|
|
8877
10078
|
children: [error && !shouldShowTitleError && jsx(Box, {
|
|
8878
10079
|
sx: {
|
|
@@ -8881,49 +10082,185 @@ var WorkspacePresetsForm = function WorkspacePresetsForm(_ref) {
|
|
|
8881
10082
|
children: jsx(AlertBanner, {
|
|
8882
10083
|
title: error.type === WorkspaceListErrorType.TRANSLATABLE_ERROR ? t(error.key, error.params) : error.message
|
|
8883
10084
|
})
|
|
8884
|
-
}), hasFormInput &&
|
|
10085
|
+
}), hasFormInput && jsx("form", {
|
|
8885
10086
|
"data-testid": "workspace-preset-form",
|
|
8886
10087
|
onSubmit: onSubmitForm,
|
|
8887
|
-
|
|
10088
|
+
style: {
|
|
10089
|
+
height: '100%'
|
|
10090
|
+
},
|
|
10091
|
+
children: isViewsOnly ? jsxs(Fragment, {
|
|
10092
|
+
children: [jsx(ReactHookFormHiddenInput, {
|
|
10093
|
+
name: "title",
|
|
10094
|
+
defaultValue: title
|
|
10095
|
+
}), jsx(ReactHookFormHiddenInput, {
|
|
10096
|
+
name: "abstract",
|
|
10097
|
+
defaultValue: _abstract
|
|
10098
|
+
}), action === WorkspacePresetAction.EDIT_TITLE && jsx(Box, {
|
|
10099
|
+
sx: {
|
|
10100
|
+
mt: 3
|
|
10101
|
+
},
|
|
10102
|
+
children: function (_ref2, _thisView$mosaicNodeI, _thisView$title) {
|
|
10103
|
+
var thisView = (_ref2 = views && views[0]) != null ? _ref2 : {};
|
|
10104
|
+
var mosaicNodeId = (_thisView$mosaicNodeI = thisView.mosaicNodeId) != null ? _thisView$mosaicNodeI : '';
|
|
10105
|
+
return jsxs(Box, {
|
|
10106
|
+
sx: {
|
|
10107
|
+
mb: 1.5
|
|
10108
|
+
},
|
|
10109
|
+
children: [jsx(ReactHookFormHiddenInput, {
|
|
10110
|
+
name: "views.0.mosaicNodeId",
|
|
10111
|
+
defaultValue: mosaicNodeId
|
|
10112
|
+
}), jsx(ReactHookFormTextField, {
|
|
10113
|
+
name: "views.0.title",
|
|
10114
|
+
defaultValue: (_thisView$title = thisView.title) != null ? _thisView$title : '',
|
|
10115
|
+
label: mosaicNodeId || t('workspace-view-title'),
|
|
10116
|
+
disabled: isDisabled,
|
|
10117
|
+
rules: {
|
|
10118
|
+
required: false
|
|
10119
|
+
}
|
|
10120
|
+
})]
|
|
10121
|
+
});
|
|
10122
|
+
}()
|
|
10123
|
+
}), hiddenFields.map(function (_ref3) {
|
|
10124
|
+
var name = _ref3.name,
|
|
10125
|
+
value = _ref3.value;
|
|
10126
|
+
return jsx(ReactHookFormHiddenInput, {
|
|
10127
|
+
name: name,
|
|
10128
|
+
defaultValue: value,
|
|
10129
|
+
"data-testid": name
|
|
10130
|
+
}, name);
|
|
10131
|
+
})]
|
|
10132
|
+
}) : jsxs(Box, {
|
|
8888
10133
|
sx: {
|
|
8889
|
-
|
|
10134
|
+
display: 'flex',
|
|
10135
|
+
flexDirection: 'column',
|
|
10136
|
+
height: '100%'
|
|
8890
10137
|
},
|
|
8891
|
-
children:
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
10138
|
+
children: [jsxs(Box, {
|
|
10139
|
+
sx: {
|
|
10140
|
+
flex: 1,
|
|
10141
|
+
minHeight: 360,
|
|
10142
|
+
overflow: 'hidden',
|
|
10143
|
+
display: 'grid',
|
|
10144
|
+
gridTemplateColumns: shouldShowLabelsForm ? {
|
|
10145
|
+
xs: '1fr',
|
|
10146
|
+
md: '300px 1fr'
|
|
10147
|
+
} : '1fr',
|
|
10148
|
+
alignItems: 'stretch'
|
|
8899
10149
|
},
|
|
8900
|
-
|
|
8901
|
-
|
|
8902
|
-
|
|
8903
|
-
|
|
8904
|
-
|
|
8905
|
-
|
|
8906
|
-
|
|
8907
|
-
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
10150
|
+
children: [shouldShowLabelsForm && jsx(Box, {
|
|
10151
|
+
sx: {
|
|
10152
|
+
pr: {
|
|
10153
|
+
md: 2
|
|
10154
|
+
},
|
|
10155
|
+
minWidth: 288,
|
|
10156
|
+
height: '100%',
|
|
10157
|
+
overflowY: 'auto',
|
|
10158
|
+
overflowX: 'hidden',
|
|
10159
|
+
bgcolor: 'geowebColors.background.surface',
|
|
10160
|
+
maxWidth: '80%'
|
|
10161
|
+
},
|
|
10162
|
+
children: jsx(WorkspacePresetLabelsPanel, {
|
|
10163
|
+
labelsConfig: labelsConfig,
|
|
10164
|
+
onActiveLabelsChange: setActiveLabelsCount
|
|
10165
|
+
})
|
|
10166
|
+
}), jsxs(Box, {
|
|
10167
|
+
sx: {
|
|
10168
|
+
pl: {
|
|
10169
|
+
md: 2
|
|
10170
|
+
},
|
|
10171
|
+
pr: 2,
|
|
10172
|
+
py: 2,
|
|
10173
|
+
minWidth: 0,
|
|
10174
|
+
overflow: 'hidden',
|
|
10175
|
+
display: 'flex',
|
|
10176
|
+
flexDirection: 'column'
|
|
10177
|
+
},
|
|
10178
|
+
children: [dialogTitle && shouldShowLabelsForm && jsx(Typography, {
|
|
10179
|
+
variant: "subtitle1",
|
|
10180
|
+
sx: {
|
|
10181
|
+
mb: 2,
|
|
10182
|
+
fontWeight: 500
|
|
10183
|
+
},
|
|
10184
|
+
children: dialogTitle
|
|
10185
|
+
}), jsx(Box, {
|
|
10186
|
+
sx: {
|
|
10187
|
+
mb: 2
|
|
10188
|
+
},
|
|
10189
|
+
children: jsx(ReactHookFormTextField, {
|
|
10190
|
+
fullWidth: true,
|
|
10191
|
+
name: titleField,
|
|
10192
|
+
label: t('workspace-dialog-name'),
|
|
10193
|
+
rules: {
|
|
10194
|
+
required: true,
|
|
10195
|
+
validate: {
|
|
10196
|
+
validateTitle: validateTitle$1
|
|
10197
|
+
}
|
|
10198
|
+
},
|
|
10199
|
+
disabled: isDisabled,
|
|
10200
|
+
defaultValue: title,
|
|
10201
|
+
error: shouldShowTitleError
|
|
10202
|
+
})
|
|
10203
|
+
}), jsx(Box, {
|
|
10204
|
+
sx: {
|
|
10205
|
+
mb: 2
|
|
10206
|
+
},
|
|
10207
|
+
children: jsx(ReactHookFormTextField, {
|
|
10208
|
+
fullWidth: true,
|
|
10209
|
+
name: "abstract",
|
|
10210
|
+
label: t('workspace-dialog-abstract'),
|
|
10211
|
+
rules: {
|
|
10212
|
+
required: false
|
|
10213
|
+
},
|
|
10214
|
+
multiline: true,
|
|
10215
|
+
rows: 3,
|
|
10216
|
+
disabled: isDisabled,
|
|
10217
|
+
defaultValue: _abstract
|
|
10218
|
+
})
|
|
10219
|
+
}), shouldShowLabelsForm && jsx(Box, {
|
|
10220
|
+
sx: {
|
|
10221
|
+
mb: 2
|
|
10222
|
+
},
|
|
10223
|
+
children: jsx(Chip, {
|
|
10224
|
+
variant: "outlined",
|
|
10225
|
+
size: "medium",
|
|
10226
|
+
color: "primary",
|
|
10227
|
+
label: t('workspace-presets-form-active-labels', {
|
|
10228
|
+
count: activeLabelsCount
|
|
10229
|
+
}),
|
|
10230
|
+
sx: {
|
|
10231
|
+
cursor: 'default',
|
|
10232
|
+
pointerEvents: 'none',
|
|
10233
|
+
'&:hover': {
|
|
10234
|
+
backgroundColor: 'transparent',
|
|
10235
|
+
boxShadow: 'none'
|
|
10236
|
+
}
|
|
10237
|
+
}
|
|
10238
|
+
})
|
|
10239
|
+
}), showInlineActions && jsx(Box, {
|
|
10240
|
+
sx: {
|
|
10241
|
+
mt: 'auto',
|
|
10242
|
+
display: 'flex',
|
|
10243
|
+
justifyContent: 'flex-end'
|
|
10244
|
+
},
|
|
10245
|
+
children: jsx(ConfirmationButtons, {
|
|
10246
|
+
onClose: onClose,
|
|
10247
|
+
cancelLabel: cancelLabel != null ? cancelLabel : '',
|
|
10248
|
+
isLoading: isLoading,
|
|
10249
|
+
onSubmit: onSubmit,
|
|
10250
|
+
confirmLabel: confirmLabel != null ? confirmLabel : ''
|
|
10251
|
+
})
|
|
10252
|
+
})]
|
|
10253
|
+
})]
|
|
10254
|
+
}), hiddenFields.map(function (_ref4) {
|
|
10255
|
+
var name = _ref4.name,
|
|
10256
|
+
value = _ref4.value;
|
|
10257
|
+
return jsx(ReactHookFormHiddenInput, {
|
|
10258
|
+
name: name,
|
|
10259
|
+
defaultValue: value,
|
|
10260
|
+
"data-testid": name
|
|
10261
|
+
}, name);
|
|
10262
|
+
})]
|
|
10263
|
+
})
|
|
8927
10264
|
}), (action === WorkspacePresetAction.DELETE || action === WorkspacePresetAction.DELETE_SYSTEM_PRESET) && jsxs(Fragment, {
|
|
8928
10265
|
children: [jsxs(Typography, {
|
|
8929
10266
|
variant: "body1",
|
|
@@ -8940,8 +10277,8 @@ var WorkspacePresetsForm = function WorkspacePresetsForm(_ref) {
|
|
|
8940
10277
|
TITLE: title
|
|
8941
10278
|
})
|
|
8942
10279
|
}), jsx(ReactHookFormHiddenInput, {
|
|
8943
|
-
|
|
8944
|
-
|
|
10280
|
+
defaultValue: title,
|
|
10281
|
+
name: "title"
|
|
8945
10282
|
}, "title")]
|
|
8946
10283
|
}), action === WorkspacePresetAction.RESET && jsxs(Box, {
|
|
8947
10284
|
children: [jsxs(Typography, {
|
|
@@ -8954,14 +10291,13 @@ var WorkspacePresetsForm = function WorkspacePresetsForm(_ref) {
|
|
|
8954
10291
|
}
|
|
8955
10292
|
}), formValues.scope === 'system' ? t('workspace-dialog-confirm-reset-message') : t('workspace-dialog-confirm-reset-personal-message')]
|
|
8956
10293
|
}), jsx(ReactHookFormHiddenInput, {
|
|
8957
|
-
|
|
8958
|
-
|
|
10294
|
+
defaultValue: title,
|
|
10295
|
+
name: "title"
|
|
8959
10296
|
}, "title")]
|
|
8960
10297
|
})]
|
|
8961
10298
|
});
|
|
8962
10299
|
};
|
|
8963
10300
|
|
|
8964
|
-
var _excluded$2 = ["title", "abstract"];
|
|
8965
10301
|
var WorkspacePresetsFormDialog = function WorkspacePresetsFormDialog(_ref) {
|
|
8966
10302
|
var isOpen = _ref.isOpen,
|
|
8967
10303
|
action = _ref.action,
|
|
@@ -8973,7 +10309,8 @@ var WorkspacePresetsFormDialog = function WorkspacePresetsFormDialog(_ref) {
|
|
|
8973
10309
|
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
8974
10310
|
error = _ref.error,
|
|
8975
10311
|
_ref$isWorkspaceSaved = _ref.isWorkspaceSaved,
|
|
8976
|
-
isWorkspaceSaved = _ref$isWorkspaceSaved === void 0 ? false : _ref$isWorkspaceSaved
|
|
10312
|
+
isWorkspaceSaved = _ref$isWorkspaceSaved === void 0 ? false : _ref$isWorkspaceSaved,
|
|
10313
|
+
labelsConfig = _ref.labelsConfig;
|
|
8977
10314
|
var _useFormContext = useFormContext(),
|
|
8978
10315
|
handleFormSubmit = _useFormContext.handleSubmit,
|
|
8979
10316
|
reset = _useFormContext.reset;
|
|
@@ -9020,6 +10357,10 @@ var WorkspacePresetsFormDialog = function WorkspacePresetsFormDialog(_ref) {
|
|
|
9020
10357
|
{
|
|
9021
10358
|
return t('workspace-edit');
|
|
9022
10359
|
}
|
|
10360
|
+
case WorkspacePresetAction.EDIT_TITLE:
|
|
10361
|
+
{
|
|
10362
|
+
return t('workspace-edit-title');
|
|
10363
|
+
}
|
|
9023
10364
|
case WorkspacePresetAction.SAVE:
|
|
9024
10365
|
{
|
|
9025
10366
|
return t('workspace-admin-save-user-workspace');
|
|
@@ -9049,15 +10390,42 @@ var WorkspacePresetsFormDialog = function WorkspacePresetsFormDialog(_ref) {
|
|
|
9049
10390
|
while (1) switch (_context.prev = _context.next) {
|
|
9050
10391
|
case 0:
|
|
9051
10392
|
_context.next = 2;
|
|
9052
|
-
return handleFormSubmit(function (
|
|
9053
|
-
var
|
|
9054
|
-
|
|
9055
|
-
|
|
9056
|
-
|
|
9057
|
-
|
|
9058
|
-
|
|
9059
|
-
|
|
9060
|
-
|
|
10393
|
+
return handleFormSubmit(function (rawValues) {
|
|
10394
|
+
var _base$views;
|
|
10395
|
+
// rawValues can be WorkspacePresetForBE OR WorkspaceFormValues
|
|
10396
|
+
var title = rawValues.title,
|
|
10397
|
+
_abstract = rawValues["abstract"],
|
|
10398
|
+
viewEdits = rawValues.views;
|
|
10399
|
+
// Start from the full BE shape already in the form (it contains the real views array)
|
|
10400
|
+
var base = rawValues;
|
|
10401
|
+
// Normalize workspace title/abstract
|
|
10402
|
+
var trimmedWorkspaceTitle = typeof title === 'string' ? title.trim() : base.title;
|
|
10403
|
+
var trimmedWorkspaceAbstract = typeof _abstract === 'string' ? _abstract.trim() : base["abstract"];
|
|
10404
|
+
// Build a map of mosaicNodeId -> trimmed new title (only if present)
|
|
10405
|
+
var editedTitles = new Map();
|
|
10406
|
+
(Array.isArray(viewEdits) ? viewEdits : []).forEach(function (ve) {
|
|
10407
|
+
if (ve != null && ve.mosaicNodeId && typeof ve.title === 'string') {
|
|
10408
|
+
editedTitles.set(ve.mosaicNodeId, ve.title.trim());
|
|
10409
|
+
}
|
|
10410
|
+
});
|
|
10411
|
+
// Merge titles into the outgoing BE views
|
|
10412
|
+
var mergedViews = ((_base$views = base.views) != null ? _base$views : []).map(function (view, idx) {
|
|
10413
|
+
var byKey = editedTitles.get(view.mosaicNodeId);
|
|
10414
|
+
if (byKey !== undefined) {
|
|
10415
|
+
return Object.assign({}, view, {
|
|
10416
|
+
title: byKey
|
|
10417
|
+
});
|
|
10418
|
+
}
|
|
10419
|
+
// (Optional) index fallback if mosaicNodeId wasn’t provided in the form
|
|
10420
|
+
var fallbackTitle = Array.isArray(viewEdits) && viewEdits[idx] && typeof viewEdits[idx].title === 'string' ? viewEdits[idx].title.trim() : undefined;
|
|
10421
|
+
return fallbackTitle !== undefined ? Object.assign({}, view, {
|
|
10422
|
+
title: fallbackTitle
|
|
10423
|
+
}) : view;
|
|
10424
|
+
});
|
|
10425
|
+
var parsedFormValues = Object.assign({}, base, {
|
|
10426
|
+
title: trimmedWorkspaceTitle,
|
|
10427
|
+
"abstract": trimmedWorkspaceAbstract,
|
|
10428
|
+
views: mergedViews
|
|
9061
10429
|
});
|
|
9062
10430
|
onFormSubmit(action, presetId, parsedFormValues);
|
|
9063
10431
|
})();
|
|
@@ -9072,33 +10440,56 @@ var WorkspacePresetsFormDialog = function WorkspacePresetsFormDialog(_ref) {
|
|
|
9072
10440
|
};
|
|
9073
10441
|
}();
|
|
9074
10442
|
var cancelLabel = t('workspace-cancel');
|
|
10443
|
+
var withLabelsPanel = action === WorkspacePresetAction.SAVE_AS || action === WorkspacePresetAction.SAVE_SYSTEM_PRESET_AS || action === WorkspacePresetAction.EDIT;
|
|
10444
|
+
var actionsNode = withLabelsPanel ? null : jsx(ConfirmationButtons, {
|
|
10445
|
+
onClose: onClose,
|
|
10446
|
+
cancelLabel: cancelLabel,
|
|
10447
|
+
isLoading: isLoading,
|
|
10448
|
+
onSubmit: onSubmit,
|
|
10449
|
+
confirmLabel: confirmLabel
|
|
10450
|
+
});
|
|
10451
|
+
var dialogTitle = getDialogTitle(action);
|
|
9075
10452
|
return jsx(CustomDialog, {
|
|
9076
10453
|
"data-testid": "workspace-preset-dialog",
|
|
9077
|
-
title: getDialogTitle(action),
|
|
10454
|
+
title: withLabelsPanel ? undefined : getDialogTitle(action),
|
|
9078
10455
|
open: isOpen,
|
|
9079
10456
|
description: "",
|
|
9080
10457
|
onClose: onClose,
|
|
9081
10458
|
isResizable: true,
|
|
9082
10459
|
resizableDefaultSize: {
|
|
9083
|
-
width: 500,
|
|
9084
|
-
height: 'auto'
|
|
10460
|
+
width: withLabelsPanel ? 700 : 500,
|
|
10461
|
+
height: withLabelsPanel ? 650 : 'auto'
|
|
9085
10462
|
},
|
|
9086
|
-
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
|
|
10463
|
+
minWidth: withLabelsPanel ? 635 : undefined,
|
|
10464
|
+
sx: withLabelsPanel ? {
|
|
10465
|
+
'& [data-testid="dialog-action-header"]': {
|
|
10466
|
+
display: 'none'
|
|
10467
|
+
},
|
|
10468
|
+
'& .MuiDialogContent-root': {
|
|
10469
|
+
padding: 0,
|
|
10470
|
+
display: 'flex',
|
|
10471
|
+
flexDirection: 'column',
|
|
10472
|
+
height: '100%',
|
|
10473
|
+
overflow: 'hidden'
|
|
10474
|
+
}
|
|
10475
|
+
} : undefined,
|
|
10476
|
+
actions: actionsNode,
|
|
10477
|
+
headerActions: withLabelsPanel ? [] : undefined,
|
|
9093
10478
|
children: jsx(WorkspacePresetsForm, {
|
|
9094
10479
|
formValues: formValues,
|
|
9095
10480
|
error: error,
|
|
9096
10481
|
onSubmit: onSubmit,
|
|
9097
10482
|
action: action,
|
|
9098
10483
|
isLoading: isLoading,
|
|
9099
|
-
hasSavedWorkspace: isWorkspaceSaved
|
|
10484
|
+
hasSavedWorkspace: isWorkspaceSaved,
|
|
10485
|
+
showInlineActions: withLabelsPanel,
|
|
10486
|
+
confirmLabel: confirmLabel,
|
|
10487
|
+
cancelLabel: cancelLabel,
|
|
10488
|
+
onClose: onClose,
|
|
10489
|
+
dialogTitle: dialogTitle,
|
|
10490
|
+
labelsConfig: labelsConfig
|
|
9100
10491
|
})
|
|
9101
|
-
});
|
|
10492
|
+
}, withLabelsPanel ? 'wide' : 'narrow');
|
|
9102
10493
|
};
|
|
9103
10494
|
var WorkspacePresetsFormDialogWrapper = function WorkspacePresetsFormDialogWrapper(_ref3) {
|
|
9104
10495
|
var props = Object.assign({}, (_objectDestructuringEmpty(_ref3), _ref3));
|
|
@@ -9110,93 +10501,8 @@ var WorkspacePresetsFormDialogWrapper = function WorkspacePresetsFormDialogWrapp
|
|
|
9110
10501
|
});
|
|
9111
10502
|
};
|
|
9112
10503
|
|
|
9113
|
-
/* *
|
|
9114
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9115
|
-
* you may not use this file except in compliance with the License.
|
|
9116
|
-
* You may obtain a copy of the License at
|
|
9117
|
-
*
|
|
9118
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9119
|
-
*
|
|
9120
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
9121
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9122
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9123
|
-
* See the License for the specific language governing permissions and
|
|
9124
|
-
* limitations under the License.
|
|
9125
|
-
*
|
|
9126
|
-
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
9127
|
-
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
9128
|
-
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
9129
|
-
* */
|
|
9130
|
-
var onWorkspaceApiError = function onWorkspaceApiError(dispatch, error, t) {
|
|
9131
|
-
dispatch(workspaceListActions.onErrorWorkspacePresetAction({
|
|
9132
|
-
error: {
|
|
9133
|
-
message: error.message + " " + t('workspace-error-generic'),
|
|
9134
|
-
type: WorkspaceListErrorType.VERBATIM_ERROR,
|
|
9135
|
-
category: error.message === 'Authentication context not found' ? WorkspaceListErrorCategory.AUTH : WorkspaceListErrorCategory.GENERIC
|
|
9136
|
-
}
|
|
9137
|
-
}));
|
|
9138
|
-
};
|
|
9139
|
-
var useDeleteWorkspacePreset = function useDeleteWorkspacePreset() {
|
|
9140
|
-
var _useAuthenticationCon = useAuthenticationContext(),
|
|
9141
|
-
auth = _useAuthenticationCon.auth;
|
|
9142
|
-
var _useSelector = useSelector(getWorkspaceActionFormValues),
|
|
9143
|
-
title = _useSelector.title;
|
|
9144
|
-
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
9145
|
-
t = _useWorkspaceTranslat.t;
|
|
9146
|
-
var dispatch = useDispatch();
|
|
9147
|
-
return useMutation({
|
|
9148
|
-
mutationFn: function mutationFn(_ref) {
|
|
9149
|
-
var id = _ref.id;
|
|
9150
|
-
if (!auth) {
|
|
9151
|
-
throw new Error('Authentication context not found');
|
|
9152
|
-
}
|
|
9153
|
-
return deleteWorkspace(id, auth);
|
|
9154
|
-
},
|
|
9155
|
-
onSuccess: function onSuccess(data, variables) {
|
|
9156
|
-
dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
9157
|
-
workspaceId: variables.id,
|
|
9158
|
-
action: WorkspacePresetAction.DELETE,
|
|
9159
|
-
emptyWorkspacePresetTitle: t('workspace-new'),
|
|
9160
|
-
title: title
|
|
9161
|
-
}));
|
|
9162
|
-
},
|
|
9163
|
-
onError: function onError(error) {
|
|
9164
|
-
onWorkspaceApiError(dispatch, error, t);
|
|
9165
|
-
}
|
|
9166
|
-
});
|
|
9167
|
-
};
|
|
9168
|
-
var useCreateWorkspacePreset = function useCreateWorkspacePreset() {
|
|
9169
|
-
var _useAuthenticationCon2 = useAuthenticationContext(),
|
|
9170
|
-
auth = _useAuthenticationCon2.auth;
|
|
9171
|
-
var _useWorkspaceTranslat2 = useWorkspaceTranslation(),
|
|
9172
|
-
t = _useWorkspaceTranslat2.t;
|
|
9173
|
-
var dispatch = useDispatch();
|
|
9174
|
-
return useMutation({
|
|
9175
|
-
mutationFn: function mutationFn(_ref2) {
|
|
9176
|
-
var data = _ref2.data;
|
|
9177
|
-
if (!auth) {
|
|
9178
|
-
throw new Error('Authentication context not found');
|
|
9179
|
-
}
|
|
9180
|
-
return createWorkspace(data, auth);
|
|
9181
|
-
},
|
|
9182
|
-
onSuccess: function onSuccess(data, variables) {
|
|
9183
|
-
var location = data == null ? void 0 : data.get('location');
|
|
9184
|
-
var newId = getIdFromUrl(location);
|
|
9185
|
-
var scope = variables.data.scope || 'user';
|
|
9186
|
-
dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
9187
|
-
workspaceId: newId,
|
|
9188
|
-
action: variables.action || WorkspacePresetAction.SAVE_AS,
|
|
9189
|
-
title: variables.data.title,
|
|
9190
|
-
scope: scope
|
|
9191
|
-
}));
|
|
9192
|
-
},
|
|
9193
|
-
onError: function onError(error) {
|
|
9194
|
-
onWorkspaceApiError(dispatch, error, t);
|
|
9195
|
-
}
|
|
9196
|
-
});
|
|
9197
|
-
};
|
|
9198
|
-
|
|
9199
10504
|
var WorkspaceTabConnect = function WorkspaceTabConnect(_ref) {
|
|
10505
|
+
var _ref3;
|
|
9200
10506
|
var workspaceId = _ref.workspaceId,
|
|
9201
10507
|
appTitle = _ref.appTitle;
|
|
9202
10508
|
var dispatch = useDispatch();
|
|
@@ -9208,13 +10514,15 @@ var WorkspaceTabConnect = function WorkspaceTabConnect(_ref) {
|
|
|
9208
10514
|
deleteWorkspace = _useDeleteWorkspacePr.mutate;
|
|
9209
10515
|
var _useCreateWorkspacePr = useCreateWorkspacePreset(),
|
|
9210
10516
|
createWorkspace = _useCreateWorkspacePr.mutate;
|
|
10517
|
+
var _useWorkspaceLabelsCo = useWorkspaceLabelsConfig(),
|
|
10518
|
+
labelsConfig = _useWorkspaceLabelsCo.data;
|
|
9211
10519
|
var title = useSelector(function (store) {
|
|
9212
10520
|
return getSelectedWorkspaceTitle(store);
|
|
9213
10521
|
});
|
|
9214
10522
|
var dialogDetails = useSelector(function (store) {
|
|
9215
10523
|
return getWorkspaceActionDialogDetails(store);
|
|
9216
10524
|
});
|
|
9217
|
-
var closeWorkspaceActionDialog =
|
|
10525
|
+
var closeWorkspaceActionDialog = React__default.useCallback(function () {
|
|
9218
10526
|
dispatch(workspaceListActions.closeWorkspaceActionDialogOptions());
|
|
9219
10527
|
}, [dispatch]);
|
|
9220
10528
|
var onSubmitForm = /*#__PURE__*/function () {
|
|
@@ -9230,7 +10538,7 @@ var WorkspaceTabConnect = function WorkspaceTabConnect(_ref) {
|
|
|
9230
10538
|
deleteWorkspace({
|
|
9231
10539
|
id: presetId
|
|
9232
10540
|
});
|
|
9233
|
-
return _context.abrupt("break",
|
|
10541
|
+
return _context.abrupt("break", 17);
|
|
9234
10542
|
case 5:
|
|
9235
10543
|
if (!presetId) {
|
|
9236
10544
|
_context.next = 11;
|
|
@@ -9250,7 +10558,7 @@ var WorkspaceTabConnect = function WorkspaceTabConnect(_ref) {
|
|
|
9250
10558
|
data: Object.assign({}, oldWorkspace, data),
|
|
9251
10559
|
action: presetAction
|
|
9252
10560
|
});
|
|
9253
|
-
return _context.abrupt("break",
|
|
10561
|
+
return _context.abrupt("break", 17);
|
|
9254
10562
|
case 15:
|
|
9255
10563
|
dispatch(workspaceListActions.submitFormWorkspaceActionDialogOptions({
|
|
9256
10564
|
presetAction: presetAction,
|
|
@@ -9259,7 +10567,8 @@ var WorkspaceTabConnect = function WorkspaceTabConnect(_ref) {
|
|
|
9259
10567
|
emptyMapPresetTitle: t('workspace-mappreset-new'),
|
|
9260
10568
|
emptyWorkspacePresetTitle: t('workspace-new')
|
|
9261
10569
|
}));
|
|
9262
|
-
|
|
10570
|
+
return _context.abrupt("break", 17);
|
|
10571
|
+
case 17:
|
|
9263
10572
|
case "end":
|
|
9264
10573
|
return _context.stop();
|
|
9265
10574
|
}
|
|
@@ -9272,25 +10581,26 @@ var WorkspaceTabConnect = function WorkspaceTabConnect(_ref) {
|
|
|
9272
10581
|
var presetId = typeof dialogDetails === 'object' && dialogDetails.presetId;
|
|
9273
10582
|
var action = typeof dialogDetails === 'object' && dialogDetails.action;
|
|
9274
10583
|
var formValues = typeof dialogDetails === 'object' && dialogDetails.formValues;
|
|
9275
|
-
var isFetching = typeof dialogDetails === 'object' && dialogDetails.isFetching
|
|
10584
|
+
var isFetching = (_ref3 = typeof dialogDetails === 'object' && dialogDetails.isFetching) != null ? _ref3 : false;
|
|
9276
10585
|
var error = typeof dialogDetails === 'object' && dialogDetails.error;
|
|
9277
10586
|
var hasSavedWorkspace = typeof dialogDetails === 'object' && dialogDetails.hasSaved;
|
|
9278
10587
|
return jsxs(Fragment, {
|
|
9279
10588
|
children: [jsx(WorkspaceTab, {
|
|
9280
10589
|
activeTab: true,
|
|
10590
|
+
appTitle: appTitle,
|
|
9281
10591
|
title: title,
|
|
9282
|
-
workspaceId: workspaceId
|
|
9283
|
-
appTitle: appTitle
|
|
10592
|
+
workspaceId: workspaceId
|
|
9284
10593
|
}), jsx(WorkspacePresetsFormDialogWrapper, {
|
|
10594
|
+
action: action || undefined,
|
|
10595
|
+
error: error || undefined,
|
|
10596
|
+
formValues: formValues != null ? formValues : undefined,
|
|
10597
|
+
isLoading: isFetching,
|
|
9285
10598
|
isOpen: Boolean(dialogDetails),
|
|
10599
|
+
isWorkspaceSaved: hasSavedWorkspace,
|
|
9286
10600
|
onClose: closeWorkspaceActionDialog,
|
|
9287
|
-
presetId: presetId || undefined,
|
|
9288
|
-
action: action || undefined,
|
|
9289
|
-
formValues: formValues || undefined,
|
|
9290
10601
|
onFormSubmit: onSubmitForm,
|
|
9291
|
-
|
|
9292
|
-
|
|
9293
|
-
isWorkspaceSaved: hasSavedWorkspace
|
|
10602
|
+
presetId: presetId || undefined,
|
|
10603
|
+
labelsConfig: labelsConfig
|
|
9294
10604
|
})]
|
|
9295
10605
|
});
|
|
9296
10606
|
};
|
|
@@ -9546,7 +10856,7 @@ var ViewPresetsFormDialog = function ViewPresetsFormDialog(_ref) {
|
|
|
9546
10856
|
_context.t1 = _context["catch"](3);
|
|
9547
10857
|
setIsLoading(false);
|
|
9548
10858
|
submitError = _context.t1;
|
|
9549
|
-
message = isAxiosError
|
|
10859
|
+
message = isAxiosError(submitError) ? getAxiosErrorMessage(submitError) : submitError.message;
|
|
9550
10860
|
setError(message);
|
|
9551
10861
|
case 39:
|
|
9552
10862
|
case "end":
|
|
@@ -9831,4 +11141,4 @@ var WorkspaceDetail = function WorkspaceDetail(_ref) {
|
|
|
9831
11141
|
});
|
|
9832
11142
|
};
|
|
9833
11143
|
|
|
9834
|
-
export { ComponentsLookUpWrapper, DemoWrapper, PresetAction, ViewPresetErrorComponent, ViewPresetErrorType, WORKSPACE_NAMESPACE, WorkspaceDetail, WorkspaceErrorType, WorkspaceI18nProvider, WorkspaceModuleProvider, WorkspacePresetAction, WorkspaceStoreWrapper, WorkspaceThemeProvider, WorkspaceTopBar, WorkspaceViewConnect, WorkspaceWrapperProviderWithStore, createBalancedMosaicNode, createCustomEmptyMapWorkspace, defaultAuthConfig, getEmptyMapWorkspace, getWorkspaceRouteUrl, selectors$
|
|
11144
|
+
export { ComponentsLookUpWrapper, DemoWrapper, PresetAction, ViewPresetErrorComponent, ViewPresetErrorType, WORKSPACE_NAMESPACE, WorkspaceDetail, WorkspaceErrorType, WorkspaceI18nProvider, WorkspaceModuleProvider, WorkspacePresetAction, WorkspaceStoreWrapper, WorkspaceThemeProvider, WorkspaceTopBar, WorkspaceViewConnect, WorkspaceWrapperProviderWithStore, createBalancedMosaicNode, createCustomEmptyMapWorkspace, defaultAuthConfig, getEmptyMapWorkspace, getWorkspaceRouteUrl, selectors$2 as selectors, viewPresetActions, viewPresetsListReducer, viewPresetsListener, viewPresetsReducer, workspaceActions, workspaceListActions, workspaceListListener, workspaceListReducer, workspaceListener, workspaceMiddlewares, workspaceReducer, workspaceReducersMap, routes as workspaceRoutes, workspaceTranslations };
|