@opengeoweb/workspace 13.1.1 → 14.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.js +1619 -1560
- package/package.json +17 -16
- package/src/lib/components/WorkspaceMenu/WorkspaceMenuButton.d.ts +9 -4
- package/src/lib/components/WorkspaceMenu/WorkspaceMenuButtonConnect.d.ts +8 -2
- package/src/lib/components/WorkspaceMenu/index.d.ts +0 -1
- package/src/lib/components/WorkspaceOptions/WorkspaceOptions.d.ts +4 -10
- package/src/lib/components/WorkspaceOptions/WorkspaceOptionsConnect.d.ts +0 -2
- package/src/lib/store/types.d.ts +2 -0
- package/src/lib/store/viewPresets/reducer.d.ts +1 -1
- package/src/lib/store/viewPresets/selectors.d.ts +29 -28
- package/src/lib/store/viewPresets/types.d.ts +2 -1
- package/src/lib/store/workspaceList/reducer.d.ts +3 -3
package/index.esm.js
CHANGED
|
@@ -9,18 +9,18 @@ import { PROJECTION, getAxiosErrorMessage, isAxiosAuthError, isAxiosError as isA
|
|
|
9
9
|
import { snackbarTypes, snackbarActions, snackbarListener, snackbarReducer, SnackbarWrapperConnect } from '@opengeoweb/snackbar';
|
|
10
10
|
import { isAxiosError } from 'axios';
|
|
11
11
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
12
|
-
import { ThemeWrapper, lightTheme, SharedPresetsMyUser, SharedPresetsOtherUsers, Delete, Preset, PresetWorkspace, PresetTiles, CloudLoading, CloudIdle, Link, LinkOff, SplitVertical, SplitHorizontal, Expand, UnExpand, Close, WebAssetOff, Exclamation } from '@opengeoweb/theme';
|
|
12
|
+
import { ThemeWrapper, lightTheme, SharedPresetsMyUser, SharedPresetsOtherUsers, Delete, Preset, PresetWorkspace, PresetTiles, CloudLoading, CloudIdle, Options, Link, LinkOff, SplitVertical, SplitHorizontal, Expand, UnExpand, Close, WebAssetOff, Exclamation } from '@opengeoweb/theme';
|
|
13
13
|
import { Provider, useDispatch, useSelector, useStore, shallowEqual } from 'react-redux';
|
|
14
14
|
import { useTranslation, I18nextProvider } from 'react-i18next';
|
|
15
15
|
import { AuthenticationProvider, useAuthenticationContext, GEOWEB_ROLE_PRESETS_ADMIN } from '@opengeoweb/authentication';
|
|
16
16
|
import { QueryClient, QueryClientProvider, useMutation } from '@tanstack/react-query';
|
|
17
17
|
import i18n from 'i18next';
|
|
18
18
|
import { webmapReactTranslations, WEBMAP_REACT_NAMESPACE } from '@opengeoweb/webmap-react';
|
|
19
|
-
import { coreTranslations, CORE_NAMESPACE } from '@opengeoweb/core';
|
|
19
|
+
import { coreTranslations, CORE_NAMESPACE, LoadingIndicatorProgressBar } from '@opengeoweb/core';
|
|
20
20
|
import { formFieldsTranslations, FORM_FIELDS_NAMESPACE, ReactHookFormTextField, ReactHookFormHiddenInput, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
|
|
21
21
|
import * as React from 'react';
|
|
22
22
|
import React__default, { useCallback, useEffect } from 'react';
|
|
23
|
-
import { LinearProgress, Typography, styled, ListItemIcon, ListItem, ListItemButton, ListItemText, Grid, Box, Menu, ListSubheader, MenuItem,
|
|
23
|
+
import { LinearProgress, Typography, styled, ListItemIcon, ListItem, ListItemButton, ListItemText, Grid, Box, useTheme, Menu, ListSubheader, MenuItem, List, Checkbox, FormGroup, FormControlLabel, Tabs } from '@mui/material';
|
|
24
24
|
import 'react-mosaic-component/react-mosaic-component.css';
|
|
25
25
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
26
26
|
import { FixedSizeList } from 'react-window';
|
|
@@ -112,7 +112,8 @@ var en = {
|
|
|
112
112
|
"workspace-viewpreset-success-unshare": "View preset \"{{TITLE}}\" has been successfully unshared",
|
|
113
113
|
"workspace-loading-indicator-loading": "Loading",
|
|
114
114
|
"workspace-loading-indicator-idle": "Loaded",
|
|
115
|
-
"workspace-open-tab": "Open in new tab"
|
|
115
|
+
"workspace-open-tab": "Open in new tab",
|
|
116
|
+
"workspace-currently": "Currently"
|
|
116
117
|
};
|
|
117
118
|
var fi = {
|
|
118
119
|
"workspace-menu": "Workspace menu",
|
|
@@ -195,7 +196,8 @@ var fi = {
|
|
|
195
196
|
"workspace-viewpreset-success-share": "ei käännetty",
|
|
196
197
|
"workspace-viewpreset-success-unshare": "ei käännetty",
|
|
197
198
|
"workspace-loading-indicator-loading": "Ladataan",
|
|
198
|
-
"workspace-loading-indicator-idle": "Ladattu"
|
|
199
|
+
"workspace-loading-indicator-idle": "Ladattu",
|
|
200
|
+
"workspace-currently": "Nykyinen"
|
|
199
201
|
};
|
|
200
202
|
var no = {
|
|
201
203
|
"workspace-menu": "Arbeidsflater",
|
|
@@ -279,7 +281,8 @@ var no = {
|
|
|
279
281
|
"workspace-viewpreset-success-share": "Vinduet \"{{TITLE}}\" har blitt delt",
|
|
280
282
|
"workspace-viewpreset-success-unshare": "Vinduet \"{{TITLE}}\" deles ikke lenger",
|
|
281
283
|
"workspace-loading-indicator-loading": "Laster inn",
|
|
282
|
-
"workspace-loading-indicator-idle": "Lastet inn"
|
|
284
|
+
"workspace-loading-indicator-idle": "Lastet inn",
|
|
285
|
+
"workspace-currently": "Nåværende"
|
|
283
286
|
};
|
|
284
287
|
var nl = {
|
|
285
288
|
"workspace-menu": "Workspace menu",
|
|
@@ -366,7 +369,8 @@ var nl = {
|
|
|
366
369
|
"workspace-viewpreset-success-unshare": "niet vertaald",
|
|
367
370
|
"workspace-loading-indicator-loading": "Aan het laden",
|
|
368
371
|
"workspace-loading-indicator-idle": "Klaar met laden",
|
|
369
|
-
"workspace-open-tab": "Open in nieuw tabblad"
|
|
372
|
+
"workspace-open-tab": "Open in nieuw tabblad",
|
|
373
|
+
"workspace-currently": "Huidig"
|
|
370
374
|
};
|
|
371
375
|
var workspaceTranslations = {
|
|
372
376
|
en: en,
|
|
@@ -989,9 +993,7 @@ var slice$3 = createSlice({
|
|
|
989
993
|
initialState: initialState$3,
|
|
990
994
|
name: 'workspaceList',
|
|
991
995
|
reducers: {
|
|
992
|
-
fetchWorkspaceList: function fetchWorkspaceList(draft,
|
|
993
|
-
// eslint-disable-next-line no-unused-vars
|
|
994
|
-
action) {
|
|
996
|
+
fetchWorkspaceList: function fetchWorkspaceList(draft, _action) {
|
|
995
997
|
draft.isFetching = true;
|
|
996
998
|
draft.error = undefined;
|
|
997
999
|
},
|
|
@@ -1011,9 +1013,7 @@ var slice$3 = createSlice({
|
|
|
1011
1013
|
isFetching: false
|
|
1012
1014
|
});
|
|
1013
1015
|
},
|
|
1014
|
-
onSuccessWorkspaceSaveDialog: function onSuccessWorkspaceSaveDialog(draft,
|
|
1015
|
-
// eslint-disable-next-line no-unused-vars
|
|
1016
|
-
action) {
|
|
1016
|
+
onSuccessWorkspaceSaveDialog: function onSuccessWorkspaceSaveDialog(draft, action) {
|
|
1017
1017
|
if (!draft.workspaceActionDialog) {
|
|
1018
1018
|
return;
|
|
1019
1019
|
}
|
|
@@ -1023,9 +1023,7 @@ var slice$3 = createSlice({
|
|
|
1023
1023
|
}
|
|
1024
1024
|
draft.workspaceActionDialog.hasSaved = true;
|
|
1025
1025
|
},
|
|
1026
|
-
submitFormWorkspaceActionDialogOptions: function submitFormWorkspaceActionDialogOptions(draft,
|
|
1027
|
-
// eslint-disable-next-line no-unused-vars
|
|
1028
|
-
action) {
|
|
1026
|
+
submitFormWorkspaceActionDialogOptions: function submitFormWorkspaceActionDialogOptions(draft, _action) {
|
|
1029
1027
|
if (!draft.workspaceActionDialog) {
|
|
1030
1028
|
return;
|
|
1031
1029
|
}
|
|
@@ -1036,9 +1034,7 @@ var slice$3 = createSlice({
|
|
|
1036
1034
|
delete draft.workspaceActionDialog;
|
|
1037
1035
|
},
|
|
1038
1036
|
// action is intercepted in mapPresets/listener
|
|
1039
|
-
onSuccessWorkspacePresetAction: function onSuccessWorkspacePresetAction(draft,
|
|
1040
|
-
// eslint-disable-next-line no-unused-vars
|
|
1041
|
-
action) {
|
|
1037
|
+
onSuccessWorkspacePresetAction: function onSuccessWorkspacePresetAction(draft, _action) {
|
|
1042
1038
|
delete draft.workspaceActionDialog;
|
|
1043
1039
|
},
|
|
1044
1040
|
onErrorWorkspacePresetAction: function onErrorWorkspacePresetAction(draft, action) {
|
|
@@ -1322,11 +1318,7 @@ var slice$2 = createSlice({
|
|
|
1322
1318
|
}
|
|
1323
1319
|
},
|
|
1324
1320
|
// action is intercepted in mapPresets/listener
|
|
1325
|
-
onSuccessViewPresetAction: function onSuccessViewPresetAction(
|
|
1326
|
-
// eslint-disable-next-line no-unused-vars
|
|
1327
|
-
draft,
|
|
1328
|
-
// eslint-disable-next-line no-unused-vars
|
|
1329
|
-
action) {},
|
|
1321
|
+
onSuccessViewPresetAction: function onSuccessViewPresetAction(_draft, _action) {},
|
|
1330
1322
|
registerViewPreset: function registerViewPreset(draft, action) {
|
|
1331
1323
|
var _action$payload8 = action.payload,
|
|
1332
1324
|
mapId = _action$payload8.panelId,
|
|
@@ -1614,6 +1606,7 @@ var filterAndSortPresets = function filterAndSortPresets(presets, selectedFilter
|
|
|
1614
1606
|
return [].concat(systemPresets, personalPresets, sharedPresets);
|
|
1615
1607
|
};
|
|
1616
1608
|
|
|
1609
|
+
/* eslint-disable no-redeclare */
|
|
1617
1610
|
/* *
|
|
1618
1611
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1619
1612
|
* you may not use this file except in compliance with the License.
|
|
@@ -1633,7 +1626,7 @@ var filterAndSortPresets = function filterAndSortPresets(presets, selectedFilter
|
|
|
1633
1626
|
* */
|
|
1634
1627
|
var getSnackbarMessage$1 = function getSnackbarMessage(action, title, is_shared) {
|
|
1635
1628
|
// Trim and add quotes
|
|
1636
|
-
var trimmedTitle =
|
|
1629
|
+
var trimmedTitle = title.trim();
|
|
1637
1630
|
switch (action) {
|
|
1638
1631
|
case WorkspacePresetAction.DELETE:
|
|
1639
1632
|
return {
|
|
@@ -1839,11 +1832,7 @@ var slice$1 = createSlice({
|
|
|
1839
1832
|
draft.hasChanges = true;
|
|
1840
1833
|
draft.viewType = getViewType$1(draft.views.allIds.length, action.payload.componentType);
|
|
1841
1834
|
},
|
|
1842
|
-
setNewWorkspaceView: function setNewWorkspaceView(
|
|
1843
|
-
// eslint-disable-next-line no-unused-vars
|
|
1844
|
-
draft,
|
|
1845
|
-
// eslint-disable-next-line no-unused-vars
|
|
1846
|
-
action) {},
|
|
1835
|
+
setNewWorkspaceView: function setNewWorkspaceView(_draft, _action) {},
|
|
1847
1836
|
deleteWorkspaceView: function deleteWorkspaceView(draft, action) {
|
|
1848
1837
|
var id = action.payload.id;
|
|
1849
1838
|
draft.views.allIds = draft.views.allIds.filter(function (viewId) {
|
|
@@ -1902,9 +1891,7 @@ var slice$1 = createSlice({
|
|
|
1902
1891
|
draft.scope = workspacePreset.scope;
|
|
1903
1892
|
draft.syncGroups = [];
|
|
1904
1893
|
},
|
|
1905
|
-
changeToEmptyMapWorkspace: function changeToEmptyMapWorkspace(draft,
|
|
1906
|
-
// eslint-disable-next-line no-unused-vars
|
|
1907
|
-
action) {
|
|
1894
|
+
changeToEmptyMapWorkspace: function changeToEmptyMapWorkspace(draft, action) {
|
|
1908
1895
|
return draft;
|
|
1909
1896
|
},
|
|
1910
1897
|
setPreset: function setPreset(draft, action) {
|
|
@@ -1946,9 +1933,7 @@ var slice$1 = createSlice({
|
|
|
1946
1933
|
});
|
|
1947
1934
|
},
|
|
1948
1935
|
// workspaces
|
|
1949
|
-
fetchWorkspace: function fetchWorkspace(draft,
|
|
1950
|
-
// eslint-disable-next-line no-unused-vars
|
|
1951
|
-
action) {
|
|
1936
|
+
fetchWorkspace: function fetchWorkspace(draft, _action) {
|
|
1952
1937
|
draft.isLoading = true;
|
|
1953
1938
|
draft.error = undefined;
|
|
1954
1939
|
},
|
|
@@ -1961,21 +1946,13 @@ var slice$1 = createSlice({
|
|
|
1961
1946
|
draft.title = workspace == null ? void 0 : workspace.title;
|
|
1962
1947
|
}
|
|
1963
1948
|
},
|
|
1964
|
-
errorWorkspace: function errorWorkspace(draft,
|
|
1965
|
-
// eslint-disable-next-line no-unused-vars
|
|
1966
|
-
action) {
|
|
1949
|
+
errorWorkspace: function errorWorkspace(draft, action) {
|
|
1967
1950
|
var error = action.payload.error;
|
|
1968
1951
|
draft.isLoading = false;
|
|
1969
1952
|
draft.error = error;
|
|
1970
1953
|
},
|
|
1971
|
-
fetchWorkspaceViewPreset: function fetchWorkspaceViewPreset(
|
|
1972
|
-
|
|
1973
|
-
draft,
|
|
1974
|
-
// eslint-disable-next-line no-unused-vars
|
|
1975
|
-
action) {},
|
|
1976
|
-
saveWorkspacePreset: function saveWorkspacePreset(draft,
|
|
1977
|
-
// eslint-disable-next-line no-unused-vars
|
|
1978
|
-
action) {
|
|
1954
|
+
fetchWorkspaceViewPreset: function fetchWorkspaceViewPreset(_draft, _action) {},
|
|
1955
|
+
saveWorkspacePreset: function saveWorkspacePreset(draft, _action) {
|
|
1979
1956
|
draft.isLoading = true;
|
|
1980
1957
|
draft.error = undefined;
|
|
1981
1958
|
}
|
|
@@ -2052,7 +2029,6 @@ var slice$1 = createSlice({
|
|
|
2052
2029
|
});
|
|
2053
2030
|
}
|
|
2054
2031
|
});
|
|
2055
|
-
// eslint-disable-next-line prefer-destructuring
|
|
2056
2032
|
var workspaceReducer = slice$1.reducer;
|
|
2057
2033
|
var workspaceActions = Object.assign({}, slice$1.actions);
|
|
2058
2034
|
|
|
@@ -2079,12 +2055,13 @@ var getViewPresetsStore = function getViewPresetsStore(store) {
|
|
|
2079
2055
|
}
|
|
2080
2056
|
return initialState$2;
|
|
2081
2057
|
};
|
|
2058
|
+
var EMPTY_VIEW_PRESETS = {
|
|
2059
|
+
entities: {},
|
|
2060
|
+
ids: []
|
|
2061
|
+
};
|
|
2082
2062
|
var selectors$2 = viewPresetsAdapter.getSelectors(function (state) {
|
|
2083
2063
|
var _state$viewPresets;
|
|
2084
|
-
return (_state$viewPresets = state == null ? void 0 : state.viewPresets) != null ? _state$viewPresets :
|
|
2085
|
-
entities: {},
|
|
2086
|
-
ids: []
|
|
2087
|
-
};
|
|
2064
|
+
return (_state$viewPresets = state == null ? void 0 : state.viewPresets) != null ? _state$viewPresets : EMPTY_VIEW_PRESETS;
|
|
2088
2065
|
});
|
|
2089
2066
|
var getViewPresets = selectors$2.selectAll,
|
|
2090
2067
|
getViewPresetById = selectors$2.selectById;
|
|
@@ -2258,6 +2235,8 @@ var emptyViewPreset = function emptyViewPreset(componentType) {
|
|
|
2258
2235
|
},
|
|
2259
2236
|
services: []
|
|
2260
2237
|
},
|
|
2238
|
+
Soundings: undefined,
|
|
2239
|
+
// TODO: empty soundings preset https://gitlab.com/opengeoweb/opengeoweb/-/issues/6029
|
|
2261
2240
|
ViewError: undefined,
|
|
2262
2241
|
ViewLoading: undefined,
|
|
2263
2242
|
MultiMap: undefined,
|
|
@@ -4931,16 +4910,16 @@ workspaceListener.startListening({
|
|
|
4931
4910
|
workspaceListener.startListening({
|
|
4932
4911
|
actionCreator: workspaceActions.fetchWorkspace,
|
|
4933
4912
|
effect: function () {
|
|
4934
|
-
var _effect5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4935
|
-
var payload, workspaceId, workspaceApi, _yield$workspaceApi$g2, workspaceData, fullLoadingWorkspace, workspaceIdsInBatches, errorType;
|
|
4936
|
-
return _regeneratorRuntime().wrap(function
|
|
4937
|
-
while (1) switch (
|
|
4913
|
+
var _effect5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref6, listenerApi) {
|
|
4914
|
+
var payload, workspaceId, workspaceApi, _yield$workspaceApi$g2, workspaceData, fullLoadingWorkspace, workspaceIdsInBatches, actionsToDispatch, errorType;
|
|
4915
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
4916
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
4938
4917
|
case 0:
|
|
4939
4918
|
payload = _ref6.payload;
|
|
4940
4919
|
// Cancel any in-progress instances of this listener
|
|
4941
4920
|
listenerApi.cancelActiveListeners();
|
|
4942
4921
|
workspaceId = payload.workspaceId;
|
|
4943
|
-
|
|
4922
|
+
_context7.prev = 3;
|
|
4944
4923
|
listenerApi.dispatch(routerActions.navigateToUrl({
|
|
4945
4924
|
url: getWorkspaceRouteUrl(workspaceId)
|
|
4946
4925
|
}));
|
|
@@ -4949,13 +4928,13 @@ workspaceListener.startListening({
|
|
|
4949
4928
|
}));
|
|
4950
4929
|
// fetch workspace
|
|
4951
4930
|
workspaceApi = getWorkspaceApi();
|
|
4952
|
-
|
|
4931
|
+
_context7.next = 9;
|
|
4953
4932
|
return workspaceApi.getWorkspacePreset(workspaceId);
|
|
4954
4933
|
case 9:
|
|
4955
|
-
_yield$workspaceApi$g2 =
|
|
4934
|
+
_yield$workspaceApi$g2 = _context7.sent;
|
|
4956
4935
|
workspaceData = _yield$workspaceApi$g2.data;
|
|
4957
4936
|
if (workspaceData) {
|
|
4958
|
-
|
|
4937
|
+
_context7.next = 13;
|
|
4959
4938
|
break;
|
|
4960
4939
|
}
|
|
4961
4940
|
throw new Error(ERROR_NOT_FOUND);
|
|
@@ -4969,60 +4948,52 @@ workspaceListener.startListening({
|
|
|
4969
4948
|
listenerApi.dispatch(workspaceActions.changePreset({
|
|
4970
4949
|
workspacePreset: fullLoadingWorkspace
|
|
4971
4950
|
}));
|
|
4972
|
-
// fetch all individual view presets in batches
|
|
4951
|
+
// fetch all individual view presets in batches and collect all actions
|
|
4973
4952
|
workspaceIdsInBatches = getListInChunks(workspaceData.views);
|
|
4974
|
-
|
|
4953
|
+
actionsToDispatch = [];
|
|
4954
|
+
_context7.next = 20;
|
|
4975
4955
|
return Promise.all(workspaceIdsInBatches.map(/*#__PURE__*/function () {
|
|
4976
|
-
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4977
|
-
return _regeneratorRuntime().wrap(function
|
|
4978
|
-
while (1) switch (
|
|
4956
|
+
var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(batchCall) {
|
|
4957
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
4958
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
4979
4959
|
case 0:
|
|
4980
|
-
|
|
4981
|
-
return Promise.all(batchCall.map(
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
return _context6.abrupt("return", fetchWorkspaceViewPreset(listenerApi.dispatch, view.viewPresetId, view.mosaicNodeId));
|
|
4987
|
-
case 1:
|
|
4988
|
-
case "end":
|
|
4989
|
-
return _context6.stop();
|
|
4990
|
-
}
|
|
4991
|
-
}, _callee6);
|
|
4992
|
-
}));
|
|
4993
|
-
return function (_x13) {
|
|
4994
|
-
return _ref8.apply(this, arguments);
|
|
4995
|
-
};
|
|
4996
|
-
}()));
|
|
4960
|
+
_context6.next = 2;
|
|
4961
|
+
return Promise.all(batchCall.map(function (view) {
|
|
4962
|
+
return fetchWorkspaceViewPreset(function (thunkAction) {
|
|
4963
|
+
actionsToDispatch.push(thunkAction);
|
|
4964
|
+
}, view.viewPresetId, view.mosaicNodeId);
|
|
4965
|
+
}));
|
|
4997
4966
|
case 2:
|
|
4998
4967
|
case "end":
|
|
4999
|
-
return
|
|
4968
|
+
return _context6.stop();
|
|
5000
4969
|
}
|
|
5001
|
-
},
|
|
4970
|
+
}, _callee6);
|
|
5002
4971
|
}));
|
|
5003
4972
|
return function (_x12) {
|
|
5004
4973
|
return _ref7.apply(this, arguments);
|
|
5005
4974
|
};
|
|
5006
4975
|
}()));
|
|
5007
|
-
case
|
|
5008
|
-
|
|
4976
|
+
case 20:
|
|
4977
|
+
// Trigger all actions at once
|
|
4978
|
+
actionsToDispatch.map(listenerApi.dispatch);
|
|
4979
|
+
_context7.next = 27;
|
|
5009
4980
|
break;
|
|
5010
|
-
case
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
errorType =
|
|
4981
|
+
case 23:
|
|
4982
|
+
_context7.prev = 23;
|
|
4983
|
+
_context7.t0 = _context7["catch"](3);
|
|
4984
|
+
errorType = _context7.t0.message === ERROR_NOT_FOUND ? WorkspaceErrorType.NOT_FOUND : WorkspaceErrorType.GENERIC;
|
|
5014
4985
|
listenerApi.dispatch(workspaceActions.errorWorkspace({
|
|
5015
4986
|
workspaceId: workspaceId,
|
|
5016
4987
|
error: {
|
|
5017
|
-
message: getErrorMessage(
|
|
4988
|
+
message: getErrorMessage(_context7.t0),
|
|
5018
4989
|
type: errorType
|
|
5019
4990
|
}
|
|
5020
4991
|
}));
|
|
5021
|
-
case
|
|
4992
|
+
case 27:
|
|
5022
4993
|
case "end":
|
|
5023
|
-
return
|
|
4994
|
+
return _context7.stop();
|
|
5024
4995
|
}
|
|
5025
|
-
},
|
|
4996
|
+
}, _callee7, null, [[3, 23]]);
|
|
5026
4997
|
}));
|
|
5027
4998
|
function effect(_x10, _x11) {
|
|
5028
4999
|
return _effect5.apply(this, arguments);
|
|
@@ -5033,18 +5004,18 @@ workspaceListener.startListening({
|
|
|
5033
5004
|
workspaceListener.startListening({
|
|
5034
5005
|
actionCreator: workspaceActions.saveWorkspacePreset,
|
|
5035
5006
|
effect: function () {
|
|
5036
|
-
var _effect6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5007
|
+
var _effect6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref8, listenerApi) {
|
|
5037
5008
|
var payload, workspace, workspaceApi;
|
|
5038
|
-
return _regeneratorRuntime().wrap(function
|
|
5039
|
-
while (1) switch (
|
|
5009
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
5010
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
5040
5011
|
case 0:
|
|
5041
|
-
payload =
|
|
5012
|
+
payload = _ref8.payload;
|
|
5042
5013
|
// Cancel any in-progress instances of this listener
|
|
5043
5014
|
listenerApi.cancelActiveListeners();
|
|
5044
5015
|
workspace = payload.workspace;
|
|
5045
|
-
|
|
5016
|
+
_context8.prev = 3;
|
|
5046
5017
|
workspaceApi = getWorkspaceApi();
|
|
5047
|
-
|
|
5018
|
+
_context8.next = 7;
|
|
5048
5019
|
return workspaceApi.saveWorkspacePreset(workspace.id, workspace);
|
|
5049
5020
|
case 7:
|
|
5050
5021
|
listenerApi.dispatch(workspaceActions.loadedWorkspace(undefined));
|
|
@@ -5054,25 +5025,25 @@ workspaceListener.startListening({
|
|
|
5054
5025
|
title: workspace.title,
|
|
5055
5026
|
scope: workspace.scope || 'user'
|
|
5056
5027
|
}));
|
|
5057
|
-
|
|
5028
|
+
_context8.next = 14;
|
|
5058
5029
|
break;
|
|
5059
5030
|
case 11:
|
|
5060
|
-
|
|
5061
|
-
|
|
5031
|
+
_context8.prev = 11;
|
|
5032
|
+
_context8.t0 = _context8["catch"](3);
|
|
5062
5033
|
listenerApi.dispatch(workspaceActions.errorWorkspace({
|
|
5063
5034
|
workspaceId: workspace.id,
|
|
5064
5035
|
error: {
|
|
5065
|
-
message:
|
|
5036
|
+
message: _context8.t0.message,
|
|
5066
5037
|
type: WorkspaceErrorType.SAVE
|
|
5067
5038
|
}
|
|
5068
5039
|
}));
|
|
5069
5040
|
case 14:
|
|
5070
5041
|
case "end":
|
|
5071
|
-
return
|
|
5042
|
+
return _context8.stop();
|
|
5072
5043
|
}
|
|
5073
|
-
},
|
|
5044
|
+
}, _callee8, null, [[3, 11]]);
|
|
5074
5045
|
}));
|
|
5075
|
-
function effect(
|
|
5046
|
+
function effect(_x13, _x14) {
|
|
5076
5047
|
return _effect6.apply(this, arguments);
|
|
5077
5048
|
}
|
|
5078
5049
|
return effect;
|
|
@@ -5081,10 +5052,10 @@ workspaceListener.startListening({
|
|
|
5081
5052
|
workspaceListener.startListening({
|
|
5082
5053
|
actionCreator: workspaceActions.changeToEmptyMapWorkspace,
|
|
5083
5054
|
effect: function () {
|
|
5084
|
-
var _effect7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5055
|
+
var _effect7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(action, listenerApi) {
|
|
5085
5056
|
var _action$payload, newMapPresetText, newWorkspaceText, intialViewMapPreset;
|
|
5086
|
-
return _regeneratorRuntime().wrap(function
|
|
5087
|
-
while (1) switch (
|
|
5057
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
5058
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
5088
5059
|
case 0:
|
|
5089
5060
|
_action$payload = action.payload, newMapPresetText = _action$payload.newMapPresetText, newWorkspaceText = _action$payload.newWorkspaceText; // Cancel any in-progress instances of this listener
|
|
5090
5061
|
listenerApi.cancelActiveListeners();
|
|
@@ -5094,11 +5065,11 @@ workspaceListener.startListening({
|
|
|
5094
5065
|
}));
|
|
5095
5066
|
case 4:
|
|
5096
5067
|
case "end":
|
|
5097
|
-
return
|
|
5068
|
+
return _context9.stop();
|
|
5098
5069
|
}
|
|
5099
|
-
},
|
|
5070
|
+
}, _callee9);
|
|
5100
5071
|
}));
|
|
5101
|
-
function effect(
|
|
5072
|
+
function effect(_x15, _x16) {
|
|
5102
5073
|
return _effect7.apply(this, arguments);
|
|
5103
5074
|
}
|
|
5104
5075
|
return effect;
|
|
@@ -5107,12 +5078,12 @@ workspaceListener.startListening({
|
|
|
5107
5078
|
workspaceListener.startListening({
|
|
5108
5079
|
actionCreator: workspaceActions.setNewWorkspaceView,
|
|
5109
5080
|
effect: function () {
|
|
5110
|
-
var _effect8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5081
|
+
var _effect8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee0(_ref9, listenerApi) {
|
|
5111
5082
|
var payload, mosaicNodeId, componentType, newId, bbox, srs, mapPreset;
|
|
5112
|
-
return _regeneratorRuntime().wrap(function
|
|
5113
|
-
while (1) switch (
|
|
5083
|
+
return _regeneratorRuntime().wrap(function _callee0$(_context0) {
|
|
5084
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
5114
5085
|
case 0:
|
|
5115
|
-
payload =
|
|
5086
|
+
payload = _ref9.payload;
|
|
5116
5087
|
mosaicNodeId = payload.mosaicNodeId, componentType = payload.componentType, newId = payload.newId; // TODO: this would be nice to move into the openlayers store
|
|
5117
5088
|
createViewObjectForNewMap(mosaicNodeId, newId);
|
|
5118
5089
|
// Note, at some point these might no longer be necessary
|
|
@@ -5134,11 +5105,11 @@ workspaceListener.startListening({
|
|
|
5134
5105
|
}));
|
|
5135
5106
|
case 7:
|
|
5136
5107
|
case "end":
|
|
5137
|
-
return
|
|
5108
|
+
return _context0.stop();
|
|
5138
5109
|
}
|
|
5139
|
-
},
|
|
5110
|
+
}, _callee0);
|
|
5140
5111
|
}));
|
|
5141
|
-
function effect(
|
|
5112
|
+
function effect(_x17, _x18) {
|
|
5142
5113
|
return _effect8.apply(this, arguments);
|
|
5143
5114
|
}
|
|
5144
5115
|
return effect;
|
|
@@ -5147,15 +5118,15 @@ workspaceListener.startListening({
|
|
|
5147
5118
|
workspaceListener.startListening({
|
|
5148
5119
|
actionCreator: workspaceActions.updateWorkspaceViews,
|
|
5149
5120
|
effect: function () {
|
|
5150
|
-
var _effect9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
5121
|
+
var _effect9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee1(_, listenerApi) {
|
|
5151
5122
|
var viewIds;
|
|
5152
|
-
return _regeneratorRuntime().wrap(function
|
|
5153
|
-
while (1) switch (
|
|
5123
|
+
return _regeneratorRuntime().wrap(function _callee1$(_context1) {
|
|
5124
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
5154
5125
|
case 0:
|
|
5155
5126
|
// Cancel any in-progress instances of this listener
|
|
5156
5127
|
listenerApi.cancelActiveListeners();
|
|
5157
5128
|
// Delay before starting actual work
|
|
5158
|
-
|
|
5129
|
+
_context1.next = 3;
|
|
5159
5130
|
return listenerApi.delay(100);
|
|
5160
5131
|
case 3:
|
|
5161
5132
|
/* This will trigger all maps and other components
|
|
@@ -5163,7 +5134,7 @@ workspaceListener.startListening({
|
|
|
5163
5134
|
window.dispatchEvent(new Event('resize'));
|
|
5164
5135
|
// Adjust the bbox of the original view after the new map is added. This is a temporal solution until the OpenLayers ticket
|
|
5165
5136
|
// https://github.com/openlayers/openlayers/issues/16572 is solved.
|
|
5166
|
-
|
|
5137
|
+
_context1.next = 6;
|
|
5167
5138
|
return listenerApi.delay(10);
|
|
5168
5139
|
case 6:
|
|
5169
5140
|
viewIds = getViewIds(listenerApi.getState());
|
|
@@ -5180,11 +5151,11 @@ workspaceListener.startListening({
|
|
|
5180
5151
|
});
|
|
5181
5152
|
case 8:
|
|
5182
5153
|
case "end":
|
|
5183
|
-
return
|
|
5154
|
+
return _context1.stop();
|
|
5184
5155
|
}
|
|
5185
|
-
},
|
|
5156
|
+
}, _callee1);
|
|
5186
5157
|
}));
|
|
5187
|
-
function effect(
|
|
5158
|
+
function effect(_x19, _x20) {
|
|
5188
5159
|
return _effect9.apply(this, arguments);
|
|
5189
5160
|
}
|
|
5190
5161
|
return effect;
|
|
@@ -5553,7 +5524,7 @@ viewPresetsListener.startListening({
|
|
|
5553
5524
|
viewPresetId: viewPresetId
|
|
5554
5525
|
}));
|
|
5555
5526
|
}
|
|
5556
|
-
} catch (
|
|
5527
|
+
} catch (_error) {
|
|
5557
5528
|
// TODO: use error handling of mapPreset https://gitlab.com/opengeoweb/opengeoweb/-/issues/3043
|
|
5558
5529
|
}
|
|
5559
5530
|
case 5:
|
|
@@ -5965,7 +5936,6 @@ var useWorkspaceTranslation = function useWorkspaceTranslation() {
|
|
|
5965
5936
|
return useTranslation(ns);
|
|
5966
5937
|
};
|
|
5967
5938
|
|
|
5968
|
-
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
5969
5939
|
/* *
|
|
5970
5940
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5971
5941
|
* you may not use this file except in compliance with the License.
|
|
@@ -6862,1561 +6832,1568 @@ var ViewPresetMenu = function ViewPresetMenu(_ref) {
|
|
|
6862
6832
|
});
|
|
6863
6833
|
};
|
|
6864
6834
|
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
setAnchorEl = _React$useState[1];
|
|
6889
|
-
var isOpen = Boolean(anchorEl);
|
|
6890
|
-
var handleClick = function handleClick(event) {
|
|
6891
|
-
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
6892
|
-
};
|
|
6893
|
-
React.useEffect(function () {
|
|
6894
|
-
if (isDefaultOpen) {
|
|
6895
|
-
setAnchorEl(document.getElementById(id));
|
|
6896
|
-
}
|
|
6897
|
-
}, [isDefaultOpen, id]);
|
|
6898
|
-
var options = [{
|
|
6899
|
-
title: t('workspace-save'),
|
|
6900
|
-
callback: handleSave
|
|
6901
|
-
}, {
|
|
6902
|
-
title: t('workspace-save-as'),
|
|
6903
|
-
callback: handleSaveAs
|
|
6904
|
-
}, {
|
|
6905
|
-
title: t('workspace-edit'),
|
|
6906
|
-
callback: handleEdit
|
|
6907
|
-
}, {
|
|
6908
|
-
title: t('workspace-reset'),
|
|
6909
|
-
callback: handleReset
|
|
6910
|
-
}, {
|
|
6911
|
-
title: t('workspace-delete'),
|
|
6912
|
-
callback: handleDelete
|
|
6913
|
-
}];
|
|
6914
|
-
var renderButton = function renderButton() {
|
|
6915
|
-
return jsxs(CustomToggleButton, {
|
|
6916
|
-
variant: "tool",
|
|
6917
|
-
selected: isOpen,
|
|
6918
|
-
onClick: handleClick,
|
|
6919
|
-
id: id,
|
|
6920
|
-
"data-testid": id,
|
|
6921
|
-
disableRipple: true,
|
|
6922
|
-
disabled: isDisabled,
|
|
6923
|
-
sx: {
|
|
6924
|
-
fontSize: '12px',
|
|
6925
|
-
'&&': {
|
|
6926
|
-
color: activeTab && !isOpen ? 'geowebColors.buttons.icon.active.color' : undefined,
|
|
6927
|
-
backgroundColor: !isOpen ? 'transparent' : undefined,
|
|
6928
|
-
'&:hover': {
|
|
6929
|
-
color: activeTab ? 'geowebColors.buttons.icon.active.color' : 'inherit',
|
|
6930
|
-
backgroundColor: 'geowebColors.workspace.tabButtonHover'
|
|
6931
|
-
},
|
|
6932
|
-
paddingRight: '4px !important',
|
|
6933
|
-
display: 'block',
|
|
6934
|
-
width: '100%',
|
|
6935
|
-
height: 20,
|
|
6936
|
-
fontStyle: hasChanges ? 'italic' : undefined,
|
|
6937
|
-
fontWeight: 500,
|
|
6938
|
-
textOverflow: 'ellipsis',
|
|
6939
|
-
overflow: 'hidden',
|
|
6940
|
-
whiteSpace: 'nowrap',
|
|
6941
|
-
lineHeight: '1px',
|
|
6942
|
-
textAlign: 'left',
|
|
6943
|
-
textTransform: 'none',
|
|
6944
|
-
'&.MuiButtonBase-root': {
|
|
6945
|
-
paddingLeft: 1,
|
|
6946
|
-
paddingTop: 1,
|
|
6947
|
-
paddingBottom: 1,
|
|
6948
|
-
border: 'none'
|
|
6949
|
-
}
|
|
6950
|
-
}
|
|
6951
|
-
},
|
|
6952
|
-
role: "button",
|
|
6953
|
-
children: [title, panelId && jsx(Box, {
|
|
6954
|
-
component: "span",
|
|
6955
|
-
sx: {
|
|
6956
|
-
fontStyle: 'normal',
|
|
6957
|
-
marginLeft: 1,
|
|
6958
|
-
color: 'geowebColors.captions.captionStatus.rgba'
|
|
6959
|
-
},
|
|
6960
|
-
children: panelId
|
|
6961
|
-
}), jsxs(Menu, {
|
|
6962
|
-
BackdropProps: {
|
|
6963
|
-
style: {
|
|
6964
|
-
opacity: 0,
|
|
6965
|
-
transition: 'none'
|
|
6966
|
-
}
|
|
6967
|
-
},
|
|
6968
|
-
open: isOpen,
|
|
6969
|
-
anchorEl: anchorEl,
|
|
6970
|
-
anchorOrigin: {
|
|
6971
|
-
vertical: 21,
|
|
6972
|
-
horizontal: 6
|
|
6973
|
-
},
|
|
6974
|
-
sx: {
|
|
6975
|
-
'& .MuiMenu-list': {
|
|
6976
|
-
padding: 0
|
|
6977
|
-
},
|
|
6978
|
-
'& .MuiMenuItem-root': {
|
|
6979
|
-
fontSize: 16
|
|
6980
|
-
}
|
|
6981
|
-
},
|
|
6982
|
-
children: [jsx(ListSubheader, {
|
|
6983
|
-
sx: {
|
|
6984
|
-
paddingTop: '8px'
|
|
6985
|
-
},
|
|
6986
|
-
children: jsx(Typography, {
|
|
6987
|
-
sx: {
|
|
6988
|
-
letterSpacing: '0.4px',
|
|
6989
|
-
fontSize: 12
|
|
6990
|
-
},
|
|
6991
|
-
children: t('workspace-options')
|
|
6992
|
-
})
|
|
6993
|
-
}), options.map(function (_ref2) {
|
|
6994
|
-
var title = _ref2.title,
|
|
6995
|
-
callback = _ref2.callback;
|
|
6996
|
-
return jsx(MenuItem, {
|
|
6997
|
-
onClick: callback,
|
|
6998
|
-
disabled: !callback,
|
|
6999
|
-
children: title
|
|
7000
|
-
}, title);
|
|
7001
|
-
})]
|
|
7002
|
-
})]
|
|
7003
|
-
});
|
|
7004
|
-
};
|
|
7005
|
-
return isDisabled ? renderButton() : jsx(CustomTooltip, {
|
|
7006
|
-
title: !isOpen && title,
|
|
7007
|
-
TransitionProps: {
|
|
7008
|
-
exit: false
|
|
7009
|
-
},
|
|
7010
|
-
children: renderButton()
|
|
7011
|
-
});
|
|
6835
|
+
/* *
|
|
6836
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6837
|
+
* you may not use this file except in compliance with the License.
|
|
6838
|
+
* You may obtain a copy of the License at
|
|
6839
|
+
*
|
|
6840
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6841
|
+
*
|
|
6842
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6843
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6844
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6845
|
+
* See the License for the specific language governing permissions and
|
|
6846
|
+
* limitations under the License.
|
|
6847
|
+
*
|
|
6848
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
6849
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
6850
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
6851
|
+
* */
|
|
6852
|
+
var config = sessionStorageProvider.getConfig();
|
|
6853
|
+
var presetBaseUrl = (config == null ? void 0 : config.GW_PRESET_BACKEND_URL) || '';
|
|
6854
|
+
var getWorkspace = function getWorkspace(workspaceId, auth) {
|
|
6855
|
+
return fetch(presetBaseUrl + "/workspacepreset/" + workspaceId, {
|
|
6856
|
+
headers: getHeaders(auth)
|
|
6857
|
+
}).then(handleResponse);
|
|
7012
6858
|
};
|
|
7013
|
-
var
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
|
|
7018
|
-
return loadingIndicatorSelectors.isLoading(store, panelId);
|
|
7019
|
-
});
|
|
7020
|
-
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7021
|
-
t = _useWorkspaceTranslat.t;
|
|
7022
|
-
return jsx(CustomTooltip, {
|
|
7023
|
-
title: isLoading ? t('workspace-loading-indicator-loading') : t('workspace-loading-indicator-idle'),
|
|
7024
|
-
children: jsx("span", {
|
|
7025
|
-
style: {
|
|
7026
|
-
height: '100%'
|
|
7027
|
-
},
|
|
7028
|
-
children: isLoading ? jsx(CloudLoading, {
|
|
7029
|
-
"data-testid": "cloudicon-loading",
|
|
7030
|
-
style: {
|
|
7031
|
-
fill: '#186DFF'
|
|
7032
|
-
}
|
|
7033
|
-
}) : jsx(CloudIdle, {
|
|
7034
|
-
"data-testid": "cloudicon-idle"
|
|
7035
|
-
})
|
|
7036
|
-
})
|
|
7037
|
-
});
|
|
6859
|
+
var deleteWorkspace = function deleteWorkspace(workspaceId, auth) {
|
|
6860
|
+
return fetch(presetBaseUrl + "/workspacepreset/" + workspaceId, {
|
|
6861
|
+
headers: getHeaders(auth),
|
|
6862
|
+
method: 'DELETE'
|
|
6863
|
+
}).then(handleResponse);
|
|
7038
6864
|
};
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
|
|
7042
|
-
|
|
7043
|
-
|
|
7044
|
-
|
|
7045
|
-
'&&': {
|
|
7046
|
-
backgroundColor: !isViewPresetDialogOpen ? 'transparent' : undefined,
|
|
7047
|
-
'&:hover': {
|
|
7048
|
-
backgroundColor: 'geowebColors.workspace.tabButtonHover'
|
|
7049
|
-
},
|
|
7050
|
-
'.MuiSvgIcon-root > path': {
|
|
7051
|
-
fill: isViewPresetDialogOpen ? theme.palette.geowebColors.iconButtons.tool.active.color : undefined
|
|
7052
|
-
}
|
|
7053
|
-
}
|
|
7054
|
-
};
|
|
6865
|
+
var updateWorkspace = function updateWorkspace(workspaceId, data, auth) {
|
|
6866
|
+
return fetch(presetBaseUrl + "/workspacepreset/" + workspaceId, {
|
|
6867
|
+
headers: getHeaders(auth),
|
|
6868
|
+
method: 'PUT',
|
|
6869
|
+
body: JSON.stringify(data)
|
|
6870
|
+
}).then(handleResponse);
|
|
7055
6871
|
};
|
|
7056
|
-
var
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
6872
|
+
var createWorkspace = function createWorkspace(data, auth) {
|
|
6873
|
+
return fetch(presetBaseUrl + "/workspacepreset", {
|
|
6874
|
+
headers: getHeaders(auth),
|
|
6875
|
+
method: 'POST',
|
|
6876
|
+
body: JSON.stringify(data)
|
|
6877
|
+
}).then(handleResponse);
|
|
6878
|
+
};
|
|
6879
|
+
|
|
6880
|
+
var WorkspaceSelectListConnect = function WorkspaceSelectListConnect() {
|
|
6881
|
+
var _GENERIC$AUTH$error$c;
|
|
7064
6882
|
var _useAuthenticationCon = useAuthenticationContext(),
|
|
7065
6883
|
currentRole = _useAuthenticationCon.currentRole,
|
|
7066
6884
|
isLoggedIn = _useAuthenticationCon.isLoggedIn,
|
|
7067
6885
|
auth = _useAuthenticationCon.auth;
|
|
6886
|
+
var username = (auth == null ? void 0 : auth.username) || '';
|
|
7068
6887
|
var isAdmin = (currentRole == null ? void 0 : currentRole.name) === GEOWEB_ROLE_PRESETS_ADMIN.name;
|
|
7069
|
-
var
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
title = _ref2.title,
|
|
7073
|
-
scope = _ref2.scope,
|
|
7074
|
-
restProps = _objectWithoutPropertiesLoose(_ref2, _excluded$4);
|
|
7075
|
-
return Object.assign({
|
|
7076
|
-
title: title,
|
|
7077
|
-
scope: scope
|
|
7078
|
-
}, restProps);
|
|
7079
|
-
}, shallowEqual);
|
|
7080
|
-
var viewComponentType = useSelector(function (store) {
|
|
7081
|
-
return getViewComponentType(store, panelId);
|
|
6888
|
+
var scope = !isAdmin ? 'user' : 'system';
|
|
6889
|
+
var workspacePresets = useSelector(function (store) {
|
|
6890
|
+
return getWorkspaceList(store);
|
|
7082
6891
|
});
|
|
7083
|
-
var
|
|
7084
|
-
|
|
6892
|
+
var selectedFilters = useSelector(getWorkspaceListFilters);
|
|
6893
|
+
var filteredPresets = React.useMemo(function () {
|
|
6894
|
+
return filterAndSortPresets(workspacePresets, selectedFilters, username, isAdmin);
|
|
6895
|
+
}, [workspacePresets, selectedFilters, username, isAdmin]);
|
|
6896
|
+
var currentView = useSelector(function (store) {
|
|
6897
|
+
return getWorkspaceState(store);
|
|
7085
6898
|
});
|
|
7086
|
-
var
|
|
7087
|
-
return
|
|
6899
|
+
var workspaceListFilters = useSelector(function (store) {
|
|
6900
|
+
return getWorkspaceListFilters(store, scope, isAdmin);
|
|
7088
6901
|
});
|
|
7089
|
-
var
|
|
7090
|
-
return
|
|
6902
|
+
var workspaceSearchQuery = useSelector(function (store) {
|
|
6903
|
+
return getWorkspaceListSearchQuery(store);
|
|
7091
6904
|
});
|
|
7092
|
-
var
|
|
7093
|
-
return
|
|
6905
|
+
var isFetching = useSelector(function (store) {
|
|
6906
|
+
return getIsWorkspaceListFetching(store);
|
|
7094
6907
|
});
|
|
7095
|
-
var
|
|
7096
|
-
|
|
7097
|
-
var title = workspaceView.title || t('workspace-mappreset-new');
|
|
7098
|
-
var viewScope = workspaceView.scope;
|
|
7099
|
-
var fullTitle = getPresetTitle(title, hasViewPresetChanges, isNewActive, t);
|
|
7100
|
-
var openViewPresetsDialog = React.useCallback(function (viewPresetDialogOptions) {
|
|
7101
|
-
dispatch(viewPresetActions.openViewPresetDialog({
|
|
7102
|
-
viewPresetDialog: viewPresetDialogOptions
|
|
7103
|
-
}));
|
|
7104
|
-
}, [dispatch]);
|
|
7105
|
-
var currentWarningsPreset = useSelector(function (store) {
|
|
7106
|
-
return publicWarningsSelectors.getWarningsPresetById(store, panelId);
|
|
6908
|
+
var error = useSelector(function (store) {
|
|
6909
|
+
return getWorkspaceListError(store);
|
|
7107
6910
|
});
|
|
7108
|
-
var
|
|
7109
|
-
|
|
7110
|
-
|
|
7111
|
-
|
|
7112
|
-
|
|
7113
|
-
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
};
|
|
7119
|
-
default:
|
|
7120
|
-
return undefined;
|
|
7121
|
-
}
|
|
7122
|
-
}, [currentWarningsPreset, panelId, relatedSyncGroupIds, store, viewComponentType]);
|
|
7123
|
-
var onSave = React.useCallback(function () {
|
|
7124
|
-
dispatch(viewPresetActions.saveViewPreset({
|
|
7125
|
-
panelId: panelId,
|
|
7126
|
-
viewPresetId: activeViewPresetId,
|
|
7127
|
-
viewPreset: Object.assign({}, emptyViewPreset(viewComponentType), {
|
|
7128
|
-
title: title,
|
|
7129
|
-
initialProps: constructInitialProps()
|
|
7130
|
-
})
|
|
7131
|
-
}));
|
|
7132
|
-
}, [activeViewPresetId, constructInitialProps, dispatch, panelId, title, viewComponentType]);
|
|
7133
|
-
var onDelete = React.useCallback(function () {
|
|
7134
|
-
openViewPresetsDialog({
|
|
7135
|
-
title: t('workspace-mappreset-dialog-title-delete'),
|
|
7136
|
-
action: PresetAction.DELETE,
|
|
7137
|
-
viewPresetId: activeViewPresetId,
|
|
7138
|
-
panelId: panelId,
|
|
7139
|
-
formValues: {
|
|
7140
|
-
title: title,
|
|
7141
|
-
"abstract": presetAbstract
|
|
7142
|
-
}
|
|
7143
|
-
});
|
|
7144
|
-
}, [activeViewPresetId, openViewPresetsDialog, panelId, title, presetAbstract, t]);
|
|
7145
|
-
var onSaveAs = React.useCallback(function () {
|
|
7146
|
-
var formTitle = activeViewPresetId ? title : '';
|
|
7147
|
-
openViewPresetsDialog({
|
|
7148
|
-
title: t('workspace-mappreset-save-as'),
|
|
7149
|
-
action: PresetAction.SAVE_AS,
|
|
7150
|
-
viewPresetId: activeViewPresetId,
|
|
7151
|
-
panelId: panelId,
|
|
7152
|
-
formValues: {
|
|
7153
|
-
title: formTitle,
|
|
7154
|
-
initialProps: constructInitialProps(),
|
|
7155
|
-
"abstract": presetAbstract
|
|
7156
|
-
}
|
|
7157
|
-
});
|
|
7158
|
-
}, [activeViewPresetId, constructInitialProps, openViewPresetsDialog, panelId, t, title, presetAbstract]);
|
|
7159
|
-
var onEdit = React.useCallback(function () {
|
|
7160
|
-
var formTitle = activeViewPresetId ? title : '';
|
|
7161
|
-
openViewPresetsDialog({
|
|
7162
|
-
title: t('workspace-mappreset-dialog-title-edit'),
|
|
7163
|
-
action: PresetAction.EDIT,
|
|
7164
|
-
panelId: panelId,
|
|
7165
|
-
viewPresetId: activeViewPresetId,
|
|
7166
|
-
formValues: {
|
|
7167
|
-
title: formTitle,
|
|
7168
|
-
initialProps: constructInitialProps(),
|
|
7169
|
-
"abstract": presetAbstract
|
|
7170
|
-
}
|
|
7171
|
-
});
|
|
7172
|
-
}, [activeViewPresetId, constructInitialProps, openViewPresetsDialog, panelId, t, title, presetAbstract]);
|
|
7173
|
-
var onReset = React.useCallback(function () {
|
|
7174
|
-
openViewPresetsDialog({
|
|
7175
|
-
title: t('workspace-reset-title'),
|
|
7176
|
-
action: PresetAction.RESET,
|
|
7177
|
-
viewPresetId: activeViewPresetId,
|
|
7178
|
-
panelId: panelId,
|
|
7179
|
-
formValues: {
|
|
7180
|
-
title: title
|
|
7181
|
-
}
|
|
7182
|
-
});
|
|
7183
|
-
}, [activeViewPresetId, openViewPresetsDialog, panelId, t, title]);
|
|
7184
|
-
var toggleViewPresetDialog = React.useCallback(function (_ref3) {
|
|
7185
|
-
var panelId = _ref3.panelId,
|
|
7186
|
-
isViewPresetDialogOpen = _ref3.isViewPresetDialogOpen;
|
|
7187
|
-
dispatch(viewPresetActions.toggleViewPresetListDialog({
|
|
7188
|
-
panelId: panelId,
|
|
7189
|
-
isViewPresetListDialogOpen: isViewPresetDialogOpen
|
|
6911
|
+
var dispatch = useDispatch();
|
|
6912
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
6913
|
+
t = _useWorkspaceTranslat.t;
|
|
6914
|
+
var fetchWorkspaceList = React.useCallback(function () {
|
|
6915
|
+
var filterParams = constructFilterParams([], workspaceSearchQuery);
|
|
6916
|
+
dispatch(workspaceListActions.fetchWorkspaceList(filterParams));
|
|
6917
|
+
}, [dispatch, workspaceSearchQuery]);
|
|
6918
|
+
var fetchWorkspace = React.useCallback(function (workspaceId) {
|
|
6919
|
+
dispatch(workspaceActions.fetchWorkspace({
|
|
6920
|
+
workspaceId: workspaceId
|
|
7190
6921
|
}));
|
|
7191
6922
|
}, [dispatch]);
|
|
7192
|
-
var
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
}, [isViewPresetDialogOpen, theme]);
|
|
7201
|
-
var presetIcon = React.useMemo(function () {
|
|
7202
|
-
return jsx(Preset, {});
|
|
7203
|
-
}, []);
|
|
7204
|
-
renderCounter.count(WorkspaceViewTitleConnectNoMemo.name);
|
|
7205
|
-
var viewpresetCreator = (currentViewPreset == null ? void 0 : currentViewPreset.username) || '';
|
|
7206
|
-
var isUserPresetCreator = (auth == null ? void 0 : auth.username) === viewpresetCreator;
|
|
7207
|
-
var currentViewScope = viewScope || 'system';
|
|
7208
|
-
var isEnabled = (currentViewScope === 'user' && isUserPresetCreator || isAdmin && currentViewScope === 'system') && activeViewPresetId !== '' && isLoggedIn;
|
|
7209
|
-
return (
|
|
7210
|
-
// Zero-length string assignment prevents showing title as an empty object '[object Object]'.
|
|
7211
|
-
// in child components. This is a workaround for a limitation in the Tooltip component.
|
|
7212
|
-
jsxs(Grid, {
|
|
7213
|
-
title: "",
|
|
7214
|
-
sx: {
|
|
7215
|
-
display: 'flex',
|
|
7216
|
-
flexGrow: 3,
|
|
7217
|
-
flexDirection: 'row',
|
|
7218
|
-
justifyContent: 'center',
|
|
7219
|
-
alignItems: 'center'
|
|
7220
|
-
},
|
|
7221
|
-
children: [jsx(CustomIconButton, {
|
|
7222
|
-
"data-testid": "open-viewpresets",
|
|
7223
|
-
sx: style,
|
|
7224
|
-
variant: "tool",
|
|
7225
|
-
onClick: onClickOpenViewPreset,
|
|
7226
|
-
tooltipTitle: t('workspace-viewpreset-menu'),
|
|
7227
|
-
isSelected: isViewPresetDialogOpen,
|
|
7228
|
-
children: presetIcon
|
|
7229
|
-
}), jsx(WorkspaceOptions, {
|
|
7230
|
-
panelId: panelId,
|
|
7231
|
-
title: fullTitle,
|
|
7232
|
-
hasChanges: hasViewPresetChanges || isNewActive,
|
|
7233
|
-
handleSave: isEnabled ? onSave : undefined,
|
|
7234
|
-
handleDelete: isEnabled ? onDelete : undefined,
|
|
7235
|
-
handleSaveAs: isLoggedIn ? onSaveAs : undefined,
|
|
7236
|
-
handleEdit: isEnabled ? onEdit : undefined,
|
|
7237
|
-
handleReset: onReset,
|
|
7238
|
-
id: viewPresetOptionId
|
|
7239
|
-
}), jsx(Box, {
|
|
7240
|
-
sx: {
|
|
7241
|
-
pt: 0.72
|
|
7242
|
-
},
|
|
7243
|
-
children: jsx(LoadingIndicatorConnect, {
|
|
7244
|
-
panelId: panelId
|
|
7245
|
-
})
|
|
7246
|
-
})]
|
|
7247
|
-
})
|
|
7248
|
-
);
|
|
7249
|
-
};
|
|
7250
|
-
var WorkspaceViewTitleConnect = /*#__PURE__*/React.memo(WorkspaceViewTitleConnectNoMemo);
|
|
7251
|
-
|
|
7252
|
-
/* *
|
|
7253
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7254
|
-
* you may not use this file except in compliance with the License.
|
|
7255
|
-
* You may obtain a copy of the License at
|
|
7256
|
-
*
|
|
7257
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7258
|
-
*
|
|
7259
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
7260
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7261
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7262
|
-
* See the License for the specific language governing permissions and
|
|
7263
|
-
* limitations under the License.
|
|
7264
|
-
*
|
|
7265
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
7266
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
7267
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
7268
|
-
* */
|
|
7269
|
-
var getUniqueId = function getUniqueId(existingIds, count) {
|
|
7270
|
-
if (count === void 0) {
|
|
7271
|
-
count = 1;
|
|
7272
|
-
}
|
|
7273
|
-
var newId = count + "_screen";
|
|
7274
|
-
if (existingIds.indexOf(newId) !== -1) {
|
|
7275
|
-
return getUniqueId(existingIds, count + 1);
|
|
7276
|
-
}
|
|
7277
|
-
return newId;
|
|
7278
|
-
};
|
|
7279
|
-
var createBalancedMosaicNode = function createBalancedMosaicNode(currentNode) {
|
|
7280
|
-
var leaves = getLeaves(currentNode);
|
|
7281
|
-
return createBalancedTreeFromLeaves(leaves);
|
|
7282
|
-
};
|
|
7283
|
-
var closeDialogsWhenChangingPreset = function closeDialogsWhenChangingPreset(componentTypes, dispatch) {
|
|
7284
|
-
if (!componentTypes || componentTypes.length === 0 || componentTypes.some(function (componentType) {
|
|
7285
|
-
return componentType.toLowerCase().includes('viewloading');
|
|
7286
|
-
})) {
|
|
7287
|
-
return;
|
|
7288
|
-
}
|
|
7289
|
-
// Close all dialogs related to timeseries
|
|
7290
|
-
if (!componentTypes.some(function (componentType) {
|
|
7291
|
-
return componentType.toLowerCase().includes('timeseries');
|
|
7292
|
-
})) {
|
|
7293
|
-
dispatch(uiActions.setToggleOpenDialog({
|
|
7294
|
-
setOpen: false,
|
|
7295
|
-
type: uiTypes.DialogTypes.TimeSeriesManager
|
|
7296
|
-
}));
|
|
7297
|
-
dispatch(uiActions.setToggleOpenDialog({
|
|
7298
|
-
setOpen: false,
|
|
7299
|
-
type: uiTypes.DialogTypes.TimeSeriesSelect
|
|
7300
|
-
}));
|
|
7301
|
-
dispatch(uiActions.setToggleOpenDialog({
|
|
7302
|
-
setOpen: false,
|
|
7303
|
-
type: uiTypes.DialogTypes.TimeSeriesInfo
|
|
6923
|
+
var setWorkspaceActionDialogOptions = React.useCallback(function (dialogOptions) {
|
|
6924
|
+
dispatch(workspaceListActions.openWorkspaceActionDialogOptions(dialogOptions));
|
|
6925
|
+
}, [dispatch]);
|
|
6926
|
+
var toggleSelectFilterChip = React.useCallback(function (id, isSelected) {
|
|
6927
|
+
dispatch(workspaceListActions.toggleSelectFilterChip({
|
|
6928
|
+
id: id,
|
|
6929
|
+
isSelected: isSelected,
|
|
6930
|
+
isAdmin: isAdmin
|
|
7304
6931
|
}));
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
6932
|
+
}, [dispatch, isAdmin]);
|
|
6933
|
+
var setSelectAllFilterChip = React.useCallback(function () {
|
|
6934
|
+
dispatch(workspaceListActions.setSelectAllFilterChip());
|
|
6935
|
+
}, [dispatch]);
|
|
6936
|
+
var searchFilter = React.useCallback(function (searchQuery) {
|
|
6937
|
+
dispatch(workspaceListActions.searchFilter({
|
|
6938
|
+
searchQuery: searchQuery
|
|
7308
6939
|
}));
|
|
7309
|
-
}
|
|
7310
|
-
//
|
|
7311
|
-
|
|
7312
|
-
|
|
7313
|
-
|
|
7314
|
-
dispatch(uiActions.setToggleOpenDialog({
|
|
7315
|
-
setOpen: false,
|
|
7316
|
-
type: uiTypes.DialogTypes.SoundingsLocations
|
|
6940
|
+
}, [dispatch]);
|
|
6941
|
+
// If we're loading the `New workspace` preset as defined in the FE, use this instead of retrieving from BE
|
|
6942
|
+
var onClickNewPreset = React.useCallback(function () {
|
|
6943
|
+
dispatch(routerActions.navigateToUrl({
|
|
6944
|
+
url: getWorkspaceRouteUrl()
|
|
7317
6945
|
}));
|
|
7318
|
-
dispatch(
|
|
7319
|
-
|
|
7320
|
-
type: uiTypes.DialogTypes.SoundingsSources
|
|
6946
|
+
dispatch(workspaceListActions.toggleWorkspaceDialog({
|
|
6947
|
+
isWorkspaceListDialogOpen: false
|
|
7321
6948
|
}));
|
|
7322
|
-
|
|
7323
|
-
|
|
7324
|
-
|
|
7325
|
-
return componentType.toLowerCase().includes('warninglist');
|
|
7326
|
-
}) && !componentTypes.some(function (componentType) {
|
|
7327
|
-
return componentType.toLowerCase().includes('map');
|
|
7328
|
-
})) {
|
|
7329
|
-
dispatch(uiActions.setToggleOpenDialog({
|
|
7330
|
-
setOpen: false,
|
|
7331
|
-
type: uiTypes.DialogTypes.PublicWarnings
|
|
6949
|
+
dispatch(workspaceActions.changeToEmptyMapWorkspace({
|
|
6950
|
+
newMapPresetText: t('workspace-mappreset-new'),
|
|
6951
|
+
newWorkspaceText: t('workspace-new')
|
|
7332
6952
|
}));
|
|
7333
|
-
}
|
|
7334
|
-
|
|
7335
|
-
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
|
|
7340
|
-
t = _useWorkspaceTranslat.t;
|
|
7341
|
-
var _React$useState = React__default.useState(null),
|
|
7342
|
-
anchorEl = _React$useState[0],
|
|
7343
|
-
setAnchorEl = _React$useState[1];
|
|
7344
|
-
var maps = useSelector(function (store) {
|
|
7345
|
-
return mapSelectors.getAllMapIds(store);
|
|
7346
|
-
});
|
|
7347
|
-
var viewsById = useSelector(getViewsById);
|
|
7348
|
-
var selectedMapIds = useSelector(function (store) {
|
|
7349
|
-
return genericSelectors.getLinkedMaps(store, panelId);
|
|
7350
|
-
});
|
|
7351
|
-
var viewComponentType = useSelector(function (store) {
|
|
7352
|
-
return getViewComponentType(store, panelId);
|
|
7353
|
-
});
|
|
7354
|
-
var sharedFeature = useSelector(function (store) {
|
|
7355
|
-
return genericSelectors.getSelectedFeature(store.syncGroups, panelId);
|
|
7356
|
-
});
|
|
7357
|
-
var mapPinLocation = useSelector(function (store) {
|
|
7358
|
-
return mapSelectors.getPinLocation(store, selectedMapIds[0] || '');
|
|
7359
|
-
});
|
|
7360
|
-
var handleLinkViews = function handleLinkViews(event) {
|
|
7361
|
-
setAnchorEl(event.currentTarget);
|
|
7362
|
-
};
|
|
7363
|
-
var handleMenuClose = function handleMenuClose() {
|
|
7364
|
-
setAnchorEl(null);
|
|
6953
|
+
}, [dispatch, t]);
|
|
6954
|
+
var onClickWorkspacePreset = function onClickWorkspacePreset(id) {
|
|
6955
|
+
if (id === getEmptyMapWorkspace(t).id) {
|
|
6956
|
+
onClickNewPreset();
|
|
6957
|
+
} else if (!isFetching) {
|
|
6958
|
+
fetchWorkspace(id);
|
|
6959
|
+
}
|
|
7365
6960
|
};
|
|
7366
|
-
var
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
dispatch(genericActions.updateLinkedMap({
|
|
7371
|
-
panelId: panelId,
|
|
7372
|
-
mapIds: updatedMapIds
|
|
7373
|
-
}));
|
|
7374
|
-
// Sync pin to newly added map for TimeSeries components
|
|
7375
|
-
if (!selectedMapIds.includes(mapId) && viewComponentType === 'TimeSeries') {
|
|
7376
|
-
// Observation station
|
|
7377
|
-
if (sharedFeature) {
|
|
7378
|
-
dispatch(mapActions.setMapPinLocation({
|
|
7379
|
-
mapId: mapId,
|
|
7380
|
-
mapPinLocation: {
|
|
7381
|
-
lon: sharedFeature.lon,
|
|
7382
|
-
lat: sharedFeature.lat
|
|
7383
|
-
}
|
|
7384
|
-
}));
|
|
7385
|
-
// Grid
|
|
7386
|
-
} else if (mapPinLocation) {
|
|
7387
|
-
dispatch(mapActions.setMapPinLocation({
|
|
7388
|
-
mapId: mapId,
|
|
7389
|
-
mapPinLocation: mapPinLocation
|
|
7390
|
-
}));
|
|
6961
|
+
var onClickFilterChip = function onClickFilterChip(id, shouldSelect) {
|
|
6962
|
+
if (id === 'all') {
|
|
6963
|
+
if (shouldSelect) {
|
|
6964
|
+
setSelectAllFilterChip();
|
|
7391
6965
|
}
|
|
6966
|
+
} else {
|
|
6967
|
+
toggleSelectFilterChip(id, shouldSelect);
|
|
7392
6968
|
}
|
|
7393
6969
|
};
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
6970
|
+
var onClickWorkspacePresetOption = function onClickWorkspacePresetOption(presetId, workspaceAction) {
|
|
6971
|
+
// If affectedPreset is the FE defined `New workspace` - use the definition from FE instead of BE
|
|
6972
|
+
var affectedPreset = presetId === getEmptyMapWorkspace(t).id ? getEmptyMapWorkspace(t) : workspacePresets.find(function (preset) {
|
|
6973
|
+
return preset.id === presetId;
|
|
6974
|
+
});
|
|
6975
|
+
var presetTitle = affectedPreset == null ? void 0 : affectedPreset.title;
|
|
6976
|
+
switch (workspaceAction) {
|
|
6977
|
+
case WorkspacePresetAction.DUPLICATE:
|
|
6978
|
+
case WorkspacePresetAction.EDIT:
|
|
6979
|
+
{
|
|
6980
|
+
setWorkspaceActionDialogOptions({
|
|
6981
|
+
action: workspaceAction,
|
|
6982
|
+
presetId: presetId,
|
|
6983
|
+
formValues: {
|
|
6984
|
+
title: presetTitle,
|
|
6985
|
+
"abstract": affectedPreset["abstract"],
|
|
6986
|
+
scope: scope
|
|
6987
|
+
}
|
|
6988
|
+
});
|
|
6989
|
+
break;
|
|
6990
|
+
}
|
|
6991
|
+
// case WorkspacePresetAction.SAVE: {
|
|
6992
|
+
// break;
|
|
6993
|
+
// }
|
|
6994
|
+
case WorkspacePresetAction.DELETE:
|
|
6995
|
+
{
|
|
6996
|
+
setWorkspaceActionDialogOptions({
|
|
6997
|
+
action: workspaceAction,
|
|
6998
|
+
presetId: presetId,
|
|
6999
|
+
formValues: {
|
|
7000
|
+
title: presetTitle,
|
|
7001
|
+
scope: scope
|
|
7002
|
+
}
|
|
7003
|
+
});
|
|
7004
|
+
break;
|
|
7005
|
+
}
|
|
7006
|
+
case WorkspacePresetAction.DELETE_SYSTEM_PRESET:
|
|
7007
|
+
{
|
|
7008
|
+
setWorkspaceActionDialogOptions({
|
|
7009
|
+
action: workspaceAction,
|
|
7010
|
+
presetId: presetId,
|
|
7011
|
+
formValues: {
|
|
7012
|
+
title: presetTitle,
|
|
7013
|
+
scope: scope
|
|
7014
|
+
}
|
|
7015
|
+
});
|
|
7016
|
+
break;
|
|
7017
|
+
}
|
|
7018
|
+
case WorkspacePresetAction.SHARE:
|
|
7019
|
+
{
|
|
7020
|
+
void getWorkspace(presetId, auth).then(function (preset) {
|
|
7021
|
+
return updateWorkspace(presetId, Object.assign({}, preset, {
|
|
7022
|
+
is_shared: !preset.is_shared
|
|
7023
|
+
}), auth).then(function () {
|
|
7024
|
+
dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
7025
|
+
workspaceId: presetId,
|
|
7026
|
+
action: WorkspacePresetAction.SHARE,
|
|
7027
|
+
title: presetTitle,
|
|
7028
|
+
scope: scope,
|
|
7029
|
+
is_shared: preset.is_shared
|
|
7030
|
+
}));
|
|
7031
|
+
fetchWorkspaceList();
|
|
7032
|
+
})["catch"](function (error) {
|
|
7033
|
+
dispatch(workspaceListActions.onErrorWorkspacePresetAction({
|
|
7034
|
+
error: {
|
|
7035
|
+
message: "" + error,
|
|
7036
|
+
type: WorkspaceListErrorType.VERBATIM_ERROR,
|
|
7037
|
+
category: WorkspaceListErrorCategory.GENERIC
|
|
7038
|
+
}
|
|
7039
|
+
}));
|
|
7040
|
+
});
|
|
7041
|
+
});
|
|
7042
|
+
break;
|
|
7043
|
+
}
|
|
7044
|
+
case WorkspacePresetAction.OPEN_TAB:
|
|
7045
|
+
{
|
|
7046
|
+
var url = getWorkspaceRouteUrl(presetId);
|
|
7047
|
+
window.open(url, '_blank');
|
|
7048
|
+
break;
|
|
7049
|
+
}
|
|
7050
|
+
}
|
|
7051
|
+
};
|
|
7052
|
+
var isAllSelected = workspaceListFilters.length > 0 && workspaceListFilters.every(function (filter) {
|
|
7053
|
+
return filter.isSelected;
|
|
7054
|
+
});
|
|
7055
|
+
var shouldHideNewWorkspace = !isAllSelected || workspaceSearchQuery.length > 0;
|
|
7056
|
+
return jsxs(Box, {
|
|
7057
|
+
"data-testid": "workspace-selectlist-connect",
|
|
7058
|
+
style: {
|
|
7059
|
+
display: 'flex',
|
|
7060
|
+
flexDirection: 'column',
|
|
7061
|
+
height: '100%'
|
|
7062
|
+
},
|
|
7063
|
+
tabIndex: 0,
|
|
7064
|
+
children: [isFetching && jsx(LinearProgress, {
|
|
7065
|
+
"data-testid": "loading-bar",
|
|
7066
|
+
color: "secondary",
|
|
7399
7067
|
sx: {
|
|
7400
|
-
|
|
7401
|
-
|
|
7068
|
+
position: 'absolute',
|
|
7069
|
+
width: '100%',
|
|
7070
|
+
top: 0,
|
|
7071
|
+
left: 0
|
|
7072
|
+
}
|
|
7073
|
+
}), error && jsx("div", {
|
|
7074
|
+
style: {
|
|
7075
|
+
whiteSpace: 'normal'
|
|
7402
7076
|
},
|
|
7403
|
-
children:
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7077
|
+
children: jsx(AlertBanner, Object.assign({
|
|
7078
|
+
title: (_GENERIC$AUTH$error$c = {
|
|
7079
|
+
GENERIC: '',
|
|
7080
|
+
AUTH: t('workspace-error-auth')
|
|
7081
|
+
}[error.category]) != null ? _GENERIC$AUTH$error$c : t('workspace-error-fetch'),
|
|
7082
|
+
info: error.type === WorkspaceListErrorType.TRANSLATABLE_ERROR ? t(error.key, error.params) : error.message,
|
|
7083
|
+
shouldClose: true
|
|
7084
|
+
}, error.category === WorkspaceListErrorCategory.GENERIC && {
|
|
7085
|
+
actionButtonProps: {
|
|
7086
|
+
title: t('workspace-retry'),
|
|
7087
|
+
onClick: function onClick() {
|
|
7088
|
+
return fetchWorkspaceList();
|
|
7089
|
+
}
|
|
7414
7090
|
}
|
|
7415
|
-
})
|
|
7416
|
-
}), jsxs(
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
fontWeight: 'bold'
|
|
7091
|
+
}))
|
|
7092
|
+
}), jsxs(Box, {
|
|
7093
|
+
sx: {
|
|
7094
|
+
display: 'flex',
|
|
7095
|
+
flexDirection: 'column',
|
|
7096
|
+
height: '100%',
|
|
7097
|
+
padding: 1,
|
|
7098
|
+
overflow: 'hidden'
|
|
7099
|
+
},
|
|
7100
|
+
children: [!error && jsxs(Box, {
|
|
7101
|
+
sx: {
|
|
7102
|
+
marginBottom: 1
|
|
7428
7103
|
},
|
|
7429
|
-
children: [
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7104
|
+
children: [jsx(Box, {
|
|
7105
|
+
sx: {
|
|
7106
|
+
display: 'flex',
|
|
7107
|
+
width: '100%'
|
|
7108
|
+
},
|
|
7109
|
+
children: jsx(Filter, {
|
|
7110
|
+
filters: workspaceListFilters,
|
|
7111
|
+
onClickFilterChip: onClickFilterChip,
|
|
7112
|
+
isAllSelected: isAllSelected,
|
|
7113
|
+
searchQuery: workspaceSearchQuery,
|
|
7114
|
+
onSearch: searchFilter
|
|
7115
|
+
})
|
|
7116
|
+
}), jsx(Box, {
|
|
7117
|
+
sx: {
|
|
7118
|
+
display: 'flex',
|
|
7119
|
+
justifyContent: 'flex-start'
|
|
7120
|
+
},
|
|
7121
|
+
children: jsx(LastUpdateTime, {
|
|
7122
|
+
onPressRefresh: function onPressRefresh() {
|
|
7123
|
+
return fetchWorkspaceList();
|
|
7438
7124
|
},
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
|
|
7447
|
-
|
|
7448
|
-
|
|
7449
|
-
|
|
7450
|
-
|
|
7451
|
-
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
'aria-labelledby': labelId
|
|
7457
|
-
}
|
|
7458
|
-
})
|
|
7459
|
-
}), jsx(ListItemText, {
|
|
7460
|
-
id: labelId,
|
|
7461
|
-
primary: (_viewsById$mapId = viewsById[mapId]) == null ? void 0 : _viewsById$mapId.title,
|
|
7462
|
-
secondary: mapId
|
|
7463
|
-
})]
|
|
7464
|
-
})
|
|
7465
|
-
}, mapId);
|
|
7125
|
+
hideLabel: true
|
|
7126
|
+
})
|
|
7127
|
+
})]
|
|
7128
|
+
}), jsx(Box, {
|
|
7129
|
+
sx: {
|
|
7130
|
+
flexGrow: 1,
|
|
7131
|
+
minHeight: 0
|
|
7132
|
+
},
|
|
7133
|
+
children: jsx(WorkspaceSelectList, {
|
|
7134
|
+
workspacePresets: filteredPresets,
|
|
7135
|
+
currentSelectedId: currentView.id || '',
|
|
7136
|
+
onClickWorkspacePreset: onClickWorkspacePreset,
|
|
7137
|
+
onClickWorkspacePresetOption: onClickWorkspacePresetOption,
|
|
7138
|
+
hideNewWorkspace: shouldHideNewWorkspace,
|
|
7139
|
+
isEditable: isLoggedIn,
|
|
7140
|
+
isAdmin: isAdmin,
|
|
7141
|
+
searchQuery: workspaceSearchQuery
|
|
7466
7142
|
})
|
|
7467
7143
|
})]
|
|
7468
7144
|
})]
|
|
7469
7145
|
});
|
|
7470
7146
|
};
|
|
7471
7147
|
|
|
7472
|
-
var
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
var WorkspaceControls = function WorkspaceControls(_ref) {
|
|
7477
|
-
var panelId = _ref.panelId,
|
|
7478
|
-
createNode = _ref.createNode,
|
|
7479
|
-
path = _ref.path,
|
|
7480
|
-
_ref$shouldPreventClo = _ref.shouldPreventCloseView,
|
|
7481
|
-
shouldPreventCloseView = _ref$shouldPreventClo === void 0 ? false : _ref$shouldPreventClo,
|
|
7482
|
-
removeLinkedMap = _ref.removeLinkedMap;
|
|
7483
|
-
var confirmDialog = useConfirmationDialog();
|
|
7484
|
-
var _React$useContext = React.useContext(MosaicContext),
|
|
7485
|
-
actions = _React$useContext.mosaicActions;
|
|
7148
|
+
var WorkspaceMenu = function WorkspaceMenu(_ref) {
|
|
7149
|
+
var _ref$isOpen = _ref.isOpen,
|
|
7150
|
+
isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
|
|
7151
|
+
closeMenu = _ref.closeMenu;
|
|
7486
7152
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7487
7153
|
t = _useWorkspaceTranslat.t;
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
setStateAfterExpand = _React$useState[1];
|
|
7494
|
-
var _React$useState2 = React.useState(mosaicNode),
|
|
7495
|
-
stateBeforeExpand = _React$useState2[0],
|
|
7496
|
-
setStateBeforeExpand = _React$useState2[1];
|
|
7497
|
-
var _React$useState3 = React.useState(false),
|
|
7498
|
-
enableUnexpand = _React$useState3[0],
|
|
7499
|
-
setEnableUnexpand = _React$useState3[1];
|
|
7500
|
-
React.useEffect(function () {
|
|
7501
|
-
if (enableUnexpand) {
|
|
7502
|
-
if (stateAfterExpand === undefined) {
|
|
7503
|
-
setStateAfterExpand(mosaicNode);
|
|
7504
|
-
return;
|
|
7505
|
-
}
|
|
7506
|
-
if (!isEqual(mosaicNode, stateAfterExpand)) {
|
|
7507
|
-
setEnableUnexpand(false);
|
|
7508
|
-
setStateAfterExpand(undefined);
|
|
7154
|
+
return jsx(CustomDialog, {
|
|
7155
|
+
open: isOpen,
|
|
7156
|
+
onClose: function onClose() {
|
|
7157
|
+
if (closeMenu) {
|
|
7158
|
+
closeMenu();
|
|
7509
7159
|
}
|
|
7510
|
-
}
|
|
7511
|
-
|
|
7512
|
-
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
_context.next = 3;
|
|
7522
|
-
return confirmDialog({
|
|
7523
|
-
title: t('workspace-control-close-message-title'),
|
|
7524
|
-
description: t('workspace-control-close-message-description'),
|
|
7525
|
-
confirmLabel: t('workspace-control-close')
|
|
7526
|
-
});
|
|
7527
|
-
case 3:
|
|
7528
|
-
actions.remove(path);
|
|
7529
|
-
removeLinkedMap(panelId);
|
|
7530
|
-
_context.next = 9;
|
|
7531
|
-
break;
|
|
7532
|
-
case 7:
|
|
7533
|
-
actions.remove(path);
|
|
7534
|
-
removeLinkedMap(panelId);
|
|
7535
|
-
case 9:
|
|
7536
|
-
case "end":
|
|
7537
|
-
return _context.stop();
|
|
7160
|
+
},
|
|
7161
|
+
isResizable: true,
|
|
7162
|
+
hasLayout: false,
|
|
7163
|
+
resizableDefaultSize: {
|
|
7164
|
+
width: 380,
|
|
7165
|
+
height: '90%'
|
|
7166
|
+
},
|
|
7167
|
+
slotProps: {
|
|
7168
|
+
backdrop: {
|
|
7169
|
+
style: {
|
|
7170
|
+
top: 40
|
|
7538
7171
|
}
|
|
7539
|
-
}, _callee);
|
|
7540
|
-
}));
|
|
7541
|
-
return function onClose() {
|
|
7542
|
-
return _ref2.apply(this, arguments);
|
|
7543
|
-
};
|
|
7544
|
-
}();
|
|
7545
|
-
return jsxs(Fragment, {
|
|
7546
|
-
children: [jsx(LinkMenuConnect, {
|
|
7547
|
-
panelId: panelId
|
|
7548
|
-
}), jsx(CustomIconButton, {
|
|
7549
|
-
"data-testid": "split-horizontal-btn",
|
|
7550
|
-
sx: buttonStyle,
|
|
7551
|
-
onClick: function onClick() {
|
|
7552
|
-
var newNode = createNode();
|
|
7553
|
-
var previousNode = getAndAssertNodeAtPathExists(actions.getRoot(), path);
|
|
7554
|
-
actions.replaceWith(path, {
|
|
7555
|
-
direction: 'column',
|
|
7556
|
-
first: previousNode,
|
|
7557
|
-
second: newNode
|
|
7558
|
-
});
|
|
7559
7172
|
},
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7173
|
+
root: {
|
|
7174
|
+
style: {
|
|
7175
|
+
top: 40
|
|
7176
|
+
}
|
|
7177
|
+
}
|
|
7178
|
+
},
|
|
7179
|
+
"data-testid": "workspace-menu",
|
|
7180
|
+
children: jsx(ToolContainer, {
|
|
7181
|
+
title: t('workspace-menu'),
|
|
7182
|
+
onClose: closeMenu,
|
|
7183
|
+
style: {
|
|
7184
|
+
width: '100%',
|
|
7185
|
+
height: '100%'
|
|
7573
7186
|
},
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
}), !enableUnexpand || isString(mosaicNode) ? jsx(CustomIconButton, {
|
|
7577
|
-
"data-testid": "expand-btn",
|
|
7578
|
-
sx: buttonStyle,
|
|
7579
|
-
onClick: function onClick() {
|
|
7580
|
-
setStateBeforeExpand(mosaicNode);
|
|
7581
|
-
setEnableUnexpand(true);
|
|
7582
|
-
actions.expand(path, 70);
|
|
7187
|
+
onClick: function onClick(event) {
|
|
7188
|
+
event.stopPropagation();
|
|
7583
7189
|
},
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
|
|
7190
|
+
children: jsx(WorkspaceSelectListConnect, {})
|
|
7191
|
+
})
|
|
7192
|
+
});
|
|
7193
|
+
};
|
|
7194
|
+
|
|
7195
|
+
var workspacePresetOptionId = 'workspaceMenuButton';
|
|
7196
|
+
var viewPresetOptionId = 'viewpreset-options-toolbutton';
|
|
7197
|
+
var WorkspaceMenuButton = function WorkspaceMenuButton(_ref) {
|
|
7198
|
+
var title = _ref.title,
|
|
7199
|
+
activeTab = _ref.activeTab,
|
|
7200
|
+
_ref$hasChanges = _ref.hasChanges,
|
|
7201
|
+
hasChanges = _ref$hasChanges === void 0 ? false : _ref$hasChanges,
|
|
7202
|
+
_ref$id = _ref.id,
|
|
7203
|
+
id = _ref$id === void 0 ? workspacePresetOptionId : _ref$id,
|
|
7204
|
+
_ref$showMenu = _ref.showMenu,
|
|
7205
|
+
showMenu = _ref$showMenu === void 0 ? false : _ref$showMenu,
|
|
7206
|
+
onToggleDialog = _ref.onToggleDialog;
|
|
7207
|
+
var handleClick = function handleClick() {
|
|
7208
|
+
if (onToggleDialog) {
|
|
7209
|
+
onToggleDialog(!showMenu);
|
|
7210
|
+
}
|
|
7211
|
+
};
|
|
7212
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7213
|
+
t = _useWorkspaceTranslat.t;
|
|
7214
|
+
return jsxs(Box, {
|
|
7215
|
+
sx: {
|
|
7216
|
+
display: 'flex',
|
|
7217
|
+
alignItems: 'center',
|
|
7218
|
+
flexGrow: 1,
|
|
7219
|
+
minWidth: 0
|
|
7220
|
+
},
|
|
7221
|
+
children: [jsx(CustomTooltip, {
|
|
7222
|
+
title: !showMenu && jsxs(Fragment, {
|
|
7223
|
+
children: [jsx(Box, {
|
|
7224
|
+
component: "span",
|
|
7225
|
+
sx: {
|
|
7226
|
+
fontWeight: 'bold',
|
|
7227
|
+
display: 'block'
|
|
7228
|
+
},
|
|
7229
|
+
children: t('workspace-menu')
|
|
7230
|
+
}), jsx(Box, {
|
|
7231
|
+
component: "span",
|
|
7232
|
+
children: t('workspace-currently') + ": " + title
|
|
7233
|
+
})]
|
|
7234
|
+
}),
|
|
7235
|
+
slotProps: {
|
|
7236
|
+
transition: {
|
|
7237
|
+
exit: false
|
|
7238
|
+
}
|
|
7592
7239
|
},
|
|
7593
|
-
|
|
7594
|
-
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7240
|
+
children: jsx(CustomToggleButton, {
|
|
7241
|
+
variant: "tool",
|
|
7242
|
+
selected: showMenu,
|
|
7243
|
+
onClick: handleClick,
|
|
7244
|
+
"data-testid": id,
|
|
7245
|
+
"aria-label": "workspace menu",
|
|
7246
|
+
disableRipple: true,
|
|
7247
|
+
sx: {
|
|
7248
|
+
flexGrow: 1,
|
|
7249
|
+
// expand across the row
|
|
7250
|
+
flexShrink: 1,
|
|
7251
|
+
minWidth: 0,
|
|
7252
|
+
justifyContent: 'flex-start',
|
|
7253
|
+
alignItems: 'center',
|
|
7254
|
+
textAlign: 'left',
|
|
7255
|
+
fontSize: '12px',
|
|
7256
|
+
fontWeight: 500,
|
|
7257
|
+
fontStyle: hasChanges ? 'italic' : undefined,
|
|
7258
|
+
height: 20,
|
|
7259
|
+
maxHeight: 20,
|
|
7260
|
+
overflow: 'hidden',
|
|
7261
|
+
'&&': {
|
|
7262
|
+
color: activeTab && !showMenu ? 'geowebColors.buttons.icon.active.color' : 'geowebColors.buttons.icon.active.color',
|
|
7263
|
+
textTransform: 'none',
|
|
7264
|
+
backgroundColor: !showMenu ? 'transparent' : 'geowebColors.workspace.tabButtonHover',
|
|
7265
|
+
'&:hover': {
|
|
7266
|
+
backgroundColor: 'geowebColors.workspace.tabButtonHover',
|
|
7267
|
+
color: activeTab && showMenu ? 'white' : 'geowebColors.buttons.icon.active.color'
|
|
7268
|
+
}
|
|
7269
|
+
}
|
|
7270
|
+
},
|
|
7271
|
+
children: jsx(Box, {
|
|
7272
|
+
component: "span",
|
|
7273
|
+
sx: {
|
|
7274
|
+
flexGrow: 1,
|
|
7275
|
+
flexShrink: 1,
|
|
7276
|
+
minWidth: 0,
|
|
7277
|
+
overflow: 'hidden',
|
|
7278
|
+
textOverflow: 'ellipsis',
|
|
7279
|
+
whiteSpace: 'nowrap'
|
|
7280
|
+
},
|
|
7281
|
+
children: title
|
|
7282
|
+
})
|
|
7283
|
+
})
|
|
7284
|
+
}), jsx(WorkspaceMenu, {
|
|
7285
|
+
isOpen: showMenu,
|
|
7286
|
+
closeMenu: function closeMenu() {
|
|
7287
|
+
return onToggleDialog == null ? void 0 : onToggleDialog(false);
|
|
7288
|
+
}
|
|
7602
7289
|
})]
|
|
7603
7290
|
});
|
|
7604
7291
|
};
|
|
7605
7292
|
|
|
7606
|
-
var
|
|
7607
|
-
var
|
|
7608
|
-
|
|
7609
|
-
|
|
7610
|
-
componentsLookUp = _ref.componentsLookUp;
|
|
7611
|
-
var dispatch = useDispatch();
|
|
7612
|
-
useFetchViewPresets(mosaicNodeId);
|
|
7613
|
-
var view = useSelector(function (store) {
|
|
7614
|
-
return getViewById(store, mosaicNodeId);
|
|
7293
|
+
var LoadingIndicatorConnect = function LoadingIndicatorConnect(_ref) {
|
|
7294
|
+
var panelId = _ref.panelId;
|
|
7295
|
+
var isLoading = useSelector(function (store) {
|
|
7296
|
+
return loadingIndicatorSelectors.isLoading(store, panelId);
|
|
7615
7297
|
});
|
|
7616
|
-
var
|
|
7617
|
-
return
|
|
7298
|
+
var getMapLoadingPercentage = useSelector(function (store) {
|
|
7299
|
+
return loadingIndicatorSelectors.getMapLoadingPercentage(store, panelId);
|
|
7618
7300
|
});
|
|
7619
|
-
var
|
|
7620
|
-
|
|
7301
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7302
|
+
t = _useWorkspaceTranslat.t;
|
|
7303
|
+
return jsx(CustomTooltip, {
|
|
7304
|
+
title: isLoading ? t('workspace-loading-indicator-loading') : t('workspace-loading-indicator-idle'),
|
|
7305
|
+
children: jsxs("span", {
|
|
7306
|
+
style: {
|
|
7307
|
+
height: '100%'
|
|
7308
|
+
},
|
|
7309
|
+
children: [jsx("span", {
|
|
7310
|
+
style: {
|
|
7311
|
+
position: 'relative',
|
|
7312
|
+
zIndex: 2
|
|
7313
|
+
},
|
|
7314
|
+
children: isLoading ? jsx(CloudLoading, {
|
|
7315
|
+
"data-testid": "cloudicon-loading",
|
|
7316
|
+
style: {
|
|
7317
|
+
fill: '#186DFF'
|
|
7318
|
+
}
|
|
7319
|
+
}) : jsx(CloudIdle, {
|
|
7320
|
+
"data-testid": "cloudicon-idle"
|
|
7321
|
+
})
|
|
7322
|
+
}), getMapLoadingPercentage !== 100 && jsx(LoadingIndicatorProgressBar, {
|
|
7323
|
+
progressPercentage: getMapLoadingPercentage
|
|
7324
|
+
})]
|
|
7325
|
+
})
|
|
7621
7326
|
});
|
|
7622
|
-
|
|
7623
|
-
|
|
7327
|
+
};
|
|
7328
|
+
|
|
7329
|
+
var workspaceOptionsButtonId = 'workspace-options-toolbutton';
|
|
7330
|
+
var WorkspaceOptions = function WorkspaceOptions(_ref) {
|
|
7331
|
+
var _ref$id = _ref.id,
|
|
7332
|
+
id = _ref$id === void 0 ? workspaceOptionsButtonId : _ref$id,
|
|
7333
|
+
handleSave = _ref.handleSave,
|
|
7334
|
+
handleSaveAs = _ref.handleSaveAs,
|
|
7335
|
+
handleEdit = _ref.handleEdit,
|
|
7336
|
+
handleDelete = _ref.handleDelete,
|
|
7337
|
+
handleReset = _ref.handleReset,
|
|
7338
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
7339
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
7340
|
+
_ref$isDefaultOpen = _ref.isDefaultOpen,
|
|
7341
|
+
isDefaultOpen = _ref$isDefaultOpen === void 0 ? false : _ref$isDefaultOpen;
|
|
7342
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7343
|
+
t = _useWorkspaceTranslat.t;
|
|
7344
|
+
var theme = useTheme();
|
|
7345
|
+
var _React$useState = React__default.useState(null),
|
|
7346
|
+
anchorEl = _React$useState[0],
|
|
7347
|
+
setAnchorEl = _React$useState[1];
|
|
7348
|
+
var isOpen = Boolean(anchorEl) || isDefaultOpen;
|
|
7349
|
+
var handleClick = function handleClick(event) {
|
|
7350
|
+
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
7351
|
+
};
|
|
7352
|
+
var options = [{
|
|
7353
|
+
title: t('workspace-save'),
|
|
7354
|
+
callback: handleSave
|
|
7355
|
+
}, {
|
|
7356
|
+
title: t('workspace-save-as'),
|
|
7357
|
+
callback: handleSaveAs
|
|
7358
|
+
}, {
|
|
7359
|
+
title: t('workspace-edit'),
|
|
7360
|
+
callback: handleEdit
|
|
7361
|
+
}, {
|
|
7362
|
+
title: t('workspace-reset'),
|
|
7363
|
+
callback: handleReset
|
|
7364
|
+
}, {
|
|
7365
|
+
title: t('workspace-delete'),
|
|
7366
|
+
callback: handleDelete
|
|
7367
|
+
}];
|
|
7368
|
+
var renderButton = function renderButton() {
|
|
7369
|
+
return jsxs(CustomIconButton, {
|
|
7370
|
+
onClick: handleClick,
|
|
7371
|
+
"data-testid": id,
|
|
7372
|
+
isSelected: isOpen,
|
|
7373
|
+
"aria-label": "workspace options",
|
|
7374
|
+
variant: "tool",
|
|
7375
|
+
disabled: isDisabled,
|
|
7376
|
+
sx: {
|
|
7377
|
+
'&&': {
|
|
7378
|
+
backgroundColor: !isOpen ? 'transparent' : 'geowebColors.workspace.tabButtonHover',
|
|
7379
|
+
'&:hover': {
|
|
7380
|
+
backgroundColor: 'geowebColors.workspace.tabButtonHover'
|
|
7381
|
+
},
|
|
7382
|
+
'.MuiSvgIcon-root > path': {
|
|
7383
|
+
fill: isOpen ? theme.palette.geowebColors.iconButtons.tool.active.color : undefined
|
|
7384
|
+
}
|
|
7385
|
+
}
|
|
7386
|
+
},
|
|
7387
|
+
children: [jsx(Options, {}), jsxs(Menu, {
|
|
7388
|
+
slotProps: {
|
|
7389
|
+
backdrop: {
|
|
7390
|
+
style: {
|
|
7391
|
+
opacity: 0,
|
|
7392
|
+
transition: 'none'
|
|
7393
|
+
}
|
|
7394
|
+
}
|
|
7395
|
+
},
|
|
7396
|
+
open: isOpen && !isDisabled,
|
|
7397
|
+
anchorEl: anchorEl,
|
|
7398
|
+
onClose: function onClose() {
|
|
7399
|
+
return setAnchorEl(null);
|
|
7400
|
+
},
|
|
7401
|
+
anchorOrigin: {
|
|
7402
|
+
vertical: 21,
|
|
7403
|
+
horizontal: 6
|
|
7404
|
+
},
|
|
7405
|
+
sx: {
|
|
7406
|
+
'& .MuiMenu-list': {
|
|
7407
|
+
padding: 0
|
|
7408
|
+
},
|
|
7409
|
+
'& .MuiMenuItem-root': {
|
|
7410
|
+
fontSize: 16
|
|
7411
|
+
}
|
|
7412
|
+
},
|
|
7413
|
+
children: [jsx(ListSubheader, {
|
|
7414
|
+
sx: {
|
|
7415
|
+
paddingTop: '8px'
|
|
7416
|
+
},
|
|
7417
|
+
children: jsx(Typography, {
|
|
7418
|
+
sx: {
|
|
7419
|
+
letterSpacing: '0.4px',
|
|
7420
|
+
fontSize: 12
|
|
7421
|
+
},
|
|
7422
|
+
children: t('workspace-options')
|
|
7423
|
+
})
|
|
7424
|
+
}), options.map(function (_ref2) {
|
|
7425
|
+
var title = _ref2.title,
|
|
7426
|
+
callback = _ref2.callback;
|
|
7427
|
+
return jsx(MenuItem, {
|
|
7428
|
+
onClick: callback,
|
|
7429
|
+
disabled: !callback,
|
|
7430
|
+
children: title
|
|
7431
|
+
}, title);
|
|
7432
|
+
})]
|
|
7433
|
+
})]
|
|
7434
|
+
});
|
|
7435
|
+
};
|
|
7436
|
+
return isDisabled ? renderButton() : jsx(CustomTooltip, {
|
|
7437
|
+
title: !isOpen && t('workspace-options'),
|
|
7438
|
+
slotProps: {
|
|
7439
|
+
transition: {
|
|
7440
|
+
exit: false
|
|
7441
|
+
}
|
|
7442
|
+
},
|
|
7443
|
+
children: renderButton()
|
|
7624
7444
|
});
|
|
7625
|
-
|
|
7626
|
-
|
|
7445
|
+
};
|
|
7446
|
+
|
|
7447
|
+
var _excluded$4 = ["title", "scope"];
|
|
7448
|
+
var WorkspaceViewTitleConnectNoMemo = function WorkspaceViewTitleConnectNoMemo(_ref) {
|
|
7449
|
+
var panelId = _ref.panelId,
|
|
7450
|
+
isViewPresetDialogOpen = _ref.isViewPresetDialogOpen;
|
|
7451
|
+
var dispatch = useDispatch();
|
|
7452
|
+
var store = useStore();
|
|
7453
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7454
|
+
t = _useWorkspaceTranslat.t;
|
|
7455
|
+
var _useAuthenticationCon = useAuthenticationContext(),
|
|
7456
|
+
currentRole = _useAuthenticationCon.currentRole,
|
|
7457
|
+
isLoggedIn = _useAuthenticationCon.isLoggedIn,
|
|
7458
|
+
auth = _useAuthenticationCon.auth;
|
|
7459
|
+
var isAdmin = (currentRole == null ? void 0 : currentRole.name) === GEOWEB_ROLE_PRESETS_ADMIN.name;
|
|
7460
|
+
var workspaceView = useSelector(function (store) {
|
|
7461
|
+
var _workspaceSelectors$g;
|
|
7462
|
+
var _ref2 = (_workspaceSelectors$g = getViewById(store, panelId)) != null ? _workspaceSelectors$g : {},
|
|
7463
|
+
title = _ref2.title,
|
|
7464
|
+
scope = _ref2.scope,
|
|
7465
|
+
restProps = _objectWithoutPropertiesLoose(_ref2, _excluded$4);
|
|
7466
|
+
return Object.assign({
|
|
7467
|
+
title: title,
|
|
7468
|
+
scope: scope
|
|
7469
|
+
}, restProps);
|
|
7470
|
+
}, shallowEqual);
|
|
7471
|
+
var viewComponentType = useSelector(function (store) {
|
|
7472
|
+
return getViewComponentType(store, panelId);
|
|
7627
7473
|
});
|
|
7628
|
-
var
|
|
7629
|
-
return
|
|
7474
|
+
var hasViewPresetChanges = useSelector(function (store) {
|
|
7475
|
+
return getViewPresetHasChanges(store, panelId);
|
|
7630
7476
|
});
|
|
7631
|
-
var
|
|
7632
|
-
|
|
7633
|
-
}
|
|
7634
|
-
var
|
|
7635
|
-
|
|
7636
|
-
|
|
7637
|
-
|
|
7638
|
-
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7642
|
-
var
|
|
7643
|
-
|
|
7644
|
-
|
|
7645
|
-
|
|
7477
|
+
var activeViewPresetId = useSelector(function (store) {
|
|
7478
|
+
return getViewPresetActiveId(store, panelId);
|
|
7479
|
+
});
|
|
7480
|
+
var relatedSyncGroupIds = useSelector(function (store) {
|
|
7481
|
+
return syncGroupsSelectors.getAllTargetGroupsForSource(store, panelId);
|
|
7482
|
+
});
|
|
7483
|
+
var currentViewPreset = useSelector(function (store) {
|
|
7484
|
+
return workspaceView.id ? getViewPresetFromList(store, workspaceView.id) : undefined;
|
|
7485
|
+
});
|
|
7486
|
+
var presetAbstract = workspaceView == null ? void 0 : workspaceView["abstract"];
|
|
7487
|
+
var isNewActive = activeViewPresetId === '';
|
|
7488
|
+
var title = workspaceView.title || t('workspace-mappreset-new');
|
|
7489
|
+
var viewScope = workspaceView.scope;
|
|
7490
|
+
var fullTitle = getPresetTitle(title, hasViewPresetChanges, isNewActive, t);
|
|
7491
|
+
var openViewPresetsDialog = React.useCallback(function (viewPresetDialogOptions) {
|
|
7492
|
+
dispatch(viewPresetActions.openViewPresetDialog({
|
|
7493
|
+
viewPresetDialog: viewPresetDialogOptions
|
|
7646
7494
|
}));
|
|
7647
7495
|
}, [dispatch]);
|
|
7648
|
-
var
|
|
7649
|
-
|
|
7650
|
-
}
|
|
7651
|
-
var
|
|
7652
|
-
|
|
7653
|
-
|
|
7654
|
-
|
|
7496
|
+
var currentWarningsPreset = useSelector(function (store) {
|
|
7497
|
+
return publicWarningsSelectors.getWarningsPresetById(store, panelId);
|
|
7498
|
+
});
|
|
7499
|
+
var constructInitialProps = React.useCallback(function () {
|
|
7500
|
+
switch (viewComponentType) {
|
|
7501
|
+
case 'WarningList':
|
|
7502
|
+
return currentWarningsPreset;
|
|
7503
|
+
case 'TimeSeries':
|
|
7504
|
+
return timeSeriesSelectors.getTimeSeriesPreset(store.getState());
|
|
7505
|
+
case 'Map':
|
|
7506
|
+
return {
|
|
7507
|
+
mapPreset: mapSelectors.getMapPreset(store.getState(), panelId),
|
|
7508
|
+
syncGroupsIds: relatedSyncGroupIds
|
|
7509
|
+
};
|
|
7510
|
+
default:
|
|
7511
|
+
return undefined;
|
|
7512
|
+
}
|
|
7513
|
+
}, [currentWarningsPreset, panelId, relatedSyncGroupIds, store, viewComponentType]);
|
|
7514
|
+
var onSave = React.useCallback(function () {
|
|
7515
|
+
dispatch(viewPresetActions.saveViewPreset({
|
|
7655
7516
|
panelId: panelId,
|
|
7656
|
-
|
|
7517
|
+
viewPresetId: activeViewPresetId,
|
|
7518
|
+
viewPreset: Object.assign({}, emptyViewPreset(viewComponentType), {
|
|
7519
|
+
title: title,
|
|
7520
|
+
initialProps: constructInitialProps()
|
|
7521
|
+
})
|
|
7657
7522
|
}));
|
|
7658
|
-
}, [dispatch]);
|
|
7659
|
-
var
|
|
7660
|
-
|
|
7661
|
-
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
|
|
7669
|
-
React.useEffect(function () {
|
|
7670
|
-
var viewPresetId = (view == null ? void 0 : view.id) || '';
|
|
7671
|
-
registerView({
|
|
7672
|
-
panelId: mosaicNodeId,
|
|
7673
|
-
mapPresetId: viewPresetId
|
|
7523
|
+
}, [activeViewPresetId, constructInitialProps, dispatch, panelId, title, viewComponentType]);
|
|
7524
|
+
var onDelete = React.useCallback(function () {
|
|
7525
|
+
openViewPresetsDialog({
|
|
7526
|
+
title: t('workspace-mappreset-dialog-title-delete'),
|
|
7527
|
+
action: PresetAction.DELETE,
|
|
7528
|
+
viewPresetId: activeViewPresetId,
|
|
7529
|
+
panelId: panelId,
|
|
7530
|
+
formValues: {
|
|
7531
|
+
title: title,
|
|
7532
|
+
"abstract": presetAbstract
|
|
7533
|
+
}
|
|
7674
7534
|
});
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7679
|
-
|
|
7680
|
-
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7685
|
-
|
|
7686
|
-
|
|
7687
|
-
|
|
7688
|
-
initialProps: view == null ? void 0 : view.initialProps
|
|
7535
|
+
}, [activeViewPresetId, openViewPresetsDialog, panelId, title, presetAbstract, t]);
|
|
7536
|
+
var onSaveAs = React.useCallback(function () {
|
|
7537
|
+
var formTitle = activeViewPresetId ? title : '';
|
|
7538
|
+
openViewPresetsDialog({
|
|
7539
|
+
title: t('workspace-mappreset-save-as'),
|
|
7540
|
+
action: PresetAction.SAVE_AS,
|
|
7541
|
+
viewPresetId: activeViewPresetId,
|
|
7542
|
+
panelId: panelId,
|
|
7543
|
+
formValues: {
|
|
7544
|
+
title: formTitle,
|
|
7545
|
+
initialProps: constructInitialProps(),
|
|
7546
|
+
"abstract": presetAbstract
|
|
7547
|
+
}
|
|
7689
7548
|
});
|
|
7690
|
-
}, [
|
|
7691
|
-
|
|
7692
|
-
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7696
|
-
|
|
7549
|
+
}, [activeViewPresetId, constructInitialProps, openViewPresetsDialog, panelId, t, title, presetAbstract]);
|
|
7550
|
+
var onEdit = React.useCallback(function () {
|
|
7551
|
+
var formTitle = activeViewPresetId ? title : '';
|
|
7552
|
+
openViewPresetsDialog({
|
|
7553
|
+
title: t('workspace-mappreset-dialog-title-edit'),
|
|
7554
|
+
action: PresetAction.EDIT,
|
|
7555
|
+
panelId: panelId,
|
|
7556
|
+
viewPresetId: activeViewPresetId,
|
|
7557
|
+
formValues: {
|
|
7558
|
+
title: formTitle,
|
|
7559
|
+
initialProps: constructInitialProps(),
|
|
7560
|
+
"abstract": presetAbstract
|
|
7561
|
+
}
|
|
7697
7562
|
});
|
|
7698
|
-
}, [
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
|
|
7706
|
-
|
|
7707
|
-
panelId: mosaicNodeId,
|
|
7708
|
-
createNode: createNode,
|
|
7709
|
-
path: path,
|
|
7710
|
-
shouldPreventCloseView: shouldPreventCloseView,
|
|
7711
|
-
removeLinkedMap: removeLinkedMap
|
|
7712
|
-
}),
|
|
7713
|
-
children: [isViewPresetsFetching && jsx(LinearProgress, {
|
|
7714
|
-
"data-testid": "loading-bar",
|
|
7715
|
-
color: "secondary",
|
|
7716
|
-
sx: {
|
|
7717
|
-
position: 'absolute',
|
|
7718
|
-
width: '100%',
|
|
7719
|
-
top: 0,
|
|
7720
|
-
zIndex: 1001
|
|
7563
|
+
}, [activeViewPresetId, constructInitialProps, openViewPresetsDialog, panelId, t, title, presetAbstract]);
|
|
7564
|
+
var onReset = React.useCallback(function () {
|
|
7565
|
+
openViewPresetsDialog({
|
|
7566
|
+
title: t('workspace-reset-title'),
|
|
7567
|
+
action: PresetAction.RESET,
|
|
7568
|
+
viewPresetId: activeViewPresetId,
|
|
7569
|
+
panelId: panelId,
|
|
7570
|
+
formValues: {
|
|
7571
|
+
title: title
|
|
7721
7572
|
}
|
|
7722
|
-
})
|
|
7573
|
+
});
|
|
7574
|
+
}, [activeViewPresetId, openViewPresetsDialog, panelId, t, title]);
|
|
7575
|
+
var toggleViewPresetDialog = React.useCallback(function (_ref3) {
|
|
7576
|
+
var panelId = _ref3.panelId,
|
|
7577
|
+
isViewPresetDialogOpen = _ref3.isViewPresetDialogOpen;
|
|
7578
|
+
dispatch(viewPresetActions.toggleViewPresetListDialog({
|
|
7579
|
+
panelId: panelId,
|
|
7580
|
+
isViewPresetListDialogOpen: isViewPresetDialogOpen
|
|
7581
|
+
}));
|
|
7582
|
+
}, [dispatch]);
|
|
7583
|
+
var onClickOpenViewPreset = React.useCallback(function () {
|
|
7584
|
+
toggleViewPresetDialog({
|
|
7585
|
+
panelId: panelId,
|
|
7586
|
+
isViewPresetDialogOpen: !isViewPresetDialogOpen
|
|
7587
|
+
});
|
|
7588
|
+
}, [isViewPresetDialogOpen, panelId, toggleViewPresetDialog]);
|
|
7589
|
+
renderCounter.count(WorkspaceViewTitleConnectNoMemo.name);
|
|
7590
|
+
var viewpresetCreator = (currentViewPreset == null ? void 0 : currentViewPreset.username) || '';
|
|
7591
|
+
var isUserPresetCreator = (auth == null ? void 0 : auth.username) === viewpresetCreator;
|
|
7592
|
+
var currentViewScope = viewScope || 'system';
|
|
7593
|
+
var isEnabled = (currentViewScope === 'user' && isUserPresetCreator || isAdmin && currentViewScope === 'system') && activeViewPresetId !== '' && isLoggedIn;
|
|
7594
|
+
return (
|
|
7595
|
+
// Zero-length string assignment prevents showing title as an empty object '[object Object]'.
|
|
7596
|
+
// in child components. This is a workaround for a limitation in the Tooltip component.
|
|
7597
|
+
jsxs(Grid, {
|
|
7598
|
+
title: "",
|
|
7723
7599
|
sx: {
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
children: jsx(AlertBanner, {
|
|
7730
|
-
title: errorViewPreset,
|
|
7731
|
-
shouldClose: true
|
|
7732
|
-
})
|
|
7733
|
-
}), defaultComponentsLookupResult, genericComponentsLookupResult, jsx(ViewPresetMenu, {
|
|
7734
|
-
panelId: mosaicNodeId,
|
|
7735
|
-
closeMenu: function closeMenu() {
|
|
7736
|
-
toggleViewPresetDialog({
|
|
7737
|
-
panelId: mosaicNodeId,
|
|
7738
|
-
isViewPresetDialogOpen: false
|
|
7739
|
-
});
|
|
7600
|
+
display: 'flex',
|
|
7601
|
+
flexGrow: 3,
|
|
7602
|
+
flexDirection: 'row',
|
|
7603
|
+
alignItems: 'center',
|
|
7604
|
+
justifyContent: 'space-between'
|
|
7740
7605
|
},
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7606
|
+
children: [jsxs(Box, {
|
|
7607
|
+
sx: {
|
|
7608
|
+
display: 'flex',
|
|
7609
|
+
alignItems: 'center',
|
|
7610
|
+
flexGrow: 1,
|
|
7611
|
+
minWidth: 0,
|
|
7612
|
+
gap: 1
|
|
7613
|
+
},
|
|
7614
|
+
children: [jsx(CustomTooltip, {
|
|
7615
|
+
title: !isViewPresetDialogOpen && jsxs(Fragment, {
|
|
7616
|
+
children: [jsx(Box, {
|
|
7617
|
+
component: "span",
|
|
7618
|
+
sx: {
|
|
7619
|
+
fontWeight: 'bold',
|
|
7620
|
+
display: 'block'
|
|
7621
|
+
},
|
|
7622
|
+
children: t('workspace-viewpreset-menu')
|
|
7623
|
+
}), jsx(Box, {
|
|
7624
|
+
component: "span",
|
|
7625
|
+
children: t('workspace-currently') + ": " + title
|
|
7626
|
+
})]
|
|
7627
|
+
}),
|
|
7628
|
+
slotProps: {
|
|
7629
|
+
transition: {
|
|
7630
|
+
exit: false
|
|
7631
|
+
}
|
|
7632
|
+
},
|
|
7633
|
+
children: jsxs(CustomToggleButton, {
|
|
7634
|
+
variant: "tool",
|
|
7635
|
+
"data-testid": "open-viewpresets",
|
|
7636
|
+
selected: isViewPresetDialogOpen,
|
|
7637
|
+
onClick: onClickOpenViewPreset,
|
|
7638
|
+
disableRipple: true,
|
|
7639
|
+
sx: {
|
|
7640
|
+
flexShrink: 1,
|
|
7641
|
+
minWidth: 0,
|
|
7642
|
+
maxWidth: 220,
|
|
7643
|
+
justifyContent: 'flex-start',
|
|
7644
|
+
alignItems: 'center',
|
|
7645
|
+
textAlign: 'left',
|
|
7646
|
+
fontSize: '12px',
|
|
7647
|
+
fontWeight: 500,
|
|
7648
|
+
fontStyle: hasViewPresetChanges || isNewActive ? 'italic' : undefined,
|
|
7649
|
+
height: 20,
|
|
7650
|
+
overflow: 'hidden',
|
|
7651
|
+
'&&': {
|
|
7652
|
+
textTransform: 'none',
|
|
7653
|
+
backgroundColor: !isViewPresetDialogOpen ? 'transparent' : 'geowebColors.workspace.tabButtonHover',
|
|
7654
|
+
'&:hover': {
|
|
7655
|
+
backgroundColor: 'geowebColors.workspace.tabButtonHover'
|
|
7656
|
+
}
|
|
7657
|
+
}
|
|
7658
|
+
},
|
|
7659
|
+
children: [jsx(Box, {
|
|
7660
|
+
component: "span",
|
|
7661
|
+
sx: {
|
|
7662
|
+
flexGrow: 1,
|
|
7663
|
+
flexShrink: 1,
|
|
7664
|
+
minWidth: 0,
|
|
7665
|
+
overflow: 'hidden',
|
|
7666
|
+
textOverflow: 'ellipsis',
|
|
7667
|
+
whiteSpace: 'nowrap',
|
|
7668
|
+
paddingRight: '2px'
|
|
7669
|
+
},
|
|
7670
|
+
children: fullTitle
|
|
7671
|
+
}), panelId && jsx(Box, {
|
|
7672
|
+
component: "span",
|
|
7673
|
+
sx: {
|
|
7674
|
+
flexShrink: 0,
|
|
7675
|
+
ml: 1,
|
|
7676
|
+
fontStyle: 'normal',
|
|
7677
|
+
fontWeight: 400,
|
|
7678
|
+
whiteSpace: 'nowrap',
|
|
7679
|
+
color: isViewPresetDialogOpen ? 'geowebColors.text.inverse' : 'geowebColors.captions.captionStatus.rgba'
|
|
7680
|
+
},
|
|
7681
|
+
children: panelId
|
|
7682
|
+
})]
|
|
7683
|
+
})
|
|
7684
|
+
}), jsx(WorkspaceOptions, {
|
|
7685
|
+
handleSave: isEnabled ? onSave : undefined,
|
|
7686
|
+
handleDelete: isEnabled ? onDelete : undefined,
|
|
7687
|
+
handleSaveAs: isLoggedIn ? onSaveAs : undefined,
|
|
7688
|
+
handleEdit: isEnabled ? onEdit : undefined,
|
|
7689
|
+
handleReset: onReset,
|
|
7690
|
+
id: viewPresetOptionId
|
|
7691
|
+
})]
|
|
7692
|
+
}), jsx(Box, {
|
|
7693
|
+
sx: {
|
|
7694
|
+
display: 'flex',
|
|
7695
|
+
alignItems: 'center',
|
|
7696
|
+
pt: 0.72
|
|
7697
|
+
},
|
|
7698
|
+
children: jsx(LoadingIndicatorConnect, {
|
|
7699
|
+
panelId: panelId
|
|
7700
|
+
})
|
|
7701
|
+
})]
|
|
7702
|
+
})
|
|
7703
|
+
);
|
|
7704
|
+
};
|
|
7705
|
+
var WorkspaceViewTitleConnect = /*#__PURE__*/React.memo(WorkspaceViewTitleConnectNoMemo);
|
|
7745
7706
|
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7707
|
+
/* *
|
|
7708
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7709
|
+
* you may not use this file except in compliance with the License.
|
|
7710
|
+
* You may obtain a copy of the License at
|
|
7711
|
+
*
|
|
7712
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7713
|
+
*
|
|
7714
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7715
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7716
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7717
|
+
* See the License for the specific language governing permissions and
|
|
7718
|
+
* limitations under the License.
|
|
7719
|
+
*
|
|
7720
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
7721
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
7722
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
7723
|
+
* */
|
|
7724
|
+
var getUniqueId = function getUniqueId(existingIds, count) {
|
|
7725
|
+
if (count === void 0) {
|
|
7726
|
+
count = 1;
|
|
7727
|
+
}
|
|
7728
|
+
var newId = count + "_screen";
|
|
7729
|
+
if (existingIds.indexOf(newId) !== -1) {
|
|
7730
|
+
return getUniqueId(existingIds, count + 1);
|
|
7731
|
+
}
|
|
7732
|
+
return newId;
|
|
7733
|
+
};
|
|
7734
|
+
var createBalancedMosaicNode = function createBalancedMosaicNode(currentNode) {
|
|
7735
|
+
var leaves = getLeaves(currentNode);
|
|
7736
|
+
return createBalancedTreeFromLeaves(leaves);
|
|
7737
|
+
};
|
|
7738
|
+
var closeDialogsWhenChangingPreset = function closeDialogsWhenChangingPreset(componentTypes, dispatch) {
|
|
7739
|
+
if (!componentTypes || componentTypes.length === 0 || componentTypes.some(function (componentType) {
|
|
7740
|
+
return componentType.toLowerCase().includes('viewloading');
|
|
7741
|
+
})) {
|
|
7742
|
+
return;
|
|
7743
|
+
}
|
|
7744
|
+
// Close all dialogs related to timeseries
|
|
7745
|
+
if (!componentTypes.some(function (componentType) {
|
|
7746
|
+
return componentType.toLowerCase().includes('timeseries');
|
|
7747
|
+
})) {
|
|
7748
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
7749
|
+
setOpen: false,
|
|
7750
|
+
type: uiTypes.DialogTypes.TimeSeriesManager
|
|
7751
|
+
}));
|
|
7752
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
7753
|
+
setOpen: false,
|
|
7754
|
+
type: uiTypes.DialogTypes.TimeSeriesSelect
|
|
7755
|
+
}));
|
|
7756
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
7757
|
+
setOpen: false,
|
|
7758
|
+
type: uiTypes.DialogTypes.TimeSeriesInfo
|
|
7759
|
+
}));
|
|
7760
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
7761
|
+
setOpen: false,
|
|
7762
|
+
type: uiTypes.DialogTypes.TimeSeriesLocationInfo
|
|
7763
|
+
}));
|
|
7764
|
+
}
|
|
7765
|
+
// Close all dialogs related to soundings
|
|
7766
|
+
if (!componentTypes.some(function (componentType) {
|
|
7767
|
+
return componentType.toLowerCase().includes('soundings');
|
|
7768
|
+
})) {
|
|
7769
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
7770
|
+
setOpen: false,
|
|
7771
|
+
type: uiTypes.DialogTypes.SoundingsLocations
|
|
7772
|
+
}));
|
|
7773
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
7774
|
+
setOpen: false,
|
|
7775
|
+
type: uiTypes.DialogTypes.SoundingsSources
|
|
7776
|
+
}));
|
|
7777
|
+
}
|
|
7778
|
+
// Close dialogs related to the warninglist
|
|
7779
|
+
if (!componentTypes.some(function (componentType) {
|
|
7780
|
+
return componentType.toLowerCase().includes('warninglist');
|
|
7781
|
+
}) && !componentTypes.some(function (componentType) {
|
|
7782
|
+
return componentType.toLowerCase().includes('map');
|
|
7783
|
+
})) {
|
|
7784
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
7785
|
+
setOpen: false,
|
|
7786
|
+
type: uiTypes.DialogTypes.PublicWarnings
|
|
7787
|
+
}));
|
|
7788
|
+
}
|
|
7789
|
+
};
|
|
7790
|
+
|
|
7791
|
+
var LinkMenuConnect = function LinkMenuConnect(_ref) {
|
|
7792
|
+
var panelId = _ref.panelId;
|
|
7793
|
+
var dispatch = useDispatch();
|
|
7754
7794
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7755
7795
|
t = _useWorkspaceTranslat.t;
|
|
7756
|
-
var
|
|
7757
|
-
|
|
7758
|
-
|
|
7759
|
-
|
|
7760
|
-
|
|
7761
|
-
justifyContent: 'center',
|
|
7762
|
-
alignItems: 'center',
|
|
7763
|
-
height: '100%'
|
|
7764
|
-
},
|
|
7765
|
-
children: [jsx(WebAssetOff, {
|
|
7766
|
-
sx: {
|
|
7767
|
-
fontSize: '150px',
|
|
7768
|
-
margin: '20px'
|
|
7769
|
-
}
|
|
7770
|
-
}), jsx(Typography, {
|
|
7771
|
-
sx: {
|
|
7772
|
-
color: 'geowebColors.typographyAndIcons.text'
|
|
7773
|
-
},
|
|
7774
|
-
children: t('geoweb-welcome')
|
|
7775
|
-
})]
|
|
7796
|
+
var _React$useState = React__default.useState(null),
|
|
7797
|
+
anchorEl = _React$useState[0],
|
|
7798
|
+
setAnchorEl = _React$useState[1];
|
|
7799
|
+
var maps = useSelector(function (store) {
|
|
7800
|
+
return mapSelectors.getAllMapIds(store);
|
|
7776
7801
|
});
|
|
7777
|
-
|
|
7778
|
-
var
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
return
|
|
7802
|
+
var viewsById = useSelector(getViewsById);
|
|
7803
|
+
var selectedMapIds = useSelector(function (store) {
|
|
7804
|
+
return genericSelectors.getLinkedMaps(store, panelId);
|
|
7805
|
+
});
|
|
7806
|
+
var viewComponentType = useSelector(function (store) {
|
|
7807
|
+
return getViewComponentType(store, panelId);
|
|
7808
|
+
});
|
|
7809
|
+
var sharedFeature = useSelector(function (store) {
|
|
7810
|
+
return genericSelectors.getSelectedFeature(store.syncGroups, panelId);
|
|
7811
|
+
});
|
|
7812
|
+
var mapPinLocation = useSelector(function (store) {
|
|
7813
|
+
return mapSelectors.getPinLocation(store, selectedMapIds[0] || '');
|
|
7814
|
+
});
|
|
7815
|
+
var handleLinkViews = function handleLinkViews(event) {
|
|
7816
|
+
setAnchorEl(event.currentTarget);
|
|
7789
7817
|
};
|
|
7790
|
-
var
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7818
|
+
var handleMenuClose = function handleMenuClose() {
|
|
7819
|
+
setAnchorEl(null);
|
|
7820
|
+
};
|
|
7821
|
+
var handleMapSelect = function handleMapSelect(mapId) {
|
|
7822
|
+
var updatedMapIds = selectedMapIds.includes(mapId) ? selectedMapIds.filter(function (id) {
|
|
7823
|
+
return id !== mapId;
|
|
7824
|
+
}) : [].concat(selectedMapIds, [mapId]);
|
|
7825
|
+
dispatch(genericActions.updateLinkedMap({
|
|
7826
|
+
panelId: panelId,
|
|
7827
|
+
mapIds: updatedMapIds
|
|
7828
|
+
}));
|
|
7829
|
+
// Sync pin to newly added map for TimeSeries or Soundings components
|
|
7830
|
+
if (!selectedMapIds.includes(mapId) && (viewComponentType === 'TimeSeries' || viewComponentType === 'Soundings')) {
|
|
7831
|
+
// Observation station
|
|
7832
|
+
if (sharedFeature) {
|
|
7833
|
+
dispatch(mapActions.setMapPinLocation({
|
|
7834
|
+
mapId: mapId,
|
|
7835
|
+
mapPinLocation: {
|
|
7836
|
+
lon: sharedFeature.lon,
|
|
7837
|
+
lat: sharedFeature.lat
|
|
7838
|
+
}
|
|
7839
|
+
}));
|
|
7840
|
+
// Grid
|
|
7841
|
+
} else if (mapPinLocation) {
|
|
7842
|
+
dispatch(mapActions.setMapPinLocation({
|
|
7843
|
+
mapId: mapId,
|
|
7844
|
+
mapPinLocation: mapPinLocation
|
|
7845
|
+
}));
|
|
7846
|
+
}
|
|
7795
7847
|
}
|
|
7796
7848
|
};
|
|
7797
|
-
return
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7849
|
+
return jsxs(Fragment, {
|
|
7850
|
+
children: [linkComponentTypesConstants.supportedComponentTypesForLinking.includes(viewComponentType) && jsx(CustomIconButton, {
|
|
7851
|
+
onClick: handleLinkViews,
|
|
7852
|
+
"data-testid": "icon-button",
|
|
7853
|
+
tooltipTitle: "Link " + viewComponentType,
|
|
7854
|
+
sx: {
|
|
7855
|
+
marginLeft: 0.5,
|
|
7856
|
+
marginRight: 0.5
|
|
7804
7857
|
},
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7858
|
+
children: selectedMapIds.length > 0 ? jsx(Link, {
|
|
7859
|
+
"data-testid": "link-icon",
|
|
7860
|
+
style: {
|
|
7861
|
+
fill: anchorEl ? 'white' : undefined,
|
|
7862
|
+
backgroundColor: anchorEl ? '#186DFF' : undefined
|
|
7863
|
+
}
|
|
7864
|
+
}) : jsx(LinkOff, {
|
|
7865
|
+
"data-testid": "link-off-icon",
|
|
7866
|
+
style: {
|
|
7867
|
+
fill: anchorEl ? 'white' : undefined,
|
|
7868
|
+
backgroundColor: anchorEl ? '#186DFF' : undefined
|
|
7869
|
+
}
|
|
7870
|
+
})
|
|
7871
|
+
}), jsxs(Menu, {
|
|
7872
|
+
id: "map-select-menu",
|
|
7873
|
+
"data-testid": "map-select-menu",
|
|
7874
|
+
anchorEl: anchorEl,
|
|
7875
|
+
open: Boolean(anchorEl),
|
|
7876
|
+
onClose: handleMenuClose,
|
|
7877
|
+
keepMounted: true,
|
|
7878
|
+
children: [jsxs(Typography, {
|
|
7879
|
+
variant: "h6",
|
|
7880
|
+
style: {
|
|
7881
|
+
padding: '10px 15px 0',
|
|
7882
|
+
fontWeight: 'bold'
|
|
7883
|
+
},
|
|
7884
|
+
children: [t('workspace-link'), " - ", t('workspace-link-location-header')]
|
|
7885
|
+
}), jsx(List, {
|
|
7886
|
+
dense: true,
|
|
7887
|
+
children: maps.map(function (mapId) {
|
|
7888
|
+
var _viewsById$mapId;
|
|
7889
|
+
var labelId = "checkbox-link-label-" + mapId;
|
|
7890
|
+
return jsx(ListItem, {
|
|
7891
|
+
onClick: function onClick() {
|
|
7892
|
+
return handleMapSelect(mapId);
|
|
7893
|
+
},
|
|
7894
|
+
disablePadding: true,
|
|
7895
|
+
dense: true,
|
|
7896
|
+
divider: true,
|
|
7897
|
+
children: jsxs(ListItemButton, {
|
|
7898
|
+
role: "checkbox",
|
|
7899
|
+
dense: true,
|
|
7900
|
+
sx: {
|
|
7901
|
+
margin: 0,
|
|
7902
|
+
padding: '0 16px'
|
|
7834
7903
|
},
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7850
|
-
|
|
7851
|
-
|
|
7852
|
-
|
|
7853
|
-
|
|
7904
|
+
children: [jsx(ListItemIcon, {
|
|
7905
|
+
children: jsx(Checkbox, {
|
|
7906
|
+
edge: "start",
|
|
7907
|
+
tabIndex: -1,
|
|
7908
|
+
checked: selectedMapIds.includes(mapId),
|
|
7909
|
+
disableRipple: true,
|
|
7910
|
+
slotProps: {
|
|
7911
|
+
input: {
|
|
7912
|
+
'aria-labelledby': labelId
|
|
7913
|
+
}
|
|
7914
|
+
}
|
|
7915
|
+
})
|
|
7916
|
+
}), jsx(ListItemText, {
|
|
7917
|
+
id: labelId,
|
|
7918
|
+
primary: (_viewsById$mapId = viewsById[mapId]) == null ? void 0 : _viewsById$mapId.title,
|
|
7919
|
+
secondary: mapId
|
|
7920
|
+
})]
|
|
7921
|
+
})
|
|
7922
|
+
}, mapId);
|
|
7923
|
+
})
|
|
7924
|
+
})]
|
|
7925
|
+
})]
|
|
7854
7926
|
});
|
|
7855
7927
|
};
|
|
7856
|
-
var useControlActiveWindowId = function useControlActiveWindowId(screenConfig, activeWindowId, setActiveWindowId) {
|
|
7857
|
-
// When screenConfig.id changes it means a new preset was chosen.
|
|
7858
|
-
React.useEffect(function () {
|
|
7859
|
-
if (screenConfig.id !== '' && screenConfig.mosaicNode) {
|
|
7860
|
-
var mosaicNode = screenConfig.mosaicNode;
|
|
7861
|
-
while (!isString(mosaicNode)) {
|
|
7862
|
-
mosaicNode = mosaicNode.first;
|
|
7863
|
-
}
|
|
7864
|
-
setActiveWindowId(mosaicNode);
|
|
7865
|
-
}
|
|
7866
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7867
|
-
}, [screenConfig.id]);
|
|
7868
|
-
// If active window is no longer in screenConfig then set active window to first window
|
|
7869
|
-
React.useEffect(function () {
|
|
7870
|
-
var viewIds = screenConfig.views.allIds;
|
|
7871
|
-
if (activeWindowId !== undefined && viewIds && viewIds.length > 0 && !viewIds.includes(activeWindowId)) {
|
|
7872
|
-
setActiveWindowId(viewIds[0]);
|
|
7873
|
-
}
|
|
7874
|
-
}, [activeWindowId, screenConfig.views, screenConfig.views.allIds, setActiveWindowId]);
|
|
7875
|
-
};
|
|
7876
7928
|
|
|
7877
|
-
var
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
var
|
|
7892
|
-
|
|
7893
|
-
activeWindowId: activeWindowId
|
|
7894
|
-
}));
|
|
7895
|
-
}, [dispatch]);
|
|
7896
|
-
var activeWindowId = useSelector(uiSelectors.getActiveWindowId);
|
|
7929
|
+
var buttonStyle = {
|
|
7930
|
+
marginLeft: 0.5,
|
|
7931
|
+
marginRight: 0.5
|
|
7932
|
+
};
|
|
7933
|
+
var WorkspaceControls = function WorkspaceControls(_ref) {
|
|
7934
|
+
var panelId = _ref.panelId,
|
|
7935
|
+
createNode = _ref.createNode,
|
|
7936
|
+
path = _ref.path,
|
|
7937
|
+
_ref$shouldPreventClo = _ref.shouldPreventCloseView,
|
|
7938
|
+
shouldPreventCloseView = _ref$shouldPreventClo === void 0 ? false : _ref$shouldPreventClo,
|
|
7939
|
+
removeLinkedMap = _ref.removeLinkedMap;
|
|
7940
|
+
var confirmDialog = useConfirmationDialog();
|
|
7941
|
+
var _React$useContext = React.useContext(MosaicContext),
|
|
7942
|
+
actions = _React$useContext.mosaicActions;
|
|
7943
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7944
|
+
t = _useWorkspaceTranslat.t;
|
|
7897
7945
|
var mosaicNode = useSelector(function (store) {
|
|
7898
7946
|
return getMosaicNode(store);
|
|
7899
7947
|
});
|
|
7900
|
-
var
|
|
7901
|
-
|
|
7902
|
-
|
|
7948
|
+
var _React$useState = React.useState(),
|
|
7949
|
+
stateAfterExpand = _React$useState[0],
|
|
7950
|
+
setStateAfterExpand = _React$useState[1];
|
|
7951
|
+
var _React$useState2 = React.useState(mosaicNode),
|
|
7952
|
+
stateBeforeExpand = _React$useState2[0],
|
|
7953
|
+
setStateBeforeExpand = _React$useState2[1];
|
|
7954
|
+
var _React$useState3 = React.useState(false),
|
|
7955
|
+
enableUnexpand = _React$useState3[0],
|
|
7956
|
+
setEnableUnexpand = _React$useState3[1];
|
|
7957
|
+
React.useEffect(function () {
|
|
7958
|
+
if (enableUnexpand) {
|
|
7959
|
+
if (stateAfterExpand === undefined) {
|
|
7960
|
+
setStateAfterExpand(mosaicNode);
|
|
7961
|
+
return;
|
|
7962
|
+
}
|
|
7963
|
+
if (!isEqual(mosaicNode, stateAfterExpand)) {
|
|
7964
|
+
setEnableUnexpand(false);
|
|
7965
|
+
setStateAfterExpand(undefined);
|
|
7966
|
+
}
|
|
7967
|
+
}
|
|
7968
|
+
}, [enableUnexpand, mosaicNode, stateAfterExpand]);
|
|
7969
|
+
var onClose = /*#__PURE__*/function () {
|
|
7970
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
7971
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7972
|
+
while (1) switch (_context.prev = _context.next) {
|
|
7973
|
+
case 0:
|
|
7974
|
+
if (!shouldPreventCloseView) {
|
|
7975
|
+
_context.next = 7;
|
|
7976
|
+
break;
|
|
7977
|
+
}
|
|
7978
|
+
_context.next = 3;
|
|
7979
|
+
return confirmDialog({
|
|
7980
|
+
title: t('workspace-control-close-message-title'),
|
|
7981
|
+
description: t('workspace-control-close-message-description'),
|
|
7982
|
+
confirmLabel: t('workspace-control-close')
|
|
7983
|
+
});
|
|
7984
|
+
case 3:
|
|
7985
|
+
actions.remove(path);
|
|
7986
|
+
removeLinkedMap(panelId);
|
|
7987
|
+
_context.next = 9;
|
|
7988
|
+
break;
|
|
7989
|
+
case 7:
|
|
7990
|
+
actions.remove(path);
|
|
7991
|
+
removeLinkedMap(panelId);
|
|
7992
|
+
case 9:
|
|
7993
|
+
case "end":
|
|
7994
|
+
return _context.stop();
|
|
7995
|
+
}
|
|
7996
|
+
}, _callee);
|
|
7903
7997
|
}));
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
autoArrange();
|
|
7907
|
-
}, [autoArrange]);
|
|
7908
|
-
var componentTypes = useSelector(function (store) {
|
|
7909
|
-
return getComponentTypesFromActiveViews(store);
|
|
7910
|
-
});
|
|
7911
|
-
React__default.useEffect(function () {
|
|
7912
|
-
closeDialogsWhenChangingPreset(componentTypes, dispatch);
|
|
7913
|
-
}, [componentTypes, dispatch]);
|
|
7914
|
-
React__default.useEffect(function () {
|
|
7915
|
-
window.addEventListener('orientationchange', handleOrientationChange);
|
|
7916
|
-
return function () {
|
|
7917
|
-
return window.removeEventListener('orientationchange', handleOrientationChange);
|
|
7998
|
+
return function onClose() {
|
|
7999
|
+
return _ref2.apply(this, arguments);
|
|
7918
8000
|
};
|
|
7919
|
-
}
|
|
7920
|
-
return
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
|
|
7926
|
-
|
|
7927
|
-
|
|
7928
|
-
|
|
7929
|
-
|
|
7930
|
-
|
|
7931
|
-
|
|
7932
|
-
|
|
7933
|
-
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7946
|
-
|
|
7947
|
-
|
|
7948
|
-
|
|
7949
|
-
|
|
7950
|
-
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
8001
|
+
}();
|
|
8002
|
+
return jsxs(Fragment, {
|
|
8003
|
+
children: [jsx(LinkMenuConnect, {
|
|
8004
|
+
panelId: panelId
|
|
8005
|
+
}), jsx(CustomIconButton, {
|
|
8006
|
+
"data-testid": "split-horizontal-btn",
|
|
8007
|
+
sx: buttonStyle,
|
|
8008
|
+
onClick: function onClick() {
|
|
8009
|
+
var newNode = createNode();
|
|
8010
|
+
var previousNode = getAndAssertNodeAtPathExists(actions.getRoot(), path);
|
|
8011
|
+
actions.replaceWith(path, {
|
|
8012
|
+
direction: 'column',
|
|
8013
|
+
first: previousNode,
|
|
8014
|
+
second: newNode
|
|
8015
|
+
});
|
|
8016
|
+
},
|
|
8017
|
+
tooltipTitle: t('workspace-control-split-horizontal'),
|
|
8018
|
+
children: jsx(SplitVertical, {})
|
|
8019
|
+
}), jsx(CustomIconButton, {
|
|
8020
|
+
"data-testid": "split-vertical-btn",
|
|
8021
|
+
sx: buttonStyle,
|
|
8022
|
+
onClick: function onClick() {
|
|
8023
|
+
var newNode = createNode();
|
|
8024
|
+
var previousNode = getAndAssertNodeAtPathExists(actions.getRoot(), path);
|
|
8025
|
+
actions.replaceWith(path, {
|
|
8026
|
+
direction: 'row',
|
|
8027
|
+
first: previousNode,
|
|
8028
|
+
second: newNode
|
|
8029
|
+
});
|
|
8030
|
+
},
|
|
8031
|
+
tooltipTitle: t('workspace-control-split-vertical'),
|
|
8032
|
+
children: jsx(SplitHorizontal, {})
|
|
8033
|
+
}), !enableUnexpand || isString(mosaicNode) ? jsx(CustomIconButton, {
|
|
8034
|
+
"data-testid": "expand-btn",
|
|
8035
|
+
sx: buttonStyle,
|
|
8036
|
+
onClick: function onClick() {
|
|
8037
|
+
setStateBeforeExpand(mosaicNode);
|
|
8038
|
+
setEnableUnexpand(true);
|
|
8039
|
+
actions.expand(path, 70);
|
|
8040
|
+
},
|
|
8041
|
+
tooltipTitle: t('workspace-control-expand'),
|
|
8042
|
+
children: jsx(Expand, {})
|
|
8043
|
+
}) : jsx(CustomIconButton, {
|
|
8044
|
+
"data-testid": "unexpand-btn",
|
|
8045
|
+
sx: buttonStyle,
|
|
8046
|
+
onClick: function onClick() {
|
|
8047
|
+
var stateBeforeExpandCopy = isString(stateBeforeExpand) ? stateBeforeExpand : Object.assign({}, stateBeforeExpand);
|
|
8048
|
+
actions.replaceWith([], stateBeforeExpandCopy);
|
|
8049
|
+
},
|
|
8050
|
+
tooltipTitle: t('workspace-control-unexpand'),
|
|
8051
|
+
children: jsx(UnExpand, {})
|
|
8052
|
+
}), jsx(CustomIconButton, {
|
|
8053
|
+
"data-testid": "close-btn",
|
|
8054
|
+
sx: buttonStyle,
|
|
8055
|
+
onClick: onClose,
|
|
8056
|
+
tooltipTitle: t('workspace-control-close'),
|
|
8057
|
+
id: "close-window-button",
|
|
8058
|
+
children: jsx(Close, {})
|
|
8059
|
+
})]
|
|
8060
|
+
});
|
|
7973
8061
|
};
|
|
7974
8062
|
|
|
7975
|
-
var
|
|
7976
|
-
var
|
|
7977
|
-
|
|
7978
|
-
|
|
7979
|
-
|
|
7980
|
-
|
|
7981
|
-
|
|
7982
|
-
var
|
|
7983
|
-
|
|
7984
|
-
var workspacePresets = useSelector(function (store) {
|
|
7985
|
-
return getWorkspaceList(store);
|
|
8063
|
+
var WorkspaceTileConnect = /*#__PURE__*/React.memo(function (_ref) {
|
|
8064
|
+
var _ref$mosaicNodeId = _ref.mosaicNodeId,
|
|
8065
|
+
mosaicNodeId = _ref$mosaicNodeId === void 0 ? '' : _ref$mosaicNodeId,
|
|
8066
|
+
path = _ref.path,
|
|
8067
|
+
componentsLookUp = _ref.componentsLookUp;
|
|
8068
|
+
var dispatch = useDispatch();
|
|
8069
|
+
useFetchViewPresets(mosaicNodeId);
|
|
8070
|
+
var view = useSelector(function (store) {
|
|
8071
|
+
return getViewById(store, mosaicNodeId);
|
|
7986
8072
|
});
|
|
7987
|
-
var
|
|
7988
|
-
|
|
7989
|
-
return filterAndSortPresets(workspacePresets, selectedFilters, username, isAdmin);
|
|
7990
|
-
}, [workspacePresets, selectedFilters, username, isAdmin]);
|
|
7991
|
-
var currentView = useSelector(function (store) {
|
|
7992
|
-
return getWorkspaceState(store);
|
|
8073
|
+
var viewIds = useSelector(function (store) {
|
|
8074
|
+
return getViewIds(store);
|
|
7993
8075
|
});
|
|
7994
|
-
var
|
|
7995
|
-
return
|
|
8076
|
+
var shouldPreventCloseView = useSelector(function (store) {
|
|
8077
|
+
return getShouldPreventClose(store, mosaicNodeId);
|
|
7996
8078
|
});
|
|
7997
|
-
var
|
|
7998
|
-
return
|
|
8079
|
+
var isViewPresetDialogOpen = useSelector(function (store) {
|
|
8080
|
+
return getIsViewPresetListDialogOpen(store, mosaicNodeId);
|
|
7999
8081
|
});
|
|
8000
|
-
var
|
|
8001
|
-
return
|
|
8082
|
+
var isViewPresetsFetching = useSelector(function (store) {
|
|
8083
|
+
return getViewPresetsIsFetching(store, mosaicNodeId);
|
|
8002
8084
|
});
|
|
8003
|
-
var
|
|
8004
|
-
return
|
|
8085
|
+
var errorViewPreset = useSelector(function (store) {
|
|
8086
|
+
return getViewPresetDetailError(store, mosaicNodeId);
|
|
8005
8087
|
});
|
|
8006
|
-
var
|
|
8007
|
-
|
|
8008
|
-
t = _useWorkspaceTranslat.t;
|
|
8009
|
-
var fetchWorkspaceList = React.useCallback(function () {
|
|
8010
|
-
var filterParams = constructFilterParams([], workspaceSearchQuery);
|
|
8011
|
-
dispatch(workspaceListActions.fetchWorkspaceList(filterParams));
|
|
8012
|
-
}, [dispatch, workspaceSearchQuery]);
|
|
8013
|
-
var fetchWorkspace = React.useCallback(function (workspaceId) {
|
|
8014
|
-
dispatch(workspaceActions.fetchWorkspace({
|
|
8015
|
-
workspaceId: workspaceId
|
|
8016
|
-
}));
|
|
8017
|
-
}, [dispatch]);
|
|
8018
|
-
var setWorkspaceActionDialogOptions = React.useCallback(function (dialogOptions) {
|
|
8019
|
-
dispatch(workspaceListActions.openWorkspaceActionDialogOptions(dialogOptions));
|
|
8088
|
+
var addView = React.useCallback(function (view) {
|
|
8089
|
+
dispatch(workspaceActions.setNewWorkspaceView(view));
|
|
8020
8090
|
}, [dispatch]);
|
|
8021
|
-
var
|
|
8022
|
-
|
|
8023
|
-
|
|
8024
|
-
|
|
8025
|
-
|
|
8091
|
+
var registerView = React.useCallback(function (_ref2) {
|
|
8092
|
+
var panelId = _ref2.panelId,
|
|
8093
|
+
mapPresetId = _ref2.mapPresetId;
|
|
8094
|
+
dispatch(viewPresetActions.registerViewPreset({
|
|
8095
|
+
panelId: panelId,
|
|
8096
|
+
viewPresetId: mapPresetId
|
|
8026
8097
|
}));
|
|
8027
|
-
}, [dispatch, isAdmin]);
|
|
8028
|
-
var setSelectAllFilterChip = React.useCallback(function () {
|
|
8029
|
-
dispatch(workspaceListActions.setSelectAllFilterChip());
|
|
8030
8098
|
}, [dispatch]);
|
|
8031
|
-
var
|
|
8032
|
-
|
|
8033
|
-
|
|
8099
|
+
var unregisterView = React.useCallback(function (_ref3) {
|
|
8100
|
+
var panelId = _ref3.panelId;
|
|
8101
|
+
dispatch(viewPresetActions.unregisterViewPreset({
|
|
8102
|
+
panelId: panelId
|
|
8034
8103
|
}));
|
|
8035
8104
|
}, [dispatch]);
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
newMapPresetText: t('workspace-mappreset-new'),
|
|
8046
|
-
newWorkspaceText: t('workspace-new')
|
|
8105
|
+
var removeLinkedMap = React.useCallback(function (panelId) {
|
|
8106
|
+
dispatch(genericActions.removeLinkedMap(panelId));
|
|
8107
|
+
}, [dispatch]);
|
|
8108
|
+
var toggleViewPresetDialog = React.useCallback(function (_ref4) {
|
|
8109
|
+
var panelId = _ref4.panelId,
|
|
8110
|
+
isViewPresetDialogOpen = _ref4.isViewPresetDialogOpen;
|
|
8111
|
+
dispatch(viewPresetActions.toggleViewPresetListDialog({
|
|
8112
|
+
panelId: panelId,
|
|
8113
|
+
isViewPresetListDialogOpen: isViewPresetDialogOpen
|
|
8047
8114
|
}));
|
|
8048
|
-
}, [dispatch
|
|
8049
|
-
var
|
|
8050
|
-
|
|
8051
|
-
|
|
8052
|
-
|
|
8053
|
-
|
|
8054
|
-
|
|
8055
|
-
};
|
|
8056
|
-
var onClickFilterChip = function onClickFilterChip(id, shouldSelect) {
|
|
8057
|
-
if (id === 'all') {
|
|
8058
|
-
if (shouldSelect) {
|
|
8059
|
-
setSelectAllFilterChip();
|
|
8060
|
-
}
|
|
8061
|
-
} else {
|
|
8062
|
-
toggleSelectFilterChip(id, shouldSelect);
|
|
8063
|
-
}
|
|
8064
|
-
};
|
|
8065
|
-
var onClickWorkspacePresetOption = function onClickWorkspacePresetOption(presetId, workspaceAction) {
|
|
8066
|
-
// If affectedPreset is the FE defined `New workspace` - use the definition from FE instead of BE
|
|
8067
|
-
var affectedPreset = presetId === getEmptyMapWorkspace(t).id ? getEmptyMapWorkspace(t) : workspacePresets.find(function (preset) {
|
|
8068
|
-
return preset.id === presetId;
|
|
8115
|
+
}, [dispatch]);
|
|
8116
|
+
var createNode = React.useCallback(function () {
|
|
8117
|
+
var newId = getUniqueId(viewIds);
|
|
8118
|
+
addView({
|
|
8119
|
+
componentType: 'Map',
|
|
8120
|
+
mosaicNodeId: mosaicNodeId,
|
|
8121
|
+
newId: newId
|
|
8069
8122
|
});
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
|
|
8088
|
-
|
|
8089
|
-
|
|
8090
|
-
|
|
8091
|
-
|
|
8092
|
-
|
|
8093
|
-
|
|
8094
|
-
|
|
8095
|
-
|
|
8096
|
-
|
|
8097
|
-
|
|
8098
|
-
|
|
8099
|
-
|
|
8100
|
-
|
|
8101
|
-
|
|
8102
|
-
|
|
8103
|
-
|
|
8104
|
-
|
|
8105
|
-
|
|
8106
|
-
|
|
8107
|
-
|
|
8108
|
-
|
|
8109
|
-
|
|
8110
|
-
|
|
8111
|
-
|
|
8112
|
-
|
|
8113
|
-
|
|
8114
|
-
|
|
8115
|
-
|
|
8116
|
-
|
|
8117
|
-
|
|
8118
|
-
}), auth).then(function () {
|
|
8119
|
-
dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
8120
|
-
workspaceId: presetId,
|
|
8121
|
-
action: WorkspacePresetAction.SHARE,
|
|
8122
|
-
title: presetTitle,
|
|
8123
|
-
scope: scope,
|
|
8124
|
-
is_shared: preset.is_shared
|
|
8125
|
-
}));
|
|
8126
|
-
fetchWorkspaceList();
|
|
8127
|
-
})["catch"](function (error) {
|
|
8128
|
-
dispatch(workspaceListActions.onErrorWorkspacePresetAction({
|
|
8129
|
-
error: {
|
|
8130
|
-
message: "" + error,
|
|
8131
|
-
type: WorkspaceListErrorType.VERBATIM_ERROR,
|
|
8132
|
-
category: WorkspaceListErrorCategory.GENERIC
|
|
8133
|
-
}
|
|
8134
|
-
}));
|
|
8135
|
-
});
|
|
8136
|
-
});
|
|
8137
|
-
break;
|
|
8138
|
-
}
|
|
8139
|
-
case WorkspacePresetAction.OPEN_TAB:
|
|
8140
|
-
{
|
|
8141
|
-
var url = getWorkspaceRouteUrl(presetId);
|
|
8142
|
-
window.open(url, '_blank');
|
|
8143
|
-
break;
|
|
8144
|
-
}
|
|
8145
|
-
}
|
|
8146
|
-
};
|
|
8147
|
-
var isAllSelected = workspaceListFilters.length > 0 && workspaceListFilters.every(function (filter) {
|
|
8148
|
-
return filter.isSelected;
|
|
8149
|
-
});
|
|
8150
|
-
var shouldHideNewWorkspace = !isAllSelected || workspaceSearchQuery.length > 0;
|
|
8151
|
-
return jsxs(Box, {
|
|
8152
|
-
"data-testid": "workspace-selectlist-connect",
|
|
8153
|
-
style: {
|
|
8154
|
-
display: 'flex',
|
|
8155
|
-
flexDirection: 'column',
|
|
8156
|
-
height: '100%'
|
|
8157
|
-
},
|
|
8158
|
-
tabIndex: 0,
|
|
8159
|
-
children: [isFetching && jsx(LinearProgress, {
|
|
8123
|
+
return newId;
|
|
8124
|
+
}, [addView, mosaicNodeId, viewIds]);
|
|
8125
|
+
var title = (view == null ? void 0 : view.title) || (view == null ? void 0 : view.id) || mosaicNodeId;
|
|
8126
|
+
React.useEffect(function () {
|
|
8127
|
+
var viewPresetId = (view == null ? void 0 : view.id) || '';
|
|
8128
|
+
registerView({
|
|
8129
|
+
panelId: mosaicNodeId,
|
|
8130
|
+
mapPresetId: viewPresetId
|
|
8131
|
+
});
|
|
8132
|
+
return function () {
|
|
8133
|
+
unregisterView({
|
|
8134
|
+
panelId: mosaicNodeId
|
|
8135
|
+
});
|
|
8136
|
+
};
|
|
8137
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8138
|
+
}, [registerView, unregisterView]);
|
|
8139
|
+
// generic componentsLookUp
|
|
8140
|
+
var genericComponentsLookupResult = React.useMemo(function () {
|
|
8141
|
+
return componentsLookUp({
|
|
8142
|
+
title: title,
|
|
8143
|
+
id: mosaicNodeId,
|
|
8144
|
+
componentType: view == null ? void 0 : view.componentType,
|
|
8145
|
+
initialProps: view == null ? void 0 : view.initialProps
|
|
8146
|
+
});
|
|
8147
|
+
}, [componentsLookUp, mosaicNodeId, title, view == null ? void 0 : view.componentType, view == null ? void 0 : view.initialProps]);
|
|
8148
|
+
// default componentsLookUp
|
|
8149
|
+
var defaultComponentsLookupResult = React.useMemo(function () {
|
|
8150
|
+
return defaultComponentsLookUp({
|
|
8151
|
+
viewPresetId: view == null ? void 0 : view.id,
|
|
8152
|
+
componentType: view == null ? void 0 : view.componentType,
|
|
8153
|
+
mosaicNodeId: mosaicNodeId
|
|
8154
|
+
});
|
|
8155
|
+
}, [mosaicNodeId, view == null ? void 0 : view.componentType, view == null ? void 0 : view.id]);
|
|
8156
|
+
return jsxs(MosaicWindow, {
|
|
8157
|
+
path: path,
|
|
8158
|
+
createNode: createNode,
|
|
8159
|
+
title: jsx(WorkspaceViewTitleConnect, {
|
|
8160
|
+
panelId: mosaicNodeId,
|
|
8161
|
+
isViewPresetDialogOpen: isViewPresetDialogOpen || false
|
|
8162
|
+
}),
|
|
8163
|
+
toolbarControls: jsx(WorkspaceControls, {
|
|
8164
|
+
panelId: mosaicNodeId,
|
|
8165
|
+
createNode: createNode,
|
|
8166
|
+
path: path,
|
|
8167
|
+
shouldPreventCloseView: shouldPreventCloseView,
|
|
8168
|
+
removeLinkedMap: removeLinkedMap
|
|
8169
|
+
}),
|
|
8170
|
+
children: [isViewPresetsFetching && jsx(LinearProgress, {
|
|
8160
8171
|
"data-testid": "loading-bar",
|
|
8161
8172
|
color: "secondary",
|
|
8162
8173
|
sx: {
|
|
8163
8174
|
position: 'absolute',
|
|
8164
8175
|
width: '100%',
|
|
8165
8176
|
top: 0,
|
|
8166
|
-
|
|
8177
|
+
zIndex: 1001
|
|
8167
8178
|
}
|
|
8168
|
-
}),
|
|
8169
|
-
|
|
8170
|
-
|
|
8179
|
+
}), errorViewPreset && jsx(Box, {
|
|
8180
|
+
sx: {
|
|
8181
|
+
position: 'absolute',
|
|
8182
|
+
left: 0,
|
|
8183
|
+
right: 0,
|
|
8184
|
+
zIndex: 1002
|
|
8171
8185
|
},
|
|
8172
|
-
children: jsx(AlertBanner,
|
|
8173
|
-
title:
|
|
8174
|
-
GENERIC: '',
|
|
8175
|
-
AUTH: t('workspace-error-auth')
|
|
8176
|
-
}[error.category]) != null ? _GENERIC$AUTH$error$c : t('workspace-error-fetch'),
|
|
8177
|
-
info: error.type === WorkspaceListErrorType.TRANSLATABLE_ERROR ? t(error.key, error.params) : error.message,
|
|
8186
|
+
children: jsx(AlertBanner, {
|
|
8187
|
+
title: errorViewPreset,
|
|
8178
8188
|
shouldClose: true
|
|
8179
|
-
}
|
|
8180
|
-
|
|
8181
|
-
|
|
8182
|
-
|
|
8183
|
-
|
|
8184
|
-
|
|
8185
|
-
|
|
8186
|
-
|
|
8187
|
-
}), jsxs(Box, {
|
|
8188
|
-
sx: {
|
|
8189
|
-
display: 'flex',
|
|
8190
|
-
flexDirection: 'column',
|
|
8191
|
-
height: '100%',
|
|
8192
|
-
padding: 1,
|
|
8193
|
-
overflow: 'hidden'
|
|
8189
|
+
})
|
|
8190
|
+
}), defaultComponentsLookupResult, genericComponentsLookupResult, jsx(ViewPresetMenu, {
|
|
8191
|
+
panelId: mosaicNodeId,
|
|
8192
|
+
closeMenu: function closeMenu() {
|
|
8193
|
+
toggleViewPresetDialog({
|
|
8194
|
+
panelId: mosaicNodeId,
|
|
8195
|
+
isViewPresetDialogOpen: false
|
|
8196
|
+
});
|
|
8194
8197
|
},
|
|
8195
|
-
|
|
8196
|
-
sx: {
|
|
8197
|
-
marginBottom: 1
|
|
8198
|
-
},
|
|
8199
|
-
children: [jsx(Box, {
|
|
8200
|
-
sx: {
|
|
8201
|
-
display: 'flex',
|
|
8202
|
-
width: '100%'
|
|
8203
|
-
},
|
|
8204
|
-
children: jsx(Filter, {
|
|
8205
|
-
filters: workspaceListFilters,
|
|
8206
|
-
onClickFilterChip: onClickFilterChip,
|
|
8207
|
-
isAllSelected: isAllSelected,
|
|
8208
|
-
searchQuery: workspaceSearchQuery,
|
|
8209
|
-
onSearch: searchFilter
|
|
8210
|
-
})
|
|
8211
|
-
}), jsx(Box, {
|
|
8212
|
-
sx: {
|
|
8213
|
-
display: 'flex',
|
|
8214
|
-
justifyContent: 'flex-start'
|
|
8215
|
-
},
|
|
8216
|
-
children: jsx(LastUpdateTime, {
|
|
8217
|
-
onPressRefresh: function onPressRefresh() {
|
|
8218
|
-
return fetchWorkspaceList();
|
|
8219
|
-
},
|
|
8220
|
-
hideLabel: true
|
|
8221
|
-
})
|
|
8222
|
-
})]
|
|
8223
|
-
}), jsx(Box, {
|
|
8224
|
-
sx: {
|
|
8225
|
-
flexGrow: 1,
|
|
8226
|
-
minHeight: 0
|
|
8227
|
-
},
|
|
8228
|
-
children: jsx(WorkspaceSelectList, {
|
|
8229
|
-
workspacePresets: filteredPresets,
|
|
8230
|
-
currentSelectedId: currentView.id || '',
|
|
8231
|
-
onClickWorkspacePreset: onClickWorkspacePreset,
|
|
8232
|
-
onClickWorkspacePresetOption: onClickWorkspacePresetOption,
|
|
8233
|
-
hideNewWorkspace: shouldHideNewWorkspace,
|
|
8234
|
-
isEditable: isLoggedIn,
|
|
8235
|
-
isAdmin: isAdmin,
|
|
8236
|
-
searchQuery: workspaceSearchQuery
|
|
8237
|
-
})
|
|
8238
|
-
})]
|
|
8198
|
+
isOpen: isViewPresetDialogOpen
|
|
8239
8199
|
})]
|
|
8240
8200
|
});
|
|
8241
|
-
};
|
|
8201
|
+
}, isEqual);
|
|
8242
8202
|
|
|
8243
|
-
var
|
|
8244
|
-
var
|
|
8245
|
-
|
|
8246
|
-
|
|
8203
|
+
var WorkspaceView = function WorkspaceView(_ref) {
|
|
8204
|
+
var screenConfig = _ref.screenConfig,
|
|
8205
|
+
componentsLookUp = _ref.componentsLookUp,
|
|
8206
|
+
updateViews = _ref.updateViews,
|
|
8207
|
+
activeWindowId = _ref.activeWindowId,
|
|
8208
|
+
setActiveWindowId = _ref.setActiveWindowId,
|
|
8209
|
+
_ref$isWorkspaceLoadi = _ref.isWorkspaceLoading,
|
|
8210
|
+
isWorkspaceLoading = _ref$isWorkspaceLoadi === void 0 ? false : _ref$isWorkspaceLoadi;
|
|
8247
8211
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
8248
8212
|
t = _useWorkspaceTranslat.t;
|
|
8249
|
-
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
|
|
8257
|
-
hasLayout: false,
|
|
8258
|
-
resizableDefaultSize: {
|
|
8259
|
-
width: 380,
|
|
8260
|
-
height: '90%'
|
|
8213
|
+
var EmptyView = !isWorkspaceLoading && jsxs(Box, {
|
|
8214
|
+
sx: {
|
|
8215
|
+
backgroundColor: 'geowebColors.background.surface',
|
|
8216
|
+
display: 'flex',
|
|
8217
|
+
flexDirection: 'column',
|
|
8218
|
+
justifyContent: 'center',
|
|
8219
|
+
alignItems: 'center',
|
|
8220
|
+
height: '100%'
|
|
8261
8221
|
},
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
}
|
|
8267
|
-
},
|
|
8268
|
-
root: {
|
|
8269
|
-
style: {
|
|
8270
|
-
top: 40
|
|
8271
|
-
}
|
|
8222
|
+
children: [jsx(WebAssetOff, {
|
|
8223
|
+
sx: {
|
|
8224
|
+
fontSize: '150px',
|
|
8225
|
+
margin: '20px'
|
|
8272
8226
|
}
|
|
8273
|
-
},
|
|
8274
|
-
|
|
8275
|
-
|
|
8276
|
-
title: t('workspace-menu'),
|
|
8277
|
-
onClose: closeMenu,
|
|
8278
|
-
style: {
|
|
8279
|
-
width: '100%',
|
|
8280
|
-
height: '100%'
|
|
8281
|
-
},
|
|
8282
|
-
onClick: function onClick(event) {
|
|
8283
|
-
event.stopPropagation();
|
|
8227
|
+
}), jsx(Typography, {
|
|
8228
|
+
sx: {
|
|
8229
|
+
color: 'geowebColors.typographyAndIcons.text'
|
|
8284
8230
|
},
|
|
8285
|
-
children:
|
|
8286
|
-
})
|
|
8231
|
+
children: t('geoweb-welcome')
|
|
8232
|
+
})]
|
|
8287
8233
|
});
|
|
8288
|
-
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
|
|
8292
|
-
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
|
|
8296
|
-
|
|
8234
|
+
useControlActiveWindowId(screenConfig, activeWindowId, setActiveWindowId);
|
|
8235
|
+
var getNewViewId = function getNewViewId(element, viewId) {
|
|
8236
|
+
if (element instanceof Element) {
|
|
8237
|
+
// Check if a windows close button was clicked
|
|
8238
|
+
var target = element.closest('#close-window-button');
|
|
8239
|
+
if (target) {
|
|
8240
|
+
var viewIds = screenConfig.views.allIds;
|
|
8241
|
+
var newViewId = viewIds.length === 0 ? undefined : activeWindowId;
|
|
8242
|
+
return newViewId;
|
|
8243
|
+
}
|
|
8244
|
+
}
|
|
8245
|
+
return viewId;
|
|
8297
8246
|
};
|
|
8298
|
-
var
|
|
8299
|
-
|
|
8300
|
-
|
|
8301
|
-
|
|
8302
|
-
|
|
8303
|
-
|
|
8304
|
-
|
|
8305
|
-
|
|
8247
|
+
var handleClickOnWindow = function handleClickOnWindow(event, viewId) {
|
|
8248
|
+
var target = event.target;
|
|
8249
|
+
var newViewId = getNewViewId(target, viewId);
|
|
8250
|
+
if (newViewId !== activeWindowId) {
|
|
8251
|
+
setActiveWindowId(newViewId);
|
|
8252
|
+
}
|
|
8253
|
+
};
|
|
8254
|
+
return jsx(Box, {
|
|
8255
|
+
sx: {
|
|
8256
|
+
height: '100%',
|
|
8257
|
+
'.geoweb-mosaic .mosaic-window-title': {
|
|
8258
|
+
fontWeight: 'bold',
|
|
8259
|
+
fontSize: '12px',
|
|
8260
|
+
userSelect: 'none'
|
|
8261
|
+
},
|
|
8262
|
+
'.geoweb-mosaic .mosaic-window-body': {
|
|
8263
|
+
backgroundColor: 'geowebColors.background.surfaceApp'
|
|
8264
|
+
}
|
|
8265
|
+
},
|
|
8266
|
+
children: jsx(Mosaic, {
|
|
8267
|
+
className: "geoweb-mosaic",
|
|
8268
|
+
zeroStateView: EmptyView || undefined,
|
|
8269
|
+
initialValue: screenConfig.mosaicNode,
|
|
8270
|
+
renderTile: function renderTile(viewId, path) {
|
|
8271
|
+
var windowIsActive = viewId === activeWindowId;
|
|
8272
|
+
return jsx(Box, {
|
|
8273
|
+
onClick: function onClick(event) {
|
|
8274
|
+
return handleClickOnWindow(event, viewId);
|
|
8275
|
+
},
|
|
8276
|
+
sx: function sx(theme) {
|
|
8277
|
+
return {
|
|
8278
|
+
'> *': {
|
|
8279
|
+
height: '100%',
|
|
8280
|
+
width: '100%'
|
|
8281
|
+
},
|
|
8282
|
+
'.mosaic-window .mosaic-window-toolbar': {
|
|
8283
|
+
backgroundColor: windowIsActive ? theme.palette.geowebColors.workspace.activeWindow : theme.palette.geowebColors.workspace.inactiveWindow
|
|
8284
|
+
},
|
|
8285
|
+
'.mosaic-window-toolbar .MuiSvgIcon-root': {
|
|
8286
|
+
fill: windowIsActive ? theme.palette.geowebColors.buttons.flat["default"].color : theme.palette.geowebColors.buttons.flat.disabled.color
|
|
8287
|
+
},
|
|
8288
|
+
'#close-window-button .MuiSvgIcon-root': {
|
|
8289
|
+
fill: theme.palette.geowebColors.buttons.flat.disabled.color
|
|
8290
|
+
},
|
|
8291
|
+
'.mosaic-window-toolbar .mosaic-window-title': {
|
|
8292
|
+
color: windowIsActive ? theme.palette.geowebColors.typographyAndIcons.text : theme.palette.geowebColors.typographyAndIcons.inactiveText
|
|
8293
|
+
}
|
|
8294
|
+
};
|
|
8295
|
+
},
|
|
8296
|
+
children: jsx(WorkspaceTileConnect, {
|
|
8297
|
+
mosaicNodeId: viewId,
|
|
8298
|
+
path: path,
|
|
8299
|
+
componentsLookUp: componentsLookUp
|
|
8300
|
+
})
|
|
8301
|
+
});
|
|
8306
8302
|
},
|
|
8307
|
-
|
|
8308
|
-
|
|
8309
|
-
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
variant: "tool",
|
|
8315
|
-
tooltipTitle: tooltipTitle,
|
|
8316
|
-
sx: {
|
|
8317
|
-
'&&': {
|
|
8318
|
-
backgroundColor: !showMenu ? 'transparent' : undefined,
|
|
8319
|
-
'&:hover': {
|
|
8320
|
-
backgroundColor: 'geowebColors.workspace.tabButtonHover'
|
|
8321
|
-
}
|
|
8322
|
-
}
|
|
8323
|
-
},
|
|
8324
|
-
children: jsx(PresetWorkspace, {})
|
|
8325
|
-
})
|
|
8326
|
-
}), jsx(WorkspaceMenu, {
|
|
8327
|
-
isOpen: showMenu,
|
|
8328
|
-
closeMenu: onCloseMenu
|
|
8329
|
-
})]
|
|
8303
|
+
onRelease: function onRelease(node) {
|
|
8304
|
+
return updateViews(node);
|
|
8305
|
+
},
|
|
8306
|
+
resize: {
|
|
8307
|
+
minimumPaneSizePercentage: screenConfig.minimumPaneSizePercentage || 20
|
|
8308
|
+
}
|
|
8309
|
+
})
|
|
8330
8310
|
});
|
|
8331
8311
|
};
|
|
8332
|
-
|
|
8333
|
-
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
|
|
8338
|
-
|
|
8339
|
-
|
|
8340
|
-
|
|
8341
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
8342
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8343
|
-
* See the License for the specific language governing permissions and
|
|
8344
|
-
* limitations under the License.
|
|
8345
|
-
*
|
|
8346
|
-
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
8347
|
-
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
8348
|
-
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
8349
|
-
* */
|
|
8350
|
-
var useFetchWorkspacePresets = function useFetchWorkspacePresets() {
|
|
8351
|
-
var dispatch = useDispatch();
|
|
8352
|
-
var _useAuthenticationCon = useAuthenticationContext(),
|
|
8353
|
-
currentRole = _useAuthenticationCon.currentRole;
|
|
8354
|
-
var isAdmin = (currentRole == null ? void 0 : currentRole.name) === GEOWEB_ROLE_PRESETS_ADMIN.name;
|
|
8355
|
-
var lastAdmin = usePrevious(isAdmin);
|
|
8356
|
-
var workspaceSearchQuery = useSelector(getWorkspaceListSearchQuery);
|
|
8357
|
-
var prevSearch = usePrevious(workspaceSearchQuery);
|
|
8358
|
-
var fetchWorkspacePresets = useCallback(function (params) {
|
|
8359
|
-
dispatch(workspaceListActions.fetchWorkspaceList(params));
|
|
8360
|
-
}, [dispatch]);
|
|
8361
|
-
useEffect(function () {
|
|
8362
|
-
if (workspaceSearchQuery !== prevSearch) {
|
|
8363
|
-
var filterParams = constructFilterParams([], workspaceSearchQuery);
|
|
8364
|
-
fetchWorkspacePresets(filterParams);
|
|
8312
|
+
var useControlActiveWindowId = function useControlActiveWindowId(screenConfig, activeWindowId, setActiveWindowId) {
|
|
8313
|
+
// When screenConfig.id changes it means a new preset was chosen.
|
|
8314
|
+
React.useEffect(function () {
|
|
8315
|
+
if (screenConfig.id !== '' && screenConfig.mosaicNode) {
|
|
8316
|
+
var mosaicNode = screenConfig.mosaicNode;
|
|
8317
|
+
while (!isString(mosaicNode)) {
|
|
8318
|
+
mosaicNode = mosaicNode.first;
|
|
8319
|
+
}
|
|
8320
|
+
setActiveWindowId(mosaicNode);
|
|
8365
8321
|
}
|
|
8366
|
-
|
|
8367
|
-
|
|
8368
|
-
|
|
8369
|
-
|
|
8370
|
-
|
|
8371
|
-
|
|
8372
|
-
|
|
8373
|
-
}, {
|
|
8374
|
-
id: PresetFilterType.personal,
|
|
8375
|
-
isSelected: !isAdmin
|
|
8376
|
-
}, {
|
|
8377
|
-
id: PresetFilterType.shared,
|
|
8378
|
-
isSelected: true
|
|
8379
|
-
}];
|
|
8380
|
-
dispatch(workspaceListActions.setFilterChips(filters));
|
|
8322
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8323
|
+
}, [screenConfig.id]);
|
|
8324
|
+
// If active window is no longer in screenConfig then set active window to first window
|
|
8325
|
+
React.useEffect(function () {
|
|
8326
|
+
var viewIds = screenConfig.views.allIds;
|
|
8327
|
+
if (activeWindowId !== undefined && viewIds && viewIds.length > 0 && !viewIds.includes(activeWindowId)) {
|
|
8328
|
+
setActiveWindowId(viewIds[0]);
|
|
8381
8329
|
}
|
|
8382
|
-
}, [
|
|
8330
|
+
}, [activeWindowId, screenConfig.views, screenConfig.views.allIds, setActiveWindowId]);
|
|
8383
8331
|
};
|
|
8384
8332
|
|
|
8385
|
-
var
|
|
8333
|
+
var WorkspaceViewConnect = function WorkspaceViewConnect(_ref) {
|
|
8334
|
+
var componentsLookUp = _ref.componentsLookUp;
|
|
8386
8335
|
var dispatch = useDispatch();
|
|
8387
|
-
var
|
|
8388
|
-
return
|
|
8336
|
+
var isWorkspaceLoading$1 = useSelector(function (store) {
|
|
8337
|
+
return isWorkspaceLoading(store);
|
|
8389
8338
|
});
|
|
8390
|
-
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8339
|
+
var screenConfig = useSelector(function (store) {
|
|
8340
|
+
return getWorkspaceState(store);
|
|
8341
|
+
});
|
|
8342
|
+
var updateViews = useCallback(function (currentNode) {
|
|
8343
|
+
dispatch(workspaceActions.updateWorkspaceViews({
|
|
8344
|
+
mosaicNode: currentNode
|
|
8394
8345
|
}));
|
|
8395
8346
|
}, [dispatch]);
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8347
|
+
var setActiveWindowId = useCallback(function (activeWindowId) {
|
|
8348
|
+
dispatch(uiActions.setActiveWindowId({
|
|
8349
|
+
activeWindowId: activeWindowId
|
|
8350
|
+
}));
|
|
8351
|
+
}, [dispatch]);
|
|
8352
|
+
var activeWindowId = useSelector(uiSelectors.getActiveWindowId);
|
|
8353
|
+
var mosaicNode = useSelector(function (store) {
|
|
8354
|
+
return getMosaicNode(store);
|
|
8355
|
+
});
|
|
8356
|
+
var autoArrange = useCallback(function () {
|
|
8357
|
+
dispatch(workspaceActions.updateWorkspaceViews({
|
|
8358
|
+
mosaicNode: createBalancedMosaicNode(mosaicNode)
|
|
8359
|
+
}));
|
|
8360
|
+
}, [dispatch, mosaicNode]);
|
|
8361
|
+
var handleOrientationChange = React__default.useCallback(function () {
|
|
8362
|
+
autoArrange();
|
|
8363
|
+
}, [autoArrange]);
|
|
8364
|
+
var componentTypes = useSelector(function (store) {
|
|
8365
|
+
return getComponentTypesFromActiveViews(store);
|
|
8366
|
+
});
|
|
8367
|
+
React__default.useEffect(function () {
|
|
8368
|
+
closeDialogsWhenChangingPreset(componentTypes, dispatch);
|
|
8369
|
+
}, [componentTypes, dispatch]);
|
|
8370
|
+
React__default.useEffect(function () {
|
|
8371
|
+
window.addEventListener('orientationchange', handleOrientationChange);
|
|
8372
|
+
return function () {
|
|
8373
|
+
return window.removeEventListener('orientationchange', handleOrientationChange);
|
|
8374
|
+
};
|
|
8375
|
+
}, [handleOrientationChange]);
|
|
8376
|
+
return jsx(WorkspaceView, {
|
|
8377
|
+
screenConfig: screenConfig,
|
|
8378
|
+
componentsLookUp: componentsLookUp,
|
|
8379
|
+
updateViews: updateViews,
|
|
8380
|
+
activeWindowId: activeWindowId,
|
|
8381
|
+
setActiveWindowId: setActiveWindowId,
|
|
8382
|
+
isWorkspaceLoading: isWorkspaceLoading$1
|
|
8399
8383
|
});
|
|
8400
8384
|
};
|
|
8401
8385
|
|
|
8402
8386
|
var WorkspaceOptionsConnect = function WorkspaceOptionsConnect(_ref) {
|
|
8403
8387
|
var title = _ref.title,
|
|
8404
|
-
|
|
8405
|
-
workspaceId = _ref.workspaceId,
|
|
8406
|
-
appTitle = _ref.appTitle;
|
|
8388
|
+
workspaceId = _ref.workspaceId;
|
|
8407
8389
|
var dispatch = useDispatch();
|
|
8408
8390
|
var store = useStore();
|
|
8409
|
-
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
8410
|
-
t = _useWorkspaceTranslat.t;
|
|
8411
8391
|
var _useAuthenticationCon = useAuthenticationContext(),
|
|
8412
8392
|
currentRole = _useAuthenticationCon.currentRole,
|
|
8413
8393
|
auth = _useAuthenticationCon.auth;
|
|
8414
8394
|
var isAdmin = (currentRole == null ? void 0 : currentRole.name) === GEOWEB_ROLE_PRESETS_ADMIN.name;
|
|
8415
8395
|
var _useAuthenticationCon2 = useAuthenticationContext(),
|
|
8416
8396
|
isLoggedIn = _useAuthenticationCon2.isLoggedIn;
|
|
8417
|
-
var hasChanges = useSelector(function (store) {
|
|
8418
|
-
return hasWorkspaceChanges(store);
|
|
8419
|
-
});
|
|
8420
8397
|
var workspaceScope = useSelector(function (store) {
|
|
8421
8398
|
return getSelectedWorkspaceScope(store);
|
|
8422
8399
|
});
|
|
@@ -8424,19 +8401,15 @@ var WorkspaceOptionsConnect = function WorkspaceOptionsConnect(_ref) {
|
|
|
8424
8401
|
return getWorkspaceData(store);
|
|
8425
8402
|
});
|
|
8426
8403
|
var currentWorkspacePreset = useSelector(function (store) {
|
|
8427
|
-
return
|
|
8404
|
+
return workspaceId ? getWorkspacePresetFromList(store, workspaceId) : undefined;
|
|
8428
8405
|
});
|
|
8429
8406
|
var workspaceCreator = (currentWorkspacePreset == null ? void 0 : currentWorkspacePreset.username) || '';
|
|
8430
8407
|
var viewIds = useSelector(function (store) {
|
|
8431
8408
|
return getViewIds(store);
|
|
8432
8409
|
});
|
|
8433
|
-
var isNew = workspaceId
|
|
8434
|
-
var fullTitle = getPresetTitle(title, hasChanges, isNew, t);
|
|
8410
|
+
var isNew = !workspaceId;
|
|
8435
8411
|
var isUserPreset = workspaceScope === 'user';
|
|
8436
8412
|
var isUserPresetCreator = (auth == null ? void 0 : auth.username) === workspaceCreator;
|
|
8437
|
-
React.useEffect(function () {
|
|
8438
|
-
setDocumentTitle(fullTitle, appTitle);
|
|
8439
|
-
}, [fullTitle, appTitle]);
|
|
8440
8413
|
var setWorkspaceActionDialogOptions = React.useCallback(function (dialogOptions) {
|
|
8441
8414
|
dispatch(workspaceListActions.openWorkspaceActionDialogOptions(dialogOptions));
|
|
8442
8415
|
}, [dispatch]);
|
|
@@ -8541,15 +8514,98 @@ var WorkspaceOptionsConnect = function WorkspaceOptionsConnect(_ref) {
|
|
|
8541
8514
|
return isUserPreset && isUserPresetCreator ? onEdit : undefined;
|
|
8542
8515
|
};
|
|
8543
8516
|
return jsx(WorkspaceOptions, {
|
|
8544
|
-
|
|
8545
|
-
title: fullTitle,
|
|
8546
|
-
activeTab: activeTab,
|
|
8547
|
-
handleDelete: getOnDelete(),
|
|
8548
|
-
handleSaveAs: handleSaveAs(),
|
|
8517
|
+
isDisabled: !viewIds.length || !isLoggedIn,
|
|
8549
8518
|
handleSave: handleSave(),
|
|
8519
|
+
handleSaveAs: handleSaveAs(),
|
|
8550
8520
|
handleEdit: handleEdit(),
|
|
8551
|
-
|
|
8552
|
-
|
|
8521
|
+
handleDelete: getOnDelete(),
|
|
8522
|
+
handleReset: onReset
|
|
8523
|
+
});
|
|
8524
|
+
};
|
|
8525
|
+
|
|
8526
|
+
/* *
|
|
8527
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8528
|
+
* you may not use this file except in compliance with the License.
|
|
8529
|
+
* You may obtain a copy of the License at
|
|
8530
|
+
*
|
|
8531
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8532
|
+
*
|
|
8533
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
8534
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
8535
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8536
|
+
* See the License for the specific language governing permissions and
|
|
8537
|
+
* limitations under the License.
|
|
8538
|
+
*
|
|
8539
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
8540
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
8541
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
8542
|
+
* */
|
|
8543
|
+
var useFetchWorkspacePresets = function useFetchWorkspacePresets() {
|
|
8544
|
+
var dispatch = useDispatch();
|
|
8545
|
+
var _useAuthenticationCon = useAuthenticationContext(),
|
|
8546
|
+
currentRole = _useAuthenticationCon.currentRole;
|
|
8547
|
+
var isAdmin = (currentRole == null ? void 0 : currentRole.name) === GEOWEB_ROLE_PRESETS_ADMIN.name;
|
|
8548
|
+
var lastAdmin = usePrevious(isAdmin);
|
|
8549
|
+
var workspaceSearchQuery = useSelector(getWorkspaceListSearchQuery);
|
|
8550
|
+
var prevSearch = usePrevious(workspaceSearchQuery);
|
|
8551
|
+
var fetchWorkspacePresets = useCallback(function (params) {
|
|
8552
|
+
dispatch(workspaceListActions.fetchWorkspaceList(params));
|
|
8553
|
+
}, [dispatch]);
|
|
8554
|
+
useEffect(function () {
|
|
8555
|
+
if (workspaceSearchQuery !== prevSearch) {
|
|
8556
|
+
var filterParams = constructFilterParams([], workspaceSearchQuery);
|
|
8557
|
+
fetchWorkspacePresets(filterParams);
|
|
8558
|
+
}
|
|
8559
|
+
}, [fetchWorkspacePresets, prevSearch, workspaceSearchQuery]);
|
|
8560
|
+
useEffect(function () {
|
|
8561
|
+
if (isAdmin !== lastAdmin && lastAdmin !== undefined) {
|
|
8562
|
+
// reset list filter when user changes role
|
|
8563
|
+
var filters = [{
|
|
8564
|
+
id: PresetFilterType.system,
|
|
8565
|
+
isSelected: true
|
|
8566
|
+
}, {
|
|
8567
|
+
id: PresetFilterType.personal,
|
|
8568
|
+
isSelected: !isAdmin
|
|
8569
|
+
}, {
|
|
8570
|
+
id: PresetFilterType.shared,
|
|
8571
|
+
isSelected: true
|
|
8572
|
+
}];
|
|
8573
|
+
dispatch(workspaceListActions.setFilterChips(filters));
|
|
8574
|
+
}
|
|
8575
|
+
}, [dispatch, isAdmin, lastAdmin]);
|
|
8576
|
+
};
|
|
8577
|
+
|
|
8578
|
+
var WorkspaceMenuButtonConnect = function WorkspaceMenuButtonConnect(_ref) {
|
|
8579
|
+
var title = _ref.title,
|
|
8580
|
+
workspaceId = _ref.workspaceId,
|
|
8581
|
+
activeTab = _ref.activeTab,
|
|
8582
|
+
appTitle = _ref.appTitle;
|
|
8583
|
+
var dispatch = useDispatch();
|
|
8584
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
8585
|
+
t = _useWorkspaceTranslat.t;
|
|
8586
|
+
var hasChanges = useSelector(function (store) {
|
|
8587
|
+
return hasWorkspaceChanges(store);
|
|
8588
|
+
});
|
|
8589
|
+
var isWorkspaceListDialogOpen = useSelector(function (store) {
|
|
8590
|
+
return getIsWorkspaceListDialogOpen(store);
|
|
8591
|
+
});
|
|
8592
|
+
var setListDialogOpen = React.useCallback(function (isListDialogOpen) {
|
|
8593
|
+
dispatch(workspaceListActions.toggleWorkspaceDialog({
|
|
8594
|
+
isWorkspaceListDialogOpen: isListDialogOpen
|
|
8595
|
+
}));
|
|
8596
|
+
}, [dispatch]);
|
|
8597
|
+
useFetchWorkspacePresets();
|
|
8598
|
+
var isNew = workspaceId === undefined || workspaceId === '';
|
|
8599
|
+
var fullTitle = getPresetTitle(title, hasChanges, isNew, t);
|
|
8600
|
+
React.useEffect(function () {
|
|
8601
|
+
setDocumentTitle(fullTitle, appTitle);
|
|
8602
|
+
}, [fullTitle, appTitle]);
|
|
8603
|
+
return jsx(WorkspaceMenuButton, {
|
|
8604
|
+
title: fullTitle,
|
|
8605
|
+
activeTab: activeTab,
|
|
8606
|
+
hasChanges: hasChanges,
|
|
8607
|
+
showMenu: isWorkspaceListDialogOpen,
|
|
8608
|
+
onToggleDialog: setListDialogOpen
|
|
8553
8609
|
});
|
|
8554
8610
|
};
|
|
8555
8611
|
|
|
@@ -8565,11 +8621,14 @@ var WorkspaceTab = function WorkspaceTab(_ref) {
|
|
|
8565
8621
|
alignItems: 'center'
|
|
8566
8622
|
},
|
|
8567
8623
|
"data-testid": "workspaceTab",
|
|
8568
|
-
children: [jsx(WorkspaceMenuButtonConnect, {
|
|
8624
|
+
children: [jsx(WorkspaceMenuButtonConnect, {
|
|
8569
8625
|
title: title,
|
|
8570
|
-
activeTab: activeTab,
|
|
8571
8626
|
workspaceId: workspaceId,
|
|
8627
|
+
activeTab: activeTab,
|
|
8572
8628
|
appTitle: appTitle
|
|
8629
|
+
}), jsx(WorkspaceOptionsConnect, {
|
|
8630
|
+
title: title,
|
|
8631
|
+
workspaceId: workspaceId
|
|
8573
8632
|
})]
|
|
8574
8633
|
});
|
|
8575
8634
|
};
|