@opengeoweb/workspace 21.2.0 → 21.3.0-nightly-20261128
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 +2391 -1953
- 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, useGeoWebHotkey, 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, crossSectionActions.setTimeSliderVisibility];
|
|
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,
|
|
@@ -2978,148 +2394,1130 @@ var workspaceActions = Object.assign({}, slice.actions);
|
|
|
2978
2394
|
* See the License for the specific language governing permissions and
|
|
2979
2395
|
* limitations under the License.
|
|
2980
2396
|
*
|
|
2981
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2982
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2983
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2397
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2398
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2399
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2400
|
+
* */
|
|
2401
|
+
var getSnackbarMessage = function getSnackbarMessage(action, title, is_shared) {
|
|
2402
|
+
// Trim and add quotes
|
|
2403
|
+
var trimmedTitle = title.trim();
|
|
2404
|
+
switch (action) {
|
|
2405
|
+
case PresetAction.DELETE:
|
|
2406
|
+
return {
|
|
2407
|
+
key: 'workspace-viewpreset-success-delete',
|
|
2408
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
2409
|
+
params: {
|
|
2410
|
+
TITLE: trimmedTitle
|
|
2411
|
+
}
|
|
2412
|
+
};
|
|
2413
|
+
case PresetAction.SAVE_AS:
|
|
2414
|
+
return {
|
|
2415
|
+
key: 'workspace-viewpreset-success-save-as',
|
|
2416
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
2417
|
+
params: {
|
|
2418
|
+
TITLE: trimmedTitle
|
|
2419
|
+
}
|
|
2420
|
+
};
|
|
2421
|
+
case PresetAction.EDIT:
|
|
2422
|
+
return {
|
|
2423
|
+
key: 'workspace-viewpreset-success-edit',
|
|
2424
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
2425
|
+
params: {
|
|
2426
|
+
TITLE: trimmedTitle
|
|
2427
|
+
}
|
|
2428
|
+
};
|
|
2429
|
+
case PresetAction.RESET:
|
|
2430
|
+
return {
|
|
2431
|
+
key: 'workspace-viewpreset-success-reset',
|
|
2432
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
2433
|
+
params: {
|
|
2434
|
+
TITLE: trimmedTitle
|
|
2435
|
+
}
|
|
2436
|
+
};
|
|
2437
|
+
case PresetAction.SHARE:
|
|
2438
|
+
return {
|
|
2439
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
2440
|
+
key: is_shared ? 'workspace-viewpreset-success-unshare' : 'workspace-viewpreset-success-share',
|
|
2441
|
+
params: {
|
|
2442
|
+
TITLE: trimmedTitle
|
|
2443
|
+
}
|
|
2444
|
+
};
|
|
2445
|
+
default:
|
|
2446
|
+
return {
|
|
2447
|
+
key: 'workspace-viewpreset-success-save',
|
|
2448
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
2449
|
+
params: {
|
|
2450
|
+
TITLE: trimmedTitle
|
|
2451
|
+
}
|
|
2452
|
+
};
|
|
2453
|
+
}
|
|
2454
|
+
};
|
|
2455
|
+
var emptyViewPreset = function emptyViewPreset(componentType) {
|
|
2456
|
+
if (componentType === void 0) {
|
|
2457
|
+
componentType = 'Map';
|
|
2458
|
+
}
|
|
2459
|
+
var actualComponentType = componentType || 'Map';
|
|
2460
|
+
var initialPropsByType = {
|
|
2461
|
+
Map: {
|
|
2462
|
+
mapPreset: {}
|
|
2463
|
+
},
|
|
2464
|
+
TimeSeries: {
|
|
2465
|
+
plotPreset: {
|
|
2466
|
+
mapId: '',
|
|
2467
|
+
plots: [],
|
|
2468
|
+
parameters: []
|
|
2469
|
+
},
|
|
2470
|
+
services: []
|
|
2471
|
+
},
|
|
2472
|
+
DataExplorer: {
|
|
2473
|
+
dataExplorerPreset: {}
|
|
2474
|
+
},
|
|
2475
|
+
Soundings: undefined,
|
|
2476
|
+
// TODO: empty soundings preset https://gitlab.com/opengeoweb/opengeoweb/-/issues/6029
|
|
2477
|
+
CrossSection: {
|
|
2478
|
+
syncGroupsIds: []
|
|
2479
|
+
},
|
|
2480
|
+
ViewError: undefined,
|
|
2481
|
+
ViewLoading: undefined,
|
|
2482
|
+
MultiMap: undefined,
|
|
2483
|
+
ModelRunInterval: undefined,
|
|
2484
|
+
HarmonieTempAndPrecipPreset: undefined,
|
|
2485
|
+
TimeSlider: undefined,
|
|
2486
|
+
WarningList: undefined,
|
|
2487
|
+
MaritimeWarnings: undefined,
|
|
2488
|
+
Plugin: undefined,
|
|
2489
|
+
WarningsTimeline: undefined
|
|
2490
|
+
};
|
|
2491
|
+
return {
|
|
2492
|
+
componentType: actualComponentType,
|
|
2493
|
+
keywords: '',
|
|
2494
|
+
scope: 'user',
|
|
2495
|
+
title: '',
|
|
2496
|
+
initialProps: initialPropsByType[actualComponentType]
|
|
2497
|
+
};
|
|
2498
|
+
};
|
|
2499
|
+
var findViewTemplatePreset = function findViewTemplatePreset(templates, presetId) {
|
|
2500
|
+
return presetId ? (templates != null ? templates : []).find(function (template) {
|
|
2501
|
+
return template.id === presetId;
|
|
2502
|
+
}) : undefined;
|
|
2503
|
+
};
|
|
2504
|
+
var findViewTemplatePresetForComponentType = function findViewTemplatePresetForComponentType(templates, componentType) {
|
|
2505
|
+
return componentType ? (templates != null ? templates : []).find(function (template) {
|
|
2506
|
+
return template.componentType === componentType;
|
|
2507
|
+
}) : undefined;
|
|
2508
|
+
};
|
|
2509
|
+
var toTranslatedViewTemplatePreset = function toTranslatedViewTemplatePreset(template, language) {
|
|
2510
|
+
return Object.assign({}, template, {
|
|
2511
|
+
title: getTemplatePresetTitle(template.title, language)
|
|
2512
|
+
});
|
|
2513
|
+
};
|
|
2514
|
+
var toViewPresetFromTemplate = function toViewPresetFromTemplate(template, language) {
|
|
2515
|
+
var _template$initialProp;
|
|
2516
|
+
var componentType = template.componentType;
|
|
2517
|
+
var emptyPreset = emptyViewPreset(componentType);
|
|
2518
|
+
return Object.assign({}, emptyPreset, {
|
|
2519
|
+
title: getTemplatePresetTitle(template.title, language),
|
|
2520
|
+
"abstract": template["abstract"],
|
|
2521
|
+
description: template.description,
|
|
2522
|
+
initialProps: (_template$initialProp = template.initialProps) != null ? _template$initialProp : emptyPreset.initialProps
|
|
2523
|
+
});
|
|
2524
|
+
};
|
|
2525
|
+
var toViewTemplateListItem = function toViewTemplateListItem(template, language) {
|
|
2526
|
+
var _template$abstract;
|
|
2527
|
+
return {
|
|
2528
|
+
id: template.id,
|
|
2529
|
+
title: getTemplatePresetTitle(template.title, language),
|
|
2530
|
+
date: '',
|
|
2531
|
+
scope: 'system',
|
|
2532
|
+
"abstract": (_template$abstract = template["abstract"]) != null ? _template$abstract : '',
|
|
2533
|
+
description: template.description,
|
|
2534
|
+
labels: template.labels,
|
|
2535
|
+
isViewTemplate: true
|
|
2536
|
+
};
|
|
2537
|
+
};
|
|
2538
|
+
var toViewTemplateListItems = function toViewTemplateListItems(templates, language) {
|
|
2539
|
+
return (templates != null ? templates : []).map(function (template) {
|
|
2540
|
+
return toViewTemplateListItem(template, language);
|
|
2541
|
+
});
|
|
2542
|
+
};
|
|
2543
|
+
|
|
2544
|
+
/* *
|
|
2545
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2546
|
+
* you may not use this file except in compliance with the License.
|
|
2547
|
+
* You may obtain a copy of the License at
|
|
2548
|
+
*
|
|
2549
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2550
|
+
*
|
|
2551
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2552
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2553
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2554
|
+
* See the License for the specific language governing permissions and
|
|
2555
|
+
* limitations under the License.
|
|
2556
|
+
*
|
|
2557
|
+
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2558
|
+
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2559
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2560
|
+
* */
|
|
2561
|
+
var getWorkspaceState = function getWorkspaceState(store) {
|
|
2562
|
+
var _store$workspace;
|
|
2563
|
+
return (_store$workspace = store == null ? void 0 : store.workspace) != null ? _store$workspace : initialState;
|
|
2564
|
+
};
|
|
2565
|
+
/**
|
|
2566
|
+
* Gets component types from the views used in the workspace
|
|
2567
|
+
*
|
|
2568
|
+
* @param {object} store store: object - Store object
|
|
2569
|
+
* @returns {WorkspaceViewType.componentType[]} returnType: WorkspaceViewType.componentType[]
|
|
2570
|
+
*/
|
|
2571
|
+
var getComponentTypesFromActiveViews = createSelector([function (state) {
|
|
2572
|
+
return state.workspace;
|
|
2573
|
+
}], function (workspace) {
|
|
2574
|
+
var viewIds = workspace == null ? void 0 : workspace.views.allIds; // Assuming you have all view IDs here
|
|
2575
|
+
var componentTypes = viewIds == null ? void 0 : viewIds.map(function (viewId) {
|
|
2576
|
+
var _workspace$views$byId, _workspace$views;
|
|
2577
|
+
return (_workspace$views$byId = workspace == null || (_workspace$views = workspace.views) == null || (_workspace$views = _workspace$views.byId) == null || (_workspace$views = _workspace$views[viewId]) == null ? void 0 : _workspace$views.componentType) != null ? _workspace$views$byId : '';
|
|
2578
|
+
});
|
|
2579
|
+
return componentTypes;
|
|
2580
|
+
});
|
|
2581
|
+
/**
|
|
2582
|
+
* Gets mosaicNode from workspace state
|
|
2583
|
+
*
|
|
2584
|
+
* @param {object} store store: object - Store object
|
|
2585
|
+
* @returns {MosaicNode<string>} returnType: MosaicNode<string>
|
|
2586
|
+
*/
|
|
2587
|
+
var getMosaicNode = createSelector(getWorkspaceState, function (state) {
|
|
2588
|
+
return state == null ? void 0 : state.mosaicNode;
|
|
2589
|
+
}, selectorMemoizationOptions);
|
|
2590
|
+
var getWorkspaceId = function getWorkspaceId(store) {
|
|
2591
|
+
var _getWorkspaceState;
|
|
2592
|
+
return (_getWorkspaceState = getWorkspaceState(store)) == null ? void 0 : _getWorkspaceState.id;
|
|
2593
|
+
};
|
|
2594
|
+
/**
|
|
2595
|
+
* Gets view from workspace state
|
|
2596
|
+
*
|
|
2597
|
+
* @param {object} store store: object - Store object
|
|
2598
|
+
* @param {string} viewId viewId: string - view id
|
|
2599
|
+
* @returns {object} returnType: WorkspaceViewType
|
|
2600
|
+
*/
|
|
2601
|
+
var getViewById = createSelector(getWorkspaceState, function (store, viewId) {
|
|
2602
|
+
return viewId;
|
|
2603
|
+
}, function (store, viewId) {
|
|
2604
|
+
var _store$views;
|
|
2605
|
+
return store == null || (_store$views = store.views) == null || (_store$views = _store$views.byId) == null ? void 0 : _store$views[viewId];
|
|
2606
|
+
}, selectorMemoizationOptions);
|
|
2607
|
+
var getViewsById = createSelector(getWorkspaceState, function (store) {
|
|
2608
|
+
return store.views.byId;
|
|
2609
|
+
});
|
|
2610
|
+
/**
|
|
2611
|
+
* Gets all view ids
|
|
2612
|
+
*
|
|
2613
|
+
* @param {object} store store: object - Store object
|
|
2614
|
+
* @returns {object} returnType: string[]
|
|
2615
|
+
*/
|
|
2616
|
+
var getViewIds = createSelector(getWorkspaceState, function (store) {
|
|
2617
|
+
return store.views.allIds || [];
|
|
2618
|
+
}, selectorMemoizationOptions);
|
|
2619
|
+
/**
|
|
2620
|
+
* Gets getShouldPreventClose from workspace state
|
|
2621
|
+
*
|
|
2622
|
+
* @param {object} store store: object - Store object
|
|
2623
|
+
* @param {string} viewId viewId: string - view id
|
|
2624
|
+
* @returns {boolean} returnType: boolean
|
|
2625
|
+
*/
|
|
2626
|
+
var getShouldPreventClose = createSelector(getViewById, function (store) {
|
|
2627
|
+
var _store$shouldPreventC;
|
|
2628
|
+
return (_store$shouldPreventC = store == null ? void 0 : store.shouldPreventClose) != null ? _store$shouldPreventC : false;
|
|
2629
|
+
}, selectorMemoizationOptions);
|
|
2630
|
+
var isWorkspaceLoading = createSelector(getWorkspaceState, function (store) {
|
|
2631
|
+
var _store$isLoading;
|
|
2632
|
+
return (_store$isLoading = store == null ? void 0 : store.isLoading) != null ? _store$isLoading : false;
|
|
2633
|
+
}, selectorMemoizationOptions);
|
|
2634
|
+
var getWorkspaceError = createSelector(getWorkspaceState, function (store) {
|
|
2635
|
+
return store == null ? void 0 : store.error;
|
|
2636
|
+
}, selectorMemoizationOptions);
|
|
2637
|
+
/**
|
|
2638
|
+
* Gets selected workspace title
|
|
2639
|
+
*
|
|
2640
|
+
* @param {object} store store: object - Store object
|
|
2641
|
+
* @returns {string} returnType: string
|
|
2642
|
+
*/
|
|
2643
|
+
var getSelectedWorkspaceTitle = createSelector(getWorkspaceState, function (store) {
|
|
2644
|
+
return (store == null ? void 0 : store.title) || '';
|
|
2645
|
+
}, selectorMemoizationOptions);
|
|
2646
|
+
var hasWorkspaceChanges = createSelector(getWorkspaceState, function (store) {
|
|
2647
|
+
var _store$hasChanges;
|
|
2648
|
+
return (_store$hasChanges = store == null ? void 0 : store.hasChanges) != null ? _store$hasChanges : false;
|
|
2649
|
+
}, selectorMemoizationOptions);
|
|
2650
|
+
/**
|
|
2651
|
+
* Gets selected viewType
|
|
2652
|
+
*
|
|
2653
|
+
* @param {object} store store: object - Store object
|
|
2654
|
+
* @returns {string} returnType: string
|
|
2655
|
+
*/
|
|
2656
|
+
var getViewType = createSelector(getWorkspaceState, function (store) {
|
|
2657
|
+
var _store$viewType;
|
|
2658
|
+
return (_store$viewType = store == null ? void 0 : store.viewType) != null ? _store$viewType : '';
|
|
2659
|
+
}, selectorMemoizationOptions);
|
|
2660
|
+
/**
|
|
2661
|
+
* Gets selected workspace scope
|
|
2662
|
+
*
|
|
2663
|
+
* @param {object} store store: object - Store object
|
|
2664
|
+
* @returns {string} returnType: string
|
|
2665
|
+
*/
|
|
2666
|
+
var getSelectedWorkspaceScope = createSelector(getWorkspaceState, function (store) {
|
|
2667
|
+
var _store$scope;
|
|
2668
|
+
return (_store$scope = store == null ? void 0 : store.scope) != null ? _store$scope : 'system';
|
|
2669
|
+
}, selectorMemoizationOptions);
|
|
2670
|
+
/**
|
|
2671
|
+
* Gets workspace data to send to the backend
|
|
2672
|
+
*
|
|
2673
|
+
* @param {object} store store: object - Store object
|
|
2674
|
+
* @returns {object} returnType: object - WorkspacePresetFromBE
|
|
2675
|
+
*/
|
|
2676
|
+
var getWorkspaceData = createSelector(getWorkspaceState, genericSelectors.getSynchronizationGroupStore, genericSelectors.selectFeatureLinksForAllPanels, function (workspaceStore, syncGroupsStore, featureLinksByPanelId) {
|
|
2677
|
+
var syncGroups = (syncGroupsStore == null ? void 0 : syncGroupsStore.groups.allIds.map(function (id) {
|
|
2678
|
+
var _syncGroupsStore$grou = syncGroupsStore.groups.byId[id],
|
|
2679
|
+
type = _syncGroupsStore$grou.type,
|
|
2680
|
+
sourcePanelId = _syncGroupsStore$grou.sourcePanelId;
|
|
2681
|
+
return {
|
|
2682
|
+
id: id,
|
|
2683
|
+
type: type,
|
|
2684
|
+
sourcePanelId: sourcePanelId
|
|
2685
|
+
};
|
|
2686
|
+
})) || [];
|
|
2687
|
+
var views = workspaceStore.views.allIds.map(function (mosaicNodeId) {
|
|
2688
|
+
var _view$componentType, _view$title, _view$id;
|
|
2689
|
+
var view = workspaceStore.views.byId[mosaicNodeId];
|
|
2690
|
+
return {
|
|
2691
|
+
mosaicNodeId: mosaicNodeId,
|
|
2692
|
+
componentType: (_view$componentType = view == null ? void 0 : view.componentType) != null ? _view$componentType : 'Map',
|
|
2693
|
+
title: (_view$title = view == null ? void 0 : view.title) != null ? _view$title : mosaicNodeId,
|
|
2694
|
+
originalViewPresetId: (_view$id = view == null ? void 0 : view.id) != null ? _view$id : undefined
|
|
2695
|
+
};
|
|
2696
|
+
});
|
|
2697
|
+
return {
|
|
2698
|
+
id: workspaceStore.id,
|
|
2699
|
+
title: workspaceStore.title,
|
|
2700
|
+
syncGroups: syncGroups,
|
|
2701
|
+
views: views,
|
|
2702
|
+
viewType: workspaceStore.viewType,
|
|
2703
|
+
scope: workspaceStore.scope,
|
|
2704
|
+
"abstract": workspaceStore["abstract"],
|
|
2705
|
+
mosaicNode: workspaceStore.mosaicNode,
|
|
2706
|
+
isTimeScrollingEnabled: (syncGroupsStore == null ? void 0 : syncGroupsStore.isTimeScrollingEnabled) || false,
|
|
2707
|
+
linking: featureLinksByPanelId,
|
|
2708
|
+
labels: workspaceStore.labels,
|
|
2709
|
+
description: workspaceStore.description,
|
|
2710
|
+
updated: workspaceStore.updated,
|
|
2711
|
+
username: workspaceStore.username
|
|
2712
|
+
};
|
|
2713
|
+
}, selectorMemoizationOptions);
|
|
2714
|
+
var getViewComponentType = createSelector(getViewById, function (store) {
|
|
2715
|
+
var _store$componentType;
|
|
2716
|
+
return (_store$componentType = store == null ? void 0 : store.componentType) != null ? _store$componentType : 'Map';
|
|
2717
|
+
}, selectorMemoizationOptions);
|
|
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) {
|
|
2721
|
+
return store;
|
|
2722
|
+
}, function (_store, panelId) {
|
|
2723
|
+
return panelId;
|
|
2724
|
+
}, function (_store, _panelId, keepAllDims) {
|
|
2725
|
+
if (keepAllDims === void 0) {
|
|
2726
|
+
keepAllDims = false;
|
|
2727
|
+
}
|
|
2728
|
+
return keepAllDims;
|
|
2729
|
+
}, function (workspaceView, viewComponentType, mapPreset, syncGroupsIds, timeSeriesPreset, warningsPreset, multiMapPreset, timeSliderPreset, soundingsPreset, crossSectionPreset, pluginState, store, panelId, keepAllDims) {
|
|
2730
|
+
var _workspaceView$scope, _initialPropsByCompon;
|
|
2731
|
+
var title = workspaceView == null ? void 0 : workspaceView.title;
|
|
2732
|
+
var scope = (_workspaceView$scope = workspaceView == null ? void 0 : workspaceView.scope) != null ? _workspaceView$scope : 'system';
|
|
2733
|
+
var defaultInitialProps = {
|
|
2734
|
+
mapPreset: mapPreset,
|
|
2735
|
+
syncGroupsIds: syncGroupsIds
|
|
2736
|
+
};
|
|
2737
|
+
var harmonieProps = mapSelectors.getHarmonieInitialProps(store, panelId, workspaceView == null ? void 0 : workspaceView.initialProps, syncGroupsIds);
|
|
2738
|
+
var initialPropsByComponentType = {
|
|
2739
|
+
DataExplorer: {
|
|
2740
|
+
dataExplorerPreset: {}
|
|
2741
|
+
},
|
|
2742
|
+
Map: defaultInitialProps,
|
|
2743
|
+
TimeSeries: Object.assign({}, timeSeriesPreset, {
|
|
2744
|
+
syncGroupsIds: syncGroupsIds
|
|
2745
|
+
}),
|
|
2746
|
+
WarningList: warningsPreset,
|
|
2747
|
+
WarningsTimeline: warningsPreset,
|
|
2748
|
+
MultiMap: multiMapPreset != null ? multiMapPreset : defaultInitialProps,
|
|
2749
|
+
HarmonieTempAndPrecipPreset: harmonieProps != null && harmonieProps.layers ? {
|
|
2750
|
+
layers: harmonieProps.layers
|
|
2751
|
+
} : undefined,
|
|
2752
|
+
TimeSlider: timeSliderPreset,
|
|
2753
|
+
Soundings: Object.assign({}, soundingsPreset, {
|
|
2754
|
+
syncGroupsIds: syncGroupsIds
|
|
2755
|
+
}),
|
|
2756
|
+
CrossSection: Object.assign({}, crossSectionPreset, {
|
|
2757
|
+
syncGroupsIds: syncGroupsIds
|
|
2758
|
+
}),
|
|
2759
|
+
Plugin: Object.assign({}, workspaceView == null ? void 0 : workspaceView.initialProps, {
|
|
2760
|
+
syncGroupsIds: syncGroupsIds
|
|
2761
|
+
}, pluginState && {
|
|
2762
|
+
pluginState: pluginState
|
|
2763
|
+
}),
|
|
2764
|
+
TafModule: Object.assign({}, workspaceView == null ? void 0 : workspaceView.initialProps)
|
|
2765
|
+
};
|
|
2766
|
+
return Object.assign({}, emptyViewPreset(viewComponentType), {
|
|
2767
|
+
id: workspaceView == null ? void 0 : workspaceView.id,
|
|
2768
|
+
scope: scope,
|
|
2769
|
+
title: title,
|
|
2770
|
+
initialProps: (_initialPropsByCompon = initialPropsByComponentType[viewComponentType]) != null ? _initialPropsByCompon : defaultInitialProps
|
|
2771
|
+
});
|
|
2772
|
+
}, selectorMemoizationOptions);
|
|
2773
|
+
/**
|
|
2774
|
+
* Gets workspace data with each view's current state included in initialProps.
|
|
2775
|
+
*/
|
|
2776
|
+
var getWorkspaceToSendToBackend = function getWorkspaceToSendToBackend(store) {
|
|
2777
|
+
var workspaceData = getWorkspaceData(store);
|
|
2778
|
+
return Object.assign({}, workspaceData, {
|
|
2779
|
+
views: workspaceData.views.map(function (view) {
|
|
2780
|
+
var _presetLike$component, _presetLike$initialPr;
|
|
2781
|
+
var presetLike = getViewPresetToSendToBackend(store, view.mosaicNodeId);
|
|
2782
|
+
return Object.assign({}, view, {
|
|
2783
|
+
componentType: (_presetLike$component = presetLike.componentType) != null ? _presetLike$component : view.componentType,
|
|
2784
|
+
initialProps: (_presetLike$initialPr = presetLike.initialProps) != null ? _presetLike$initialPr : {}
|
|
2785
|
+
});
|
|
2786
|
+
})
|
|
2787
|
+
});
|
|
2788
|
+
};
|
|
2789
|
+
|
|
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)
|
|
2984
3230
|
* */
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
TITLE: trimmedTitle
|
|
2995
|
-
}
|
|
2996
|
-
};
|
|
2997
|
-
case PresetAction.SAVE_AS:
|
|
2998
|
-
return {
|
|
2999
|
-
key: 'workspace-viewpreset-success-save-as',
|
|
3000
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
3001
|
-
params: {
|
|
3002
|
-
TITLE: trimmedTitle
|
|
3003
|
-
}
|
|
3004
|
-
};
|
|
3005
|
-
case PresetAction.EDIT:
|
|
3006
|
-
return {
|
|
3007
|
-
key: 'workspace-viewpreset-success-edit',
|
|
3008
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
3009
|
-
params: {
|
|
3010
|
-
TITLE: trimmedTitle
|
|
3011
|
-
}
|
|
3012
|
-
};
|
|
3013
|
-
case PresetAction.RESET:
|
|
3014
|
-
return {
|
|
3015
|
-
key: 'workspace-viewpreset-success-reset',
|
|
3016
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
3017
|
-
params: {
|
|
3018
|
-
TITLE: trimmedTitle
|
|
3019
|
-
}
|
|
3020
|
-
};
|
|
3021
|
-
case PresetAction.SHARE:
|
|
3022
|
-
return {
|
|
3023
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
3024
|
-
key: is_shared ? 'workspace-viewpreset-success-unshare' : 'workspace-viewpreset-success-share',
|
|
3025
|
-
params: {
|
|
3026
|
-
TITLE: trimmedTitle
|
|
3027
|
-
}
|
|
3028
|
-
};
|
|
3029
|
-
default:
|
|
3030
|
-
return {
|
|
3031
|
-
key: 'workspace-viewpreset-success-save',
|
|
3032
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
3033
|
-
params: {
|
|
3034
|
-
TITLE: trimmedTitle
|
|
3035
|
-
}
|
|
3036
|
-
};
|
|
3037
|
-
}
|
|
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) || '';
|
|
3038
3240
|
};
|
|
3039
|
-
var
|
|
3040
|
-
|
|
3041
|
-
componentType = 'Map';
|
|
3042
|
-
}
|
|
3043
|
-
var actualComponentType = componentType || 'Map';
|
|
3044
|
-
var initialPropsByType = {
|
|
3045
|
-
Map: {
|
|
3046
|
-
mapPreset: {}
|
|
3047
|
-
},
|
|
3048
|
-
TimeSeries: {
|
|
3049
|
-
plotPreset: {
|
|
3050
|
-
mapId: '',
|
|
3051
|
-
plots: [],
|
|
3052
|
-
parameters: []
|
|
3053
|
-
},
|
|
3054
|
-
services: []
|
|
3055
|
-
},
|
|
3056
|
-
Soundings: undefined,
|
|
3057
|
-
// TODO: empty soundings preset https://gitlab.com/opengeoweb/opengeoweb/-/issues/6029
|
|
3058
|
-
CrossSection: {
|
|
3059
|
-
syncGroupsIds: []
|
|
3060
|
-
},
|
|
3061
|
-
ViewError: undefined,
|
|
3062
|
-
ViewLoading: undefined,
|
|
3063
|
-
MultiMap: undefined,
|
|
3064
|
-
ModelRunInterval: undefined,
|
|
3065
|
-
HarmonieTempAndPrecipPreset: undefined,
|
|
3066
|
-
TimeSlider: undefined,
|
|
3067
|
-
WarningList: undefined,
|
|
3068
|
-
MaritimeWarnings: undefined,
|
|
3069
|
-
Plugin: undefined,
|
|
3070
|
-
WarningsTimeline: undefined
|
|
3071
|
-
};
|
|
3072
|
-
return {
|
|
3073
|
-
componentType: actualComponentType,
|
|
3074
|
-
keywords: '',
|
|
3075
|
-
scope: 'user',
|
|
3076
|
-
title: '',
|
|
3077
|
-
initialProps: initialPropsByType[actualComponentType]
|
|
3078
|
-
};
|
|
3241
|
+
var getIdFromUrl = function getIdFromUrl(url) {
|
|
3242
|
+
return url && /[^/]+$/.exec(url)[0];
|
|
3079
3243
|
};
|
|
3080
|
-
var
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
}) : undefined;
|
|
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';
|
|
3084
3247
|
};
|
|
3085
|
-
var
|
|
3086
|
-
|
|
3087
|
-
return
|
|
3088
|
-
})
|
|
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;
|
|
3089
3256
|
};
|
|
3090
|
-
var
|
|
3091
|
-
|
|
3092
|
-
|
|
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;
|
|
3093
3282
|
});
|
|
3094
3283
|
};
|
|
3095
|
-
var
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
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
|
+
});
|
|
3104
3296
|
});
|
|
3105
3297
|
};
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
|
|
3114
|
-
|
|
3115
|
-
|
|
3116
|
-
|
|
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);
|
|
3117
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);
|
|
3118
3428
|
};
|
|
3119
|
-
var
|
|
3120
|
-
|
|
3121
|
-
|
|
3122
|
-
|
|
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
|
+
}
|
|
3123
3521
|
};
|
|
3124
3522
|
|
|
3125
3523
|
/* *
|
|
@@ -3135,257 +3533,18 @@ var toViewTemplateListItems = function toViewTemplateListItems(templates, langua
|
|
|
3135
3533
|
* See the License for the specific language governing permissions and
|
|
3136
3534
|
* limitations under the License.
|
|
3137
3535
|
*
|
|
3138
|
-
* Copyright
|
|
3139
|
-
* Copyright
|
|
3140
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
3141
|
-
* */
|
|
3142
|
-
var
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
* @param {object} store store: object - Store object
|
|
3150
|
-
* @returns {WorkspaceViewType.componentType[]} returnType: WorkspaceViewType.componentType[]
|
|
3151
|
-
*/
|
|
3152
|
-
var getComponentTypesFromActiveViews = createSelector([function (state) {
|
|
3153
|
-
return state.workspace;
|
|
3154
|
-
}], function (workspace) {
|
|
3155
|
-
var viewIds = workspace == null ? void 0 : workspace.views.allIds; // Assuming you have all view IDs here
|
|
3156
|
-
var componentTypes = viewIds == null ? void 0 : viewIds.map(function (viewId) {
|
|
3157
|
-
var _workspace$views$byId, _workspace$views;
|
|
3158
|
-
return (_workspace$views$byId = workspace == null || (_workspace$views = workspace.views) == null || (_workspace$views = _workspace$views.byId) == null || (_workspace$views = _workspace$views[viewId]) == null ? void 0 : _workspace$views.componentType) != null ? _workspace$views$byId : '';
|
|
3159
|
-
});
|
|
3160
|
-
return componentTypes;
|
|
3161
|
-
});
|
|
3162
|
-
/**
|
|
3163
|
-
* Gets mosaicNode from workspace state
|
|
3164
|
-
*
|
|
3165
|
-
* @param {object} store store: object - Store object
|
|
3166
|
-
* @returns {MosaicNode<string>} returnType: MosaicNode<string>
|
|
3167
|
-
*/
|
|
3168
|
-
var getMosaicNode = createSelector(getWorkspaceState, function (state) {
|
|
3169
|
-
return state == null ? void 0 : state.mosaicNode;
|
|
3170
|
-
}, selectorMemoizationOptions);
|
|
3171
|
-
var getWorkspaceId = function getWorkspaceId(store) {
|
|
3172
|
-
var _getWorkspaceState;
|
|
3173
|
-
return (_getWorkspaceState = getWorkspaceState(store)) == null ? void 0 : _getWorkspaceState.id;
|
|
3174
|
-
};
|
|
3175
|
-
/**
|
|
3176
|
-
* Gets view from workspace state
|
|
3177
|
-
*
|
|
3178
|
-
* @param {object} store store: object - Store object
|
|
3179
|
-
* @param {string} viewId viewId: string - view id
|
|
3180
|
-
* @returns {object} returnType: WorkspaceViewType
|
|
3181
|
-
*/
|
|
3182
|
-
var getViewById = createSelector(getWorkspaceState, function (store, viewId) {
|
|
3183
|
-
return viewId;
|
|
3184
|
-
}, function (store, viewId) {
|
|
3185
|
-
var _store$views;
|
|
3186
|
-
return store == null || (_store$views = store.views) == null || (_store$views = _store$views.byId) == null ? void 0 : _store$views[viewId];
|
|
3187
|
-
}, selectorMemoizationOptions);
|
|
3188
|
-
var getViewsById = createSelector(getWorkspaceState, function (store) {
|
|
3189
|
-
return store.views.byId;
|
|
3190
|
-
});
|
|
3191
|
-
/**
|
|
3192
|
-
* Gets all view ids
|
|
3193
|
-
*
|
|
3194
|
-
* @param {object} store store: object - Store object
|
|
3195
|
-
* @returns {object} returnType: string[]
|
|
3196
|
-
*/
|
|
3197
|
-
var getViewIds = createSelector(getWorkspaceState, function (store) {
|
|
3198
|
-
return store.views.allIds || [];
|
|
3199
|
-
}, selectorMemoizationOptions);
|
|
3200
|
-
/**
|
|
3201
|
-
* Gets getShouldPreventClose from workspace state
|
|
3202
|
-
*
|
|
3203
|
-
* @param {object} store store: object - Store object
|
|
3204
|
-
* @param {string} viewId viewId: string - view id
|
|
3205
|
-
* @returns {boolean} returnType: boolean
|
|
3206
|
-
*/
|
|
3207
|
-
var getShouldPreventClose = createSelector(getViewById, function (store) {
|
|
3208
|
-
var _store$shouldPreventC;
|
|
3209
|
-
return (_store$shouldPreventC = store == null ? void 0 : store.shouldPreventClose) != null ? _store$shouldPreventC : false;
|
|
3210
|
-
}, selectorMemoizationOptions);
|
|
3211
|
-
var isWorkspaceLoading = createSelector(getWorkspaceState, function (store) {
|
|
3212
|
-
var _store$isLoading;
|
|
3213
|
-
return (_store$isLoading = store == null ? void 0 : store.isLoading) != null ? _store$isLoading : false;
|
|
3214
|
-
}, selectorMemoizationOptions);
|
|
3215
|
-
var getWorkspaceError = createSelector(getWorkspaceState, function (store) {
|
|
3216
|
-
return store == null ? void 0 : store.error;
|
|
3217
|
-
}, selectorMemoizationOptions);
|
|
3218
|
-
/**
|
|
3219
|
-
* Gets selected workspace title
|
|
3220
|
-
*
|
|
3221
|
-
* @param {object} store store: object - Store object
|
|
3222
|
-
* @returns {string} returnType: string
|
|
3223
|
-
*/
|
|
3224
|
-
var getSelectedWorkspaceTitle = createSelector(getWorkspaceState, function (store) {
|
|
3225
|
-
return (store == null ? void 0 : store.title) || '';
|
|
3226
|
-
}, selectorMemoizationOptions);
|
|
3227
|
-
var hasWorkspaceChanges = createSelector(getWorkspaceState, function (store) {
|
|
3228
|
-
var _store$hasChanges;
|
|
3229
|
-
return (_store$hasChanges = store == null ? void 0 : store.hasChanges) != null ? _store$hasChanges : false;
|
|
3230
|
-
}, selectorMemoizationOptions);
|
|
3231
|
-
/**
|
|
3232
|
-
* Gets selected viewType
|
|
3233
|
-
*
|
|
3234
|
-
* @param {object} store store: object - Store object
|
|
3235
|
-
* @returns {string} returnType: string
|
|
3236
|
-
*/
|
|
3237
|
-
var getViewType = createSelector(getWorkspaceState, function (store) {
|
|
3238
|
-
var _store$viewType;
|
|
3239
|
-
return (_store$viewType = store == null ? void 0 : store.viewType) != null ? _store$viewType : '';
|
|
3240
|
-
}, selectorMemoizationOptions);
|
|
3241
|
-
/**
|
|
3242
|
-
* Gets selected workspace scope
|
|
3243
|
-
*
|
|
3244
|
-
* @param {object} store store: object - Store object
|
|
3245
|
-
* @returns {string} returnType: string
|
|
3246
|
-
*/
|
|
3247
|
-
var getSelectedWorkspaceScope = createSelector(getWorkspaceState, function (store) {
|
|
3248
|
-
var _store$scope;
|
|
3249
|
-
return (_store$scope = store == null ? void 0 : store.scope) != null ? _store$scope : 'system';
|
|
3250
|
-
}, selectorMemoizationOptions);
|
|
3251
|
-
/**
|
|
3252
|
-
* Gets workspace data to send to the backend
|
|
3253
|
-
*
|
|
3254
|
-
* @param {object} store store: object - Store object
|
|
3255
|
-
* @returns {object} returnType: object - WorkspacePresetFromBE
|
|
3256
|
-
*/
|
|
3257
|
-
var getWorkspaceData = createSelector(getWorkspaceState, genericSelectors.getSynchronizationGroupStore, genericSelectors.selectFeatureLinksForAllPanels, function (workspaceStore, syncGroupsStore, featureLinksByPanelId) {
|
|
3258
|
-
var syncGroups = (syncGroupsStore == null ? void 0 : syncGroupsStore.groups.allIds.map(function (id) {
|
|
3259
|
-
var _syncGroupsStore$grou = syncGroupsStore.groups.byId[id],
|
|
3260
|
-
type = _syncGroupsStore$grou.type,
|
|
3261
|
-
sourcePanelId = _syncGroupsStore$grou.sourcePanelId;
|
|
3262
|
-
return {
|
|
3263
|
-
id: id,
|
|
3264
|
-
type: type,
|
|
3265
|
-
sourcePanelId: sourcePanelId
|
|
3266
|
-
};
|
|
3267
|
-
})) || [];
|
|
3268
|
-
var views = workspaceStore.views.allIds.map(function (mosaicNodeId) {
|
|
3269
|
-
var _view$componentType, _view$title, _view$id;
|
|
3270
|
-
var view = workspaceStore.views.byId[mosaicNodeId];
|
|
3271
|
-
return {
|
|
3272
|
-
mosaicNodeId: mosaicNodeId,
|
|
3273
|
-
componentType: (_view$componentType = view == null ? void 0 : view.componentType) != null ? _view$componentType : 'Map',
|
|
3274
|
-
title: (_view$title = view == null ? void 0 : view.title) != null ? _view$title : mosaicNodeId,
|
|
3275
|
-
originalViewPresetId: (_view$id = view == null ? void 0 : view.id) != null ? _view$id : undefined
|
|
3276
|
-
};
|
|
3277
|
-
});
|
|
3278
|
-
return {
|
|
3279
|
-
id: workspaceStore.id,
|
|
3280
|
-
title: workspaceStore.title,
|
|
3281
|
-
syncGroups: syncGroups,
|
|
3282
|
-
views: views,
|
|
3283
|
-
viewType: workspaceStore.viewType,
|
|
3284
|
-
scope: workspaceStore.scope,
|
|
3285
|
-
"abstract": workspaceStore["abstract"],
|
|
3286
|
-
mosaicNode: workspaceStore.mosaicNode,
|
|
3287
|
-
isTimeScrollingEnabled: (syncGroupsStore == null ? void 0 : syncGroupsStore.isTimeScrollingEnabled) || false,
|
|
3288
|
-
linking: featureLinksByPanelId,
|
|
3289
|
-
labels: workspaceStore.labels,
|
|
3290
|
-
description: workspaceStore.description,
|
|
3291
|
-
updated: workspaceStore.updated,
|
|
3292
|
-
username: workspaceStore.username
|
|
3293
|
-
};
|
|
3294
|
-
}, selectorMemoizationOptions);
|
|
3295
|
-
var getViewComponentType = createSelector(getViewById, function (store) {
|
|
3296
|
-
var _store$componentType;
|
|
3297
|
-
return (_store$componentType = store == null ? void 0 : store.componentType) != null ? _store$componentType : 'Map';
|
|
3298
|
-
}, selectorMemoizationOptions);
|
|
3299
|
-
var getViewPresetToSendToBackend = createSelector(getViewById, getViewComponentType, mapSelectors.getMapPreset, syncGroupsSelectors.getAllTargetGroupsForSource, timeSeriesSelectors.getTimeSeriesPreset, publicWarningsSelectors.getWarningsPresetById, mapSelectors.getMultiMapInitialProps, mapSelectors.getTimeSliderInitialProps, soundingsSelectors.getSoundingsPreset, getPluginState, function (store, panelId) {
|
|
3300
|
-
return soundingsSelectors.getSoundingsPreset(store, panelId);
|
|
3301
|
-
}, function (store) {
|
|
3302
|
-
return store;
|
|
3303
|
-
}, function (panelId) {
|
|
3304
|
-
return panelId;
|
|
3305
|
-
}, function (_store, _panelId, keepAllDims) {
|
|
3306
|
-
if (keepAllDims === void 0) {
|
|
3307
|
-
keepAllDims = false;
|
|
3308
|
-
}
|
|
3309
|
-
return keepAllDims;
|
|
3310
|
-
}, function (workspaceView, viewComponentType, mapPreset, syncGroupsIds, timeSeriesPreset, warningsPreset, multiMapPreset, timeSliderPreset, soundingsPreset, pluginState, store, panelId, keepAllDims) {
|
|
3311
|
-
var _workspaceView$scope, _initialPropsByCompon;
|
|
3312
|
-
var title = workspaceView == null ? void 0 : workspaceView.title;
|
|
3313
|
-
var scope = (_workspaceView$scope = workspaceView == null ? void 0 : workspaceView.scope) != null ? _workspaceView$scope : 'system';
|
|
3314
|
-
var defaultInitialProps = {
|
|
3315
|
-
mapPreset: mapPreset,
|
|
3316
|
-
syncGroupsIds: syncGroupsIds
|
|
3317
|
-
};
|
|
3318
|
-
var harmonieProps = mapSelectors.getHarmonieInitialProps(store, panelId, workspaceView == null ? void 0 : workspaceView.initialProps, syncGroupsIds);
|
|
3319
|
-
var initialPropsByComponentType = {
|
|
3320
|
-
Map: defaultInitialProps,
|
|
3321
|
-
TimeSeries: Object.assign({}, timeSeriesPreset, {
|
|
3322
|
-
syncGroupsIds: syncGroupsIds
|
|
3323
|
-
}),
|
|
3324
|
-
WarningList: warningsPreset,
|
|
3325
|
-
WarningsTimeline: warningsPreset,
|
|
3326
|
-
MultiMap: multiMapPreset != null ? multiMapPreset : defaultInitialProps,
|
|
3327
|
-
HarmonieTempAndPrecipPreset: harmonieProps != null && harmonieProps.layers ? {
|
|
3328
|
-
layers: harmonieProps.layers
|
|
3329
|
-
} : undefined,
|
|
3330
|
-
TimeSlider: timeSliderPreset,
|
|
3331
|
-
Soundings: Object.assign({}, soundingsPreset, {
|
|
3332
|
-
syncGroupsIds: syncGroupsIds
|
|
3333
|
-
}),
|
|
3334
|
-
CrossSection: Object.assign({}, workspaceView == null ? void 0 : workspaceView.initialProps, {
|
|
3335
|
-
syncGroupsIds: syncGroupsIds
|
|
3336
|
-
}),
|
|
3337
|
-
Plugin: Object.assign({}, workspaceView == null ? void 0 : workspaceView.initialProps, {
|
|
3338
|
-
syncGroupsIds: syncGroupsIds
|
|
3339
|
-
}, pluginState && {
|
|
3340
|
-
pluginState: pluginState
|
|
3341
|
-
}),
|
|
3342
|
-
TafModule: Object.assign({}, workspaceView == null ? void 0 : workspaceView.initialProps)
|
|
3343
|
-
};
|
|
3344
|
-
return Object.assign({}, emptyViewPreset(viewComponentType), {
|
|
3345
|
-
id: workspaceView == null ? void 0 : workspaceView.id,
|
|
3346
|
-
scope: scope,
|
|
3347
|
-
title: title,
|
|
3348
|
-
initialProps: (_initialPropsByCompon = initialPropsByComponentType[viewComponentType]) != null ? _initialPropsByCompon : defaultInitialProps
|
|
3349
|
-
});
|
|
3350
|
-
}, selectorMemoizationOptions);
|
|
3351
|
-
/**
|
|
3352
|
-
* Gets workspace data with each view's current state included in initialProps.
|
|
3353
|
-
*/
|
|
3354
|
-
var getWorkspaceToSendToBackend = function getWorkspaceToSendToBackend(store) {
|
|
3355
|
-
var workspaceData = getWorkspaceData(store);
|
|
3356
|
-
return Object.assign({}, workspaceData, {
|
|
3357
|
-
views: workspaceData.views.map(function (view) {
|
|
3358
|
-
var _presetLike$component, _presetLike$initialPr;
|
|
3359
|
-
var presetLike = getViewPresetToSendToBackend(store, view.mosaicNodeId);
|
|
3360
|
-
return Object.assign({}, view, {
|
|
3361
|
-
componentType: (_presetLike$component = presetLike.componentType) != null ? _presetLike$component : view.componentType,
|
|
3362
|
-
initialProps: (_presetLike$initialPr = presetLike.initialProps) != null ? _presetLike$initialPr : {}
|
|
3363
|
-
});
|
|
3364
|
-
})
|
|
3365
|
-
});
|
|
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;
|
|
3366
3547
|
};
|
|
3367
|
-
|
|
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
|
-
});
|
|
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;
|
|
@@ -10570,30 +10728,19 @@ var WorkspaceViewConnect = function WorkspaceViewConnect(_ref) {
|
|
|
10570
10728
|
var isWorkspaceListDialogOpen = useSelector(function (store) {
|
|
10571
10729
|
return getIsWorkspaceListDialogOpen(store);
|
|
10572
10730
|
});
|
|
10573
|
-
|
|
10574
|
-
|
|
10575
|
-
|
|
10731
|
+
useGeoWebHotkey('workspace.openViewPresets', function () {
|
|
10732
|
+
var panelIds = getLeaves(mosaicNode);
|
|
10733
|
+
var panelId = panelIds.includes(activeWindowId) ? activeWindowId : panelIds[0];
|
|
10734
|
+
if (!panelId) {
|
|
10735
|
+
return;
|
|
10576
10736
|
}
|
|
10577
|
-
|
|
10578
|
-
|
|
10579
|
-
|
|
10580
|
-
|
|
10581
|
-
|
|
10582
|
-
|
|
10583
|
-
|
|
10584
|
-
return;
|
|
10585
|
-
}
|
|
10586
|
-
event.preventDefault();
|
|
10587
|
-
dispatch(viewPresetActions.toggleViewPresetListDialog({
|
|
10588
|
-
panelId: panelId,
|
|
10589
|
-
isViewPresetListDialogOpen: true
|
|
10590
|
-
}));
|
|
10591
|
-
};
|
|
10592
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
10593
|
-
return function () {
|
|
10594
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
10595
|
-
};
|
|
10596
|
-
}, [activeWindowId, dispatch, isWorkspaceListDialogOpen, mosaicNode]);
|
|
10737
|
+
dispatch(viewPresetActions.toggleViewPresetListDialog({
|
|
10738
|
+
panelId: panelId,
|
|
10739
|
+
isViewPresetListDialogOpen: true
|
|
10740
|
+
}));
|
|
10741
|
+
}, {
|
|
10742
|
+
enabled: !isWorkspaceListDialogOpen
|
|
10743
|
+
});
|
|
10597
10744
|
React.useEffect(function () {
|
|
10598
10745
|
if (!mosaicNode) {
|
|
10599
10746
|
dispatch(workspaceActions.teardownComplete());
|
|
@@ -10679,22 +10826,11 @@ var WorkspaceMenuButtonConnect = function WorkspaceMenuButtonConnect(_ref) {
|
|
|
10679
10826
|
}));
|
|
10680
10827
|
}, [dispatch]);
|
|
10681
10828
|
useResetWorkspaceFiltersOnRoleChange();
|
|
10682
|
-
|
|
10683
|
-
|
|
10684
|
-
|
|
10685
|
-
|
|
10686
|
-
|
|
10687
|
-
if (event.code !== 'KeyW' || event.ctrlKey || event.metaKey || event.altKey || event.repeat || event.defaultPrevented || isTargetInteractiveInput(event.target)) {
|
|
10688
|
-
return;
|
|
10689
|
-
}
|
|
10690
|
-
event.preventDefault();
|
|
10691
|
-
setListDialogOpen(true);
|
|
10692
|
-
};
|
|
10693
|
-
document.addEventListener('keydown', handleKeyDown);
|
|
10694
|
-
return function () {
|
|
10695
|
-
document.removeEventListener('keydown', handleKeyDown);
|
|
10696
|
-
};
|
|
10697
|
-
}, [isWorkspaceListDialogOpen, setListDialogOpen]);
|
|
10829
|
+
useGeoWebHotkey('workspace.openList', function () {
|
|
10830
|
+
return setListDialogOpen(true);
|
|
10831
|
+
}, {
|
|
10832
|
+
enabled: !isWorkspaceListDialogOpen
|
|
10833
|
+
});
|
|
10698
10834
|
var isNew = workspaceId === undefined || workspaceId === '';
|
|
10699
10835
|
var fullTitle = getPresetTitle(title, hasChanges, isNew, t);
|
|
10700
10836
|
React.useEffect(function () {
|
|
@@ -12228,6 +12364,17 @@ var ViewPresetsFormDialogConnect = function ViewPresetsFormDialogConnect(_ref) {
|
|
|
12228
12364
|
});
|
|
12229
12365
|
};
|
|
12230
12366
|
|
|
12367
|
+
var _templateObject, _templateObject2, _offMainThreadBarAnim;
|
|
12368
|
+
var bar1SlideKeyframes = keyframes(_templateObject || (_templateObject = _taggedTemplateLiteralLoose(["\n 0% { transform: translateX(-35%) scaleX(0.35); }\n 60%, 100% { transform: translateX(100%) scaleX(0.9); }\n"])));
|
|
12369
|
+
var bar2SlideKeyframes = keyframes(_templateObject2 || (_templateObject2 = _taggedTemplateLiteralLoose(["\n 0% { transform: translateX(-200%) scaleX(2); }\n 60%, 100% { transform: translateX(107%) scaleX(0.01); }\n"])));
|
|
12370
|
+
/** MUI's indeterminate motion as transforms, which keep animating while the main thread mounts views. */
|
|
12371
|
+
var offMainThreadBarAnimation = (_offMainThreadBarAnim = {}, _offMainThreadBarAnim["& ." + linearProgressClasses.bar1 + ", & ." + linearProgressClasses.bar2] = {
|
|
12372
|
+
width: '100%'
|
|
12373
|
+
}, _offMainThreadBarAnim["& ." + linearProgressClasses.bar1] = {
|
|
12374
|
+
animation: bar1SlideKeyframes + " 2.1s cubic-bezier(0.65, 0.815, 0.735, 0.395) infinite"
|
|
12375
|
+
}, _offMainThreadBarAnim["& ." + linearProgressClasses.bar2] = {
|
|
12376
|
+
animation: bar2SlideKeyframes + " 2.1s cubic-bezier(0.165, 0.84, 0.44, 1) 1.15s infinite"
|
|
12377
|
+
}, _offMainThreadBarAnim);
|
|
12231
12378
|
var WorkspaceDetail = function WorkspaceDetail(_ref) {
|
|
12232
12379
|
var initialWorkspaceId = _ref.initialWorkspaceId,
|
|
12233
12380
|
workspaceId = _ref.workspaceId,
|
|
@@ -12247,6 +12394,7 @@ var WorkspaceDetail = function WorkspaceDetail(_ref) {
|
|
|
12247
12394
|
return getWorkspaceError(store);
|
|
12248
12395
|
});
|
|
12249
12396
|
var isLoading = useSelector(isWorkspaceLoading);
|
|
12397
|
+
var areViewsSettling = useSelector(mapSelectors.areViewsSettling);
|
|
12250
12398
|
var workspaceData = useSelector(getWorkspaceData);
|
|
12251
12399
|
var workspaceState = useSelector(getWorkspaceState);
|
|
12252
12400
|
var fetchWorkspace = React.useCallback(function (newWorkspaceId) {
|
|
@@ -12296,15 +12444,15 @@ var WorkspaceDetail = function WorkspaceDetail(_ref) {
|
|
|
12296
12444
|
width: '100%',
|
|
12297
12445
|
height: '100%'
|
|
12298
12446
|
},
|
|
12299
|
-
children: [!!isLoading && jsx(LinearProgress, {
|
|
12447
|
+
children: [!!(isLoading || areViewsSettling) && jsx(LinearProgress, {
|
|
12300
12448
|
color: "secondary",
|
|
12301
12449
|
"data-testid": "loading-bar",
|
|
12302
|
-
sx: {
|
|
12450
|
+
sx: Object.assign({
|
|
12303
12451
|
position: 'absolute',
|
|
12304
12452
|
width: '100%',
|
|
12305
12453
|
top: 0,
|
|
12306
12454
|
zIndex: 100
|
|
12307
|
-
}
|
|
12455
|
+
}, offMainThreadBarAnimation)
|
|
12308
12456
|
}), !!error && error.type !== WorkspaceErrorType.SAVE && jsx(AlertBanner, Object.assign({
|
|
12309
12457
|
info: error.message,
|
|
12310
12458
|
shouldClose: true,
|
|
@@ -12367,8 +12515,9 @@ var TranslatedError = /*#__PURE__*/function (_Error) {
|
|
|
12367
12515
|
* Coordinates the Data Explorer with the workspace and Timeseries panels.
|
|
12368
12516
|
* Data Explorer itself does not depend on workspace or Timeseries.
|
|
12369
12517
|
*/
|
|
12370
|
-
var
|
|
12371
|
-
var
|
|
12518
|
+
var DataExplorerActionsConnect = function DataExplorerActionsConnect(_ref) {
|
|
12519
|
+
var dataExplorerPanelId = _ref.panelId,
|
|
12520
|
+
children = _ref.children;
|
|
12372
12521
|
var store = useStore();
|
|
12373
12522
|
var _useTranslation = useTranslation([DATA_EXPLORER_NAMESPACE, SHARED_NAMESPACE]),
|
|
12374
12523
|
t = _useTranslation.t;
|
|
@@ -12405,24 +12554,209 @@ var DataExplorerTimeseriesConnect = function DataExplorerTimeseriesConnect(_ref)
|
|
|
12405
12554
|
resolveChoice.current == null || resolveChoice.current(id);
|
|
12406
12555
|
resolveChoice.current = undefined;
|
|
12407
12556
|
};
|
|
12408
|
-
var
|
|
12557
|
+
var addMapLayer = React.useCallback(/*#__PURE__*/function () {
|
|
12409
12558
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref3) {
|
|
12410
|
-
var _store$getState$works
|
|
12411
|
-
var title,
|
|
12559
|
+
var _store$getState$works;
|
|
12560
|
+
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
12561
|
return _regenerator().w(function (_context2) {
|
|
12413
|
-
while (1) switch (_context2.n) {
|
|
12562
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
12414
12563
|
case 0:
|
|
12415
|
-
title = _ref3.title,
|
|
12564
|
+
title = _ref3.title, targetMapId = _ref3.targetMapId, createLayer = _ref3.createLayer;
|
|
12416
12565
|
workspaceId = (_store$getState$works = store.getState().workspace) == null ? void 0 : _store$getState$works.id;
|
|
12566
|
+
_context2.p = 1;
|
|
12567
|
+
state = store.getState();
|
|
12568
|
+
availableMapIds = mapSelectors.getAllMapIds(state);
|
|
12569
|
+
linkedMapIds = [];
|
|
12570
|
+
if (dataExplorerPanelId) {
|
|
12571
|
+
linkedMapIds = genericSelectors.getLinkedTargetIds(state, dataExplorerPanelId).filter(function (id) {
|
|
12572
|
+
return availableMapIds.includes(id);
|
|
12573
|
+
});
|
|
12574
|
+
} else if (targetMapId) {
|
|
12575
|
+
linkedMapIds = [targetMapId];
|
|
12576
|
+
}
|
|
12577
|
+
destinationMapIds = linkedMapIds;
|
|
12578
|
+
if (!dataExplorerPanelId && !destinationMapIds.length && availableMapIds.length === 1) {
|
|
12579
|
+
destinationMapIds = availableMapIds;
|
|
12580
|
+
}
|
|
12581
|
+
if (!(!dataExplorerPanelId && !destinationMapIds.length && availableMapIds.length > 1)) {
|
|
12582
|
+
_context2.n = 4;
|
|
12583
|
+
break;
|
|
12584
|
+
}
|
|
12585
|
+
_context2.n = 2;
|
|
12586
|
+
return choose({
|
|
12587
|
+
title: t('dataexplorer-select-map-view'),
|
|
12588
|
+
options: availableMapIds.map(function (id, index) {
|
|
12589
|
+
var _getViewById;
|
|
12590
|
+
return {
|
|
12591
|
+
id: id,
|
|
12592
|
+
title: ((_getViewById = getViewById(state, id)) == null ? void 0 : _getViewById.title) || t('dataexplorer-map-view', {
|
|
12593
|
+
number: index + 1
|
|
12594
|
+
})
|
|
12595
|
+
};
|
|
12596
|
+
})
|
|
12597
|
+
});
|
|
12598
|
+
case 2:
|
|
12599
|
+
selectedMapId = _context2.v;
|
|
12600
|
+
if (selectedMapId) {
|
|
12601
|
+
_context2.n = 3;
|
|
12602
|
+
break;
|
|
12603
|
+
}
|
|
12604
|
+
return _context2.a(2, undefined);
|
|
12605
|
+
case 3:
|
|
12606
|
+
destinationMapIds = [selectedMapId];
|
|
12607
|
+
case 4:
|
|
12608
|
+
if (mounted.current) {
|
|
12609
|
+
_context2.n = 5;
|
|
12610
|
+
break;
|
|
12611
|
+
}
|
|
12612
|
+
return _context2.a(2, undefined);
|
|
12613
|
+
case 5:
|
|
12614
|
+
state = store.getState();
|
|
12615
|
+
if (!(((_state$workspace = state.workspace) == null ? void 0 : _state$workspace.id) !== workspaceId || (_state$workspace2 = state.workspace) != null && _state$workspace2.isLoading || destinationMapIds.some(function (id) {
|
|
12616
|
+
return !mapSelectors.getAllMapIds(state).includes(id);
|
|
12617
|
+
}))) {
|
|
12618
|
+
_context2.n = 6;
|
|
12619
|
+
break;
|
|
12620
|
+
}
|
|
12621
|
+
throw new TranslatedError(t('dataexplorer-map-error-workspace-changed'));
|
|
12622
|
+
case 6:
|
|
12623
|
+
if (!(!dataExplorerPanelId && !destinationMapIds.length && getViewIds(state).some(function (id) {
|
|
12624
|
+
var _getViewById2;
|
|
12625
|
+
return ((_getViewById2 = getViewById(state, id)) == null ? void 0 : _getViewById2.componentType) === 'Map';
|
|
12626
|
+
}))) {
|
|
12627
|
+
_context2.n = 7;
|
|
12628
|
+
break;
|
|
12629
|
+
}
|
|
12630
|
+
throw new TranslatedError(t('dataexplorer-map-error-loading'));
|
|
12631
|
+
case 7:
|
|
12632
|
+
_context2.n = 8;
|
|
12633
|
+
return createLayer();
|
|
12634
|
+
case 8:
|
|
12635
|
+
loadedLayer = _context2.v;
|
|
12636
|
+
layer = Object.assign({}, loadedLayer, {
|
|
12637
|
+
id: (_loadedLayer$id = loadedLayer.id) != null ? _loadedLayer$id : v4()
|
|
12638
|
+
});
|
|
12639
|
+
if (mounted.current) {
|
|
12640
|
+
_context2.n = 9;
|
|
12641
|
+
break;
|
|
12642
|
+
}
|
|
12643
|
+
return _context2.a(2, undefined);
|
|
12644
|
+
case 9:
|
|
12645
|
+
state = store.getState();
|
|
12646
|
+
if (!(((_state$workspace3 = state.workspace) == null ? void 0 : _state$workspace3.id) !== workspaceId || (_state$workspace4 = state.workspace) != null && _state$workspace4.isLoading || destinationMapIds.some(function (id) {
|
|
12647
|
+
return !mapSelectors.getAllMapIds(state).includes(id);
|
|
12648
|
+
}))) {
|
|
12649
|
+
_context2.n = 10;
|
|
12650
|
+
break;
|
|
12651
|
+
}
|
|
12652
|
+
throw new TranslatedError(t('dataexplorer-map-error-workspace-changed'));
|
|
12653
|
+
case 10:
|
|
12654
|
+
if (!destinationMapIds.length) {
|
|
12655
|
+
mapId = v4();
|
|
12656
|
+
// Include the layer in the initial preset so mounting the map preserves it.
|
|
12657
|
+
store.dispatch(workspaceActions.addWorkspaceView({
|
|
12658
|
+
id: mapId,
|
|
12659
|
+
componentType: 'Map',
|
|
12660
|
+
initialProps: {
|
|
12661
|
+
mapPreset: {
|
|
12662
|
+
layers: [layer]
|
|
12663
|
+
},
|
|
12664
|
+
syncGroupsIds: []
|
|
12665
|
+
}
|
|
12666
|
+
}));
|
|
12667
|
+
store.dispatch(workspaceActions.updateWorkspaceView({
|
|
12668
|
+
mosaicNodeId: mapId,
|
|
12669
|
+
viewPreset: Object.assign({}, getViewById(store.getState(), mapId), {
|
|
12670
|
+
title: title
|
|
12671
|
+
})
|
|
12672
|
+
}));
|
|
12673
|
+
store.dispatch(viewPresetActions.setViewPresetInline({
|
|
12674
|
+
panelId: mapId,
|
|
12675
|
+
isInline: true
|
|
12676
|
+
}));
|
|
12677
|
+
mosaicNode = getMosaicNode(store.getState());
|
|
12678
|
+
store.dispatch(workspaceActions.updateWorkspaceViews({
|
|
12679
|
+
mosaicNode: mosaicNode ? {
|
|
12680
|
+
direction: 'row',
|
|
12681
|
+
first: mosaicNode,
|
|
12682
|
+
second: mapId
|
|
12683
|
+
} : mapId
|
|
12684
|
+
}));
|
|
12685
|
+
if (dataExplorerPanelId) {
|
|
12686
|
+
store.dispatch(syncGroupsActions.updateLinkedMap({
|
|
12687
|
+
panelId: dataExplorerPanelId,
|
|
12688
|
+
mapIds: [mapId]
|
|
12689
|
+
}));
|
|
12690
|
+
}
|
|
12691
|
+
destinationMapIds = [mapId];
|
|
12692
|
+
} else {
|
|
12693
|
+
mapId = destinationMapIds[0];
|
|
12694
|
+
destinationMapIds.forEach(function (destinationMapId, index) {
|
|
12695
|
+
var destinationLayer = index === 0 ? layer : Object.assign({}, layer, {
|
|
12696
|
+
id: v4()
|
|
12697
|
+
});
|
|
12698
|
+
if (layerSelectors.getLayersByMapId(state, destinationMapId).some(function (existing) {
|
|
12699
|
+
return existing.service === layer.service && existing.name === layer.name;
|
|
12700
|
+
})) {
|
|
12701
|
+
return;
|
|
12702
|
+
}
|
|
12703
|
+
store.dispatch(layerActions.addLayer({
|
|
12704
|
+
mapId: destinationMapId,
|
|
12705
|
+
layerId: destinationLayer.id,
|
|
12706
|
+
layer: destinationLayer,
|
|
12707
|
+
origin: layerTypes.LayerActionOrigin.dataExplorer
|
|
12708
|
+
}));
|
|
12709
|
+
});
|
|
12710
|
+
}
|
|
12711
|
+
destinationMapIds.forEach(function (destinationMapId) {
|
|
12712
|
+
return store.dispatch(viewPresetActions.setViewPresetHasChanges({
|
|
12713
|
+
panelId: destinationMapId,
|
|
12714
|
+
hasChanges: true
|
|
12715
|
+
}));
|
|
12716
|
+
});
|
|
12717
|
+
store.dispatch(workspaceActions.markWorkspaceChanged());
|
|
12718
|
+
store.dispatch(uiActions.setActiveWindowId({
|
|
12719
|
+
activeWindowId: mapId
|
|
12720
|
+
}));
|
|
12721
|
+
return _context2.a(2, mapId);
|
|
12722
|
+
case 11:
|
|
12723
|
+
_context2.p = 11;
|
|
12724
|
+
_t = _context2.v;
|
|
12725
|
+
if (!(_t instanceof TranslatedError)) {
|
|
12726
|
+
_context2.n = 12;
|
|
12727
|
+
break;
|
|
12728
|
+
}
|
|
12729
|
+
throw _t;
|
|
12730
|
+
case 12:
|
|
12731
|
+
console.error('Unable to add dataset to a map: ', _t);
|
|
12732
|
+
throw new TranslatedError(t('dataexplorer-map-error-generic'));
|
|
12733
|
+
case 13:
|
|
12734
|
+
return _context2.a(2);
|
|
12735
|
+
}
|
|
12736
|
+
}, _callee2, null, [[1, 11]]);
|
|
12737
|
+
}));
|
|
12738
|
+
return function (_x2) {
|
|
12739
|
+
return _ref4.apply(this, arguments);
|
|
12740
|
+
};
|
|
12741
|
+
}(), [choose, dataExplorerPanelId, store, t]);
|
|
12742
|
+
var addTimeseriesToWorkspace = React.useCallback(/*#__PURE__*/function () {
|
|
12743
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(_ref5) {
|
|
12744
|
+
var _store$getState$works2, _state$workspace5, _state$workspace6, _state$workspace7, _state$workspace8, _getViewById5, _timeSeriesSelectors$2;
|
|
12745
|
+
var title, collectionLinks, targetMapId, workspaceId, collectionUrl, target, state, panels, destinationMapIds, candidates, panelId, existingService, service, plotId, isNewPanel, plotPreset, mosaicNode, _t2;
|
|
12746
|
+
return _regenerator().w(function (_context3) {
|
|
12747
|
+
while (1) switch (_context3.n) {
|
|
12748
|
+
case 0:
|
|
12749
|
+
title = _ref5.title, collectionLinks = _ref5.collectionLinks, targetMapId = _ref5.targetMapId;
|
|
12750
|
+
workspaceId = (_store$getState$works2 = store.getState().workspace) == null ? void 0 : _store$getState$works2.id;
|
|
12417
12751
|
if (!(collectionLinks.length === 1)) {
|
|
12418
|
-
|
|
12752
|
+
_context3.n = 1;
|
|
12419
12753
|
break;
|
|
12420
12754
|
}
|
|
12421
|
-
|
|
12422
|
-
|
|
12755
|
+
_t2 = collectionLinks[0].href;
|
|
12756
|
+
_context3.n = 3;
|
|
12423
12757
|
break;
|
|
12424
12758
|
case 1:
|
|
12425
|
-
|
|
12759
|
+
_context3.n = 2;
|
|
12426
12760
|
return choose({
|
|
12427
12761
|
title: t('dataexplorer-select-data-link'),
|
|
12428
12762
|
options: collectionLinks.map(function (link) {
|
|
@@ -12433,54 +12767,68 @@ var DataExplorerTimeseriesConnect = function DataExplorerTimeseriesConnect(_ref)
|
|
|
12433
12767
|
})
|
|
12434
12768
|
});
|
|
12435
12769
|
case 2:
|
|
12436
|
-
|
|
12770
|
+
_t2 = _context3.v;
|
|
12437
12771
|
case 3:
|
|
12438
|
-
collectionUrl =
|
|
12772
|
+
collectionUrl = _t2;
|
|
12439
12773
|
if (!(!collectionUrl || !mounted.current)) {
|
|
12440
|
-
|
|
12774
|
+
_context3.n = 4;
|
|
12441
12775
|
break;
|
|
12442
12776
|
}
|
|
12443
|
-
return
|
|
12777
|
+
return _context3.a(2);
|
|
12444
12778
|
case 4:
|
|
12445
|
-
|
|
12779
|
+
_context3.n = 5;
|
|
12446
12780
|
return resolveEdrCollectionTarget(collectionUrl);
|
|
12447
12781
|
case 5:
|
|
12448
|
-
target =
|
|
12782
|
+
target = _context3.v;
|
|
12449
12783
|
if (mounted.current) {
|
|
12450
|
-
|
|
12784
|
+
_context3.n = 6;
|
|
12451
12785
|
break;
|
|
12452
12786
|
}
|
|
12453
|
-
return
|
|
12787
|
+
return _context3.a(2);
|
|
12454
12788
|
case 6:
|
|
12455
12789
|
state = store.getState();
|
|
12456
|
-
if (!(((_state$
|
|
12457
|
-
|
|
12790
|
+
if (!(((_state$workspace5 = state.workspace) == null ? void 0 : _state$workspace5.id) !== workspaceId || (_state$workspace6 = state.workspace) != null && _state$workspace6.isLoading)) {
|
|
12791
|
+
_context3.n = 7;
|
|
12458
12792
|
break;
|
|
12459
12793
|
}
|
|
12460
12794
|
throw new TranslatedError(t('dataexplorer-timeseries-error-workspace-changed'));
|
|
12461
12795
|
case 7:
|
|
12462
12796
|
panels = getViewIds(state).filter(function (id) {
|
|
12463
|
-
var
|
|
12464
|
-
return ((
|
|
12797
|
+
var _getViewById3;
|
|
12798
|
+
return ((_getViewById3 = getViewById(state, id)) == null ? void 0 : _getViewById3.componentType) === 'TimeSeries';
|
|
12465
12799
|
});
|
|
12466
|
-
|
|
12467
|
-
|
|
12468
|
-
|
|
12469
|
-
|
|
12470
|
-
|
|
12800
|
+
destinationMapIds = [];
|
|
12801
|
+
if (dataExplorerPanelId) {
|
|
12802
|
+
destinationMapIds = genericSelectors.getLinkedTargetIds(state, dataExplorerPanelId).filter(function (id) {
|
|
12803
|
+
return mapSelectors.getAllMapIds(state).includes(id);
|
|
12804
|
+
});
|
|
12805
|
+
} else if (targetMapId) {
|
|
12806
|
+
destinationMapIds = [targetMapId];
|
|
12807
|
+
}
|
|
12808
|
+
candidates = [];
|
|
12809
|
+
if (destinationMapIds.length) {
|
|
12810
|
+
candidates = panels.filter(function (id) {
|
|
12811
|
+
var linkedMaps = genericSelectors.getLinkedTargetIds(state, id);
|
|
12812
|
+
return linkedMaps.length > 0 ? linkedMaps.some(function (mapId) {
|
|
12813
|
+
return destinationMapIds.includes(mapId);
|
|
12814
|
+
}) : destinationMapIds.includes(timeSeriesSelectors.getMapId(state, id) || '');
|
|
12815
|
+
});
|
|
12816
|
+
} else if (!dataExplorerPanelId) {
|
|
12817
|
+
candidates = panels;
|
|
12818
|
+
}
|
|
12471
12819
|
panelId = candidates.length === 1 ? candidates[0] : undefined;
|
|
12472
12820
|
if (!(candidates.length > 1)) {
|
|
12473
|
-
|
|
12821
|
+
_context3.n = 9;
|
|
12474
12822
|
break;
|
|
12475
12823
|
}
|
|
12476
|
-
|
|
12824
|
+
_context3.n = 8;
|
|
12477
12825
|
return choose({
|
|
12478
12826
|
title: t('dataexplorer-select-timeseries-panel'),
|
|
12479
12827
|
options: candidates.map(function (id, index) {
|
|
12480
|
-
var
|
|
12828
|
+
var _getViewById4, _timeSeriesSelectors$;
|
|
12481
12829
|
return {
|
|
12482
12830
|
id: id,
|
|
12483
|
-
title: ((
|
|
12831
|
+
title: ((_getViewById4 = getViewById(state, id)) == null ? void 0 : _getViewById4.title) || t('dataexplorer-timeseries-panel', {
|
|
12484
12832
|
number: index + 1
|
|
12485
12833
|
}),
|
|
12486
12834
|
description: (_timeSeriesSelectors$ = timeSeriesSelectors.getPlotState(state, id)) == null ? void 0 : _timeSeriesSelectors$.plots.map(function (plot) {
|
|
@@ -12490,22 +12838,22 @@ var DataExplorerTimeseriesConnect = function DataExplorerTimeseriesConnect(_ref)
|
|
|
12490
12838
|
})
|
|
12491
12839
|
});
|
|
12492
12840
|
case 8:
|
|
12493
|
-
panelId =
|
|
12841
|
+
panelId = _context3.v;
|
|
12494
12842
|
if (panelId) {
|
|
12495
|
-
|
|
12843
|
+
_context3.n = 9;
|
|
12496
12844
|
break;
|
|
12497
12845
|
}
|
|
12498
|
-
return
|
|
12846
|
+
return _context3.a(2);
|
|
12499
12847
|
case 9:
|
|
12500
12848
|
state = store.getState();
|
|
12501
12849
|
if (mounted.current) {
|
|
12502
|
-
|
|
12850
|
+
_context3.n = 10;
|
|
12503
12851
|
break;
|
|
12504
12852
|
}
|
|
12505
|
-
return
|
|
12853
|
+
return _context3.a(2);
|
|
12506
12854
|
case 10:
|
|
12507
|
-
if (!(((_state$
|
|
12508
|
-
|
|
12855
|
+
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')) {
|
|
12856
|
+
_context3.n = 11;
|
|
12509
12857
|
break;
|
|
12510
12858
|
}
|
|
12511
12859
|
throw new TranslatedError(t('dataexplorer-timeseries-error-workspace-changed'));
|
|
@@ -12528,7 +12876,7 @@ var DataExplorerTimeseriesConnect = function DataExplorerTimeseriesConnect(_ref)
|
|
|
12528
12876
|
isNewPanel = !panelId;
|
|
12529
12877
|
panelId != null ? panelId : panelId = v4();
|
|
12530
12878
|
if (!(!isNewPanel && !timeSeriesSelectors.getPlotState(state, panelId))) {
|
|
12531
|
-
|
|
12879
|
+
_context3.n = 12;
|
|
12532
12880
|
break;
|
|
12533
12881
|
}
|
|
12534
12882
|
throw new TranslatedError(t('dataexplorer-timeseries-error-panel-loading'));
|
|
@@ -12548,7 +12896,7 @@ var DataExplorerTimeseriesConnect = function DataExplorerTimeseriesConnect(_ref)
|
|
|
12548
12896
|
}
|
|
12549
12897
|
if (isNewPanel) {
|
|
12550
12898
|
plotPreset = {
|
|
12551
|
-
mapId:
|
|
12899
|
+
mapId: destinationMapIds[0] || '',
|
|
12552
12900
|
plots: [{
|
|
12553
12901
|
plotId: plotId,
|
|
12554
12902
|
title: title
|
|
@@ -12581,10 +12929,10 @@ var DataExplorerTimeseriesConnect = function DataExplorerTimeseriesConnect(_ref)
|
|
|
12581
12929
|
panelId: panelId,
|
|
12582
12930
|
plotPreset: plotPreset
|
|
12583
12931
|
}));
|
|
12584
|
-
if (
|
|
12932
|
+
if (destinationMapIds.length) {
|
|
12585
12933
|
store.dispatch(syncGroupsActions.updateLinkedMap({
|
|
12586
12934
|
panelId: panelId,
|
|
12587
|
-
mapIds:
|
|
12935
|
+
mapIds: destinationMapIds
|
|
12588
12936
|
}));
|
|
12589
12937
|
}
|
|
12590
12938
|
} else {
|
|
@@ -12617,57 +12965,84 @@ var DataExplorerTimeseriesConnect = function DataExplorerTimeseriesConnect(_ref)
|
|
|
12617
12965
|
}));
|
|
12618
12966
|
});
|
|
12619
12967
|
case 13:
|
|
12620
|
-
return
|
|
12968
|
+
return _context3.a(2);
|
|
12621
12969
|
}
|
|
12622
|
-
},
|
|
12970
|
+
}, _callee3);
|
|
12623
12971
|
}));
|
|
12624
|
-
return function (
|
|
12625
|
-
return
|
|
12972
|
+
return function (_x3) {
|
|
12973
|
+
return _ref6.apply(this, arguments);
|
|
12626
12974
|
};
|
|
12627
|
-
}(), [choose, store, t]);
|
|
12975
|
+
}(), [choose, dataExplorerPanelId, store, t]);
|
|
12628
12976
|
var addTimeseries = React.useCallback(/*#__PURE__*/function () {
|
|
12629
|
-
var
|
|
12630
|
-
var
|
|
12631
|
-
return _regenerator().w(function (
|
|
12632
|
-
while (1) switch (
|
|
12977
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(request) {
|
|
12978
|
+
var _t3;
|
|
12979
|
+
return _regenerator().w(function (_context4) {
|
|
12980
|
+
while (1) switch (_context4.p = _context4.n) {
|
|
12633
12981
|
case 0:
|
|
12634
|
-
|
|
12635
|
-
|
|
12982
|
+
_context4.p = 0;
|
|
12983
|
+
_context4.n = 1;
|
|
12636
12984
|
return addTimeseriesToWorkspace(request);
|
|
12637
12985
|
case 1:
|
|
12638
|
-
|
|
12986
|
+
_context4.n = 5;
|
|
12639
12987
|
break;
|
|
12640
12988
|
case 2:
|
|
12641
|
-
|
|
12642
|
-
|
|
12643
|
-
if (!(
|
|
12644
|
-
|
|
12989
|
+
_context4.p = 2;
|
|
12990
|
+
_t3 = _context4.v;
|
|
12991
|
+
if (!(_t3 instanceof TranslatedError)) {
|
|
12992
|
+
_context4.n = 3;
|
|
12645
12993
|
break;
|
|
12646
12994
|
}
|
|
12647
|
-
throw
|
|
12995
|
+
throw _t3;
|
|
12648
12996
|
case 3:
|
|
12649
|
-
if (!(
|
|
12650
|
-
|
|
12997
|
+
if (!(_t3 instanceof EdrCollectionTargetError)) {
|
|
12998
|
+
_context4.n = 4;
|
|
12651
12999
|
break;
|
|
12652
13000
|
}
|
|
12653
|
-
throw new TranslatedError(t("dataexplorer-timeseries-error-" +
|
|
13001
|
+
throw new TranslatedError(t("dataexplorer-timeseries-error-" + _t3.code));
|
|
12654
13002
|
case 4:
|
|
12655
|
-
console.error('Unable to add dataset as Timeseries: ',
|
|
13003
|
+
console.error('Unable to add dataset as Timeseries: ', _t3);
|
|
12656
13004
|
throw new TranslatedError(t('dataexplorer-timeseries-error-generic'));
|
|
12657
13005
|
case 5:
|
|
12658
|
-
return
|
|
13006
|
+
return _context4.a(2);
|
|
12659
13007
|
}
|
|
12660
|
-
},
|
|
13008
|
+
}, _callee4, null, [[0, 2]]);
|
|
12661
13009
|
}));
|
|
12662
|
-
return function (
|
|
12663
|
-
return
|
|
13010
|
+
return function (_x4) {
|
|
13011
|
+
return _ref7.apply(this, arguments);
|
|
12664
13012
|
};
|
|
12665
13013
|
}(), [addTimeseriesToWorkspace, t]);
|
|
13014
|
+
var removeMapLayer = React.useCallback(function (_ref8) {
|
|
13015
|
+
var targetMapIds = _ref8.targetMapIds,
|
|
13016
|
+
layerName = _ref8.layerName,
|
|
13017
|
+
serviceUrl = _ref8.serviceUrl;
|
|
13018
|
+
var state = store.getState();
|
|
13019
|
+
var linkedMapIds = dataExplorerPanelId ? genericSelectors.getLinkedTargetIds(state, dataExplorerPanelId) : targetMapIds;
|
|
13020
|
+
var mapIds = new Set(linkedMapIds);
|
|
13021
|
+
var matchingLayers = layerSelectors.getAllLayers(state).filter(function (layer) {
|
|
13022
|
+
return mapIds.has(layer.mapId) && layer.name === layerName && layer.service === serviceUrl;
|
|
13023
|
+
});
|
|
13024
|
+
var changedMapIds = new Set();
|
|
13025
|
+
matchingLayers.forEach(function (layer) {
|
|
13026
|
+
var mapId = layer.mapId;
|
|
13027
|
+
store.dispatch(layerActions.layerDelete({
|
|
13028
|
+
mapId: mapId,
|
|
13029
|
+
layerId: layer.id,
|
|
13030
|
+
origin: layerTypes.LayerActionOrigin.layerManager
|
|
13031
|
+
}));
|
|
13032
|
+
changedMapIds.add(mapId);
|
|
13033
|
+
});
|
|
13034
|
+
changedMapIds.forEach(function (mapId) {
|
|
13035
|
+
store.dispatch(viewPresetActions.setViewPresetHasChanges({
|
|
13036
|
+
panelId: mapId,
|
|
13037
|
+
hasChanges: true
|
|
13038
|
+
}));
|
|
13039
|
+
});
|
|
13040
|
+
if (changedMapIds.size) {
|
|
13041
|
+
store.dispatch(workspaceActions.markWorkspaceChanged());
|
|
13042
|
+
}
|
|
13043
|
+
}, [dataExplorerPanelId, store]);
|
|
12666
13044
|
return jsxs(Fragment, {
|
|
12667
|
-
children: [
|
|
12668
|
-
onAddTimeseries: addTimeseries,
|
|
12669
|
-
productConfigKey: productConfigKey
|
|
12670
|
-
}), jsxs(Dialog, {
|
|
13045
|
+
children: [children(addTimeseries, addMapLayer, removeMapLayer), jsxs(Dialog, {
|
|
12671
13046
|
onClose: function onClose() {
|
|
12672
13047
|
return finishChoice();
|
|
12673
13048
|
},
|
|
@@ -12699,6 +13074,18 @@ var DataExplorerTimeseriesConnect = function DataExplorerTimeseriesConnect(_ref)
|
|
|
12699
13074
|
})]
|
|
12700
13075
|
});
|
|
12701
13076
|
};
|
|
13077
|
+
var DataExplorerTimeseriesConnect = function DataExplorerTimeseriesConnect(_ref9) {
|
|
13078
|
+
var productConfigKey = _ref9.productConfigKey;
|
|
13079
|
+
return jsx(DataExplorerActionsConnect, {
|
|
13080
|
+
children: function children(addTimeseries, addMapLayer) {
|
|
13081
|
+
return jsx(DataExplorerConnect, {
|
|
13082
|
+
onAddMapLayer: addMapLayer,
|
|
13083
|
+
onAddTimeseries: addTimeseries,
|
|
13084
|
+
productConfigKey: productConfigKey
|
|
13085
|
+
});
|
|
13086
|
+
}
|
|
13087
|
+
});
|
|
13088
|
+
};
|
|
12702
13089
|
|
|
12703
13090
|
/* *
|
|
12704
13091
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -12949,6 +13336,20 @@ var viewPresets = [
|
|
|
12949
13336
|
componentType: "WarningsTimeline",
|
|
12950
13337
|
initialProps: {
|
|
12951
13338
|
}
|
|
13339
|
+
},
|
|
13340
|
+
{
|
|
13341
|
+
id: "template-data-explorer",
|
|
13342
|
+
title: {
|
|
13343
|
+
en: "New data explorer preset",
|
|
13344
|
+
fi: "Uusi data explorer-preset",
|
|
13345
|
+
no: "Ny data explorer-preset",
|
|
13346
|
+
nl: "Nieuwe data explorer-preset"
|
|
13347
|
+
},
|
|
13348
|
+
componentType: "DataExplorer",
|
|
13349
|
+
initialProps: {
|
|
13350
|
+
dataExplorerPreset: {
|
|
13351
|
+
}
|
|
13352
|
+
}
|
|
12952
13353
|
}
|
|
12953
13354
|
];
|
|
12954
13355
|
var templatePresets = {
|
|
@@ -14354,4 +14755,41 @@ var workspaceEndpoints = [].concat(createUserPreferencesEndpoints(), [http.get(/
|
|
|
14354
14755
|
}, _callee6);
|
|
14355
14756
|
})))]);
|
|
14356
14757
|
|
|
14357
|
-
|
|
14758
|
+
var WorkspaceDataExplorerPanelConnect = function WorkspaceDataExplorerPanelConnect(_ref) {
|
|
14759
|
+
var _linkedMaps$find;
|
|
14760
|
+
var panelId = _ref.panelId,
|
|
14761
|
+
productConfigKey = _ref.productConfigKey;
|
|
14762
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
14763
|
+
t = _useWorkspaceTranslat.t;
|
|
14764
|
+
var mapIds = useSelector(function (state) {
|
|
14765
|
+
return mapSelectors.getAllMapIds(state);
|
|
14766
|
+
});
|
|
14767
|
+
var linkedMaps = useSelector(function (state) {
|
|
14768
|
+
return genericSelectors.getLinkedTargetIds(state, panelId);
|
|
14769
|
+
});
|
|
14770
|
+
var targetMapIds = linkedMaps;
|
|
14771
|
+
var targetMapId = (_linkedMaps$find = linkedMaps.find(function (id) {
|
|
14772
|
+
return mapIds.includes(id);
|
|
14773
|
+
})) != null ? _linkedMaps$find : '';
|
|
14774
|
+
if (!productConfigKey) {
|
|
14775
|
+
return jsx(AlertBanner, {
|
|
14776
|
+
title: t('workspace-data-explorer-not-configured')
|
|
14777
|
+
});
|
|
14778
|
+
}
|
|
14779
|
+
return jsx(DataExplorerActionsConnect, {
|
|
14780
|
+
panelId: panelId,
|
|
14781
|
+
children: function children(addTimeseries, addMapLayer, removeMapLayer) {
|
|
14782
|
+
return jsx(DataExplorerPanelContent, {
|
|
14783
|
+
onAddMapLayer: addMapLayer,
|
|
14784
|
+
onAddTimeseries: addTimeseries,
|
|
14785
|
+
onRemoveMapLayer: removeMapLayer,
|
|
14786
|
+
productConfigKey: productConfigKey,
|
|
14787
|
+
targetMapId: targetMapId,
|
|
14788
|
+
targetMapIds: targetMapIds,
|
|
14789
|
+
viewId: panelId
|
|
14790
|
+
});
|
|
14791
|
+
}
|
|
14792
|
+
});
|
|
14793
|
+
};
|
|
14794
|
+
|
|
14795
|
+
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 };
|