@opengeoweb/workspace 21.2.0 → 21.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/README.md +28 -0
- package/dist/README.md +28 -0
- package/dist/index.esm.js +2020 -1560
- package/dist/src/index.d.ts +1 -0
- package/dist/src/lib/components/DataExplorerTimeseriesConnect/DataExplorerTimeseriesConnect.d.ts +5 -0
- package/dist/src/lib/components/WorkspaceDataExplorerPanelConnect/WorkspaceDataExplorerPanelConnect.d.ts +5 -0
- package/dist/src/lib/store/store.d.ts +2 -1
- package/dist/src/lib/store/viewPresets/reducer.d.ts +3 -0
- package/dist/src/lib/store/viewPresets/types.d.ts +2 -2
- package/dist/src/lib/store/workspace/restoreSyncGroupViews.d.ts +8 -0
- package/package.json +21 -21
package/dist/index.esm.js
CHANGED
|
@@ -1,35 +1,38 @@
|
|
|
1
1
|
import { createSlice, createEntityAdapter, createSelector, createListenerMiddleware, isAnyOf, combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
2
2
|
import { handleResponse, getHeaders, getQueryClient, QueryClientProviderWrapper, useAuthenticationContext as useAuthenticationContext$1, GEOWEB_ROLE_PRESETS_ADMIN as GEOWEB_ROLE_PRESETS_ADMIN$1 } from '@opengeoweb/api';
|
|
3
3
|
import { soundingsActions, SoundingsTypes, soundingsSelectors, soundingsReducer } from '@opengeoweb/soundings';
|
|
4
|
-
import { syncGroupsTypes, FEATURE_GROUP_PREFIX, syncGroupsActions, layerActions, mapActions, uiActions, genericActions, layerTypes, mapEnums, selectorMemoizationOptions, genericSelectors, mapSelectors, syncGroupsSelectors,
|
|
4
|
+
import { syncGroupsTypes, FEATURE_GROUP_PREFIX, syncGroupsActions, layerActions, mapActions, uiActions, genericActions, layerTypes, mapEnums, selectorMemoizationOptions, genericSelectors, mapSelectors, syncGroupsSelectors, calculateSyncGroupFit, setSyncGroupViewFit, getVisibleArea, syncConstants, routerActions, createViewObjectForNewMap, mapListener, serviceListener, layersListener, syncGroupsListener, openlayersListener, uiReducer, loadingIndicatorReducer, syncGroupsReducer, layerReducer, serviceReducer, mapReducer, uiTypes, isWarningsTimelineLinkSourceAllowed, getTakenWarningTimelineIds, linkComponentTypesConstants, constructSyncSourceDisplayName, uiSelectors, loadingIndicatorSelectors, layerSelectors, pickList, pickRecord, pickEntities } from '@opengeoweb/store';
|
|
5
5
|
import { timeseriesTranslations, TIME_SERIES_NAMESPACE, timeSeriesActions, TimeSeriesTypes, timeSeriesSelectors, timeSeriesReducer, getUserAddedEDRServices, normalizeEdrServiceUrl, resolveEdrCollectionTarget, EdrCollectionTargetError } from '@opengeoweb/time-series';
|
|
6
|
-
import { chunk, cloneDeep, isEqual, isString } from 'lodash';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { sessionStorageProvider, SHARED_NAMESPACE, safelyInitI18nForTestsAndStories, sharedTranslations, isAxiosError, getAxiosErrorMessage, isAuthError, isAxiosAuthError, ConfirmationServiceProvider, CustomIconButton, useConfirmationDialog, usePrevious, AlertBanner, CustomAccordion, CustomTooltip, linkifyText, dateUtils, SystemScope, SearchHighlight, ToggleMenu, SearchField, Filter, LastUpdateTime, renderCounter, CustomDialog, ToolContainer, CustomToggleButton, isTargetInteractiveInput, ConfirmationButtons } from '@opengeoweb/shared';
|
|
6
|
+
import { chunk, cloneDeep, compact, isEqual, isString } from 'lodash';
|
|
7
|
+
import { snackbarTypes, snackbarActions, snackbarListener, snackbarReducer, SnackbarWrapperConnect } from '@opengeoweb/snackbar';
|
|
8
|
+
import { crossSectionActions, CrossSectionTypes, crossSectionSelectors, crossSectionReducer } from '@opengeoweb/cross-section';
|
|
10
9
|
import { pluginsActions, getPluginState, pluginsReducer, PluginProvider, PluginDebugProvider, OverlayPluginMenuButton, usePluginCatalog, OverlayPluginWindows } from '@opengeoweb/plugins';
|
|
11
10
|
import { warningsTranslations, WARN_NAMESPACE, warningsFiltersActions, publicWarningsSelectors } from '@opengeoweb/warnings';
|
|
12
|
-
import {
|
|
11
|
+
import { getLeaves, createBalancedTreeFromLeaves, MosaicContext, getAndAssertNodeAtPathExists, MosaicWindow, Mosaic } from 'react-mosaic-component';
|
|
13
12
|
import i18n from 'i18next';
|
|
14
13
|
import { useTranslation, I18nextProvider } from 'react-i18next';
|
|
15
14
|
import { coreTranslations, CORE_NAMESPACE, LoadingIndicatorProgressBar } from '@opengeoweb/core';
|
|
16
|
-
import { dataExplorerTranslations, DATA_EXPLORER_NAMESPACE, DataExplorerConnect } from '@opengeoweb/data-explorer';
|
|
15
|
+
import { dataExplorerTranslations, DATA_EXPLORER_NAMESPACE, DataExplorerConnect, DataExplorerPanelContent } from '@opengeoweb/data-explorer';
|
|
17
16
|
import { formFieldsTranslations, FORM_FIELDS_NAMESPACE, ReactHookFormHiddenInput, ReactHookFormTextField, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
|
|
17
|
+
import { SHARED_NAMESPACE, safelyInitI18nForTestsAndStories, sharedTranslations, sessionStorageProvider, isAxiosError, getAxiosErrorMessage, isAuthError, isAxiosAuthError, ConfirmationServiceProvider, CustomIconButton, useConfirmationDialog, usePrevious, AlertBanner, CustomAccordion, CustomTooltip, linkifyText, dateUtils, SystemScope, SearchHighlight, ToggleMenu, SearchField, Filter, LastUpdateTime, renderCounter, CustomDialog, ToolContainer, CustomToggleButton, isTargetInteractiveInput, ConfirmationButtons } from '@opengeoweb/shared';
|
|
18
18
|
import { webmapReactTranslations, WEBMAP_REACT_NAMESPACE } from '@opengeoweb/webmap-react';
|
|
19
|
+
import { queryOptions, useQueryClient, useQuery, useMutation, useIsMutating } from '@tanstack/react-query';
|
|
19
20
|
import { isAxiosError as isAxiosError$1 } from 'axios';
|
|
20
21
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
21
22
|
import { Provider, useDispatch, useSelector, useStore, shallowEqual } from 'react-redux';
|
|
22
23
|
import { AuthenticationProvider, useAuthenticationContext, GEOWEB_ROLE_PRESETS_ADMIN } from '@opengeoweb/authentication';
|
|
23
24
|
import { ThemeWrapper, lightTheme, Link, LinkOff, SplitHorizontal, SplitVertical, SplitHorizontalWithContent, SplitVerticalWithContent, Expand, UnExpand, ChevronDown, Close, ChevronUp, LockLocked, Star, StarOutline, Info, WorkspacePresetsSystemIcon, WorkspacePresetsPluginIcon, SharedPresetsMyUser, SharedPresetsOtherUsers, WorkspacePresetsMyIcon, BackdropStyle, Options, CloudLoading, CloudIdle, WebAssetOff, Exclamation } from '@opengeoweb/theme';
|
|
24
25
|
import React, { useEffect, useCallback } from 'react';
|
|
25
|
-
import { Menu, Typography, List, ListItem, ListItemButton, ListItemIcon, Checkbox, ListItemText, MenuItem, useTheme, Box, LinearProgress, Button, Stack, FormControlLabel, Chip, Popper, ClickAwayListener, Paper, IconButton, Collapse, Divider, Grid, TextField, ListSubheader, Tabs, Dialog, DialogTitle, DialogActions } from '@mui/material';
|
|
26
|
+
import { Menu, Typography, List, ListItem, ListItemButton, ListItemIcon, Checkbox, ListItemText, MenuItem, useTheme, Box, LinearProgress, Button, Stack, FormControlLabel, Chip, Popper, ClickAwayListener, Paper, IconButton, Collapse, Divider, Grid, TextField, ListSubheader, Tabs, linearProgressClasses, Dialog, DialogTitle, DialogActions } from '@mui/material';
|
|
26
27
|
import 'react-mosaic-component/react-mosaic-component.css';
|
|
27
28
|
import { useFormContext, useWatch, useForm, FormProvider } from 'react-hook-form';
|
|
28
29
|
import { List as List$1 } from 'react-window';
|
|
30
|
+
import { keyframes } from '@mui/material/styles';
|
|
29
31
|
import { v4 } from 'uuid';
|
|
30
32
|
import { http, HttpResponse, delay } from 'msw';
|
|
31
33
|
|
|
32
34
|
var en = {
|
|
35
|
+
"workspace-data-explorer-not-configured": "Data Explorer is not configured.",
|
|
33
36
|
"workspace-favourites": "Favourites",
|
|
34
37
|
"workspace-add-favourite": "Add {{title}} to favourites",
|
|
35
38
|
"workspace-remove-favourite": "Remove {{title}} from favourites",
|
|
@@ -126,6 +129,7 @@ var en = {
|
|
|
126
129
|
"workspace-viewpreset-success-unshare": "View preset \"{{TITLE}}\" has been successfully unshared",
|
|
127
130
|
"workspace-loading-indicator-loading": "Loading",
|
|
128
131
|
"workspace-loading-indicator-idle": "Loaded",
|
|
132
|
+
"workspace-map-views-restore-timeout": "Map views may not match the saved workspace. Reload the workspace to try again.",
|
|
129
133
|
"workspace-open-tab": "Open in new tab",
|
|
130
134
|
"workspace-info-title": "Information",
|
|
131
135
|
"workspace-info-preset-title": "Title:",
|
|
@@ -187,6 +191,7 @@ var en = {
|
|
|
187
191
|
"viewpreset-paste-validation-wrong-preset-type": "The clipboard contains a workspace preset, not a view preset."
|
|
188
192
|
};
|
|
189
193
|
var fi = {
|
|
194
|
+
"workspace-data-explorer-not-configured": "Data Exploreria ei ole määritetty.",
|
|
190
195
|
"workspace-favourites": "Suosikit",
|
|
191
196
|
"workspace-add-favourite": "Lisää {{title}} suosikkeihin",
|
|
192
197
|
"workspace-remove-favourite": "Poista {{title}} suosikeista",
|
|
@@ -347,6 +352,7 @@ var fi = {
|
|
|
347
352
|
"viewpreset-paste-validation-wrong-preset-type": "The clipboard contains a workspace preset, not a view preset."
|
|
348
353
|
};
|
|
349
354
|
var no = {
|
|
355
|
+
"workspace-data-explorer-not-configured": "Data Explorer er ikke konfigurert.",
|
|
350
356
|
"workspace-favourites": "Favoritter",
|
|
351
357
|
"workspace-add-favourite": "Legg til {{title}} i favoritter",
|
|
352
358
|
"workspace-remove-favourite": "Fjern {{title}} fra favoritter",
|
|
@@ -440,6 +446,7 @@ var no = {
|
|
|
440
446
|
"workspace-viewpreset-success-unshare": "Vinduet \"{{TITLE}}\" deles ikke lenger",
|
|
441
447
|
"workspace-loading-indicator-loading": "Laster inn",
|
|
442
448
|
"workspace-loading-indicator-idle": "Lastet inn",
|
|
449
|
+
"workspace-map-views-restore-timeout": "Kartvisningene samsvarer kanskje ikke med den lagrede arbeidsflaten. Last inn arbeidsflaten på nytt.",
|
|
443
450
|
"workspace-open-tab": "Åpne i ny fane",
|
|
444
451
|
"workspace-info-title": "Informasjon",
|
|
445
452
|
"workspace-info-short-description": "Kort beskrivelse",
|
|
@@ -497,6 +504,7 @@ var no = {
|
|
|
497
504
|
"viewpreset-paste-validation-wrong-preset-type": "Utklippstavlen inneholder en Arbeidsflate, ikke en Snarvei."
|
|
498
505
|
};
|
|
499
506
|
var nl = {
|
|
507
|
+
"workspace-data-explorer-not-configured": "Data Explorer is niet geconfigureerd.",
|
|
500
508
|
"workspace-favourites": "Favorieten",
|
|
501
509
|
"workspace-add-favourite": "Voeg {{title}} toe aan favorieten",
|
|
502
510
|
"workspace-remove-favourite": "Verwijder {{title}} uit favorieten",
|
|
@@ -592,6 +600,7 @@ var nl = {
|
|
|
592
600
|
"workspace-viewpreset-success-unshare": "Viewpreset \"{{TITLE}}\" deling is ongedaan gemaakt",
|
|
593
601
|
"workspace-loading-indicator-loading": "Aan het laden",
|
|
594
602
|
"workspace-loading-indicator-idle": "Klaar met laden",
|
|
603
|
+
"workspace-map-views-restore-timeout": "Kaartweergaven komen mogelijk niet overeen met de opgeslagen workspace. Laad de workspace opnieuw.",
|
|
595
604
|
"workspace-open-tab": "Open in nieuw tabblad",
|
|
596
605
|
"workspace-info-title": "Informatie",
|
|
597
606
|
"workspace-info-short-description": "Korte beschrijving",
|
|
@@ -838,6 +847,9 @@ function _setPrototypeOf(t, e) {
|
|
|
838
847
|
return t.__proto__ = e, t;
|
|
839
848
|
}, _setPrototypeOf(t, e);
|
|
840
849
|
}
|
|
850
|
+
function _taggedTemplateLiteralLoose(e, t) {
|
|
851
|
+
return t || (t = e.slice(0)), e.raw = t, e;
|
|
852
|
+
}
|
|
841
853
|
function _wrapNativeSuper(t) {
|
|
842
854
|
var r = "function" == typeof Map ? new Map() : void 0;
|
|
843
855
|
return _wrapNativeSuper = function (t) {
|
|
@@ -861,6 +873,46 @@ function _wrapNativeSuper(t) {
|
|
|
861
873
|
}, _wrapNativeSuper(t);
|
|
862
874
|
}
|
|
863
875
|
|
|
876
|
+
/* *
|
|
877
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
878
|
+
* you may not use this file except in compliance with the License.
|
|
879
|
+
* You may obtain a copy of the License at
|
|
880
|
+
*
|
|
881
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
882
|
+
*
|
|
883
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
884
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
885
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
886
|
+
* See the License for the specific language governing permissions and
|
|
887
|
+
* limitations under the License.
|
|
888
|
+
*
|
|
889
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
890
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
891
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
892
|
+
* */
|
|
893
|
+
var WorkspacePresetAction;
|
|
894
|
+
(function (WorkspacePresetAction) {
|
|
895
|
+
WorkspacePresetAction["DELETE"] = "DELETE";
|
|
896
|
+
WorkspacePresetAction["EDIT"] = "EDIT";
|
|
897
|
+
WorkspacePresetAction["SAVE"] = "SAVE";
|
|
898
|
+
WorkspacePresetAction["SAVE_AS"] = "SAVE_AS";
|
|
899
|
+
WorkspacePresetAction["DUPLICATE"] = "DUPLICATE";
|
|
900
|
+
WorkspacePresetAction["SAVE_SYSTEM_PRESET"] = "SAVE_SYSTEM_PRESET";
|
|
901
|
+
WorkspacePresetAction["SAVE_SYSTEM_PRESET_AS"] = "SAVE_SYSTEM_PRESET_AS";
|
|
902
|
+
WorkspacePresetAction["RESET"] = "RESET";
|
|
903
|
+
WorkspacePresetAction["DELETE_SYSTEM_PRESET"] = "DELETE_SYSTEM_PRESET";
|
|
904
|
+
WorkspacePresetAction["SHARE"] = "SHARE";
|
|
905
|
+
WorkspacePresetAction["OPEN_TAB"] = "OPEN_TAB";
|
|
906
|
+
WorkspacePresetAction["EDIT_TITLE"] = "EDIT_TITLE";
|
|
907
|
+
WorkspacePresetAction["COPY_TO_CLIPBOARD"] = "COPY_TO_CLIPBOARD";
|
|
908
|
+
})(WorkspacePresetAction || (WorkspacePresetAction = {}));
|
|
909
|
+
var WorkspaceErrorType;
|
|
910
|
+
(function (WorkspaceErrorType) {
|
|
911
|
+
WorkspaceErrorType["NOT_FOUND"] = "NOT_FOUND";
|
|
912
|
+
WorkspaceErrorType["GENERIC"] = "GENERIC";
|
|
913
|
+
WorkspaceErrorType["SAVE"] = "SAVE";
|
|
914
|
+
})(WorkspaceErrorType || (WorkspaceErrorType = {}));
|
|
915
|
+
|
|
864
916
|
/* *
|
|
865
917
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
866
918
|
* you may not use this file except in compliance with the License.
|
|
@@ -1001,283 +1053,37 @@ var toViewsArray = function toViewsArray(wsViews) {
|
|
|
1001
1053
|
});
|
|
1002
1054
|
};
|
|
1003
1055
|
|
|
1004
|
-
var
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
title: "Map A"
|
|
1036
|
-
},
|
|
1037
|
-
{
|
|
1038
|
-
mosaicNodeId: "right-map",
|
|
1039
|
-
componentType: "Map",
|
|
1040
|
-
initialProps: {
|
|
1041
|
-
mapPreset: {
|
|
1042
|
-
layers: [
|
|
1043
|
-
],
|
|
1044
|
-
proj: {
|
|
1045
|
-
bbox: {
|
|
1046
|
-
left: -2782987.27,
|
|
1047
|
-
bottom: 3503549.84,
|
|
1048
|
-
right: 5009377.09,
|
|
1049
|
-
top: 11753184.62
|
|
1050
|
-
},
|
|
1051
|
-
srs: "EPSG:3857"
|
|
1052
|
-
},
|
|
1053
|
-
showTimeSlider: false,
|
|
1054
|
-
displayMapPin: false,
|
|
1055
|
-
shouldShowZoomControls: true
|
|
1056
|
-
},
|
|
1057
|
-
syncGroupsIds: [
|
|
1058
|
-
]
|
|
1059
|
-
},
|
|
1060
|
-
title: "Map B"
|
|
1061
|
-
}
|
|
1062
|
-
],
|
|
1063
|
-
syncGroups: [
|
|
1064
|
-
],
|
|
1065
|
-
mosaicNode: {
|
|
1066
|
-
direction: "row",
|
|
1067
|
-
first: "left-map",
|
|
1068
|
-
second: "right-map",
|
|
1069
|
-
splitPercentage: 50
|
|
1070
|
-
}
|
|
1071
|
-
},
|
|
1072
|
-
{
|
|
1073
|
-
id: "timeSeriesWorkspace",
|
|
1074
|
-
title: "Timeseries",
|
|
1075
|
-
scope: "system",
|
|
1076
|
-
abstract: "",
|
|
1077
|
-
viewType: "multiWindow",
|
|
1078
|
-
views: [
|
|
1079
|
-
{
|
|
1080
|
-
mosaicNodeId: "timeseries-map",
|
|
1081
|
-
componentType: "Map",
|
|
1082
|
-
initialProps: {
|
|
1083
|
-
mapPreset: {
|
|
1084
|
-
layers: [
|
|
1085
|
-
],
|
|
1086
|
-
proj: {
|
|
1087
|
-
bbox: {
|
|
1088
|
-
left: -2782987.27,
|
|
1089
|
-
bottom: 3503549.84,
|
|
1090
|
-
right: 5009377.09,
|
|
1091
|
-
top: 11753184.62
|
|
1092
|
-
},
|
|
1093
|
-
srs: "EPSG:3857"
|
|
1094
|
-
},
|
|
1095
|
-
showTimeSlider: true,
|
|
1096
|
-
displayMapPin: true,
|
|
1097
|
-
shouldShowZoomControls: true
|
|
1098
|
-
},
|
|
1099
|
-
syncGroupsIds: [
|
|
1100
|
-
"Area_TimeSeries",
|
|
1101
|
-
"Time_TimeSeries"
|
|
1102
|
-
]
|
|
1103
|
-
},
|
|
1104
|
-
title: "Map"
|
|
1105
|
-
},
|
|
1106
|
-
{
|
|
1107
|
-
mosaicNodeId: "timeseries-panel",
|
|
1108
|
-
componentType: "TimeSeries",
|
|
1109
|
-
initialProps: {
|
|
1110
|
-
plotPreset: {
|
|
1111
|
-
mapId: "timeseries-map",
|
|
1112
|
-
plots: [
|
|
1113
|
-
],
|
|
1114
|
-
parameters: [
|
|
1115
|
-
]
|
|
1116
|
-
},
|
|
1117
|
-
services: [
|
|
1118
|
-
]
|
|
1119
|
-
},
|
|
1120
|
-
title: "Timeseries"
|
|
1121
|
-
}
|
|
1122
|
-
],
|
|
1123
|
-
syncGroups: [
|
|
1124
|
-
{
|
|
1125
|
-
id: "Area_TimeSeries",
|
|
1126
|
-
type: "SYNCGROUPS_TYPE_SETBBOX"
|
|
1127
|
-
},
|
|
1128
|
-
{
|
|
1129
|
-
id: "Time_TimeSeries",
|
|
1130
|
-
type: "SYNCGROUPS_TYPE_SETTIME"
|
|
1131
|
-
}
|
|
1132
|
-
],
|
|
1133
|
-
linking: {
|
|
1134
|
-
"timeseries-panel": [
|
|
1135
|
-
"timeseries-map"
|
|
1136
|
-
]
|
|
1137
|
-
},
|
|
1138
|
-
mosaicNode: {
|
|
1139
|
-
direction: "row",
|
|
1140
|
-
first: "timeseries-map",
|
|
1141
|
-
second: "timeseries-panel",
|
|
1142
|
-
splitPercentage: 50
|
|
1143
|
-
}
|
|
1144
|
-
},
|
|
1145
|
-
{
|
|
1146
|
-
id: "soundingWorkspace",
|
|
1147
|
-
title: "Soundings",
|
|
1148
|
-
scope: "system",
|
|
1149
|
-
abstract: "Vertical profile observations",
|
|
1150
|
-
viewType: "multiWindow",
|
|
1151
|
-
views: [
|
|
1152
|
-
{
|
|
1153
|
-
mosaicNodeId: "sounding-map",
|
|
1154
|
-
componentType: "Map",
|
|
1155
|
-
initialProps: {
|
|
1156
|
-
mapPreset: {
|
|
1157
|
-
layers: [
|
|
1158
|
-
],
|
|
1159
|
-
proj: {
|
|
1160
|
-
bbox: {
|
|
1161
|
-
left: -2782987.27,
|
|
1162
|
-
bottom: 3503549.84,
|
|
1163
|
-
right: 5009377.09,
|
|
1164
|
-
top: 11753184.62
|
|
1165
|
-
},
|
|
1166
|
-
srs: "EPSG:3857"
|
|
1167
|
-
},
|
|
1168
|
-
showTimeSlider: true,
|
|
1169
|
-
displayMapPin: true,
|
|
1170
|
-
shouldShowZoomControls: true
|
|
1171
|
-
},
|
|
1172
|
-
syncGroupsIds: [
|
|
1173
|
-
"Area_Sounding",
|
|
1174
|
-
"Time_Sounding"
|
|
1175
|
-
]
|
|
1176
|
-
},
|
|
1177
|
-
title: "Map"
|
|
1178
|
-
},
|
|
1179
|
-
{
|
|
1180
|
-
mosaicNodeId: "sounding-panel",
|
|
1181
|
-
componentType: "Soundings",
|
|
1182
|
-
initialProps: {
|
|
1183
|
-
selectedSources: {
|
|
1184
|
-
},
|
|
1185
|
-
selectedLocations: {
|
|
1186
|
-
}
|
|
1187
|
-
},
|
|
1188
|
-
title: "Sounding"
|
|
1189
|
-
}
|
|
1190
|
-
],
|
|
1191
|
-
syncGroups: [
|
|
1192
|
-
{
|
|
1193
|
-
id: "Area_Sounding",
|
|
1194
|
-
type: "SYNCGROUPS_TYPE_SETBBOX"
|
|
1195
|
-
},
|
|
1196
|
-
{
|
|
1197
|
-
id: "Time_Sounding",
|
|
1198
|
-
type: "SYNCGROUPS_TYPE_SETTIME"
|
|
1199
|
-
}
|
|
1200
|
-
],
|
|
1201
|
-
linking: {
|
|
1202
|
-
"sounding-panel": [
|
|
1203
|
-
"sounding-map"
|
|
1204
|
-
]
|
|
1205
|
-
},
|
|
1206
|
-
mosaicNode: {
|
|
1207
|
-
direction: "row",
|
|
1208
|
-
first: "sounding-map",
|
|
1209
|
-
second: "sounding-panel",
|
|
1210
|
-
splitPercentage: 50
|
|
1211
|
-
}
|
|
1212
|
-
},
|
|
1213
|
-
{
|
|
1214
|
-
id: "capWarningsWorkspace",
|
|
1215
|
-
title: "Cap warnings",
|
|
1216
|
-
scope: "system",
|
|
1217
|
-
abstract: "",
|
|
1218
|
-
viewType: "multiWindow",
|
|
1219
|
-
views: [
|
|
1220
|
-
{
|
|
1221
|
-
mosaicNodeId: "cap-map",
|
|
1222
|
-
componentType: "CapWarningMap",
|
|
1223
|
-
initialProps: {
|
|
1224
|
-
mapPreset: {
|
|
1225
|
-
layers: [
|
|
1226
|
-
],
|
|
1227
|
-
proj: {
|
|
1228
|
-
bbox: {
|
|
1229
|
-
left: -2782987.27,
|
|
1230
|
-
bottom: 3503549.84,
|
|
1231
|
-
right: 5009377.09,
|
|
1232
|
-
top: 11753184.62
|
|
1233
|
-
},
|
|
1234
|
-
srs: "EPSG:3857"
|
|
1235
|
-
}
|
|
1236
|
-
},
|
|
1237
|
-
geoJson: {
|
|
1238
|
-
type: "FeatureCollection",
|
|
1239
|
-
features: [
|
|
1240
|
-
]
|
|
1241
|
-
}
|
|
1242
|
-
},
|
|
1243
|
-
title: "CAP warnings map"
|
|
1244
|
-
},
|
|
1245
|
-
{
|
|
1246
|
-
mosaicNodeId: "cap-list",
|
|
1247
|
-
componentType: "CapWarningList",
|
|
1248
|
-
initialProps: {
|
|
1249
|
-
mapPreset: {
|
|
1250
|
-
layers: [
|
|
1251
|
-
],
|
|
1252
|
-
proj: {
|
|
1253
|
-
bbox: {
|
|
1254
|
-
left: -2782987.27,
|
|
1255
|
-
bottom: 3503549.84,
|
|
1256
|
-
right: 5009377.09,
|
|
1257
|
-
top: 11753184.62
|
|
1258
|
-
},
|
|
1259
|
-
srs: "EPSG:3857"
|
|
1260
|
-
}
|
|
1261
|
-
},
|
|
1262
|
-
geoJson: {
|
|
1263
|
-
type: "FeatureCollection",
|
|
1264
|
-
features: [
|
|
1265
|
-
]
|
|
1266
|
-
}
|
|
1267
|
-
},
|
|
1268
|
-
title: "CAP warnings list"
|
|
1269
|
-
}
|
|
1270
|
-
],
|
|
1271
|
-
syncGroups: [
|
|
1272
|
-
],
|
|
1273
|
-
mosaicNode: {
|
|
1274
|
-
direction: "row",
|
|
1275
|
-
first: "cap-map",
|
|
1276
|
-
second: "cap-list",
|
|
1277
|
-
splitPercentage: 50
|
|
1278
|
-
}
|
|
1279
|
-
}
|
|
1280
|
-
];
|
|
1056
|
+
var AVIATION_COMPONENT_TYPES = ['AirmetModule', 'SigmetModule'];
|
|
1057
|
+
var CAP_COMPONENT_TYPES = ['CapWarningList', 'CapWarningMap'];
|
|
1058
|
+
// 1) Map-like components
|
|
1059
|
+
var SUPPORTED_COMPONENT_TYPES = ['Map', 'MultiMap', 'ModelRunInterval', 'HarmonieTempAndPrecipPreset', 'TimeSlider'];
|
|
1060
|
+
// 2) TimeSeries components
|
|
1061
|
+
var SUPPORTED_TIMESERIES_COMPONENT_TYPES = ['TimeSeries'];
|
|
1062
|
+
// or keep your old union type if it already exists
|
|
1063
|
+
// 3) Warning list components
|
|
1064
|
+
var WARNING_LIST_COMPONENT_TYPES = ['WarningList', 'MaritimeWarnings', 'WarningsTimeline'];
|
|
1065
|
+
// TODO: expand it and move to a more centralized place
|
|
1066
|
+
var ALL_COMPONENT_TYPES = [].concat(SUPPORTED_COMPONENT_TYPES, SUPPORTED_TIMESERIES_COMPONENT_TYPES, WARNING_LIST_COMPONENT_TYPES, AVIATION_COMPONENT_TYPES, CAP_COMPONENT_TYPES, ['TafModule', 'TrajksModule', 'SpaceweatherModule', 'Plugin', 'Soundings', 'CrossSection', 'DataExplorer']);
|
|
1067
|
+
var ViewPresetErrorComponent;
|
|
1068
|
+
(function (ViewPresetErrorComponent) {
|
|
1069
|
+
ViewPresetErrorComponent["PRESET_DETAIL"] = "PRESET_DETAIL";
|
|
1070
|
+
ViewPresetErrorComponent["PRESET_LIST"] = "PRESET_LIST";
|
|
1071
|
+
})(ViewPresetErrorComponent || (ViewPresetErrorComponent = {}));
|
|
1072
|
+
var ViewPresetErrorType;
|
|
1073
|
+
(function (ViewPresetErrorType) {
|
|
1074
|
+
ViewPresetErrorType["AUTH"] = "AUTH";
|
|
1075
|
+
ViewPresetErrorType["GENERIC"] = "GENERIC";
|
|
1076
|
+
})(ViewPresetErrorType || (ViewPresetErrorType = {}));
|
|
1077
|
+
var PresetAction;
|
|
1078
|
+
(function (PresetAction) {
|
|
1079
|
+
PresetAction["OPEN"] = "Open";
|
|
1080
|
+
PresetAction["DELETE"] = "Delete";
|
|
1081
|
+
PresetAction["SAVE"] = "Save";
|
|
1082
|
+
PresetAction["SAVE_AS"] = "Save as";
|
|
1083
|
+
PresetAction["SHARE"] = "Share";
|
|
1084
|
+
PresetAction["EDIT"] = "Edit";
|
|
1085
|
+
PresetAction["RESET"] = "Reset";
|
|
1086
|
+
})(PresetAction || (PresetAction = {}));
|
|
1281
1087
|
|
|
1282
1088
|
/* *
|
|
1283
1089
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -1292,302 +1098,340 @@ var workspacePresetsFallback = [
|
|
|
1292
1098
|
* See the License for the specific language governing permissions and
|
|
1293
1099
|
* limitations under the License.
|
|
1294
1100
|
*
|
|
1295
|
-
* Copyright
|
|
1296
|
-
* Copyright
|
|
1297
|
-
* Copyright
|
|
1101
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1102
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
1103
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1298
1104
|
* */
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
var
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
};
|
|
1309
|
-
var
|
|
1310
|
-
|
|
1105
|
+
var WorkspaceListErrorCategory;
|
|
1106
|
+
(function (WorkspaceListErrorCategory) {
|
|
1107
|
+
WorkspaceListErrorCategory["AUTH"] = "AUTH";
|
|
1108
|
+
WorkspaceListErrorCategory["GENERIC"] = "GENERIC";
|
|
1109
|
+
})(WorkspaceListErrorCategory || (WorkspaceListErrorCategory = {}));
|
|
1110
|
+
var WorkspaceListErrorType;
|
|
1111
|
+
(function (WorkspaceListErrorType) {
|
|
1112
|
+
WorkspaceListErrorType["TRANSLATABLE_ERROR"] = "TRANSLATABLE_ERROR";
|
|
1113
|
+
WorkspaceListErrorType["VERBATIM_ERROR"] = "VERBATIM_ERROR";
|
|
1114
|
+
})(WorkspaceListErrorType || (WorkspaceListErrorType = {}));
|
|
1115
|
+
var PresetFilterType;
|
|
1116
|
+
(function (PresetFilterType) {
|
|
1117
|
+
PresetFilterType["personal"] = "personal";
|
|
1118
|
+
PresetFilterType["shared"] = "shared";
|
|
1119
|
+
PresetFilterType["system"] = "system";
|
|
1120
|
+
PresetFilterType["plugin"] = "plugin";
|
|
1121
|
+
PresetFilterType["templates"] = "templates";
|
|
1122
|
+
PresetFilterType["favourites"] = "favourites";
|
|
1123
|
+
})(PresetFilterType || (PresetFilterType = {}));
|
|
1124
|
+
|
|
1125
|
+
/* *
|
|
1126
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1127
|
+
* you may not use this file except in compliance with the License.
|
|
1128
|
+
* You may obtain a copy of the License at
|
|
1129
|
+
*
|
|
1130
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1131
|
+
*
|
|
1132
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1133
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1134
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1135
|
+
* See the License for the specific language governing permissions and
|
|
1136
|
+
* limitations under the License.
|
|
1137
|
+
*
|
|
1138
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1139
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
1140
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1141
|
+
* */
|
|
1142
|
+
var WORKSPACE_NAMESPACE = 'workspace';
|
|
1143
|
+
var initWorkspaceTestI18n = function initWorkspaceTestI18n() {
|
|
1144
|
+
safelyInitI18nForTestsAndStories(i18n, WORKSPACE_NAMESPACE, [{
|
|
1145
|
+
ns: WORKSPACE_NAMESPACE,
|
|
1146
|
+
translations: workspaceTranslations
|
|
1147
|
+
}, {
|
|
1148
|
+
ns: SHARED_NAMESPACE,
|
|
1149
|
+
translations: sharedTranslations
|
|
1150
|
+
}, {
|
|
1151
|
+
ns: CORE_NAMESPACE,
|
|
1152
|
+
translations: coreTranslations
|
|
1153
|
+
}, {
|
|
1154
|
+
ns: WEBMAP_REACT_NAMESPACE,
|
|
1155
|
+
translations: webmapReactTranslations
|
|
1156
|
+
}, {
|
|
1157
|
+
ns: FORM_FIELDS_NAMESPACE,
|
|
1158
|
+
translations: formFieldsTranslations
|
|
1159
|
+
}, {
|
|
1160
|
+
ns: WARN_NAMESPACE,
|
|
1161
|
+
translations: warningsTranslations
|
|
1162
|
+
}, {
|
|
1163
|
+
ns: TIME_SERIES_NAMESPACE,
|
|
1164
|
+
translations: timeseriesTranslations
|
|
1165
|
+
}, {
|
|
1166
|
+
ns: DATA_EXPLORER_NAMESPACE,
|
|
1167
|
+
translations: dataExplorerTranslations
|
|
1168
|
+
}]);
|
|
1311
1169
|
};
|
|
1312
|
-
var
|
|
1313
|
-
var
|
|
1314
|
-
return
|
|
1170
|
+
var ns = [WORKSPACE_NAMESPACE, SHARED_NAMESPACE];
|
|
1171
|
+
var useWorkspaceTranslation = function useWorkspaceTranslation() {
|
|
1172
|
+
return useTranslation(ns);
|
|
1315
1173
|
};
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1174
|
+
|
|
1175
|
+
var _excluded$7 = ["views"];
|
|
1176
|
+
var getSnackbarMessage$1 = function getSnackbarMessage(action, title, is_shared) {
|
|
1177
|
+
// Trim and add quotes
|
|
1178
|
+
var trimmedTitle = title.trim();
|
|
1179
|
+
switch (action) {
|
|
1180
|
+
case WorkspacePresetAction.DELETE:
|
|
1181
|
+
return {
|
|
1182
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
1183
|
+
key: 'workspace-list-success-delete',
|
|
1184
|
+
params: {
|
|
1185
|
+
TITLE: trimmedTitle
|
|
1186
|
+
}
|
|
1187
|
+
};
|
|
1188
|
+
case WorkspacePresetAction.DELETE_SYSTEM_PRESET:
|
|
1189
|
+
return {
|
|
1190
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
1191
|
+
key: 'workspace-list-success-delete-system',
|
|
1192
|
+
params: {
|
|
1193
|
+
TITLE: trimmedTitle
|
|
1194
|
+
}
|
|
1195
|
+
};
|
|
1196
|
+
case WorkspacePresetAction.DUPLICATE:
|
|
1197
|
+
return {
|
|
1198
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
1199
|
+
key: 'workspace-list-success-duplicate',
|
|
1200
|
+
params: {
|
|
1201
|
+
TITLE: trimmedTitle
|
|
1202
|
+
}
|
|
1203
|
+
};
|
|
1204
|
+
case WorkspacePresetAction.EDIT:
|
|
1205
|
+
return {
|
|
1206
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
1207
|
+
key: 'workspace-list-success-edit',
|
|
1208
|
+
params: {
|
|
1209
|
+
TITLE: trimmedTitle
|
|
1210
|
+
}
|
|
1211
|
+
};
|
|
1212
|
+
case WorkspacePresetAction.RESET:
|
|
1213
|
+
return {
|
|
1214
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
1215
|
+
key: 'workspace-list-success-reset',
|
|
1216
|
+
params: {
|
|
1217
|
+
TITLE: trimmedTitle
|
|
1218
|
+
}
|
|
1219
|
+
};
|
|
1220
|
+
case WorkspacePresetAction.SHARE:
|
|
1221
|
+
return {
|
|
1222
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
1223
|
+
key: is_shared ? 'workspace-list-success-unshare' : 'workspace-list-success-share',
|
|
1224
|
+
params: {
|
|
1225
|
+
TITLE: trimmedTitle
|
|
1226
|
+
}
|
|
1227
|
+
};
|
|
1228
|
+
default:
|
|
1229
|
+
return {
|
|
1230
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
1231
|
+
key: 'workspace-list-success-save',
|
|
1232
|
+
params: {
|
|
1233
|
+
TITLE: trimmedTitle
|
|
1234
|
+
}
|
|
1235
|
+
};
|
|
1322
1236
|
}
|
|
1323
|
-
return preset;
|
|
1324
1237
|
};
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1238
|
+
function getEmptyWorkspaceListItem(t) {
|
|
1239
|
+
return {
|
|
1240
|
+
id: undefined,
|
|
1241
|
+
title: t ? t('workspace-new') : undefined,
|
|
1242
|
+
labels: undefined,
|
|
1243
|
+
scope: 'system',
|
|
1244
|
+
"abstract": '',
|
|
1245
|
+
viewType: 'singleWindow'
|
|
1246
|
+
};
|
|
1247
|
+
}
|
|
1248
|
+
function getEmptyMapWorkspace(t) {
|
|
1249
|
+
return Object.assign({}, getEmptyWorkspaceListItem(t), {
|
|
1250
|
+
views: {
|
|
1251
|
+
allIds: ['1_screen'],
|
|
1252
|
+
byId: {
|
|
1253
|
+
'1_screen': {
|
|
1254
|
+
title: t ? t('workspace-mappreset-new') : undefined,
|
|
1255
|
+
componentType: 'Map',
|
|
1256
|
+
initialProps: {
|
|
1257
|
+
mapPreset: {
|
|
1258
|
+
shouldShowLayerManager: true,
|
|
1259
|
+
dockedLayerManagerSize: 'sizeSmall'
|
|
1260
|
+
},
|
|
1261
|
+
syncGroupsIds: []
|
|
1262
|
+
}
|
|
1263
|
+
}
|
|
1264
|
+
}
|
|
1265
|
+
},
|
|
1266
|
+
mosaicNode: '1_screen'
|
|
1337
1267
|
});
|
|
1338
|
-
|
|
1339
|
-
|
|
1268
|
+
}
|
|
1269
|
+
var getEmptyWorkspacePreset = function getEmptyWorkspacePreset() {
|
|
1270
|
+
return {
|
|
1271
|
+
scope: 'system',
|
|
1272
|
+
"abstract": '',
|
|
1273
|
+
views: {
|
|
1274
|
+
allIds: ['1_screen'],
|
|
1275
|
+
byId: {
|
|
1276
|
+
'1_screen': {
|
|
1277
|
+
componentType: 'Map',
|
|
1278
|
+
initialProps: {
|
|
1279
|
+
mapPreset: {
|
|
1280
|
+
shouldShowLayerManager: true,
|
|
1281
|
+
dockedLayerManagerSize: 'sizeSmall'
|
|
1282
|
+
},
|
|
1283
|
+
syncGroupsIds: []
|
|
1284
|
+
}
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
},
|
|
1288
|
+
mosaicNode: '1_screen',
|
|
1289
|
+
viewType: 'singleWindow',
|
|
1290
|
+
username: 'global'
|
|
1291
|
+
};
|
|
1292
|
+
};
|
|
1293
|
+
var createCustomEmptyMapWorkspace = function createCustomEmptyMapWorkspace(emptyWorkspaceTitle, emptyMapWorkspaceTitle, customMapPreset) {
|
|
1294
|
+
var customEmptyMapWorkspace = cloneDeep(getEmptyWorkspacePreset());
|
|
1295
|
+
if (customMapPreset) {
|
|
1296
|
+
customEmptyMapWorkspace.views.byId['1_screen'].initialProps.mapPreset = customMapPreset;
|
|
1340
1297
|
}
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1298
|
+
customEmptyMapWorkspace.views.byId['1_screen'].title = emptyMapWorkspaceTitle;
|
|
1299
|
+
var emptyWorkspacePreset = Object.assign({}, customEmptyMapWorkspace, {
|
|
1300
|
+
title: emptyWorkspaceTitle
|
|
1301
|
+
});
|
|
1302
|
+
return emptyWorkspacePreset;
|
|
1303
|
+
};
|
|
1304
|
+
var FALLBACK_TEMPLATE_LANGUAGE = 'en';
|
|
1305
|
+
// Falls back to English and then to the first title, so a template does not
|
|
1306
|
+
// need a title for every language
|
|
1307
|
+
var getTemplatePresetTitle = function getTemplatePresetTitle(title, language) {
|
|
1308
|
+
var _language, _Object$values$;
|
|
1309
|
+
if (language === void 0) {
|
|
1310
|
+
language = i18n.language;
|
|
1311
|
+
}
|
|
1312
|
+
if (typeof title === 'string') {
|
|
1313
|
+
return title;
|
|
1314
|
+
}
|
|
1315
|
+
var languageCode = [language, (_language = language) == null ? void 0 : _language.split('-')[0], FALLBACK_TEMPLATE_LANGUAGE].find(function (code) {
|
|
1316
|
+
return code && title[code];
|
|
1317
|
+
});
|
|
1318
|
+
return languageCode ? title[languageCode] : (_Object$values$ = Object.values(title)[0]) != null ? _Object$values$ : '';
|
|
1319
|
+
};
|
|
1320
|
+
var findWorkspaceTemplatePreset = function findWorkspaceTemplatePreset(defaultPresets, presetId) {
|
|
1321
|
+
return (defaultPresets != null ? defaultPresets : []).find(function (preset) {
|
|
1322
|
+
return (preset.id || undefined) === (presetId || undefined);
|
|
1323
|
+
});
|
|
1324
|
+
};
|
|
1325
|
+
var isWorkspaceTemplatePresetId = function isWorkspaceTemplatePresetId(defaultPresets, presetId) {
|
|
1326
|
+
return findWorkspaceTemplatePreset(defaultPresets, presetId) !== undefined;
|
|
1327
|
+
};
|
|
1328
|
+
var toWorkspacePresetFromTemplate = function toWorkspacePresetFromTemplate(preset, language) {
|
|
1329
|
+
var views = preset.views,
|
|
1330
|
+
rest = _objectWithoutPropertiesLoose(preset, _excluded$7);
|
|
1331
|
+
return Object.assign({}, rest, {
|
|
1332
|
+
title: getTemplatePresetTitle(preset.title, language),
|
|
1333
|
+
views: {
|
|
1334
|
+
allIds: views.allIds,
|
|
1335
|
+
byId: Object.fromEntries(views.allIds.map(function (viewId) {
|
|
1336
|
+
var view = views.byId[viewId];
|
|
1337
|
+
return [viewId, Object.assign({}, view, {
|
|
1338
|
+
title: view.title === undefined ? undefined : getTemplatePresetTitle(view.title, language)
|
|
1339
|
+
})];
|
|
1340
|
+
}))
|
|
1348
1341
|
}
|
|
1349
|
-
return true;
|
|
1350
1342
|
});
|
|
1351
1343
|
};
|
|
1352
|
-
var
|
|
1353
|
-
|
|
1344
|
+
var getEmptyMapWorkspaceTitles = function getEmptyMapWorkspaceTitles(preset, language) {
|
|
1345
|
+
var _views$byId$views$all, _views$byId$views$all2;
|
|
1346
|
+
var _toWorkspacePresetFro = toWorkspacePresetFromTemplate(preset, language),
|
|
1347
|
+
title = _toWorkspacePresetFro.title,
|
|
1348
|
+
views = _toWorkspacePresetFro.views;
|
|
1349
|
+
return {
|
|
1350
|
+
newWorkspaceText: title,
|
|
1351
|
+
newMapPresetText: (_views$byId$views$all = (_views$byId$views$all2 = views.byId[views.allIds[0]]) == null ? void 0 : _views$byId$views$all2.title) != null ? _views$byId$views$all : title
|
|
1352
|
+
};
|
|
1354
1353
|
};
|
|
1355
|
-
var
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1354
|
+
var toWorkspaceTemplateListItem = function toWorkspaceTemplateListItem(preset, language) {
|
|
1355
|
+
var _preset$scope, _preset$abstract, _preset$viewType;
|
|
1356
|
+
return {
|
|
1357
|
+
id: preset.id,
|
|
1358
|
+
title: getTemplatePresetTitle(preset.title, language),
|
|
1359
|
+
labels: preset.labels,
|
|
1360
|
+
scope: (_preset$scope = preset.scope) != null ? _preset$scope : 'system',
|
|
1361
|
+
"abstract": (_preset$abstract = preset["abstract"]) != null ? _preset$abstract : '',
|
|
1362
|
+
viewType: (_preset$viewType = preset.viewType) != null ? _preset$viewType : 'singleWindow',
|
|
1363
|
+
isWorkspaceTemplate: true
|
|
1364
|
+
};
|
|
1365
|
+
};
|
|
1366
|
+
var toWorkspaceTemplateListItems = function toWorkspaceTemplateListItems(defaultPresets, language) {
|
|
1367
|
+
return (defaultPresets != null ? defaultPresets : []).map(function (preset) {
|
|
1368
|
+
return toWorkspaceTemplateListItem(preset, language);
|
|
1369
|
+
});
|
|
1370
|
+
};
|
|
1371
|
+
var getBEViewsFromState = function getBEViewsFromState(workspace) {
|
|
1372
|
+
var _workspace$views$allI, _workspace$views;
|
|
1373
|
+
var result = [];
|
|
1374
|
+
((_workspace$views$allI = workspace == null || (_workspace$views = workspace.views) == null ? void 0 : _workspace$views.allIds) != null ? _workspace$views$allI : []).forEach(function (id) {
|
|
1375
|
+
var _workspace$views$byId;
|
|
1376
|
+
var view = (_workspace$views$byId = workspace.views.byId[id]) != null ? _workspace$views$byId : {};
|
|
1377
|
+
result.push({
|
|
1378
|
+
mosaicNodeId: id,
|
|
1379
|
+
title: typeof view.title === 'string' && view.title.trim() ? view.title : id,
|
|
1380
|
+
componentType: view.componentType,
|
|
1381
|
+
initialProps: view.initialProps
|
|
1382
|
+
});
|
|
1383
|
+
});
|
|
1384
|
+
return result;
|
|
1385
|
+
};
|
|
1386
|
+
var togglePresetFilter = function togglePresetFilter(filters, id, isSelected, isAdmin, isFavouritesEnabled, isTemplatesEnabled) {
|
|
1387
|
+
if (isAdmin === void 0) {
|
|
1388
|
+
isAdmin = false;
|
|
1389
|
+
}
|
|
1390
|
+
if (isFavouritesEnabled === void 0) {
|
|
1391
|
+
isFavouritesEnabled = true;
|
|
1392
|
+
}
|
|
1393
|
+
if (isTemplatesEnabled === void 0) {
|
|
1394
|
+
isTemplatesEnabled = true;
|
|
1395
|
+
}
|
|
1396
|
+
if (!filters.some(function (filter) {
|
|
1397
|
+
return filter.id === id;
|
|
1398
|
+
})) {
|
|
1399
|
+
return filters;
|
|
1400
|
+
}
|
|
1401
|
+
var availableFilters = filters.filter(function (filter) {
|
|
1402
|
+
if (filter.id === PresetFilterType.favourites) {
|
|
1403
|
+
return isFavouritesEnabled;
|
|
1404
|
+
}
|
|
1405
|
+
if (filter.id === PresetFilterType.templates && !isTemplatesEnabled) {
|
|
1406
|
+
return false;
|
|
1407
|
+
}
|
|
1408
|
+
return !isAdmin || filter.id === PresetFilterType.system || filter.id === PresetFilterType.shared || filter.id === PresetFilterType.templates;
|
|
1409
|
+
});
|
|
1410
|
+
var allSelected = availableFilters.every(function (filter) {
|
|
1411
|
+
return filter.isSelected;
|
|
1412
|
+
});
|
|
1413
|
+
var allUnselected = availableFilters.every(function (filter) {
|
|
1414
|
+
return filter.id === id ? !isSelected : !filter.isSelected;
|
|
1415
|
+
});
|
|
1416
|
+
return filters.map(function (filter) {
|
|
1417
|
+
if (allSelected) {
|
|
1418
|
+
return Object.assign({}, filter, {
|
|
1419
|
+
isSelected: filter.id === id && isSelected
|
|
1420
|
+
});
|
|
1421
|
+
}
|
|
1422
|
+
// Admins select one scope at a time, deselecting goes through the
|
|
1423
|
+
// regular flow so the last deselected chip falls back to all
|
|
1424
|
+
if (isAdmin && isSelected && id !== PresetFilterType.favourites && filter.id !== PresetFilterType.favourites) {
|
|
1425
|
+
return Object.assign({}, filter, {
|
|
1426
|
+
isSelected: filter.id === id
|
|
1427
|
+
});
|
|
1428
|
+
}
|
|
1429
|
+
return Object.assign({}, filter, {
|
|
1430
|
+
isSelected: allUnselected || (filter.id === id ? isSelected : filter.isSelected)
|
|
1363
1431
|
});
|
|
1364
1432
|
});
|
|
1365
1433
|
};
|
|
1366
1434
|
|
|
1367
|
-
var getViewPreset = /*#__PURE__*/function () {
|
|
1368
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(viewpresetId, auth) {
|
|
1369
|
-
return _regenerator().w(function (_context) {
|
|
1370
|
-
while (1) switch (_context.n) {
|
|
1371
|
-
case 0:
|
|
1372
|
-
if (viewpresetId) {
|
|
1373
|
-
_context.n = 1;
|
|
1374
|
-
break;
|
|
1375
|
-
}
|
|
1376
|
-
return _context.a(2, null);
|
|
1377
|
-
case 1:
|
|
1378
|
-
return _context.a(2, fetch(getPresetBaseUrl() + "/viewpreset/" + viewpresetId, {
|
|
1379
|
-
headers: getHeaders(auth)
|
|
1380
|
-
}).then(handleResponse));
|
|
1381
|
-
}
|
|
1382
|
-
}, _callee);
|
|
1383
|
-
}));
|
|
1384
|
-
return function getViewPreset(_x, _x2) {
|
|
1385
|
-
return _ref.apply(this, arguments);
|
|
1386
|
-
};
|
|
1387
|
-
}();
|
|
1388
|
-
var getViewPresets$1 = /*#__PURE__*/function () {
|
|
1389
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(auth) {
|
|
1390
|
-
var url;
|
|
1391
|
-
return _regenerator().w(function (_context2) {
|
|
1392
|
-
while (1) switch (_context2.n) {
|
|
1393
|
-
case 0:
|
|
1394
|
-
url = getPresetBaseUrl() + "/viewpreset";
|
|
1395
|
-
return _context2.a(2, fetch(url, {
|
|
1396
|
-
headers: getHeaders(auth)
|
|
1397
|
-
}).then(handleResponse));
|
|
1398
|
-
}
|
|
1399
|
-
}, _callee2);
|
|
1400
|
-
}));
|
|
1401
|
-
return function getViewPresets(_x3) {
|
|
1402
|
-
return _ref2.apply(this, arguments);
|
|
1403
|
-
};
|
|
1404
|
-
}();
|
|
1405
|
-
var updateViewPreset = /*#__PURE__*/function () {
|
|
1406
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(viewpresetId, data, auth) {
|
|
1407
|
-
return _regenerator().w(function (_context3) {
|
|
1408
|
-
while (1) switch (_context3.n) {
|
|
1409
|
-
case 0:
|
|
1410
|
-
return _context3.a(2, fetch(getPresetBaseUrl() + "/viewpreset/" + viewpresetId, {
|
|
1411
|
-
headers: getHeaders(auth),
|
|
1412
|
-
method: 'PUT',
|
|
1413
|
-
body: JSON.stringify(data)
|
|
1414
|
-
}).then(handleResponse));
|
|
1415
|
-
}
|
|
1416
|
-
}, _callee3);
|
|
1417
|
-
}));
|
|
1418
|
-
return function updateViewPreset(_x4, _x5, _x6) {
|
|
1419
|
-
return _ref3.apply(this, arguments);
|
|
1420
|
-
};
|
|
1421
|
-
}();
|
|
1422
|
-
var saveViewPreset = /*#__PURE__*/function () {
|
|
1423
|
-
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(viewPresetId, data, auth) {
|
|
1424
|
-
var payload;
|
|
1425
|
-
return _regenerator().w(function (_context4) {
|
|
1426
|
-
while (1) switch (_context4.n) {
|
|
1427
|
-
case 0:
|
|
1428
|
-
payload = data.initialProps === null ? Object.assign({}, data, {
|
|
1429
|
-
initialProps: {}
|
|
1430
|
-
}) : data;
|
|
1431
|
-
return _context4.a(2, fetch(getPresetBaseUrl() + "/viewpreset/" + viewPresetId + "/", {
|
|
1432
|
-
headers: getHeaders(auth),
|
|
1433
|
-
method: 'PUT',
|
|
1434
|
-
body: JSON.stringify(payload)
|
|
1435
|
-
}).then(handleResponse));
|
|
1436
|
-
}
|
|
1437
|
-
}, _callee4);
|
|
1438
|
-
}));
|
|
1439
|
-
return function saveViewPreset(_x7, _x8, _x9) {
|
|
1440
|
-
return _ref4.apply(this, arguments);
|
|
1441
|
-
};
|
|
1442
|
-
}();
|
|
1443
|
-
var saveViewPresetAs = /*#__PURE__*/function () {
|
|
1444
|
-
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(data, auth) {
|
|
1445
|
-
var _response$headers$get;
|
|
1446
|
-
var payload, response, headerLocation;
|
|
1447
|
-
return _regenerator().w(function (_context5) {
|
|
1448
|
-
while (1) switch (_context5.n) {
|
|
1449
|
-
case 0:
|
|
1450
|
-
payload = data.initialProps === null ? Object.assign({}, data, {
|
|
1451
|
-
initialProps: {}
|
|
1452
|
-
}) : data;
|
|
1453
|
-
_context5.n = 1;
|
|
1454
|
-
return fetch(getPresetBaseUrl() + "/viewpreset/", {
|
|
1455
|
-
headers: getHeaders(auth),
|
|
1456
|
-
method: 'POST',
|
|
1457
|
-
body: JSON.stringify(payload)
|
|
1458
|
-
});
|
|
1459
|
-
case 1:
|
|
1460
|
-
response = _context5.v;
|
|
1461
|
-
_context5.n = 2;
|
|
1462
|
-
return handleResponse(response);
|
|
1463
|
-
case 2:
|
|
1464
|
-
headerLocation = (_response$headers$get = response.headers.get('Location')) != null ? _response$headers$get : response.headers.get('location');
|
|
1465
|
-
return _context5.a(2, getIdFromUrl(headerLocation));
|
|
1466
|
-
}
|
|
1467
|
-
}, _callee5);
|
|
1468
|
-
}));
|
|
1469
|
-
return function saveViewPresetAs(_x0, _x1) {
|
|
1470
|
-
return _ref5.apply(this, arguments);
|
|
1471
|
-
};
|
|
1472
|
-
}();
|
|
1473
|
-
var deleteViewPreset = /*#__PURE__*/function () {
|
|
1474
|
-
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(viewPresetId, auth) {
|
|
1475
|
-
return _regenerator().w(function (_context6) {
|
|
1476
|
-
while (1) switch (_context6.n) {
|
|
1477
|
-
case 0:
|
|
1478
|
-
return _context6.a(2, fetch(getPresetBaseUrl() + "/viewpreset/" + viewPresetId, {
|
|
1479
|
-
method: 'DELETE',
|
|
1480
|
-
headers: getHeaders(auth)
|
|
1481
|
-
}).then(handleResponse));
|
|
1482
|
-
}
|
|
1483
|
-
}, _callee6);
|
|
1484
|
-
}));
|
|
1485
|
-
return function deleteViewPreset(_x10, _x11) {
|
|
1486
|
-
return _ref6.apply(this, arguments);
|
|
1487
|
-
};
|
|
1488
|
-
}();
|
|
1489
|
-
|
|
1490
|
-
var API_KEY$1 = 'viewpreset-api';
|
|
1491
|
-
var generateViewPresetQueryKeys = function generateViewPresetQueryKeys() {
|
|
1492
|
-
for (var _len = arguments.length, queryKeys = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
1493
|
-
queryKeys[_key] = arguments[_key];
|
|
1494
|
-
}
|
|
1495
|
-
return [LIB_KEY, API_KEY$1].concat(queryKeys);
|
|
1496
|
-
};
|
|
1497
|
-
var viewpresetQueryOptions = {
|
|
1498
|
-
keys: {
|
|
1499
|
-
all: function all() {
|
|
1500
|
-
return generateViewPresetQueryKeys();
|
|
1501
|
-
},
|
|
1502
|
-
views: function views() {
|
|
1503
|
-
return [].concat(viewpresetQueryOptions.keys.all(), ['view']);
|
|
1504
|
-
},
|
|
1505
|
-
lists: function lists() {
|
|
1506
|
-
return [].concat(viewpresetQueryOptions.keys.all(), ['list']);
|
|
1507
|
-
}
|
|
1508
|
-
},
|
|
1509
|
-
getViewPreset: function getViewPreset$1(id, credentials) {
|
|
1510
|
-
return queryOptions({
|
|
1511
|
-
queryKey: [].concat(viewpresetQueryOptions.keys.views(), [id]),
|
|
1512
|
-
queryFn: function () {
|
|
1513
|
-
var _queryFn = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
1514
|
-
return _regenerator().w(function (_context) {
|
|
1515
|
-
while (1) switch (_context.n) {
|
|
1516
|
-
case 0:
|
|
1517
|
-
return _context.a(2, getViewPreset(id, credentials));
|
|
1518
|
-
}
|
|
1519
|
-
}, _callee);
|
|
1520
|
-
}));
|
|
1521
|
-
function queryFn() {
|
|
1522
|
-
return _queryFn.apply(this, arguments);
|
|
1523
|
-
}
|
|
1524
|
-
return queryFn;
|
|
1525
|
-
}()
|
|
1526
|
-
});
|
|
1527
|
-
},
|
|
1528
|
-
getViewPresets: function getViewPresets(credentials) {
|
|
1529
|
-
return queryOptions({
|
|
1530
|
-
queryKey: viewpresetQueryOptions.keys.lists(),
|
|
1531
|
-
queryFn: function () {
|
|
1532
|
-
var _queryFn2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
1533
|
-
return _regenerator().w(function (_context2) {
|
|
1534
|
-
while (1) switch (_context2.n) {
|
|
1535
|
-
case 0:
|
|
1536
|
-
return _context2.a(2, getViewPresets$1(credentials));
|
|
1537
|
-
}
|
|
1538
|
-
}, _callee2);
|
|
1539
|
-
}));
|
|
1540
|
-
function queryFn() {
|
|
1541
|
-
return _queryFn2.apply(this, arguments);
|
|
1542
|
-
}
|
|
1543
|
-
return queryFn;
|
|
1544
|
-
}(),
|
|
1545
|
-
staleTime: 2 * 60 * 1000,
|
|
1546
|
-
refetchOnMount: true
|
|
1547
|
-
});
|
|
1548
|
-
},
|
|
1549
|
-
saveViewPreset: function saveViewPreset$1(id, data, credentials) {
|
|
1550
|
-
return queryOptions({
|
|
1551
|
-
queryKey: [].concat(viewpresetQueryOptions.keys.views(), [id, 'save']),
|
|
1552
|
-
staleTime: 0,
|
|
1553
|
-
queryFn: function () {
|
|
1554
|
-
var _queryFn3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
1555
|
-
return _regenerator().w(function (_context3) {
|
|
1556
|
-
while (1) switch (_context3.n) {
|
|
1557
|
-
case 0:
|
|
1558
|
-
return _context3.a(2, saveViewPreset(id, data, credentials));
|
|
1559
|
-
}
|
|
1560
|
-
}, _callee3);
|
|
1561
|
-
}));
|
|
1562
|
-
function queryFn() {
|
|
1563
|
-
return _queryFn3.apply(this, arguments);
|
|
1564
|
-
}
|
|
1565
|
-
return queryFn;
|
|
1566
|
-
}()
|
|
1567
|
-
});
|
|
1568
|
-
},
|
|
1569
|
-
saveViewPresetAs: function saveViewPresetAs$1(data, credentials) {
|
|
1570
|
-
return queryOptions({
|
|
1571
|
-
queryKey: [].concat(viewpresetQueryOptions.keys.views(), ['save-as']),
|
|
1572
|
-
staleTime: 0,
|
|
1573
|
-
queryFn: function () {
|
|
1574
|
-
var _queryFn4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
1575
|
-
return _regenerator().w(function (_context4) {
|
|
1576
|
-
while (1) switch (_context4.n) {
|
|
1577
|
-
case 0:
|
|
1578
|
-
return _context4.a(2, saveViewPresetAs(data, credentials));
|
|
1579
|
-
}
|
|
1580
|
-
}, _callee4);
|
|
1581
|
-
}));
|
|
1582
|
-
function queryFn() {
|
|
1583
|
-
return _queryFn4.apply(this, arguments);
|
|
1584
|
-
}
|
|
1585
|
-
return queryFn;
|
|
1586
|
-
}()
|
|
1587
|
-
});
|
|
1588
|
-
}
|
|
1589
|
-
};
|
|
1590
|
-
|
|
1591
1435
|
/* *
|
|
1592
1436
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1593
1437
|
* you may not use this file except in compliance with the License.
|
|
@@ -1605,14 +1449,134 @@ var viewpresetQueryOptions = {
|
|
|
1605
1449
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
1606
1450
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1607
1451
|
* */
|
|
1608
|
-
var
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1452
|
+
var personalFilterState = {
|
|
1453
|
+
label: 'shared-filter-my-presets',
|
|
1454
|
+
id: PresetFilterType.personal,
|
|
1455
|
+
isSelected: true,
|
|
1456
|
+
isDisabled: false
|
|
1612
1457
|
};
|
|
1613
|
-
var
|
|
1614
|
-
|
|
1458
|
+
var systemFilterState = {
|
|
1459
|
+
label: 'shared-filter-system-presets',
|
|
1460
|
+
id: PresetFilterType.system,
|
|
1461
|
+
isSelected: true,
|
|
1462
|
+
isDisabled: false
|
|
1615
1463
|
};
|
|
1464
|
+
var sharedFilterState = {
|
|
1465
|
+
label: 'shared-filter-shared-presets',
|
|
1466
|
+
id: PresetFilterType.shared,
|
|
1467
|
+
isSelected: true,
|
|
1468
|
+
isDisabled: false
|
|
1469
|
+
};
|
|
1470
|
+
({
|
|
1471
|
+
id: PresetFilterType.plugin});
|
|
1472
|
+
var templatesFilterState = {
|
|
1473
|
+
label: 'shared-filter-template-presets',
|
|
1474
|
+
id: PresetFilterType.templates,
|
|
1475
|
+
isSelected: true,
|
|
1476
|
+
isDisabled: false
|
|
1477
|
+
};
|
|
1478
|
+
var favouriteFilterState = {
|
|
1479
|
+
label: 'workspace-favourites',
|
|
1480
|
+
id: PresetFilterType.favourites,
|
|
1481
|
+
isSelected: true,
|
|
1482
|
+
isDisabled: false
|
|
1483
|
+
};
|
|
1484
|
+
var defaultPresetFilterState = [personalFilterState, systemFilterState, sharedFilterState, templatesFilterState, favouriteFilterState];
|
|
1485
|
+
var ADMIN_WORKSPACE_FILTER_IDS = [PresetFilterType.system, PresetFilterType.shared, PresetFilterType.templates, PresetFilterType.favourites];
|
|
1486
|
+
var initialState$2 = {
|
|
1487
|
+
error: undefined,
|
|
1488
|
+
isWorkspaceListDialogOpen: false,
|
|
1489
|
+
searchQuery: '',
|
|
1490
|
+
workspaceListFilters: defaultPresetFilterState,
|
|
1491
|
+
workspaceLabelFilters: undefined
|
|
1492
|
+
};
|
|
1493
|
+
var slice$2 = createSlice({
|
|
1494
|
+
initialState: initialState$2,
|
|
1495
|
+
name: 'workspaceList',
|
|
1496
|
+
reducers: {
|
|
1497
|
+
openWorkspaceActionDialogOptions: function openWorkspaceActionDialogOptions(draft, action) {
|
|
1498
|
+
draft.workspaceActionDialog = Object.assign({}, action.payload, {
|
|
1499
|
+
error: undefined
|
|
1500
|
+
});
|
|
1501
|
+
},
|
|
1502
|
+
onSuccessWorkspaceSaveDialog: function onSuccessWorkspaceSaveDialog(draft, action) {
|
|
1503
|
+
if (!draft.workspaceActionDialog) {
|
|
1504
|
+
return;
|
|
1505
|
+
}
|
|
1506
|
+
var presetId = action.payload.presetId;
|
|
1507
|
+
if (presetId) {
|
|
1508
|
+
draft.workspaceActionDialog.presetId = presetId;
|
|
1509
|
+
}
|
|
1510
|
+
draft.workspaceActionDialog.hasSaved = true;
|
|
1511
|
+
},
|
|
1512
|
+
submitFormWorkspaceActionDialogOptions: function submitFormWorkspaceActionDialogOptions(draft, _action) {
|
|
1513
|
+
if (!draft.workspaceActionDialog) {
|
|
1514
|
+
return;
|
|
1515
|
+
}
|
|
1516
|
+
draft.workspaceActionDialog.error = undefined;
|
|
1517
|
+
},
|
|
1518
|
+
closeWorkspaceActionDialogOptions: function closeWorkspaceActionDialogOptions(draft) {
|
|
1519
|
+
delete draft.workspaceActionDialog;
|
|
1520
|
+
},
|
|
1521
|
+
// action is intercepted in mapPresets/listener
|
|
1522
|
+
onSuccessWorkspacePresetAction: function onSuccessWorkspacePresetAction(draft, _action) {
|
|
1523
|
+
delete draft.workspaceActionDialog;
|
|
1524
|
+
},
|
|
1525
|
+
onErrorWorkspacePresetAction: function onErrorWorkspacePresetAction(draft, action) {
|
|
1526
|
+
var error = action.payload.error;
|
|
1527
|
+
if (draft.workspaceActionDialog) {
|
|
1528
|
+
draft.workspaceActionDialog.error = error;
|
|
1529
|
+
} else {
|
|
1530
|
+
// fallback if dialog isn't open (e.g. SHARE action)
|
|
1531
|
+
draft.error = error;
|
|
1532
|
+
}
|
|
1533
|
+
},
|
|
1534
|
+
toggleWorkspaceDialog: function toggleWorkspaceDialog(draft, action) {
|
|
1535
|
+
var isListDialogOpen = action.payload.isWorkspaceListDialogOpen;
|
|
1536
|
+
draft.isWorkspaceListDialogOpen = isListDialogOpen;
|
|
1537
|
+
},
|
|
1538
|
+
toggleSelectFilterChip: function toggleSelectFilterChip(draft, action) {
|
|
1539
|
+
var _action$payload = action.payload,
|
|
1540
|
+
id = _action$payload.id,
|
|
1541
|
+
isSelected = _action$payload.isSelected,
|
|
1542
|
+
isAdmin = _action$payload.isAdmin,
|
|
1543
|
+
isFavouritesEnabled = _action$payload.isFavouritesEnabled,
|
|
1544
|
+
isTemplatesEnabled = _action$payload.isTemplatesEnabled;
|
|
1545
|
+
draft.workspaceListFilters = togglePresetFilter(draft.workspaceListFilters, id, isSelected, isAdmin, isFavouritesEnabled, isTemplatesEnabled);
|
|
1546
|
+
},
|
|
1547
|
+
setSelectAllFilterChip: function setSelectAllFilterChip(draft) {
|
|
1548
|
+
draft.workspaceListFilters = draft.workspaceListFilters.map(function (filter) {
|
|
1549
|
+
return Object.assign({}, filter, {
|
|
1550
|
+
isSelected: true
|
|
1551
|
+
});
|
|
1552
|
+
});
|
|
1553
|
+
},
|
|
1554
|
+
setFilterChips: function setFilterChips(draft, action) {
|
|
1555
|
+
var payload = action.payload;
|
|
1556
|
+
draft.workspaceListFilters.forEach(function (filter, index) {
|
|
1557
|
+
var existingFilter = payload.find(function (existingFilter) {
|
|
1558
|
+
return existingFilter.id === filter.id;
|
|
1559
|
+
});
|
|
1560
|
+
var updatedFilter = Object.assign({}, filter, {
|
|
1561
|
+
isSelected: existingFilter ? existingFilter.isSelected : filter.isSelected
|
|
1562
|
+
});
|
|
1563
|
+
draft.workspaceListFilters[index] = updatedFilter;
|
|
1564
|
+
});
|
|
1565
|
+
},
|
|
1566
|
+
setWorkspaceLabelFilters: function setWorkspaceLabelFilters(draft, action) {
|
|
1567
|
+
draft.workspaceLabelFilters = action.payload.labels;
|
|
1568
|
+
},
|
|
1569
|
+
clearLabelFilters: function clearLabelFilters(draft) {
|
|
1570
|
+
draft.workspaceLabelFilters = undefined;
|
|
1571
|
+
},
|
|
1572
|
+
searchFilter: function searchFilter(draft, action) {
|
|
1573
|
+
var searchQuery = action.payload.searchQuery;
|
|
1574
|
+
draft.searchQuery = searchQuery;
|
|
1575
|
+
}
|
|
1576
|
+
}
|
|
1577
|
+
});
|
|
1578
|
+
var workspaceListReducer = slice$2.reducer,
|
|
1579
|
+
workspaceListActions = slice$2.actions;
|
|
1616
1580
|
|
|
1617
1581
|
/* *
|
|
1618
1582
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -1631,914 +1595,351 @@ var getWorkspaceRouteUrl = function getWorkspaceRouteUrl(workspaceId) {
|
|
|
1631
1595
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
1632
1596
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1633
1597
|
* */
|
|
1634
|
-
var
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
}
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
// 2) TimeSeries components
|
|
1662
|
-
var SUPPORTED_TIMESERIES_COMPONENT_TYPES = ['TimeSeries'];
|
|
1663
|
-
// or keep your old union type if it already exists
|
|
1664
|
-
// 3) Warning list components
|
|
1665
|
-
var WARNING_LIST_COMPONENT_TYPES = ['WarningList', 'MaritimeWarnings', 'WarningsTimeline'];
|
|
1666
|
-
// TODO: expand it and move to a more centralized place
|
|
1667
|
-
var ALL_COMPONENT_TYPES = [].concat(SUPPORTED_COMPONENT_TYPES, SUPPORTED_TIMESERIES_COMPONENT_TYPES, WARNING_LIST_COMPONENT_TYPES, AVIATION_COMPONENT_TYPES, CAP_COMPONENT_TYPES, ['TafModule', 'TrajksModule', 'SpaceweatherModule', 'Plugin', 'Soundings', 'CrossSection']);
|
|
1668
|
-
var ViewPresetErrorComponent;
|
|
1669
|
-
(function (ViewPresetErrorComponent) {
|
|
1670
|
-
ViewPresetErrorComponent["PRESET_DETAIL"] = "PRESET_DETAIL";
|
|
1671
|
-
ViewPresetErrorComponent["PRESET_LIST"] = "PRESET_LIST";
|
|
1672
|
-
})(ViewPresetErrorComponent || (ViewPresetErrorComponent = {}));
|
|
1673
|
-
var ViewPresetErrorType;
|
|
1674
|
-
(function (ViewPresetErrorType) {
|
|
1675
|
-
ViewPresetErrorType["AUTH"] = "AUTH";
|
|
1676
|
-
ViewPresetErrorType["GENERIC"] = "GENERIC";
|
|
1677
|
-
})(ViewPresetErrorType || (ViewPresetErrorType = {}));
|
|
1678
|
-
var PresetAction;
|
|
1679
|
-
(function (PresetAction) {
|
|
1680
|
-
PresetAction["OPEN"] = "Open";
|
|
1681
|
-
PresetAction["DELETE"] = "Delete";
|
|
1682
|
-
PresetAction["SAVE"] = "Save";
|
|
1683
|
-
PresetAction["SAVE_AS"] = "Save as";
|
|
1684
|
-
PresetAction["SHARE"] = "Share";
|
|
1685
|
-
PresetAction["EDIT"] = "Edit";
|
|
1686
|
-
PresetAction["RESET"] = "Reset";
|
|
1687
|
-
})(PresetAction || (PresetAction = {}));
|
|
1688
|
-
|
|
1689
|
-
/* *
|
|
1690
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1691
|
-
* you may not use this file except in compliance with the License.
|
|
1692
|
-
* You may obtain a copy of the License at
|
|
1693
|
-
*
|
|
1694
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1695
|
-
*
|
|
1696
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1697
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1698
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1699
|
-
* See the License for the specific language governing permissions and
|
|
1700
|
-
* limitations under the License.
|
|
1701
|
-
*
|
|
1702
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1703
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
1704
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1705
|
-
* */
|
|
1706
|
-
var WorkspaceListErrorCategory;
|
|
1707
|
-
(function (WorkspaceListErrorCategory) {
|
|
1708
|
-
WorkspaceListErrorCategory["AUTH"] = "AUTH";
|
|
1709
|
-
WorkspaceListErrorCategory["GENERIC"] = "GENERIC";
|
|
1710
|
-
})(WorkspaceListErrorCategory || (WorkspaceListErrorCategory = {}));
|
|
1711
|
-
var WorkspaceListErrorType;
|
|
1712
|
-
(function (WorkspaceListErrorType) {
|
|
1713
|
-
WorkspaceListErrorType["TRANSLATABLE_ERROR"] = "TRANSLATABLE_ERROR";
|
|
1714
|
-
WorkspaceListErrorType["VERBATIM_ERROR"] = "VERBATIM_ERROR";
|
|
1715
|
-
})(WorkspaceListErrorType || (WorkspaceListErrorType = {}));
|
|
1716
|
-
var PresetFilterType;
|
|
1717
|
-
(function (PresetFilterType) {
|
|
1718
|
-
PresetFilterType["personal"] = "personal";
|
|
1719
|
-
PresetFilterType["shared"] = "shared";
|
|
1720
|
-
PresetFilterType["system"] = "system";
|
|
1721
|
-
PresetFilterType["plugin"] = "plugin";
|
|
1722
|
-
PresetFilterType["templates"] = "templates";
|
|
1723
|
-
PresetFilterType["favourites"] = "favourites";
|
|
1724
|
-
})(PresetFilterType || (PresetFilterType = {}));
|
|
1725
|
-
|
|
1726
|
-
/* *
|
|
1727
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1728
|
-
* you may not use this file except in compliance with the License.
|
|
1729
|
-
* You may obtain a copy of the License at
|
|
1730
|
-
*
|
|
1731
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1732
|
-
*
|
|
1733
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1734
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1735
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1736
|
-
* See the License for the specific language governing permissions and
|
|
1737
|
-
* limitations under the License.
|
|
1738
|
-
*
|
|
1739
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1740
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
1741
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1742
|
-
* */
|
|
1743
|
-
var WORKSPACE_NAMESPACE = 'workspace';
|
|
1744
|
-
var initWorkspaceTestI18n = function initWorkspaceTestI18n() {
|
|
1745
|
-
safelyInitI18nForTestsAndStories(i18n, WORKSPACE_NAMESPACE, [{
|
|
1746
|
-
ns: WORKSPACE_NAMESPACE,
|
|
1747
|
-
translations: workspaceTranslations
|
|
1748
|
-
}, {
|
|
1749
|
-
ns: SHARED_NAMESPACE,
|
|
1750
|
-
translations: sharedTranslations
|
|
1751
|
-
}, {
|
|
1752
|
-
ns: CORE_NAMESPACE,
|
|
1753
|
-
translations: coreTranslations
|
|
1754
|
-
}, {
|
|
1755
|
-
ns: WEBMAP_REACT_NAMESPACE,
|
|
1756
|
-
translations: webmapReactTranslations
|
|
1757
|
-
}, {
|
|
1758
|
-
ns: FORM_FIELDS_NAMESPACE,
|
|
1759
|
-
translations: formFieldsTranslations
|
|
1760
|
-
}, {
|
|
1761
|
-
ns: WARN_NAMESPACE,
|
|
1762
|
-
translations: warningsTranslations
|
|
1763
|
-
}, {
|
|
1764
|
-
ns: TIME_SERIES_NAMESPACE,
|
|
1765
|
-
translations: timeseriesTranslations
|
|
1766
|
-
}, {
|
|
1767
|
-
ns: DATA_EXPLORER_NAMESPACE,
|
|
1768
|
-
translations: dataExplorerTranslations
|
|
1769
|
-
}]);
|
|
1770
|
-
};
|
|
1771
|
-
var ns = [WORKSPACE_NAMESPACE, SHARED_NAMESPACE];
|
|
1772
|
-
var useWorkspaceTranslation = function useWorkspaceTranslation() {
|
|
1773
|
-
return useTranslation(ns);
|
|
1598
|
+
var defaultViewPresetsFilters = [{
|
|
1599
|
+
label: 'shared-filter-my-view-presets',
|
|
1600
|
+
id: PresetFilterType.personal,
|
|
1601
|
+
isSelected: true,
|
|
1602
|
+
isDisabled: false
|
|
1603
|
+
}, {
|
|
1604
|
+
label: 'shared-filter-system-view-presets',
|
|
1605
|
+
id: PresetFilterType.system,
|
|
1606
|
+
isSelected: true,
|
|
1607
|
+
isDisabled: false
|
|
1608
|
+
}, {
|
|
1609
|
+
label: 'shared-filter-shared-view-presets',
|
|
1610
|
+
id: PresetFilterType.shared,
|
|
1611
|
+
isSelected: true,
|
|
1612
|
+
isDisabled: false
|
|
1613
|
+
}, {
|
|
1614
|
+
label: 'shared-filter-template-presets',
|
|
1615
|
+
id: PresetFilterType.templates,
|
|
1616
|
+
isSelected: true,
|
|
1617
|
+
isDisabled: false
|
|
1618
|
+
}, favouriteFilterState];
|
|
1619
|
+
var ADMIN_VIEW_PRESET_FILTER_IDS = [PresetFilterType.system, PresetFilterType.shared, PresetFilterType.templates, PresetFilterType.favourites];
|
|
1620
|
+
var pluginViewPresetsFilter = {
|
|
1621
|
+
label: 'shared-filter-plugin-view-presets',
|
|
1622
|
+
id: PresetFilterType.plugin,
|
|
1623
|
+
isSelected: true,
|
|
1624
|
+
isDisabled: false
|
|
1774
1625
|
};
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
var trimmedTitle = title.trim();
|
|
1780
|
-
switch (action) {
|
|
1781
|
-
case WorkspacePresetAction.DELETE:
|
|
1782
|
-
return {
|
|
1783
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
1784
|
-
key: 'workspace-list-success-delete',
|
|
1785
|
-
params: {
|
|
1786
|
-
TITLE: trimmedTitle
|
|
1787
|
-
}
|
|
1788
|
-
};
|
|
1789
|
-
case WorkspacePresetAction.DELETE_SYSTEM_PRESET:
|
|
1790
|
-
return {
|
|
1791
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
1792
|
-
key: 'workspace-list-success-delete-system',
|
|
1793
|
-
params: {
|
|
1794
|
-
TITLE: trimmedTitle
|
|
1795
|
-
}
|
|
1796
|
-
};
|
|
1797
|
-
case WorkspacePresetAction.DUPLICATE:
|
|
1798
|
-
return {
|
|
1799
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
1800
|
-
key: 'workspace-list-success-duplicate',
|
|
1801
|
-
params: {
|
|
1802
|
-
TITLE: trimmedTitle
|
|
1803
|
-
}
|
|
1804
|
-
};
|
|
1805
|
-
case WorkspacePresetAction.EDIT:
|
|
1806
|
-
return {
|
|
1807
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
1808
|
-
key: 'workspace-list-success-edit',
|
|
1809
|
-
params: {
|
|
1810
|
-
TITLE: trimmedTitle
|
|
1811
|
-
}
|
|
1812
|
-
};
|
|
1813
|
-
case WorkspacePresetAction.RESET:
|
|
1814
|
-
return {
|
|
1815
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
1816
|
-
key: 'workspace-list-success-reset',
|
|
1817
|
-
params: {
|
|
1818
|
-
TITLE: trimmedTitle
|
|
1819
|
-
}
|
|
1820
|
-
};
|
|
1821
|
-
case WorkspacePresetAction.SHARE:
|
|
1822
|
-
return {
|
|
1823
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
1824
|
-
key: is_shared ? 'workspace-list-success-unshare' : 'workspace-list-success-share',
|
|
1825
|
-
params: {
|
|
1826
|
-
TITLE: trimmedTitle
|
|
1827
|
-
}
|
|
1828
|
-
};
|
|
1829
|
-
default:
|
|
1830
|
-
return {
|
|
1831
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
1832
|
-
key: 'workspace-list-success-save',
|
|
1833
|
-
params: {
|
|
1834
|
-
TITLE: trimmedTitle
|
|
1835
|
-
}
|
|
1836
|
-
};
|
|
1626
|
+
var viewPresetsAdapter = createEntityAdapter({
|
|
1627
|
+
// we use panelId as id (panelId can be mapId or viewId)
|
|
1628
|
+
selectId: function selectId(mapPreset) {
|
|
1629
|
+
return mapPreset.panelId;
|
|
1837
1630
|
}
|
|
1838
|
-
};
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1631
|
+
});
|
|
1632
|
+
var initialState$1 = viewPresetsAdapter.getInitialState();
|
|
1633
|
+
var warningsPresetChangeActions = [warningsFiltersActions.setWarningFilters, warningsFiltersActions.setExpandedSectionsForPanel];
|
|
1634
|
+
var syncGroupChangeActions = [syncGroupsActions.syncGroupRemoveTarget, syncGroupsActions.syncGroupAddTarget];
|
|
1635
|
+
var mapPresetChangeActions = [layerActions.setBaseLayers, layerActions.layerDelete, layerActions.addLayer, layerActions.duplicateMapLayer, layerActions.layerChangeEnabled, layerActions.layerChangeName, layerActions.layerChangeStyle, layerActions.layerChangeOpacity, layerActions.layerChangeDimension, layerActions.layerChangeAcceptanceTime, layerActions.SetLayerLegendVisibilityPayload, mapActions.layerMoveLayer, mapActions.setAutoLayerId, mapActions.setAutoTimestepLayerId, mapActions.setAutoUpdateLayerId, mapActions.toggleAutoUpdate, mapActions.mapStartAnimation, mapActions.mapStopAnimation, mapActions.toggleTimeSliderIsVisible, mapActions.setTimeStep, mapActions.setTimeSliderSpan, mapActions.toggleTimeSpanAuto, mapActions.setAnimationDelay, mapActions.toggleTimestepAuto, mapActions.setAnimationStartTime, mapActions.setAnimationEndTime, mapActions.setAnimationLength, mapActions.changeOverlayer, uiActions.setActiveMapIdForDialog, uiActions.setToggleOpenDialog, genericActions.setBbox, mapActions.setBbox, mapActions.toggleClock, mapActions.toggleClockOptions, mapActions.setClockPositionSize, mapActions.setLegendPositionSize, mapActions.setDockedLayerManagerSize, mapActions.setDockedLayerManagerPosition, mapActions.setDockedLayerManagerDimensions];
|
|
1636
|
+
var pluginPresetChangeActions = [pluginsActions.setGeoWebPluginState];
|
|
1637
|
+
var timeSeriesPresetChangeActions = [timeSeriesActions.addParameter, timeSeriesActions.addPlot, timeSeriesActions.duplicatePlot, timeSeriesActions.deleteParameter, timeSeriesActions.deletePlot, timeSeriesActions.moveParameter, timeSeriesActions.movePlot, timeSeriesActions.toggleParameter, timeSeriesActions.togglePlot, timeSeriesActions.patchParameter, timeSeriesActions.updateTitle, timeSeriesActions.setLocationMenuSizeAndPosition, timeSeriesActions.setLocationsDialogOpen, timeSeriesActions.reorderPlots, timeSeriesActions.setPlotIsOpen, timeSeriesActions.setPlotSize];
|
|
1638
|
+
var soundingsChangeActions = [soundingsActions.updateSelectedSource, soundingsActions.updateSelectedLocation, soundingsActions.updateDiagramType, soundingsActions.toggleLocationMarkers, soundingsActions.updateProfileDataPreferences, soundingsActions.changeSoundingPanelOrder, soundingsActions.toggleSoundingPanelVisibility, soundingsActions.setPanelIsOpen, soundingsActions.setPanelCustomWidth, soundingsActions.toggleLegendVisibility, soundingsActions.updateSelectedTime, soundingsActions.toggleTimeSliderVisibility, soundingsActions.setLocationMenuSizeAndPosition, soundingsActions.setLocationsMenuOpen];
|
|
1639
|
+
var crossSectionChangeActions = [crossSectionActions.setTemporalMode, crossSectionActions.setLegendVisibility];
|
|
1640
|
+
var supportedMapActionOrigins = [layerTypes.LayerActionOrigin.layerManager, layerTypes.LayerActionOrigin.legend, layerTypes.LayerActionOrigin.wmsLoader, mapEnums.MapActionOrigin.map];
|
|
1641
|
+
var supportedTimeSeriesActionOrigins = [TimeSeriesTypes.TimeSeriesActionOrigin.timeSeriesManager, TimeSeriesTypes.TimeSeriesActionOrigin.timeSeriesSelect];
|
|
1642
|
+
var supportedSoundingsActionOrigins = [SoundingsTypes.SoundingsActionOrigin.soundingsComponent, SoundingsTypes.SoundingsActionOrigin.soundingsManager];
|
|
1643
|
+
var supportedCrossSectionActionOrigins = [CrossSectionTypes.CrossSectionActionOrigin.crossSectionComponent, CrossSectionTypes.CrossSectionActionOrigin.crossSectionManager];
|
|
1644
|
+
var slice$1 = createSlice({
|
|
1645
|
+
initialState: initialState$1,
|
|
1646
|
+
name: 'viewPresets',
|
|
1647
|
+
reducers: {
|
|
1648
|
+
// fetch list actions
|
|
1649
|
+
fetchViewPresets: function fetchViewPresets(draft, action) {
|
|
1650
|
+
var panelId = action.payload.panelId;
|
|
1651
|
+
var entity = draft.entities[panelId];
|
|
1652
|
+
if (entity) {
|
|
1653
|
+
entity.isFetching = true;
|
|
1654
|
+
entity.error = undefined;
|
|
1655
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
1656
|
+
}
|
|
1657
|
+
},
|
|
1658
|
+
fetchedViewPreset: function fetchedViewPreset(draft, action) {
|
|
1659
|
+
var _action$payload = action.payload,
|
|
1660
|
+
panelId = _action$payload.panelId,
|
|
1661
|
+
mapPresetId = _action$payload.viewPresetId;
|
|
1662
|
+
var entity = draft.entities[panelId];
|
|
1663
|
+
if (entity) {
|
|
1664
|
+
entity.isFetching = false;
|
|
1665
|
+
entity.activeViewPresetId = mapPresetId;
|
|
1666
|
+
entity.hasChanges = false;
|
|
1667
|
+
entity.error = undefined;
|
|
1668
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
1669
|
+
}
|
|
1670
|
+
},
|
|
1671
|
+
saveViewPreset: function saveViewPreset(draft, action) {
|
|
1672
|
+
var panelId = action.payload.panelId;
|
|
1673
|
+
var entity = draft.entities[panelId];
|
|
1674
|
+
if (entity) {
|
|
1675
|
+
entity.isFetching = true;
|
|
1676
|
+
entity.error = undefined;
|
|
1677
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
1678
|
+
}
|
|
1679
|
+
},
|
|
1680
|
+
savedViewPreset: function savedViewPreset(draft, action) {
|
|
1681
|
+
var _action$payload2 = action.payload,
|
|
1682
|
+
panelId = _action$payload2.panelId,
|
|
1683
|
+
viewPresetId = _action$payload2.viewPresetId;
|
|
1684
|
+
var entity = draft.entities[panelId];
|
|
1685
|
+
if (entity) {
|
|
1686
|
+
entity.isFetching = false;
|
|
1687
|
+
entity.hasChanges = false;
|
|
1688
|
+
entity.activeViewPresetId = viewPresetId;
|
|
1689
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
1690
|
+
}
|
|
1691
|
+
},
|
|
1692
|
+
errorViewPreset: function errorViewPreset(draft, action) {
|
|
1693
|
+
var _action$payload3 = action.payload,
|
|
1694
|
+
panelId = _action$payload3.panelId,
|
|
1695
|
+
error = _action$payload3.error;
|
|
1696
|
+
var entity = draft.entities[panelId];
|
|
1697
|
+
if (entity) {
|
|
1698
|
+
entity.error = error;
|
|
1699
|
+
entity.isFetching = false;
|
|
1700
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
1701
|
+
}
|
|
1702
|
+
},
|
|
1703
|
+
// map actions
|
|
1704
|
+
setViewPresetHasChanges: function setViewPresetHasChanges(draft, action) {
|
|
1705
|
+
var _action$payload4 = action.payload,
|
|
1706
|
+
panelId = _action$payload4.panelId,
|
|
1707
|
+
hasChanges = _action$payload4.hasChanges;
|
|
1708
|
+
var entity = draft.entities[panelId];
|
|
1709
|
+
if (entity) {
|
|
1710
|
+
entity.hasChanges = hasChanges;
|
|
1711
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
1712
|
+
}
|
|
1713
|
+
},
|
|
1714
|
+
setViewPresetInline: function setViewPresetInline(draft, action) {
|
|
1715
|
+
var _action$payload5 = action.payload,
|
|
1716
|
+
panelId = _action$payload5.panelId,
|
|
1717
|
+
isInline = _action$payload5.isInline;
|
|
1718
|
+
var entity = draft.entities[panelId];
|
|
1719
|
+
if (entity) {
|
|
1720
|
+
if (isInline) {
|
|
1721
|
+
entity.activeViewPresetId = '';
|
|
1864
1722
|
}
|
|
1723
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
1865
1724
|
}
|
|
1866
1725
|
},
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
|
|
1726
|
+
setActiveViewPresetId: function setActiveViewPresetId(draft, action) {
|
|
1727
|
+
var _action$payload6 = action.payload,
|
|
1728
|
+
panelId = _action$payload6.panelId,
|
|
1729
|
+
mapPresetId = _action$payload6.viewPresetId;
|
|
1730
|
+
var entity = draft.entities[panelId];
|
|
1731
|
+
if (entity) {
|
|
1732
|
+
entity.activeViewPresetId = mapPresetId;
|
|
1733
|
+
entity.hasChanges = false;
|
|
1734
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
1735
|
+
}
|
|
1736
|
+
},
|
|
1737
|
+
selectViewPreset: function selectViewPreset(draft, action) {
|
|
1738
|
+
var _action$payload7 = action.payload,
|
|
1739
|
+
panelId = _action$payload7.panelId,
|
|
1740
|
+
mapPresetId = _action$payload7.viewPresetId;
|
|
1741
|
+
var entity = draft.entities[panelId];
|
|
1742
|
+
if (entity) {
|
|
1743
|
+
// only update activeMapPresetId after selecting a NEW preset
|
|
1744
|
+
// existing mapPresets are getting an activeMapPresetId after a succesfull fetch
|
|
1745
|
+
if (mapPresetId === '') {
|
|
1746
|
+
entity.activeViewPresetId = '';
|
|
1747
|
+
entity.error = undefined;
|
|
1886
1748
|
}
|
|
1749
|
+
entity.isViewPresetListDialogOpen = false;
|
|
1750
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
1887
1751
|
}
|
|
1888
1752
|
},
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
}
|
|
1899
|
-
customEmptyMapWorkspace.views.byId['1_screen'].title = emptyMapWorkspaceTitle;
|
|
1900
|
-
var emptyWorkspacePreset = Object.assign({}, customEmptyMapWorkspace, {
|
|
1901
|
-
title: emptyWorkspaceTitle
|
|
1902
|
-
});
|
|
1903
|
-
return emptyWorkspacePreset;
|
|
1904
|
-
};
|
|
1905
|
-
var FALLBACK_TEMPLATE_LANGUAGE = 'en';
|
|
1906
|
-
// Falls back to English and then to the first title, so a template does not
|
|
1907
|
-
// need a title for every language
|
|
1908
|
-
var getTemplatePresetTitle = function getTemplatePresetTitle(title, language) {
|
|
1909
|
-
var _language, _Object$values$;
|
|
1910
|
-
if (language === void 0) {
|
|
1911
|
-
language = i18n.language;
|
|
1912
|
-
}
|
|
1913
|
-
if (typeof title === 'string') {
|
|
1914
|
-
return title;
|
|
1915
|
-
}
|
|
1916
|
-
var languageCode = [language, (_language = language) == null ? void 0 : _language.split('-')[0], FALLBACK_TEMPLATE_LANGUAGE].find(function (code) {
|
|
1917
|
-
return code && title[code];
|
|
1918
|
-
});
|
|
1919
|
-
return languageCode ? title[languageCode] : (_Object$values$ = Object.values(title)[0]) != null ? _Object$values$ : '';
|
|
1920
|
-
};
|
|
1921
|
-
var findWorkspaceTemplatePreset = function findWorkspaceTemplatePreset(defaultPresets, presetId) {
|
|
1922
|
-
return (defaultPresets != null ? defaultPresets : []).find(function (preset) {
|
|
1923
|
-
return (preset.id || undefined) === (presetId || undefined);
|
|
1924
|
-
});
|
|
1925
|
-
};
|
|
1926
|
-
var isWorkspaceTemplatePresetId = function isWorkspaceTemplatePresetId(defaultPresets, presetId) {
|
|
1927
|
-
return findWorkspaceTemplatePreset(defaultPresets, presetId) !== undefined;
|
|
1928
|
-
};
|
|
1929
|
-
var toWorkspacePresetFromTemplate = function toWorkspacePresetFromTemplate(preset, language) {
|
|
1930
|
-
var views = preset.views,
|
|
1931
|
-
rest = _objectWithoutPropertiesLoose(preset, _excluded$7);
|
|
1932
|
-
return Object.assign({}, rest, {
|
|
1933
|
-
title: getTemplatePresetTitle(preset.title, language),
|
|
1934
|
-
views: {
|
|
1935
|
-
allIds: views.allIds,
|
|
1936
|
-
byId: Object.fromEntries(views.allIds.map(function (viewId) {
|
|
1937
|
-
var view = views.byId[viewId];
|
|
1938
|
-
return [viewId, Object.assign({}, view, {
|
|
1939
|
-
title: view.title === undefined ? undefined : getTemplatePresetTitle(view.title, language)
|
|
1940
|
-
})];
|
|
1941
|
-
}))
|
|
1942
|
-
}
|
|
1943
|
-
});
|
|
1944
|
-
};
|
|
1945
|
-
var getEmptyMapWorkspaceTitles = function getEmptyMapWorkspaceTitles(preset, language) {
|
|
1946
|
-
var _views$byId$views$all, _views$byId$views$all2;
|
|
1947
|
-
var _toWorkspacePresetFro = toWorkspacePresetFromTemplate(preset, language),
|
|
1948
|
-
title = _toWorkspacePresetFro.title,
|
|
1949
|
-
views = _toWorkspacePresetFro.views;
|
|
1950
|
-
return {
|
|
1951
|
-
newWorkspaceText: title,
|
|
1952
|
-
newMapPresetText: (_views$byId$views$all = (_views$byId$views$all2 = views.byId[views.allIds[0]]) == null ? void 0 : _views$byId$views$all2.title) != null ? _views$byId$views$all : title
|
|
1953
|
-
};
|
|
1954
|
-
};
|
|
1955
|
-
var toWorkspaceTemplateListItem = function toWorkspaceTemplateListItem(preset, language) {
|
|
1956
|
-
var _preset$scope, _preset$abstract, _preset$viewType;
|
|
1957
|
-
return {
|
|
1958
|
-
id: preset.id,
|
|
1959
|
-
title: getTemplatePresetTitle(preset.title, language),
|
|
1960
|
-
labels: preset.labels,
|
|
1961
|
-
scope: (_preset$scope = preset.scope) != null ? _preset$scope : 'system',
|
|
1962
|
-
"abstract": (_preset$abstract = preset["abstract"]) != null ? _preset$abstract : '',
|
|
1963
|
-
viewType: (_preset$viewType = preset.viewType) != null ? _preset$viewType : 'singleWindow',
|
|
1964
|
-
isWorkspaceTemplate: true
|
|
1965
|
-
};
|
|
1966
|
-
};
|
|
1967
|
-
var toWorkspaceTemplateListItems = function toWorkspaceTemplateListItems(defaultPresets, language) {
|
|
1968
|
-
return (defaultPresets != null ? defaultPresets : []).map(function (preset) {
|
|
1969
|
-
return toWorkspaceTemplateListItem(preset, language);
|
|
1970
|
-
});
|
|
1971
|
-
};
|
|
1972
|
-
var getBEViewsFromState = function getBEViewsFromState(workspace) {
|
|
1973
|
-
var _workspace$views$allI, _workspace$views;
|
|
1974
|
-
var result = [];
|
|
1975
|
-
((_workspace$views$allI = workspace == null || (_workspace$views = workspace.views) == null ? void 0 : _workspace$views.allIds) != null ? _workspace$views$allI : []).forEach(function (id) {
|
|
1976
|
-
var _workspace$views$byId;
|
|
1977
|
-
var view = (_workspace$views$byId = workspace.views.byId[id]) != null ? _workspace$views$byId : {};
|
|
1978
|
-
result.push({
|
|
1979
|
-
mosaicNodeId: id,
|
|
1980
|
-
title: typeof view.title === 'string' && view.title.trim() ? view.title : id,
|
|
1981
|
-
componentType: view.componentType,
|
|
1982
|
-
initialProps: view.initialProps
|
|
1983
|
-
});
|
|
1984
|
-
});
|
|
1985
|
-
return result;
|
|
1986
|
-
};
|
|
1987
|
-
var togglePresetFilter = function togglePresetFilter(filters, id, isSelected, isAdmin, isFavouritesEnabled, isTemplatesEnabled) {
|
|
1988
|
-
if (isAdmin === void 0) {
|
|
1989
|
-
isAdmin = false;
|
|
1990
|
-
}
|
|
1991
|
-
if (isFavouritesEnabled === void 0) {
|
|
1992
|
-
isFavouritesEnabled = true;
|
|
1993
|
-
}
|
|
1994
|
-
if (isTemplatesEnabled === void 0) {
|
|
1995
|
-
isTemplatesEnabled = true;
|
|
1996
|
-
}
|
|
1997
|
-
if (!filters.some(function (filter) {
|
|
1998
|
-
return filter.id === id;
|
|
1999
|
-
})) {
|
|
2000
|
-
return filters;
|
|
2001
|
-
}
|
|
2002
|
-
var availableFilters = filters.filter(function (filter) {
|
|
2003
|
-
if (filter.id === PresetFilterType.favourites) {
|
|
2004
|
-
return isFavouritesEnabled;
|
|
2005
|
-
}
|
|
2006
|
-
if (filter.id === PresetFilterType.templates && !isTemplatesEnabled) {
|
|
2007
|
-
return false;
|
|
2008
|
-
}
|
|
2009
|
-
return !isAdmin || filter.id === PresetFilterType.system || filter.id === PresetFilterType.shared || filter.id === PresetFilterType.templates;
|
|
2010
|
-
});
|
|
2011
|
-
var allSelected = availableFilters.every(function (filter) {
|
|
2012
|
-
return filter.isSelected;
|
|
2013
|
-
});
|
|
2014
|
-
var allUnselected = availableFilters.every(function (filter) {
|
|
2015
|
-
return filter.id === id ? !isSelected : !filter.isSelected;
|
|
2016
|
-
});
|
|
2017
|
-
return filters.map(function (filter) {
|
|
2018
|
-
if (allSelected) {
|
|
2019
|
-
return Object.assign({}, filter, {
|
|
2020
|
-
isSelected: filter.id === id && isSelected
|
|
2021
|
-
});
|
|
2022
|
-
}
|
|
2023
|
-
// Admins select one scope at a time, deselecting goes through the
|
|
2024
|
-
// regular flow so the last deselected chip falls back to all
|
|
2025
|
-
if (isAdmin && isSelected && id !== PresetFilterType.favourites && filter.id !== PresetFilterType.favourites) {
|
|
2026
|
-
return Object.assign({}, filter, {
|
|
2027
|
-
isSelected: filter.id === id
|
|
2028
|
-
});
|
|
2029
|
-
}
|
|
2030
|
-
return Object.assign({}, filter, {
|
|
2031
|
-
isSelected: allUnselected || (filter.id === id ? isSelected : filter.isSelected)
|
|
2032
|
-
});
|
|
2033
|
-
});
|
|
2034
|
-
};
|
|
2035
|
-
|
|
2036
|
-
/* *
|
|
2037
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2038
|
-
* you may not use this file except in compliance with the License.
|
|
2039
|
-
* You may obtain a copy of the License at
|
|
2040
|
-
*
|
|
2041
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2042
|
-
*
|
|
2043
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2044
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2045
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2046
|
-
* See the License for the specific language governing permissions and
|
|
2047
|
-
* limitations under the License.
|
|
2048
|
-
*
|
|
2049
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2050
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2051
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2052
|
-
* */
|
|
2053
|
-
var personalFilterState = {
|
|
2054
|
-
label: 'shared-filter-my-presets',
|
|
2055
|
-
id: PresetFilterType.personal,
|
|
2056
|
-
isSelected: true,
|
|
2057
|
-
isDisabled: false
|
|
2058
|
-
};
|
|
2059
|
-
var systemFilterState = {
|
|
2060
|
-
label: 'shared-filter-system-presets',
|
|
2061
|
-
id: PresetFilterType.system,
|
|
2062
|
-
isSelected: true,
|
|
2063
|
-
isDisabled: false
|
|
2064
|
-
};
|
|
2065
|
-
var sharedFilterState = {
|
|
2066
|
-
label: 'shared-filter-shared-presets',
|
|
2067
|
-
id: PresetFilterType.shared,
|
|
2068
|
-
isSelected: true,
|
|
2069
|
-
isDisabled: false
|
|
2070
|
-
};
|
|
2071
|
-
({
|
|
2072
|
-
id: PresetFilterType.plugin});
|
|
2073
|
-
var templatesFilterState = {
|
|
2074
|
-
label: 'shared-filter-template-presets',
|
|
2075
|
-
id: PresetFilterType.templates,
|
|
2076
|
-
isSelected: true,
|
|
2077
|
-
isDisabled: false
|
|
2078
|
-
};
|
|
2079
|
-
var favouriteFilterState = {
|
|
2080
|
-
label: 'workspace-favourites',
|
|
2081
|
-
id: PresetFilterType.favourites,
|
|
2082
|
-
isSelected: true,
|
|
2083
|
-
isDisabled: false
|
|
2084
|
-
};
|
|
2085
|
-
var defaultPresetFilterState = [personalFilterState, systemFilterState, sharedFilterState, templatesFilterState, favouriteFilterState];
|
|
2086
|
-
var ADMIN_WORKSPACE_FILTER_IDS = [PresetFilterType.system, PresetFilterType.shared, PresetFilterType.templates, PresetFilterType.favourites];
|
|
2087
|
-
var initialState$2 = {
|
|
2088
|
-
error: undefined,
|
|
2089
|
-
isWorkspaceListDialogOpen: false,
|
|
2090
|
-
searchQuery: '',
|
|
2091
|
-
workspaceListFilters: defaultPresetFilterState,
|
|
2092
|
-
workspaceLabelFilters: undefined
|
|
2093
|
-
};
|
|
2094
|
-
var slice$2 = createSlice({
|
|
2095
|
-
initialState: initialState$2,
|
|
2096
|
-
name: 'workspaceList',
|
|
2097
|
-
reducers: {
|
|
2098
|
-
openWorkspaceActionDialogOptions: function openWorkspaceActionDialogOptions(draft, action) {
|
|
2099
|
-
draft.workspaceActionDialog = Object.assign({}, action.payload, {
|
|
2100
|
-
error: undefined
|
|
2101
|
-
});
|
|
2102
|
-
},
|
|
2103
|
-
onSuccessWorkspaceSaveDialog: function onSuccessWorkspaceSaveDialog(draft, action) {
|
|
2104
|
-
if (!draft.workspaceActionDialog) {
|
|
2105
|
-
return;
|
|
2106
|
-
}
|
|
2107
|
-
var presetId = action.payload.presetId;
|
|
2108
|
-
if (presetId) {
|
|
2109
|
-
draft.workspaceActionDialog.presetId = presetId;
|
|
2110
|
-
}
|
|
2111
|
-
draft.workspaceActionDialog.hasSaved = true;
|
|
2112
|
-
},
|
|
2113
|
-
submitFormWorkspaceActionDialogOptions: function submitFormWorkspaceActionDialogOptions(draft, _action) {
|
|
2114
|
-
if (!draft.workspaceActionDialog) {
|
|
2115
|
-
return;
|
|
1753
|
+
// the view itself is replaced in viewPresets/listener
|
|
1754
|
+
selectViewTemplate: function selectViewTemplate(draft, action) {
|
|
1755
|
+
var panelId = action.payload.panelId;
|
|
1756
|
+
var entity = draft.entities[panelId];
|
|
1757
|
+
if (entity) {
|
|
1758
|
+
entity.activeViewPresetId = '';
|
|
1759
|
+
entity.error = undefined;
|
|
1760
|
+
entity.isViewPresetListDialogOpen = false;
|
|
1761
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
2116
1762
|
}
|
|
2117
|
-
draft.workspaceActionDialog.error = undefined;
|
|
2118
1763
|
},
|
|
2119
|
-
|
|
2120
|
-
|
|
1764
|
+
selectViewPlugin: function selectViewPlugin(draft, action) {
|
|
1765
|
+
var _action$payload8 = action.payload,
|
|
1766
|
+
panelId = _action$payload8.panelId,
|
|
1767
|
+
pluginMetaData = _action$payload8.pluginMetaData;
|
|
1768
|
+
var entity = draft.entities[panelId];
|
|
1769
|
+
entity.activeViewPresetId = (pluginMetaData == null ? void 0 : pluginMetaData.id) || '';
|
|
1770
|
+
entity.error = undefined;
|
|
1771
|
+
entity.isViewPresetListDialogOpen = false;
|
|
2121
1772
|
},
|
|
2122
1773
|
// action is intercepted in mapPresets/listener
|
|
2123
|
-
|
|
2124
|
-
|
|
1774
|
+
onSuccessViewPresetAction: function onSuccessViewPresetAction(_draft, _action) {},
|
|
1775
|
+
registerViewPreset: function registerViewPreset(draft, action) {
|
|
1776
|
+
var _action$payload9 = action.payload,
|
|
1777
|
+
mapId = _action$payload9.panelId,
|
|
1778
|
+
mapPresetId = _action$payload9.viewPresetId,
|
|
1779
|
+
filters = _action$payload9.filters;
|
|
1780
|
+
viewPresetsAdapter.setOne(draft, {
|
|
1781
|
+
panelId: mapId,
|
|
1782
|
+
activeViewPresetId: mapPresetId,
|
|
1783
|
+
hasChanges: false,
|
|
1784
|
+
isFetching: false,
|
|
1785
|
+
error: undefined,
|
|
1786
|
+
isViewPresetListDialogOpen: false,
|
|
1787
|
+
filters: filters != null ? filters : defaultViewPresetsFilters,
|
|
1788
|
+
searchQuery: '',
|
|
1789
|
+
filterResults: {
|
|
1790
|
+
ids: [],
|
|
1791
|
+
entities: {}
|
|
1792
|
+
}
|
|
1793
|
+
});
|
|
2125
1794
|
},
|
|
2126
|
-
|
|
2127
|
-
var
|
|
2128
|
-
|
|
2129
|
-
draft.workspaceActionDialog.error = error;
|
|
2130
|
-
} else {
|
|
2131
|
-
// fallback if dialog isn't open (e.g. SHARE action)
|
|
2132
|
-
draft.error = error;
|
|
2133
|
-
}
|
|
1795
|
+
unregisterViewPreset: function unregisterViewPreset(draft, action) {
|
|
1796
|
+
var panelId = action.payload.panelId;
|
|
1797
|
+
viewPresetsAdapter.removeOne(draft, panelId);
|
|
2134
1798
|
},
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
1799
|
+
// dialog actions
|
|
1800
|
+
openViewPresetDialog: function openViewPresetDialog(draft, action) {
|
|
1801
|
+
var viewPresetDialog = action.payload.viewPresetDialog;
|
|
1802
|
+
draft.viewPresetDialog = viewPresetDialog;
|
|
2138
1803
|
},
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
id = _action$payload.id,
|
|
2142
|
-
isSelected = _action$payload.isSelected,
|
|
2143
|
-
isAdmin = _action$payload.isAdmin,
|
|
2144
|
-
isFavouritesEnabled = _action$payload.isFavouritesEnabled,
|
|
2145
|
-
isTemplatesEnabled = _action$payload.isTemplatesEnabled;
|
|
2146
|
-
draft.workspaceListFilters = togglePresetFilter(draft.workspaceListFilters, id, isSelected, isAdmin, isFavouritesEnabled, isTemplatesEnabled);
|
|
1804
|
+
closeViewPresetDialog: function closeViewPresetDialog(draft) {
|
|
1805
|
+
delete draft.viewPresetDialog;
|
|
2147
1806
|
},
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
1807
|
+
toggleViewPresetListDialog: function toggleViewPresetListDialog(draft, action) {
|
|
1808
|
+
var _action$payload0 = action.payload,
|
|
1809
|
+
isViewPresetDialogOpen = _action$payload0.isViewPresetListDialogOpen,
|
|
1810
|
+
panelId = _action$payload0.panelId;
|
|
1811
|
+
var entity = draft.entities[panelId];
|
|
1812
|
+
if (entity) {
|
|
1813
|
+
entity.isViewPresetListDialogOpen = isViewPresetDialogOpen;
|
|
1814
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
1815
|
+
}
|
|
2154
1816
|
},
|
|
2155
|
-
|
|
2156
|
-
var
|
|
2157
|
-
|
|
2158
|
-
|
|
1817
|
+
toggleSelectFilterChip: function toggleSelectFilterChip(draft, action) {
|
|
1818
|
+
var _action$payload1 = action.payload,
|
|
1819
|
+
id = _action$payload1.id,
|
|
1820
|
+
isSelected = _action$payload1.isSelected,
|
|
1821
|
+
panelId = _action$payload1.panelId,
|
|
1822
|
+
isAdmin = _action$payload1.isAdmin,
|
|
1823
|
+
isFavouritesEnabled = _action$payload1.isFavouritesEnabled;
|
|
1824
|
+
var entity = draft.entities[panelId];
|
|
1825
|
+
if (entity) {
|
|
1826
|
+
entity.filters = togglePresetFilter(entity.filters, id, isSelected, isAdmin, isFavouritesEnabled);
|
|
1827
|
+
}
|
|
1828
|
+
},
|
|
1829
|
+
setSelectAllFilterChip: function setSelectAllFilterChip(draft, action) {
|
|
1830
|
+
var panelId = action.payload.panelId;
|
|
1831
|
+
var entity = draft.entities[panelId];
|
|
1832
|
+
if (entity) {
|
|
1833
|
+
entity.filters = entity.filters.map(function (filter) {
|
|
1834
|
+
return Object.assign({}, filter, {
|
|
1835
|
+
isSelected: true
|
|
1836
|
+
});
|
|
1837
|
+
});
|
|
1838
|
+
}
|
|
1839
|
+
},
|
|
1840
|
+
setFilterChips: function setFilterChips(draft, action) {
|
|
1841
|
+
var _action$payload10 = action.payload,
|
|
1842
|
+
panelId = _action$payload10.panelId,
|
|
1843
|
+
filters = _action$payload10.filters;
|
|
1844
|
+
var entity = draft.entities[panelId];
|
|
1845
|
+
if (!entity) {
|
|
1846
|
+
return;
|
|
1847
|
+
}
|
|
1848
|
+
entity.filters.forEach(function (filter, index) {
|
|
1849
|
+
var existingFilter = filters.find(function (existingFilter) {
|
|
2159
1850
|
return existingFilter.id === filter.id;
|
|
2160
1851
|
});
|
|
2161
1852
|
var updatedFilter = Object.assign({}, filter, {
|
|
2162
1853
|
isSelected: existingFilter ? existingFilter.isSelected : filter.isSelected
|
|
2163
1854
|
});
|
|
2164
|
-
|
|
1855
|
+
entity.filters[index] = updatedFilter;
|
|
2165
1856
|
});
|
|
2166
1857
|
},
|
|
2167
|
-
setWorkspaceLabelFilters: function setWorkspaceLabelFilters(draft, action) {
|
|
2168
|
-
draft.workspaceLabelFilters = action.payload.labels;
|
|
2169
|
-
},
|
|
2170
|
-
clearLabelFilters: function clearLabelFilters(draft) {
|
|
2171
|
-
draft.workspaceLabelFilters = undefined;
|
|
2172
|
-
},
|
|
2173
1858
|
searchFilter: function searchFilter(draft, action) {
|
|
2174
|
-
var
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
}
|
|
2178
|
-
});
|
|
2179
|
-
var workspaceListReducer = slice$2.reducer,
|
|
2180
|
-
workspaceListActions = slice$2.actions;
|
|
2181
|
-
|
|
2182
|
-
/* *
|
|
2183
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2184
|
-
* you may not use this file except in compliance with the License.
|
|
2185
|
-
* You may obtain a copy of the License at
|
|
2186
|
-
*
|
|
2187
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2188
|
-
*
|
|
2189
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2190
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2191
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2192
|
-
* See the License for the specific language governing permissions and
|
|
2193
|
-
* limitations under the License.
|
|
2194
|
-
*
|
|
2195
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2196
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2197
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2198
|
-
* */
|
|
2199
|
-
var defaultViewPresetsFilters = [{
|
|
2200
|
-
label: 'shared-filter-my-view-presets',
|
|
2201
|
-
id: PresetFilterType.personal,
|
|
2202
|
-
isSelected: true,
|
|
2203
|
-
isDisabled: false
|
|
2204
|
-
}, {
|
|
2205
|
-
label: 'shared-filter-system-view-presets',
|
|
2206
|
-
id: PresetFilterType.system,
|
|
2207
|
-
isSelected: true,
|
|
2208
|
-
isDisabled: false
|
|
2209
|
-
}, {
|
|
2210
|
-
label: 'shared-filter-shared-view-presets',
|
|
2211
|
-
id: PresetFilterType.shared,
|
|
2212
|
-
isSelected: true,
|
|
2213
|
-
isDisabled: false
|
|
2214
|
-
}, {
|
|
2215
|
-
label: 'shared-filter-template-presets',
|
|
2216
|
-
id: PresetFilterType.templates,
|
|
2217
|
-
isSelected: true,
|
|
2218
|
-
isDisabled: false
|
|
2219
|
-
}, favouriteFilterState];
|
|
2220
|
-
var ADMIN_VIEW_PRESET_FILTER_IDS = [PresetFilterType.system, PresetFilterType.shared, PresetFilterType.templates, PresetFilterType.favourites];
|
|
2221
|
-
var pluginViewPresetsFilter = {
|
|
2222
|
-
label: 'shared-filter-plugin-view-presets',
|
|
2223
|
-
id: PresetFilterType.plugin,
|
|
2224
|
-
isSelected: true,
|
|
2225
|
-
isDisabled: false
|
|
2226
|
-
};
|
|
2227
|
-
var viewPresetsAdapter = createEntityAdapter({
|
|
2228
|
-
// we use panelId as id (panelId can be mapId or viewId)
|
|
2229
|
-
selectId: function selectId(mapPreset) {
|
|
2230
|
-
return mapPreset.panelId;
|
|
2231
|
-
}
|
|
2232
|
-
});
|
|
2233
|
-
var initialState$1 = viewPresetsAdapter.getInitialState();
|
|
2234
|
-
var warningsPresetChangeActions = [warningsFiltersActions.setWarningFilters, warningsFiltersActions.setExpandedSectionsForPanel];
|
|
2235
|
-
var syncGroupChangeActions = [syncGroupsActions.syncGroupRemoveTarget, syncGroupsActions.syncGroupAddTarget];
|
|
2236
|
-
var mapPresetChangeActions = [layerActions.setBaseLayers, layerActions.layerDelete, layerActions.addLayer, layerActions.duplicateMapLayer, layerActions.layerChangeEnabled, layerActions.layerChangeName, layerActions.layerChangeStyle, layerActions.layerChangeOpacity, layerActions.layerChangeDimension, layerActions.layerChangeAcceptanceTime, layerActions.SetLayerLegendVisibilityPayload, mapActions.layerMoveLayer, mapActions.setAutoLayerId, mapActions.setAutoTimestepLayerId, mapActions.setAutoUpdateLayerId, mapActions.toggleAutoUpdate, mapActions.mapStartAnimation, mapActions.mapStopAnimation, mapActions.toggleTimeSliderIsVisible, mapActions.setTimeStep, mapActions.setTimeSliderSpan, mapActions.toggleTimeSpanAuto, mapActions.setAnimationDelay, mapActions.toggleTimestepAuto, mapActions.setAnimationStartTime, mapActions.setAnimationEndTime, mapActions.setAnimationLength, mapActions.changeOverlayer, uiActions.setActiveMapIdForDialog, uiActions.setToggleOpenDialog, genericActions.setBbox, mapActions.setBbox, mapActions.toggleClock, mapActions.toggleClockOptions, mapActions.setClockPositionSize, mapActions.setLegendPositionSize, mapActions.setDockedLayerManagerSize, mapActions.setDockedLayerManagerPosition, mapActions.setDockedLayerManagerDimensions];
|
|
2237
|
-
var pluginPresetChangeActions = [pluginsActions.setGeoWebPluginState];
|
|
2238
|
-
var timeSeriesPresetChangeActions = [timeSeriesActions.addParameter, timeSeriesActions.addPlot, timeSeriesActions.duplicatePlot, timeSeriesActions.deleteParameter, timeSeriesActions.deletePlot, timeSeriesActions.moveParameter, timeSeriesActions.movePlot, timeSeriesActions.toggleParameter, timeSeriesActions.togglePlot, timeSeriesActions.patchParameter, timeSeriesActions.updateTitle, timeSeriesActions.setLocationMenuSizeAndPosition, timeSeriesActions.setLocationsDialogOpen, timeSeriesActions.reorderPlots, timeSeriesActions.setPlotIsOpen, timeSeriesActions.setPlotSize];
|
|
2239
|
-
var soundingsChangeActions = [soundingsActions.updateSelectedSource, soundingsActions.updateSelectedLocation, soundingsActions.updateDiagramType, soundingsActions.toggleLocationMarkers, soundingsActions.updateProfileDataPreferences, soundingsActions.changeSoundingPanelOrder, soundingsActions.toggleSoundingPanelVisibility, soundingsActions.setPanelIsOpen, soundingsActions.setPanelCustomWidth, soundingsActions.toggleLegendVisibility, soundingsActions.updateSelectedTime, soundingsActions.toggleTimeSliderVisibility, soundingsActions.setLocationMenuSizeAndPosition, soundingsActions.setLocationsMenuOpen];
|
|
2240
|
-
var supportedMapActionOrigins = [layerTypes.LayerActionOrigin.layerManager, layerTypes.LayerActionOrigin.legend, layerTypes.LayerActionOrigin.wmsLoader, mapEnums.MapActionOrigin.map];
|
|
2241
|
-
var supportedTimeSeriesActionOrigins = [TimeSeriesTypes.TimeSeriesActionOrigin.timeSeriesManager, TimeSeriesTypes.TimeSeriesActionOrigin.timeSeriesSelect];
|
|
2242
|
-
var supportedSoundingsActionOrigins = [SoundingsTypes.SoundingsActionOrigin.soundingsComponent, SoundingsTypes.SoundingsActionOrigin.soundingsManager];
|
|
2243
|
-
var slice$1 = createSlice({
|
|
2244
|
-
initialState: initialState$1,
|
|
2245
|
-
name: 'viewPresets',
|
|
2246
|
-
reducers: {
|
|
2247
|
-
// fetch list actions
|
|
2248
|
-
fetchViewPresets: function fetchViewPresets(draft, action) {
|
|
2249
|
-
var panelId = action.payload.panelId;
|
|
1859
|
+
var _action$payload11 = action.payload,
|
|
1860
|
+
searchQuery = _action$payload11.searchQuery,
|
|
1861
|
+
panelId = _action$payload11.panelId;
|
|
2250
1862
|
var entity = draft.entities[panelId];
|
|
2251
1863
|
if (entity) {
|
|
2252
|
-
entity.
|
|
2253
|
-
entity.error = undefined;
|
|
2254
|
-
viewPresetsAdapter.setOne(draft, entity);
|
|
1864
|
+
entity.searchQuery = searchQuery;
|
|
2255
1865
|
}
|
|
2256
1866
|
},
|
|
2257
|
-
|
|
2258
|
-
var _action$
|
|
2259
|
-
panelId = _action$
|
|
2260
|
-
|
|
1867
|
+
setViewPresetLabelFilters: function setViewPresetLabelFilters(draft, action) {
|
|
1868
|
+
var _action$payload12 = action.payload,
|
|
1869
|
+
panelId = _action$payload12.panelId,
|
|
1870
|
+
labels = _action$payload12.labels;
|
|
2261
1871
|
var entity = draft.entities[panelId];
|
|
2262
|
-
if (entity) {
|
|
2263
|
-
|
|
2264
|
-
entity.activeViewPresetId = mapPresetId;
|
|
2265
|
-
entity.hasChanges = false;
|
|
2266
|
-
entity.error = undefined;
|
|
2267
|
-
viewPresetsAdapter.setOne(draft, entity);
|
|
1872
|
+
if (!entity) {
|
|
1873
|
+
return;
|
|
2268
1874
|
}
|
|
1875
|
+
entity.labelFilters = labels;
|
|
1876
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
2269
1877
|
},
|
|
2270
|
-
|
|
1878
|
+
clearViewPresetLabelFilters: function clearViewPresetLabelFilters(draft, action) {
|
|
2271
1879
|
var panelId = action.payload.panelId;
|
|
2272
1880
|
var entity = draft.entities[panelId];
|
|
2273
|
-
if (entity) {
|
|
2274
|
-
|
|
2275
|
-
entity.error = undefined;
|
|
2276
|
-
viewPresetsAdapter.setOne(draft, entity);
|
|
1881
|
+
if (!entity) {
|
|
1882
|
+
return;
|
|
2277
1883
|
}
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
1884
|
+
entity.labelFilters = undefined;
|
|
1885
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
1886
|
+
}
|
|
1887
|
+
},
|
|
1888
|
+
extraReducers: function extraReducers(builder) {
|
|
1889
|
+
builder.addCase(mapActions.setMapPresetError, function (draft, action) {
|
|
1890
|
+
var _action$payload13 = action.payload,
|
|
1891
|
+
mapId = _action$payload13.mapId,
|
|
1892
|
+
error = _action$payload13.error;
|
|
1893
|
+
var entity = draft.entities[mapId];
|
|
2284
1894
|
if (entity) {
|
|
1895
|
+
entity.error = error ? {
|
|
1896
|
+
message: error,
|
|
1897
|
+
component: ViewPresetErrorComponent.PRESET_DETAIL,
|
|
1898
|
+
errorType: ViewPresetErrorType.GENERIC
|
|
1899
|
+
} : undefined;
|
|
2285
1900
|
entity.isFetching = false;
|
|
2286
|
-
entity.hasChanges = false;
|
|
2287
|
-
entity.activeViewPresetId = viewPresetId;
|
|
2288
1901
|
viewPresetsAdapter.setOne(draft, entity);
|
|
2289
1902
|
}
|
|
2290
|
-
}
|
|
2291
|
-
|
|
2292
|
-
var
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
viewPresetsAdapter.setOne(draft, entity);
|
|
1903
|
+
});
|
|
1904
|
+
builder.addCase(workspaceListActions.submitFormWorkspaceActionDialogOptions, function (draft, action) {
|
|
1905
|
+
var data = action.payload.data;
|
|
1906
|
+
if (data.views) {
|
|
1907
|
+
data.views.forEach(function (view) {
|
|
1908
|
+
if (draft.entities[view.mosaicNodeId]) {
|
|
1909
|
+
draft.entities[view.mosaicNodeId].error = undefined;
|
|
1910
|
+
}
|
|
1911
|
+
});
|
|
2300
1912
|
}
|
|
2301
|
-
}
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
entity.hasChanges = hasChanges;
|
|
2310
|
-
viewPresetsAdapter.setOne(draft, entity);
|
|
1913
|
+
});
|
|
1914
|
+
builder.addCase(workspaceListActions.onSuccessWorkspacePresetAction, function (draft, action) {
|
|
1915
|
+
var _action$payload14 = action.payload,
|
|
1916
|
+
wsAction = _action$payload14.action,
|
|
1917
|
+
views = _action$payload14.views;
|
|
1918
|
+
var shouldClear = wsAction === WorkspacePresetAction.SAVE || wsAction === WorkspacePresetAction.SAVE_AS || wsAction === WorkspacePresetAction.SAVE_SYSTEM_PRESET || wsAction === WorkspacePresetAction.SAVE_SYSTEM_PRESET_AS || wsAction === WorkspacePresetAction.EDIT;
|
|
1919
|
+
if (!shouldClear) {
|
|
1920
|
+
return;
|
|
2311
1921
|
}
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
1922
|
+
var viewIds = (views != null ? views : []).map(function (view) {
|
|
1923
|
+
return view.mosaicNodeId;
|
|
1924
|
+
}).filter(Boolean);
|
|
1925
|
+
if (viewIds.length) {
|
|
1926
|
+
viewIds.forEach(function (panelId) {
|
|
1927
|
+
var entity = draft.entities[panelId];
|
|
1928
|
+
if (entity) {
|
|
1929
|
+
entity.hasChanges = false;
|
|
1930
|
+
entity.activeViewPresetId = '';
|
|
1931
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
1932
|
+
}
|
|
1933
|
+
});
|
|
1934
|
+
return;
|
|
1935
|
+
}
|
|
1936
|
+
Object.values(draft.entities).forEach(function (entity) {
|
|
1937
|
+
if (entity) {
|
|
1938
|
+
// eslint-disable-next-line no-param-reassign
|
|
1939
|
+
entity.hasChanges = false;
|
|
1940
|
+
// eslint-disable-next-line no-param-reassign
|
|
2320
1941
|
entity.activeViewPresetId = '';
|
|
2321
|
-
|
|
2322
|
-
viewPresetsAdapter.setOne(draft, entity);
|
|
2323
|
-
}
|
|
2324
|
-
},
|
|
2325
|
-
setActiveViewPresetId: function setActiveViewPresetId(draft, action) {
|
|
2326
|
-
var _action$payload6 = action.payload,
|
|
2327
|
-
panelId = _action$payload6.panelId,
|
|
2328
|
-
mapPresetId = _action$payload6.viewPresetId;
|
|
2329
|
-
var entity = draft.entities[panelId];
|
|
2330
|
-
if (entity) {
|
|
2331
|
-
entity.activeViewPresetId = mapPresetId;
|
|
2332
|
-
entity.hasChanges = false;
|
|
2333
|
-
viewPresetsAdapter.setOne(draft, entity);
|
|
2334
|
-
}
|
|
2335
|
-
},
|
|
2336
|
-
selectViewPreset: function selectViewPreset(draft, action) {
|
|
2337
|
-
var _action$payload7 = action.payload,
|
|
2338
|
-
panelId = _action$payload7.panelId,
|
|
2339
|
-
mapPresetId = _action$payload7.viewPresetId;
|
|
2340
|
-
var entity = draft.entities[panelId];
|
|
2341
|
-
if (entity) {
|
|
2342
|
-
// only update activeMapPresetId after selecting a NEW preset
|
|
2343
|
-
// existing mapPresets are getting an activeMapPresetId after a succesfull fetch
|
|
2344
|
-
if (mapPresetId === '') {
|
|
2345
|
-
entity.activeViewPresetId = '';
|
|
2346
|
-
entity.error = undefined;
|
|
2347
|
-
}
|
|
2348
|
-
entity.isViewPresetListDialogOpen = false;
|
|
2349
|
-
viewPresetsAdapter.setOne(draft, entity);
|
|
2350
|
-
}
|
|
2351
|
-
},
|
|
2352
|
-
// the view itself is replaced in viewPresets/listener
|
|
2353
|
-
selectViewTemplate: function selectViewTemplate(draft, action) {
|
|
2354
|
-
var panelId = action.payload.panelId;
|
|
2355
|
-
var entity = draft.entities[panelId];
|
|
2356
|
-
if (entity) {
|
|
2357
|
-
entity.activeViewPresetId = '';
|
|
2358
|
-
entity.error = undefined;
|
|
2359
|
-
entity.isViewPresetListDialogOpen = false;
|
|
2360
|
-
viewPresetsAdapter.setOne(draft, entity);
|
|
2361
|
-
}
|
|
2362
|
-
},
|
|
2363
|
-
selectViewPlugin: function selectViewPlugin(draft, action) {
|
|
2364
|
-
var _action$payload8 = action.payload,
|
|
2365
|
-
panelId = _action$payload8.panelId,
|
|
2366
|
-
pluginMetaData = _action$payload8.pluginMetaData;
|
|
2367
|
-
var entity = draft.entities[panelId];
|
|
2368
|
-
entity.activeViewPresetId = (pluginMetaData == null ? void 0 : pluginMetaData.id) || '';
|
|
2369
|
-
entity.error = undefined;
|
|
2370
|
-
entity.isViewPresetListDialogOpen = false;
|
|
2371
|
-
},
|
|
2372
|
-
// action is intercepted in mapPresets/listener
|
|
2373
|
-
onSuccessViewPresetAction: function onSuccessViewPresetAction(_draft, _action) {},
|
|
2374
|
-
registerViewPreset: function registerViewPreset(draft, action) {
|
|
2375
|
-
var _action$payload9 = action.payload,
|
|
2376
|
-
mapId = _action$payload9.panelId,
|
|
2377
|
-
mapPresetId = _action$payload9.viewPresetId,
|
|
2378
|
-
filters = _action$payload9.filters;
|
|
2379
|
-
viewPresetsAdapter.setOne(draft, {
|
|
2380
|
-
panelId: mapId,
|
|
2381
|
-
activeViewPresetId: mapPresetId,
|
|
2382
|
-
hasChanges: false,
|
|
2383
|
-
isFetching: false,
|
|
2384
|
-
error: undefined,
|
|
2385
|
-
isViewPresetListDialogOpen: false,
|
|
2386
|
-
filters: filters != null ? filters : defaultViewPresetsFilters,
|
|
2387
|
-
searchQuery: '',
|
|
2388
|
-
filterResults: {
|
|
2389
|
-
ids: [],
|
|
2390
|
-
entities: {}
|
|
2391
|
-
}
|
|
2392
|
-
});
|
|
2393
|
-
},
|
|
2394
|
-
unregisterViewPreset: function unregisterViewPreset(draft, action) {
|
|
2395
|
-
var panelId = action.payload.panelId;
|
|
2396
|
-
viewPresetsAdapter.removeOne(draft, panelId);
|
|
2397
|
-
},
|
|
2398
|
-
// dialog actions
|
|
2399
|
-
openViewPresetDialog: function openViewPresetDialog(draft, action) {
|
|
2400
|
-
var viewPresetDialog = action.payload.viewPresetDialog;
|
|
2401
|
-
draft.viewPresetDialog = viewPresetDialog;
|
|
2402
|
-
},
|
|
2403
|
-
closeViewPresetDialog: function closeViewPresetDialog(draft) {
|
|
2404
|
-
delete draft.viewPresetDialog;
|
|
2405
|
-
},
|
|
2406
|
-
toggleViewPresetListDialog: function toggleViewPresetListDialog(draft, action) {
|
|
2407
|
-
var _action$payload0 = action.payload,
|
|
2408
|
-
isViewPresetDialogOpen = _action$payload0.isViewPresetListDialogOpen,
|
|
2409
|
-
panelId = _action$payload0.panelId;
|
|
2410
|
-
var entity = draft.entities[panelId];
|
|
2411
|
-
if (entity) {
|
|
2412
|
-
entity.isViewPresetListDialogOpen = isViewPresetDialogOpen;
|
|
2413
|
-
viewPresetsAdapter.setOne(draft, entity);
|
|
2414
|
-
}
|
|
2415
|
-
},
|
|
2416
|
-
toggleSelectFilterChip: function toggleSelectFilterChip(draft, action) {
|
|
2417
|
-
var _action$payload1 = action.payload,
|
|
2418
|
-
id = _action$payload1.id,
|
|
2419
|
-
isSelected = _action$payload1.isSelected,
|
|
2420
|
-
panelId = _action$payload1.panelId,
|
|
2421
|
-
isAdmin = _action$payload1.isAdmin,
|
|
2422
|
-
isFavouritesEnabled = _action$payload1.isFavouritesEnabled;
|
|
2423
|
-
var entity = draft.entities[panelId];
|
|
2424
|
-
if (entity) {
|
|
2425
|
-
entity.filters = togglePresetFilter(entity.filters, id, isSelected, isAdmin, isFavouritesEnabled);
|
|
2426
|
-
}
|
|
2427
|
-
},
|
|
2428
|
-
setSelectAllFilterChip: function setSelectAllFilterChip(draft, action) {
|
|
2429
|
-
var panelId = action.payload.panelId;
|
|
2430
|
-
var entity = draft.entities[panelId];
|
|
2431
|
-
if (entity) {
|
|
2432
|
-
entity.filters = entity.filters.map(function (filter) {
|
|
2433
|
-
return Object.assign({}, filter, {
|
|
2434
|
-
isSelected: true
|
|
2435
|
-
});
|
|
2436
|
-
});
|
|
2437
|
-
}
|
|
2438
|
-
},
|
|
2439
|
-
setFilterChips: function setFilterChips(draft, action) {
|
|
2440
|
-
var _action$payload10 = action.payload,
|
|
2441
|
-
panelId = _action$payload10.panelId,
|
|
2442
|
-
filters = _action$payload10.filters;
|
|
2443
|
-
var entity = draft.entities[panelId];
|
|
2444
|
-
if (!entity) {
|
|
2445
|
-
return;
|
|
2446
|
-
}
|
|
2447
|
-
entity.filters.forEach(function (filter, index) {
|
|
2448
|
-
var existingFilter = filters.find(function (existingFilter) {
|
|
2449
|
-
return existingFilter.id === filter.id;
|
|
2450
|
-
});
|
|
2451
|
-
var updatedFilter = Object.assign({}, filter, {
|
|
2452
|
-
isSelected: existingFilter ? existingFilter.isSelected : filter.isSelected
|
|
2453
|
-
});
|
|
2454
|
-
entity.filters[index] = updatedFilter;
|
|
2455
|
-
});
|
|
2456
|
-
},
|
|
2457
|
-
searchFilter: function searchFilter(draft, action) {
|
|
2458
|
-
var _action$payload11 = action.payload,
|
|
2459
|
-
searchQuery = _action$payload11.searchQuery,
|
|
2460
|
-
panelId = _action$payload11.panelId;
|
|
2461
|
-
var entity = draft.entities[panelId];
|
|
2462
|
-
if (entity) {
|
|
2463
|
-
entity.searchQuery = searchQuery;
|
|
2464
|
-
}
|
|
2465
|
-
},
|
|
2466
|
-
setViewPresetLabelFilters: function setViewPresetLabelFilters(draft, action) {
|
|
2467
|
-
var _action$payload12 = action.payload,
|
|
2468
|
-
panelId = _action$payload12.panelId,
|
|
2469
|
-
labels = _action$payload12.labels;
|
|
2470
|
-
var entity = draft.entities[panelId];
|
|
2471
|
-
if (!entity) {
|
|
2472
|
-
return;
|
|
2473
|
-
}
|
|
2474
|
-
entity.labelFilters = labels;
|
|
2475
|
-
viewPresetsAdapter.setOne(draft, entity);
|
|
2476
|
-
},
|
|
2477
|
-
clearViewPresetLabelFilters: function clearViewPresetLabelFilters(draft, action) {
|
|
2478
|
-
var panelId = action.payload.panelId;
|
|
2479
|
-
var entity = draft.entities[panelId];
|
|
2480
|
-
if (!entity) {
|
|
2481
|
-
return;
|
|
2482
|
-
}
|
|
2483
|
-
entity.labelFilters = undefined;
|
|
2484
|
-
viewPresetsAdapter.setOne(draft, entity);
|
|
2485
|
-
}
|
|
2486
|
-
},
|
|
2487
|
-
extraReducers: function extraReducers(builder) {
|
|
2488
|
-
builder.addCase(mapActions.setMapPresetError, function (draft, action) {
|
|
2489
|
-
var _action$payload13 = action.payload,
|
|
2490
|
-
mapId = _action$payload13.mapId,
|
|
2491
|
-
error = _action$payload13.error;
|
|
2492
|
-
var entity = draft.entities[mapId];
|
|
2493
|
-
if (entity) {
|
|
2494
|
-
entity.error = error ? {
|
|
2495
|
-
message: error,
|
|
2496
|
-
component: ViewPresetErrorComponent.PRESET_DETAIL,
|
|
2497
|
-
errorType: ViewPresetErrorType.GENERIC
|
|
2498
|
-
} : undefined;
|
|
2499
|
-
entity.isFetching = false;
|
|
2500
|
-
viewPresetsAdapter.setOne(draft, entity);
|
|
2501
|
-
}
|
|
2502
|
-
});
|
|
2503
|
-
builder.addCase(workspaceListActions.submitFormWorkspaceActionDialogOptions, function (draft, action) {
|
|
2504
|
-
var data = action.payload.data;
|
|
2505
|
-
if (data.views) {
|
|
2506
|
-
data.views.forEach(function (view) {
|
|
2507
|
-
if (draft.entities[view.mosaicNodeId]) {
|
|
2508
|
-
draft.entities[view.mosaicNodeId].error = undefined;
|
|
2509
|
-
}
|
|
2510
|
-
});
|
|
2511
|
-
}
|
|
2512
|
-
});
|
|
2513
|
-
builder.addCase(workspaceListActions.onSuccessWorkspacePresetAction, function (draft, action) {
|
|
2514
|
-
var _action$payload14 = action.payload,
|
|
2515
|
-
wsAction = _action$payload14.action,
|
|
2516
|
-
views = _action$payload14.views;
|
|
2517
|
-
var shouldClear = wsAction === WorkspacePresetAction.SAVE || wsAction === WorkspacePresetAction.SAVE_AS || wsAction === WorkspacePresetAction.SAVE_SYSTEM_PRESET || wsAction === WorkspacePresetAction.SAVE_SYSTEM_PRESET_AS || wsAction === WorkspacePresetAction.EDIT;
|
|
2518
|
-
if (!shouldClear) {
|
|
2519
|
-
return;
|
|
2520
|
-
}
|
|
2521
|
-
var viewIds = (views != null ? views : []).map(function (view) {
|
|
2522
|
-
return view.mosaicNodeId;
|
|
2523
|
-
}).filter(Boolean);
|
|
2524
|
-
if (viewIds.length) {
|
|
2525
|
-
viewIds.forEach(function (panelId) {
|
|
2526
|
-
var entity = draft.entities[panelId];
|
|
2527
|
-
if (entity) {
|
|
2528
|
-
entity.hasChanges = false;
|
|
2529
|
-
entity.activeViewPresetId = '';
|
|
2530
|
-
viewPresetsAdapter.setOne(draft, entity);
|
|
2531
|
-
}
|
|
2532
|
-
});
|
|
2533
|
-
return;
|
|
2534
|
-
}
|
|
2535
|
-
Object.values(draft.entities).forEach(function (entity) {
|
|
2536
|
-
if (entity) {
|
|
2537
|
-
// eslint-disable-next-line no-param-reassign
|
|
2538
|
-
entity.hasChanges = false;
|
|
2539
|
-
// eslint-disable-next-line no-param-reassign
|
|
2540
|
-
entity.activeViewPresetId = '';
|
|
2541
|
-
viewPresetsAdapter.setOne(draft, entity);
|
|
1942
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
2542
1943
|
}
|
|
2543
1944
|
});
|
|
2544
1945
|
});
|
|
@@ -2635,6 +2036,21 @@ var slice$1 = createSlice({
|
|
|
2635
2036
|
}
|
|
2636
2037
|
});
|
|
2637
2038
|
});
|
|
2039
|
+
crossSectionChangeActions.map(function (crossSectionAction) {
|
|
2040
|
+
return builder.addCase(crossSectionAction, function (draft, action) {
|
|
2041
|
+
var _action$payload20 = action.payload,
|
|
2042
|
+
viewId = _action$payload20.viewId,
|
|
2043
|
+
origin = _action$payload20.origin;
|
|
2044
|
+
var isChangeOriginSupported = supportedCrossSectionActionOrigins.includes(origin);
|
|
2045
|
+
if (isChangeOriginSupported && viewId) {
|
|
2046
|
+
var entity = draft.entities[viewId];
|
|
2047
|
+
if (entity && !entity.hasChanges) {
|
|
2048
|
+
entity.hasChanges = true;
|
|
2049
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
});
|
|
2053
|
+
});
|
|
2638
2054
|
}
|
|
2639
2055
|
});
|
|
2640
2056
|
var viewPresetsReducer = slice$1.reducer,
|
|
@@ -3053,6 +2469,9 @@ var emptyViewPreset = function emptyViewPreset(componentType) {
|
|
|
3053
2469
|
},
|
|
3054
2470
|
services: []
|
|
3055
2471
|
},
|
|
2472
|
+
DataExplorer: {
|
|
2473
|
+
dataExplorerPreset: {}
|
|
2474
|
+
},
|
|
3056
2475
|
Soundings: undefined,
|
|
3057
2476
|
// TODO: empty soundings preset https://gitlab.com/opengeoweb/opengeoweb/-/issues/6029
|
|
3058
2477
|
CrossSection: {
|
|
@@ -3296,18 +2715,18 @@ var getViewComponentType = createSelector(getViewById, function (store) {
|
|
|
3296
2715
|
var _store$componentType;
|
|
3297
2716
|
return (_store$componentType = store == null ? void 0 : store.componentType) != null ? _store$componentType : 'Map';
|
|
3298
2717
|
}, selectorMemoizationOptions);
|
|
3299
|
-
var getViewPresetToSendToBackend = createSelector(getViewById, getViewComponentType, mapSelectors.getMapPreset, syncGroupsSelectors.getAllTargetGroupsForSource, timeSeriesSelectors.getTimeSeriesPreset, publicWarningsSelectors.getWarningsPresetById, mapSelectors.getMultiMapInitialProps, mapSelectors.getTimeSliderInitialProps, soundingsSelectors.getSoundingsPreset,
|
|
3300
|
-
return
|
|
3301
|
-
}, function (store) {
|
|
2718
|
+
var getViewPresetToSendToBackend = createSelector(getViewById, getViewComponentType, mapSelectors.getMapPreset, syncGroupsSelectors.getAllTargetGroupsForSource, timeSeriesSelectors.getTimeSeriesPreset, publicWarningsSelectors.getWarningsPresetById, mapSelectors.getMultiMapInitialProps, mapSelectors.getTimeSliderInitialProps, soundingsSelectors.getSoundingsPreset, function (store, panelId) {
|
|
2719
|
+
return crossSectionSelectors.getCrossSectionPreset(store, panelId);
|
|
2720
|
+
}, getPluginState, function (store) {
|
|
3302
2721
|
return store;
|
|
3303
|
-
}, function (panelId) {
|
|
2722
|
+
}, function (_store, panelId) {
|
|
3304
2723
|
return panelId;
|
|
3305
2724
|
}, function (_store, _panelId, keepAllDims) {
|
|
3306
2725
|
if (keepAllDims === void 0) {
|
|
3307
2726
|
keepAllDims = false;
|
|
3308
2727
|
}
|
|
3309
2728
|
return keepAllDims;
|
|
3310
|
-
}, function (workspaceView, viewComponentType, mapPreset, syncGroupsIds, timeSeriesPreset, warningsPreset, multiMapPreset, timeSliderPreset, soundingsPreset, pluginState, store, panelId, keepAllDims) {
|
|
2729
|
+
}, function (workspaceView, viewComponentType, mapPreset, syncGroupsIds, timeSeriesPreset, warningsPreset, multiMapPreset, timeSliderPreset, soundingsPreset, crossSectionPreset, pluginState, store, panelId, keepAllDims) {
|
|
3311
2730
|
var _workspaceView$scope, _initialPropsByCompon;
|
|
3312
2731
|
var title = workspaceView == null ? void 0 : workspaceView.title;
|
|
3313
2732
|
var scope = (_workspaceView$scope = workspaceView == null ? void 0 : workspaceView.scope) != null ? _workspaceView$scope : 'system';
|
|
@@ -3317,6 +2736,9 @@ var getViewPresetToSendToBackend = createSelector(getViewById, getViewComponentT
|
|
|
3317
2736
|
};
|
|
3318
2737
|
var harmonieProps = mapSelectors.getHarmonieInitialProps(store, panelId, workspaceView == null ? void 0 : workspaceView.initialProps, syncGroupsIds);
|
|
3319
2738
|
var initialPropsByComponentType = {
|
|
2739
|
+
DataExplorer: {
|
|
2740
|
+
dataExplorerPreset: {}
|
|
2741
|
+
},
|
|
3320
2742
|
Map: defaultInitialProps,
|
|
3321
2743
|
TimeSeries: Object.assign({}, timeSeriesPreset, {
|
|
3322
2744
|
syncGroupsIds: syncGroupsIds
|
|
@@ -3331,7 +2753,7 @@ var getViewPresetToSendToBackend = createSelector(getViewById, getViewComponentT
|
|
|
3331
2753
|
Soundings: Object.assign({}, soundingsPreset, {
|
|
3332
2754
|
syncGroupsIds: syncGroupsIds
|
|
3333
2755
|
}),
|
|
3334
|
-
CrossSection: Object.assign({},
|
|
2756
|
+
CrossSection: Object.assign({}, crossSectionPreset, {
|
|
3335
2757
|
syncGroupsIds: syncGroupsIds
|
|
3336
2758
|
}),
|
|
3337
2759
|
Plugin: Object.assign({}, workspaceView == null ? void 0 : workspaceView.initialProps, {
|
|
@@ -3365,27 +2787,764 @@ var getWorkspaceToSendToBackend = function getWorkspaceToSendToBackend(store) {
|
|
|
3365
2787
|
});
|
|
3366
2788
|
};
|
|
3367
2789
|
|
|
3368
|
-
var selectors$1 = /*#__PURE__*/Object.freeze({
|
|
3369
|
-
__proto__: null,
|
|
3370
|
-
getComponentTypesFromActiveViews: getComponentTypesFromActiveViews,
|
|
3371
|
-
getMosaicNode: getMosaicNode,
|
|
3372
|
-
getSelectedWorkspaceScope: getSelectedWorkspaceScope,
|
|
3373
|
-
getSelectedWorkspaceTitle: getSelectedWorkspaceTitle,
|
|
3374
|
-
getShouldPreventClose: getShouldPreventClose,
|
|
3375
|
-
getViewById: getViewById,
|
|
3376
|
-
getViewComponentType: getViewComponentType,
|
|
3377
|
-
getViewIds: getViewIds,
|
|
3378
|
-
getViewPresetToSendToBackend: getViewPresetToSendToBackend,
|
|
3379
|
-
getViewType: getViewType,
|
|
3380
|
-
getViewsById: getViewsById,
|
|
3381
|
-
getWorkspaceData: getWorkspaceData,
|
|
3382
|
-
getWorkspaceError: getWorkspaceError,
|
|
3383
|
-
getWorkspaceId: getWorkspaceId,
|
|
3384
|
-
getWorkspaceState: getWorkspaceState,
|
|
3385
|
-
getWorkspaceToSendToBackend: getWorkspaceToSendToBackend,
|
|
3386
|
-
hasWorkspaceChanges: hasWorkspaceChanges,
|
|
3387
|
-
isWorkspaceLoading: isWorkspaceLoading
|
|
3388
|
-
});
|
|
2790
|
+
var selectors$1 = /*#__PURE__*/Object.freeze({
|
|
2791
|
+
__proto__: null,
|
|
2792
|
+
getComponentTypesFromActiveViews: getComponentTypesFromActiveViews,
|
|
2793
|
+
getMosaicNode: getMosaicNode,
|
|
2794
|
+
getSelectedWorkspaceScope: getSelectedWorkspaceScope,
|
|
2795
|
+
getSelectedWorkspaceTitle: getSelectedWorkspaceTitle,
|
|
2796
|
+
getShouldPreventClose: getShouldPreventClose,
|
|
2797
|
+
getViewById: getViewById,
|
|
2798
|
+
getViewComponentType: getViewComponentType,
|
|
2799
|
+
getViewIds: getViewIds,
|
|
2800
|
+
getViewPresetToSendToBackend: getViewPresetToSendToBackend,
|
|
2801
|
+
getViewType: getViewType,
|
|
2802
|
+
getViewsById: getViewsById,
|
|
2803
|
+
getWorkspaceData: getWorkspaceData,
|
|
2804
|
+
getWorkspaceError: getWorkspaceError,
|
|
2805
|
+
getWorkspaceId: getWorkspaceId,
|
|
2806
|
+
getWorkspaceState: getWorkspaceState,
|
|
2807
|
+
getWorkspaceToSendToBackend: getWorkspaceToSendToBackend,
|
|
2808
|
+
hasWorkspaceChanges: hasWorkspaceChanges,
|
|
2809
|
+
isWorkspaceLoading: isWorkspaceLoading
|
|
2810
|
+
});
|
|
2811
|
+
|
|
2812
|
+
var VIEW_PRESETS_DOWNLOAD_TIMEOUT_MS = 30000;
|
|
2813
|
+
var MAP_SIZES_TIMEOUT_MS = 10000;
|
|
2814
|
+
var restoreTimeoutMessage = {
|
|
2815
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
2816
|
+
key: 'workspace-map-views-restore-timeout'
|
|
2817
|
+
};
|
|
2818
|
+
/** Resolves true once the state is ready, or false when the timeout passes first. */
|
|
2819
|
+
var waitForState = /*#__PURE__*/function () {
|
|
2820
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(listenerApi, isReady, timeout) {
|
|
2821
|
+
return _regenerator().w(function (_context) {
|
|
2822
|
+
while (1) switch (_context.n) {
|
|
2823
|
+
case 0:
|
|
2824
|
+
return _context.a(2, isReady(listenerApi.getState()) || listenerApi.condition(function (_action, currentState) {
|
|
2825
|
+
return isReady(currentState);
|
|
2826
|
+
}, timeout));
|
|
2827
|
+
}
|
|
2828
|
+
}, _callee);
|
|
2829
|
+
}));
|
|
2830
|
+
return function waitForState(_x, _x2, _x3) {
|
|
2831
|
+
return _ref.apply(this, arguments);
|
|
2832
|
+
};
|
|
2833
|
+
}();
|
|
2834
|
+
var areViewPresetsDownloaded = function areViewPresetsDownloaded(state) {
|
|
2835
|
+
return getViewIds(state).every(function (viewId) {
|
|
2836
|
+
var _getViewById;
|
|
2837
|
+
return ((_getViewById = getViewById(state, viewId)) == null ? void 0 : _getViewById.componentType) !== 'ViewLoading';
|
|
2838
|
+
});
|
|
2839
|
+
};
|
|
2840
|
+
var collectSavedBboxes = function collectSavedBboxes(state) {
|
|
2841
|
+
return getViewIds(state).reduce(function (savedBboxes, viewId) {
|
|
2842
|
+
var _getViewById2, _initialProps$mapPres, _proj$bbox, _Object$assign;
|
|
2843
|
+
var initialProps = (_getViewById2 = getViewById(state, viewId)) == null ? void 0 : _getViewById2.initialProps;
|
|
2844
|
+
var proj = initialProps == null || (_initialProps$mapPres = initialProps.mapPreset) == null ? void 0 : _initialProps$mapPres.proj;
|
|
2845
|
+
return getViewComponentType(state, viewId) === 'Map' && (proj == null || (_proj$bbox = proj.bbox) == null ? void 0 : _proj$bbox.left) !== undefined ? Object.assign({}, savedBboxes, (_Object$assign = {}, _Object$assign[viewId] = {
|
|
2846
|
+
bbox: proj.bbox,
|
|
2847
|
+
srs: proj.srs
|
|
2848
|
+
}, _Object$assign)) : savedBboxes;
|
|
2849
|
+
}, {});
|
|
2850
|
+
};
|
|
2851
|
+
var getBboxSyncGroupMembers = function getBboxSyncGroupMembers(state, mapIds) {
|
|
2852
|
+
var _syncGroupsSelectors$, _groups$allIds;
|
|
2853
|
+
var groups = (_syncGroupsSelectors$ = syncGroupsSelectors.getSynchronizationGroupState(state)) == null ? void 0 : _syncGroupsSelectors$.groups;
|
|
2854
|
+
return ((_groups$allIds = groups == null ? void 0 : groups.allIds) != null ? _groups$allIds : []).reduce(function (membersByGroupId, groupId) {
|
|
2855
|
+
var _Object$assign2;
|
|
2856
|
+
var group = groups.byId[groupId];
|
|
2857
|
+
var memberMapIds = group.type === syncConstants.SYNCGROUPS_TYPE_SETBBOX ? group.targets.allIds.filter(function (targetId) {
|
|
2858
|
+
return mapIds.includes(targetId);
|
|
2859
|
+
}) : [];
|
|
2860
|
+
return memberMapIds.length ? Object.assign({}, membersByGroupId, (_Object$assign2 = {}, _Object$assign2[groupId] = memberMapIds, _Object$assign2)) : membersByGroupId;
|
|
2861
|
+
}, {});
|
|
2862
|
+
};
|
|
2863
|
+
var haveMapSizes = function haveMapSizes(state, mapIds) {
|
|
2864
|
+
return mapIds.every(function (mapId) {
|
|
2865
|
+
return !!mapSelectors.getMapSize(state, mapId);
|
|
2866
|
+
});
|
|
2867
|
+
};
|
|
2868
|
+
var getSizedFitMembers = function getSizedFitMembers(state, memberMapIds, presetBboxes) {
|
|
2869
|
+
return compact(memberMapIds.map(function (mapId) {
|
|
2870
|
+
var mapSize = mapSelectors.getMapSize(state, mapId);
|
|
2871
|
+
return mapSize && {
|
|
2872
|
+
mapId: mapId,
|
|
2873
|
+
bbox: presetBboxes[mapId].bbox,
|
|
2874
|
+
mapSize: mapSize
|
|
2875
|
+
};
|
|
2876
|
+
}));
|
|
2877
|
+
};
|
|
2878
|
+
/** Sets the group view once and stores what the members show, so a save right after the restore keeps this view. */
|
|
2879
|
+
var applySyncGroupFit = function applySyncGroupFit(listenerApi, groupId, memberMapIds, savedBboxes) {
|
|
2880
|
+
var members = getSizedFitMembers(listenerApi.getState(), memberMapIds, savedBboxes);
|
|
2881
|
+
var fit = calculateSyncGroupFit(members);
|
|
2882
|
+
if (!fit) {
|
|
2883
|
+
return;
|
|
2884
|
+
}
|
|
2885
|
+
var chosenMember = members.find(function (member) {
|
|
2886
|
+
return member.mapId === fit.mapId;
|
|
2887
|
+
});
|
|
2888
|
+
var srs = savedBboxes[chosenMember.mapId].srs;
|
|
2889
|
+
setSyncGroupViewFit(groupId, fit, srs);
|
|
2890
|
+
listenerApi.dispatch(genericActions.setBbox({
|
|
2891
|
+
sourceId: chosenMember.mapId,
|
|
2892
|
+
bbox: getVisibleArea(fit, chosenMember.mapSize),
|
|
2893
|
+
srs: srs,
|
|
2894
|
+
origin: 'restoreSyncGroupViews'
|
|
2895
|
+
}));
|
|
2896
|
+
};
|
|
2897
|
+
/** Restores each zoom sync group's shared view once every view preset is downloaded and every member map has its size. */
|
|
2898
|
+
var restoreSyncGroupViews = /*#__PURE__*/function () {
|
|
2899
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(listenerApi) {
|
|
2900
|
+
var isDownloaded, savedBboxes, membersByGroupId, memberMapIds, areMapsSized;
|
|
2901
|
+
return _regenerator().w(function (_context2) {
|
|
2902
|
+
while (1) switch (_context2.n) {
|
|
2903
|
+
case 0:
|
|
2904
|
+
_context2.n = 1;
|
|
2905
|
+
return waitForState(listenerApi, areViewPresetsDownloaded, VIEW_PRESETS_DOWNLOAD_TIMEOUT_MS);
|
|
2906
|
+
case 1:
|
|
2907
|
+
isDownloaded = _context2.v;
|
|
2908
|
+
savedBboxes = collectSavedBboxes(listenerApi.getState());
|
|
2909
|
+
membersByGroupId = getBboxSyncGroupMembers(listenerApi.getState(), Object.keys(savedBboxes));
|
|
2910
|
+
memberMapIds = Object.values(membersByGroupId).flat();
|
|
2911
|
+
_context2.n = 2;
|
|
2912
|
+
return waitForState(listenerApi, function (state) {
|
|
2913
|
+
return haveMapSizes(state, memberMapIds);
|
|
2914
|
+
}, MAP_SIZES_TIMEOUT_MS);
|
|
2915
|
+
case 2:
|
|
2916
|
+
areMapsSized = _context2.v;
|
|
2917
|
+
Object.entries(membersByGroupId).forEach(function (_ref3) {
|
|
2918
|
+
var groupId = _ref3[0],
|
|
2919
|
+
groupMemberMapIds = _ref3[1];
|
|
2920
|
+
return applySyncGroupFit(listenerApi, groupId, groupMemberMapIds, savedBboxes);
|
|
2921
|
+
});
|
|
2922
|
+
listenerApi.dispatch(mapActions.endViewsSettling());
|
|
2923
|
+
if (!isDownloaded || !areMapsSized) {
|
|
2924
|
+
listenerApi.dispatch(snackbarActions.openSnackbar(restoreTimeoutMessage));
|
|
2925
|
+
}
|
|
2926
|
+
case 3:
|
|
2927
|
+
return _context2.a(2);
|
|
2928
|
+
}
|
|
2929
|
+
}, _callee2);
|
|
2930
|
+
}));
|
|
2931
|
+
return function restoreSyncGroupViews(_x4) {
|
|
2932
|
+
return _ref2.apply(this, arguments);
|
|
2933
|
+
};
|
|
2934
|
+
}();
|
|
2935
|
+
|
|
2936
|
+
var workspacePresetsFallback = [
|
|
2937
|
+
{
|
|
2938
|
+
id: "newSplitMap2x1Workspace",
|
|
2939
|
+
title: "Two maps",
|
|
2940
|
+
scope: "system",
|
|
2941
|
+
abstract: "",
|
|
2942
|
+
viewType: "multiWindow",
|
|
2943
|
+
views: [
|
|
2944
|
+
{
|
|
2945
|
+
mosaicNodeId: "left-map",
|
|
2946
|
+
componentType: "Map",
|
|
2947
|
+
initialProps: {
|
|
2948
|
+
mapPreset: {
|
|
2949
|
+
layers: [
|
|
2950
|
+
],
|
|
2951
|
+
proj: {
|
|
2952
|
+
bbox: {
|
|
2953
|
+
left: -2782987.27,
|
|
2954
|
+
bottom: 3503549.84,
|
|
2955
|
+
right: 5009377.09,
|
|
2956
|
+
top: 11753184.62
|
|
2957
|
+
},
|
|
2958
|
+
srs: "EPSG:3857"
|
|
2959
|
+
},
|
|
2960
|
+
showTimeSlider: false,
|
|
2961
|
+
displayMapPin: false,
|
|
2962
|
+
shouldShowZoomControls: true
|
|
2963
|
+
},
|
|
2964
|
+
syncGroupsIds: [
|
|
2965
|
+
]
|
|
2966
|
+
},
|
|
2967
|
+
title: "Map A"
|
|
2968
|
+
},
|
|
2969
|
+
{
|
|
2970
|
+
mosaicNodeId: "right-map",
|
|
2971
|
+
componentType: "Map",
|
|
2972
|
+
initialProps: {
|
|
2973
|
+
mapPreset: {
|
|
2974
|
+
layers: [
|
|
2975
|
+
],
|
|
2976
|
+
proj: {
|
|
2977
|
+
bbox: {
|
|
2978
|
+
left: -2782987.27,
|
|
2979
|
+
bottom: 3503549.84,
|
|
2980
|
+
right: 5009377.09,
|
|
2981
|
+
top: 11753184.62
|
|
2982
|
+
},
|
|
2983
|
+
srs: "EPSG:3857"
|
|
2984
|
+
},
|
|
2985
|
+
showTimeSlider: false,
|
|
2986
|
+
displayMapPin: false,
|
|
2987
|
+
shouldShowZoomControls: true
|
|
2988
|
+
},
|
|
2989
|
+
syncGroupsIds: [
|
|
2990
|
+
]
|
|
2991
|
+
},
|
|
2992
|
+
title: "Map B"
|
|
2993
|
+
}
|
|
2994
|
+
],
|
|
2995
|
+
syncGroups: [
|
|
2996
|
+
],
|
|
2997
|
+
mosaicNode: {
|
|
2998
|
+
direction: "row",
|
|
2999
|
+
first: "left-map",
|
|
3000
|
+
second: "right-map",
|
|
3001
|
+
splitPercentage: 50
|
|
3002
|
+
}
|
|
3003
|
+
},
|
|
3004
|
+
{
|
|
3005
|
+
id: "timeSeriesWorkspace",
|
|
3006
|
+
title: "Timeseries",
|
|
3007
|
+
scope: "system",
|
|
3008
|
+
abstract: "",
|
|
3009
|
+
viewType: "multiWindow",
|
|
3010
|
+
views: [
|
|
3011
|
+
{
|
|
3012
|
+
mosaicNodeId: "timeseries-map",
|
|
3013
|
+
componentType: "Map",
|
|
3014
|
+
initialProps: {
|
|
3015
|
+
mapPreset: {
|
|
3016
|
+
layers: [
|
|
3017
|
+
],
|
|
3018
|
+
proj: {
|
|
3019
|
+
bbox: {
|
|
3020
|
+
left: -2782987.27,
|
|
3021
|
+
bottom: 3503549.84,
|
|
3022
|
+
right: 5009377.09,
|
|
3023
|
+
top: 11753184.62
|
|
3024
|
+
},
|
|
3025
|
+
srs: "EPSG:3857"
|
|
3026
|
+
},
|
|
3027
|
+
showTimeSlider: true,
|
|
3028
|
+
displayMapPin: true,
|
|
3029
|
+
shouldShowZoomControls: true
|
|
3030
|
+
},
|
|
3031
|
+
syncGroupsIds: [
|
|
3032
|
+
"Area_TimeSeries",
|
|
3033
|
+
"Time_TimeSeries"
|
|
3034
|
+
]
|
|
3035
|
+
},
|
|
3036
|
+
title: "Map"
|
|
3037
|
+
},
|
|
3038
|
+
{
|
|
3039
|
+
mosaicNodeId: "timeseries-panel",
|
|
3040
|
+
componentType: "TimeSeries",
|
|
3041
|
+
initialProps: {
|
|
3042
|
+
plotPreset: {
|
|
3043
|
+
mapId: "timeseries-map",
|
|
3044
|
+
plots: [
|
|
3045
|
+
],
|
|
3046
|
+
parameters: [
|
|
3047
|
+
]
|
|
3048
|
+
},
|
|
3049
|
+
services: [
|
|
3050
|
+
]
|
|
3051
|
+
},
|
|
3052
|
+
title: "Timeseries"
|
|
3053
|
+
}
|
|
3054
|
+
],
|
|
3055
|
+
syncGroups: [
|
|
3056
|
+
{
|
|
3057
|
+
id: "Area_TimeSeries",
|
|
3058
|
+
type: "SYNCGROUPS_TYPE_SETBBOX"
|
|
3059
|
+
},
|
|
3060
|
+
{
|
|
3061
|
+
id: "Time_TimeSeries",
|
|
3062
|
+
type: "SYNCGROUPS_TYPE_SETTIME"
|
|
3063
|
+
}
|
|
3064
|
+
],
|
|
3065
|
+
linking: {
|
|
3066
|
+
"timeseries-panel": [
|
|
3067
|
+
"timeseries-map"
|
|
3068
|
+
]
|
|
3069
|
+
},
|
|
3070
|
+
mosaicNode: {
|
|
3071
|
+
direction: "row",
|
|
3072
|
+
first: "timeseries-map",
|
|
3073
|
+
second: "timeseries-panel",
|
|
3074
|
+
splitPercentage: 50
|
|
3075
|
+
}
|
|
3076
|
+
},
|
|
3077
|
+
{
|
|
3078
|
+
id: "soundingWorkspace",
|
|
3079
|
+
title: "Soundings",
|
|
3080
|
+
scope: "system",
|
|
3081
|
+
abstract: "Vertical profile observations",
|
|
3082
|
+
viewType: "multiWindow",
|
|
3083
|
+
views: [
|
|
3084
|
+
{
|
|
3085
|
+
mosaicNodeId: "sounding-map",
|
|
3086
|
+
componentType: "Map",
|
|
3087
|
+
initialProps: {
|
|
3088
|
+
mapPreset: {
|
|
3089
|
+
layers: [
|
|
3090
|
+
],
|
|
3091
|
+
proj: {
|
|
3092
|
+
bbox: {
|
|
3093
|
+
left: -2782987.27,
|
|
3094
|
+
bottom: 3503549.84,
|
|
3095
|
+
right: 5009377.09,
|
|
3096
|
+
top: 11753184.62
|
|
3097
|
+
},
|
|
3098
|
+
srs: "EPSG:3857"
|
|
3099
|
+
},
|
|
3100
|
+
showTimeSlider: true,
|
|
3101
|
+
displayMapPin: true,
|
|
3102
|
+
shouldShowZoomControls: true
|
|
3103
|
+
},
|
|
3104
|
+
syncGroupsIds: [
|
|
3105
|
+
"Area_Sounding",
|
|
3106
|
+
"Time_Sounding"
|
|
3107
|
+
]
|
|
3108
|
+
},
|
|
3109
|
+
title: "Map"
|
|
3110
|
+
},
|
|
3111
|
+
{
|
|
3112
|
+
mosaicNodeId: "sounding-panel",
|
|
3113
|
+
componentType: "Soundings",
|
|
3114
|
+
initialProps: {
|
|
3115
|
+
selectedSources: {
|
|
3116
|
+
},
|
|
3117
|
+
selectedLocations: {
|
|
3118
|
+
}
|
|
3119
|
+
},
|
|
3120
|
+
title: "Sounding"
|
|
3121
|
+
}
|
|
3122
|
+
],
|
|
3123
|
+
syncGroups: [
|
|
3124
|
+
{
|
|
3125
|
+
id: "Area_Sounding",
|
|
3126
|
+
type: "SYNCGROUPS_TYPE_SETBBOX"
|
|
3127
|
+
},
|
|
3128
|
+
{
|
|
3129
|
+
id: "Time_Sounding",
|
|
3130
|
+
type: "SYNCGROUPS_TYPE_SETTIME"
|
|
3131
|
+
}
|
|
3132
|
+
],
|
|
3133
|
+
linking: {
|
|
3134
|
+
"sounding-panel": [
|
|
3135
|
+
"sounding-map"
|
|
3136
|
+
]
|
|
3137
|
+
},
|
|
3138
|
+
mosaicNode: {
|
|
3139
|
+
direction: "row",
|
|
3140
|
+
first: "sounding-map",
|
|
3141
|
+
second: "sounding-panel",
|
|
3142
|
+
splitPercentage: 50
|
|
3143
|
+
}
|
|
3144
|
+
},
|
|
3145
|
+
{
|
|
3146
|
+
id: "capWarningsWorkspace",
|
|
3147
|
+
title: "Cap warnings",
|
|
3148
|
+
scope: "system",
|
|
3149
|
+
abstract: "",
|
|
3150
|
+
viewType: "multiWindow",
|
|
3151
|
+
views: [
|
|
3152
|
+
{
|
|
3153
|
+
mosaicNodeId: "cap-map",
|
|
3154
|
+
componentType: "CapWarningMap",
|
|
3155
|
+
initialProps: {
|
|
3156
|
+
mapPreset: {
|
|
3157
|
+
layers: [
|
|
3158
|
+
],
|
|
3159
|
+
proj: {
|
|
3160
|
+
bbox: {
|
|
3161
|
+
left: -2782987.27,
|
|
3162
|
+
bottom: 3503549.84,
|
|
3163
|
+
right: 5009377.09,
|
|
3164
|
+
top: 11753184.62
|
|
3165
|
+
},
|
|
3166
|
+
srs: "EPSG:3857"
|
|
3167
|
+
}
|
|
3168
|
+
},
|
|
3169
|
+
geoJson: {
|
|
3170
|
+
type: "FeatureCollection",
|
|
3171
|
+
features: [
|
|
3172
|
+
]
|
|
3173
|
+
}
|
|
3174
|
+
},
|
|
3175
|
+
title: "CAP warnings map"
|
|
3176
|
+
},
|
|
3177
|
+
{
|
|
3178
|
+
mosaicNodeId: "cap-list",
|
|
3179
|
+
componentType: "CapWarningList",
|
|
3180
|
+
initialProps: {
|
|
3181
|
+
mapPreset: {
|
|
3182
|
+
layers: [
|
|
3183
|
+
],
|
|
3184
|
+
proj: {
|
|
3185
|
+
bbox: {
|
|
3186
|
+
left: -2782987.27,
|
|
3187
|
+
bottom: 3503549.84,
|
|
3188
|
+
right: 5009377.09,
|
|
3189
|
+
top: 11753184.62
|
|
3190
|
+
},
|
|
3191
|
+
srs: "EPSG:3857"
|
|
3192
|
+
}
|
|
3193
|
+
},
|
|
3194
|
+
geoJson: {
|
|
3195
|
+
type: "FeatureCollection",
|
|
3196
|
+
features: [
|
|
3197
|
+
]
|
|
3198
|
+
}
|
|
3199
|
+
},
|
|
3200
|
+
title: "CAP warnings list"
|
|
3201
|
+
}
|
|
3202
|
+
],
|
|
3203
|
+
syncGroups: [
|
|
3204
|
+
],
|
|
3205
|
+
mosaicNode: {
|
|
3206
|
+
direction: "row",
|
|
3207
|
+
first: "cap-map",
|
|
3208
|
+
second: "cap-list",
|
|
3209
|
+
splitPercentage: 50
|
|
3210
|
+
}
|
|
3211
|
+
}
|
|
3212
|
+
];
|
|
3213
|
+
|
|
3214
|
+
/* *
|
|
3215
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3216
|
+
* you may not use this file except in compliance with the License.
|
|
3217
|
+
* You may obtain a copy of the License at
|
|
3218
|
+
*
|
|
3219
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3220
|
+
*
|
|
3221
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3222
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3223
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3224
|
+
* See the License for the specific language governing permissions and
|
|
3225
|
+
* limitations under the License.
|
|
3226
|
+
*
|
|
3227
|
+
* Copyright 2026 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3228
|
+
* Copyright 2026 - Finnish Meteorological Institute (FMI)
|
|
3229
|
+
* Copyright 2026 - The Norwegian Meteorological Institute (MET Norway)
|
|
3230
|
+
* */
|
|
3231
|
+
/*
|
|
3232
|
+
configureLibraryDefaults([LIB_KEY], {
|
|
3233
|
+
staleTime: 5 * 60 * 1000,
|
|
3234
|
+
});
|
|
3235
|
+
*/
|
|
3236
|
+
var LIB_KEY = 'workspace-lib';
|
|
3237
|
+
var getPresetBaseUrl = function getPresetBaseUrl() {
|
|
3238
|
+
var config = sessionStorageProvider.getConfig();
|
|
3239
|
+
return (config == null ? void 0 : config.GW_PRESET_BACKEND_URL) || '';
|
|
3240
|
+
};
|
|
3241
|
+
var getIdFromUrl = function getIdFromUrl(url) {
|
|
3242
|
+
return url && /[^/]+$/.exec(url)[0];
|
|
3243
|
+
};
|
|
3244
|
+
var ERROR_NOT_FOUND$1 = 'Request failed with status code 400';
|
|
3245
|
+
var hasNoPresetBackend = function hasNoPresetBackend() {
|
|
3246
|
+
return !getPresetBaseUrl() && process.env.NODE_ENV !== 'test';
|
|
3247
|
+
};
|
|
3248
|
+
var extractWorkspacePresetFromJSON = function extractWorkspacePresetFromJSON(workspacePresetId) {
|
|
3249
|
+
var preset = workspacePresetsFallback.find(function (element) {
|
|
3250
|
+
return element.id === workspacePresetId;
|
|
3251
|
+
});
|
|
3252
|
+
if (!preset) {
|
|
3253
|
+
throw new Error(ERROR_NOT_FOUND$1);
|
|
3254
|
+
}
|
|
3255
|
+
return preset;
|
|
3256
|
+
};
|
|
3257
|
+
var filterWorkspacePresetList = function filterWorkspacePresetList(params) {
|
|
3258
|
+
var list = workspacePresetsFallback.map(function (preset) {
|
|
3259
|
+
var _preset$abstract;
|
|
3260
|
+
return {
|
|
3261
|
+
id: preset.id,
|
|
3262
|
+
title: preset.title,
|
|
3263
|
+
scope: preset.scope,
|
|
3264
|
+
viewType: preset.viewType,
|
|
3265
|
+
"abstract": (_preset$abstract = preset["abstract"]) != null ? _preset$abstract : '',
|
|
3266
|
+
description: preset.description,
|
|
3267
|
+
username: preset.username
|
|
3268
|
+
};
|
|
3269
|
+
});
|
|
3270
|
+
if (!params) {
|
|
3271
|
+
return list;
|
|
3272
|
+
}
|
|
3273
|
+
return list.filter(function (preset) {
|
|
3274
|
+
if (params.scope && preset.scope !== params.scope) {
|
|
3275
|
+
return false;
|
|
3276
|
+
}
|
|
3277
|
+
if (params.search) {
|
|
3278
|
+
var query = params.search.toLowerCase();
|
|
3279
|
+
return preset.title.toLowerCase().includes(query) || preset["abstract"].toLowerCase().includes(query);
|
|
3280
|
+
}
|
|
3281
|
+
return true;
|
|
3282
|
+
});
|
|
3283
|
+
};
|
|
3284
|
+
var favouritePresetKey = function favouritePresetKey(type, preset) {
|
|
3285
|
+
return type + ":" + preset.id;
|
|
3286
|
+
};
|
|
3287
|
+
var updateCachedFavourite = function updateCachedFavourite(client, queryKey, key, isFavourite) {
|
|
3288
|
+
client.setQueryData(queryKey, function (preferences) {
|
|
3289
|
+
var _preferences$favourit;
|
|
3290
|
+
var favourites = (_preferences$favourit = preferences == null ? void 0 : preferences.favouritePresets) != null ? _preferences$favourit : [];
|
|
3291
|
+
return Object.assign({}, preferences, {
|
|
3292
|
+
favouritePresets: isFavourite ? Array.from(new Set([].concat(favourites, [key]))) : favourites.filter(function (value) {
|
|
3293
|
+
return value !== key;
|
|
3294
|
+
})
|
|
3295
|
+
});
|
|
3296
|
+
});
|
|
3297
|
+
};
|
|
3298
|
+
|
|
3299
|
+
var getViewPreset = /*#__PURE__*/function () {
|
|
3300
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(viewpresetId, auth) {
|
|
3301
|
+
return _regenerator().w(function (_context) {
|
|
3302
|
+
while (1) switch (_context.n) {
|
|
3303
|
+
case 0:
|
|
3304
|
+
if (viewpresetId) {
|
|
3305
|
+
_context.n = 1;
|
|
3306
|
+
break;
|
|
3307
|
+
}
|
|
3308
|
+
return _context.a(2, null);
|
|
3309
|
+
case 1:
|
|
3310
|
+
return _context.a(2, fetch(getPresetBaseUrl() + "/viewpreset/" + viewpresetId, {
|
|
3311
|
+
headers: getHeaders(auth)
|
|
3312
|
+
}).then(handleResponse));
|
|
3313
|
+
}
|
|
3314
|
+
}, _callee);
|
|
3315
|
+
}));
|
|
3316
|
+
return function getViewPreset(_x, _x2) {
|
|
3317
|
+
return _ref.apply(this, arguments);
|
|
3318
|
+
};
|
|
3319
|
+
}();
|
|
3320
|
+
var getViewPresets$1 = /*#__PURE__*/function () {
|
|
3321
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(auth) {
|
|
3322
|
+
var url;
|
|
3323
|
+
return _regenerator().w(function (_context2) {
|
|
3324
|
+
while (1) switch (_context2.n) {
|
|
3325
|
+
case 0:
|
|
3326
|
+
url = getPresetBaseUrl() + "/viewpreset";
|
|
3327
|
+
return _context2.a(2, fetch(url, {
|
|
3328
|
+
headers: getHeaders(auth)
|
|
3329
|
+
}).then(handleResponse));
|
|
3330
|
+
}
|
|
3331
|
+
}, _callee2);
|
|
3332
|
+
}));
|
|
3333
|
+
return function getViewPresets(_x3) {
|
|
3334
|
+
return _ref2.apply(this, arguments);
|
|
3335
|
+
};
|
|
3336
|
+
}();
|
|
3337
|
+
var updateViewPreset = /*#__PURE__*/function () {
|
|
3338
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(viewpresetId, data, auth) {
|
|
3339
|
+
return _regenerator().w(function (_context3) {
|
|
3340
|
+
while (1) switch (_context3.n) {
|
|
3341
|
+
case 0:
|
|
3342
|
+
return _context3.a(2, fetch(getPresetBaseUrl() + "/viewpreset/" + viewpresetId, {
|
|
3343
|
+
headers: getHeaders(auth),
|
|
3344
|
+
method: 'PUT',
|
|
3345
|
+
body: JSON.stringify(data)
|
|
3346
|
+
}).then(handleResponse));
|
|
3347
|
+
}
|
|
3348
|
+
}, _callee3);
|
|
3349
|
+
}));
|
|
3350
|
+
return function updateViewPreset(_x4, _x5, _x6) {
|
|
3351
|
+
return _ref3.apply(this, arguments);
|
|
3352
|
+
};
|
|
3353
|
+
}();
|
|
3354
|
+
var saveViewPreset = /*#__PURE__*/function () {
|
|
3355
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(viewPresetId, data, auth) {
|
|
3356
|
+
var payload;
|
|
3357
|
+
return _regenerator().w(function (_context4) {
|
|
3358
|
+
while (1) switch (_context4.n) {
|
|
3359
|
+
case 0:
|
|
3360
|
+
payload = data.initialProps === null ? Object.assign({}, data, {
|
|
3361
|
+
initialProps: {}
|
|
3362
|
+
}) : data;
|
|
3363
|
+
return _context4.a(2, fetch(getPresetBaseUrl() + "/viewpreset/" + viewPresetId + "/", {
|
|
3364
|
+
headers: getHeaders(auth),
|
|
3365
|
+
method: 'PUT',
|
|
3366
|
+
body: JSON.stringify(payload)
|
|
3367
|
+
}).then(handleResponse));
|
|
3368
|
+
}
|
|
3369
|
+
}, _callee4);
|
|
3370
|
+
}));
|
|
3371
|
+
return function saveViewPreset(_x7, _x8, _x9) {
|
|
3372
|
+
return _ref4.apply(this, arguments);
|
|
3373
|
+
};
|
|
3374
|
+
}();
|
|
3375
|
+
var saveViewPresetAs = /*#__PURE__*/function () {
|
|
3376
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5(data, auth) {
|
|
3377
|
+
var _response$headers$get;
|
|
3378
|
+
var payload, response, headerLocation;
|
|
3379
|
+
return _regenerator().w(function (_context5) {
|
|
3380
|
+
while (1) switch (_context5.n) {
|
|
3381
|
+
case 0:
|
|
3382
|
+
payload = data.initialProps === null ? Object.assign({}, data, {
|
|
3383
|
+
initialProps: {}
|
|
3384
|
+
}) : data;
|
|
3385
|
+
_context5.n = 1;
|
|
3386
|
+
return fetch(getPresetBaseUrl() + "/viewpreset/", {
|
|
3387
|
+
headers: getHeaders(auth),
|
|
3388
|
+
method: 'POST',
|
|
3389
|
+
body: JSON.stringify(payload)
|
|
3390
|
+
});
|
|
3391
|
+
case 1:
|
|
3392
|
+
response = _context5.v;
|
|
3393
|
+
_context5.n = 2;
|
|
3394
|
+
return handleResponse(response);
|
|
3395
|
+
case 2:
|
|
3396
|
+
headerLocation = (_response$headers$get = response.headers.get('Location')) != null ? _response$headers$get : response.headers.get('location');
|
|
3397
|
+
return _context5.a(2, getIdFromUrl(headerLocation));
|
|
3398
|
+
}
|
|
3399
|
+
}, _callee5);
|
|
3400
|
+
}));
|
|
3401
|
+
return function saveViewPresetAs(_x0, _x1) {
|
|
3402
|
+
return _ref5.apply(this, arguments);
|
|
3403
|
+
};
|
|
3404
|
+
}();
|
|
3405
|
+
var deleteViewPreset = /*#__PURE__*/function () {
|
|
3406
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee6(viewPresetId, auth) {
|
|
3407
|
+
return _regenerator().w(function (_context6) {
|
|
3408
|
+
while (1) switch (_context6.n) {
|
|
3409
|
+
case 0:
|
|
3410
|
+
return _context6.a(2, fetch(getPresetBaseUrl() + "/viewpreset/" + viewPresetId, {
|
|
3411
|
+
method: 'DELETE',
|
|
3412
|
+
headers: getHeaders(auth)
|
|
3413
|
+
}).then(handleResponse));
|
|
3414
|
+
}
|
|
3415
|
+
}, _callee6);
|
|
3416
|
+
}));
|
|
3417
|
+
return function deleteViewPreset(_x10, _x11) {
|
|
3418
|
+
return _ref6.apply(this, arguments);
|
|
3419
|
+
};
|
|
3420
|
+
}();
|
|
3421
|
+
|
|
3422
|
+
var API_KEY$1 = 'viewpreset-api';
|
|
3423
|
+
var generateViewPresetQueryKeys = function generateViewPresetQueryKeys() {
|
|
3424
|
+
for (var _len = arguments.length, queryKeys = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3425
|
+
queryKeys[_key] = arguments[_key];
|
|
3426
|
+
}
|
|
3427
|
+
return [LIB_KEY, API_KEY$1].concat(queryKeys);
|
|
3428
|
+
};
|
|
3429
|
+
var viewpresetQueryOptions = {
|
|
3430
|
+
keys: {
|
|
3431
|
+
all: function all() {
|
|
3432
|
+
return generateViewPresetQueryKeys();
|
|
3433
|
+
},
|
|
3434
|
+
views: function views() {
|
|
3435
|
+
return [].concat(viewpresetQueryOptions.keys.all(), ['view']);
|
|
3436
|
+
},
|
|
3437
|
+
lists: function lists() {
|
|
3438
|
+
return [].concat(viewpresetQueryOptions.keys.all(), ['list']);
|
|
3439
|
+
}
|
|
3440
|
+
},
|
|
3441
|
+
getViewPreset: function getViewPreset$1(id, credentials) {
|
|
3442
|
+
return queryOptions({
|
|
3443
|
+
queryKey: [].concat(viewpresetQueryOptions.keys.views(), [id]),
|
|
3444
|
+
queryFn: function () {
|
|
3445
|
+
var _queryFn = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
3446
|
+
return _regenerator().w(function (_context) {
|
|
3447
|
+
while (1) switch (_context.n) {
|
|
3448
|
+
case 0:
|
|
3449
|
+
return _context.a(2, getViewPreset(id, credentials));
|
|
3450
|
+
}
|
|
3451
|
+
}, _callee);
|
|
3452
|
+
}));
|
|
3453
|
+
function queryFn() {
|
|
3454
|
+
return _queryFn.apply(this, arguments);
|
|
3455
|
+
}
|
|
3456
|
+
return queryFn;
|
|
3457
|
+
}()
|
|
3458
|
+
});
|
|
3459
|
+
},
|
|
3460
|
+
getViewPresets: function getViewPresets(credentials) {
|
|
3461
|
+
return queryOptions({
|
|
3462
|
+
queryKey: viewpresetQueryOptions.keys.lists(),
|
|
3463
|
+
queryFn: function () {
|
|
3464
|
+
var _queryFn2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
3465
|
+
return _regenerator().w(function (_context2) {
|
|
3466
|
+
while (1) switch (_context2.n) {
|
|
3467
|
+
case 0:
|
|
3468
|
+
return _context2.a(2, getViewPresets$1(credentials));
|
|
3469
|
+
}
|
|
3470
|
+
}, _callee2);
|
|
3471
|
+
}));
|
|
3472
|
+
function queryFn() {
|
|
3473
|
+
return _queryFn2.apply(this, arguments);
|
|
3474
|
+
}
|
|
3475
|
+
return queryFn;
|
|
3476
|
+
}(),
|
|
3477
|
+
staleTime: 2 * 60 * 1000,
|
|
3478
|
+
refetchOnMount: true
|
|
3479
|
+
});
|
|
3480
|
+
},
|
|
3481
|
+
saveViewPreset: function saveViewPreset$1(id, data, credentials) {
|
|
3482
|
+
return queryOptions({
|
|
3483
|
+
queryKey: [].concat(viewpresetQueryOptions.keys.views(), [id, 'save']),
|
|
3484
|
+
staleTime: 0,
|
|
3485
|
+
queryFn: function () {
|
|
3486
|
+
var _queryFn3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3() {
|
|
3487
|
+
return _regenerator().w(function (_context3) {
|
|
3488
|
+
while (1) switch (_context3.n) {
|
|
3489
|
+
case 0:
|
|
3490
|
+
return _context3.a(2, saveViewPreset(id, data, credentials));
|
|
3491
|
+
}
|
|
3492
|
+
}, _callee3);
|
|
3493
|
+
}));
|
|
3494
|
+
function queryFn() {
|
|
3495
|
+
return _queryFn3.apply(this, arguments);
|
|
3496
|
+
}
|
|
3497
|
+
return queryFn;
|
|
3498
|
+
}()
|
|
3499
|
+
});
|
|
3500
|
+
},
|
|
3501
|
+
saveViewPresetAs: function saveViewPresetAs$1(data, credentials) {
|
|
3502
|
+
return queryOptions({
|
|
3503
|
+
queryKey: [].concat(viewpresetQueryOptions.keys.views(), ['save-as']),
|
|
3504
|
+
staleTime: 0,
|
|
3505
|
+
queryFn: function () {
|
|
3506
|
+
var _queryFn4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4() {
|
|
3507
|
+
return _regenerator().w(function (_context4) {
|
|
3508
|
+
while (1) switch (_context4.n) {
|
|
3509
|
+
case 0:
|
|
3510
|
+
return _context4.a(2, saveViewPresetAs(data, credentials));
|
|
3511
|
+
}
|
|
3512
|
+
}, _callee4);
|
|
3513
|
+
}));
|
|
3514
|
+
function queryFn() {
|
|
3515
|
+
return _queryFn4.apply(this, arguments);
|
|
3516
|
+
}
|
|
3517
|
+
return queryFn;
|
|
3518
|
+
}()
|
|
3519
|
+
});
|
|
3520
|
+
}
|
|
3521
|
+
};
|
|
3522
|
+
|
|
3523
|
+
/* *
|
|
3524
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3525
|
+
* you may not use this file except in compliance with the License.
|
|
3526
|
+
* You may obtain a copy of the License at
|
|
3527
|
+
*
|
|
3528
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3529
|
+
*
|
|
3530
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3531
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3532
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3533
|
+
* See the License for the specific language governing permissions and
|
|
3534
|
+
* limitations under the License.
|
|
3535
|
+
*
|
|
3536
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3537
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
3538
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
3539
|
+
* */
|
|
3540
|
+
var routes = {
|
|
3541
|
+
root: '/',
|
|
3542
|
+
workspace: '/workspace',
|
|
3543
|
+
workspaceDetail: '/workspace/:workspaceId'
|
|
3544
|
+
};
|
|
3545
|
+
var getWorkspaceRouteUrl = function getWorkspaceRouteUrl(workspaceId) {
|
|
3546
|
+
return workspaceId ? routes.workspaceDetail.replace(':workspaceId', workspaceId) : routes.workspace;
|
|
3547
|
+
};
|
|
3389
3548
|
|
|
3390
3549
|
/* *
|
|
3391
3550
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -4393,6 +4552,7 @@ workspaceListener.startListening({
|
|
|
4393
4552
|
case 1:
|
|
4394
4553
|
listenerApi.dispatch(timeSeriesActions.resetTimeSeriesPanels());
|
|
4395
4554
|
listenerApi.dispatch(syncGroupsActions.syncGroupClear());
|
|
4555
|
+
listenerApi.dispatch(mapActions.startViewsSettling());
|
|
4396
4556
|
listenerApi.dispatch(workspaceActions.setPreset(payload));
|
|
4397
4557
|
allSyncGroups = getSyncGroups(payload.workspacePreset.syncGroups);
|
|
4398
4558
|
allSyncGroups.map(function (syncGroup) {
|
|
@@ -4455,6 +4615,8 @@ workspaceListener.startListening({
|
|
|
4455
4615
|
url: getWorkspaceRouteUrl()
|
|
4456
4616
|
}));
|
|
4457
4617
|
}
|
|
4618
|
+
_context4.n = 3;
|
|
4619
|
+
return restoreSyncGroupViews(listenerApi);
|
|
4458
4620
|
case 3:
|
|
4459
4621
|
return _context4.a(2);
|
|
4460
4622
|
}
|
|
@@ -4929,7 +5091,7 @@ workspaceListener.startListening({
|
|
|
4929
5091
|
actionCreator: workspaceActions.updateWorkspaceViews,
|
|
4930
5092
|
effect: function () {
|
|
4931
5093
|
var _effect9 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee13(_, listenerApi) {
|
|
4932
|
-
var viewCountBefore, viewCountAfter, aViewWasClosed
|
|
5094
|
+
var viewCountBefore, viewCountAfter, aViewWasClosed;
|
|
4933
5095
|
return _regenerator().w(function (_context13) {
|
|
4934
5096
|
while (1) switch (_context13.n) {
|
|
4935
5097
|
case 0:
|
|
@@ -4952,24 +5114,7 @@ workspaceListener.startListening({
|
|
|
4952
5114
|
if (aViewWasClosed) {
|
|
4953
5115
|
listenerApi.dispatch(soundingsActions.notifyViewClosed());
|
|
4954
5116
|
}
|
|
4955
|
-
// Adjust the bbox of the original view after the new map is added. This is a temporal solution until the OpenLayers ticket
|
|
4956
|
-
// https://github.com/openlayers/openlayers/issues/16572 is solved.
|
|
4957
|
-
_context13.n = 2;
|
|
4958
|
-
return waitForFrame();
|
|
4959
5117
|
case 2:
|
|
4960
|
-
viewIds = getViewIds(listenerApi.getState());
|
|
4961
|
-
viewIds.forEach(function (viewId) {
|
|
4962
|
-
var bbox = mapSelectors.getBbox(listenerApi.getState(), viewId);
|
|
4963
|
-
var srs = mapSelectors.getSrs(listenerApi.getState(), viewId);
|
|
4964
|
-
if ((bbox == null ? void 0 : bbox.left) !== undefined && srs) {
|
|
4965
|
-
listenerApi.dispatch(mapActions.setBbox({
|
|
4966
|
-
mapId: viewId,
|
|
4967
|
-
bbox: bbox,
|
|
4968
|
-
srs: srs
|
|
4969
|
-
}));
|
|
4970
|
-
}
|
|
4971
|
-
});
|
|
4972
|
-
case 3:
|
|
4973
5118
|
return _context13.a(2);
|
|
4974
5119
|
}
|
|
4975
5120
|
}, _callee13);
|
|
@@ -5289,6 +5434,7 @@ var workspaceReducersMap = {
|
|
|
5289
5434
|
pluginsState: pluginsReducer,
|
|
5290
5435
|
timeSeries: timeSeriesReducer,
|
|
5291
5436
|
soundings: soundingsReducer,
|
|
5437
|
+
crossSection: crossSectionReducer,
|
|
5292
5438
|
snackbar: snackbarReducer
|
|
5293
5439
|
};
|
|
5294
5440
|
var workspaceMiddlewares = [mapListener.middleware, serviceListener.middleware, layersListener.middleware, syncGroupsListener.middleware, workspaceListener.middleware, workspaceListListener.middleware, viewPresetsListener.middleware, snackbarListener.middleware, openlayersListener.middleware];
|
|
@@ -5477,6 +5623,14 @@ var closeDialogsWhenChangingPreset = function closeDialogsWhenChangingPreset(com
|
|
|
5477
5623
|
type: uiTypes.DialogTypes.SoundingsSources
|
|
5478
5624
|
}));
|
|
5479
5625
|
}
|
|
5626
|
+
if (!componentTypes.some(function (componentType) {
|
|
5627
|
+
return componentType.toLowerCase().includes('crosssection');
|
|
5628
|
+
})) {
|
|
5629
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
5630
|
+
setOpen: false,
|
|
5631
|
+
type: uiTypes.DialogTypes.CrossSectionManager
|
|
5632
|
+
}));
|
|
5633
|
+
}
|
|
5480
5634
|
// Close dialogs related to the warninglist
|
|
5481
5635
|
if (!componentTypes.some(function (componentType) {
|
|
5482
5636
|
return componentType.toLowerCase().includes('warninglist');
|
|
@@ -8332,6 +8486,8 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
8332
8486
|
})), [queryClient]);
|
|
8333
8487
|
var constructInitialProps = function constructInitialProps() {
|
|
8334
8488
|
switch (viewComponentType) {
|
|
8489
|
+
case 'DataExplorer':
|
|
8490
|
+
return getViewPresetToSendToBackend(store.getState(), panelId).initialProps;
|
|
8335
8491
|
case 'WarningList':
|
|
8336
8492
|
case 'WarningsTimeline':
|
|
8337
8493
|
return currentWarningsPreset;
|
|
@@ -9871,8 +10027,10 @@ var _WorkspaceViewTitleConnectNoMemo = function WorkspaceViewTitleConnectNoMemo(
|
|
|
9871
10027
|
mapPreset: mapSelectors.getMapPreset(store.getState(), panelId),
|
|
9872
10028
|
syncGroupsIds: relatedSyncGroupIds
|
|
9873
10029
|
};
|
|
9874
|
-
case 'Plugin':
|
|
9875
10030
|
case 'CrossSection':
|
|
10031
|
+
return Object.assign({}, crossSectionSelectors.getCrossSectionPreset(store.getState(), panelId));
|
|
10032
|
+
case 'DataExplorer':
|
|
10033
|
+
case 'Plugin':
|
|
9876
10034
|
return getViewPresetToSendToBackend(store.getState(), panelId).initialProps;
|
|
9877
10035
|
default:
|
|
9878
10036
|
return undefined;
|
|
@@ -12228,6 +12386,17 @@ var ViewPresetsFormDialogConnect = function ViewPresetsFormDialogConnect(_ref) {
|
|
|
12228
12386
|
});
|
|
12229
12387
|
};
|
|
12230
12388
|
|
|
12389
|
+
var _templateObject, _templateObject2, _offMainThreadBarAnim;
|
|
12390
|
+
var bar1SlideKeyframes = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n 0% { transform: translateX(-35%) scaleX(0.35); }\n 60%, 100% { transform: translateX(100%) scaleX(0.9); }\n"])));
|
|
12391
|
+
var bar2SlideKeyframes = keyframes(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n 0% { transform: translateX(-200%) scaleX(2); }\n 60%, 100% { transform: translateX(107%) scaleX(0.01); }\n"])));
|
|
12392
|
+
/** MUI's indeterminate motion as transforms, which keep animating while the main thread mounts views. */
|
|
12393
|
+
var offMainThreadBarAnimation = (_offMainThreadBarAnim = {}, _offMainThreadBarAnim["& ." + linearProgressClasses.bar1 + ", & ." + linearProgressClasses.bar2] = {
|
|
12394
|
+
width: '100%'
|
|
12395
|
+
}, _offMainThreadBarAnim["& ." + linearProgressClasses.bar1] = {
|
|
12396
|
+
animation: bar1SlideKeyframes + " 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite"
|
|
12397
|
+
}, _offMainThreadBarAnim["& ." + linearProgressClasses.bar2] = {
|
|
12398
|
+
animation: bar2SlideKeyframes + " 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite"
|
|
12399
|
+
}, _offMainThreadBarAnim);
|
|
12231
12400
|
var WorkspaceDetail = function WorkspaceDetail(_ref) {
|
|
12232
12401
|
var initialWorkspaceId = _ref.initialWorkspaceId,
|
|
12233
12402
|
workspaceId = _ref.workspaceId,
|
|
@@ -12247,6 +12416,7 @@ var WorkspaceDetail = function WorkspaceDetail(_ref) {
|
|
|
12247
12416
|
return getWorkspaceError(store);
|
|
12248
12417
|
});
|
|
12249
12418
|
var isLoading = useSelector(isWorkspaceLoading);
|
|
12419
|
+
var areViewsSettling = useSelector(mapSelectors.areViewsSettling);
|
|
12250
12420
|
var workspaceData = useSelector(getWorkspaceData);
|
|
12251
12421
|
var workspaceState = useSelector(getWorkspaceState);
|
|
12252
12422
|
var fetchWorkspace = React.useCallback(function (newWorkspaceId) {
|
|
@@ -12296,15 +12466,15 @@ var WorkspaceDetail = function WorkspaceDetail(_ref) {
|
|
|
12296
12466
|
width: '100%',
|
|
12297
12467
|
height: '100%'
|
|
12298
12468
|
},
|
|
12299
|
-
children: [!!isLoading && jsx(LinearProgress, {
|
|
12469
|
+
children: [!!(isLoading || areViewsSettling) && jsx(LinearProgress, {
|
|
12300
12470
|
color: "secondary",
|
|
12301
12471
|
"data-testid": "loading-bar",
|
|
12302
|
-
sx: {
|
|
12472
|
+
sx: Object.assign({
|
|
12303
12473
|
position: 'absolute',
|
|
12304
12474
|
width: '100%',
|
|
12305
12475
|
top: 0,
|
|
12306
12476
|
zIndex: 100
|
|
12307
|
-
}
|
|
12477
|
+
}, offMainThreadBarAnimation)
|
|
12308
12478
|
}), !!error && error.type !== WorkspaceErrorType.SAVE && jsx(AlertBanner, Object.assign({
|
|
12309
12479
|
info: error.message,
|
|
12310
12480
|
shouldClose: true,
|
|
@@ -12367,8 +12537,9 @@ var TranslatedError = /*#__PURE__*/function (_Error) {
|
|
|
12367
12537
|
* Coordinates the Data Explorer with the workspace and Timeseries panels.
|
|
12368
12538
|
* Data Explorer itself does not depend on workspace or Timeseries.
|
|
12369
12539
|
*/
|
|
12370
|
-
var
|
|
12371
|
-
var
|
|
12540
|
+
var DataExplorerActionsConnect = function DataExplorerActionsConnect(_ref) {
|
|
12541
|
+
var dataExplorerPanelId = _ref.panelId,
|
|
12542
|
+
children = _ref.children;
|
|
12372
12543
|
var store = useStore();
|
|
12373
12544
|
var _useTranslation = useTranslation([DATA_EXPLORER_NAMESPACE, SHARED_NAMESPACE]),
|
|
12374
12545
|
t = _useTranslation.t;
|
|
@@ -12405,24 +12576,209 @@ var DataExplorerTimeseriesConnect = function DataExplorerTimeseriesConnect(_ref)
|
|
|
12405
12576
|
resolveChoice.current == null || resolveChoice.current(id);
|
|
12406
12577
|
resolveChoice.current = undefined;
|
|
12407
12578
|
};
|
|
12408
|
-
var
|
|
12579
|
+
var addMapLayer = React.useCallback(/*#__PURE__*/function () {
|
|
12409
12580
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref3) {
|
|
12410
|
-
var _store$getState$works
|
|
12411
|
-
var title,
|
|
12581
|
+
var _store$getState$works;
|
|
12582
|
+
var title, targetMapId, createLayer, workspaceId, _state$workspace, _state$workspace2, _loadedLayer$id, _state$workspace3, _state$workspace4, state, availableMapIds, linkedMapIds, destinationMapIds, selectedMapId, loadedLayer, layer, mapId, mosaicNode, _t;
|
|
12412
12583
|
return _regenerator().w(function (_context2) {
|
|
12413
|
-
while (1) switch (_context2.n) {
|
|
12584
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
12414
12585
|
case 0:
|
|
12415
|
-
title = _ref3.title,
|
|
12586
|
+
title = _ref3.title, targetMapId = _ref3.targetMapId, createLayer = _ref3.createLayer;
|
|
12416
12587
|
workspaceId = (_store$getState$works = store.getState().workspace) == null ? void 0 : _store$getState$works.id;
|
|
12588
|
+
_context2.p = 1;
|
|
12589
|
+
state = store.getState();
|
|
12590
|
+
availableMapIds = mapSelectors.getAllMapIds(state);
|
|
12591
|
+
linkedMapIds = [];
|
|
12592
|
+
if (dataExplorerPanelId) {
|
|
12593
|
+
linkedMapIds = genericSelectors.getLinkedTargetIds(state, dataExplorerPanelId).filter(function (id) {
|
|
12594
|
+
return availableMapIds.includes(id);
|
|
12595
|
+
});
|
|
12596
|
+
} else if (targetMapId) {
|
|
12597
|
+
linkedMapIds = [targetMapId];
|
|
12598
|
+
}
|
|
12599
|
+
destinationMapIds = linkedMapIds;
|
|
12600
|
+
if (!dataExplorerPanelId && !destinationMapIds.length && availableMapIds.length === 1) {
|
|
12601
|
+
destinationMapIds = availableMapIds;
|
|
12602
|
+
}
|
|
12603
|
+
if (!(!dataExplorerPanelId && !destinationMapIds.length && availableMapIds.length > 1)) {
|
|
12604
|
+
_context2.n = 4;
|
|
12605
|
+
break;
|
|
12606
|
+
}
|
|
12607
|
+
_context2.n = 2;
|
|
12608
|
+
return choose({
|
|
12609
|
+
title: t('dataexplorer-select-map-view'),
|
|
12610
|
+
options: availableMapIds.map(function (id, index) {
|
|
12611
|
+
var _getViewById;
|
|
12612
|
+
return {
|
|
12613
|
+
id: id,
|
|
12614
|
+
title: ((_getViewById = getViewById(state, id)) == null ? void 0 : _getViewById.title) || t('dataexplorer-map-view', {
|
|
12615
|
+
number: index + 1
|
|
12616
|
+
})
|
|
12617
|
+
};
|
|
12618
|
+
})
|
|
12619
|
+
});
|
|
12620
|
+
case 2:
|
|
12621
|
+
selectedMapId = _context2.v;
|
|
12622
|
+
if (selectedMapId) {
|
|
12623
|
+
_context2.n = 3;
|
|
12624
|
+
break;
|
|
12625
|
+
}
|
|
12626
|
+
return _context2.a(2, undefined);
|
|
12627
|
+
case 3:
|
|
12628
|
+
destinationMapIds = [selectedMapId];
|
|
12629
|
+
case 4:
|
|
12630
|
+
if (mounted.current) {
|
|
12631
|
+
_context2.n = 5;
|
|
12632
|
+
break;
|
|
12633
|
+
}
|
|
12634
|
+
return _context2.a(2, undefined);
|
|
12635
|
+
case 5:
|
|
12636
|
+
state = store.getState();
|
|
12637
|
+
if (!(((_state$workspace = state.workspace) == null ? void 0 : _state$workspace.id) !== workspaceId || (_state$workspace2 = state.workspace) != null && _state$workspace2.isLoading || destinationMapIds.some(function (id) {
|
|
12638
|
+
return !mapSelectors.getAllMapIds(state).includes(id);
|
|
12639
|
+
}))) {
|
|
12640
|
+
_context2.n = 6;
|
|
12641
|
+
break;
|
|
12642
|
+
}
|
|
12643
|
+
throw new TranslatedError(t('dataexplorer-map-error-workspace-changed'));
|
|
12644
|
+
case 6:
|
|
12645
|
+
if (!(!dataExplorerPanelId && !destinationMapIds.length && getViewIds(state).some(function (id) {
|
|
12646
|
+
var _getViewById2;
|
|
12647
|
+
return ((_getViewById2 = getViewById(state, id)) == null ? void 0 : _getViewById2.componentType) === 'Map';
|
|
12648
|
+
}))) {
|
|
12649
|
+
_context2.n = 7;
|
|
12650
|
+
break;
|
|
12651
|
+
}
|
|
12652
|
+
throw new TranslatedError(t('dataexplorer-map-error-loading'));
|
|
12653
|
+
case 7:
|
|
12654
|
+
_context2.n = 8;
|
|
12655
|
+
return createLayer();
|
|
12656
|
+
case 8:
|
|
12657
|
+
loadedLayer = _context2.v;
|
|
12658
|
+
layer = Object.assign({}, loadedLayer, {
|
|
12659
|
+
id: (_loadedLayer$id = loadedLayer.id) != null ? _loadedLayer$id : v4()
|
|
12660
|
+
});
|
|
12661
|
+
if (mounted.current) {
|
|
12662
|
+
_context2.n = 9;
|
|
12663
|
+
break;
|
|
12664
|
+
}
|
|
12665
|
+
return _context2.a(2, undefined);
|
|
12666
|
+
case 9:
|
|
12667
|
+
state = store.getState();
|
|
12668
|
+
if (!(((_state$workspace3 = state.workspace) == null ? void 0 : _state$workspace3.id) !== workspaceId || (_state$workspace4 = state.workspace) != null && _state$workspace4.isLoading || destinationMapIds.some(function (id) {
|
|
12669
|
+
return !mapSelectors.getAllMapIds(state).includes(id);
|
|
12670
|
+
}))) {
|
|
12671
|
+
_context2.n = 10;
|
|
12672
|
+
break;
|
|
12673
|
+
}
|
|
12674
|
+
throw new TranslatedError(t('dataexplorer-map-error-workspace-changed'));
|
|
12675
|
+
case 10:
|
|
12676
|
+
if (!destinationMapIds.length) {
|
|
12677
|
+
mapId = v4();
|
|
12678
|
+
// Include the layer in the initial preset so mounting the map preserves it.
|
|
12679
|
+
store.dispatch(workspaceActions.addWorkspaceView({
|
|
12680
|
+
id: mapId,
|
|
12681
|
+
componentType: 'Map',
|
|
12682
|
+
initialProps: {
|
|
12683
|
+
mapPreset: {
|
|
12684
|
+
layers: [layer]
|
|
12685
|
+
},
|
|
12686
|
+
syncGroupsIds: []
|
|
12687
|
+
}
|
|
12688
|
+
}));
|
|
12689
|
+
store.dispatch(workspaceActions.updateWorkspaceView({
|
|
12690
|
+
mosaicNodeId: mapId,
|
|
12691
|
+
viewPreset: Object.assign({}, getViewById(store.getState(), mapId), {
|
|
12692
|
+
title: title
|
|
12693
|
+
})
|
|
12694
|
+
}));
|
|
12695
|
+
store.dispatch(viewPresetActions.setViewPresetInline({
|
|
12696
|
+
panelId: mapId,
|
|
12697
|
+
isInline: true
|
|
12698
|
+
}));
|
|
12699
|
+
mosaicNode = getMosaicNode(store.getState());
|
|
12700
|
+
store.dispatch(workspaceActions.updateWorkspaceViews({
|
|
12701
|
+
mosaicNode: mosaicNode ? {
|
|
12702
|
+
direction: 'row',
|
|
12703
|
+
first: mosaicNode,
|
|
12704
|
+
second: mapId
|
|
12705
|
+
} : mapId
|
|
12706
|
+
}));
|
|
12707
|
+
if (dataExplorerPanelId) {
|
|
12708
|
+
store.dispatch(syncGroupsActions.updateLinkedMap({
|
|
12709
|
+
panelId: dataExplorerPanelId,
|
|
12710
|
+
mapIds: [mapId]
|
|
12711
|
+
}));
|
|
12712
|
+
}
|
|
12713
|
+
destinationMapIds = [mapId];
|
|
12714
|
+
} else {
|
|
12715
|
+
mapId = destinationMapIds[0];
|
|
12716
|
+
destinationMapIds.forEach(function (destinationMapId, index) {
|
|
12717
|
+
var destinationLayer = index === 0 ? layer : Object.assign({}, layer, {
|
|
12718
|
+
id: v4()
|
|
12719
|
+
});
|
|
12720
|
+
if (layerSelectors.getLayersByMapId(state, destinationMapId).some(function (existing) {
|
|
12721
|
+
return existing.service === layer.service && existing.name === layer.name;
|
|
12722
|
+
})) {
|
|
12723
|
+
return;
|
|
12724
|
+
}
|
|
12725
|
+
store.dispatch(layerActions.addLayer({
|
|
12726
|
+
mapId: destinationMapId,
|
|
12727
|
+
layerId: destinationLayer.id,
|
|
12728
|
+
layer: destinationLayer,
|
|
12729
|
+
origin: layerTypes.LayerActionOrigin.dataExplorer
|
|
12730
|
+
}));
|
|
12731
|
+
});
|
|
12732
|
+
}
|
|
12733
|
+
destinationMapIds.forEach(function (destinationMapId) {
|
|
12734
|
+
return store.dispatch(viewPresetActions.setViewPresetHasChanges({
|
|
12735
|
+
panelId: destinationMapId,
|
|
12736
|
+
hasChanges: true
|
|
12737
|
+
}));
|
|
12738
|
+
});
|
|
12739
|
+
store.dispatch(workspaceActions.markWorkspaceChanged());
|
|
12740
|
+
store.dispatch(uiActions.setActiveWindowId({
|
|
12741
|
+
activeWindowId: mapId
|
|
12742
|
+
}));
|
|
12743
|
+
return _context2.a(2, mapId);
|
|
12744
|
+
case 11:
|
|
12745
|
+
_context2.p = 11;
|
|
12746
|
+
_t = _context2.v;
|
|
12747
|
+
if (!(_t instanceof TranslatedError)) {
|
|
12748
|
+
_context2.n = 12;
|
|
12749
|
+
break;
|
|
12750
|
+
}
|
|
12751
|
+
throw _t;
|
|
12752
|
+
case 12:
|
|
12753
|
+
console.error('Unable to add dataset to a map: ', _t);
|
|
12754
|
+
throw new TranslatedError(t('dataexplorer-map-error-generic'));
|
|
12755
|
+
case 13:
|
|
12756
|
+
return _context2.a(2);
|
|
12757
|
+
}
|
|
12758
|
+
}, _callee2, null, [[1, 11]]);
|
|
12759
|
+
}));
|
|
12760
|
+
return function (_x2) {
|
|
12761
|
+
return _ref4.apply(this, arguments);
|
|
12762
|
+
};
|
|
12763
|
+
}(), [choose, dataExplorerPanelId, store, t]);
|
|
12764
|
+
var addTimeseriesToWorkspace = React.useCallback(/*#__PURE__*/function () {
|
|
12765
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(_ref5) {
|
|
12766
|
+
var _store$getState$works2, _state$workspace5, _state$workspace6, _state$workspace7, _state$workspace8, _getViewById5, _timeSeriesSelectors$2;
|
|
12767
|
+
var title, collectionLinks, targetMapId, workspaceId, collectionUrl, target, state, panels, destinationMapIds, candidates, panelId, existingService, service, plotId, isNewPanel, plotPreset, mosaicNode, _t2;
|
|
12768
|
+
return _regenerator().w(function (_context3) {
|
|
12769
|
+
while (1) switch (_context3.n) {
|
|
12770
|
+
case 0:
|
|
12771
|
+
title = _ref5.title, collectionLinks = _ref5.collectionLinks, targetMapId = _ref5.targetMapId;
|
|
12772
|
+
workspaceId = (_store$getState$works2 = store.getState().workspace) == null ? void 0 : _store$getState$works2.id;
|
|
12417
12773
|
if (!(collectionLinks.length === 1)) {
|
|
12418
|
-
|
|
12774
|
+
_context3.n = 1;
|
|
12419
12775
|
break;
|
|
12420
12776
|
}
|
|
12421
|
-
|
|
12422
|
-
|
|
12777
|
+
_t2 = collectionLinks[0].href;
|
|
12778
|
+
_context3.n = 3;
|
|
12423
12779
|
break;
|
|
12424
12780
|
case 1:
|
|
12425
|
-
|
|
12781
|
+
_context3.n = 2;
|
|
12426
12782
|
return choose({
|
|
12427
12783
|
title: t('dataexplorer-select-data-link'),
|
|
12428
12784
|
options: collectionLinks.map(function (link) {
|
|
@@ -12433,54 +12789,68 @@ var DataExplorerTimeseriesConnect = function DataExplorerTimeseriesConnect(_ref)
|
|
|
12433
12789
|
})
|
|
12434
12790
|
});
|
|
12435
12791
|
case 2:
|
|
12436
|
-
|
|
12792
|
+
_t2 = _context3.v;
|
|
12437
12793
|
case 3:
|
|
12438
|
-
collectionUrl =
|
|
12794
|
+
collectionUrl = _t2;
|
|
12439
12795
|
if (!(!collectionUrl || !mounted.current)) {
|
|
12440
|
-
|
|
12796
|
+
_context3.n = 4;
|
|
12441
12797
|
break;
|
|
12442
12798
|
}
|
|
12443
|
-
return
|
|
12799
|
+
return _context3.a(2);
|
|
12444
12800
|
case 4:
|
|
12445
|
-
|
|
12801
|
+
_context3.n = 5;
|
|
12446
12802
|
return resolveEdrCollectionTarget(collectionUrl);
|
|
12447
12803
|
case 5:
|
|
12448
|
-
target =
|
|
12804
|
+
target = _context3.v;
|
|
12449
12805
|
if (mounted.current) {
|
|
12450
|
-
|
|
12806
|
+
_context3.n = 6;
|
|
12451
12807
|
break;
|
|
12452
12808
|
}
|
|
12453
|
-
return
|
|
12809
|
+
return _context3.a(2);
|
|
12454
12810
|
case 6:
|
|
12455
12811
|
state = store.getState();
|
|
12456
|
-
if (!(((_state$
|
|
12457
|
-
|
|
12812
|
+
if (!(((_state$workspace5 = state.workspace) == null ? void 0 : _state$workspace5.id) !== workspaceId || (_state$workspace6 = state.workspace) != null && _state$workspace6.isLoading)) {
|
|
12813
|
+
_context3.n = 7;
|
|
12458
12814
|
break;
|
|
12459
12815
|
}
|
|
12460
12816
|
throw new TranslatedError(t('dataexplorer-timeseries-error-workspace-changed'));
|
|
12461
12817
|
case 7:
|
|
12462
12818
|
panels = getViewIds(state).filter(function (id) {
|
|
12463
|
-
var
|
|
12464
|
-
return ((
|
|
12819
|
+
var _getViewById3;
|
|
12820
|
+
return ((_getViewById3 = getViewById(state, id)) == null ? void 0 : _getViewById3.componentType) === 'TimeSeries';
|
|
12465
12821
|
});
|
|
12466
|
-
|
|
12467
|
-
|
|
12468
|
-
|
|
12469
|
-
|
|
12470
|
-
|
|
12822
|
+
destinationMapIds = [];
|
|
12823
|
+
if (dataExplorerPanelId) {
|
|
12824
|
+
destinationMapIds = genericSelectors.getLinkedTargetIds(state, dataExplorerPanelId).filter(function (id) {
|
|
12825
|
+
return mapSelectors.getAllMapIds(state).includes(id);
|
|
12826
|
+
});
|
|
12827
|
+
} else if (targetMapId) {
|
|
12828
|
+
destinationMapIds = [targetMapId];
|
|
12829
|
+
}
|
|
12830
|
+
candidates = [];
|
|
12831
|
+
if (destinationMapIds.length) {
|
|
12832
|
+
candidates = panels.filter(function (id) {
|
|
12833
|
+
var linkedMaps = genericSelectors.getLinkedTargetIds(state, id);
|
|
12834
|
+
return linkedMaps.length > 0 ? linkedMaps.some(function (mapId) {
|
|
12835
|
+
return destinationMapIds.includes(mapId);
|
|
12836
|
+
}) : destinationMapIds.includes(timeSeriesSelectors.getMapId(state, id) || '');
|
|
12837
|
+
});
|
|
12838
|
+
} else if (!dataExplorerPanelId) {
|
|
12839
|
+
candidates = panels;
|
|
12840
|
+
}
|
|
12471
12841
|
panelId = candidates.length === 1 ? candidates[0] : undefined;
|
|
12472
12842
|
if (!(candidates.length > 1)) {
|
|
12473
|
-
|
|
12843
|
+
_context3.n = 9;
|
|
12474
12844
|
break;
|
|
12475
12845
|
}
|
|
12476
|
-
|
|
12846
|
+
_context3.n = 8;
|
|
12477
12847
|
return choose({
|
|
12478
12848
|
title: t('dataexplorer-select-timeseries-panel'),
|
|
12479
12849
|
options: candidates.map(function (id, index) {
|
|
12480
|
-
var
|
|
12850
|
+
var _getViewById4, _timeSeriesSelectors$;
|
|
12481
12851
|
return {
|
|
12482
12852
|
id: id,
|
|
12483
|
-
title: ((
|
|
12853
|
+
title: ((_getViewById4 = getViewById(state, id)) == null ? void 0 : _getViewById4.title) || t('dataexplorer-timeseries-panel', {
|
|
12484
12854
|
number: index + 1
|
|
12485
12855
|
}),
|
|
12486
12856
|
description: (_timeSeriesSelectors$ = timeSeriesSelectors.getPlotState(state, id)) == null ? void 0 : _timeSeriesSelectors$.plots.map(function (plot) {
|
|
@@ -12490,22 +12860,22 @@ var DataExplorerTimeseriesConnect = function DataExplorerTimeseriesConnect(_ref)
|
|
|
12490
12860
|
})
|
|
12491
12861
|
});
|
|
12492
12862
|
case 8:
|
|
12493
|
-
panelId =
|
|
12863
|
+
panelId = _context3.v;
|
|
12494
12864
|
if (panelId) {
|
|
12495
|
-
|
|
12865
|
+
_context3.n = 9;
|
|
12496
12866
|
break;
|
|
12497
12867
|
}
|
|
12498
|
-
return
|
|
12868
|
+
return _context3.a(2);
|
|
12499
12869
|
case 9:
|
|
12500
12870
|
state = store.getState();
|
|
12501
12871
|
if (mounted.current) {
|
|
12502
|
-
|
|
12872
|
+
_context3.n = 10;
|
|
12503
12873
|
break;
|
|
12504
12874
|
}
|
|
12505
|
-
return
|
|
12875
|
+
return _context3.a(2);
|
|
12506
12876
|
case 10:
|
|
12507
|
-
if (!(((_state$
|
|
12508
|
-
|
|
12877
|
+
if (!(((_state$workspace7 = state.workspace) == null ? void 0 : _state$workspace7.id) !== workspaceId || (_state$workspace8 = state.workspace) != null && _state$workspace8.isLoading || panelId && ((_getViewById5 = getViewById(state, panelId)) == null ? void 0 : _getViewById5.componentType) !== 'TimeSeries')) {
|
|
12878
|
+
_context3.n = 11;
|
|
12509
12879
|
break;
|
|
12510
12880
|
}
|
|
12511
12881
|
throw new TranslatedError(t('dataexplorer-timeseries-error-workspace-changed'));
|
|
@@ -12528,7 +12898,7 @@ var DataExplorerTimeseriesConnect = function DataExplorerTimeseriesConnect(_ref)
|
|
|
12528
12898
|
isNewPanel = !panelId;
|
|
12529
12899
|
panelId != null ? panelId : panelId = v4();
|
|
12530
12900
|
if (!(!isNewPanel && !timeSeriesSelectors.getPlotState(state, panelId))) {
|
|
12531
|
-
|
|
12901
|
+
_context3.n = 12;
|
|
12532
12902
|
break;
|
|
12533
12903
|
}
|
|
12534
12904
|
throw new TranslatedError(t('dataexplorer-timeseries-error-panel-loading'));
|
|
@@ -12548,7 +12918,7 @@ var DataExplorerTimeseriesConnect = function DataExplorerTimeseriesConnect(_ref)
|
|
|
12548
12918
|
}
|
|
12549
12919
|
if (isNewPanel) {
|
|
12550
12920
|
plotPreset = {
|
|
12551
|
-
mapId:
|
|
12921
|
+
mapId: destinationMapIds[0] || '',
|
|
12552
12922
|
plots: [{
|
|
12553
12923
|
plotId: plotId,
|
|
12554
12924
|
title: title
|
|
@@ -12581,10 +12951,10 @@ var DataExplorerTimeseriesConnect = function DataExplorerTimeseriesConnect(_ref)
|
|
|
12581
12951
|
panelId: panelId,
|
|
12582
12952
|
plotPreset: plotPreset
|
|
12583
12953
|
}));
|
|
12584
|
-
if (
|
|
12954
|
+
if (destinationMapIds.length) {
|
|
12585
12955
|
store.dispatch(syncGroupsActions.updateLinkedMap({
|
|
12586
12956
|
panelId: panelId,
|
|
12587
|
-
mapIds:
|
|
12957
|
+
mapIds: destinationMapIds
|
|
12588
12958
|
}));
|
|
12589
12959
|
}
|
|
12590
12960
|
} else {
|
|
@@ -12617,57 +12987,84 @@ var DataExplorerTimeseriesConnect = function DataExplorerTimeseriesConnect(_ref)
|
|
|
12617
12987
|
}));
|
|
12618
12988
|
});
|
|
12619
12989
|
case 13:
|
|
12620
|
-
return
|
|
12990
|
+
return _context3.a(2);
|
|
12621
12991
|
}
|
|
12622
|
-
},
|
|
12992
|
+
}, _callee3);
|
|
12623
12993
|
}));
|
|
12624
|
-
return function (
|
|
12625
|
-
return
|
|
12994
|
+
return function (_x3) {
|
|
12995
|
+
return _ref6.apply(this, arguments);
|
|
12626
12996
|
};
|
|
12627
|
-
}(), [choose, store, t]);
|
|
12997
|
+
}(), [choose, dataExplorerPanelId, store, t]);
|
|
12628
12998
|
var addTimeseries = React.useCallback(/*#__PURE__*/function () {
|
|
12629
|
-
var
|
|
12630
|
-
var
|
|
12631
|
-
return _regenerator().w(function (
|
|
12632
|
-
while (1) switch (
|
|
12999
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(request) {
|
|
13000
|
+
var _t3;
|
|
13001
|
+
return _regenerator().w(function (_context4) {
|
|
13002
|
+
while (1) switch (_context4.p = _context4.n) {
|
|
12633
13003
|
case 0:
|
|
12634
|
-
|
|
12635
|
-
|
|
13004
|
+
_context4.p = 0;
|
|
13005
|
+
_context4.n = 1;
|
|
12636
13006
|
return addTimeseriesToWorkspace(request);
|
|
12637
13007
|
case 1:
|
|
12638
|
-
|
|
13008
|
+
_context4.n = 5;
|
|
12639
13009
|
break;
|
|
12640
13010
|
case 2:
|
|
12641
|
-
|
|
12642
|
-
|
|
12643
|
-
if (!(
|
|
12644
|
-
|
|
13011
|
+
_context4.p = 2;
|
|
13012
|
+
_t3 = _context4.v;
|
|
13013
|
+
if (!(_t3 instanceof TranslatedError)) {
|
|
13014
|
+
_context4.n = 3;
|
|
12645
13015
|
break;
|
|
12646
13016
|
}
|
|
12647
|
-
throw
|
|
13017
|
+
throw _t3;
|
|
12648
13018
|
case 3:
|
|
12649
|
-
if (!(
|
|
12650
|
-
|
|
13019
|
+
if (!(_t3 instanceof EdrCollectionTargetError)) {
|
|
13020
|
+
_context4.n = 4;
|
|
12651
13021
|
break;
|
|
12652
13022
|
}
|
|
12653
|
-
throw new TranslatedError(t("dataexplorer-timeseries-error-" +
|
|
13023
|
+
throw new TranslatedError(t("dataexplorer-timeseries-error-" + _t3.code));
|
|
12654
13024
|
case 4:
|
|
12655
|
-
console.error('Unable to add dataset as Timeseries: ',
|
|
13025
|
+
console.error('Unable to add dataset as Timeseries: ', _t3);
|
|
12656
13026
|
throw new TranslatedError(t('dataexplorer-timeseries-error-generic'));
|
|
12657
13027
|
case 5:
|
|
12658
|
-
return
|
|
13028
|
+
return _context4.a(2);
|
|
12659
13029
|
}
|
|
12660
|
-
},
|
|
13030
|
+
}, _callee4, null, [[0, 2]]);
|
|
12661
13031
|
}));
|
|
12662
|
-
return function (
|
|
12663
|
-
return
|
|
13032
|
+
return function (_x4) {
|
|
13033
|
+
return _ref7.apply(this, arguments);
|
|
12664
13034
|
};
|
|
12665
13035
|
}(), [addTimeseriesToWorkspace, t]);
|
|
13036
|
+
var removeMapLayer = React.useCallback(function (_ref8) {
|
|
13037
|
+
var targetMapIds = _ref8.targetMapIds,
|
|
13038
|
+
layerName = _ref8.layerName,
|
|
13039
|
+
serviceUrl = _ref8.serviceUrl;
|
|
13040
|
+
var state = store.getState();
|
|
13041
|
+
var linkedMapIds = dataExplorerPanelId ? genericSelectors.getLinkedTargetIds(state, dataExplorerPanelId) : targetMapIds;
|
|
13042
|
+
var mapIds = new Set(linkedMapIds);
|
|
13043
|
+
var matchingLayers = layerSelectors.getAllLayers(state).filter(function (layer) {
|
|
13044
|
+
return mapIds.has(layer.mapId) && layer.name === layerName && layer.service === serviceUrl;
|
|
13045
|
+
});
|
|
13046
|
+
var changedMapIds = new Set();
|
|
13047
|
+
matchingLayers.forEach(function (layer) {
|
|
13048
|
+
var mapId = layer.mapId;
|
|
13049
|
+
store.dispatch(layerActions.layerDelete({
|
|
13050
|
+
mapId: mapId,
|
|
13051
|
+
layerId: layer.id,
|
|
13052
|
+
origin: layerTypes.LayerActionOrigin.layerManager
|
|
13053
|
+
}));
|
|
13054
|
+
changedMapIds.add(mapId);
|
|
13055
|
+
});
|
|
13056
|
+
changedMapIds.forEach(function (mapId) {
|
|
13057
|
+
store.dispatch(viewPresetActions.setViewPresetHasChanges({
|
|
13058
|
+
panelId: mapId,
|
|
13059
|
+
hasChanges: true
|
|
13060
|
+
}));
|
|
13061
|
+
});
|
|
13062
|
+
if (changedMapIds.size) {
|
|
13063
|
+
store.dispatch(workspaceActions.markWorkspaceChanged());
|
|
13064
|
+
}
|
|
13065
|
+
}, [dataExplorerPanelId, store]);
|
|
12666
13066
|
return jsxs(Fragment, {
|
|
12667
|
-
children: [
|
|
12668
|
-
onAddTimeseries: addTimeseries,
|
|
12669
|
-
productConfigKey: productConfigKey
|
|
12670
|
-
}), jsxs(Dialog, {
|
|
13067
|
+
children: [children(addTimeseries, addMapLayer, removeMapLayer), jsxs(Dialog, {
|
|
12671
13068
|
onClose: function onClose() {
|
|
12672
13069
|
return finishChoice();
|
|
12673
13070
|
},
|
|
@@ -12699,6 +13096,18 @@ var DataExplorerTimeseriesConnect = function DataExplorerTimeseriesConnect(_ref)
|
|
|
12699
13096
|
})]
|
|
12700
13097
|
});
|
|
12701
13098
|
};
|
|
13099
|
+
var DataExplorerTimeseriesConnect = function DataExplorerTimeseriesConnect(_ref9) {
|
|
13100
|
+
var productConfigKey = _ref9.productConfigKey;
|
|
13101
|
+
return jsx(DataExplorerActionsConnect, {
|
|
13102
|
+
children: function children(addTimeseries, addMapLayer) {
|
|
13103
|
+
return jsx(DataExplorerConnect, {
|
|
13104
|
+
onAddMapLayer: addMapLayer,
|
|
13105
|
+
onAddTimeseries: addTimeseries,
|
|
13106
|
+
productConfigKey: productConfigKey
|
|
13107
|
+
});
|
|
13108
|
+
}
|
|
13109
|
+
});
|
|
13110
|
+
};
|
|
12702
13111
|
|
|
12703
13112
|
/* *
|
|
12704
13113
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -12949,6 +13358,20 @@ var viewPresets = [
|
|
|
12949
13358
|
componentType: "WarningsTimeline",
|
|
12950
13359
|
initialProps: {
|
|
12951
13360
|
}
|
|
13361
|
+
},
|
|
13362
|
+
{
|
|
13363
|
+
id: "template-data-explorer",
|
|
13364
|
+
title: {
|
|
13365
|
+
en: "New data explorer preset",
|
|
13366
|
+
fi: "Uusi data explorer-preset",
|
|
13367
|
+
no: "Ny data explorer-preset",
|
|
13368
|
+
nl: "Nieuwe data explorer-preset"
|
|
13369
|
+
},
|
|
13370
|
+
componentType: "DataExplorer",
|
|
13371
|
+
initialProps: {
|
|
13372
|
+
dataExplorerPreset: {
|
|
13373
|
+
}
|
|
13374
|
+
}
|
|
12952
13375
|
}
|
|
12953
13376
|
];
|
|
12954
13377
|
var templatePresets = {
|
|
@@ -14354,4 +14777,41 @@ var workspaceEndpoints = [].concat(createUserPreferencesEndpoints(), [http.get(/
|
|
|
14354
14777
|
}, _callee6);
|
|
14355
14778
|
})))]);
|
|
14356
14779
|
|
|
14357
|
-
|
|
14780
|
+
var WorkspaceDataExplorerPanelConnect = function WorkspaceDataExplorerPanelConnect(_ref) {
|
|
14781
|
+
var _linkedMaps$find;
|
|
14782
|
+
var panelId = _ref.panelId,
|
|
14783
|
+
productConfigKey = _ref.productConfigKey;
|
|
14784
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
14785
|
+
t = _useWorkspaceTranslat.t;
|
|
14786
|
+
var mapIds = useSelector(function (state) {
|
|
14787
|
+
return mapSelectors.getAllMapIds(state);
|
|
14788
|
+
});
|
|
14789
|
+
var linkedMaps = useSelector(function (state) {
|
|
14790
|
+
return genericSelectors.getLinkedTargetIds(state, panelId);
|
|
14791
|
+
});
|
|
14792
|
+
var targetMapIds = linkedMaps;
|
|
14793
|
+
var targetMapId = (_linkedMaps$find = linkedMaps.find(function (id) {
|
|
14794
|
+
return mapIds.includes(id);
|
|
14795
|
+
})) != null ? _linkedMaps$find : '';
|
|
14796
|
+
if (!productConfigKey) {
|
|
14797
|
+
return jsx(AlertBanner, {
|
|
14798
|
+
title: t('workspace-data-explorer-not-configured')
|
|
14799
|
+
});
|
|
14800
|
+
}
|
|
14801
|
+
return jsx(DataExplorerActionsConnect, {
|
|
14802
|
+
panelId: panelId,
|
|
14803
|
+
children: function children(addTimeseries, addMapLayer, removeMapLayer) {
|
|
14804
|
+
return jsx(DataExplorerPanelContent, {
|
|
14805
|
+
onAddMapLayer: addMapLayer,
|
|
14806
|
+
onAddTimeseries: addTimeseries,
|
|
14807
|
+
onRemoveMapLayer: removeMapLayer,
|
|
14808
|
+
productConfigKey: productConfigKey,
|
|
14809
|
+
targetMapId: targetMapId,
|
|
14810
|
+
targetMapIds: targetMapIds,
|
|
14811
|
+
viewId: panelId
|
|
14812
|
+
});
|
|
14813
|
+
}
|
|
14814
|
+
});
|
|
14815
|
+
};
|
|
14816
|
+
|
|
14817
|
+
export { ALL_COMPONENT_TYPES, AVIATION_COMPONENT_TYPES, CAP_COMPONENT_TYPES, ComponentsLookUpWrapper, DataExplorerTimeseriesConnect, DemoWrapper, PresetAction, SUPPORTED_COMPONENT_TYPES, SUPPORTED_TIMESERIES_COMPONENT_TYPES, ViewPresetErrorComponent, ViewPresetErrorType, WARNING_LIST_COMPONENT_TYPES, WORKSPACE_NAMESPACE, WorkspaceDataExplorerPanelConnect, WorkspaceDetail, WorkspaceErrorType, WorkspaceI18nProvider, WorkspacePresetAction, WorkspaceStoreWrapper, WorkspaceThemeProvider, WorkspaceTopBar, WorkspaceViewConnect, WorkspaceWrapperProviderWithStore, createBalancedMosaicNode, createCustomEmptyMapWorkspace, defaultAuthConfig, defaultViewPresetsFilters, getEmptyMapWorkspace, getWorkspaceRouteUrl, selectors$1 as selectors, templatePresetsFixture, viewPresetActions, viewPresetsListener, viewPresetsReducer, workspaceActions, workspaceEndpoints, workspaceListActions, workspaceListListener, workspaceListReducer, workspaceListener, workspaceMiddlewares, workspaceReducer, workspaceReducersMap, routes as workspaceRoutes, workspaceSentryStateMap, workspaceTranslations };
|