@opengeoweb/workspace 13.0.0 → 13.2.1
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 +1534 -1450
- package/package.json +15 -15
- 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/viewPresets/selectors.d.ts +29 -28
- package/src/lib/store/workspace/selectors.d.ts +13 -279
- package/src/lib/store/workspace/types.d.ts +2 -1
- package/src/lib/store/workspaceList/selectors.d.ts +1 -21
package/index.esm.js
CHANGED
|
@@ -9,7 +9,7 @@ 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';
|
|
@@ -20,7 +20,7 @@ import { coreTranslations, CORE_NAMESPACE } 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';
|
|
@@ -111,7 +111,9 @@ var en = {
|
|
|
111
111
|
"workspace-viewpreset-success-share": "View preset \"{{TITLE}}\" has been successfully shared",
|
|
112
112
|
"workspace-viewpreset-success-unshare": "View preset \"{{TITLE}}\" has been successfully unshared",
|
|
113
113
|
"workspace-loading-indicator-loading": "Loading",
|
|
114
|
-
"workspace-loading-indicator-idle": "Loaded"
|
|
114
|
+
"workspace-loading-indicator-idle": "Loaded",
|
|
115
|
+
"workspace-open-tab": "Open in new tab",
|
|
116
|
+
"workspace-currently": "Currently"
|
|
115
117
|
};
|
|
116
118
|
var fi = {
|
|
117
119
|
"workspace-menu": "Workspace menu",
|
|
@@ -194,7 +196,8 @@ var fi = {
|
|
|
194
196
|
"workspace-viewpreset-success-share": "ei käännetty",
|
|
195
197
|
"workspace-viewpreset-success-unshare": "ei käännetty",
|
|
196
198
|
"workspace-loading-indicator-loading": "Ladataan",
|
|
197
|
-
"workspace-loading-indicator-idle": "Ladattu"
|
|
199
|
+
"workspace-loading-indicator-idle": "Ladattu",
|
|
200
|
+
"workspace-currently": "Nykyinen"
|
|
198
201
|
};
|
|
199
202
|
var no = {
|
|
200
203
|
"workspace-menu": "Arbeidsflater",
|
|
@@ -278,7 +281,8 @@ var no = {
|
|
|
278
281
|
"workspace-viewpreset-success-share": "Vinduet \"{{TITLE}}\" har blitt delt",
|
|
279
282
|
"workspace-viewpreset-success-unshare": "Vinduet \"{{TITLE}}\" deles ikke lenger",
|
|
280
283
|
"workspace-loading-indicator-loading": "Laster inn",
|
|
281
|
-
"workspace-loading-indicator-idle": "Lastet inn"
|
|
284
|
+
"workspace-loading-indicator-idle": "Lastet inn",
|
|
285
|
+
"workspace-currently": "Nåværende"
|
|
282
286
|
};
|
|
283
287
|
var nl = {
|
|
284
288
|
"workspace-menu": "Workspace menu",
|
|
@@ -364,7 +368,9 @@ var nl = {
|
|
|
364
368
|
"workspace-viewpreset-success-share": "niet vertaald",
|
|
365
369
|
"workspace-viewpreset-success-unshare": "niet vertaald",
|
|
366
370
|
"workspace-loading-indicator-loading": "Aan het laden",
|
|
367
|
-
"workspace-loading-indicator-idle": "Klaar met laden"
|
|
371
|
+
"workspace-loading-indicator-idle": "Klaar met laden",
|
|
372
|
+
"workspace-open-tab": "Open in nieuw tabblad",
|
|
373
|
+
"workspace-currently": "Huidig"
|
|
368
374
|
};
|
|
369
375
|
var workspaceTranslations = {
|
|
370
376
|
en: en,
|
|
@@ -895,6 +901,7 @@ var WorkspacePresetAction;
|
|
|
895
901
|
WorkspacePresetAction["RESET"] = "RESET";
|
|
896
902
|
WorkspacePresetAction["DELETE_SYSTEM_PRESET"] = "DELETE_SYSTEM_PRESET";
|
|
897
903
|
WorkspacePresetAction["SHARE"] = "SHARE";
|
|
904
|
+
WorkspacePresetAction["OPEN_TAB"] = "OPEN_TAB";
|
|
898
905
|
})(WorkspacePresetAction || (WorkspacePresetAction = {}));
|
|
899
906
|
var WorkspaceErrorType;
|
|
900
907
|
(function (WorkspaceErrorType) {
|
|
@@ -2076,12 +2083,13 @@ var getViewPresetsStore = function getViewPresetsStore(store) {
|
|
|
2076
2083
|
}
|
|
2077
2084
|
return initialState$2;
|
|
2078
2085
|
};
|
|
2086
|
+
var EMPTY_VIEW_PRESETS = {
|
|
2087
|
+
entities: {},
|
|
2088
|
+
ids: []
|
|
2089
|
+
};
|
|
2079
2090
|
var selectors$2 = viewPresetsAdapter.getSelectors(function (state) {
|
|
2080
2091
|
var _state$viewPresets;
|
|
2081
|
-
return (_state$viewPresets = state == null ? void 0 : state.viewPresets) != null ? _state$viewPresets :
|
|
2082
|
-
entities: {},
|
|
2083
|
-
ids: []
|
|
2084
|
-
};
|
|
2092
|
+
return (_state$viewPresets = state == null ? void 0 : state.viewPresets) != null ? _state$viewPresets : EMPTY_VIEW_PRESETS;
|
|
2085
2093
|
});
|
|
2086
2094
|
var getViewPresets = selectors$2.selectAll,
|
|
2087
2095
|
getViewPresetById = selectors$2.selectById;
|
|
@@ -2290,18 +2298,9 @@ var emptyViewPreset = function emptyViewPreset(componentType) {
|
|
|
2290
2298
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2291
2299
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2292
2300
|
* */
|
|
2293
|
-
var
|
|
2301
|
+
var getWorkspaceState = function getWorkspaceState(store) {
|
|
2294
2302
|
return (store == null ? void 0 : store.workspace) || initialState$1;
|
|
2295
2303
|
};
|
|
2296
|
-
/**
|
|
2297
|
-
* Gets workspace state
|
|
2298
|
-
*
|
|
2299
|
-
* @param {object} store store: object - Store object
|
|
2300
|
-
* @returns {object} returnType: WorkspaceState
|
|
2301
|
-
*/
|
|
2302
|
-
var getWorkspaceState = createSelector(workspaceStore, function (store) {
|
|
2303
|
-
return store || initialState$1;
|
|
2304
|
-
}, selectorMemoizationOptions);
|
|
2305
2304
|
/**
|
|
2306
2305
|
* Gets component types from the views used in the workspace
|
|
2307
2306
|
*
|
|
@@ -2349,7 +2348,7 @@ var getViewsById = createSelector(getWorkspaceState, function (store) {
|
|
|
2349
2348
|
* @param {object} store store: object - Store object
|
|
2350
2349
|
* @returns {object} returnType: string[]
|
|
2351
2350
|
*/
|
|
2352
|
-
var getViewIds = createSelector(
|
|
2351
|
+
var getViewIds = createSelector(getWorkspaceState, function (store) {
|
|
2353
2352
|
return store.views.allIds || [];
|
|
2354
2353
|
}, selectorMemoizationOptions);
|
|
2355
2354
|
/**
|
|
@@ -2374,7 +2373,7 @@ var getWorkspaceError = createSelector(getWorkspaceState, function (store) {
|
|
|
2374
2373
|
* @param {object} store store: object - Store object
|
|
2375
2374
|
* @returns {string} returnType: string
|
|
2376
2375
|
*/
|
|
2377
|
-
var getSelectedWorkspaceTitle = createSelector(
|
|
2376
|
+
var getSelectedWorkspaceTitle = createSelector(getWorkspaceState, function (store) {
|
|
2378
2377
|
return store && store.title || '';
|
|
2379
2378
|
}, selectorMemoizationOptions);
|
|
2380
2379
|
var hasWorkspaceChanges = createSelector(getWorkspaceState, function (store) {
|
|
@@ -2395,7 +2394,7 @@ var getViewType = createSelector(getWorkspaceState, function (store) {
|
|
|
2395
2394
|
* @param {object} store store: object - Store object
|
|
2396
2395
|
* @returns {string} returnType: string
|
|
2397
2396
|
*/
|
|
2398
|
-
var getSelectedWorkspaceScope = createSelector(
|
|
2397
|
+
var getSelectedWorkspaceScope = createSelector(getWorkspaceState, function (store) {
|
|
2399
2398
|
return store && store.scope || 'system';
|
|
2400
2399
|
}, selectorMemoizationOptions);
|
|
2401
2400
|
/**
|
|
@@ -6366,6 +6365,11 @@ var WorkspaceSelectListRow = function WorkspaceSelectListRow(_ref) {
|
|
|
6366
6365
|
action: function action() {
|
|
6367
6366
|
return _onClick(WorkspacePresetAction.DUPLICATE);
|
|
6368
6367
|
}
|
|
6368
|
+
}, {
|
|
6369
|
+
text: t('workspace-open-tab'),
|
|
6370
|
+
action: function action() {
|
|
6371
|
+
return _onClick(WorkspacePresetAction.OPEN_TAB);
|
|
6372
|
+
}
|
|
6369
6373
|
}];
|
|
6370
6374
|
// Show "Edit" if it's your own user-scoped preset OR you're an admin
|
|
6371
6375
|
if (workspacePreset.scope === SystemScope.user && (auth == null ? void 0 : auth.username) === workspacePreset.username || isAdmin) {
|
|
@@ -6411,8 +6415,13 @@ var WorkspaceSelectListRow = function WorkspaceSelectListRow(_ref) {
|
|
|
6411
6415
|
children: jsxs(ListItemButton, {
|
|
6412
6416
|
"data-testid": testIdPrefix + "-selectListRow",
|
|
6413
6417
|
selected: isSelected,
|
|
6414
|
-
onClick: function onClick() {
|
|
6415
|
-
|
|
6418
|
+
onClick: function onClick(event) {
|
|
6419
|
+
if (event.ctrlKey || event.metaKey) {
|
|
6420
|
+
var url = getWorkspaceRouteUrl(workspacePreset.id);
|
|
6421
|
+
window.open(url, '_blank');
|
|
6422
|
+
} else {
|
|
6423
|
+
onClickWorkspacePreset(workspacePreset.id);
|
|
6424
|
+
}
|
|
6416
6425
|
},
|
|
6417
6426
|
sx: {
|
|
6418
6427
|
padding: 1,
|
|
@@ -6858,1555 +6867,1548 @@ var ViewPresetMenu = function ViewPresetMenu(_ref) {
|
|
|
6858
6867
|
});
|
|
6859
6868
|
};
|
|
6860
6869
|
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6874
|
-
|
|
6875
|
-
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
setAnchorEl = _React$useState[1];
|
|
6885
|
-
var isOpen = Boolean(anchorEl);
|
|
6886
|
-
var handleClick = function handleClick(event) {
|
|
6887
|
-
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
6888
|
-
};
|
|
6889
|
-
React.useEffect(function () {
|
|
6890
|
-
if (isDefaultOpen) {
|
|
6891
|
-
setAnchorEl(document.getElementById(id));
|
|
6892
|
-
}
|
|
6893
|
-
}, [isDefaultOpen, id]);
|
|
6894
|
-
var options = [{
|
|
6895
|
-
title: t('workspace-save'),
|
|
6896
|
-
callback: handleSave
|
|
6897
|
-
}, {
|
|
6898
|
-
title: t('workspace-save-as'),
|
|
6899
|
-
callback: handleSaveAs
|
|
6900
|
-
}, {
|
|
6901
|
-
title: t('workspace-edit'),
|
|
6902
|
-
callback: handleEdit
|
|
6903
|
-
}, {
|
|
6904
|
-
title: t('workspace-reset'),
|
|
6905
|
-
callback: handleReset
|
|
6906
|
-
}, {
|
|
6907
|
-
title: t('workspace-delete'),
|
|
6908
|
-
callback: handleDelete
|
|
6909
|
-
}];
|
|
6910
|
-
var renderButton = function renderButton() {
|
|
6911
|
-
return jsxs(CustomToggleButton, {
|
|
6912
|
-
variant: "tool",
|
|
6913
|
-
selected: isOpen,
|
|
6914
|
-
onClick: handleClick,
|
|
6915
|
-
id: id,
|
|
6916
|
-
"data-testid": id,
|
|
6917
|
-
disableRipple: true,
|
|
6918
|
-
disabled: isDisabled,
|
|
6919
|
-
sx: {
|
|
6920
|
-
fontSize: '12px',
|
|
6921
|
-
'&&': {
|
|
6922
|
-
color: activeTab && !isOpen ? 'geowebColors.buttons.icon.active.color' : undefined,
|
|
6923
|
-
backgroundColor: !isOpen ? 'transparent' : undefined,
|
|
6924
|
-
'&:hover': {
|
|
6925
|
-
color: activeTab ? 'geowebColors.buttons.icon.active.color' : 'inherit',
|
|
6926
|
-
backgroundColor: 'geowebColors.workspace.tabButtonHover'
|
|
6927
|
-
},
|
|
6928
|
-
paddingRight: '4px !important',
|
|
6929
|
-
display: 'block',
|
|
6930
|
-
width: '100%',
|
|
6931
|
-
height: 20,
|
|
6932
|
-
fontStyle: hasChanges ? 'italic' : undefined,
|
|
6933
|
-
fontWeight: 500,
|
|
6934
|
-
textOverflow: 'ellipsis',
|
|
6935
|
-
overflow: 'hidden',
|
|
6936
|
-
whiteSpace: 'nowrap',
|
|
6937
|
-
lineHeight: '1px',
|
|
6938
|
-
textAlign: 'left',
|
|
6939
|
-
textTransform: 'none',
|
|
6940
|
-
'&.MuiButtonBase-root': {
|
|
6941
|
-
paddingLeft: 1,
|
|
6942
|
-
paddingTop: 1,
|
|
6943
|
-
paddingBottom: 1,
|
|
6944
|
-
border: 'none'
|
|
6945
|
-
}
|
|
6946
|
-
}
|
|
6947
|
-
},
|
|
6948
|
-
role: "button",
|
|
6949
|
-
children: [title, panelId && jsx(Box, {
|
|
6950
|
-
component: "span",
|
|
6951
|
-
sx: {
|
|
6952
|
-
fontStyle: 'normal',
|
|
6953
|
-
marginLeft: 1,
|
|
6954
|
-
color: 'geowebColors.captions.captionStatus.rgba'
|
|
6955
|
-
},
|
|
6956
|
-
children: panelId
|
|
6957
|
-
}), jsxs(Menu, {
|
|
6958
|
-
BackdropProps: {
|
|
6959
|
-
style: {
|
|
6960
|
-
opacity: 0,
|
|
6961
|
-
transition: 'none'
|
|
6962
|
-
}
|
|
6963
|
-
},
|
|
6964
|
-
open: isOpen,
|
|
6965
|
-
anchorEl: anchorEl,
|
|
6966
|
-
anchorOrigin: {
|
|
6967
|
-
vertical: 21,
|
|
6968
|
-
horizontal: 6
|
|
6969
|
-
},
|
|
6970
|
-
sx: {
|
|
6971
|
-
'& .MuiMenu-list': {
|
|
6972
|
-
padding: 0
|
|
6973
|
-
},
|
|
6974
|
-
'& .MuiMenuItem-root': {
|
|
6975
|
-
fontSize: 16
|
|
6976
|
-
}
|
|
6977
|
-
},
|
|
6978
|
-
children: [jsx(ListSubheader, {
|
|
6979
|
-
sx: {
|
|
6980
|
-
paddingTop: '8px'
|
|
6981
|
-
},
|
|
6982
|
-
children: jsx(Typography, {
|
|
6983
|
-
sx: {
|
|
6984
|
-
letterSpacing: '0.4px',
|
|
6985
|
-
fontSize: 12
|
|
6986
|
-
},
|
|
6987
|
-
children: t('workspace-options')
|
|
6988
|
-
})
|
|
6989
|
-
}), options.map(function (_ref2) {
|
|
6990
|
-
var title = _ref2.title,
|
|
6991
|
-
callback = _ref2.callback;
|
|
6992
|
-
return jsx(MenuItem, {
|
|
6993
|
-
onClick: callback,
|
|
6994
|
-
disabled: !callback,
|
|
6995
|
-
children: title
|
|
6996
|
-
}, title);
|
|
6997
|
-
})]
|
|
6998
|
-
})]
|
|
6999
|
-
});
|
|
7000
|
-
};
|
|
7001
|
-
return isDisabled ? renderButton() : jsx(CustomTooltip, {
|
|
7002
|
-
title: !isOpen && title,
|
|
7003
|
-
TransitionProps: {
|
|
7004
|
-
exit: false
|
|
7005
|
-
},
|
|
7006
|
-
children: renderButton()
|
|
7007
|
-
});
|
|
6870
|
+
/* *
|
|
6871
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6872
|
+
* you may not use this file except in compliance with the License.
|
|
6873
|
+
* You may obtain a copy of the License at
|
|
6874
|
+
*
|
|
6875
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6876
|
+
*
|
|
6877
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6878
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6879
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6880
|
+
* See the License for the specific language governing permissions and
|
|
6881
|
+
* limitations under the License.
|
|
6882
|
+
*
|
|
6883
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
6884
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
6885
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
6886
|
+
* */
|
|
6887
|
+
var config = sessionStorageProvider.getConfig();
|
|
6888
|
+
var presetBaseUrl = (config == null ? void 0 : config.GW_PRESET_BACKEND_URL) || '';
|
|
6889
|
+
var getWorkspace = function getWorkspace(workspaceId, auth) {
|
|
6890
|
+
return fetch(presetBaseUrl + "/workspacepreset/" + workspaceId, {
|
|
6891
|
+
headers: getHeaders(auth)
|
|
6892
|
+
}).then(handleResponse);
|
|
7008
6893
|
};
|
|
7009
|
-
var
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
return loadingIndicatorSelectors.isLoading(store, panelId);
|
|
7015
|
-
});
|
|
7016
|
-
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7017
|
-
t = _useWorkspaceTranslat.t;
|
|
7018
|
-
return jsx(CustomTooltip, {
|
|
7019
|
-
title: isLoading ? t('workspace-loading-indicator-loading') : t('workspace-loading-indicator-idle'),
|
|
7020
|
-
children: jsx("span", {
|
|
7021
|
-
style: {
|
|
7022
|
-
height: '100%'
|
|
7023
|
-
},
|
|
7024
|
-
children: isLoading ? jsx(CloudLoading, {
|
|
7025
|
-
"data-testid": "cloudicon-loading",
|
|
7026
|
-
style: {
|
|
7027
|
-
fill: '#186DFF'
|
|
7028
|
-
}
|
|
7029
|
-
}) : jsx(CloudIdle, {
|
|
7030
|
-
"data-testid": "cloudicon-idle"
|
|
7031
|
-
})
|
|
7032
|
-
})
|
|
7033
|
-
});
|
|
6894
|
+
var deleteWorkspace = function deleteWorkspace(workspaceId, auth) {
|
|
6895
|
+
return fetch(presetBaseUrl + "/workspacepreset/" + workspaceId, {
|
|
6896
|
+
headers: getHeaders(auth),
|
|
6897
|
+
method: 'DELETE'
|
|
6898
|
+
}).then(handleResponse);
|
|
7034
6899
|
};
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7040
|
-
|
|
7041
|
-
'&&': {
|
|
7042
|
-
backgroundColor: !isViewPresetDialogOpen ? 'transparent' : undefined,
|
|
7043
|
-
'&:hover': {
|
|
7044
|
-
backgroundColor: 'geowebColors.workspace.tabButtonHover'
|
|
7045
|
-
},
|
|
7046
|
-
'.MuiSvgIcon-root > path': {
|
|
7047
|
-
fill: isViewPresetDialogOpen ? theme.palette.geowebColors.iconButtons.tool.active.color : undefined
|
|
7048
|
-
}
|
|
7049
|
-
}
|
|
7050
|
-
};
|
|
6900
|
+
var updateWorkspace = function updateWorkspace(workspaceId, data, auth) {
|
|
6901
|
+
return fetch(presetBaseUrl + "/workspacepreset/" + workspaceId, {
|
|
6902
|
+
headers: getHeaders(auth),
|
|
6903
|
+
method: 'PUT',
|
|
6904
|
+
body: JSON.stringify(data)
|
|
6905
|
+
}).then(handleResponse);
|
|
7051
6906
|
};
|
|
7052
|
-
var
|
|
7053
|
-
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
6907
|
+
var createWorkspace = function createWorkspace(data, auth) {
|
|
6908
|
+
return fetch(presetBaseUrl + "/workspacepreset", {
|
|
6909
|
+
headers: getHeaders(auth),
|
|
6910
|
+
method: 'POST',
|
|
6911
|
+
body: JSON.stringify(data)
|
|
6912
|
+
}).then(handleResponse);
|
|
6913
|
+
};
|
|
6914
|
+
|
|
6915
|
+
var WorkspaceSelectListConnect = function WorkspaceSelectListConnect() {
|
|
6916
|
+
var _GENERIC$AUTH$error$c;
|
|
7060
6917
|
var _useAuthenticationCon = useAuthenticationContext(),
|
|
7061
6918
|
currentRole = _useAuthenticationCon.currentRole,
|
|
7062
6919
|
isLoggedIn = _useAuthenticationCon.isLoggedIn,
|
|
7063
6920
|
auth = _useAuthenticationCon.auth;
|
|
6921
|
+
var username = (auth == null ? void 0 : auth.username) || '';
|
|
7064
6922
|
var isAdmin = (currentRole == null ? void 0 : currentRole.name) === GEOWEB_ROLE_PRESETS_ADMIN.name;
|
|
7065
|
-
var
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
title = _ref2.title,
|
|
7069
|
-
scope = _ref2.scope,
|
|
7070
|
-
restProps = _objectWithoutPropertiesLoose(_ref2, _excluded$4);
|
|
7071
|
-
return Object.assign({
|
|
7072
|
-
title: title,
|
|
7073
|
-
scope: scope
|
|
7074
|
-
}, restProps);
|
|
7075
|
-
}, shallowEqual);
|
|
7076
|
-
var viewComponentType = useSelector(function (store) {
|
|
7077
|
-
return getViewComponentType(store, panelId);
|
|
6923
|
+
var scope = !isAdmin ? 'user' : 'system';
|
|
6924
|
+
var workspacePresets = useSelector(function (store) {
|
|
6925
|
+
return getWorkspaceList(store);
|
|
7078
6926
|
});
|
|
7079
|
-
var
|
|
7080
|
-
|
|
6927
|
+
var selectedFilters = useSelector(getWorkspaceListFilters);
|
|
6928
|
+
var filteredPresets = React.useMemo(function () {
|
|
6929
|
+
return filterAndSortPresets(workspacePresets, selectedFilters, username, isAdmin);
|
|
6930
|
+
}, [workspacePresets, selectedFilters, username, isAdmin]);
|
|
6931
|
+
var currentView = useSelector(function (store) {
|
|
6932
|
+
return getWorkspaceState(store);
|
|
7081
6933
|
});
|
|
7082
|
-
var
|
|
7083
|
-
return
|
|
6934
|
+
var workspaceListFilters = useSelector(function (store) {
|
|
6935
|
+
return getWorkspaceListFilters(store, scope, isAdmin);
|
|
7084
6936
|
});
|
|
7085
|
-
var
|
|
7086
|
-
return
|
|
6937
|
+
var workspaceSearchQuery = useSelector(function (store) {
|
|
6938
|
+
return getWorkspaceListSearchQuery(store);
|
|
7087
6939
|
});
|
|
7088
|
-
var
|
|
7089
|
-
return
|
|
6940
|
+
var isFetching = useSelector(function (store) {
|
|
6941
|
+
return getIsWorkspaceListFetching(store);
|
|
7090
6942
|
});
|
|
7091
|
-
var
|
|
7092
|
-
|
|
7093
|
-
|
|
7094
|
-
var
|
|
7095
|
-
var
|
|
7096
|
-
|
|
7097
|
-
|
|
7098
|
-
|
|
6943
|
+
var error = useSelector(function (store) {
|
|
6944
|
+
return getWorkspaceListError(store);
|
|
6945
|
+
});
|
|
6946
|
+
var dispatch = useDispatch();
|
|
6947
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
6948
|
+
t = _useWorkspaceTranslat.t;
|
|
6949
|
+
var fetchWorkspaceList = React.useCallback(function () {
|
|
6950
|
+
var filterParams = constructFilterParams([], workspaceSearchQuery);
|
|
6951
|
+
dispatch(workspaceListActions.fetchWorkspaceList(filterParams));
|
|
6952
|
+
}, [dispatch, workspaceSearchQuery]);
|
|
6953
|
+
var fetchWorkspace = React.useCallback(function (workspaceId) {
|
|
6954
|
+
dispatch(workspaceActions.fetchWorkspace({
|
|
6955
|
+
workspaceId: workspaceId
|
|
7099
6956
|
}));
|
|
7100
6957
|
}, [dispatch]);
|
|
7101
|
-
var
|
|
7102
|
-
|
|
7103
|
-
});
|
|
7104
|
-
var
|
|
7105
|
-
|
|
7106
|
-
|
|
7107
|
-
|
|
7108
|
-
|
|
7109
|
-
return timeSeriesSelectors.getTimeSeriesPreset(store.getState());
|
|
7110
|
-
case 'Map':
|
|
7111
|
-
return {
|
|
7112
|
-
mapPreset: mapSelectors.getMapPreset(store.getState(), panelId),
|
|
7113
|
-
syncGroupsIds: relatedSyncGroupIds
|
|
7114
|
-
};
|
|
7115
|
-
default:
|
|
7116
|
-
return undefined;
|
|
7117
|
-
}
|
|
7118
|
-
}, [currentWarningsPreset, panelId, relatedSyncGroupIds, store, viewComponentType]);
|
|
7119
|
-
var onSave = React.useCallback(function () {
|
|
7120
|
-
dispatch(viewPresetActions.saveViewPreset({
|
|
7121
|
-
panelId: panelId,
|
|
7122
|
-
viewPresetId: activeViewPresetId,
|
|
7123
|
-
viewPreset: Object.assign({}, emptyViewPreset(viewComponentType), {
|
|
7124
|
-
title: title,
|
|
7125
|
-
initialProps: constructInitialProps()
|
|
7126
|
-
})
|
|
6958
|
+
var setWorkspaceActionDialogOptions = React.useCallback(function (dialogOptions) {
|
|
6959
|
+
dispatch(workspaceListActions.openWorkspaceActionDialogOptions(dialogOptions));
|
|
6960
|
+
}, [dispatch]);
|
|
6961
|
+
var toggleSelectFilterChip = React.useCallback(function (id, isSelected) {
|
|
6962
|
+
dispatch(workspaceListActions.toggleSelectFilterChip({
|
|
6963
|
+
id: id,
|
|
6964
|
+
isSelected: isSelected,
|
|
6965
|
+
isAdmin: isAdmin
|
|
7127
6966
|
}));
|
|
7128
|
-
}, [
|
|
7129
|
-
var
|
|
7130
|
-
|
|
7131
|
-
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
formValues: {
|
|
7136
|
-
title: title,
|
|
7137
|
-
"abstract": presetAbstract
|
|
7138
|
-
}
|
|
7139
|
-
});
|
|
7140
|
-
}, [activeViewPresetId, openViewPresetsDialog, panelId, title, presetAbstract, t]);
|
|
7141
|
-
var onSaveAs = React.useCallback(function () {
|
|
7142
|
-
var formTitle = activeViewPresetId ? title : '';
|
|
7143
|
-
openViewPresetsDialog({
|
|
7144
|
-
title: t('workspace-mappreset-save-as'),
|
|
7145
|
-
action: PresetAction.SAVE_AS,
|
|
7146
|
-
viewPresetId: activeViewPresetId,
|
|
7147
|
-
panelId: panelId,
|
|
7148
|
-
formValues: {
|
|
7149
|
-
title: formTitle,
|
|
7150
|
-
initialProps: constructInitialProps(),
|
|
7151
|
-
"abstract": presetAbstract
|
|
7152
|
-
}
|
|
7153
|
-
});
|
|
7154
|
-
}, [activeViewPresetId, constructInitialProps, openViewPresetsDialog, panelId, t, title, presetAbstract]);
|
|
7155
|
-
var onEdit = React.useCallback(function () {
|
|
7156
|
-
var formTitle = activeViewPresetId ? title : '';
|
|
7157
|
-
openViewPresetsDialog({
|
|
7158
|
-
title: t('workspace-mappreset-dialog-title-edit'),
|
|
7159
|
-
action: PresetAction.EDIT,
|
|
7160
|
-
panelId: panelId,
|
|
7161
|
-
viewPresetId: activeViewPresetId,
|
|
7162
|
-
formValues: {
|
|
7163
|
-
title: formTitle,
|
|
7164
|
-
initialProps: constructInitialProps(),
|
|
7165
|
-
"abstract": presetAbstract
|
|
7166
|
-
}
|
|
7167
|
-
});
|
|
7168
|
-
}, [activeViewPresetId, constructInitialProps, openViewPresetsDialog, panelId, t, title, presetAbstract]);
|
|
7169
|
-
var onReset = React.useCallback(function () {
|
|
7170
|
-
openViewPresetsDialog({
|
|
7171
|
-
title: t('workspace-reset-title'),
|
|
7172
|
-
action: PresetAction.RESET,
|
|
7173
|
-
viewPresetId: activeViewPresetId,
|
|
7174
|
-
panelId: panelId,
|
|
7175
|
-
formValues: {
|
|
7176
|
-
title: title
|
|
7177
|
-
}
|
|
7178
|
-
});
|
|
7179
|
-
}, [activeViewPresetId, openViewPresetsDialog, panelId, t, title]);
|
|
7180
|
-
var toggleViewPresetDialog = React.useCallback(function (_ref3) {
|
|
7181
|
-
var panelId = _ref3.panelId,
|
|
7182
|
-
isViewPresetDialogOpen = _ref3.isViewPresetDialogOpen;
|
|
7183
|
-
dispatch(viewPresetActions.toggleViewPresetListDialog({
|
|
7184
|
-
panelId: panelId,
|
|
7185
|
-
isViewPresetListDialogOpen: isViewPresetDialogOpen
|
|
6967
|
+
}, [dispatch, isAdmin]);
|
|
6968
|
+
var setSelectAllFilterChip = React.useCallback(function () {
|
|
6969
|
+
dispatch(workspaceListActions.setSelectAllFilterChip());
|
|
6970
|
+
}, [dispatch]);
|
|
6971
|
+
var searchFilter = React.useCallback(function (searchQuery) {
|
|
6972
|
+
dispatch(workspaceListActions.searchFilter({
|
|
6973
|
+
searchQuery: searchQuery
|
|
7186
6974
|
}));
|
|
7187
6975
|
}, [dispatch]);
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
6976
|
+
// If we're loading the `New workspace` preset as defined in the FE, use this instead of retrieving from BE
|
|
6977
|
+
var onClickNewPreset = React.useCallback(function () {
|
|
6978
|
+
dispatch(routerActions.navigateToUrl({
|
|
6979
|
+
url: getWorkspaceRouteUrl()
|
|
6980
|
+
}));
|
|
6981
|
+
dispatch(workspaceListActions.toggleWorkspaceDialog({
|
|
6982
|
+
isWorkspaceListDialogOpen: false
|
|
6983
|
+
}));
|
|
6984
|
+
dispatch(workspaceActions.changeToEmptyMapWorkspace({
|
|
6985
|
+
newMapPresetText: t('workspace-mappreset-new'),
|
|
6986
|
+
newWorkspaceText: t('workspace-new')
|
|
6987
|
+
}));
|
|
6988
|
+
}, [dispatch, t]);
|
|
6989
|
+
var onClickWorkspacePreset = function onClickWorkspacePreset(id) {
|
|
6990
|
+
if (id === getEmptyMapWorkspace(t).id) {
|
|
6991
|
+
onClickNewPreset();
|
|
6992
|
+
} else if (!isFetching) {
|
|
6993
|
+
fetchWorkspace(id);
|
|
6994
|
+
}
|
|
6995
|
+
};
|
|
6996
|
+
var onClickFilterChip = function onClickFilterChip(id, shouldSelect) {
|
|
6997
|
+
if (id === 'all') {
|
|
6998
|
+
if (shouldSelect) {
|
|
6999
|
+
setSelectAllFilterChip();
|
|
7000
|
+
}
|
|
7001
|
+
} else {
|
|
7002
|
+
toggleSelectFilterChip(id, shouldSelect);
|
|
7003
|
+
}
|
|
7004
|
+
};
|
|
7005
|
+
var onClickWorkspacePresetOption = function onClickWorkspacePresetOption(presetId, workspaceAction) {
|
|
7006
|
+
// If affectedPreset is the FE defined `New workspace` - use the definition from FE instead of BE
|
|
7007
|
+
var affectedPreset = presetId === getEmptyMapWorkspace(t).id ? getEmptyMapWorkspace(t) : workspacePresets.find(function (preset) {
|
|
7008
|
+
return preset.id === presetId;
|
|
7192
7009
|
});
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7010
|
+
var presetTitle = affectedPreset == null ? void 0 : affectedPreset.title;
|
|
7011
|
+
switch (workspaceAction) {
|
|
7012
|
+
case WorkspacePresetAction.DUPLICATE:
|
|
7013
|
+
case WorkspacePresetAction.EDIT:
|
|
7014
|
+
{
|
|
7015
|
+
setWorkspaceActionDialogOptions({
|
|
7016
|
+
action: workspaceAction,
|
|
7017
|
+
presetId: presetId,
|
|
7018
|
+
formValues: {
|
|
7019
|
+
title: presetTitle,
|
|
7020
|
+
"abstract": affectedPreset["abstract"],
|
|
7021
|
+
scope: scope
|
|
7022
|
+
}
|
|
7023
|
+
});
|
|
7024
|
+
break;
|
|
7025
|
+
}
|
|
7026
|
+
// case WorkspacePresetAction.SAVE: {
|
|
7027
|
+
// break;
|
|
7028
|
+
// }
|
|
7029
|
+
case WorkspacePresetAction.DELETE:
|
|
7030
|
+
{
|
|
7031
|
+
setWorkspaceActionDialogOptions({
|
|
7032
|
+
action: workspaceAction,
|
|
7033
|
+
presetId: presetId,
|
|
7034
|
+
formValues: {
|
|
7035
|
+
title: presetTitle,
|
|
7036
|
+
scope: scope
|
|
7037
|
+
}
|
|
7038
|
+
});
|
|
7039
|
+
break;
|
|
7040
|
+
}
|
|
7041
|
+
case WorkspacePresetAction.DELETE_SYSTEM_PRESET:
|
|
7042
|
+
{
|
|
7043
|
+
setWorkspaceActionDialogOptions({
|
|
7044
|
+
action: workspaceAction,
|
|
7045
|
+
presetId: presetId,
|
|
7046
|
+
formValues: {
|
|
7047
|
+
title: presetTitle,
|
|
7048
|
+
scope: scope
|
|
7049
|
+
}
|
|
7050
|
+
});
|
|
7051
|
+
break;
|
|
7052
|
+
}
|
|
7053
|
+
case WorkspacePresetAction.SHARE:
|
|
7054
|
+
{
|
|
7055
|
+
void getWorkspace(presetId, auth).then(function (preset) {
|
|
7056
|
+
return updateWorkspace(presetId, Object.assign({}, preset, {
|
|
7057
|
+
is_shared: !preset.is_shared
|
|
7058
|
+
}), auth).then(function () {
|
|
7059
|
+
dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
7060
|
+
workspaceId: presetId,
|
|
7061
|
+
action: WorkspacePresetAction.SHARE,
|
|
7062
|
+
title: presetTitle,
|
|
7063
|
+
scope: scope,
|
|
7064
|
+
is_shared: preset.is_shared
|
|
7065
|
+
}));
|
|
7066
|
+
fetchWorkspaceList();
|
|
7067
|
+
})["catch"](function (error) {
|
|
7068
|
+
dispatch(workspaceListActions.onErrorWorkspacePresetAction({
|
|
7069
|
+
error: {
|
|
7070
|
+
message: "" + error,
|
|
7071
|
+
type: WorkspaceListErrorType.VERBATIM_ERROR,
|
|
7072
|
+
category: WorkspaceListErrorCategory.GENERIC
|
|
7073
|
+
}
|
|
7074
|
+
}));
|
|
7075
|
+
});
|
|
7076
|
+
});
|
|
7077
|
+
break;
|
|
7078
|
+
}
|
|
7079
|
+
case WorkspacePresetAction.OPEN_TAB:
|
|
7080
|
+
{
|
|
7081
|
+
var url = getWorkspaceRouteUrl(presetId);
|
|
7082
|
+
window.open(url, '_blank');
|
|
7083
|
+
break;
|
|
7084
|
+
}
|
|
7085
|
+
}
|
|
7086
|
+
};
|
|
7087
|
+
var isAllSelected = workspaceListFilters.length > 0 && workspaceListFilters.every(function (filter) {
|
|
7088
|
+
return filter.isSelected;
|
|
7089
|
+
});
|
|
7090
|
+
var shouldHideNewWorkspace = !isAllSelected || workspaceSearchQuery.length > 0;
|
|
7091
|
+
return jsxs(Box, {
|
|
7092
|
+
"data-testid": "workspace-selectlist-connect",
|
|
7093
|
+
style: {
|
|
7094
|
+
display: 'flex',
|
|
7095
|
+
flexDirection: 'column',
|
|
7096
|
+
height: '100%'
|
|
7097
|
+
},
|
|
7098
|
+
tabIndex: 0,
|
|
7099
|
+
children: [isFetching && jsx(LinearProgress, {
|
|
7100
|
+
"data-testid": "loading-bar",
|
|
7101
|
+
color: "secondary",
|
|
7102
|
+
sx: {
|
|
7103
|
+
position: 'absolute',
|
|
7104
|
+
width: '100%',
|
|
7105
|
+
top: 0,
|
|
7106
|
+
left: 0
|
|
7107
|
+
}
|
|
7108
|
+
}), error && jsx("div", {
|
|
7109
|
+
style: {
|
|
7110
|
+
whiteSpace: 'normal'
|
|
7111
|
+
},
|
|
7112
|
+
children: jsx(AlertBanner, Object.assign({
|
|
7113
|
+
title: (_GENERIC$AUTH$error$c = {
|
|
7114
|
+
GENERIC: '',
|
|
7115
|
+
AUTH: t('workspace-error-auth')
|
|
7116
|
+
}[error.category]) != null ? _GENERIC$AUTH$error$c : t('workspace-error-fetch'),
|
|
7117
|
+
info: error.type === WorkspaceListErrorType.TRANSLATABLE_ERROR ? t(error.key, error.params) : error.message,
|
|
7118
|
+
shouldClose: true
|
|
7119
|
+
}, error.category === WorkspaceListErrorCategory.GENERIC && {
|
|
7120
|
+
actionButtonProps: {
|
|
7121
|
+
title: t('workspace-retry'),
|
|
7122
|
+
onClick: function onClick() {
|
|
7123
|
+
return fetchWorkspaceList();
|
|
7124
|
+
}
|
|
7125
|
+
}
|
|
7126
|
+
}))
|
|
7127
|
+
}), jsxs(Box, {
|
|
7210
7128
|
sx: {
|
|
7211
7129
|
display: 'flex',
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
|
|
7215
|
-
|
|
7130
|
+
flexDirection: 'column',
|
|
7131
|
+
height: '100%',
|
|
7132
|
+
padding: 1,
|
|
7133
|
+
overflow: 'hidden'
|
|
7216
7134
|
},
|
|
7217
|
-
children: [
|
|
7218
|
-
|
|
7219
|
-
|
|
7220
|
-
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7135
|
+
children: [!error && jsxs(Box, {
|
|
7136
|
+
sx: {
|
|
7137
|
+
marginBottom: 1
|
|
7138
|
+
},
|
|
7139
|
+
children: [jsx(Box, {
|
|
7140
|
+
sx: {
|
|
7141
|
+
display: 'flex',
|
|
7142
|
+
width: '100%'
|
|
7143
|
+
},
|
|
7144
|
+
children: jsx(Filter, {
|
|
7145
|
+
filters: workspaceListFilters,
|
|
7146
|
+
onClickFilterChip: onClickFilterChip,
|
|
7147
|
+
isAllSelected: isAllSelected,
|
|
7148
|
+
searchQuery: workspaceSearchQuery,
|
|
7149
|
+
onSearch: searchFilter
|
|
7150
|
+
})
|
|
7151
|
+
}), jsx(Box, {
|
|
7152
|
+
sx: {
|
|
7153
|
+
display: 'flex',
|
|
7154
|
+
justifyContent: 'flex-start'
|
|
7155
|
+
},
|
|
7156
|
+
children: jsx(LastUpdateTime, {
|
|
7157
|
+
onPressRefresh: function onPressRefresh() {
|
|
7158
|
+
return fetchWorkspaceList();
|
|
7159
|
+
},
|
|
7160
|
+
hideLabel: true
|
|
7161
|
+
})
|
|
7162
|
+
})]
|
|
7235
7163
|
}), jsx(Box, {
|
|
7236
7164
|
sx: {
|
|
7237
|
-
|
|
7165
|
+
flexGrow: 1,
|
|
7166
|
+
minHeight: 0
|
|
7167
|
+
},
|
|
7168
|
+
children: jsx(WorkspaceSelectList, {
|
|
7169
|
+
workspacePresets: filteredPresets,
|
|
7170
|
+
currentSelectedId: currentView.id || '',
|
|
7171
|
+
onClickWorkspacePreset: onClickWorkspacePreset,
|
|
7172
|
+
onClickWorkspacePresetOption: onClickWorkspacePresetOption,
|
|
7173
|
+
hideNewWorkspace: shouldHideNewWorkspace,
|
|
7174
|
+
isEditable: isLoggedIn,
|
|
7175
|
+
isAdmin: isAdmin,
|
|
7176
|
+
searchQuery: workspaceSearchQuery
|
|
7177
|
+
})
|
|
7178
|
+
})]
|
|
7179
|
+
})]
|
|
7180
|
+
});
|
|
7181
|
+
};
|
|
7182
|
+
|
|
7183
|
+
var WorkspaceMenu = function WorkspaceMenu(_ref) {
|
|
7184
|
+
var _ref$isOpen = _ref.isOpen,
|
|
7185
|
+
isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
|
|
7186
|
+
closeMenu = _ref.closeMenu;
|
|
7187
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7188
|
+
t = _useWorkspaceTranslat.t;
|
|
7189
|
+
return jsx(CustomDialog, {
|
|
7190
|
+
open: isOpen,
|
|
7191
|
+
onClose: function onClose() {
|
|
7192
|
+
if (closeMenu) {
|
|
7193
|
+
closeMenu();
|
|
7194
|
+
}
|
|
7195
|
+
},
|
|
7196
|
+
isResizable: true,
|
|
7197
|
+
hasLayout: false,
|
|
7198
|
+
resizableDefaultSize: {
|
|
7199
|
+
width: 380,
|
|
7200
|
+
height: '90%'
|
|
7201
|
+
},
|
|
7202
|
+
slotProps: {
|
|
7203
|
+
backdrop: {
|
|
7204
|
+
style: {
|
|
7205
|
+
top: 40
|
|
7206
|
+
}
|
|
7207
|
+
},
|
|
7208
|
+
root: {
|
|
7209
|
+
style: {
|
|
7210
|
+
top: 40
|
|
7211
|
+
}
|
|
7212
|
+
}
|
|
7213
|
+
},
|
|
7214
|
+
"data-testid": "workspace-menu",
|
|
7215
|
+
children: jsx(ToolContainer, {
|
|
7216
|
+
title: t('workspace-menu'),
|
|
7217
|
+
onClose: closeMenu,
|
|
7218
|
+
style: {
|
|
7219
|
+
width: '100%',
|
|
7220
|
+
height: '100%'
|
|
7221
|
+
},
|
|
7222
|
+
onClick: function onClick(event) {
|
|
7223
|
+
event.stopPropagation();
|
|
7224
|
+
},
|
|
7225
|
+
children: jsx(WorkspaceSelectListConnect, {})
|
|
7226
|
+
})
|
|
7227
|
+
});
|
|
7228
|
+
};
|
|
7229
|
+
|
|
7230
|
+
var workspacePresetOptionId = 'workspaceMenuButton';
|
|
7231
|
+
var viewPresetOptionId = 'viewpreset-options-toolbutton';
|
|
7232
|
+
var WorkspaceMenuButton = function WorkspaceMenuButton(_ref) {
|
|
7233
|
+
var title = _ref.title,
|
|
7234
|
+
activeTab = _ref.activeTab,
|
|
7235
|
+
_ref$hasChanges = _ref.hasChanges,
|
|
7236
|
+
hasChanges = _ref$hasChanges === void 0 ? false : _ref$hasChanges,
|
|
7237
|
+
_ref$id = _ref.id,
|
|
7238
|
+
id = _ref$id === void 0 ? workspacePresetOptionId : _ref$id,
|
|
7239
|
+
_ref$showMenu = _ref.showMenu,
|
|
7240
|
+
showMenu = _ref$showMenu === void 0 ? false : _ref$showMenu,
|
|
7241
|
+
onToggleDialog = _ref.onToggleDialog;
|
|
7242
|
+
var handleClick = function handleClick() {
|
|
7243
|
+
if (onToggleDialog) {
|
|
7244
|
+
onToggleDialog(!showMenu);
|
|
7245
|
+
}
|
|
7246
|
+
};
|
|
7247
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7248
|
+
t = _useWorkspaceTranslat.t;
|
|
7249
|
+
return jsxs(Box, {
|
|
7250
|
+
sx: {
|
|
7251
|
+
display: 'flex',
|
|
7252
|
+
alignItems: 'center',
|
|
7253
|
+
flexGrow: 1,
|
|
7254
|
+
minWidth: 0
|
|
7255
|
+
},
|
|
7256
|
+
children: [jsx(CustomTooltip, {
|
|
7257
|
+
title: !showMenu && jsxs(Fragment, {
|
|
7258
|
+
children: [jsx(Box, {
|
|
7259
|
+
component: "span",
|
|
7260
|
+
sx: {
|
|
7261
|
+
fontWeight: 'bold',
|
|
7262
|
+
display: 'block'
|
|
7263
|
+
},
|
|
7264
|
+
children: t('workspace-menu')
|
|
7265
|
+
}), jsx(Box, {
|
|
7266
|
+
component: "span",
|
|
7267
|
+
children: t('workspace-currently') + ": " + title
|
|
7268
|
+
})]
|
|
7269
|
+
}),
|
|
7270
|
+
TransitionProps: {
|
|
7271
|
+
exit: false
|
|
7272
|
+
},
|
|
7273
|
+
children: jsx(CustomToggleButton, {
|
|
7274
|
+
variant: "tool",
|
|
7275
|
+
selected: showMenu,
|
|
7276
|
+
onClick: handleClick,
|
|
7277
|
+
"data-testid": id,
|
|
7278
|
+
"aria-label": "workspace menu",
|
|
7279
|
+
disableRipple: true,
|
|
7280
|
+
sx: {
|
|
7281
|
+
flexGrow: 1,
|
|
7282
|
+
// expand across the row
|
|
7283
|
+
flexShrink: 1,
|
|
7284
|
+
minWidth: 0,
|
|
7285
|
+
justifyContent: 'flex-start',
|
|
7286
|
+
alignItems: 'center',
|
|
7287
|
+
textAlign: 'left',
|
|
7288
|
+
fontSize: '12px',
|
|
7289
|
+
fontWeight: 500,
|
|
7290
|
+
fontStyle: hasChanges ? 'italic' : undefined,
|
|
7291
|
+
height: 20,
|
|
7292
|
+
maxHeight: 20,
|
|
7293
|
+
overflow: 'hidden',
|
|
7294
|
+
'&&': {
|
|
7295
|
+
color: activeTab && !showMenu ? 'geowebColors.buttons.icon.active.color' : 'geowebColors.buttons.icon.active.color',
|
|
7296
|
+
textTransform: 'none',
|
|
7297
|
+
backgroundColor: !showMenu ? 'transparent' : 'geowebColors.workspace.tabButtonHover',
|
|
7298
|
+
'&:hover': {
|
|
7299
|
+
backgroundColor: 'geowebColors.workspace.tabButtonHover',
|
|
7300
|
+
color: activeTab && showMenu ? 'white' : 'geowebColors.buttons.icon.active.color'
|
|
7301
|
+
}
|
|
7302
|
+
}
|
|
7238
7303
|
},
|
|
7239
|
-
children: jsx(
|
|
7240
|
-
|
|
7304
|
+
children: jsx(Box, {
|
|
7305
|
+
component: "span",
|
|
7306
|
+
sx: {
|
|
7307
|
+
flexGrow: 1,
|
|
7308
|
+
flexShrink: 1,
|
|
7309
|
+
minWidth: 0,
|
|
7310
|
+
overflow: 'hidden',
|
|
7311
|
+
textOverflow: 'ellipsis',
|
|
7312
|
+
whiteSpace: 'nowrap'
|
|
7313
|
+
},
|
|
7314
|
+
children: title
|
|
7241
7315
|
})
|
|
7242
|
-
})
|
|
7243
|
-
})
|
|
7244
|
-
|
|
7316
|
+
})
|
|
7317
|
+
}), jsx(WorkspaceMenu, {
|
|
7318
|
+
isOpen: showMenu,
|
|
7319
|
+
closeMenu: function closeMenu() {
|
|
7320
|
+
return onToggleDialog == null ? void 0 : onToggleDialog(false);
|
|
7321
|
+
}
|
|
7322
|
+
})]
|
|
7323
|
+
});
|
|
7245
7324
|
};
|
|
7246
|
-
var WorkspaceViewTitleConnect = /*#__PURE__*/React.memo(WorkspaceViewTitleConnectNoMemo);
|
|
7247
7325
|
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
return getUniqueId(existingIds, count + 1);
|
|
7272
|
-
}
|
|
7273
|
-
return newId;
|
|
7274
|
-
};
|
|
7275
|
-
var createBalancedMosaicNode = function createBalancedMosaicNode(currentNode) {
|
|
7276
|
-
var leaves = getLeaves(currentNode);
|
|
7277
|
-
return createBalancedTreeFromLeaves(leaves);
|
|
7278
|
-
};
|
|
7279
|
-
var closeDialogsWhenChangingPreset = function closeDialogsWhenChangingPreset(componentTypes, dispatch) {
|
|
7280
|
-
if (!componentTypes || componentTypes.length === 0 || componentTypes.some(function (componentType) {
|
|
7281
|
-
return componentType.toLowerCase().includes('viewloading');
|
|
7282
|
-
})) {
|
|
7283
|
-
return;
|
|
7284
|
-
}
|
|
7285
|
-
// Close all dialogs related to timeseries
|
|
7286
|
-
if (!componentTypes.some(function (componentType) {
|
|
7287
|
-
return componentType.toLowerCase().includes('timeseries');
|
|
7288
|
-
})) {
|
|
7289
|
-
dispatch(uiActions.setToggleOpenDialog({
|
|
7290
|
-
setOpen: false,
|
|
7291
|
-
type: uiTypes.DialogTypes.TimeSeriesManager
|
|
7292
|
-
}));
|
|
7293
|
-
dispatch(uiActions.setToggleOpenDialog({
|
|
7294
|
-
setOpen: false,
|
|
7295
|
-
type: uiTypes.DialogTypes.TimeSeriesSelect
|
|
7296
|
-
}));
|
|
7297
|
-
dispatch(uiActions.setToggleOpenDialog({
|
|
7298
|
-
setOpen: false,
|
|
7299
|
-
type: uiTypes.DialogTypes.TimeSeriesInfo
|
|
7300
|
-
}));
|
|
7301
|
-
dispatch(uiActions.setToggleOpenDialog({
|
|
7302
|
-
setOpen: false,
|
|
7303
|
-
type: uiTypes.DialogTypes.TimeSeriesLocationInfo
|
|
7304
|
-
}));
|
|
7305
|
-
}
|
|
7306
|
-
// Close all dialogs related to soundings
|
|
7307
|
-
if (!componentTypes.some(function (componentType) {
|
|
7308
|
-
return componentType.toLowerCase().includes('soundings');
|
|
7309
|
-
})) {
|
|
7310
|
-
dispatch(uiActions.setToggleOpenDialog({
|
|
7311
|
-
setOpen: false,
|
|
7312
|
-
type: uiTypes.DialogTypes.SoundingsLocations
|
|
7313
|
-
}));
|
|
7314
|
-
dispatch(uiActions.setToggleOpenDialog({
|
|
7315
|
-
setOpen: false,
|
|
7316
|
-
type: uiTypes.DialogTypes.SoundingsSources
|
|
7317
|
-
}));
|
|
7318
|
-
}
|
|
7319
|
-
// Close dialogs related to the warninglist
|
|
7320
|
-
if (!componentTypes.some(function (componentType) {
|
|
7321
|
-
return componentType.toLowerCase().includes('warninglist');
|
|
7322
|
-
}) && !componentTypes.some(function (componentType) {
|
|
7323
|
-
return componentType.toLowerCase().includes('map');
|
|
7324
|
-
})) {
|
|
7325
|
-
dispatch(uiActions.setToggleOpenDialog({
|
|
7326
|
-
setOpen: false,
|
|
7327
|
-
type: uiTypes.DialogTypes.PublicWarnings
|
|
7328
|
-
}));
|
|
7329
|
-
}
|
|
7326
|
+
var LoadingIndicatorConnect = function LoadingIndicatorConnect(_ref) {
|
|
7327
|
+
var panelId = _ref.panelId;
|
|
7328
|
+
var isLoading = useSelector(function (store) {
|
|
7329
|
+
return loadingIndicatorSelectors.isLoading(store, panelId);
|
|
7330
|
+
});
|
|
7331
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7332
|
+
t = _useWorkspaceTranslat.t;
|
|
7333
|
+
return jsx(CustomTooltip, {
|
|
7334
|
+
title: isLoading ? t('workspace-loading-indicator-loading') : t('workspace-loading-indicator-idle'),
|
|
7335
|
+
children: jsx("span", {
|
|
7336
|
+
style: {
|
|
7337
|
+
height: '100%'
|
|
7338
|
+
},
|
|
7339
|
+
children: isLoading ? jsx(CloudLoading, {
|
|
7340
|
+
"data-testid": "cloudicon-loading",
|
|
7341
|
+
style: {
|
|
7342
|
+
fill: '#186DFF'
|
|
7343
|
+
}
|
|
7344
|
+
}) : jsx(CloudIdle, {
|
|
7345
|
+
"data-testid": "cloudicon-idle"
|
|
7346
|
+
})
|
|
7347
|
+
})
|
|
7348
|
+
});
|
|
7330
7349
|
};
|
|
7331
7350
|
|
|
7332
|
-
var
|
|
7333
|
-
|
|
7334
|
-
var
|
|
7351
|
+
var workspaceOptionsButtonId = 'workspace-options-toolbutton';
|
|
7352
|
+
var WorkspaceOptions = function WorkspaceOptions(_ref) {
|
|
7353
|
+
var _ref$id = _ref.id,
|
|
7354
|
+
id = _ref$id === void 0 ? workspaceOptionsButtonId : _ref$id,
|
|
7355
|
+
handleSave = _ref.handleSave,
|
|
7356
|
+
handleSaveAs = _ref.handleSaveAs,
|
|
7357
|
+
handleEdit = _ref.handleEdit,
|
|
7358
|
+
handleDelete = _ref.handleDelete,
|
|
7359
|
+
handleReset = _ref.handleReset,
|
|
7360
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
7361
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
7362
|
+
_ref$isDefaultOpen = _ref.isDefaultOpen,
|
|
7363
|
+
isDefaultOpen = _ref$isDefaultOpen === void 0 ? false : _ref$isDefaultOpen;
|
|
7335
7364
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7336
7365
|
t = _useWorkspaceTranslat.t;
|
|
7366
|
+
var theme = useTheme();
|
|
7337
7367
|
var _React$useState = React__default.useState(null),
|
|
7338
7368
|
anchorEl = _React$useState[0],
|
|
7339
7369
|
setAnchorEl = _React$useState[1];
|
|
7340
|
-
var
|
|
7341
|
-
|
|
7342
|
-
|
|
7343
|
-
var viewsById = useSelector(getViewsById);
|
|
7344
|
-
var selectedMapIds = useSelector(function (store) {
|
|
7345
|
-
return genericSelectors.getLinkedMaps(store, panelId);
|
|
7346
|
-
});
|
|
7347
|
-
var viewComponentType = useSelector(function (store) {
|
|
7348
|
-
return getViewComponentType(store, panelId);
|
|
7349
|
-
});
|
|
7350
|
-
var sharedFeature = useSelector(function (store) {
|
|
7351
|
-
return genericSelectors.getSelectedFeature(store.syncGroups, panelId);
|
|
7352
|
-
});
|
|
7353
|
-
var mapPinLocation = useSelector(function (store) {
|
|
7354
|
-
return mapSelectors.getPinLocation(store, selectedMapIds[0] || '');
|
|
7355
|
-
});
|
|
7356
|
-
var handleLinkViews = function handleLinkViews(event) {
|
|
7357
|
-
setAnchorEl(event.currentTarget);
|
|
7358
|
-
};
|
|
7359
|
-
var handleMenuClose = function handleMenuClose() {
|
|
7360
|
-
setAnchorEl(null);
|
|
7361
|
-
};
|
|
7362
|
-
var handleMapSelect = function handleMapSelect(mapId) {
|
|
7363
|
-
var updatedMapIds = selectedMapIds.includes(mapId) ? selectedMapIds.filter(function (id) {
|
|
7364
|
-
return id !== mapId;
|
|
7365
|
-
}) : [].concat(selectedMapIds, [mapId]);
|
|
7366
|
-
dispatch(genericActions.updateLinkedMap({
|
|
7367
|
-
panelId: panelId,
|
|
7368
|
-
mapIds: updatedMapIds
|
|
7369
|
-
}));
|
|
7370
|
-
// Sync pin to newly added map for TimeSeries components
|
|
7371
|
-
if (!selectedMapIds.includes(mapId) && viewComponentType === 'TimeSeries') {
|
|
7372
|
-
// Observation station
|
|
7373
|
-
if (sharedFeature) {
|
|
7374
|
-
dispatch(mapActions.setMapPinLocation({
|
|
7375
|
-
mapId: mapId,
|
|
7376
|
-
mapPinLocation: {
|
|
7377
|
-
lon: sharedFeature.lon,
|
|
7378
|
-
lat: sharedFeature.lat
|
|
7379
|
-
}
|
|
7380
|
-
}));
|
|
7381
|
-
// Grid
|
|
7382
|
-
} else if (mapPinLocation) {
|
|
7383
|
-
dispatch(mapActions.setMapPinLocation({
|
|
7384
|
-
mapId: mapId,
|
|
7385
|
-
mapPinLocation: mapPinLocation
|
|
7386
|
-
}));
|
|
7387
|
-
}
|
|
7388
|
-
}
|
|
7370
|
+
var isOpen = Boolean(anchorEl) || isDefaultOpen;
|
|
7371
|
+
var handleClick = function handleClick(event) {
|
|
7372
|
+
setAnchorEl(anchorEl ? null : event.currentTarget);
|
|
7389
7373
|
};
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7374
|
+
var options = [{
|
|
7375
|
+
title: t('workspace-save'),
|
|
7376
|
+
callback: handleSave
|
|
7377
|
+
}, {
|
|
7378
|
+
title: t('workspace-save-as'),
|
|
7379
|
+
callback: handleSaveAs
|
|
7380
|
+
}, {
|
|
7381
|
+
title: t('workspace-edit'),
|
|
7382
|
+
callback: handleEdit
|
|
7383
|
+
}, {
|
|
7384
|
+
title: t('workspace-reset'),
|
|
7385
|
+
callback: handleReset
|
|
7386
|
+
}, {
|
|
7387
|
+
title: t('workspace-delete'),
|
|
7388
|
+
callback: handleDelete
|
|
7389
|
+
}];
|
|
7390
|
+
var renderButton = function renderButton() {
|
|
7391
|
+
return jsxs(CustomIconButton, {
|
|
7392
|
+
onClick: handleClick,
|
|
7393
|
+
"data-testid": id,
|
|
7394
|
+
isSelected: isOpen,
|
|
7395
|
+
"aria-label": "workspace options",
|
|
7396
|
+
variant: "tool",
|
|
7397
|
+
disabled: isDisabled,
|
|
7395
7398
|
sx: {
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
}
|
|
7405
|
-
}) : jsx(LinkOff, {
|
|
7406
|
-
"data-testid": "link-off-icon",
|
|
7407
|
-
style: {
|
|
7408
|
-
fill: anchorEl ? 'white' : undefined,
|
|
7409
|
-
backgroundColor: anchorEl ? '#186DFF' : undefined
|
|
7399
|
+
'&&': {
|
|
7400
|
+
backgroundColor: !isOpen ? 'transparent' : 'geowebColors.workspace.tabButtonHover',
|
|
7401
|
+
'&:hover': {
|
|
7402
|
+
backgroundColor: 'geowebColors.workspace.tabButtonHover'
|
|
7403
|
+
},
|
|
7404
|
+
'.MuiSvgIcon-root > path': {
|
|
7405
|
+
fill: isOpen ? theme.palette.geowebColors.iconButtons.tool.active.color : undefined
|
|
7406
|
+
}
|
|
7410
7407
|
}
|
|
7411
|
-
}
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
keepMounted: true,
|
|
7419
|
-
children: [jsxs(Typography, {
|
|
7420
|
-
variant: "h6",
|
|
7421
|
-
style: {
|
|
7422
|
-
padding: '10px 15px 0',
|
|
7423
|
-
fontWeight: 'bold'
|
|
7408
|
+
},
|
|
7409
|
+
children: [jsx(Options, {}), jsxs(Menu, {
|
|
7410
|
+
BackdropProps: {
|
|
7411
|
+
style: {
|
|
7412
|
+
opacity: 0,
|
|
7413
|
+
transition: 'none'
|
|
7414
|
+
}
|
|
7424
7415
|
},
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7416
|
+
open: isOpen && !isDisabled,
|
|
7417
|
+
anchorEl: anchorEl,
|
|
7418
|
+
onClose: function onClose() {
|
|
7419
|
+
return setAnchorEl(null);
|
|
7420
|
+
},
|
|
7421
|
+
anchorOrigin: {
|
|
7422
|
+
vertical: 21,
|
|
7423
|
+
horizontal: 6
|
|
7424
|
+
},
|
|
7425
|
+
sx: {
|
|
7426
|
+
'& .MuiMenu-list': {
|
|
7427
|
+
padding: 0
|
|
7428
|
+
},
|
|
7429
|
+
'& .MuiMenuItem-root': {
|
|
7430
|
+
fontSize: 16
|
|
7431
|
+
}
|
|
7432
|
+
},
|
|
7433
|
+
children: [jsx(ListSubheader, {
|
|
7434
|
+
sx: {
|
|
7435
|
+
paddingTop: '8px'
|
|
7436
|
+
},
|
|
7437
|
+
children: jsx(Typography, {
|
|
7438
|
+
sx: {
|
|
7439
|
+
letterSpacing: '0.4px',
|
|
7440
|
+
fontSize: 12
|
|
7434
7441
|
},
|
|
7435
|
-
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
7439
|
-
|
|
7440
|
-
|
|
7441
|
-
|
|
7442
|
-
|
|
7443
|
-
|
|
7444
|
-
|
|
7445
|
-
|
|
7446
|
-
children: jsx(Checkbox, {
|
|
7447
|
-
edge: "start",
|
|
7448
|
-
tabIndex: -1,
|
|
7449
|
-
checked: selectedMapIds.includes(mapId),
|
|
7450
|
-
disableRipple: true,
|
|
7451
|
-
inputProps: {
|
|
7452
|
-
'aria-labelledby': labelId
|
|
7453
|
-
}
|
|
7454
|
-
})
|
|
7455
|
-
}), jsx(ListItemText, {
|
|
7456
|
-
id: labelId,
|
|
7457
|
-
primary: (_viewsById$mapId = viewsById[mapId]) == null ? void 0 : _viewsById$mapId.title,
|
|
7458
|
-
secondary: mapId
|
|
7459
|
-
})]
|
|
7460
|
-
})
|
|
7461
|
-
}, mapId);
|
|
7462
|
-
})
|
|
7442
|
+
children: t('workspace-options')
|
|
7443
|
+
})
|
|
7444
|
+
}), options.map(function (_ref2) {
|
|
7445
|
+
var title = _ref2.title,
|
|
7446
|
+
callback = _ref2.callback;
|
|
7447
|
+
return jsx(MenuItem, {
|
|
7448
|
+
onClick: callback,
|
|
7449
|
+
disabled: !callback,
|
|
7450
|
+
children: title
|
|
7451
|
+
}, title);
|
|
7452
|
+
})]
|
|
7463
7453
|
})]
|
|
7464
|
-
})
|
|
7454
|
+
});
|
|
7455
|
+
};
|
|
7456
|
+
return isDisabled ? renderButton() : jsx(CustomTooltip, {
|
|
7457
|
+
title: !isOpen && t('workspace-options'),
|
|
7458
|
+
TransitionProps: {
|
|
7459
|
+
exit: false
|
|
7460
|
+
},
|
|
7461
|
+
children: renderButton()
|
|
7465
7462
|
});
|
|
7466
7463
|
};
|
|
7467
7464
|
|
|
7468
|
-
var
|
|
7469
|
-
|
|
7470
|
-
marginRight: 0.5
|
|
7471
|
-
};
|
|
7472
|
-
var WorkspaceControls = function WorkspaceControls(_ref) {
|
|
7465
|
+
var _excluded$4 = ["title", "scope"];
|
|
7466
|
+
var WorkspaceViewTitleConnectNoMemo = function WorkspaceViewTitleConnectNoMemo(_ref) {
|
|
7473
7467
|
var panelId = _ref.panelId,
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
shouldPreventCloseView = _ref$shouldPreventClo === void 0 ? false : _ref$shouldPreventClo,
|
|
7478
|
-
removeLinkedMap = _ref.removeLinkedMap;
|
|
7479
|
-
var confirmDialog = useConfirmationDialog();
|
|
7480
|
-
var _React$useContext = React.useContext(MosaicContext),
|
|
7481
|
-
actions = _React$useContext.mosaicActions;
|
|
7468
|
+
isViewPresetDialogOpen = _ref.isViewPresetDialogOpen;
|
|
7469
|
+
var dispatch = useDispatch();
|
|
7470
|
+
var store = useStore();
|
|
7482
7471
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7483
7472
|
t = _useWorkspaceTranslat.t;
|
|
7484
|
-
var
|
|
7485
|
-
|
|
7486
|
-
|
|
7487
|
-
|
|
7488
|
-
|
|
7489
|
-
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7494
|
-
|
|
7495
|
-
|
|
7496
|
-
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
if (!isEqual(mosaicNode, stateAfterExpand)) {
|
|
7503
|
-
setEnableUnexpand(false);
|
|
7504
|
-
setStateAfterExpand(undefined);
|
|
7505
|
-
}
|
|
7506
|
-
}
|
|
7507
|
-
}, [enableUnexpand, mosaicNode, stateAfterExpand]);
|
|
7508
|
-
var onClose = /*#__PURE__*/function () {
|
|
7509
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
7510
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7511
|
-
while (1) switch (_context.prev = _context.next) {
|
|
7512
|
-
case 0:
|
|
7513
|
-
if (!shouldPreventCloseView) {
|
|
7514
|
-
_context.next = 7;
|
|
7515
|
-
break;
|
|
7516
|
-
}
|
|
7517
|
-
_context.next = 3;
|
|
7518
|
-
return confirmDialog({
|
|
7519
|
-
title: t('workspace-control-close-message-title'),
|
|
7520
|
-
description: t('workspace-control-close-message-description'),
|
|
7521
|
-
confirmLabel: t('workspace-control-close')
|
|
7522
|
-
});
|
|
7523
|
-
case 3:
|
|
7524
|
-
actions.remove(path);
|
|
7525
|
-
removeLinkedMap(panelId);
|
|
7526
|
-
_context.next = 9;
|
|
7527
|
-
break;
|
|
7528
|
-
case 7:
|
|
7529
|
-
actions.remove(path);
|
|
7530
|
-
removeLinkedMap(panelId);
|
|
7531
|
-
case 9:
|
|
7532
|
-
case "end":
|
|
7533
|
-
return _context.stop();
|
|
7534
|
-
}
|
|
7535
|
-
}, _callee);
|
|
7536
|
-
}));
|
|
7537
|
-
return function onClose() {
|
|
7538
|
-
return _ref2.apply(this, arguments);
|
|
7539
|
-
};
|
|
7540
|
-
}();
|
|
7541
|
-
return jsxs(Fragment, {
|
|
7542
|
-
children: [jsx(LinkMenuConnect, {
|
|
7543
|
-
panelId: panelId
|
|
7544
|
-
}), jsx(CustomIconButton, {
|
|
7545
|
-
"data-testid": "split-horizontal-btn",
|
|
7546
|
-
sx: buttonStyle,
|
|
7547
|
-
onClick: function onClick() {
|
|
7548
|
-
var newNode = createNode();
|
|
7549
|
-
var previousNode = getAndAssertNodeAtPathExists(actions.getRoot(), path);
|
|
7550
|
-
actions.replaceWith(path, {
|
|
7551
|
-
direction: 'column',
|
|
7552
|
-
first: previousNode,
|
|
7553
|
-
second: newNode
|
|
7554
|
-
});
|
|
7555
|
-
},
|
|
7556
|
-
tooltipTitle: t('workspace-control-split-horizontal'),
|
|
7557
|
-
children: jsx(SplitVertical, {})
|
|
7558
|
-
}), jsx(CustomIconButton, {
|
|
7559
|
-
"data-testid": "split-vertical-btn",
|
|
7560
|
-
sx: buttonStyle,
|
|
7561
|
-
onClick: function onClick() {
|
|
7562
|
-
var newNode = createNode();
|
|
7563
|
-
var previousNode = getAndAssertNodeAtPathExists(actions.getRoot(), path);
|
|
7564
|
-
actions.replaceWith(path, {
|
|
7565
|
-
direction: 'row',
|
|
7566
|
-
first: previousNode,
|
|
7567
|
-
second: newNode
|
|
7568
|
-
});
|
|
7569
|
-
},
|
|
7570
|
-
tooltipTitle: t('workspace-control-split-vertical'),
|
|
7571
|
-
children: jsx(SplitHorizontal, {})
|
|
7572
|
-
}), !enableUnexpand || isString(mosaicNode) ? jsx(CustomIconButton, {
|
|
7573
|
-
"data-testid": "expand-btn",
|
|
7574
|
-
sx: buttonStyle,
|
|
7575
|
-
onClick: function onClick() {
|
|
7576
|
-
setStateBeforeExpand(mosaicNode);
|
|
7577
|
-
setEnableUnexpand(true);
|
|
7578
|
-
actions.expand(path, 70);
|
|
7579
|
-
},
|
|
7580
|
-
tooltipTitle: t('workspace-control-expand'),
|
|
7581
|
-
children: jsx(Expand, {})
|
|
7582
|
-
}) : jsx(CustomIconButton, {
|
|
7583
|
-
"data-testid": "unexpand-btn",
|
|
7584
|
-
sx: buttonStyle,
|
|
7585
|
-
onClick: function onClick() {
|
|
7586
|
-
var stateBeforeExpandCopy = isString(stateBeforeExpand) ? stateBeforeExpand : Object.assign({}, stateBeforeExpand);
|
|
7587
|
-
actions.replaceWith([], stateBeforeExpandCopy);
|
|
7588
|
-
},
|
|
7589
|
-
tooltipTitle: t('workspace-control-unexpand'),
|
|
7590
|
-
children: jsx(UnExpand, {})
|
|
7591
|
-
}), jsx(CustomIconButton, {
|
|
7592
|
-
"data-testid": "close-btn",
|
|
7593
|
-
sx: buttonStyle,
|
|
7594
|
-
onClick: onClose,
|
|
7595
|
-
tooltipTitle: t('workspace-control-close'),
|
|
7596
|
-
id: "close-window-button",
|
|
7597
|
-
children: jsx(Close, {})
|
|
7598
|
-
})]
|
|
7599
|
-
});
|
|
7600
|
-
};
|
|
7601
|
-
|
|
7602
|
-
var WorkspaceTileConnect = /*#__PURE__*/React.memo(function (_ref) {
|
|
7603
|
-
var _ref$mosaicNodeId = _ref.mosaicNodeId,
|
|
7604
|
-
mosaicNodeId = _ref$mosaicNodeId === void 0 ? '' : _ref$mosaicNodeId,
|
|
7605
|
-
path = _ref.path,
|
|
7606
|
-
componentsLookUp = _ref.componentsLookUp;
|
|
7607
|
-
var dispatch = useDispatch();
|
|
7608
|
-
useFetchViewPresets(mosaicNodeId);
|
|
7609
|
-
var view = useSelector(function (store) {
|
|
7610
|
-
return getViewById(store, mosaicNodeId);
|
|
7611
|
-
});
|
|
7612
|
-
var viewIds = useSelector(function (store) {
|
|
7613
|
-
return getViewIds(store);
|
|
7473
|
+
var _useAuthenticationCon = useAuthenticationContext(),
|
|
7474
|
+
currentRole = _useAuthenticationCon.currentRole,
|
|
7475
|
+
isLoggedIn = _useAuthenticationCon.isLoggedIn,
|
|
7476
|
+
auth = _useAuthenticationCon.auth;
|
|
7477
|
+
var isAdmin = (currentRole == null ? void 0 : currentRole.name) === GEOWEB_ROLE_PRESETS_ADMIN.name;
|
|
7478
|
+
var workspaceView = useSelector(function (store) {
|
|
7479
|
+
var _workspaceSelectors$g;
|
|
7480
|
+
var _ref2 = (_workspaceSelectors$g = getViewById(store, panelId)) != null ? _workspaceSelectors$g : {},
|
|
7481
|
+
title = _ref2.title,
|
|
7482
|
+
scope = _ref2.scope,
|
|
7483
|
+
restProps = _objectWithoutPropertiesLoose(_ref2, _excluded$4);
|
|
7484
|
+
return Object.assign({
|
|
7485
|
+
title: title,
|
|
7486
|
+
scope: scope
|
|
7487
|
+
}, restProps);
|
|
7488
|
+
}, shallowEqual);
|
|
7489
|
+
var viewComponentType = useSelector(function (store) {
|
|
7490
|
+
return getViewComponentType(store, panelId);
|
|
7614
7491
|
});
|
|
7615
|
-
var
|
|
7616
|
-
return
|
|
7492
|
+
var hasViewPresetChanges = useSelector(function (store) {
|
|
7493
|
+
return getViewPresetHasChanges(store, panelId);
|
|
7617
7494
|
});
|
|
7618
|
-
var
|
|
7619
|
-
return
|
|
7495
|
+
var activeViewPresetId = useSelector(function (store) {
|
|
7496
|
+
return getViewPresetActiveId(store, panelId);
|
|
7620
7497
|
});
|
|
7621
|
-
var
|
|
7622
|
-
return
|
|
7498
|
+
var relatedSyncGroupIds = useSelector(function (store) {
|
|
7499
|
+
return syncGroupsSelectors.getAllTargetGroupsForSource(store, panelId);
|
|
7623
7500
|
});
|
|
7624
|
-
var
|
|
7625
|
-
return
|
|
7501
|
+
var currentViewPreset = useSelector(function (store) {
|
|
7502
|
+
return workspaceView.id ? getViewPresetFromList(store, workspaceView.id) : undefined;
|
|
7626
7503
|
});
|
|
7627
|
-
var
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
var
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
dispatch(viewPresetActions.
|
|
7634
|
-
|
|
7635
|
-
viewPresetId: mapPresetId
|
|
7504
|
+
var presetAbstract = workspaceView == null ? void 0 : workspaceView["abstract"];
|
|
7505
|
+
var isNewActive = activeViewPresetId === '';
|
|
7506
|
+
var title = workspaceView.title || t('workspace-mappreset-new');
|
|
7507
|
+
var viewScope = workspaceView.scope;
|
|
7508
|
+
var fullTitle = getPresetTitle(title, hasViewPresetChanges, isNewActive, t);
|
|
7509
|
+
var openViewPresetsDialog = React.useCallback(function (viewPresetDialogOptions) {
|
|
7510
|
+
dispatch(viewPresetActions.openViewPresetDialog({
|
|
7511
|
+
viewPresetDialog: viewPresetDialogOptions
|
|
7636
7512
|
}));
|
|
7637
7513
|
}, [dispatch]);
|
|
7638
|
-
var
|
|
7639
|
-
|
|
7640
|
-
|
|
7641
|
-
|
|
7514
|
+
var currentWarningsPreset = useSelector(function (store) {
|
|
7515
|
+
return publicWarningsSelectors.getWarningsPresetById(store, panelId);
|
|
7516
|
+
});
|
|
7517
|
+
var constructInitialProps = React.useCallback(function () {
|
|
7518
|
+
switch (viewComponentType) {
|
|
7519
|
+
case 'WarningList':
|
|
7520
|
+
return currentWarningsPreset;
|
|
7521
|
+
case 'TimeSeries':
|
|
7522
|
+
return timeSeriesSelectors.getTimeSeriesPreset(store.getState());
|
|
7523
|
+
case 'Map':
|
|
7524
|
+
return {
|
|
7525
|
+
mapPreset: mapSelectors.getMapPreset(store.getState(), panelId),
|
|
7526
|
+
syncGroupsIds: relatedSyncGroupIds
|
|
7527
|
+
};
|
|
7528
|
+
default:
|
|
7529
|
+
return undefined;
|
|
7530
|
+
}
|
|
7531
|
+
}, [currentWarningsPreset, panelId, relatedSyncGroupIds, store, viewComponentType]);
|
|
7532
|
+
var onSave = React.useCallback(function () {
|
|
7533
|
+
dispatch(viewPresetActions.saveViewPreset({
|
|
7534
|
+
panelId: panelId,
|
|
7535
|
+
viewPresetId: activeViewPresetId,
|
|
7536
|
+
viewPreset: Object.assign({}, emptyViewPreset(viewComponentType), {
|
|
7537
|
+
title: title,
|
|
7538
|
+
initialProps: constructInitialProps()
|
|
7539
|
+
})
|
|
7642
7540
|
}));
|
|
7643
|
-
}, [dispatch]);
|
|
7644
|
-
var
|
|
7645
|
-
|
|
7646
|
-
|
|
7647
|
-
|
|
7648
|
-
|
|
7649
|
-
|
|
7541
|
+
}, [activeViewPresetId, constructInitialProps, dispatch, panelId, title, viewComponentType]);
|
|
7542
|
+
var onDelete = React.useCallback(function () {
|
|
7543
|
+
openViewPresetsDialog({
|
|
7544
|
+
title: t('workspace-mappreset-dialog-title-delete'),
|
|
7545
|
+
action: PresetAction.DELETE,
|
|
7546
|
+
viewPresetId: activeViewPresetId,
|
|
7547
|
+
panelId: panelId,
|
|
7548
|
+
formValues: {
|
|
7549
|
+
title: title,
|
|
7550
|
+
"abstract": presetAbstract
|
|
7551
|
+
}
|
|
7552
|
+
});
|
|
7553
|
+
}, [activeViewPresetId, openViewPresetsDialog, panelId, title, presetAbstract, t]);
|
|
7554
|
+
var onSaveAs = React.useCallback(function () {
|
|
7555
|
+
var formTitle = activeViewPresetId ? title : '';
|
|
7556
|
+
openViewPresetsDialog({
|
|
7557
|
+
title: t('workspace-mappreset-save-as'),
|
|
7558
|
+
action: PresetAction.SAVE_AS,
|
|
7559
|
+
viewPresetId: activeViewPresetId,
|
|
7560
|
+
panelId: panelId,
|
|
7561
|
+
formValues: {
|
|
7562
|
+
title: formTitle,
|
|
7563
|
+
initialProps: constructInitialProps(),
|
|
7564
|
+
"abstract": presetAbstract
|
|
7565
|
+
}
|
|
7566
|
+
});
|
|
7567
|
+
}, [activeViewPresetId, constructInitialProps, openViewPresetsDialog, panelId, t, title, presetAbstract]);
|
|
7568
|
+
var onEdit = React.useCallback(function () {
|
|
7569
|
+
var formTitle = activeViewPresetId ? title : '';
|
|
7570
|
+
openViewPresetsDialog({
|
|
7571
|
+
title: t('workspace-mappreset-dialog-title-edit'),
|
|
7572
|
+
action: PresetAction.EDIT,
|
|
7573
|
+
panelId: panelId,
|
|
7574
|
+
viewPresetId: activeViewPresetId,
|
|
7575
|
+
formValues: {
|
|
7576
|
+
title: formTitle,
|
|
7577
|
+
initialProps: constructInitialProps(),
|
|
7578
|
+
"abstract": presetAbstract
|
|
7579
|
+
}
|
|
7580
|
+
});
|
|
7581
|
+
}, [activeViewPresetId, constructInitialProps, openViewPresetsDialog, panelId, t, title, presetAbstract]);
|
|
7582
|
+
var onReset = React.useCallback(function () {
|
|
7583
|
+
openViewPresetsDialog({
|
|
7584
|
+
title: t('workspace-reset-title'),
|
|
7585
|
+
action: PresetAction.RESET,
|
|
7586
|
+
viewPresetId: activeViewPresetId,
|
|
7587
|
+
panelId: panelId,
|
|
7588
|
+
formValues: {
|
|
7589
|
+
title: title
|
|
7590
|
+
}
|
|
7591
|
+
});
|
|
7592
|
+
}, [activeViewPresetId, openViewPresetsDialog, panelId, t, title]);
|
|
7593
|
+
var toggleViewPresetDialog = React.useCallback(function (_ref3) {
|
|
7594
|
+
var panelId = _ref3.panelId,
|
|
7595
|
+
isViewPresetDialogOpen = _ref3.isViewPresetDialogOpen;
|
|
7650
7596
|
dispatch(viewPresetActions.toggleViewPresetListDialog({
|
|
7651
7597
|
panelId: panelId,
|
|
7652
7598
|
isViewPresetListDialogOpen: isViewPresetDialogOpen
|
|
7653
7599
|
}));
|
|
7654
7600
|
}, [dispatch]);
|
|
7655
|
-
var
|
|
7656
|
-
|
|
7657
|
-
|
|
7658
|
-
|
|
7659
|
-
mosaicNodeId: mosaicNodeId,
|
|
7660
|
-
newId: newId
|
|
7661
|
-
});
|
|
7662
|
-
return newId;
|
|
7663
|
-
}, [addView, mosaicNodeId, viewIds]);
|
|
7664
|
-
var title = (view == null ? void 0 : view.title) || (view == null ? void 0 : view.id) || mosaicNodeId;
|
|
7665
|
-
React.useEffect(function () {
|
|
7666
|
-
var viewPresetId = (view == null ? void 0 : view.id) || '';
|
|
7667
|
-
registerView({
|
|
7668
|
-
panelId: mosaicNodeId,
|
|
7669
|
-
mapPresetId: viewPresetId
|
|
7670
|
-
});
|
|
7671
|
-
return function () {
|
|
7672
|
-
unregisterView({
|
|
7673
|
-
panelId: mosaicNodeId
|
|
7674
|
-
});
|
|
7675
|
-
};
|
|
7676
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7677
|
-
}, [registerView, unregisterView]);
|
|
7678
|
-
// generic componentsLookUp
|
|
7679
|
-
var genericComponentsLookupResult = React.useMemo(function () {
|
|
7680
|
-
return componentsLookUp({
|
|
7681
|
-
title: title,
|
|
7682
|
-
id: mosaicNodeId,
|
|
7683
|
-
componentType: view == null ? void 0 : view.componentType,
|
|
7684
|
-
initialProps: view == null ? void 0 : view.initialProps
|
|
7685
|
-
});
|
|
7686
|
-
}, [componentsLookUp, mosaicNodeId, title, view == null ? void 0 : view.componentType, view == null ? void 0 : view.initialProps]);
|
|
7687
|
-
// default componentsLookUp
|
|
7688
|
-
var defaultComponentsLookupResult = React.useMemo(function () {
|
|
7689
|
-
return defaultComponentsLookUp({
|
|
7690
|
-
viewPresetId: view == null ? void 0 : view.id,
|
|
7691
|
-
componentType: view == null ? void 0 : view.componentType,
|
|
7692
|
-
mosaicNodeId: mosaicNodeId
|
|
7601
|
+
var onClickOpenViewPreset = React.useCallback(function () {
|
|
7602
|
+
toggleViewPresetDialog({
|
|
7603
|
+
panelId: panelId,
|
|
7604
|
+
isViewPresetDialogOpen: !isViewPresetDialogOpen
|
|
7693
7605
|
});
|
|
7694
|
-
}, [
|
|
7695
|
-
|
|
7696
|
-
|
|
7697
|
-
|
|
7698
|
-
|
|
7699
|
-
|
|
7700
|
-
|
|
7701
|
-
|
|
7702
|
-
|
|
7703
|
-
|
|
7704
|
-
|
|
7705
|
-
path: path,
|
|
7706
|
-
shouldPreventCloseView: shouldPreventCloseView,
|
|
7707
|
-
removeLinkedMap: removeLinkedMap
|
|
7708
|
-
}),
|
|
7709
|
-
children: [isViewPresetsFetching && jsx(LinearProgress, {
|
|
7710
|
-
"data-testid": "loading-bar",
|
|
7711
|
-
color: "secondary",
|
|
7712
|
-
sx: {
|
|
7713
|
-
position: 'absolute',
|
|
7714
|
-
width: '100%',
|
|
7715
|
-
top: 0,
|
|
7716
|
-
zIndex: 1001
|
|
7717
|
-
}
|
|
7718
|
-
}), errorViewPreset && jsx(Box, {
|
|
7606
|
+
}, [isViewPresetDialogOpen, panelId, toggleViewPresetDialog]);
|
|
7607
|
+
renderCounter.count(WorkspaceViewTitleConnectNoMemo.name);
|
|
7608
|
+
var viewpresetCreator = (currentViewPreset == null ? void 0 : currentViewPreset.username) || '';
|
|
7609
|
+
var isUserPresetCreator = (auth == null ? void 0 : auth.username) === viewpresetCreator;
|
|
7610
|
+
var currentViewScope = viewScope || 'system';
|
|
7611
|
+
var isEnabled = (currentViewScope === 'user' && isUserPresetCreator || isAdmin && currentViewScope === 'system') && activeViewPresetId !== '' && isLoggedIn;
|
|
7612
|
+
return (
|
|
7613
|
+
// Zero-length string assignment prevents showing title as an empty object '[object Object]'.
|
|
7614
|
+
// in child components. This is a workaround for a limitation in the Tooltip component.
|
|
7615
|
+
jsxs(Grid, {
|
|
7616
|
+
title: "",
|
|
7719
7617
|
sx: {
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
children: jsx(AlertBanner, {
|
|
7726
|
-
title: errorViewPreset,
|
|
7727
|
-
shouldClose: true
|
|
7728
|
-
})
|
|
7729
|
-
}), defaultComponentsLookupResult, genericComponentsLookupResult, jsx(ViewPresetMenu, {
|
|
7730
|
-
panelId: mosaicNodeId,
|
|
7731
|
-
closeMenu: function closeMenu() {
|
|
7732
|
-
toggleViewPresetDialog({
|
|
7733
|
-
panelId: mosaicNodeId,
|
|
7734
|
-
isViewPresetDialogOpen: false
|
|
7735
|
-
});
|
|
7618
|
+
display: 'flex',
|
|
7619
|
+
flexGrow: 3,
|
|
7620
|
+
flexDirection: 'row',
|
|
7621
|
+
alignItems: 'center',
|
|
7622
|
+
justifyContent: 'space-between'
|
|
7736
7623
|
},
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7624
|
+
children: [jsxs(Box, {
|
|
7625
|
+
sx: {
|
|
7626
|
+
display: 'flex',
|
|
7627
|
+
alignItems: 'center',
|
|
7628
|
+
flexGrow: 1,
|
|
7629
|
+
minWidth: 0,
|
|
7630
|
+
gap: 1
|
|
7631
|
+
},
|
|
7632
|
+
children: [jsx(CustomTooltip, {
|
|
7633
|
+
title: !isViewPresetDialogOpen && jsxs(Fragment, {
|
|
7634
|
+
children: [jsx(Box, {
|
|
7635
|
+
component: "span",
|
|
7636
|
+
sx: {
|
|
7637
|
+
fontWeight: 'bold',
|
|
7638
|
+
display: 'block'
|
|
7639
|
+
},
|
|
7640
|
+
children: t('workspace-viewpreset-menu')
|
|
7641
|
+
}), jsx(Box, {
|
|
7642
|
+
component: "span",
|
|
7643
|
+
children: t('workspace-currently') + ": " + title
|
|
7644
|
+
})]
|
|
7645
|
+
}),
|
|
7646
|
+
TransitionProps: {
|
|
7647
|
+
exit: false
|
|
7648
|
+
},
|
|
7649
|
+
children: jsxs(CustomToggleButton, {
|
|
7650
|
+
variant: "tool",
|
|
7651
|
+
"data-testid": "open-viewpresets",
|
|
7652
|
+
selected: isViewPresetDialogOpen,
|
|
7653
|
+
onClick: onClickOpenViewPreset,
|
|
7654
|
+
disableRipple: true,
|
|
7655
|
+
sx: {
|
|
7656
|
+
flexShrink: 1,
|
|
7657
|
+
minWidth: 0,
|
|
7658
|
+
maxWidth: 220,
|
|
7659
|
+
justifyContent: 'flex-start',
|
|
7660
|
+
alignItems: 'center',
|
|
7661
|
+
textAlign: 'left',
|
|
7662
|
+
fontSize: '12px',
|
|
7663
|
+
fontWeight: 500,
|
|
7664
|
+
fontStyle: hasViewPresetChanges || isNewActive ? 'italic' : undefined,
|
|
7665
|
+
height: 20,
|
|
7666
|
+
overflow: 'hidden',
|
|
7667
|
+
'&&': {
|
|
7668
|
+
textTransform: 'none',
|
|
7669
|
+
backgroundColor: !isViewPresetDialogOpen ? 'transparent' : 'geowebColors.workspace.tabButtonHover',
|
|
7670
|
+
'&:hover': {
|
|
7671
|
+
backgroundColor: 'geowebColors.workspace.tabButtonHover'
|
|
7672
|
+
}
|
|
7673
|
+
}
|
|
7674
|
+
},
|
|
7675
|
+
children: [jsx(Box, {
|
|
7676
|
+
component: "span",
|
|
7677
|
+
sx: {
|
|
7678
|
+
flexGrow: 1,
|
|
7679
|
+
flexShrink: 1,
|
|
7680
|
+
minWidth: 0,
|
|
7681
|
+
overflow: 'hidden',
|
|
7682
|
+
textOverflow: 'ellipsis',
|
|
7683
|
+
whiteSpace: 'nowrap',
|
|
7684
|
+
paddingRight: '2px'
|
|
7685
|
+
},
|
|
7686
|
+
children: fullTitle
|
|
7687
|
+
}), panelId && jsx(Box, {
|
|
7688
|
+
component: "span",
|
|
7689
|
+
sx: {
|
|
7690
|
+
flexShrink: 0,
|
|
7691
|
+
ml: 1,
|
|
7692
|
+
fontStyle: 'normal',
|
|
7693
|
+
fontWeight: 400,
|
|
7694
|
+
whiteSpace: 'nowrap',
|
|
7695
|
+
color: isViewPresetDialogOpen ? 'geowebColors.text.inverse' : 'geowebColors.captions.captionStatus.rgba'
|
|
7696
|
+
},
|
|
7697
|
+
children: panelId
|
|
7698
|
+
})]
|
|
7699
|
+
})
|
|
7700
|
+
}), jsx(WorkspaceOptions, {
|
|
7701
|
+
handleSave: isEnabled ? onSave : undefined,
|
|
7702
|
+
handleDelete: isEnabled ? onDelete : undefined,
|
|
7703
|
+
handleSaveAs: isLoggedIn ? onSaveAs : undefined,
|
|
7704
|
+
handleEdit: isEnabled ? onEdit : undefined,
|
|
7705
|
+
handleReset: onReset,
|
|
7706
|
+
id: viewPresetOptionId
|
|
7707
|
+
})]
|
|
7708
|
+
}), jsx(Box, {
|
|
7709
|
+
sx: {
|
|
7710
|
+
display: 'flex',
|
|
7711
|
+
alignItems: 'center',
|
|
7712
|
+
pt: 0.72
|
|
7713
|
+
},
|
|
7714
|
+
children: jsx(LoadingIndicatorConnect, {
|
|
7715
|
+
panelId: panelId
|
|
7716
|
+
})
|
|
7717
|
+
})]
|
|
7718
|
+
})
|
|
7719
|
+
);
|
|
7720
|
+
};
|
|
7721
|
+
var WorkspaceViewTitleConnect = /*#__PURE__*/React.memo(WorkspaceViewTitleConnectNoMemo);
|
|
7722
|
+
|
|
7723
|
+
/* *
|
|
7724
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7725
|
+
* you may not use this file except in compliance with the License.
|
|
7726
|
+
* You may obtain a copy of the License at
|
|
7727
|
+
*
|
|
7728
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7729
|
+
*
|
|
7730
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7731
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7732
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7733
|
+
* See the License for the specific language governing permissions and
|
|
7734
|
+
* limitations under the License.
|
|
7735
|
+
*
|
|
7736
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
7737
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
7738
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
7739
|
+
* */
|
|
7740
|
+
var getUniqueId = function getUniqueId(existingIds, count) {
|
|
7741
|
+
if (count === void 0) {
|
|
7742
|
+
count = 1;
|
|
7743
|
+
}
|
|
7744
|
+
var newId = count + "_screen";
|
|
7745
|
+
if (existingIds.indexOf(newId) !== -1) {
|
|
7746
|
+
return getUniqueId(existingIds, count + 1);
|
|
7747
|
+
}
|
|
7748
|
+
return newId;
|
|
7749
|
+
};
|
|
7750
|
+
var createBalancedMosaicNode = function createBalancedMosaicNode(currentNode) {
|
|
7751
|
+
var leaves = getLeaves(currentNode);
|
|
7752
|
+
return createBalancedTreeFromLeaves(leaves);
|
|
7753
|
+
};
|
|
7754
|
+
var closeDialogsWhenChangingPreset = function closeDialogsWhenChangingPreset(componentTypes, dispatch) {
|
|
7755
|
+
if (!componentTypes || componentTypes.length === 0 || componentTypes.some(function (componentType) {
|
|
7756
|
+
return componentType.toLowerCase().includes('viewloading');
|
|
7757
|
+
})) {
|
|
7758
|
+
return;
|
|
7759
|
+
}
|
|
7760
|
+
// Close all dialogs related to timeseries
|
|
7761
|
+
if (!componentTypes.some(function (componentType) {
|
|
7762
|
+
return componentType.toLowerCase().includes('timeseries');
|
|
7763
|
+
})) {
|
|
7764
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
7765
|
+
setOpen: false,
|
|
7766
|
+
type: uiTypes.DialogTypes.TimeSeriesManager
|
|
7767
|
+
}));
|
|
7768
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
7769
|
+
setOpen: false,
|
|
7770
|
+
type: uiTypes.DialogTypes.TimeSeriesSelect
|
|
7771
|
+
}));
|
|
7772
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
7773
|
+
setOpen: false,
|
|
7774
|
+
type: uiTypes.DialogTypes.TimeSeriesInfo
|
|
7775
|
+
}));
|
|
7776
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
7777
|
+
setOpen: false,
|
|
7778
|
+
type: uiTypes.DialogTypes.TimeSeriesLocationInfo
|
|
7779
|
+
}));
|
|
7780
|
+
}
|
|
7781
|
+
// Close all dialogs related to soundings
|
|
7782
|
+
if (!componentTypes.some(function (componentType) {
|
|
7783
|
+
return componentType.toLowerCase().includes('soundings');
|
|
7784
|
+
})) {
|
|
7785
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
7786
|
+
setOpen: false,
|
|
7787
|
+
type: uiTypes.DialogTypes.SoundingsLocations
|
|
7788
|
+
}));
|
|
7789
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
7790
|
+
setOpen: false,
|
|
7791
|
+
type: uiTypes.DialogTypes.SoundingsSources
|
|
7792
|
+
}));
|
|
7793
|
+
}
|
|
7794
|
+
// Close dialogs related to the warninglist
|
|
7795
|
+
if (!componentTypes.some(function (componentType) {
|
|
7796
|
+
return componentType.toLowerCase().includes('warninglist');
|
|
7797
|
+
}) && !componentTypes.some(function (componentType) {
|
|
7798
|
+
return componentType.toLowerCase().includes('map');
|
|
7799
|
+
})) {
|
|
7800
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
7801
|
+
setOpen: false,
|
|
7802
|
+
type: uiTypes.DialogTypes.PublicWarnings
|
|
7803
|
+
}));
|
|
7804
|
+
}
|
|
7805
|
+
};
|
|
7741
7806
|
|
|
7742
|
-
var
|
|
7743
|
-
var
|
|
7744
|
-
|
|
7745
|
-
updateViews = _ref.updateViews,
|
|
7746
|
-
activeWindowId = _ref.activeWindowId,
|
|
7747
|
-
setActiveWindowId = _ref.setActiveWindowId,
|
|
7748
|
-
_ref$isWorkspaceLoadi = _ref.isWorkspaceLoading,
|
|
7749
|
-
isWorkspaceLoading = _ref$isWorkspaceLoadi === void 0 ? false : _ref$isWorkspaceLoadi;
|
|
7807
|
+
var LinkMenuConnect = function LinkMenuConnect(_ref) {
|
|
7808
|
+
var panelId = _ref.panelId;
|
|
7809
|
+
var dispatch = useDispatch();
|
|
7750
7810
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7751
7811
|
t = _useWorkspaceTranslat.t;
|
|
7752
|
-
var
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
7757
|
-
justifyContent: 'center',
|
|
7758
|
-
alignItems: 'center',
|
|
7759
|
-
height: '100%'
|
|
7760
|
-
},
|
|
7761
|
-
children: [jsx(WebAssetOff, {
|
|
7762
|
-
sx: {
|
|
7763
|
-
fontSize: '150px',
|
|
7764
|
-
margin: '20px'
|
|
7765
|
-
}
|
|
7766
|
-
}), jsx(Typography, {
|
|
7767
|
-
sx: {
|
|
7768
|
-
color: 'geowebColors.typographyAndIcons.text'
|
|
7769
|
-
},
|
|
7770
|
-
children: t('geoweb-welcome')
|
|
7771
|
-
})]
|
|
7812
|
+
var _React$useState = React__default.useState(null),
|
|
7813
|
+
anchorEl = _React$useState[0],
|
|
7814
|
+
setAnchorEl = _React$useState[1];
|
|
7815
|
+
var maps = useSelector(function (store) {
|
|
7816
|
+
return mapSelectors.getAllMapIds(store);
|
|
7772
7817
|
});
|
|
7773
|
-
|
|
7774
|
-
var
|
|
7775
|
-
|
|
7776
|
-
|
|
7777
|
-
|
|
7778
|
-
|
|
7779
|
-
|
|
7780
|
-
|
|
7781
|
-
|
|
7782
|
-
|
|
7783
|
-
|
|
7784
|
-
return
|
|
7818
|
+
var viewsById = useSelector(getViewsById);
|
|
7819
|
+
var selectedMapIds = useSelector(function (store) {
|
|
7820
|
+
return genericSelectors.getLinkedMaps(store, panelId);
|
|
7821
|
+
});
|
|
7822
|
+
var viewComponentType = useSelector(function (store) {
|
|
7823
|
+
return getViewComponentType(store, panelId);
|
|
7824
|
+
});
|
|
7825
|
+
var sharedFeature = useSelector(function (store) {
|
|
7826
|
+
return genericSelectors.getSelectedFeature(store.syncGroups, panelId);
|
|
7827
|
+
});
|
|
7828
|
+
var mapPinLocation = useSelector(function (store) {
|
|
7829
|
+
return mapSelectors.getPinLocation(store, selectedMapIds[0] || '');
|
|
7830
|
+
});
|
|
7831
|
+
var handleLinkViews = function handleLinkViews(event) {
|
|
7832
|
+
setAnchorEl(event.currentTarget);
|
|
7785
7833
|
};
|
|
7786
|
-
var
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7834
|
+
var handleMenuClose = function handleMenuClose() {
|
|
7835
|
+
setAnchorEl(null);
|
|
7836
|
+
};
|
|
7837
|
+
var handleMapSelect = function handleMapSelect(mapId) {
|
|
7838
|
+
var updatedMapIds = selectedMapIds.includes(mapId) ? selectedMapIds.filter(function (id) {
|
|
7839
|
+
return id !== mapId;
|
|
7840
|
+
}) : [].concat(selectedMapIds, [mapId]);
|
|
7841
|
+
dispatch(genericActions.updateLinkedMap({
|
|
7842
|
+
panelId: panelId,
|
|
7843
|
+
mapIds: updatedMapIds
|
|
7844
|
+
}));
|
|
7845
|
+
// Sync pin to newly added map for TimeSeries components
|
|
7846
|
+
if (!selectedMapIds.includes(mapId) && viewComponentType === 'TimeSeries') {
|
|
7847
|
+
// Observation station
|
|
7848
|
+
if (sharedFeature) {
|
|
7849
|
+
dispatch(mapActions.setMapPinLocation({
|
|
7850
|
+
mapId: mapId,
|
|
7851
|
+
mapPinLocation: {
|
|
7852
|
+
lon: sharedFeature.lon,
|
|
7853
|
+
lat: sharedFeature.lat
|
|
7854
|
+
}
|
|
7855
|
+
}));
|
|
7856
|
+
// Grid
|
|
7857
|
+
} else if (mapPinLocation) {
|
|
7858
|
+
dispatch(mapActions.setMapPinLocation({
|
|
7859
|
+
mapId: mapId,
|
|
7860
|
+
mapPinLocation: mapPinLocation
|
|
7861
|
+
}));
|
|
7862
|
+
}
|
|
7791
7863
|
}
|
|
7792
7864
|
};
|
|
7793
|
-
return
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7865
|
+
return jsxs(Fragment, {
|
|
7866
|
+
children: [linkComponentTypesConstants.supportedComponentTypesForLinking.includes(viewComponentType) && jsx(CustomIconButton, {
|
|
7867
|
+
onClick: handleLinkViews,
|
|
7868
|
+
"data-testid": "icon-button",
|
|
7869
|
+
tooltipTitle: "Link " + viewComponentType,
|
|
7870
|
+
sx: {
|
|
7871
|
+
marginLeft: 0.5,
|
|
7872
|
+
marginRight: 0.5
|
|
7800
7873
|
},
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
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
|
-
|
|
7874
|
+
children: selectedMapIds.length > 0 ? jsx(Link, {
|
|
7875
|
+
"data-testid": "link-icon",
|
|
7876
|
+
style: {
|
|
7877
|
+
fill: anchorEl ? 'white' : undefined,
|
|
7878
|
+
backgroundColor: anchorEl ? '#186DFF' : undefined
|
|
7879
|
+
}
|
|
7880
|
+
}) : jsx(LinkOff, {
|
|
7881
|
+
"data-testid": "link-off-icon",
|
|
7882
|
+
style: {
|
|
7883
|
+
fill: anchorEl ? 'white' : undefined,
|
|
7884
|
+
backgroundColor: anchorEl ? '#186DFF' : undefined
|
|
7885
|
+
}
|
|
7886
|
+
})
|
|
7887
|
+
}), jsxs(Menu, {
|
|
7888
|
+
id: "map-select-menu",
|
|
7889
|
+
"data-testid": "map-select-menu",
|
|
7890
|
+
anchorEl: anchorEl,
|
|
7891
|
+
open: Boolean(anchorEl),
|
|
7892
|
+
onClose: handleMenuClose,
|
|
7893
|
+
keepMounted: true,
|
|
7894
|
+
children: [jsxs(Typography, {
|
|
7895
|
+
variant: "h6",
|
|
7896
|
+
style: {
|
|
7897
|
+
padding: '10px 15px 0',
|
|
7898
|
+
fontWeight: 'bold'
|
|
7899
|
+
},
|
|
7900
|
+
children: [t('workspace-link'), " - ", t('workspace-link-location-header')]
|
|
7901
|
+
}), jsx(List, {
|
|
7902
|
+
dense: true,
|
|
7903
|
+
children: maps.map(function (mapId) {
|
|
7904
|
+
var _viewsById$mapId;
|
|
7905
|
+
var labelId = "checkbox-link-label-" + mapId;
|
|
7906
|
+
return jsx(ListItem, {
|
|
7907
|
+
onClick: function onClick() {
|
|
7908
|
+
return handleMapSelect(mapId);
|
|
7909
|
+
},
|
|
7910
|
+
disablePadding: true,
|
|
7911
|
+
dense: true,
|
|
7912
|
+
divider: true,
|
|
7913
|
+
children: jsxs(ListItemButton, {
|
|
7914
|
+
role: "checkbox",
|
|
7915
|
+
dense: true,
|
|
7916
|
+
sx: {
|
|
7917
|
+
margin: 0,
|
|
7918
|
+
padding: '0 16px'
|
|
7830
7919
|
},
|
|
7831
|
-
|
|
7832
|
-
|
|
7833
|
-
|
|
7834
|
-
|
|
7835
|
-
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
7841
|
-
|
|
7842
|
-
|
|
7843
|
-
|
|
7844
|
-
|
|
7845
|
-
|
|
7846
|
-
|
|
7847
|
-
|
|
7848
|
-
|
|
7849
|
-
|
|
7920
|
+
children: [jsx(ListItemIcon, {
|
|
7921
|
+
children: jsx(Checkbox, {
|
|
7922
|
+
edge: "start",
|
|
7923
|
+
tabIndex: -1,
|
|
7924
|
+
checked: selectedMapIds.includes(mapId),
|
|
7925
|
+
disableRipple: true,
|
|
7926
|
+
inputProps: {
|
|
7927
|
+
'aria-labelledby': labelId
|
|
7928
|
+
}
|
|
7929
|
+
})
|
|
7930
|
+
}), jsx(ListItemText, {
|
|
7931
|
+
id: labelId,
|
|
7932
|
+
primary: (_viewsById$mapId = viewsById[mapId]) == null ? void 0 : _viewsById$mapId.title,
|
|
7933
|
+
secondary: mapId
|
|
7934
|
+
})]
|
|
7935
|
+
})
|
|
7936
|
+
}, mapId);
|
|
7937
|
+
})
|
|
7938
|
+
})]
|
|
7939
|
+
})]
|
|
7850
7940
|
});
|
|
7851
7941
|
};
|
|
7852
|
-
var useControlActiveWindowId = function useControlActiveWindowId(screenConfig, activeWindowId, setActiveWindowId) {
|
|
7853
|
-
// When screenConfig.id changes it means a new preset was chosen.
|
|
7854
|
-
React.useEffect(function () {
|
|
7855
|
-
if (screenConfig.id !== '' && screenConfig.mosaicNode) {
|
|
7856
|
-
var mosaicNode = screenConfig.mosaicNode;
|
|
7857
|
-
while (!isString(mosaicNode)) {
|
|
7858
|
-
mosaicNode = mosaicNode.first;
|
|
7859
|
-
}
|
|
7860
|
-
setActiveWindowId(mosaicNode);
|
|
7861
|
-
}
|
|
7862
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7863
|
-
}, [screenConfig.id]);
|
|
7864
|
-
// If active window is no longer in screenConfig then set active window to first window
|
|
7865
|
-
React.useEffect(function () {
|
|
7866
|
-
var viewIds = screenConfig.views.allIds;
|
|
7867
|
-
if (activeWindowId !== undefined && viewIds && viewIds.length > 0 && !viewIds.includes(activeWindowId)) {
|
|
7868
|
-
setActiveWindowId(viewIds[0]);
|
|
7869
|
-
}
|
|
7870
|
-
}, [activeWindowId, screenConfig.views, screenConfig.views.allIds, setActiveWindowId]);
|
|
7871
|
-
};
|
|
7872
7942
|
|
|
7873
|
-
var
|
|
7874
|
-
|
|
7875
|
-
|
|
7876
|
-
|
|
7877
|
-
|
|
7878
|
-
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
|
|
7883
|
-
|
|
7884
|
-
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
var
|
|
7888
|
-
|
|
7889
|
-
activeWindowId: activeWindowId
|
|
7890
|
-
}));
|
|
7891
|
-
}, [dispatch]);
|
|
7892
|
-
var activeWindowId = useSelector(uiSelectors.getActiveWindowId);
|
|
7943
|
+
var buttonStyle = {
|
|
7944
|
+
marginLeft: 0.5,
|
|
7945
|
+
marginRight: 0.5
|
|
7946
|
+
};
|
|
7947
|
+
var WorkspaceControls = function WorkspaceControls(_ref) {
|
|
7948
|
+
var panelId = _ref.panelId,
|
|
7949
|
+
createNode = _ref.createNode,
|
|
7950
|
+
path = _ref.path,
|
|
7951
|
+
_ref$shouldPreventClo = _ref.shouldPreventCloseView,
|
|
7952
|
+
shouldPreventCloseView = _ref$shouldPreventClo === void 0 ? false : _ref$shouldPreventClo,
|
|
7953
|
+
removeLinkedMap = _ref.removeLinkedMap;
|
|
7954
|
+
var confirmDialog = useConfirmationDialog();
|
|
7955
|
+
var _React$useContext = React.useContext(MosaicContext),
|
|
7956
|
+
actions = _React$useContext.mosaicActions;
|
|
7957
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7958
|
+
t = _useWorkspaceTranslat.t;
|
|
7893
7959
|
var mosaicNode = useSelector(function (store) {
|
|
7894
7960
|
return getMosaicNode(store);
|
|
7895
7961
|
});
|
|
7896
|
-
var
|
|
7897
|
-
|
|
7898
|
-
|
|
7962
|
+
var _React$useState = React.useState(),
|
|
7963
|
+
stateAfterExpand = _React$useState[0],
|
|
7964
|
+
setStateAfterExpand = _React$useState[1];
|
|
7965
|
+
var _React$useState2 = React.useState(mosaicNode),
|
|
7966
|
+
stateBeforeExpand = _React$useState2[0],
|
|
7967
|
+
setStateBeforeExpand = _React$useState2[1];
|
|
7968
|
+
var _React$useState3 = React.useState(false),
|
|
7969
|
+
enableUnexpand = _React$useState3[0],
|
|
7970
|
+
setEnableUnexpand = _React$useState3[1];
|
|
7971
|
+
React.useEffect(function () {
|
|
7972
|
+
if (enableUnexpand) {
|
|
7973
|
+
if (stateAfterExpand === undefined) {
|
|
7974
|
+
setStateAfterExpand(mosaicNode);
|
|
7975
|
+
return;
|
|
7976
|
+
}
|
|
7977
|
+
if (!isEqual(mosaicNode, stateAfterExpand)) {
|
|
7978
|
+
setEnableUnexpand(false);
|
|
7979
|
+
setStateAfterExpand(undefined);
|
|
7980
|
+
}
|
|
7981
|
+
}
|
|
7982
|
+
}, [enableUnexpand, mosaicNode, stateAfterExpand]);
|
|
7983
|
+
var onClose = /*#__PURE__*/function () {
|
|
7984
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
7985
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7986
|
+
while (1) switch (_context.prev = _context.next) {
|
|
7987
|
+
case 0:
|
|
7988
|
+
if (!shouldPreventCloseView) {
|
|
7989
|
+
_context.next = 7;
|
|
7990
|
+
break;
|
|
7991
|
+
}
|
|
7992
|
+
_context.next = 3;
|
|
7993
|
+
return confirmDialog({
|
|
7994
|
+
title: t('workspace-control-close-message-title'),
|
|
7995
|
+
description: t('workspace-control-close-message-description'),
|
|
7996
|
+
confirmLabel: t('workspace-control-close')
|
|
7997
|
+
});
|
|
7998
|
+
case 3:
|
|
7999
|
+
actions.remove(path);
|
|
8000
|
+
removeLinkedMap(panelId);
|
|
8001
|
+
_context.next = 9;
|
|
8002
|
+
break;
|
|
8003
|
+
case 7:
|
|
8004
|
+
actions.remove(path);
|
|
8005
|
+
removeLinkedMap(panelId);
|
|
8006
|
+
case 9:
|
|
8007
|
+
case "end":
|
|
8008
|
+
return _context.stop();
|
|
8009
|
+
}
|
|
8010
|
+
}, _callee);
|
|
7899
8011
|
}));
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
autoArrange();
|
|
7903
|
-
}, [autoArrange]);
|
|
7904
|
-
var componentTypes = useSelector(function (store) {
|
|
7905
|
-
return getComponentTypesFromActiveViews(store);
|
|
7906
|
-
});
|
|
7907
|
-
React__default.useEffect(function () {
|
|
7908
|
-
closeDialogsWhenChangingPreset(componentTypes, dispatch);
|
|
7909
|
-
}, [componentTypes, dispatch]);
|
|
7910
|
-
React__default.useEffect(function () {
|
|
7911
|
-
window.addEventListener('orientationchange', handleOrientationChange);
|
|
7912
|
-
return function () {
|
|
7913
|
-
return window.removeEventListener('orientationchange', handleOrientationChange);
|
|
8012
|
+
return function onClose() {
|
|
8013
|
+
return _ref2.apply(this, arguments);
|
|
7914
8014
|
};
|
|
7915
|
-
}
|
|
7916
|
-
return
|
|
7917
|
-
|
|
7918
|
-
|
|
7919
|
-
|
|
7920
|
-
|
|
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
|
-
|
|
8015
|
+
}();
|
|
8016
|
+
return jsxs(Fragment, {
|
|
8017
|
+
children: [jsx(LinkMenuConnect, {
|
|
8018
|
+
panelId: panelId
|
|
8019
|
+
}), jsx(CustomIconButton, {
|
|
8020
|
+
"data-testid": "split-horizontal-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: 'column',
|
|
8027
|
+
first: previousNode,
|
|
8028
|
+
second: newNode
|
|
8029
|
+
});
|
|
8030
|
+
},
|
|
8031
|
+
tooltipTitle: t('workspace-control-split-horizontal'),
|
|
8032
|
+
children: jsx(SplitVertical, {})
|
|
8033
|
+
}), jsx(CustomIconButton, {
|
|
8034
|
+
"data-testid": "split-vertical-btn",
|
|
8035
|
+
sx: buttonStyle,
|
|
8036
|
+
onClick: function onClick() {
|
|
8037
|
+
var newNode = createNode();
|
|
8038
|
+
var previousNode = getAndAssertNodeAtPathExists(actions.getRoot(), path);
|
|
8039
|
+
actions.replaceWith(path, {
|
|
8040
|
+
direction: 'row',
|
|
8041
|
+
first: previousNode,
|
|
8042
|
+
second: newNode
|
|
8043
|
+
});
|
|
8044
|
+
},
|
|
8045
|
+
tooltipTitle: t('workspace-control-split-vertical'),
|
|
8046
|
+
children: jsx(SplitHorizontal, {})
|
|
8047
|
+
}), !enableUnexpand || isString(mosaicNode) ? jsx(CustomIconButton, {
|
|
8048
|
+
"data-testid": "expand-btn",
|
|
8049
|
+
sx: buttonStyle,
|
|
8050
|
+
onClick: function onClick() {
|
|
8051
|
+
setStateBeforeExpand(mosaicNode);
|
|
8052
|
+
setEnableUnexpand(true);
|
|
8053
|
+
actions.expand(path, 70);
|
|
8054
|
+
},
|
|
8055
|
+
tooltipTitle: t('workspace-control-expand'),
|
|
8056
|
+
children: jsx(Expand, {})
|
|
8057
|
+
}) : jsx(CustomIconButton, {
|
|
8058
|
+
"data-testid": "unexpand-btn",
|
|
8059
|
+
sx: buttonStyle,
|
|
8060
|
+
onClick: function onClick() {
|
|
8061
|
+
var stateBeforeExpandCopy = isString(stateBeforeExpand) ? stateBeforeExpand : Object.assign({}, stateBeforeExpand);
|
|
8062
|
+
actions.replaceWith([], stateBeforeExpandCopy);
|
|
8063
|
+
},
|
|
8064
|
+
tooltipTitle: t('workspace-control-unexpand'),
|
|
8065
|
+
children: jsx(UnExpand, {})
|
|
8066
|
+
}), jsx(CustomIconButton, {
|
|
8067
|
+
"data-testid": "close-btn",
|
|
8068
|
+
sx: buttonStyle,
|
|
8069
|
+
onClick: onClose,
|
|
8070
|
+
tooltipTitle: t('workspace-control-close'),
|
|
8071
|
+
id: "close-window-button",
|
|
8072
|
+
children: jsx(Close, {})
|
|
8073
|
+
})]
|
|
8074
|
+
});
|
|
7969
8075
|
};
|
|
7970
8076
|
|
|
7971
|
-
var
|
|
7972
|
-
var
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7978
|
-
var
|
|
7979
|
-
|
|
7980
|
-
var workspacePresets = useSelector(function (store) {
|
|
7981
|
-
return getWorkspaceList(store);
|
|
8077
|
+
var WorkspaceTileConnect = /*#__PURE__*/React.memo(function (_ref) {
|
|
8078
|
+
var _ref$mosaicNodeId = _ref.mosaicNodeId,
|
|
8079
|
+
mosaicNodeId = _ref$mosaicNodeId === void 0 ? '' : _ref$mosaicNodeId,
|
|
8080
|
+
path = _ref.path,
|
|
8081
|
+
componentsLookUp = _ref.componentsLookUp;
|
|
8082
|
+
var dispatch = useDispatch();
|
|
8083
|
+
useFetchViewPresets(mosaicNodeId);
|
|
8084
|
+
var view = useSelector(function (store) {
|
|
8085
|
+
return getViewById(store, mosaicNodeId);
|
|
7982
8086
|
});
|
|
7983
|
-
var
|
|
7984
|
-
|
|
7985
|
-
return filterAndSortPresets(workspacePresets, selectedFilters, username, isAdmin);
|
|
7986
|
-
}, [workspacePresets, selectedFilters, username, isAdmin]);
|
|
7987
|
-
var currentView = useSelector(function (store) {
|
|
7988
|
-
return getWorkspaceState(store);
|
|
8087
|
+
var viewIds = useSelector(function (store) {
|
|
8088
|
+
return getViewIds(store);
|
|
7989
8089
|
});
|
|
7990
|
-
var
|
|
7991
|
-
return
|
|
8090
|
+
var shouldPreventCloseView = useSelector(function (store) {
|
|
8091
|
+
return getShouldPreventClose(store, mosaicNodeId);
|
|
7992
8092
|
});
|
|
7993
|
-
var
|
|
7994
|
-
return
|
|
8093
|
+
var isViewPresetDialogOpen = useSelector(function (store) {
|
|
8094
|
+
return getIsViewPresetListDialogOpen(store, mosaicNodeId);
|
|
7995
8095
|
});
|
|
7996
|
-
var
|
|
7997
|
-
return
|
|
8096
|
+
var isViewPresetsFetching = useSelector(function (store) {
|
|
8097
|
+
return getViewPresetsIsFetching(store, mosaicNodeId);
|
|
7998
8098
|
});
|
|
7999
|
-
var
|
|
8000
|
-
return
|
|
8099
|
+
var errorViewPreset = useSelector(function (store) {
|
|
8100
|
+
return getViewPresetDetailError(store, mosaicNodeId);
|
|
8001
8101
|
});
|
|
8002
|
-
var
|
|
8003
|
-
|
|
8004
|
-
t = _useWorkspaceTranslat.t;
|
|
8005
|
-
var fetchWorkspaceList = React.useCallback(function () {
|
|
8006
|
-
var filterParams = constructFilterParams([], workspaceSearchQuery);
|
|
8007
|
-
dispatch(workspaceListActions.fetchWorkspaceList(filterParams));
|
|
8008
|
-
}, [dispatch, workspaceSearchQuery]);
|
|
8009
|
-
var fetchWorkspace = React.useCallback(function (workspaceId) {
|
|
8010
|
-
dispatch(workspaceActions.fetchWorkspace({
|
|
8011
|
-
workspaceId: workspaceId
|
|
8012
|
-
}));
|
|
8013
|
-
}, [dispatch]);
|
|
8014
|
-
var setWorkspaceActionDialogOptions = React.useCallback(function (dialogOptions) {
|
|
8015
|
-
dispatch(workspaceListActions.openWorkspaceActionDialogOptions(dialogOptions));
|
|
8102
|
+
var addView = React.useCallback(function (view) {
|
|
8103
|
+
dispatch(workspaceActions.setNewWorkspaceView(view));
|
|
8016
8104
|
}, [dispatch]);
|
|
8017
|
-
var
|
|
8018
|
-
|
|
8019
|
-
|
|
8020
|
-
|
|
8021
|
-
|
|
8105
|
+
var registerView = React.useCallback(function (_ref2) {
|
|
8106
|
+
var panelId = _ref2.panelId,
|
|
8107
|
+
mapPresetId = _ref2.mapPresetId;
|
|
8108
|
+
dispatch(viewPresetActions.registerViewPreset({
|
|
8109
|
+
panelId: panelId,
|
|
8110
|
+
viewPresetId: mapPresetId
|
|
8022
8111
|
}));
|
|
8023
|
-
}, [dispatch, isAdmin]);
|
|
8024
|
-
var setSelectAllFilterChip = React.useCallback(function () {
|
|
8025
|
-
dispatch(workspaceListActions.setSelectAllFilterChip());
|
|
8026
8112
|
}, [dispatch]);
|
|
8027
|
-
var
|
|
8028
|
-
|
|
8029
|
-
|
|
8113
|
+
var unregisterView = React.useCallback(function (_ref3) {
|
|
8114
|
+
var panelId = _ref3.panelId;
|
|
8115
|
+
dispatch(viewPresetActions.unregisterViewPreset({
|
|
8116
|
+
panelId: panelId
|
|
8030
8117
|
}));
|
|
8031
8118
|
}, [dispatch]);
|
|
8032
|
-
|
|
8033
|
-
|
|
8034
|
-
|
|
8035
|
-
|
|
8036
|
-
|
|
8037
|
-
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
newMapPresetText: t('workspace-mappreset-new'),
|
|
8042
|
-
newWorkspaceText: t('workspace-new')
|
|
8119
|
+
var removeLinkedMap = React.useCallback(function (panelId) {
|
|
8120
|
+
dispatch(genericActions.removeLinkedMap(panelId));
|
|
8121
|
+
}, [dispatch]);
|
|
8122
|
+
var toggleViewPresetDialog = React.useCallback(function (_ref4) {
|
|
8123
|
+
var panelId = _ref4.panelId,
|
|
8124
|
+
isViewPresetDialogOpen = _ref4.isViewPresetDialogOpen;
|
|
8125
|
+
dispatch(viewPresetActions.toggleViewPresetListDialog({
|
|
8126
|
+
panelId: panelId,
|
|
8127
|
+
isViewPresetListDialogOpen: isViewPresetDialogOpen
|
|
8043
8128
|
}));
|
|
8044
|
-
}, [dispatch
|
|
8045
|
-
var
|
|
8046
|
-
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
|
|
8050
|
-
|
|
8051
|
-
};
|
|
8052
|
-
var onClickFilterChip = function onClickFilterChip(id, shouldSelect) {
|
|
8053
|
-
if (id === 'all') {
|
|
8054
|
-
if (shouldSelect) {
|
|
8055
|
-
setSelectAllFilterChip();
|
|
8056
|
-
}
|
|
8057
|
-
} else {
|
|
8058
|
-
toggleSelectFilterChip(id, shouldSelect);
|
|
8059
|
-
}
|
|
8060
|
-
};
|
|
8061
|
-
var onClickWorkspacePresetOption = function onClickWorkspacePresetOption(presetId, workspaceAction) {
|
|
8062
|
-
// If affectedPreset is the FE defined `New workspace` - use the definition from FE instead of BE
|
|
8063
|
-
var affectedPreset = presetId === getEmptyMapWorkspace(t).id ? getEmptyMapWorkspace(t) : workspacePresets.find(function (preset) {
|
|
8064
|
-
return preset.id === presetId;
|
|
8129
|
+
}, [dispatch]);
|
|
8130
|
+
var createNode = React.useCallback(function () {
|
|
8131
|
+
var newId = getUniqueId(viewIds);
|
|
8132
|
+
addView({
|
|
8133
|
+
componentType: 'Map',
|
|
8134
|
+
mosaicNodeId: mosaicNodeId,
|
|
8135
|
+
newId: newId
|
|
8065
8136
|
});
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
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
|
-
}), auth).then(function () {
|
|
8115
|
-
dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
8116
|
-
workspaceId: presetId,
|
|
8117
|
-
action: WorkspacePresetAction.SHARE,
|
|
8118
|
-
title: presetTitle,
|
|
8119
|
-
scope: scope,
|
|
8120
|
-
is_shared: preset.is_shared
|
|
8121
|
-
}));
|
|
8122
|
-
fetchWorkspaceList();
|
|
8123
|
-
})["catch"](function (error) {
|
|
8124
|
-
dispatch(workspaceListActions.onErrorWorkspacePresetAction({
|
|
8125
|
-
error: {
|
|
8126
|
-
message: "" + error,
|
|
8127
|
-
type: WorkspaceListErrorType.VERBATIM_ERROR,
|
|
8128
|
-
category: WorkspaceListErrorCategory.GENERIC
|
|
8129
|
-
}
|
|
8130
|
-
}));
|
|
8131
|
-
});
|
|
8132
|
-
});
|
|
8133
|
-
break;
|
|
8134
|
-
}
|
|
8135
|
-
}
|
|
8136
|
-
};
|
|
8137
|
-
var isAllSelected = workspaceListFilters.length > 0 && workspaceListFilters.every(function (filter) {
|
|
8138
|
-
return filter.isSelected;
|
|
8139
|
-
});
|
|
8140
|
-
var shouldHideNewWorkspace = !isAllSelected || workspaceSearchQuery.length > 0;
|
|
8141
|
-
return jsxs(Box, {
|
|
8142
|
-
"data-testid": "workspace-selectlist-connect",
|
|
8143
|
-
style: {
|
|
8144
|
-
display: 'flex',
|
|
8145
|
-
flexDirection: 'column',
|
|
8146
|
-
height: '100%'
|
|
8147
|
-
},
|
|
8148
|
-
tabIndex: 0,
|
|
8149
|
-
children: [isFetching && jsx(LinearProgress, {
|
|
8137
|
+
return newId;
|
|
8138
|
+
}, [addView, mosaicNodeId, viewIds]);
|
|
8139
|
+
var title = (view == null ? void 0 : view.title) || (view == null ? void 0 : view.id) || mosaicNodeId;
|
|
8140
|
+
React.useEffect(function () {
|
|
8141
|
+
var viewPresetId = (view == null ? void 0 : view.id) || '';
|
|
8142
|
+
registerView({
|
|
8143
|
+
panelId: mosaicNodeId,
|
|
8144
|
+
mapPresetId: viewPresetId
|
|
8145
|
+
});
|
|
8146
|
+
return function () {
|
|
8147
|
+
unregisterView({
|
|
8148
|
+
panelId: mosaicNodeId
|
|
8149
|
+
});
|
|
8150
|
+
};
|
|
8151
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8152
|
+
}, [registerView, unregisterView]);
|
|
8153
|
+
// generic componentsLookUp
|
|
8154
|
+
var genericComponentsLookupResult = React.useMemo(function () {
|
|
8155
|
+
return componentsLookUp({
|
|
8156
|
+
title: title,
|
|
8157
|
+
id: mosaicNodeId,
|
|
8158
|
+
componentType: view == null ? void 0 : view.componentType,
|
|
8159
|
+
initialProps: view == null ? void 0 : view.initialProps
|
|
8160
|
+
});
|
|
8161
|
+
}, [componentsLookUp, mosaicNodeId, title, view == null ? void 0 : view.componentType, view == null ? void 0 : view.initialProps]);
|
|
8162
|
+
// default componentsLookUp
|
|
8163
|
+
var defaultComponentsLookupResult = React.useMemo(function () {
|
|
8164
|
+
return defaultComponentsLookUp({
|
|
8165
|
+
viewPresetId: view == null ? void 0 : view.id,
|
|
8166
|
+
componentType: view == null ? void 0 : view.componentType,
|
|
8167
|
+
mosaicNodeId: mosaicNodeId
|
|
8168
|
+
});
|
|
8169
|
+
}, [mosaicNodeId, view == null ? void 0 : view.componentType, view == null ? void 0 : view.id]);
|
|
8170
|
+
return jsxs(MosaicWindow, {
|
|
8171
|
+
path: path,
|
|
8172
|
+
createNode: createNode,
|
|
8173
|
+
title: jsx(WorkspaceViewTitleConnect, {
|
|
8174
|
+
panelId: mosaicNodeId,
|
|
8175
|
+
isViewPresetDialogOpen: isViewPresetDialogOpen || false
|
|
8176
|
+
}),
|
|
8177
|
+
toolbarControls: jsx(WorkspaceControls, {
|
|
8178
|
+
panelId: mosaicNodeId,
|
|
8179
|
+
createNode: createNode,
|
|
8180
|
+
path: path,
|
|
8181
|
+
shouldPreventCloseView: shouldPreventCloseView,
|
|
8182
|
+
removeLinkedMap: removeLinkedMap
|
|
8183
|
+
}),
|
|
8184
|
+
children: [isViewPresetsFetching && jsx(LinearProgress, {
|
|
8150
8185
|
"data-testid": "loading-bar",
|
|
8151
8186
|
color: "secondary",
|
|
8152
8187
|
sx: {
|
|
8153
8188
|
position: 'absolute',
|
|
8154
8189
|
width: '100%',
|
|
8155
8190
|
top: 0,
|
|
8156
|
-
|
|
8191
|
+
zIndex: 1001
|
|
8157
8192
|
}
|
|
8158
|
-
}),
|
|
8159
|
-
|
|
8160
|
-
|
|
8193
|
+
}), errorViewPreset && jsx(Box, {
|
|
8194
|
+
sx: {
|
|
8195
|
+
position: 'absolute',
|
|
8196
|
+
left: 0,
|
|
8197
|
+
right: 0,
|
|
8198
|
+
zIndex: 1002
|
|
8161
8199
|
},
|
|
8162
|
-
children: jsx(AlertBanner,
|
|
8163
|
-
title:
|
|
8164
|
-
GENERIC: '',
|
|
8165
|
-
AUTH: t('workspace-error-auth')
|
|
8166
|
-
}[error.category]) != null ? _GENERIC$AUTH$error$c : t('workspace-error-fetch'),
|
|
8167
|
-
info: error.type === WorkspaceListErrorType.TRANSLATABLE_ERROR ? t(error.key, error.params) : error.message,
|
|
8200
|
+
children: jsx(AlertBanner, {
|
|
8201
|
+
title: errorViewPreset,
|
|
8168
8202
|
shouldClose: true
|
|
8169
|
-
}
|
|
8170
|
-
|
|
8171
|
-
|
|
8172
|
-
|
|
8173
|
-
|
|
8174
|
-
|
|
8175
|
-
|
|
8176
|
-
|
|
8177
|
-
}), jsxs(Box, {
|
|
8178
|
-
sx: {
|
|
8179
|
-
display: 'flex',
|
|
8180
|
-
flexDirection: 'column',
|
|
8181
|
-
height: '100%',
|
|
8182
|
-
padding: 1,
|
|
8183
|
-
overflow: 'hidden'
|
|
8203
|
+
})
|
|
8204
|
+
}), defaultComponentsLookupResult, genericComponentsLookupResult, jsx(ViewPresetMenu, {
|
|
8205
|
+
panelId: mosaicNodeId,
|
|
8206
|
+
closeMenu: function closeMenu() {
|
|
8207
|
+
toggleViewPresetDialog({
|
|
8208
|
+
panelId: mosaicNodeId,
|
|
8209
|
+
isViewPresetDialogOpen: false
|
|
8210
|
+
});
|
|
8184
8211
|
},
|
|
8185
|
-
|
|
8186
|
-
sx: {
|
|
8187
|
-
marginBottom: 1
|
|
8188
|
-
},
|
|
8189
|
-
children: [jsx(Box, {
|
|
8190
|
-
sx: {
|
|
8191
|
-
display: 'flex',
|
|
8192
|
-
width: '100%'
|
|
8193
|
-
},
|
|
8194
|
-
children: jsx(Filter, {
|
|
8195
|
-
filters: workspaceListFilters,
|
|
8196
|
-
onClickFilterChip: onClickFilterChip,
|
|
8197
|
-
isAllSelected: isAllSelected,
|
|
8198
|
-
searchQuery: workspaceSearchQuery,
|
|
8199
|
-
onSearch: searchFilter
|
|
8200
|
-
})
|
|
8201
|
-
}), jsx(Box, {
|
|
8202
|
-
sx: {
|
|
8203
|
-
display: 'flex',
|
|
8204
|
-
justifyContent: 'flex-start'
|
|
8205
|
-
},
|
|
8206
|
-
children: jsx(LastUpdateTime, {
|
|
8207
|
-
onPressRefresh: function onPressRefresh() {
|
|
8208
|
-
return fetchWorkspaceList();
|
|
8209
|
-
},
|
|
8210
|
-
hideLabel: true
|
|
8211
|
-
})
|
|
8212
|
-
})]
|
|
8213
|
-
}), jsx(Box, {
|
|
8214
|
-
sx: {
|
|
8215
|
-
flexGrow: 1,
|
|
8216
|
-
minHeight: 0
|
|
8217
|
-
},
|
|
8218
|
-
children: jsx(WorkspaceSelectList, {
|
|
8219
|
-
workspacePresets: filteredPresets,
|
|
8220
|
-
currentSelectedId: currentView.id || '',
|
|
8221
|
-
onClickWorkspacePreset: onClickWorkspacePreset,
|
|
8222
|
-
onClickWorkspacePresetOption: onClickWorkspacePresetOption,
|
|
8223
|
-
hideNewWorkspace: shouldHideNewWorkspace,
|
|
8224
|
-
isEditable: isLoggedIn,
|
|
8225
|
-
isAdmin: isAdmin,
|
|
8226
|
-
searchQuery: workspaceSearchQuery
|
|
8227
|
-
})
|
|
8228
|
-
})]
|
|
8212
|
+
isOpen: isViewPresetDialogOpen
|
|
8229
8213
|
})]
|
|
8230
8214
|
});
|
|
8231
|
-
};
|
|
8215
|
+
}, isEqual);
|
|
8232
8216
|
|
|
8233
|
-
var
|
|
8234
|
-
var
|
|
8235
|
-
|
|
8236
|
-
|
|
8217
|
+
var WorkspaceView = function WorkspaceView(_ref) {
|
|
8218
|
+
var screenConfig = _ref.screenConfig,
|
|
8219
|
+
componentsLookUp = _ref.componentsLookUp,
|
|
8220
|
+
updateViews = _ref.updateViews,
|
|
8221
|
+
activeWindowId = _ref.activeWindowId,
|
|
8222
|
+
setActiveWindowId = _ref.setActiveWindowId,
|
|
8223
|
+
_ref$isWorkspaceLoadi = _ref.isWorkspaceLoading,
|
|
8224
|
+
isWorkspaceLoading = _ref$isWorkspaceLoadi === void 0 ? false : _ref$isWorkspaceLoadi;
|
|
8237
8225
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
8238
8226
|
t = _useWorkspaceTranslat.t;
|
|
8239
|
-
|
|
8240
|
-
|
|
8241
|
-
|
|
8242
|
-
|
|
8243
|
-
|
|
8244
|
-
|
|
8245
|
-
|
|
8246
|
-
|
|
8247
|
-
hasLayout: false,
|
|
8248
|
-
resizableDefaultSize: {
|
|
8249
|
-
width: 380,
|
|
8250
|
-
height: '90%'
|
|
8227
|
+
var EmptyView = !isWorkspaceLoading && jsxs(Box, {
|
|
8228
|
+
sx: {
|
|
8229
|
+
backgroundColor: 'geowebColors.background.surface',
|
|
8230
|
+
display: 'flex',
|
|
8231
|
+
flexDirection: 'column',
|
|
8232
|
+
justifyContent: 'center',
|
|
8233
|
+
alignItems: 'center',
|
|
8234
|
+
height: '100%'
|
|
8251
8235
|
},
|
|
8252
|
-
|
|
8253
|
-
|
|
8254
|
-
|
|
8255
|
-
|
|
8256
|
-
}
|
|
8257
|
-
},
|
|
8258
|
-
root: {
|
|
8259
|
-
style: {
|
|
8260
|
-
top: 40
|
|
8261
|
-
}
|
|
8236
|
+
children: [jsx(WebAssetOff, {
|
|
8237
|
+
sx: {
|
|
8238
|
+
fontSize: '150px',
|
|
8239
|
+
margin: '20px'
|
|
8262
8240
|
}
|
|
8263
|
-
},
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
title: t('workspace-menu'),
|
|
8267
|
-
onClose: closeMenu,
|
|
8268
|
-
style: {
|
|
8269
|
-
width: '100%',
|
|
8270
|
-
height: '100%'
|
|
8271
|
-
},
|
|
8272
|
-
onClick: function onClick(event) {
|
|
8273
|
-
event.stopPropagation();
|
|
8241
|
+
}), jsx(Typography, {
|
|
8242
|
+
sx: {
|
|
8243
|
+
color: 'geowebColors.typographyAndIcons.text'
|
|
8274
8244
|
},
|
|
8275
|
-
children:
|
|
8276
|
-
})
|
|
8245
|
+
children: t('geoweb-welcome')
|
|
8246
|
+
})]
|
|
8277
8247
|
});
|
|
8278
|
-
|
|
8279
|
-
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
|
|
8286
|
-
|
|
8248
|
+
useControlActiveWindowId(screenConfig, activeWindowId, setActiveWindowId);
|
|
8249
|
+
var getNewViewId = function getNewViewId(element, viewId) {
|
|
8250
|
+
if (element instanceof Element) {
|
|
8251
|
+
// Check if a windows close button was clicked
|
|
8252
|
+
var target = element.closest('#close-window-button');
|
|
8253
|
+
if (target) {
|
|
8254
|
+
var viewIds = screenConfig.views.allIds;
|
|
8255
|
+
var newViewId = viewIds.length === 0 ? undefined : activeWindowId;
|
|
8256
|
+
return newViewId;
|
|
8257
|
+
}
|
|
8258
|
+
}
|
|
8259
|
+
return viewId;
|
|
8287
8260
|
};
|
|
8288
|
-
var
|
|
8289
|
-
|
|
8290
|
-
|
|
8291
|
-
|
|
8292
|
-
|
|
8293
|
-
|
|
8294
|
-
|
|
8295
|
-
|
|
8261
|
+
var handleClickOnWindow = function handleClickOnWindow(event, viewId) {
|
|
8262
|
+
var target = event.target;
|
|
8263
|
+
var newViewId = getNewViewId(target, viewId);
|
|
8264
|
+
if (newViewId !== activeWindowId) {
|
|
8265
|
+
setActiveWindowId(newViewId);
|
|
8266
|
+
}
|
|
8267
|
+
};
|
|
8268
|
+
return jsx(Box, {
|
|
8269
|
+
sx: {
|
|
8270
|
+
height: '100%',
|
|
8271
|
+
'.geoweb-mosaic .mosaic-window-title': {
|
|
8272
|
+
fontWeight: 'bold',
|
|
8273
|
+
fontSize: '12px',
|
|
8274
|
+
userSelect: 'none'
|
|
8275
|
+
},
|
|
8276
|
+
'.geoweb-mosaic .mosaic-window-body': {
|
|
8277
|
+
backgroundColor: 'geowebColors.background.surfaceApp'
|
|
8278
|
+
}
|
|
8279
|
+
},
|
|
8280
|
+
children: jsx(Mosaic, {
|
|
8281
|
+
className: "geoweb-mosaic",
|
|
8282
|
+
zeroStateView: EmptyView || undefined,
|
|
8283
|
+
initialValue: screenConfig.mosaicNode,
|
|
8284
|
+
renderTile: function renderTile(viewId, path) {
|
|
8285
|
+
var windowIsActive = viewId === activeWindowId;
|
|
8286
|
+
return jsx(Box, {
|
|
8287
|
+
onClick: function onClick(event) {
|
|
8288
|
+
return handleClickOnWindow(event, viewId);
|
|
8289
|
+
},
|
|
8290
|
+
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
8291
|
+
sx: function sx(theme) {
|
|
8292
|
+
return {
|
|
8293
|
+
'> *': {
|
|
8294
|
+
height: '100%',
|
|
8295
|
+
width: '100%'
|
|
8296
|
+
},
|
|
8297
|
+
'.mosaic-window .mosaic-window-toolbar': {
|
|
8298
|
+
backgroundColor: windowIsActive ? theme.palette.geowebColors.workspace.activeWindow : theme.palette.geowebColors.workspace.inactiveWindow
|
|
8299
|
+
},
|
|
8300
|
+
'.mosaic-window-toolbar .MuiSvgIcon-root': {
|
|
8301
|
+
fill: windowIsActive ? theme.palette.geowebColors.buttons.flat["default"].color : theme.palette.geowebColors.buttons.flat.disabled.color
|
|
8302
|
+
},
|
|
8303
|
+
'#close-window-button .MuiSvgIcon-root': {
|
|
8304
|
+
fill: theme.palette.geowebColors.buttons.flat.disabled.color
|
|
8305
|
+
},
|
|
8306
|
+
'.mosaic-window-toolbar .mosaic-window-title': {
|
|
8307
|
+
color: windowIsActive ? theme.palette.geowebColors.typographyAndIcons.text : theme.palette.geowebColors.typographyAndIcons.inactiveText
|
|
8308
|
+
}
|
|
8309
|
+
};
|
|
8310
|
+
},
|
|
8311
|
+
children: jsx(WorkspaceTileConnect, {
|
|
8312
|
+
mosaicNodeId: viewId,
|
|
8313
|
+
path: path,
|
|
8314
|
+
componentsLookUp: componentsLookUp
|
|
8315
|
+
})
|
|
8316
|
+
});
|
|
8296
8317
|
},
|
|
8297
|
-
|
|
8298
|
-
|
|
8299
|
-
|
|
8300
|
-
|
|
8301
|
-
|
|
8302
|
-
|
|
8303
|
-
|
|
8304
|
-
variant: "tool",
|
|
8305
|
-
tooltipTitle: tooltipTitle,
|
|
8306
|
-
sx: {
|
|
8307
|
-
'&&': {
|
|
8308
|
-
backgroundColor: !showMenu ? 'transparent' : undefined,
|
|
8309
|
-
'&:hover': {
|
|
8310
|
-
backgroundColor: 'geowebColors.workspace.tabButtonHover'
|
|
8311
|
-
}
|
|
8312
|
-
}
|
|
8313
|
-
},
|
|
8314
|
-
children: jsx(PresetWorkspace, {})
|
|
8315
|
-
})
|
|
8316
|
-
}), jsx(WorkspaceMenu, {
|
|
8317
|
-
isOpen: showMenu,
|
|
8318
|
-
closeMenu: onCloseMenu
|
|
8319
|
-
})]
|
|
8318
|
+
onRelease: function onRelease(node) {
|
|
8319
|
+
return updateViews(node);
|
|
8320
|
+
},
|
|
8321
|
+
resize: {
|
|
8322
|
+
minimumPaneSizePercentage: screenConfig.minimumPaneSizePercentage || 20
|
|
8323
|
+
}
|
|
8324
|
+
})
|
|
8320
8325
|
});
|
|
8321
8326
|
};
|
|
8322
|
-
|
|
8323
|
-
|
|
8324
|
-
|
|
8325
|
-
|
|
8326
|
-
|
|
8327
|
-
|
|
8328
|
-
|
|
8329
|
-
|
|
8330
|
-
|
|
8331
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
8332
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8333
|
-
* See the License for the specific language governing permissions and
|
|
8334
|
-
* limitations under the License.
|
|
8335
|
-
*
|
|
8336
|
-
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
8337
|
-
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
8338
|
-
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
8339
|
-
* */
|
|
8340
|
-
var useFetchWorkspacePresets = function useFetchWorkspacePresets() {
|
|
8341
|
-
var dispatch = useDispatch();
|
|
8342
|
-
var _useAuthenticationCon = useAuthenticationContext(),
|
|
8343
|
-
currentRole = _useAuthenticationCon.currentRole;
|
|
8344
|
-
var isAdmin = (currentRole == null ? void 0 : currentRole.name) === GEOWEB_ROLE_PRESETS_ADMIN.name;
|
|
8345
|
-
var lastAdmin = usePrevious(isAdmin);
|
|
8346
|
-
var workspaceSearchQuery = useSelector(getWorkspaceListSearchQuery);
|
|
8347
|
-
var prevSearch = usePrevious(workspaceSearchQuery);
|
|
8348
|
-
var fetchWorkspacePresets = useCallback(function (params) {
|
|
8349
|
-
dispatch(workspaceListActions.fetchWorkspaceList(params));
|
|
8350
|
-
}, [dispatch]);
|
|
8351
|
-
useEffect(function () {
|
|
8352
|
-
if (workspaceSearchQuery !== prevSearch) {
|
|
8353
|
-
var filterParams = constructFilterParams([], workspaceSearchQuery);
|
|
8354
|
-
fetchWorkspacePresets(filterParams);
|
|
8327
|
+
var useControlActiveWindowId = function useControlActiveWindowId(screenConfig, activeWindowId, setActiveWindowId) {
|
|
8328
|
+
// When screenConfig.id changes it means a new preset was chosen.
|
|
8329
|
+
React.useEffect(function () {
|
|
8330
|
+
if (screenConfig.id !== '' && screenConfig.mosaicNode) {
|
|
8331
|
+
var mosaicNode = screenConfig.mosaicNode;
|
|
8332
|
+
while (!isString(mosaicNode)) {
|
|
8333
|
+
mosaicNode = mosaicNode.first;
|
|
8334
|
+
}
|
|
8335
|
+
setActiveWindowId(mosaicNode);
|
|
8355
8336
|
}
|
|
8356
|
-
|
|
8357
|
-
|
|
8358
|
-
|
|
8359
|
-
|
|
8360
|
-
|
|
8361
|
-
|
|
8362
|
-
|
|
8363
|
-
}, {
|
|
8364
|
-
id: PresetFilterType.personal,
|
|
8365
|
-
isSelected: !isAdmin
|
|
8366
|
-
}, {
|
|
8367
|
-
id: PresetFilterType.shared,
|
|
8368
|
-
isSelected: true
|
|
8369
|
-
}];
|
|
8370
|
-
dispatch(workspaceListActions.setFilterChips(filters));
|
|
8337
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8338
|
+
}, [screenConfig.id]);
|
|
8339
|
+
// If active window is no longer in screenConfig then set active window to first window
|
|
8340
|
+
React.useEffect(function () {
|
|
8341
|
+
var viewIds = screenConfig.views.allIds;
|
|
8342
|
+
if (activeWindowId !== undefined && viewIds && viewIds.length > 0 && !viewIds.includes(activeWindowId)) {
|
|
8343
|
+
setActiveWindowId(viewIds[0]);
|
|
8371
8344
|
}
|
|
8372
|
-
}, [
|
|
8345
|
+
}, [activeWindowId, screenConfig.views, screenConfig.views.allIds, setActiveWindowId]);
|
|
8373
8346
|
};
|
|
8374
8347
|
|
|
8375
|
-
var
|
|
8348
|
+
var WorkspaceViewConnect = function WorkspaceViewConnect(_ref) {
|
|
8349
|
+
var componentsLookUp = _ref.componentsLookUp;
|
|
8376
8350
|
var dispatch = useDispatch();
|
|
8377
|
-
var
|
|
8378
|
-
return
|
|
8351
|
+
var isWorkspaceLoading$1 = useSelector(function (store) {
|
|
8352
|
+
return isWorkspaceLoading(store);
|
|
8379
8353
|
});
|
|
8380
|
-
|
|
8381
|
-
|
|
8382
|
-
|
|
8383
|
-
|
|
8354
|
+
var screenConfig = useSelector(function (store) {
|
|
8355
|
+
return getWorkspaceState(store);
|
|
8356
|
+
});
|
|
8357
|
+
var updateViews = useCallback(function (currentNode) {
|
|
8358
|
+
dispatch(workspaceActions.updateWorkspaceViews({
|
|
8359
|
+
mosaicNode: currentNode
|
|
8384
8360
|
}));
|
|
8385
8361
|
}, [dispatch]);
|
|
8386
|
-
|
|
8387
|
-
|
|
8388
|
-
|
|
8362
|
+
var setActiveWindowId = useCallback(function (activeWindowId) {
|
|
8363
|
+
dispatch(uiActions.setActiveWindowId({
|
|
8364
|
+
activeWindowId: activeWindowId
|
|
8365
|
+
}));
|
|
8366
|
+
}, [dispatch]);
|
|
8367
|
+
var activeWindowId = useSelector(uiSelectors.getActiveWindowId);
|
|
8368
|
+
var mosaicNode = useSelector(function (store) {
|
|
8369
|
+
return getMosaicNode(store);
|
|
8370
|
+
});
|
|
8371
|
+
var autoArrange = useCallback(function () {
|
|
8372
|
+
dispatch(workspaceActions.updateWorkspaceViews({
|
|
8373
|
+
mosaicNode: createBalancedMosaicNode(mosaicNode)
|
|
8374
|
+
}));
|
|
8375
|
+
}, [dispatch, mosaicNode]);
|
|
8376
|
+
var handleOrientationChange = React__default.useCallback(function () {
|
|
8377
|
+
autoArrange();
|
|
8378
|
+
}, [autoArrange]);
|
|
8379
|
+
var componentTypes = useSelector(function (store) {
|
|
8380
|
+
return getComponentTypesFromActiveViews(store);
|
|
8381
|
+
});
|
|
8382
|
+
React__default.useEffect(function () {
|
|
8383
|
+
closeDialogsWhenChangingPreset(componentTypes, dispatch);
|
|
8384
|
+
}, [componentTypes, dispatch]);
|
|
8385
|
+
React__default.useEffect(function () {
|
|
8386
|
+
window.addEventListener('orientationchange', handleOrientationChange);
|
|
8387
|
+
return function () {
|
|
8388
|
+
return window.removeEventListener('orientationchange', handleOrientationChange);
|
|
8389
|
+
};
|
|
8390
|
+
}, [handleOrientationChange]);
|
|
8391
|
+
return jsx(WorkspaceView, {
|
|
8392
|
+
screenConfig: screenConfig,
|
|
8393
|
+
componentsLookUp: componentsLookUp,
|
|
8394
|
+
updateViews: updateViews,
|
|
8395
|
+
activeWindowId: activeWindowId,
|
|
8396
|
+
setActiveWindowId: setActiveWindowId,
|
|
8397
|
+
isWorkspaceLoading: isWorkspaceLoading$1
|
|
8389
8398
|
});
|
|
8390
8399
|
};
|
|
8391
8400
|
|
|
8392
8401
|
var WorkspaceOptionsConnect = function WorkspaceOptionsConnect(_ref) {
|
|
8393
8402
|
var title = _ref.title,
|
|
8394
|
-
|
|
8395
|
-
workspaceId = _ref.workspaceId,
|
|
8396
|
-
appTitle = _ref.appTitle;
|
|
8403
|
+
workspaceId = _ref.workspaceId;
|
|
8397
8404
|
var dispatch = useDispatch();
|
|
8398
8405
|
var store = useStore();
|
|
8399
|
-
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
8400
|
-
t = _useWorkspaceTranslat.t;
|
|
8401
8406
|
var _useAuthenticationCon = useAuthenticationContext(),
|
|
8402
8407
|
currentRole = _useAuthenticationCon.currentRole,
|
|
8403
8408
|
auth = _useAuthenticationCon.auth;
|
|
8404
8409
|
var isAdmin = (currentRole == null ? void 0 : currentRole.name) === GEOWEB_ROLE_PRESETS_ADMIN.name;
|
|
8405
8410
|
var _useAuthenticationCon2 = useAuthenticationContext(),
|
|
8406
8411
|
isLoggedIn = _useAuthenticationCon2.isLoggedIn;
|
|
8407
|
-
var hasChanges = useSelector(function (store) {
|
|
8408
|
-
return hasWorkspaceChanges(store);
|
|
8409
|
-
});
|
|
8410
8412
|
var workspaceScope = useSelector(function (store) {
|
|
8411
8413
|
return getSelectedWorkspaceScope(store);
|
|
8412
8414
|
});
|
|
@@ -8414,19 +8416,15 @@ var WorkspaceOptionsConnect = function WorkspaceOptionsConnect(_ref) {
|
|
|
8414
8416
|
return getWorkspaceData(store);
|
|
8415
8417
|
});
|
|
8416
8418
|
var currentWorkspacePreset = useSelector(function (store) {
|
|
8417
|
-
return
|
|
8419
|
+
return workspaceId ? getWorkspacePresetFromList(store, workspaceId) : undefined;
|
|
8418
8420
|
});
|
|
8419
8421
|
var workspaceCreator = (currentWorkspacePreset == null ? void 0 : currentWorkspacePreset.username) || '';
|
|
8420
8422
|
var viewIds = useSelector(function (store) {
|
|
8421
8423
|
return getViewIds(store);
|
|
8422
8424
|
});
|
|
8423
|
-
var isNew = workspaceId
|
|
8424
|
-
var fullTitle = getPresetTitle(title, hasChanges, isNew, t);
|
|
8425
|
+
var isNew = !workspaceId;
|
|
8425
8426
|
var isUserPreset = workspaceScope === 'user';
|
|
8426
8427
|
var isUserPresetCreator = (auth == null ? void 0 : auth.username) === workspaceCreator;
|
|
8427
|
-
React.useEffect(function () {
|
|
8428
|
-
setDocumentTitle(fullTitle, appTitle);
|
|
8429
|
-
}, [fullTitle, appTitle]);
|
|
8430
8428
|
var setWorkspaceActionDialogOptions = React.useCallback(function (dialogOptions) {
|
|
8431
8429
|
dispatch(workspaceListActions.openWorkspaceActionDialogOptions(dialogOptions));
|
|
8432
8430
|
}, [dispatch]);
|
|
@@ -8531,15 +8529,98 @@ var WorkspaceOptionsConnect = function WorkspaceOptionsConnect(_ref) {
|
|
|
8531
8529
|
return isUserPreset && isUserPresetCreator ? onEdit : undefined;
|
|
8532
8530
|
};
|
|
8533
8531
|
return jsx(WorkspaceOptions, {
|
|
8534
|
-
|
|
8535
|
-
title: fullTitle,
|
|
8536
|
-
activeTab: activeTab,
|
|
8537
|
-
handleDelete: getOnDelete(),
|
|
8538
|
-
handleSaveAs: handleSaveAs(),
|
|
8532
|
+
isDisabled: !viewIds.length || !isLoggedIn,
|
|
8539
8533
|
handleSave: handleSave(),
|
|
8534
|
+
handleSaveAs: handleSaveAs(),
|
|
8540
8535
|
handleEdit: handleEdit(),
|
|
8541
|
-
|
|
8542
|
-
|
|
8536
|
+
handleDelete: getOnDelete(),
|
|
8537
|
+
handleReset: onReset
|
|
8538
|
+
});
|
|
8539
|
+
};
|
|
8540
|
+
|
|
8541
|
+
/* *
|
|
8542
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8543
|
+
* you may not use this file except in compliance with the License.
|
|
8544
|
+
* You may obtain a copy of the License at
|
|
8545
|
+
*
|
|
8546
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8547
|
+
*
|
|
8548
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
8549
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
8550
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8551
|
+
* See the License for the specific language governing permissions and
|
|
8552
|
+
* limitations under the License.
|
|
8553
|
+
*
|
|
8554
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
8555
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
8556
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
8557
|
+
* */
|
|
8558
|
+
var useFetchWorkspacePresets = function useFetchWorkspacePresets() {
|
|
8559
|
+
var dispatch = useDispatch();
|
|
8560
|
+
var _useAuthenticationCon = useAuthenticationContext(),
|
|
8561
|
+
currentRole = _useAuthenticationCon.currentRole;
|
|
8562
|
+
var isAdmin = (currentRole == null ? void 0 : currentRole.name) === GEOWEB_ROLE_PRESETS_ADMIN.name;
|
|
8563
|
+
var lastAdmin = usePrevious(isAdmin);
|
|
8564
|
+
var workspaceSearchQuery = useSelector(getWorkspaceListSearchQuery);
|
|
8565
|
+
var prevSearch = usePrevious(workspaceSearchQuery);
|
|
8566
|
+
var fetchWorkspacePresets = useCallback(function (params) {
|
|
8567
|
+
dispatch(workspaceListActions.fetchWorkspaceList(params));
|
|
8568
|
+
}, [dispatch]);
|
|
8569
|
+
useEffect(function () {
|
|
8570
|
+
if (workspaceSearchQuery !== prevSearch) {
|
|
8571
|
+
var filterParams = constructFilterParams([], workspaceSearchQuery);
|
|
8572
|
+
fetchWorkspacePresets(filterParams);
|
|
8573
|
+
}
|
|
8574
|
+
}, [fetchWorkspacePresets, prevSearch, workspaceSearchQuery]);
|
|
8575
|
+
useEffect(function () {
|
|
8576
|
+
if (isAdmin !== lastAdmin && lastAdmin !== undefined) {
|
|
8577
|
+
// reset list filter when user changes role
|
|
8578
|
+
var filters = [{
|
|
8579
|
+
id: PresetFilterType.system,
|
|
8580
|
+
isSelected: true
|
|
8581
|
+
}, {
|
|
8582
|
+
id: PresetFilterType.personal,
|
|
8583
|
+
isSelected: !isAdmin
|
|
8584
|
+
}, {
|
|
8585
|
+
id: PresetFilterType.shared,
|
|
8586
|
+
isSelected: true
|
|
8587
|
+
}];
|
|
8588
|
+
dispatch(workspaceListActions.setFilterChips(filters));
|
|
8589
|
+
}
|
|
8590
|
+
}, [dispatch, isAdmin, lastAdmin]);
|
|
8591
|
+
};
|
|
8592
|
+
|
|
8593
|
+
var WorkspaceMenuButtonConnect = function WorkspaceMenuButtonConnect(_ref) {
|
|
8594
|
+
var title = _ref.title,
|
|
8595
|
+
workspaceId = _ref.workspaceId,
|
|
8596
|
+
activeTab = _ref.activeTab,
|
|
8597
|
+
appTitle = _ref.appTitle;
|
|
8598
|
+
var dispatch = useDispatch();
|
|
8599
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
8600
|
+
t = _useWorkspaceTranslat.t;
|
|
8601
|
+
var hasChanges = useSelector(function (store) {
|
|
8602
|
+
return hasWorkspaceChanges(store);
|
|
8603
|
+
});
|
|
8604
|
+
var isWorkspaceListDialogOpen = useSelector(function (store) {
|
|
8605
|
+
return getIsWorkspaceListDialogOpen(store);
|
|
8606
|
+
});
|
|
8607
|
+
var setListDialogOpen = React.useCallback(function (isListDialogOpen) {
|
|
8608
|
+
dispatch(workspaceListActions.toggleWorkspaceDialog({
|
|
8609
|
+
isWorkspaceListDialogOpen: isListDialogOpen
|
|
8610
|
+
}));
|
|
8611
|
+
}, [dispatch]);
|
|
8612
|
+
useFetchWorkspacePresets();
|
|
8613
|
+
var isNew = workspaceId === undefined || workspaceId === '';
|
|
8614
|
+
var fullTitle = getPresetTitle(title, hasChanges, isNew, t);
|
|
8615
|
+
React.useEffect(function () {
|
|
8616
|
+
setDocumentTitle(fullTitle, appTitle);
|
|
8617
|
+
}, [fullTitle, appTitle]);
|
|
8618
|
+
return jsx(WorkspaceMenuButton, {
|
|
8619
|
+
title: fullTitle,
|
|
8620
|
+
activeTab: activeTab,
|
|
8621
|
+
hasChanges: hasChanges,
|
|
8622
|
+
showMenu: isWorkspaceListDialogOpen,
|
|
8623
|
+
onToggleDialog: setListDialogOpen
|
|
8543
8624
|
});
|
|
8544
8625
|
};
|
|
8545
8626
|
|
|
@@ -8555,11 +8636,14 @@ var WorkspaceTab = function WorkspaceTab(_ref) {
|
|
|
8555
8636
|
alignItems: 'center'
|
|
8556
8637
|
},
|
|
8557
8638
|
"data-testid": "workspaceTab",
|
|
8558
|
-
children: [jsx(WorkspaceMenuButtonConnect, {
|
|
8639
|
+
children: [jsx(WorkspaceMenuButtonConnect, {
|
|
8559
8640
|
title: title,
|
|
8560
|
-
activeTab: activeTab,
|
|
8561
8641
|
workspaceId: workspaceId,
|
|
8642
|
+
activeTab: activeTab,
|
|
8562
8643
|
appTitle: appTitle
|
|
8644
|
+
}), jsx(WorkspaceOptionsConnect, {
|
|
8645
|
+
title: title,
|
|
8646
|
+
workspaceId: workspaceId
|
|
8563
8647
|
})]
|
|
8564
8648
|
});
|
|
8565
8649
|
};
|