@opengeoweb/workspace 14.3.0 → 14.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.js +2354 -1002
- package/package.json +18 -17
- package/src/lib/components/LabelsPanel/PresetLabelsPanel.d.ts +14 -0
- package/src/lib/components/ViewPresetMenu/ViewPresetMenu.d.ts +1 -0
- package/src/lib/components/ViewPresetMenu/ViewPresetMenuListConnect.d.ts +3 -0
- package/src/lib/components/ViewPresetsFormDialog/ViewPresetsForm.d.ts +9 -0
- package/src/lib/components/ViewPresetsFormDialog/ViewPresetsFormDialog.d.ts +3 -1
- package/src/lib/components/ViewPresetsFormDialog/ViewPresetsFormDialogConnect.d.ts +2 -0
- package/src/lib/components/WorkspaceMenu/WorkspaceMenu.d.ts +1 -0
- package/src/lib/components/WorkspaceMenu/WorkspaceMenu.stories.d.ts +2 -0
- package/src/lib/components/WorkspacePresetsFormDialog/WorkspacePresetsFormDialog.stories.d.ts +2 -0
- package/src/lib/components/WorkspaceSelectList/WorkspaceMenuLabelsWrapper.d.ts +9 -0
- package/src/lib/components/WorkspaceSelectList/WorkspaceMenuLabelsWrapper.spec.d.ts +1 -0
- package/src/lib/components/WorkspaceSelectList/WorkspacePresetInfo.d.ts +12 -0
- package/src/lib/components/WorkspaceSelectList/WorkspacePresetInfo.spec.d.ts +1 -0
- package/src/lib/components/WorkspaceSelectList/WorkspacePresetInfo.stories.d.ts +10 -0
- package/src/lib/components/WorkspaceSelectList/WorkspaceSelectList.d.ts +2 -0
- package/src/lib/components/WorkspaceSelectList/WorkspaceSelectListConnect.d.ts +6 -1
- package/src/lib/components/WorkspaceSelectList/WorkspaceSelectListRow.d.ts +2 -0
- package/src/lib/components/WorkspaceView/SplitButtonsConnect.d.ts +8 -0
- package/src/lib/components/WorkspaceView/SplitButtonsConnect.spec.d.ts +1 -0
- package/src/lib/store/viewPresets/reducer.d.ts +3 -1
- package/src/lib/store/viewPresets/selectors.d.ts +83 -1
- package/src/lib/store/viewPresets/types.d.ts +28 -1
- package/src/lib/store/viewPresetsList/selectors.d.ts +10 -0
- package/src/lib/store/viewPresetsList/types.d.ts +5 -0
- package/src/lib/store/workspace/selectors.d.ts +16 -786
- package/src/lib/store/workspace/types.d.ts +28 -20
- package/src/lib/store/workspaceList/reducer.d.ts +3 -1
- package/src/lib/store/workspaceList/selectors.d.ts +83 -90
- package/src/lib/store/workspaceList/types.d.ts +13 -0
- package/src/lib/utils/labels.config.d.ts +2 -8
- package/src/lib/utils/utils.d.ts +3 -2
- package/src/lib/components/WorkspacePresetsFormDialog/WorkspacePresetLabelsPanel.d.ts +0 -8
- /package/src/lib/components/{WorkspacePresetsFormDialog/WorkspacePresetLabelsPanel.spec.d.ts → LabelsPanel/PresetLabelsPanel.spec.d.ts} +0 -0
package/index.esm.js
CHANGED
|
@@ -6,25 +6,25 @@ import { createApiInstance, createNonAuthApiInstance, getApi, createFakeApiInsta
|
|
|
6
6
|
import { timeSeriesActions, TimeSeriesTypes, timeSeriesSelectors, timeSeriesReducer } from '@opengeoweb/time-series';
|
|
7
7
|
import { publicWarningActions, publicWarningsSelectors, warningsTranslations, WARN_NAMESPACE } from '@opengeoweb/warnings';
|
|
8
8
|
import { snackbarTypes, snackbarActions, snackbarListener, snackbarReducer, SnackbarWrapperConnect } from '@opengeoweb/snackbar';
|
|
9
|
-
import { getAxiosErrorMessage, isAxiosError, isAxiosAuthError, safelyInitI18nForTestsAndStories, sharedTranslations, SHARED_NAMESPACE, ConfirmationServiceProvider, usePrevious, AlertBanner, sessionStorageProvider, SystemScope, CustomTooltip, SearchHighlight, ToggleMenu,
|
|
9
|
+
import { getAxiosErrorMessage, isAxiosError, isAxiosAuthError, safelyInitI18nForTestsAndStories, sharedTranslations, SHARED_NAMESPACE, ConfirmationServiceProvider, usePrevious, AlertBanner, sessionStorageProvider, SystemScope, CustomTooltip, SearchHighlight, CustomIconButton, ToggleMenu, CustomAccordion, dateUtils, SearchField, Filter, LastUpdateTime, renderCounter, CustomDialog, ToolContainer, CustomToggleButton, useConfirmationDialog, ConfirmationButtons } from '@opengeoweb/shared';
|
|
10
10
|
import { isAxiosError as isAxiosError$1 } from 'axios';
|
|
11
11
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
12
|
-
import { ThemeWrapper, lightTheme,
|
|
12
|
+
import { ThemeWrapper, lightTheme, Info, WorkspacePresetsSystemIcon, SharedPresetsMyUser, SharedPresetsOtherUsers, WorkspacePresetsMyIcon, ChevronUp, ChevronDown, LockLocked, Close, BackdropStyle, CloudLoading, CloudIdle, Options, Link, LinkOff, SplitVertical, SplitHorizontal, Expand, UnExpand, WebAssetOff, Exclamation } from '@opengeoweb/theme';
|
|
13
13
|
import { Provider, useDispatch, useSelector, useStore, shallowEqual } from 'react-redux';
|
|
14
14
|
import { useTranslation, I18nextProvider } from 'react-i18next';
|
|
15
15
|
import { AuthenticationProvider, useAuthenticationContext, GEOWEB_ROLE_PRESETS_ADMIN } from '@opengeoweb/authentication';
|
|
16
|
-
import { QueryClient, QueryClientProvider,
|
|
16
|
+
import { QueryClient, QueryClientProvider, useQuery, useMutation } from '@tanstack/react-query';
|
|
17
17
|
import i18n from 'i18next';
|
|
18
18
|
import { webmapReactTranslations, WEBMAP_REACT_NAMESPACE } from '@opengeoweb/webmap-react';
|
|
19
19
|
import { coreTranslations, CORE_NAMESPACE, LoadingIndicatorProgressBar } from '@opengeoweb/core';
|
|
20
20
|
import { formFieldsTranslations, FORM_FIELDS_NAMESPACE, ReactHookFormHiddenInput, ReactHookFormTextField, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
|
|
21
21
|
import * as React from 'react';
|
|
22
22
|
import React__default, { useCallback, useEffect } from 'react';
|
|
23
|
-
import { LinearProgress, Typography, ListItem, ListItemButton, ListItemIcon, ListItemText, Grid,
|
|
23
|
+
import { LinearProgress, Typography, Box, ListItem, ListItemButton, ListItemIcon, ListItemText, Grid, Button, Stack, FormControlLabel, Checkbox, Chip, Popper, ClickAwayListener, Paper, IconButton, Collapse, Divider, useTheme, Menu, ListSubheader, MenuItem, List, Tabs } from '@mui/material';
|
|
24
24
|
import 'react-mosaic-component/react-mosaic-component.css';
|
|
25
25
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
26
26
|
import { FixedSizeList } from 'react-window';
|
|
27
|
-
import { useFormContext, useWatch } from 'react-hook-form';
|
|
27
|
+
import { useFormContext, useWatch, useForm, FormProvider } from 'react-hook-form';
|
|
28
28
|
|
|
29
29
|
var en = {
|
|
30
30
|
"workspace-menu": "Workspace menu",
|
|
@@ -36,7 +36,9 @@ var en = {
|
|
|
36
36
|
"workspce-clear": "Clear",
|
|
37
37
|
"workspace-save": "Save",
|
|
38
38
|
"workspace-save-as": "Save as",
|
|
39
|
-
"workspace-edit": "Edit
|
|
39
|
+
"workspace-edit": "Edit metadata",
|
|
40
|
+
"workspace-dialog-description": "Short description",
|
|
41
|
+
"workspace-char-limit": "Character limitation",
|
|
40
42
|
"workspace-edit-title": "Edit title",
|
|
41
43
|
"workspace-share": "Share",
|
|
42
44
|
"workspace-stop-share": "Unshare",
|
|
@@ -57,6 +59,7 @@ var en = {
|
|
|
57
59
|
"workspace-delete-tooltip": "Delete preset",
|
|
58
60
|
"workspace-control-split-horizontal": "Split window horizontally",
|
|
59
61
|
"workspace-control-split-vertical": "Split window vertically",
|
|
62
|
+
"workspace-control-split-shift": "Hold shift to copy viewpreset content",
|
|
60
63
|
"workspace-control-expand": "Expand window",
|
|
61
64
|
"workspace-control-unexpand": "Unexpand window",
|
|
62
65
|
"workspace-control-close": "Close window",
|
|
@@ -103,7 +106,6 @@ var en = {
|
|
|
103
106
|
"workspace-reset-title": "Reset to original",
|
|
104
107
|
"workspace-dialog-delete-system": "Delete system workspace",
|
|
105
108
|
"workspace-dialog-confirm-delete-system": "The system workspace will be deleted, but all the view presets used will remain intact.",
|
|
106
|
-
"workspace-dialog-confirm-delete-user": "The workspace will be deleted, but all the view presets used will remain intact.",
|
|
107
109
|
"workspace-list-success-delete-system": "\"{{TITLE}}\" has been successfully removed from the system's workspaces.",
|
|
108
110
|
"workspace-link-location-header": "Location",
|
|
109
111
|
"workspace-link": "Link",
|
|
@@ -114,6 +116,21 @@ var en = {
|
|
|
114
116
|
"workspace-loading-indicator-loading": "Loading",
|
|
115
117
|
"workspace-loading-indicator-idle": "Loaded",
|
|
116
118
|
"workspace-open-tab": "Open in new tab",
|
|
119
|
+
"workspace-info-title": "Information",
|
|
120
|
+
"workspace-info-preset-title": "Title:",
|
|
121
|
+
"workspace-info-short-description": "Short description",
|
|
122
|
+
"workspace-info-no-description": "No description available",
|
|
123
|
+
"workspace-info-abstract": "Abstract",
|
|
124
|
+
"workspace-info-no-abstract": "No abstract available",
|
|
125
|
+
"workspace-info-selected-labels": "Selected labels ({{count}})",
|
|
126
|
+
"workspace-info-no-labels": "No labels selected",
|
|
127
|
+
"workspace-info-updated": "Date last changed",
|
|
128
|
+
"workspace-info-author": "Author",
|
|
129
|
+
"workspace-info-created": "Date created",
|
|
130
|
+
"workspace-info-created-by": "Author",
|
|
131
|
+
"workspace-info-no-date-provided": "Not provided",
|
|
132
|
+
"workspace-info-unknown-author": "Unknown",
|
|
133
|
+
"workspace-info-tooltip": "Show preset information",
|
|
117
134
|
"workspace-currently": "Currently",
|
|
118
135
|
"workspace-presets-form-labels-info": "View type will not be cleared.",
|
|
119
136
|
"workspace-presets-form-labels-clearAll": "Clear all filters ({{count}})",
|
|
@@ -139,7 +156,9 @@ var fi = {
|
|
|
139
156
|
"workspce-clear": "Tyhjennä",
|
|
140
157
|
"workspace-save": "Tallenna",
|
|
141
158
|
"workspace-save-as": "Tallenna nimellä",
|
|
142
|
-
"workspace-
|
|
159
|
+
"workspace-dialog-description": "Short description",
|
|
160
|
+
"workspace-char-limit": "Character limitation",
|
|
161
|
+
"workspace-edit": "Muokkaa metadata",
|
|
143
162
|
"workspace-edit-title": "Muokkaa otsikkoa",
|
|
144
163
|
"workspace-share": "Missing-translation",
|
|
145
164
|
"workspace-stop-share": "Missing-translation",
|
|
@@ -159,6 +178,7 @@ var fi = {
|
|
|
159
178
|
"workspace-delete-tooltip": "Poista preset",
|
|
160
179
|
"workspace-control-split-horizontal": "Jaa ikkuna vaakasuoraan",
|
|
161
180
|
"workspace-control-split-vertical": "Jaa ikkuna pystysuoraan",
|
|
181
|
+
"workspace-control-split-shift": "Pidä Shift painettuna kopioidaksesi näkymän sisällön",
|
|
162
182
|
"workspace-control-expand": "Laajenna ikkuna",
|
|
163
183
|
"workspace-control-unexpand": "Supista ikkuna",
|
|
164
184
|
"workspace-control-close": "Sulje ikkuna",
|
|
@@ -203,7 +223,6 @@ var fi = {
|
|
|
203
223
|
"workspace-reset": "Palauta alkuperäinen",
|
|
204
224
|
"workspace-reset-title": "ei käännetty",
|
|
205
225
|
"workspace-dialog-confirm-delete-system": "ei käännetty",
|
|
206
|
-
"workspace-dialog-confirm-delete-user": "Workspace poistetaan, mutta kaikki view presetit säilyvät tallennettuina.",
|
|
207
226
|
"workspace-link-location-header": "Sijainti",
|
|
208
227
|
"workspace-link": "Link",
|
|
209
228
|
"workspace-dialog-confirm-reset-view-message": "ei käännetty",
|
|
@@ -212,6 +231,21 @@ var fi = {
|
|
|
212
231
|
"workspace-viewpreset-success-unshare": "ei käännetty",
|
|
213
232
|
"workspace-loading-indicator-loading": "Ladataan",
|
|
214
233
|
"workspace-loading-indicator-idle": "Ladattu",
|
|
234
|
+
"workspace-open-tab": "Open in new tab",
|
|
235
|
+
"workspace-info-title": "Information",
|
|
236
|
+
"workspace-info-short-description": "Short description",
|
|
237
|
+
"workspace-info-no-description": "No description available",
|
|
238
|
+
"workspace-info-abstract": "Abstract",
|
|
239
|
+
"workspace-info-no-abstract": "No abstract available",
|
|
240
|
+
"workspace-info-selected-labels": "Selected labels ({{count}})",
|
|
241
|
+
"workspace-info-no-labels": "No labels selected",
|
|
242
|
+
"workspace-info-updated": "Date last changed",
|
|
243
|
+
"workspace-info-author": "Author",
|
|
244
|
+
"workspace-info-created": "Original made",
|
|
245
|
+
"workspace-info-created-by": "Author",
|
|
246
|
+
"workspace-info-no-date-provided": "Not provided",
|
|
247
|
+
"workspace-info-unknown-author": "Unknown",
|
|
248
|
+
"workspace-info-tooltip": "Show preset information",
|
|
215
249
|
"workspace-currently": "Nykyinen",
|
|
216
250
|
"workspace-presets-form-labels-info": "ei käännetty",
|
|
217
251
|
"workspace-presets-form-labels-clearAll": "ei käännetty ({{count}})",
|
|
@@ -237,7 +271,9 @@ var no = {
|
|
|
237
271
|
"workspce-clear": "Tøm",
|
|
238
272
|
"workspace-save": "Lagre",
|
|
239
273
|
"workspace-save-as": "Lagre som",
|
|
240
|
-
"workspace-
|
|
274
|
+
"workspace-dialog-description": "Kort beskrivelse",
|
|
275
|
+
"workspace-char-limit": "Tegnbegrensning",
|
|
276
|
+
"workspace-edit": "Endre metadata",
|
|
241
277
|
"workspace-edit-title": "Endre tittel",
|
|
242
278
|
"workspace-share": "Del",
|
|
243
279
|
"workspace-stop-share": "Stopp deling",
|
|
@@ -258,6 +294,7 @@ var no = {
|
|
|
258
294
|
"workspace-delete-tooltip": "Slett snarvei",
|
|
259
295
|
"workspace-control-split-horizontal": "Splitt vindu horisontalt",
|
|
260
296
|
"workspace-control-split-vertical": "Splitt vindu vertikalt",
|
|
297
|
+
"workspace-control-split-shift": "Hold shift for å kopiere viewpreset-innhold",
|
|
261
298
|
"workspace-control-expand": "Utvid vindu",
|
|
262
299
|
"workspace-control-unexpand": "Krymp vindu",
|
|
263
300
|
"workspace-control-close": "Lukk vindu",
|
|
@@ -302,7 +339,6 @@ var no = {
|
|
|
302
339
|
"workspace-reset": "Tilbakestill",
|
|
303
340
|
"workspace-reset-title": "Tilbakestill til original",
|
|
304
341
|
"workspace-dialog-confirm-delete-system": "Systemets arbeidsflate vil bli slettet, men alle vinduer som er brukt vil forbli intakte.",
|
|
305
|
-
"workspace-dialog-confirm-delete-user": "Arbeidsflaten blir slettet, men alle vinduer som er brukt vil forbli intakte.",
|
|
306
342
|
"workspace-link-location-header": "Lokasjon",
|
|
307
343
|
"workspace-link": "Link",
|
|
308
344
|
"workspace-dialog-confirm-reset-view-message": "Endringer i dette vinduet blir tapt. Er du sikker på at du vil fortsette?",
|
|
@@ -311,6 +347,21 @@ var no = {
|
|
|
311
347
|
"workspace-viewpreset-success-unshare": "Vinduet \"{{TITLE}}\" deles ikke lenger",
|
|
312
348
|
"workspace-loading-indicator-loading": "Laster inn",
|
|
313
349
|
"workspace-loading-indicator-idle": "Lastet inn",
|
|
350
|
+
"workspace-open-tab": "Åpne i ny fane",
|
|
351
|
+
"workspace-info-title": "Informasjon",
|
|
352
|
+
"workspace-info-short-description": "Kort beskrivelse",
|
|
353
|
+
"workspace-info-no-description": "Ingen beskrivelse gitt",
|
|
354
|
+
"workspace-info-abstract": "Abstrakt",
|
|
355
|
+
"workspace-info-no-abstract": "Ingen abstrakt gitt",
|
|
356
|
+
"workspace-info-selected-labels": "Valgte labels ({{count}})",
|
|
357
|
+
"workspace-info-no-labels": "Ingen valgte labels",
|
|
358
|
+
"workspace-info-updated": "Date sist endret",
|
|
359
|
+
"workspace-info-author": "Author",
|
|
360
|
+
"workspace-info-created": "Dato opprettet",
|
|
361
|
+
"workspace-info-created-by": "Forfatter",
|
|
362
|
+
"workspace-info-no-date-provided": "Ikke gitt",
|
|
363
|
+
"workspace-info-unknown-author": "Uvisst",
|
|
364
|
+
"workspace-info-tooltip": "Vis preset informasjon",
|
|
314
365
|
"workspace-currently": "Nåværende",
|
|
315
366
|
"workspace-presets-form-labels-info": "Komponent blir ikke fjernet.",
|
|
316
367
|
"workspace-presets-form-labels-clearAll": "Fjern alle filtre ({{count}})",
|
|
@@ -336,7 +387,9 @@ var nl = {
|
|
|
336
387
|
"workspce-clear": "Wissen",
|
|
337
388
|
"workspace-save": "Opslaan",
|
|
338
389
|
"workspace-save-as": "Opslaan als",
|
|
339
|
-
"workspace-
|
|
390
|
+
"workspace-dialog-description": "Korte beschrijving",
|
|
391
|
+
"workspace-char-limit": "Karakter limiet",
|
|
392
|
+
"workspace-edit": "Aanpassen metadata",
|
|
340
393
|
"workspace-edit-title": "Titel bewerken",
|
|
341
394
|
"workspace-share": "Delen",
|
|
342
395
|
"workspace-stop-share": "Stoppen met delen",
|
|
@@ -357,6 +410,7 @@ var nl = {
|
|
|
357
410
|
"workspace-delete-tooltip": "Verwijder preset",
|
|
358
411
|
"workspace-control-split-horizontal": "Splits paneel horizontaal",
|
|
359
412
|
"workspace-control-split-vertical": "Splits paneel verticaal",
|
|
413
|
+
"workspace-control-split-shift": "Houdt Shift ingedrukt om viewpreset te kopieren",
|
|
360
414
|
"workspace-control-expand": "Vergroot paneel",
|
|
361
415
|
"workspace-control-unexpand": "Verklein paneel",
|
|
362
416
|
"workspace-control-close": "Sluit paneel",
|
|
@@ -403,7 +457,6 @@ var nl = {
|
|
|
403
457
|
"workspace-dialog-confirm-delete-system": "Deze systeem workspace zal worden verwijderd, maar alle gebruikte viewpresets zullen intact blijven.",
|
|
404
458
|
"workspace-dialog-confirm-reset-personal-message": "De workspace zal worden hersteld en alle aanpassing zullen worden verwijderd. Weet je zeker dat je door wilt gaan?",
|
|
405
459
|
"workspace-list-success-delete-system": "\"{{TITLE}}\" is succesvol verwijderd uit de systeem workspaces.",
|
|
406
|
-
"workspace-dialog-confirm-delete-user": "Deze workspace zal worden verwijderd, maar alle gebruikte view presets zullen intact blijven.",
|
|
407
460
|
"workspace-link-location-header": "Locatie",
|
|
408
461
|
"workspace-link": "Link",
|
|
409
462
|
"workspace-dialog-confirm-reset-view-message": "De viewpreset zal worden hersteld en alle aanpassing zullen worden verwijderd. Weet je zeker dat je door wilt gaan?",
|
|
@@ -413,6 +466,20 @@ var nl = {
|
|
|
413
466
|
"workspace-loading-indicator-loading": "Aan het laden",
|
|
414
467
|
"workspace-loading-indicator-idle": "Klaar met laden",
|
|
415
468
|
"workspace-open-tab": "Open in nieuw tabblad",
|
|
469
|
+
"workspace-info-title": "Informatie",
|
|
470
|
+
"workspace-info-short-description": "Korte beschrijving",
|
|
471
|
+
"workspace-info-no-description": "Geen beschrijving beschikbaar",
|
|
472
|
+
"workspace-info-abstract": "Abstract",
|
|
473
|
+
"workspace-info-no-abstract": "Geen abstract beschikbaar",
|
|
474
|
+
"workspace-info-selected-labels": "Geselecteerde labels ({{count}})",
|
|
475
|
+
"workspace-info-no-labels": "Geen labels geselecteerd",
|
|
476
|
+
"workspace-info-updated": "Datum laatste aanpassing",
|
|
477
|
+
"workspace-info-author": "Auteur",
|
|
478
|
+
"workspace-info-created": "Creatie datum",
|
|
479
|
+
"workspace-info-created-by": "Auteur",
|
|
480
|
+
"workspace-info-no-date-provided": "-",
|
|
481
|
+
"workspace-info-unknown-author": "Onbekend",
|
|
482
|
+
"workspace-info-tooltip": "Toon preset informatie",
|
|
416
483
|
"workspace-currently": "Huidig",
|
|
417
484
|
"workspace-presets-form-labels-info": "niet vertaald",
|
|
418
485
|
"workspace-presets-form-labels-clearAll": "niet vertaald ({{count}})",
|
|
@@ -438,6 +505,11 @@ var workspaceTranslations = {
|
|
|
438
505
|
function _OverloadYield(e, d) {
|
|
439
506
|
this.v = e, this.k = d;
|
|
440
507
|
}
|
|
508
|
+
function _arrayLikeToArray(r, a) {
|
|
509
|
+
(null == a || a > r.length) && (a = r.length);
|
|
510
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
511
|
+
return n;
|
|
512
|
+
}
|
|
441
513
|
function asyncGeneratorStep(n, t, e, r, o, a, c) {
|
|
442
514
|
try {
|
|
443
515
|
var i = n[a](c),
|
|
@@ -463,6 +535,23 @@ function _asyncToGenerator(n) {
|
|
|
463
535
|
});
|
|
464
536
|
};
|
|
465
537
|
}
|
|
538
|
+
function _createForOfIteratorHelperLoose(r, e) {
|
|
539
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
540
|
+
if (t) return (t = t.call(r)).next.bind(t);
|
|
541
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
|
|
542
|
+
t && (r = t);
|
|
543
|
+
var o = 0;
|
|
544
|
+
return function () {
|
|
545
|
+
return o >= r.length ? {
|
|
546
|
+
done: true
|
|
547
|
+
} : {
|
|
548
|
+
done: false,
|
|
549
|
+
value: r[o++]
|
|
550
|
+
};
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
554
|
+
}
|
|
466
555
|
function _objectDestructuringEmpty(t) {
|
|
467
556
|
if (null == t) throw new TypeError("Cannot destructure " + t);
|
|
468
557
|
}
|
|
@@ -650,6 +739,13 @@ function _regeneratorValues(e) {
|
|
|
650
739
|
}
|
|
651
740
|
throw new TypeError(typeof e + " is not iterable");
|
|
652
741
|
}
|
|
742
|
+
function _unsupportedIterableToArray(r, a) {
|
|
743
|
+
if (r) {
|
|
744
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
745
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
746
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
747
|
+
}
|
|
748
|
+
}
|
|
653
749
|
function _regeneratorRuntime() {
|
|
654
750
|
|
|
655
751
|
var r = _regenerator(),
|
|
@@ -1057,7 +1153,8 @@ var initialState$3 = Object.assign({
|
|
|
1057
1153
|
isWorkspaceListDialogOpen: false
|
|
1058
1154
|
}, workspaceListAdapter.getInitialState(), {
|
|
1059
1155
|
searchQuery: '',
|
|
1060
|
-
workspaceListFilters: defaultPresetFilterState
|
|
1156
|
+
workspaceListFilters: defaultPresetFilterState,
|
|
1157
|
+
workspaceLabelFilters: undefined
|
|
1061
1158
|
});
|
|
1062
1159
|
var slice$3 = createSlice({
|
|
1063
1160
|
initialState: initialState$3,
|
|
@@ -1180,6 +1277,12 @@ var slice$3 = createSlice({
|
|
|
1180
1277
|
draft.workspaceListFilters[index] = updatedFilter;
|
|
1181
1278
|
});
|
|
1182
1279
|
},
|
|
1280
|
+
setWorkspaceLabelFilters: function setWorkspaceLabelFilters(draft, action) {
|
|
1281
|
+
draft.workspaceLabelFilters = action.payload.labels;
|
|
1282
|
+
},
|
|
1283
|
+
clearLabelFilters: function clearLabelFilters(draft) {
|
|
1284
|
+
draft.workspaceLabelFilters = undefined;
|
|
1285
|
+
},
|
|
1183
1286
|
searchFilter: function searchFilter(draft, action) {
|
|
1184
1287
|
var searchQuery = action.payload.searchQuery;
|
|
1185
1288
|
draft.searchQuery = searchQuery;
|
|
@@ -1189,6 +1292,17 @@ var slice$3 = createSlice({
|
|
|
1189
1292
|
var workspaceListReducer = slice$3.reducer,
|
|
1190
1293
|
workspaceListActions = slice$3.actions;
|
|
1191
1294
|
|
|
1295
|
+
var AVIATION_COMPONENT_TYPES = ['AirmetModule', 'SigmetModule'];
|
|
1296
|
+
var CAP_COMPONENT_TYPES = ['CapWarningList', 'CapWarningMap'];
|
|
1297
|
+
// 1) Map-like components
|
|
1298
|
+
var SUPPORTED_COMPONENT_TYPES = ['Map', 'MultiMap', 'ModelRunInterval', 'HarmonieTempAndPrecipPreset', 'TimeSlider'];
|
|
1299
|
+
// 2) TimeSeries components
|
|
1300
|
+
var SUPPORTED_TIMESERIES_COMPONENT_TYPES = ['TimeSeries'];
|
|
1301
|
+
// or keep your old union type if it already exists
|
|
1302
|
+
// 3) Warning list components
|
|
1303
|
+
var WARNING_LIST_COMPONENT_TYPES = ['WarningList', 'MaritimeWarnings'];
|
|
1304
|
+
// TODO: expand it and move to a more centralized place
|
|
1305
|
+
var ALL_COMPONENT_TYPES = [].concat(SUPPORTED_COMPONENT_TYPES, SUPPORTED_TIMESERIES_COMPONENT_TYPES, WARNING_LIST_COMPONENT_TYPES, AVIATION_COMPONENT_TYPES, CAP_COMPONENT_TYPES, ['TafModule', 'TrajksModule', 'SpaceweatherModule']);
|
|
1192
1306
|
var ViewPresetErrorComponent;
|
|
1193
1307
|
(function (ViewPresetErrorComponent) {
|
|
1194
1308
|
ViewPresetErrorComponent["PRESET_DETAIL"] = "PRESET_DETAIL";
|
|
@@ -1511,13 +1625,33 @@ var slice$2 = createSlice({
|
|
|
1511
1625
|
if (entity) {
|
|
1512
1626
|
entity.searchQuery = searchQuery;
|
|
1513
1627
|
}
|
|
1628
|
+
},
|
|
1629
|
+
setViewPresetLabelFilters: function setViewPresetLabelFilters(draft, action) {
|
|
1630
|
+
var _action$payload11 = action.payload,
|
|
1631
|
+
panelId = _action$payload11.panelId,
|
|
1632
|
+
labels = _action$payload11.labels;
|
|
1633
|
+
var entity = draft.entities[panelId];
|
|
1634
|
+
if (!entity) {
|
|
1635
|
+
return;
|
|
1636
|
+
}
|
|
1637
|
+
entity.labelFilters = labels;
|
|
1638
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
1639
|
+
},
|
|
1640
|
+
clearViewPresetLabelFilters: function clearViewPresetLabelFilters(draft, action) {
|
|
1641
|
+
var panelId = action.payload.panelId;
|
|
1642
|
+
var entity = draft.entities[panelId];
|
|
1643
|
+
if (!entity) {
|
|
1644
|
+
return;
|
|
1645
|
+
}
|
|
1646
|
+
entity.labelFilters = undefined;
|
|
1647
|
+
viewPresetsAdapter.setOne(draft, entity);
|
|
1514
1648
|
}
|
|
1515
1649
|
},
|
|
1516
1650
|
extraReducers: function extraReducers(builder) {
|
|
1517
1651
|
builder.addCase(mapActions.setMapPresetError, function (draft, action) {
|
|
1518
|
-
var _action$
|
|
1519
|
-
mapId = _action$
|
|
1520
|
-
error = _action$
|
|
1652
|
+
var _action$payload12 = action.payload,
|
|
1653
|
+
mapId = _action$payload12.mapId,
|
|
1654
|
+
error = _action$payload12.error;
|
|
1521
1655
|
var entity = draft.entities[mapId];
|
|
1522
1656
|
if (entity) {
|
|
1523
1657
|
entity.error = {
|
|
@@ -1540,9 +1674,9 @@ var slice$2 = createSlice({
|
|
|
1540
1674
|
}
|
|
1541
1675
|
});
|
|
1542
1676
|
builder.addCase(workspaceListActions.onSuccessWorkspacePresetAction, function (draft, action) {
|
|
1543
|
-
var _action$
|
|
1544
|
-
wsAction = _action$
|
|
1545
|
-
views = _action$
|
|
1677
|
+
var _action$payload13 = action.payload,
|
|
1678
|
+
wsAction = _action$payload13.action,
|
|
1679
|
+
views = _action$payload13.views;
|
|
1546
1680
|
var shouldClear = wsAction === WorkspacePresetAction.SAVE || wsAction === WorkspacePresetAction.SAVE_AS || wsAction === WorkspacePresetAction.SAVE_SYSTEM_PRESET || wsAction === WorkspacePresetAction.SAVE_SYSTEM_PRESET_AS || wsAction === WorkspacePresetAction.EDIT;
|
|
1547
1681
|
if (!shouldClear) {
|
|
1548
1682
|
return;
|
|
@@ -1570,9 +1704,9 @@ var slice$2 = createSlice({
|
|
|
1570
1704
|
});
|
|
1571
1705
|
warningsPresetChangeActions.map(function (warningsAction) {
|
|
1572
1706
|
return builder.addCase(warningsAction, function (draft, action) {
|
|
1573
|
-
var _action$
|
|
1574
|
-
systemUpdate = _action$
|
|
1575
|
-
panelId = _action$
|
|
1707
|
+
var _action$payload14 = action.payload,
|
|
1708
|
+
systemUpdate = _action$payload14.systemUpdate,
|
|
1709
|
+
panelId = _action$payload14.panelId;
|
|
1576
1710
|
if (!systemUpdate && panelId) {
|
|
1577
1711
|
var entity = draft.entities[panelId];
|
|
1578
1712
|
if (entity && !(entity != null && entity.hasChanges)) {
|
|
@@ -1584,9 +1718,9 @@ var slice$2 = createSlice({
|
|
|
1584
1718
|
});
|
|
1585
1719
|
syncGroupChangeActions.map(function (syncGroupAction) {
|
|
1586
1720
|
return builder.addCase(syncGroupAction, function (draft, action) {
|
|
1587
|
-
var _action$
|
|
1588
|
-
origin = _action$
|
|
1589
|
-
targetId = _action$
|
|
1721
|
+
var _action$payload15 = action.payload,
|
|
1722
|
+
origin = _action$payload15.origin,
|
|
1723
|
+
targetId = _action$payload15.targetId;
|
|
1590
1724
|
if (origin === 'user') {
|
|
1591
1725
|
var entity = draft.entities[targetId];
|
|
1592
1726
|
if (entity && !(entity != null && entity.hasChanges)) {
|
|
@@ -1598,9 +1732,9 @@ var slice$2 = createSlice({
|
|
|
1598
1732
|
});
|
|
1599
1733
|
mapPresetChangeActions.map(function (mapPresetAction) {
|
|
1600
1734
|
return builder.addCase(mapPresetAction, function (draft, action) {
|
|
1601
|
-
var _action$
|
|
1602
|
-
mapId = _action$
|
|
1603
|
-
origin = _action$
|
|
1735
|
+
var _action$payload16 = action.payload,
|
|
1736
|
+
mapId = _action$payload16.mapId,
|
|
1737
|
+
origin = _action$payload16.origin;
|
|
1604
1738
|
var isChangeOriginSupported = supportedMapActionOrigins.indexOf(origin) >= 0;
|
|
1605
1739
|
if (isChangeOriginSupported && mapId) {
|
|
1606
1740
|
var entity = draft.entities[mapId];
|
|
@@ -1613,9 +1747,9 @@ var slice$2 = createSlice({
|
|
|
1613
1747
|
});
|
|
1614
1748
|
timeSeriesPresetChangeActions.map(function (timeSeriesPresetAction) {
|
|
1615
1749
|
return builder.addCase(timeSeriesPresetAction, function (draft, action) {
|
|
1616
|
-
var _action$
|
|
1617
|
-
panelId = _action$
|
|
1618
|
-
origin = _action$
|
|
1750
|
+
var _action$payload17 = action.payload,
|
|
1751
|
+
panelId = _action$payload17.panelId,
|
|
1752
|
+
origin = _action$payload17.origin;
|
|
1619
1753
|
var isChangeOriginSupported = supportedTimeSeriesActionOrigins.indexOf(origin) >= 0;
|
|
1620
1754
|
var changesRelevantProperties = timeSeriesPresetAction.type === timeSeriesActions.patchParameter.type ? Object.keys(action.payload.parameter).filter(function (key) {
|
|
1621
1755
|
return key !== 'id' && key !== 'instanceId';
|
|
@@ -1634,23 +1768,6 @@ var slice$2 = createSlice({
|
|
|
1634
1768
|
var viewPresetsReducer = slice$2.reducer,
|
|
1635
1769
|
viewPresetActions = slice$2.actions;
|
|
1636
1770
|
|
|
1637
|
-
/* *
|
|
1638
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1639
|
-
* you may not use this file except in compliance with the License.
|
|
1640
|
-
* You may obtain a copy of the License at
|
|
1641
|
-
*
|
|
1642
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1643
|
-
*
|
|
1644
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1645
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1646
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1647
|
-
* See the License for the specific language governing permissions and
|
|
1648
|
-
* limitations under the License.
|
|
1649
|
-
*
|
|
1650
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1651
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
1652
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1653
|
-
* */
|
|
1654
1771
|
var getCleanSearchQuery = function getCleanSearchQuery(searchQuery) {
|
|
1655
1772
|
return searchQuery.trim().split(/\s+/).join();
|
|
1656
1773
|
};
|
|
@@ -1665,7 +1782,12 @@ var setDocumentTitle = function setDocumentTitle(workspaceTitle, appTitle) {
|
|
|
1665
1782
|
var fallbackAppTitle = appTitle || 'GeoWeb';
|
|
1666
1783
|
document.title = workspaceTitle ? workspaceTitle + " - " + fallbackAppTitle : fallbackAppTitle;
|
|
1667
1784
|
};
|
|
1668
|
-
var
|
|
1785
|
+
var humanizeLabelStrings = function humanizeLabelStrings(value) {
|
|
1786
|
+
return value.replace(/[_-]+/g, ' ').replace(/\s+/g, ' ').trim().replace(/\b\w/g, function (match) {
|
|
1787
|
+
return match.toUpperCase();
|
|
1788
|
+
});
|
|
1789
|
+
};
|
|
1790
|
+
var filterAndSortPresets = function filterAndSortPresets(presets, selectedFilters, username, isAdmin, labelFilters) {
|
|
1669
1791
|
var selectedIds = selectedFilters.filter(function (filter) {
|
|
1670
1792
|
return filter.isSelected;
|
|
1671
1793
|
}).map(function (filter) {
|
|
@@ -1677,7 +1799,7 @@ var filterAndSortPresets = function filterAndSortPresets(presets, selectedFilter
|
|
|
1677
1799
|
var isAllSelected = expectedIdsForAll.every(function (id) {
|
|
1678
1800
|
return selectedIds.includes(id);
|
|
1679
1801
|
});
|
|
1680
|
-
var
|
|
1802
|
+
var scopeFiltered = isAllSelected ? presets.filter(function (preset) {
|
|
1681
1803
|
if (isAdmin) {
|
|
1682
1804
|
// Admin users: Only system + shared, never personal
|
|
1683
1805
|
return preset.scope === 'system' || preset.scope === 'user' && preset.is_shared;
|
|
@@ -1687,17 +1809,67 @@ var filterAndSortPresets = function filterAndSortPresets(presets, selectedFilter
|
|
|
1687
1809
|
}) : presets.filter(function (preset) {
|
|
1688
1810
|
return selectedIds.includes(PresetFilterType.system) && preset.scope === 'system' || selectedIds.includes(PresetFilterType.personal) && preset.scope === 'user' && preset.username === username || selectedIds.includes(PresetFilterType.shared) && preset.scope === 'user' && preset.is_shared && (isAdmin || preset.username !== username);
|
|
1689
1811
|
});
|
|
1690
|
-
var
|
|
1812
|
+
var labelFiltered = function () {
|
|
1813
|
+
if (!labelFilters) {
|
|
1814
|
+
return scopeFiltered;
|
|
1815
|
+
}
|
|
1816
|
+
var activeGroups = Object.keys(labelFilters).map(function (key) {
|
|
1817
|
+
var _labelFilters$key;
|
|
1818
|
+
return {
|
|
1819
|
+
key: key,
|
|
1820
|
+
values: (_labelFilters$key = labelFilters[key]) != null ? _labelFilters$key : []
|
|
1821
|
+
};
|
|
1822
|
+
}).filter(function (_ref) {
|
|
1823
|
+
var values = _ref.values;
|
|
1824
|
+
return values.length > 0;
|
|
1825
|
+
});
|
|
1826
|
+
if (activeGroups.length === 0) {
|
|
1827
|
+
return scopeFiltered;
|
|
1828
|
+
}
|
|
1829
|
+
var matchesLabelFilters = function matchesLabelFilters(preset) {
|
|
1830
|
+
var _preset$labels;
|
|
1831
|
+
var presetLabels = (_preset$labels = preset.labels) != null ? _preset$labels : {};
|
|
1832
|
+
var _loop = function _loop() {
|
|
1833
|
+
var _presetLabels$key;
|
|
1834
|
+
var _step$value = _step.value,
|
|
1835
|
+
key = _step$value.key,
|
|
1836
|
+
selectedValues = _step$value.values;
|
|
1837
|
+
var presetValues = (_presetLabels$key = presetLabels[key]) != null ? _presetLabels$key : [];
|
|
1838
|
+
// If user filtered on this group but preset has no labels in it → exclude
|
|
1839
|
+
if (!presetValues.length) {
|
|
1840
|
+
return {
|
|
1841
|
+
v: false
|
|
1842
|
+
};
|
|
1843
|
+
}
|
|
1844
|
+
var hasAllSelectedValues = selectedValues.every(function (label) {
|
|
1845
|
+
return presetValues.includes(label);
|
|
1846
|
+
});
|
|
1847
|
+
if (!hasAllSelectedValues) {
|
|
1848
|
+
return {
|
|
1849
|
+
v: false
|
|
1850
|
+
};
|
|
1851
|
+
}
|
|
1852
|
+
},
|
|
1853
|
+
_ret;
|
|
1854
|
+
for (var _iterator = _createForOfIteratorHelperLoose(activeGroups), _step; !(_step = _iterator()).done;) {
|
|
1855
|
+
_ret = _loop();
|
|
1856
|
+
if (_ret) return _ret.v;
|
|
1857
|
+
}
|
|
1858
|
+
return true;
|
|
1859
|
+
};
|
|
1860
|
+
return scopeFiltered.filter(matchesLabelFilters);
|
|
1861
|
+
}();
|
|
1862
|
+
var systemPresets = labelFiltered.filter(function (preset) {
|
|
1691
1863
|
return preset.scope === 'system';
|
|
1692
1864
|
}).sort(function (presetA, presetB) {
|
|
1693
1865
|
return presetA.title.localeCompare(presetB.title);
|
|
1694
1866
|
});
|
|
1695
|
-
var personalPresets =
|
|
1867
|
+
var personalPresets = labelFiltered.filter(function (preset) {
|
|
1696
1868
|
return preset.scope === 'user' && preset.username === username;
|
|
1697
1869
|
}).sort(function (presetA, presetB) {
|
|
1698
1870
|
return presetA.title.localeCompare(presetB.title);
|
|
1699
1871
|
});
|
|
1700
|
-
var sharedPresets =
|
|
1872
|
+
var sharedPresets = labelFiltered.filter(function (preset) {
|
|
1701
1873
|
return preset.scope === 'user' && preset.username !== username;
|
|
1702
1874
|
}).sort(function (presetA, presetB) {
|
|
1703
1875
|
return presetA.title.localeCompare(presetB.title);
|
|
@@ -1968,6 +2140,7 @@ var slice$1 = createSlice({
|
|
|
1968
2140
|
draft.id = '';
|
|
1969
2141
|
draft.title = workspacePreset.title;
|
|
1970
2142
|
draft["abstract"] = workspacePreset["abstract"];
|
|
2143
|
+
draft.description = workspacePreset.description;
|
|
1971
2144
|
draft.labels = workspacePreset.labels;
|
|
1972
2145
|
draft.scope = workspacePreset.scope;
|
|
1973
2146
|
draft.syncGroups = [];
|
|
@@ -2004,6 +2177,7 @@ var slice$1 = createSlice({
|
|
|
2004
2177
|
draft.viewType = action.payload.workspacePreset.viewType;
|
|
2005
2178
|
draft.isTimeScrollingEnabled = action.payload.workspacePreset.isTimeScrollingEnabled;
|
|
2006
2179
|
draft.labels = action.payload.workspacePreset.labels;
|
|
2180
|
+
draft.description = action.payload.workspacePreset.description;
|
|
2007
2181
|
return draft;
|
|
2008
2182
|
},
|
|
2009
2183
|
setPreventCloseView: function setPreventCloseView(draft, action) {
|
|
@@ -2029,6 +2203,7 @@ var slice$1 = createSlice({
|
|
|
2029
2203
|
draft.title = ws.title;
|
|
2030
2204
|
draft["abstract"] = ws["abstract"];
|
|
2031
2205
|
draft.labels = ws.labels;
|
|
2206
|
+
draft.description = ws.description;
|
|
2032
2207
|
var wsViews = ws.views;
|
|
2033
2208
|
var viewsArray = [];
|
|
2034
2209
|
if (Array.isArray(wsViews)) {
|
|
@@ -2093,6 +2268,7 @@ var slice$1 = createSlice({
|
|
|
2093
2268
|
draft.id = action.payload.workspaceId;
|
|
2094
2269
|
draft.title = action.payload.title;
|
|
2095
2270
|
draft["abstract"] = action.payload["abstract"];
|
|
2271
|
+
draft.description = action.payload.description;
|
|
2096
2272
|
draft.labels = action.payload.labels;
|
|
2097
2273
|
draft.hasChanges = false;
|
|
2098
2274
|
draft.scope = action.payload.scope || 'user';
|
|
@@ -2104,6 +2280,7 @@ var slice$1 = createSlice({
|
|
|
2104
2280
|
draft.title = action.payload.title;
|
|
2105
2281
|
draft["abstract"] = action.payload["abstract"];
|
|
2106
2282
|
draft.labels = action.payload.labels;
|
|
2283
|
+
draft.description = action.payload.description;
|
|
2107
2284
|
}
|
|
2108
2285
|
var changedViews = action.payload.views;
|
|
2109
2286
|
if (changedViews && (_draft$views = draft.views) != null && _draft$views.byId) {
|
|
@@ -2141,12 +2318,14 @@ var slice$1 = createSlice({
|
|
|
2141
2318
|
title = _action$payload5.title,
|
|
2142
2319
|
presetAction = _action$payload5.action,
|
|
2143
2320
|
scope = _action$payload5.scope,
|
|
2144
|
-
_abstract = _action$payload5["abstract"]
|
|
2321
|
+
_abstract = _action$payload5["abstract"],
|
|
2322
|
+
labels = _action$payload5.labels;
|
|
2145
2323
|
var entity = draft.views.byId[panelId];
|
|
2146
2324
|
if (entity && presetAction !== PresetAction.DELETE) {
|
|
2147
2325
|
entity.title = title;
|
|
2148
2326
|
entity.scope = scope || 'user';
|
|
2149
2327
|
entity["abstract"] = _abstract;
|
|
2328
|
+
entity.labels = labels;
|
|
2150
2329
|
}
|
|
2151
2330
|
});
|
|
2152
2331
|
workspacePresetChangeActions.map(function (action) {
|
|
@@ -2167,6 +2346,7 @@ var slice$1 = createSlice({
|
|
|
2167
2346
|
entity.title = '';
|
|
2168
2347
|
entity.scope = 'system';
|
|
2169
2348
|
entity["abstract"] = '';
|
|
2349
|
+
entity.labels = undefined;
|
|
2170
2350
|
}
|
|
2171
2351
|
}
|
|
2172
2352
|
});
|
|
@@ -2442,7 +2622,9 @@ var getWorkspaceData = createSelector(getWorkspaceState, genericSelectors.getSyn
|
|
|
2442
2622
|
mosaicNode: workspaceStore.mosaicNode,
|
|
2443
2623
|
isTimeScrollingEnabled: (syncGroupsStore == null ? void 0 : syncGroupsStore.isTimeScrollingEnabled) || false,
|
|
2444
2624
|
linking: linkedState,
|
|
2445
|
-
labels: workspaceStore.labels
|
|
2625
|
+
labels: workspaceStore.labels,
|
|
2626
|
+
description: workspaceStore.description,
|
|
2627
|
+
updated: workspaceStore.updated
|
|
2446
2628
|
};
|
|
2447
2629
|
}, selectorMemoizationOptions);
|
|
2448
2630
|
var getViewComponentType = createSelector(getViewById, function (store) {
|
|
@@ -2453,7 +2635,12 @@ var getViewPresetToSendToBackend = createSelector(getViewById, getViewComponentT
|
|
|
2453
2635
|
return store;
|
|
2454
2636
|
}, function (panelId) {
|
|
2455
2637
|
return panelId;
|
|
2456
|
-
}, function (
|
|
2638
|
+
}, function (_store, _panelId, keepAllDims) {
|
|
2639
|
+
if (keepAllDims === void 0) {
|
|
2640
|
+
keepAllDims = false;
|
|
2641
|
+
}
|
|
2642
|
+
return keepAllDims;
|
|
2643
|
+
}, function (workspaceView, viewComponentType, mapPreset, syncGroupsIds, timeSeriesPreset, warningsPreset, multiMapPreset, timeSliderPreset, store, panelId, keepAllDims) {
|
|
2457
2644
|
var _workspaceView$scope, _initialPropsByCompon;
|
|
2458
2645
|
var title = workspaceView == null ? void 0 : workspaceView.title;
|
|
2459
2646
|
var scope = (_workspaceView$scope = workspaceView == null ? void 0 : workspaceView.scope) != null ? _workspaceView$scope : 'system';
|
|
@@ -2614,6 +2801,11 @@ var getViewPresetListFilterResultsForView = createSelector(getViewPresetById, fu
|
|
|
2614
2801
|
entities: {}};
|
|
2615
2802
|
return Object.values(filteredResults.entities);
|
|
2616
2803
|
}, selectorMemoizationOptions);
|
|
2804
|
+
var getViewPresetLabelFilters = createSelector(getViewPresetById, function (_store, panelId) {
|
|
2805
|
+
return panelId;
|
|
2806
|
+
}, function (viewPreset) {
|
|
2807
|
+
return viewPreset == null ? void 0 : viewPreset.labelFilters;
|
|
2808
|
+
}, selectorMemoizationOptions);
|
|
2617
2809
|
|
|
2618
2810
|
var viewPresetsListFullContent = [
|
|
2619
2811
|
{
|
|
@@ -4029,6 +4221,7 @@ var workspacePresetsListFullContent = [
|
|
|
4029
4221
|
title: "Radar and temperature",
|
|
4030
4222
|
scope: "system",
|
|
4031
4223
|
abstract: "",
|
|
4224
|
+
description: "Radar and temp preset multi",
|
|
4032
4225
|
viewType: "multiWindow",
|
|
4033
4226
|
views: [
|
|
4034
4227
|
{
|
|
@@ -5234,6 +5427,7 @@ var workspacePresetsList = [
|
|
|
5234
5427
|
date: "2022-06-01T12:34:27.787184",
|
|
5235
5428
|
scope: "user",
|
|
5236
5429
|
abstract: "Some abstract",
|
|
5430
|
+
description: "Some description",
|
|
5237
5431
|
viewType: "singleWindow",
|
|
5238
5432
|
username: "user.name"
|
|
5239
5433
|
},
|
|
@@ -5510,14 +5704,18 @@ var getWorkspaceActionDialogDetails = createSelector(getWorkspaceListStore, getW
|
|
|
5510
5704
|
if (dialog) {
|
|
5511
5705
|
var _dialog$formValues$vi;
|
|
5512
5706
|
var views = (_dialog$formValues$vi = dialog.formValues.views) == null ? void 0 : _dialog$formValues$vi.map(function (view) {
|
|
5513
|
-
var
|
|
5707
|
+
var _workspaceState$views, _view$initialProps;
|
|
5708
|
+
var workspaceView = workspaceState == null || (_workspaceState$views = workspaceState.views) == null || (_workspaceState$views = _workspaceState$views.byId) == null ? void 0 : _workspaceState$views[view.mosaicNodeId];
|
|
5709
|
+
if (!workspaceView) {
|
|
5710
|
+
return view;
|
|
5711
|
+
}
|
|
5514
5712
|
return {
|
|
5515
5713
|
mosaicNodeId: view.mosaicNodeId,
|
|
5516
5714
|
title: view.title || workspaceView.title,
|
|
5517
5715
|
"abstract": workspaceView["abstract"],
|
|
5518
5716
|
componentType: workspaceView.componentType,
|
|
5519
5717
|
scope: view.scope || workspaceView.scope,
|
|
5520
|
-
initialProps: view.initialProps,
|
|
5718
|
+
initialProps: (_view$initialProps = view.initialProps) != null ? _view$initialProps : workspaceView.initialProps,
|
|
5521
5719
|
originalViewPresetId: view == null ? void 0 : view.originalViewPresetId
|
|
5522
5720
|
};
|
|
5523
5721
|
});
|
|
@@ -5566,6 +5764,11 @@ var getWorkspaceListSearchQuery = createSelector(getWorkspaceListStore, function
|
|
|
5566
5764
|
var _state$searchQuery;
|
|
5567
5765
|
return (_state$searchQuery = state == null ? void 0 : state.searchQuery) != null ? _state$searchQuery : '';
|
|
5568
5766
|
}, selectorMemoizationOptions);
|
|
5767
|
+
var getWorkspaceLabelFilters = createSelector(getWorkspaceListStore, function (store) {
|
|
5768
|
+
return store;
|
|
5769
|
+
}, function (state) {
|
|
5770
|
+
return state.workspaceLabelFilters;
|
|
5771
|
+
}, selectorMemoizationOptions);
|
|
5569
5772
|
|
|
5570
5773
|
var emptyWorkspaceBEData = Object.assign({}, getEmptyMapWorkspace(), {
|
|
5571
5774
|
views: [{
|
|
@@ -5703,7 +5906,10 @@ workspaceListListener.startListening({
|
|
|
5703
5906
|
workspaceDataNewTitle = Object.assign({}, originalData, {
|
|
5704
5907
|
title: data.title,
|
|
5705
5908
|
"abstract": data["abstract"],
|
|
5706
|
-
|
|
5909
|
+
description: data.description,
|
|
5910
|
+
labels: data.labels,
|
|
5911
|
+
updated: data.updated,
|
|
5912
|
+
updatedBy: data.updatedBy
|
|
5707
5913
|
});
|
|
5708
5914
|
_context3.next = 17;
|
|
5709
5915
|
return workspaceApi.saveWorkspacePreset(presetId, workspaceDataNewTitle);
|
|
@@ -5713,7 +5919,10 @@ workspaceListListener.startListening({
|
|
|
5713
5919
|
action: presetAction,
|
|
5714
5920
|
title: data.title,
|
|
5715
5921
|
"abstract": data["abstract"],
|
|
5922
|
+
description: data.description,
|
|
5716
5923
|
labels: data.labels,
|
|
5924
|
+
updated: data.updated,
|
|
5925
|
+
updatedBy: data.updatedBy,
|
|
5717
5926
|
scope: scope
|
|
5718
5927
|
}));
|
|
5719
5928
|
case 18:
|
|
@@ -5777,6 +5986,7 @@ workspaceListListener.startListening({
|
|
|
5777
5986
|
id: workspaceId,
|
|
5778
5987
|
title: data.title,
|
|
5779
5988
|
"abstract": data["abstract"],
|
|
5989
|
+
description: data.description,
|
|
5780
5990
|
labels: data.labels,
|
|
5781
5991
|
scope: scope,
|
|
5782
5992
|
views: viewsWithInitialProps
|
|
@@ -5808,6 +6018,7 @@ workspaceListListener.startListening({
|
|
|
5808
6018
|
workspaceId: workspaceId,
|
|
5809
6019
|
title: newWorkspace.title,
|
|
5810
6020
|
"abstract": newWorkspace["abstract"],
|
|
6021
|
+
description: newWorkspace.description,
|
|
5811
6022
|
labels: newWorkspace.labels,
|
|
5812
6023
|
scope: scope
|
|
5813
6024
|
}));
|
|
@@ -5834,6 +6045,7 @@ workspaceListListener.startListening({
|
|
|
5834
6045
|
workspaceId: presetId,
|
|
5835
6046
|
title: data.title,
|
|
5836
6047
|
"abstract": data["abstract"],
|
|
6048
|
+
description: data.description,
|
|
5837
6049
|
labels: data.labels,
|
|
5838
6050
|
scope: scope
|
|
5839
6051
|
}));
|
|
@@ -6280,35 +6492,80 @@ workspaceListener.startListening({
|
|
|
6280
6492
|
return effect;
|
|
6281
6493
|
}()
|
|
6282
6494
|
});
|
|
6495
|
+
var generateInitialProps = function generateInitialProps(componentType, originalInitialProps, copyOriginalcontent) {
|
|
6496
|
+
var _originalInitialProps;
|
|
6497
|
+
// If we are copying the original content, use that
|
|
6498
|
+
if (copyOriginalcontent) {
|
|
6499
|
+
return originalInitialProps;
|
|
6500
|
+
}
|
|
6501
|
+
// Add a new map, copy over the bbox and srs if present
|
|
6502
|
+
if (componentType === 'Map' && originalInitialProps != null && (_originalInitialProps = originalInitialProps.mapPreset) != null && (_originalInitialProps = _originalInitialProps.proj) != null && _originalInitialProps.bbox.bottom) {
|
|
6503
|
+
var proj = originalInitialProps.mapPreset.proj;
|
|
6504
|
+
return {
|
|
6505
|
+
mapPreset: {
|
|
6506
|
+
proj: {
|
|
6507
|
+
bbox: proj == null ? void 0 : proj.bbox,
|
|
6508
|
+
srs: proj == null ? void 0 : proj.srs
|
|
6509
|
+
}
|
|
6510
|
+
},
|
|
6511
|
+
syncGroupsIds: []
|
|
6512
|
+
};
|
|
6513
|
+
}
|
|
6514
|
+
// Split button was pressed on a non-map component so we need to use default map settings
|
|
6515
|
+
if (componentType === 'Map') {
|
|
6516
|
+
return {
|
|
6517
|
+
mapPreset: {},
|
|
6518
|
+
syncGroupsIds: []
|
|
6519
|
+
};
|
|
6520
|
+
}
|
|
6521
|
+
// In all other cases, return empty initialProps
|
|
6522
|
+
return {};
|
|
6523
|
+
};
|
|
6283
6524
|
workspaceListener.startListening({
|
|
6284
6525
|
actionCreator: workspaceActions.setNewWorkspaceView,
|
|
6285
6526
|
effect: function () {
|
|
6286
6527
|
var _effect8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref0, listenerApi) {
|
|
6287
|
-
var
|
|
6528
|
+
var _getViewPresetToSendT, _initialProps$mapPres;
|
|
6529
|
+
var payload, mosaicNodeId, componentType, newId, copyOriginalcontent, originalInitialProps, initialProps;
|
|
6288
6530
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
6289
6531
|
while (1) switch (_context10.prev = _context10.next) {
|
|
6290
6532
|
case 0:
|
|
6291
6533
|
payload = _ref0.payload;
|
|
6292
|
-
mosaicNodeId = payload.mosaicNodeId, componentType = payload.componentType, newId = payload.newId
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
srs: srs
|
|
6301
|
-
}
|
|
6302
|
-
} : {};
|
|
6534
|
+
mosaicNodeId = payload.mosaicNodeId, componentType = payload.componentType, newId = payload.newId, copyOriginalcontent = payload.copyOriginalcontent;
|
|
6535
|
+
if (componentType === 'Map') {
|
|
6536
|
+
// TODO: this would be nice to move into the openlayers store
|
|
6537
|
+
createViewObjectForNewMap(mosaicNodeId, newId);
|
|
6538
|
+
}
|
|
6539
|
+
// Construct new initialProps from original preset if needed
|
|
6540
|
+
originalInitialProps = (_getViewPresetToSendT = getViewPresetToSendToBackend(listenerApi.getState(), mosaicNodeId, true).initialProps) != null ? _getViewPresetToSendT : {};
|
|
6541
|
+
initialProps = generateInitialProps(componentType, originalInitialProps, copyOriginalcontent);
|
|
6303
6542
|
listenerApi.dispatch(workspaceActions.addWorkspaceView({
|
|
6304
6543
|
componentType: componentType,
|
|
6305
6544
|
id: newId,
|
|
6306
|
-
initialProps:
|
|
6307
|
-
mapPreset: mapPreset,
|
|
6308
|
-
syncGroupsIds: []
|
|
6309
|
-
}
|
|
6545
|
+
initialProps: initialProps
|
|
6310
6546
|
}));
|
|
6311
|
-
|
|
6547
|
+
if (!(componentType === 'Map')) {
|
|
6548
|
+
_context10.next = 9;
|
|
6549
|
+
break;
|
|
6550
|
+
}
|
|
6551
|
+
_context10.next = 9;
|
|
6552
|
+
return Promise.all(originalInitialProps.syncGroupsIds.map(function (groupId) {
|
|
6553
|
+
return listenerApi.dispatch(syncGroupsActions.syncGroupAddTarget({
|
|
6554
|
+
groupId: groupId,
|
|
6555
|
+
targetId: newId,
|
|
6556
|
+
linked: true
|
|
6557
|
+
}));
|
|
6558
|
+
}));
|
|
6559
|
+
case 9:
|
|
6560
|
+
// Update map to use all dimensions as set in original map
|
|
6561
|
+
if (componentType === 'Map' && (_initialProps$mapPres = initialProps.mapPreset) != null && _initialProps$mapPres.dimensions) {
|
|
6562
|
+
listenerApi.dispatch(mapActions.mapUpdateAllMapDimensions({
|
|
6563
|
+
mapId: newId,
|
|
6564
|
+
dimensions: initialProps.mapPreset.dimensions,
|
|
6565
|
+
origin: 'workspace/listener.ts, setNewWorkspaceView'
|
|
6566
|
+
}));
|
|
6567
|
+
}
|
|
6568
|
+
case 10:
|
|
6312
6569
|
case "end":
|
|
6313
6570
|
return _context10.stop();
|
|
6314
6571
|
}
|
|
@@ -7125,10 +7382,13 @@ var getPresetIcon = function getPresetIcon(preset, currentUsername) {
|
|
|
7125
7382
|
return null;
|
|
7126
7383
|
};
|
|
7127
7384
|
var WorkspaceSelectListRow = function WorkspaceSelectListRow(_ref) {
|
|
7385
|
+
var _workspacePreset$desc;
|
|
7128
7386
|
var workspacePreset = _ref.workspacePreset,
|
|
7129
7387
|
isSelected = _ref.isSelected,
|
|
7130
7388
|
onClickWorkspacePreset = _ref.onClickWorkspacePreset,
|
|
7131
7389
|
onClickWorkspacePresetOption = _ref.onClickWorkspacePresetOption,
|
|
7390
|
+
onOpenPresetInfo = _ref.onOpenPresetInfo,
|
|
7391
|
+
infoOpenPresetId = _ref.infoOpenPresetId,
|
|
7132
7392
|
_ref$isOptionsMenuOpe = _ref.isOptionsMenuOpen,
|
|
7133
7393
|
isOptionsMenuOpen = _ref$isOptionsMenuOpe === void 0 ? false : _ref$isOptionsMenuOpe,
|
|
7134
7394
|
_ref$isEditable = _ref.isEditable,
|
|
@@ -7143,18 +7403,24 @@ var WorkspaceSelectListRow = function WorkspaceSelectListRow(_ref) {
|
|
|
7143
7403
|
auth = _useAuthenticationCon.auth;
|
|
7144
7404
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7145
7405
|
t = _useWorkspaceTranslat.t;
|
|
7146
|
-
var
|
|
7406
|
+
var onClick = function onClick(action) {
|
|
7147
7407
|
return onClickWorkspacePresetOption(workspacePreset.id, action, workspacePreset);
|
|
7148
7408
|
};
|
|
7409
|
+
var isInfoOpen = infoOpenPresetId === workspacePreset.id;
|
|
7410
|
+
var onOpenInfoClick = function onOpenInfoClick(event) {
|
|
7411
|
+
event.stopPropagation();
|
|
7412
|
+
onOpenPresetInfo == null || onOpenPresetInfo(workspacePreset);
|
|
7413
|
+
};
|
|
7414
|
+
var canDelete = (workspacePreset.scope === SystemScope.user && (auth == null ? void 0 : auth.username) === workspacePreset.username || isAdmin) && Boolean(workspacePreset.id);
|
|
7149
7415
|
var menuItems = [{
|
|
7150
7416
|
text: t('workspace-duplicate'),
|
|
7151
7417
|
action: function action() {
|
|
7152
|
-
return
|
|
7418
|
+
return onClick(WorkspacePresetAction.DUPLICATE);
|
|
7153
7419
|
}
|
|
7154
7420
|
}, {
|
|
7155
7421
|
text: t('workspace-open-tab'),
|
|
7156
7422
|
action: function action() {
|
|
7157
|
-
return
|
|
7423
|
+
return onClick(WorkspacePresetAction.OPEN_TAB);
|
|
7158
7424
|
}
|
|
7159
7425
|
}];
|
|
7160
7426
|
// Show "Edit" if it's your own user-scoped preset OR you're an admin
|
|
@@ -7162,7 +7428,7 @@ var WorkspaceSelectListRow = function WorkspaceSelectListRow(_ref) {
|
|
|
7162
7428
|
menuItems.push({
|
|
7163
7429
|
text: t('workspace-edit'),
|
|
7164
7430
|
action: function action() {
|
|
7165
|
-
return
|
|
7431
|
+
return onClick(WorkspacePresetAction.EDIT);
|
|
7166
7432
|
}
|
|
7167
7433
|
});
|
|
7168
7434
|
}
|
|
@@ -7171,16 +7437,38 @@ var WorkspaceSelectListRow = function WorkspaceSelectListRow(_ref) {
|
|
|
7171
7437
|
menuItems.push({
|
|
7172
7438
|
text: workspacePreset.is_shared ? t('workspace-stop-share') : t('workspace-share'),
|
|
7173
7439
|
action: function action() {
|
|
7174
|
-
return
|
|
7440
|
+
return onClick(WorkspacePresetAction.SHARE);
|
|
7175
7441
|
},
|
|
7176
7442
|
isDisabled: false
|
|
7177
7443
|
});
|
|
7178
7444
|
}
|
|
7445
|
+
var description = (_workspacePreset$desc = workspacePreset == null ? void 0 : workspacePreset.description) != null ? _workspacePreset$desc : '';
|
|
7446
|
+
var tooltipContent = jsxs(Box, {
|
|
7447
|
+
children: [jsx(Typography, {
|
|
7448
|
+
variant: "body2",
|
|
7449
|
+
fontWeight: 600,
|
|
7450
|
+
children: workspacePreset.title
|
|
7451
|
+
}), description && jsx(Typography, {
|
|
7452
|
+
variant: "body2",
|
|
7453
|
+
children: description
|
|
7454
|
+
})]
|
|
7455
|
+
});
|
|
7456
|
+
if (canDelete) {
|
|
7457
|
+
menuItems.push({
|
|
7458
|
+
text: t('workspace-delete'),
|
|
7459
|
+
action: function action() {
|
|
7460
|
+
return onClick(isAdmin ? WorkspacePresetAction.DELETE_SYSTEM_PRESET : WorkspacePresetAction.DELETE);
|
|
7461
|
+
}
|
|
7462
|
+
});
|
|
7463
|
+
}
|
|
7179
7464
|
return jsx(ListItem, {
|
|
7180
7465
|
disablePadding: true,
|
|
7181
7466
|
sx: {
|
|
7182
|
-
|
|
7467
|
+
mb: 0.5,
|
|
7468
|
+
borderRadius: 1.5,
|
|
7183
7469
|
backgroundColor: 'geowebColors.cards.cardContainer',
|
|
7470
|
+
boxShadow: '0px 1px 3px rgba(15, 23, 42, 0.12)',
|
|
7471
|
+
transition: 'box-shadow 0.15s ease-out, transform 0.15s ease-out',
|
|
7184
7472
|
' .MuiListItemText-primary': {
|
|
7185
7473
|
fontSize: '12px',
|
|
7186
7474
|
fontWeight: 500,
|
|
@@ -7217,45 +7505,84 @@ var WorkspaceSelectListRow = function WorkspaceSelectListRow(_ref) {
|
|
|
7217
7505
|
"aria-label": testIdPrefix,
|
|
7218
7506
|
children: [jsx(ListItemIcon, {
|
|
7219
7507
|
children: getPresetIcon(workspacePreset, auth == null ? void 0 : auth.username)
|
|
7220
|
-
}), jsx(
|
|
7221
|
-
|
|
7222
|
-
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
|
|
7230
|
-
|
|
7231
|
-
|
|
7232
|
-
|
|
7233
|
-
|
|
7234
|
-
|
|
7508
|
+
}), jsx(ListItemText, {
|
|
7509
|
+
primary: jsx(CustomTooltip, {
|
|
7510
|
+
placement: "bottom",
|
|
7511
|
+
title: tooltipContent,
|
|
7512
|
+
enterDelay: 300,
|
|
7513
|
+
children: jsx(Box, {
|
|
7514
|
+
component: "span",
|
|
7515
|
+
sx: {
|
|
7516
|
+
overflow: 'hidden',
|
|
7517
|
+
textOverflow: 'ellipsis',
|
|
7518
|
+
whiteSpace: 'nowrap',
|
|
7519
|
+
display: 'block'
|
|
7520
|
+
},
|
|
7521
|
+
children: jsx(SearchHighlight, {
|
|
7522
|
+
text: workspacePreset == null ? void 0 : workspacePreset.title,
|
|
7523
|
+
search: searchQuery
|
|
7524
|
+
})
|
|
7525
|
+
})
|
|
7526
|
+
}),
|
|
7527
|
+
secondary: jsx(CustomTooltip, {
|
|
7528
|
+
placement: "bottom",
|
|
7529
|
+
title: tooltipContent,
|
|
7530
|
+
enterDelay: 300,
|
|
7531
|
+
children: jsx(Box, {
|
|
7532
|
+
component: "span",
|
|
7533
|
+
sx: {
|
|
7534
|
+
overflow: 'hidden',
|
|
7535
|
+
display: '-webkit-box',
|
|
7536
|
+
WebkitLineClamp: 1,
|
|
7537
|
+
WebkitBoxOrient: 'vertical'
|
|
7538
|
+
},
|
|
7539
|
+
children: jsx(SearchHighlight, {
|
|
7540
|
+
text: description,
|
|
7541
|
+
search: searchQuery
|
|
7542
|
+
})
|
|
7543
|
+
})
|
|
7544
|
+
}),
|
|
7545
|
+
sx: {
|
|
7546
|
+
margin: 0
|
|
7547
|
+
}
|
|
7235
7548
|
}), isEditable && jsx(Grid, {
|
|
7236
7549
|
sx: {
|
|
7237
|
-
minWidth:
|
|
7550
|
+
minWidth: 72,
|
|
7238
7551
|
marginLeft: 2
|
|
7239
7552
|
},
|
|
7240
7553
|
children: jsxs(Grid, {
|
|
7241
|
-
|
|
7554
|
+
sx: {
|
|
7555
|
+
display: 'flex',
|
|
7556
|
+
alignItems: 'center',
|
|
7557
|
+
justifyContent: 'flex-end',
|
|
7558
|
+
gap: 0.5
|
|
7559
|
+
},
|
|
7560
|
+
children: [workspacePreset.id && jsx(CustomIconButton, {
|
|
7561
|
+
tooltipTitle: t('workspace-info-tooltip'),
|
|
7562
|
+
onClick: onOpenInfoClick,
|
|
7563
|
+
variant: "flat",
|
|
7564
|
+
isSelected: isInfoOpen,
|
|
7565
|
+
sx: {
|
|
7566
|
+
color: isInfoOpen ? 'primary.main' : 'geowebColors.typographyAndIcons.text',
|
|
7567
|
+
backgroundColor: 'transparent',
|
|
7568
|
+
'&.Mui-selected': {
|
|
7569
|
+
backgroundColor: 'transparent',
|
|
7570
|
+
color: 'primary.main'
|
|
7571
|
+
},
|
|
7572
|
+
'&:hover': {
|
|
7573
|
+
backgroundColor: 'transparent'
|
|
7574
|
+
}
|
|
7575
|
+
},
|
|
7576
|
+
"data-testid": testIdPrefix + "-listInfoButton",
|
|
7577
|
+
children: jsx(Info, {
|
|
7578
|
+
fontSize: "small"
|
|
7579
|
+
})
|
|
7580
|
+
}), jsx(ToggleMenu, {
|
|
7242
7581
|
buttonTestId: testIdPrefix + "-listOptionsButton",
|
|
7243
7582
|
menuPosition: "right",
|
|
7244
7583
|
menuItems: menuItems,
|
|
7245
7584
|
menuTitle: t('workspace-options'),
|
|
7246
7585
|
isDefaultOpen: isOptionsMenuOpen
|
|
7247
|
-
}), (workspacePreset.scope === SystemScope.user && (auth == null ? void 0 : auth.username) === workspacePreset.username || isAdmin) && workspacePreset.id && jsx(CustomIconButton, {
|
|
7248
|
-
tooltipTitle: t('workspace-delete-tooltip'),
|
|
7249
|
-
onClick: function onClick(event) {
|
|
7250
|
-
event.stopPropagation();
|
|
7251
|
-
_onClick(isAdmin ? WorkspacePresetAction.DELETE_SYSTEM_PRESET : WorkspacePresetAction.DELETE);
|
|
7252
|
-
},
|
|
7253
|
-
variant: "tool",
|
|
7254
|
-
sx: {
|
|
7255
|
-
marginLeft: 1
|
|
7256
|
-
},
|
|
7257
|
-
"data-testid": testIdPrefix + "-listDeleteButton",
|
|
7258
|
-
children: jsx(Delete, {})
|
|
7259
7586
|
})]
|
|
7260
7587
|
})
|
|
7261
7588
|
})]
|
|
@@ -7279,7 +7606,9 @@ var WorkspaceSelectList = function WorkspaceSelectList(_ref) {
|
|
|
7279
7606
|
searchQuery = _ref.searchQuery,
|
|
7280
7607
|
newPreset = _ref.newPreset,
|
|
7281
7608
|
_ref$testIdPrefix = _ref.testIdPrefix,
|
|
7282
|
-
testIdPrefix = _ref$testIdPrefix === void 0 ? 'workspace' : _ref$testIdPrefix
|
|
7609
|
+
testIdPrefix = _ref$testIdPrefix === void 0 ? 'workspace' : _ref$testIdPrefix,
|
|
7610
|
+
onOpenPresetInfo = _ref.onOpenPresetInfo,
|
|
7611
|
+
infoOpenPresetId = _ref.infoOpenPresetId;
|
|
7283
7612
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7284
7613
|
t = _useWorkspaceTranslat.t;
|
|
7285
7614
|
var newPresetTruthy = newPreset || getEmptyWorkspaceListItem(t);
|
|
@@ -7324,6 +7653,8 @@ var WorkspaceSelectList = function WorkspaceSelectList(_ref) {
|
|
|
7324
7653
|
workspacePreset: preset,
|
|
7325
7654
|
onClickWorkspacePreset: onClickWorkspacePreset,
|
|
7326
7655
|
onClickWorkspacePresetOption: onClickWorkspacePresetOption,
|
|
7656
|
+
onOpenPresetInfo: onOpenPresetInfo,
|
|
7657
|
+
infoOpenPresetId: infoOpenPresetId,
|
|
7327
7658
|
isEditable: isEditable,
|
|
7328
7659
|
isAdmin: isAdmin,
|
|
7329
7660
|
searchQuery: searchQuery,
|
|
@@ -7339,103 +7670,938 @@ var WorkspaceSelectList = function WorkspaceSelectList(_ref) {
|
|
|
7339
7670
|
});
|
|
7340
7671
|
};
|
|
7341
7672
|
|
|
7342
|
-
|
|
7343
|
-
|
|
7673
|
+
/* *
|
|
7674
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7675
|
+
* you may not use this file except in compliance with the License.
|
|
7676
|
+
* You may obtain a copy of the License at
|
|
7677
|
+
*
|
|
7678
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7679
|
+
*
|
|
7680
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7681
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7682
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7683
|
+
* See the License for the specific language governing permissions and
|
|
7684
|
+
* limitations under the License.
|
|
7685
|
+
*
|
|
7686
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
7687
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
7688
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
7689
|
+
* */
|
|
7690
|
+
var LABELS_CONFIG_DEFAULT = {
|
|
7691
|
+
purpose: ['Aviation', 'Monitor', 'Public', 'Maritime', 'Warning', 'Media', 'Nowcasting (0–12h)'],
|
|
7692
|
+
parameters: ['Pressure', 'Temperature', 'Wind', 'Humidity', 'Water vapour', 'Visibility', 'Geopotential', 'Snow', 'Cloud', 'Waves', 'Index', 'Precipitation'],
|
|
7693
|
+
phenomena: ['Turbulence', 'MTW', 'CAT', 'Icing', 'Freezing rain', 'FlashFlood', 'Wind gust', 'Rain', 'Snow', 'Road ice', 'Lightning strike', 'Drifting snow', 'Wave height + water level', 'Forest fire', 'Polar Low', 'Heat wave', 'Gale warning'],
|
|
7694
|
+
dataType: ['observation', 'forecast', 'archive'],
|
|
7695
|
+
dataSource: ['Meps', 'Arome Arctic', 'Ecmwf', 'Ensemble', 'AIFS', 'BRIS', 'radar', 'satellite', 'synop']
|
|
7696
|
+
};
|
|
7697
|
+
|
|
7698
|
+
var VIEW_TYPE_KEY = 'viewType';
|
|
7699
|
+
var normalizeLabels = function normalizeLabels(labels, available) {
|
|
7700
|
+
var result = {};
|
|
7701
|
+
var allKeys = Array.from(new Set([].concat(Object.keys(available != null ? available : {}), labels ? Object.keys(labels) : [])));
|
|
7702
|
+
allKeys.forEach(function (key) {
|
|
7703
|
+
var _labels$key;
|
|
7704
|
+
result[key] = (_labels$key = labels == null ? void 0 : labels[key]) != null ? _labels$key : [];
|
|
7705
|
+
});
|
|
7706
|
+
return result;
|
|
7707
|
+
};
|
|
7708
|
+
var PresetLabelsPanel = function PresetLabelsPanel(_ref) {
|
|
7709
|
+
var _labels$VIEW_TYPE_KEY3;
|
|
7710
|
+
var labelsConfig = _ref.labelsConfig,
|
|
7711
|
+
viewComponentType = _ref.viewComponentType,
|
|
7712
|
+
onLabelsChange = _ref.onLabelsChange,
|
|
7713
|
+
menuLabels = _ref.menuLabels,
|
|
7714
|
+
_ref$isMenuFilterMode = _ref.isMenuFilterMode,
|
|
7715
|
+
isMenuFilterModeProp = _ref$isMenuFilterMode === void 0 ? false : _ref$isMenuFilterMode;
|
|
7716
|
+
var isMenuFilterMode = Boolean(isMenuFilterModeProp);
|
|
7344
7717
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7345
7718
|
t = _useWorkspaceTranslat.t;
|
|
7346
|
-
var
|
|
7347
|
-
|
|
7348
|
-
|
|
7349
|
-
|
|
7350
|
-
|
|
7351
|
-
|
|
7352
|
-
var isAdmin = (currentRole == null ? void 0 : currentRole.name) === GEOWEB_ROLE_PRESETS_ADMIN.name;
|
|
7353
|
-
var scope = !isAdmin ? 'user' : 'system';
|
|
7354
|
-
var viewPresets = useSelector(function (store) {
|
|
7355
|
-
return getFilteredViewPresetListForView(store, panelId);
|
|
7356
|
-
});
|
|
7357
|
-
var viewPresetListFilters = useSelector(function (store) {
|
|
7358
|
-
return getViewPresetListFiltersForView(store, panelId, scope, isAdmin);
|
|
7359
|
-
});
|
|
7360
|
-
var viewPresetListSearchQuery = useSelector(function (store) {
|
|
7361
|
-
return getViewPresetListSearchQueryForView(store, panelId);
|
|
7362
|
-
});
|
|
7363
|
-
var filteredPresets = React.useMemo(function () {
|
|
7364
|
-
return filterAndSortPresets(viewPresets, viewPresetListFilters, username, isAdmin);
|
|
7365
|
-
}, [viewPresets, viewPresetListFilters, username, isAdmin]);
|
|
7366
|
-
var activeViewPresetId = useSelector(function (store) {
|
|
7367
|
-
return getViewPresetActiveId(store, panelId);
|
|
7368
|
-
});
|
|
7369
|
-
var viewComponentType = useSelector(function (store) {
|
|
7370
|
-
return getViewComponentType(store, panelId);
|
|
7371
|
-
});
|
|
7372
|
-
var currentMapPreset = useSelector(function (store) {
|
|
7373
|
-
return mapSelectors.getMapPreset(store, panelId);
|
|
7374
|
-
});
|
|
7375
|
-
var currentTimeSeriesPreset = useSelector(function (store) {
|
|
7376
|
-
return timeSeriesSelectors.getTimeSeriesPreset(store);
|
|
7719
|
+
var _useFormContext = useFormContext(),
|
|
7720
|
+
control = _useFormContext.control,
|
|
7721
|
+
setValue = _useFormContext.setValue;
|
|
7722
|
+
var watchedLabels = useWatch({
|
|
7723
|
+
control: control,
|
|
7724
|
+
name: 'labels'
|
|
7377
7725
|
});
|
|
7378
|
-
var
|
|
7379
|
-
|
|
7726
|
+
var watchedViews = useWatch({
|
|
7727
|
+
control: control,
|
|
7728
|
+
name: 'views'
|
|
7380
7729
|
});
|
|
7381
|
-
var
|
|
7382
|
-
|
|
7383
|
-
|
|
7730
|
+
var availableLabels = labelsConfig != null ? labelsConfig : LABELS_CONFIG_DEFAULT;
|
|
7731
|
+
var labels = React__default.useMemo(function () {
|
|
7732
|
+
return normalizeLabels(watchedLabels, availableLabels);
|
|
7733
|
+
}, [watchedLabels, availableLabels]);
|
|
7734
|
+
var groupKeys = React__default.useMemo(function () {
|
|
7735
|
+
return Array.from(new Set([VIEW_TYPE_KEY].concat(Object.keys(availableLabels != null ? availableLabels : {}), watchedLabels ? Object.keys(watchedLabels) : [])));
|
|
7736
|
+
}, [availableLabels, watchedLabels]);
|
|
7737
|
+
var orderedGroupKeys = React__default.useMemo(function () {
|
|
7738
|
+
var withoutViewType = groupKeys.filter(function (key) {
|
|
7739
|
+
return key !== VIEW_TYPE_KEY;
|
|
7384
7740
|
});
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7741
|
+
// If for some reason viewType really isn't in groupKeys, just return as-is
|
|
7742
|
+
if (!groupKeys.includes(VIEW_TYPE_KEY)) {
|
|
7743
|
+
return withoutViewType;
|
|
7744
|
+
}
|
|
7745
|
+
if (isMenuFilterMode) {
|
|
7746
|
+
// MENU MODE: viewType should be NEXT TO LAST.
|
|
7747
|
+
if (withoutViewType.length === 0) {
|
|
7748
|
+
return [VIEW_TYPE_KEY];
|
|
7749
|
+
}
|
|
7750
|
+
if (withoutViewType.length === 1) {
|
|
7751
|
+
// Only one other group → [viewType, other] or [other, viewType]?
|
|
7752
|
+
// "Next to last" with one element basically just means "first".
|
|
7753
|
+
return [VIEW_TYPE_KEY, withoutViewType[0]];
|
|
7754
|
+
}
|
|
7755
|
+
var last = withoutViewType[withoutViewType.length - 1];
|
|
7756
|
+
var rest = withoutViewType.slice(0, -1);
|
|
7757
|
+
return [].concat(rest, [VIEW_TYPE_KEY, last]);
|
|
7758
|
+
}
|
|
7759
|
+
// FORM MODE: viewType should be LAST.
|
|
7760
|
+
return [].concat(withoutViewType, [VIEW_TYPE_KEY]);
|
|
7761
|
+
}, [groupKeys, isMenuFilterMode]);
|
|
7762
|
+
var titleForGroup = React__default.useCallback(function (key) {
|
|
7763
|
+
var translationKey = "workspace-labels-" + key;
|
|
7764
|
+
var translated = t(translationKey);
|
|
7765
|
+
return translated !== translationKey ? translated : humanizeLabelStrings(key);
|
|
7766
|
+
}, [t]);
|
|
7767
|
+
var labelFor = function labelFor(group, value) {
|
|
7768
|
+
var translationKey = "workspace-labels-" + group + "-" + value;
|
|
7769
|
+
var translated = t(translationKey);
|
|
7770
|
+
if (translated !== translationKey) {
|
|
7771
|
+
return translated;
|
|
7772
|
+
}
|
|
7773
|
+
return humanizeLabelStrings(value);
|
|
7774
|
+
};
|
|
7775
|
+
// viewType is actually based on componentType.
|
|
7776
|
+
// In workspace form mode, we derive it from the real views array.
|
|
7777
|
+
// In view preset form, we fall back to viewComponentType.
|
|
7778
|
+
var componentTypes = React__default.useMemo(function () {
|
|
7779
|
+
var viewsArray = Array.isArray(watchedViews) ? watchedViews : [];
|
|
7780
|
+
var fromViews = viewsArray.map(function (view) {
|
|
7781
|
+
return view == null ? void 0 : view.componentType;
|
|
7782
|
+
}).filter(function (value) {
|
|
7783
|
+
return Boolean(value);
|
|
7784
|
+
});
|
|
7785
|
+
if (fromViews.length > 0) {
|
|
7786
|
+
return Array.from(new Set(fromViews));
|
|
7787
|
+
}
|
|
7788
|
+
if (viewComponentType) {
|
|
7789
|
+
return [viewComponentType];
|
|
7790
|
+
}
|
|
7791
|
+
return [];
|
|
7792
|
+
}, [watchedViews, viewComponentType]);
|
|
7793
|
+
var viewTypeItems = React__default.useMemo(function () {
|
|
7794
|
+
var _labels$VIEW_TYPE_KEY;
|
|
7795
|
+
if (isMenuFilterMode) {
|
|
7796
|
+
return ALL_COMPONENT_TYPES.slice();
|
|
7797
|
+
}
|
|
7798
|
+
var viewTypeLabels = (_labels$VIEW_TYPE_KEY = labels[VIEW_TYPE_KEY]) != null ? _labels$VIEW_TYPE_KEY : [];
|
|
7799
|
+
return componentTypes.length ? componentTypes : viewTypeLabels;
|
|
7800
|
+
}, [isMenuFilterMode, componentTypes, labels]);
|
|
7801
|
+
React__default.useEffect(function () {
|
|
7802
|
+
if (!isMenuFilterMode) {
|
|
7803
|
+
return;
|
|
7804
|
+
}
|
|
7805
|
+
if (!menuLabels) {
|
|
7806
|
+
return;
|
|
7807
|
+
}
|
|
7808
|
+
setValue('labels', menuLabels, {
|
|
7809
|
+
shouldDirty: false
|
|
7810
|
+
});
|
|
7811
|
+
}, [isMenuFilterMode, menuLabels, setValue]);
|
|
7812
|
+
// In form mode, keep locked "viewType" labels in sync with componentTypes
|
|
7813
|
+
React__default.useEffect(function () {
|
|
7814
|
+
var _labels$VIEW_TYPE_KEY2;
|
|
7815
|
+
if (isMenuFilterMode) {
|
|
7816
|
+
return;
|
|
7817
|
+
}
|
|
7818
|
+
if (!componentTypes.length) {
|
|
7819
|
+
return;
|
|
7820
|
+
}
|
|
7821
|
+
var currentViewType = (_labels$VIEW_TYPE_KEY2 = labels[VIEW_TYPE_KEY]) != null ? _labels$VIEW_TYPE_KEY2 : [];
|
|
7822
|
+
var sameLength = currentViewType.length === componentTypes.length;
|
|
7823
|
+
var sameValues = sameLength && currentViewType.every(function (val, idx) {
|
|
7824
|
+
return val === componentTypes[idx];
|
|
7825
|
+
});
|
|
7826
|
+
if (sameValues) {
|
|
7827
|
+
return;
|
|
7828
|
+
}
|
|
7829
|
+
setValue("labels." + VIEW_TYPE_KEY, componentTypes, {
|
|
7830
|
+
shouldDirty: true
|
|
7831
|
+
});
|
|
7832
|
+
}, [isMenuFilterMode, componentTypes, labels, setValue]);
|
|
7833
|
+
var totalActive = React__default.useMemo(function () {
|
|
7834
|
+
return groupKeys.reduce(function (sum, key) {
|
|
7835
|
+
var _labels$key2;
|
|
7836
|
+
return sum + ((_labels$key2 = labels[key]) != null ? _labels$key2 : []).length;
|
|
7837
|
+
}, 0);
|
|
7838
|
+
}, [groupKeys, labels]);
|
|
7839
|
+
var viewTypeLabels = (_labels$VIEW_TYPE_KEY3 = labels[VIEW_TYPE_KEY]) != null ? _labels$VIEW_TYPE_KEY3 : [];
|
|
7840
|
+
var activeNonViewType = Math.max(0, totalActive - viewTypeLabels.length);
|
|
7841
|
+
var isClearAllDisabled = isMenuFilterMode ? totalActive === 0 // Menu mode: disable only if nothing selected at all
|
|
7842
|
+
: activeNonViewType === 0;
|
|
7843
|
+
var clearAll = function clearAll() {
|
|
7844
|
+
var newLabels = Object.assign({}, labels);
|
|
7845
|
+
groupKeys.forEach(function (key) {
|
|
7846
|
+
if (isMenuFilterMode || key !== VIEW_TYPE_KEY) {
|
|
7847
|
+
// Menu mode: clear everything including viewType
|
|
7848
|
+
// Form mode: clear everything except viewType
|
|
7849
|
+
newLabels[key] = [];
|
|
7850
|
+
}
|
|
7851
|
+
});
|
|
7852
|
+
setValue('labels', newLabels, {
|
|
7853
|
+
shouldDirty: true
|
|
7854
|
+
});
|
|
7855
|
+
if (isMenuFilterMode && onLabelsChange) {
|
|
7856
|
+
onLabelsChange(newLabels);
|
|
7857
|
+
}
|
|
7858
|
+
};
|
|
7859
|
+
var toggle = function toggle(key, item, locked) {
|
|
7860
|
+
var _labels$key3, _Object$assign;
|
|
7861
|
+
if (locked) {
|
|
7862
|
+
return;
|
|
7863
|
+
}
|
|
7864
|
+
var currentGroup = (_labels$key3 = labels[key]) != null ? _labels$key3 : [];
|
|
7865
|
+
var nextGroup = currentGroup.includes(item) ? currentGroup.filter(function (label) {
|
|
7866
|
+
return label !== item;
|
|
7867
|
+
}) : [].concat(currentGroup, [item]);
|
|
7868
|
+
var newLabels = Object.assign({}, labels, (_Object$assign = {}, _Object$assign[key] = nextGroup, _Object$assign));
|
|
7869
|
+
setValue('labels', newLabels, {
|
|
7870
|
+
shouldDirty: true,
|
|
7871
|
+
shouldTouch: true
|
|
7872
|
+
});
|
|
7873
|
+
if (isMenuFilterMode && onLabelsChange) {
|
|
7874
|
+
onLabelsChange(newLabels);
|
|
7875
|
+
}
|
|
7876
|
+
};
|
|
7877
|
+
var groups = React__default.useMemo(function () {
|
|
7878
|
+
return orderedGroupKeys.map(function (key) {
|
|
7879
|
+
var _availableLabels$key;
|
|
7880
|
+
var isViewType = key === VIEW_TYPE_KEY;
|
|
7881
|
+
var items = isViewType ? viewTypeItems : (_availableLabels$key = availableLabels[key]) != null ? _availableLabels$key : [];
|
|
7882
|
+
var locked = !isMenuFilterMode && isViewType;
|
|
7883
|
+
return {
|
|
7884
|
+
key: key,
|
|
7885
|
+
title: titleForGroup(key),
|
|
7886
|
+
items: items,
|
|
7887
|
+
locked: locked
|
|
7888
|
+
};
|
|
7889
|
+
});
|
|
7890
|
+
}, [orderedGroupKeys, availableLabels, viewTypeItems, isMenuFilterMode, titleForGroup]);
|
|
7891
|
+
var _React$useState = React__default.useState(false),
|
|
7892
|
+
expandAll = _React$useState[0],
|
|
7893
|
+
setExpandAll = _React$useState[1];
|
|
7894
|
+
var _React$useState2 = React__default.useState(0),
|
|
7895
|
+
resetKey = _React$useState2[0],
|
|
7896
|
+
setResetKey = _React$useState2[1];
|
|
7897
|
+
var toggleAll = function toggleAll() {
|
|
7898
|
+
setExpandAll(function (prev) {
|
|
7899
|
+
return !prev;
|
|
7900
|
+
});
|
|
7901
|
+
setResetKey(function (key) {
|
|
7902
|
+
return key + 1;
|
|
7903
|
+
});
|
|
7904
|
+
};
|
|
7905
|
+
return jsxs(Box, {
|
|
7906
|
+
sx: {
|
|
7907
|
+
py: 1
|
|
7908
|
+
},
|
|
7909
|
+
children: [jsx(Typography, {
|
|
7910
|
+
variant: "subtitle1",
|
|
7911
|
+
sx: {
|
|
7912
|
+
px: 2,
|
|
7913
|
+
mb: 1,
|
|
7914
|
+
mt: 1
|
|
7915
|
+
},
|
|
7916
|
+
children: t('workspace-presets-form-labels-header')
|
|
7917
|
+
}), jsxs(Box, {
|
|
7918
|
+
sx: {
|
|
7919
|
+
px: 2,
|
|
7920
|
+
display: 'grid',
|
|
7921
|
+
rowGap: 1,
|
|
7922
|
+
mb: 2
|
|
7923
|
+
},
|
|
7924
|
+
children: [jsx(Button, {
|
|
7925
|
+
variant: "contained",
|
|
7926
|
+
size: "small",
|
|
7927
|
+
color: "secondary",
|
|
7928
|
+
onClick: clearAll,
|
|
7929
|
+
disabled: isClearAllDisabled,
|
|
7930
|
+
sx: {
|
|
7931
|
+
justifySelf: 'start',
|
|
7932
|
+
letterSpacing: 0.2,
|
|
7933
|
+
boxShadow: 'none',
|
|
7934
|
+
textTransform: 'none'
|
|
7935
|
+
},
|
|
7936
|
+
children: t('workspace-presets-form-labels-clearAll', {
|
|
7937
|
+
count: totalActive
|
|
7938
|
+
})
|
|
7939
|
+
}), jsx(Typography, {
|
|
7940
|
+
variant: "caption",
|
|
7941
|
+
sx: {
|
|
7942
|
+
color: 'text.secondary'
|
|
7943
|
+
},
|
|
7944
|
+
children: t('workspace-presets-form-labels-info')
|
|
7945
|
+
}), jsx(Button, {
|
|
7946
|
+
variant: "outlined",
|
|
7947
|
+
size: "small",
|
|
7948
|
+
onClick: toggleAll,
|
|
7949
|
+
sx: {
|
|
7950
|
+
justifySelf: 'start',
|
|
7951
|
+
textTransform: 'none',
|
|
7952
|
+
minWidth: 120,
|
|
7953
|
+
maxWidth: 120
|
|
7954
|
+
},
|
|
7955
|
+
endIcon: expandAll ? jsx(ChevronUp, {}) : jsx(ChevronDown, {}),
|
|
7956
|
+
children: expandAll ? t('workspace-presets-form-labels-collapseAll') : t('workspace-presets-form-labels-expandAll')
|
|
7957
|
+
})]
|
|
7958
|
+
}), jsx(Stack, {
|
|
7959
|
+
spacing: 1,
|
|
7960
|
+
sx: {
|
|
7961
|
+
px: 1
|
|
7962
|
+
},
|
|
7963
|
+
children: groups.map(function (_ref2) {
|
|
7964
|
+
var _labels$key4;
|
|
7965
|
+
var key = _ref2.key,
|
|
7966
|
+
title = _ref2.title,
|
|
7967
|
+
items = _ref2.items,
|
|
7968
|
+
locked = _ref2.locked;
|
|
7969
|
+
var safeItems = items != null ? items : [];
|
|
7970
|
+
var currentGroupLabels = (_labels$key4 = labels[key]) != null ? _labels$key4 : [];
|
|
7971
|
+
var active = currentGroupLabels.length;
|
|
7972
|
+
return jsx(CustomAccordion, {
|
|
7973
|
+
defaultExpanded: expandAll,
|
|
7974
|
+
"data-testid": "workspace-labels-drawer-" + key,
|
|
7975
|
+
sx: {
|
|
7976
|
+
border: 'none',
|
|
7977
|
+
width: '100%',
|
|
7978
|
+
boxShadow: 'none',
|
|
7979
|
+
'&::before': {
|
|
7980
|
+
display: 'none'
|
|
7981
|
+
},
|
|
7982
|
+
'& .MuiPaper-root, & .MuiAccordion-root': {
|
|
7983
|
+
boxShadow: 'none'
|
|
7984
|
+
},
|
|
7985
|
+
'& .MuiAccordionSummary-content, & .MuiAccordionSummary-content.Mui-expanded': {
|
|
7986
|
+
marginY: 0
|
|
7987
|
+
},
|
|
7988
|
+
'& .MuiAccordionDetails-root': {
|
|
7989
|
+
paddingTop: 0.25,
|
|
7990
|
+
paddingBottom: 0.75
|
|
7991
|
+
},
|
|
7992
|
+
'& .MuiAccordionSummary-root.Mui-expanded': {
|
|
7993
|
+
borderBottom: 'none'
|
|
7994
|
+
}
|
|
7995
|
+
},
|
|
7996
|
+
title: jsxs(Stack, {
|
|
7997
|
+
direction: "row",
|
|
7998
|
+
alignItems: "center",
|
|
7999
|
+
sx: {
|
|
8000
|
+
flexGrow: 1,
|
|
8001
|
+
minWidth: 0
|
|
8002
|
+
},
|
|
8003
|
+
children: [jsxs(Stack, {
|
|
8004
|
+
direction: "row",
|
|
8005
|
+
spacing: 1,
|
|
8006
|
+
alignItems: "center",
|
|
8007
|
+
children: [jsx(Typography, {
|
|
8008
|
+
sx: {
|
|
8009
|
+
fontSize: '14px'
|
|
8010
|
+
},
|
|
8011
|
+
children: title + " (" + safeItems.length + ")"
|
|
8012
|
+
}), locked && jsx(LockLocked, {
|
|
8013
|
+
fontSize: "small"
|
|
8014
|
+
})]
|
|
8015
|
+
}), active > 0 && jsx(Chip, {
|
|
8016
|
+
size: "small",
|
|
8017
|
+
label: active + " " + t('workspace-label-active'),
|
|
8018
|
+
color: "primary",
|
|
8019
|
+
variant: "outlined",
|
|
8020
|
+
sx: {
|
|
8021
|
+
ml: 'auto',
|
|
8022
|
+
fontWeight: 500,
|
|
8023
|
+
fontSize: 12,
|
|
8024
|
+
border: 'none',
|
|
8025
|
+
position: 'absolute',
|
|
8026
|
+
right: 35,
|
|
8027
|
+
cursor: 'default',
|
|
8028
|
+
pointerEvents: 'none',
|
|
8029
|
+
'&:hover': {
|
|
8030
|
+
backgroundColor: 'transparent',
|
|
8031
|
+
boxShadow: 'none'
|
|
8032
|
+
}
|
|
8033
|
+
}
|
|
8034
|
+
})]
|
|
8035
|
+
}),
|
|
8036
|
+
children: jsx(Stack, {
|
|
8037
|
+
spacing: -0.8,
|
|
8038
|
+
children: safeItems.map(function (it) {
|
|
8039
|
+
return jsx(FormControlLabel, {
|
|
8040
|
+
disabled: locked,
|
|
8041
|
+
control: jsx(Checkbox, {
|
|
8042
|
+
size: "small",
|
|
8043
|
+
checked: currentGroupLabels.includes(it),
|
|
8044
|
+
onChange: function onChange() {
|
|
8045
|
+
return toggle(key, it, locked);
|
|
8046
|
+
}
|
|
8047
|
+
}),
|
|
8048
|
+
label: jsx(Typography, {
|
|
8049
|
+
variant: "body2",
|
|
8050
|
+
sx: {
|
|
8051
|
+
fontSize: 16
|
|
8052
|
+
},
|
|
8053
|
+
children: labelFor(key, it)
|
|
8054
|
+
})
|
|
8055
|
+
}, it);
|
|
8056
|
+
})
|
|
8057
|
+
})
|
|
8058
|
+
}, resetKey + "-" + key + "-" + expandAll);
|
|
8059
|
+
})
|
|
8060
|
+
})]
|
|
8061
|
+
});
|
|
8062
|
+
};
|
|
8063
|
+
|
|
8064
|
+
var WorkspaceMenuLabelsPanel = function WorkspaceMenuLabelsPanel(_ref) {
|
|
8065
|
+
var value = _ref.value,
|
|
8066
|
+
onChange = _ref.onChange,
|
|
8067
|
+
menuLabels = _ref.menuLabels;
|
|
8068
|
+
var methods = useForm({
|
|
8069
|
+
defaultValues: {
|
|
8070
|
+
labels: value != null ? value : {},
|
|
8071
|
+
views: []
|
|
8072
|
+
}
|
|
8073
|
+
});
|
|
8074
|
+
return jsx(FormProvider, Object.assign({}, methods, {
|
|
8075
|
+
children: jsx(PresetLabelsPanel, {
|
|
8076
|
+
menuLabels: menuLabels,
|
|
8077
|
+
isMenuFilterMode: true,
|
|
8078
|
+
onLabelsChange: onChange,
|
|
8079
|
+
"data-testid": "workspace-menu-labels-panel"
|
|
8080
|
+
})
|
|
8081
|
+
}));
|
|
8082
|
+
};
|
|
8083
|
+
|
|
8084
|
+
var formatDate = function formatDate(value) {
|
|
8085
|
+
var _dateUtils$isoStringT, _dateUtils$dateToStri;
|
|
8086
|
+
if (!value) {
|
|
8087
|
+
return undefined;
|
|
8088
|
+
}
|
|
8089
|
+
var parsedDate = (_dateUtils$isoStringT = dateUtils.isoStringToDate(value, false)) != null ? _dateUtils$isoStringT : dateUtils.stringToDate(value, 'yyyy-MM-dd', false);
|
|
8090
|
+
if (!parsedDate || Number.isNaN(parsedDate.getTime())) {
|
|
8091
|
+
return value;
|
|
8092
|
+
}
|
|
8093
|
+
return (_dateUtils$dateToStri = dateUtils.dateToString(parsedDate, 'dd/MM/yyyy', false)) != null ? _dateUtils$dateToStri : value;
|
|
8094
|
+
};
|
|
8095
|
+
var WorkspacePresetInfo = function WorkspacePresetInfo(_ref) {
|
|
8096
|
+
var _preset$description, _preset$abstract, _anchorEl$ownerDocume, _formatDate, _preset$updatedBy, _formatDate2, _preset$username;
|
|
8097
|
+
var preset = _ref.preset,
|
|
8098
|
+
anchorEl = _ref.anchorEl,
|
|
8099
|
+
isOpen = _ref.isOpen,
|
|
8100
|
+
onClose = _ref.onClose,
|
|
8101
|
+
_ref$disablePortal = _ref.disablePortal,
|
|
8102
|
+
disablePortal = _ref$disablePortal === void 0 ? false : _ref$disablePortal;
|
|
8103
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
8104
|
+
t = _useWorkspaceTranslat.t;
|
|
8105
|
+
var _React$useState = React__default.useState(false),
|
|
8106
|
+
isAbstractOpen = _React$useState[0],
|
|
8107
|
+
setIsAbstractOpen = _React$useState[1];
|
|
8108
|
+
var _React$useState2 = React__default.useState(false),
|
|
8109
|
+
isLabelsOpen = _React$useState2[0],
|
|
8110
|
+
setIsLabelsOpen = _React$useState2[1];
|
|
8111
|
+
var labelEntries = React__default.useMemo(function () {
|
|
8112
|
+
var _preset$labels;
|
|
8113
|
+
return Object.entries((_preset$labels = preset == null ? void 0 : preset.labels) != null ? _preset$labels : {}).filter(function (_ref2) {
|
|
8114
|
+
var values = _ref2[1];
|
|
8115
|
+
return Array.isArray(values) && values.length > 0;
|
|
8116
|
+
});
|
|
8117
|
+
}, [preset == null ? void 0 : preset.labels]);
|
|
8118
|
+
var totalLabelCount = React__default.useMemo(function () {
|
|
8119
|
+
return labelEntries.reduce(function (sum, _ref3) {
|
|
8120
|
+
var _values$length;
|
|
8121
|
+
var values = _ref3[1];
|
|
8122
|
+
return sum + ((_values$length = values == null ? void 0 : values.length) != null ? _values$length : 0);
|
|
8123
|
+
}, 0);
|
|
8124
|
+
}, [labelEntries]);
|
|
8125
|
+
var shortDescription = (_preset$description = preset == null ? void 0 : preset.description) != null ? _preset$description : '';
|
|
8126
|
+
var abstractText = (_preset$abstract = preset == null ? void 0 : preset["abstract"]) != null ? _preset$abstract : '';
|
|
8127
|
+
var labelFor = React__default.useCallback(function (group, value) {
|
|
8128
|
+
var translationKey = "workspace-labels-" + group + "-" + value;
|
|
8129
|
+
var translated = t(translationKey);
|
|
8130
|
+
if (translated !== translationKey) {
|
|
8131
|
+
return translated;
|
|
8132
|
+
}
|
|
8133
|
+
return humanizeLabelStrings(value);
|
|
8134
|
+
}, [t]);
|
|
8135
|
+
React__default.useEffect(function () {
|
|
8136
|
+
if (!isOpen) {
|
|
8137
|
+
setIsAbstractOpen(false);
|
|
8138
|
+
setIsLabelsOpen(false);
|
|
8139
|
+
}
|
|
8140
|
+
}, [isOpen]);
|
|
8141
|
+
if (!preset) {
|
|
8142
|
+
return null;
|
|
8143
|
+
}
|
|
8144
|
+
return jsx(Popper, {
|
|
8145
|
+
open: isOpen,
|
|
8146
|
+
anchorEl: anchorEl,
|
|
8147
|
+
placement: "auto",
|
|
8148
|
+
disablePortal: disablePortal,
|
|
8149
|
+
container: anchorEl ? (_anchorEl$ownerDocume = anchorEl.ownerDocument) == null ? void 0 : _anchorEl$ownerDocume.body : undefined,
|
|
8150
|
+
sx: {
|
|
8151
|
+
zIndex: 1300
|
|
8152
|
+
},
|
|
8153
|
+
"data-testid": "workspace-preset-info-popper",
|
|
8154
|
+
popperOptions: {
|
|
8155
|
+
strategy: 'fixed'
|
|
8156
|
+
},
|
|
8157
|
+
modifiers: [{
|
|
8158
|
+
name: 'offset',
|
|
8159
|
+
options: {
|
|
8160
|
+
offset: [8, 0]
|
|
8161
|
+
}
|
|
8162
|
+
}, {
|
|
8163
|
+
name: 'flip',
|
|
8164
|
+
options: {
|
|
8165
|
+
fallbackPlacements: ['bottom-start', 'top-start', 'right-start', 'left-start']
|
|
8166
|
+
}
|
|
8167
|
+
}, {
|
|
8168
|
+
name: 'preventOverflow',
|
|
8169
|
+
options: {
|
|
8170
|
+
padding: 8,
|
|
8171
|
+
altBoundary: true,
|
|
8172
|
+
tether: true,
|
|
8173
|
+
boundary: 'viewport',
|
|
8174
|
+
altAxis: true
|
|
8175
|
+
}
|
|
8176
|
+
}],
|
|
8177
|
+
children: jsx(ClickAwayListener, {
|
|
8178
|
+
onClickAway: onClose,
|
|
8179
|
+
children: jsxs(Paper, {
|
|
8180
|
+
elevation: 8,
|
|
8181
|
+
sx: {
|
|
8182
|
+
width: {
|
|
8183
|
+
xs: '100%',
|
|
8184
|
+
sm: 340
|
|
8185
|
+
},
|
|
8186
|
+
maxWidth: {
|
|
8187
|
+
xs: 'calc(100vw - 16px)',
|
|
8188
|
+
sm: 340
|
|
8189
|
+
},
|
|
8190
|
+
maxHeight: 'calc(100vh - 16px)',
|
|
8191
|
+
overflowY: 'auto',
|
|
8192
|
+
borderRadius: 2,
|
|
8193
|
+
boxShadow: '0px 8px 24px rgba(15, 23, 42, 0.2)',
|
|
8194
|
+
padding: 2,
|
|
8195
|
+
bgcolor: 'geowebColors.background.surface'
|
|
8196
|
+
},
|
|
8197
|
+
children: [jsxs(Box, {
|
|
8198
|
+
sx: {
|
|
8199
|
+
display: 'flex',
|
|
8200
|
+
alignItems: 'center',
|
|
8201
|
+
justifyContent: 'space-between',
|
|
8202
|
+
mb: 1.5
|
|
8203
|
+
},
|
|
8204
|
+
children: [jsx(Typography, {
|
|
8205
|
+
variant: "subtitle1",
|
|
8206
|
+
fontSize: 20,
|
|
8207
|
+
fontWeight: 400,
|
|
8208
|
+
children: t('workspace-info-title')
|
|
8209
|
+
}), jsx(IconButton, {
|
|
8210
|
+
onClick: onClose,
|
|
8211
|
+
size: "small",
|
|
8212
|
+
"data-testid": "workspace-preset-info-close",
|
|
8213
|
+
children: jsx(Close, {
|
|
8214
|
+
fontSize: "small"
|
|
8215
|
+
})
|
|
8216
|
+
})]
|
|
8217
|
+
}), jsxs(Box, {
|
|
8218
|
+
sx: {
|
|
8219
|
+
mb: 1.75
|
|
8220
|
+
},
|
|
8221
|
+
display: "flex",
|
|
8222
|
+
alignItems: "center",
|
|
8223
|
+
children: [jsx(Typography, {
|
|
8224
|
+
variant: "subtitle2",
|
|
8225
|
+
fontSize: 16,
|
|
8226
|
+
fontWeight: 400,
|
|
8227
|
+
gutterBottom: true,
|
|
8228
|
+
sx: {
|
|
8229
|
+
mr: 0.5
|
|
8230
|
+
},
|
|
8231
|
+
children: t('workspace-info-preset-title')
|
|
8232
|
+
}), jsx(Typography, {
|
|
8233
|
+
variant: "subtitle2",
|
|
8234
|
+
fontSize: 16,
|
|
8235
|
+
fontWeight: 300,
|
|
8236
|
+
gutterBottom: true,
|
|
8237
|
+
children: preset.title
|
|
8238
|
+
})]
|
|
8239
|
+
}), jsxs(Box, {
|
|
8240
|
+
sx: {
|
|
8241
|
+
mb: 1.75
|
|
8242
|
+
},
|
|
8243
|
+
children: [jsx(Typography, {
|
|
8244
|
+
variant: "subtitle2",
|
|
8245
|
+
fontSize: 16,
|
|
8246
|
+
fontWeight: 400,
|
|
8247
|
+
gutterBottom: true,
|
|
8248
|
+
children: t('workspace-info-short-description')
|
|
8249
|
+
}), jsx(Typography, {
|
|
8250
|
+
variant: "body2",
|
|
8251
|
+
color: "text.secondary",
|
|
8252
|
+
children: shortDescription || t('workspace-info-no-description')
|
|
8253
|
+
})]
|
|
8254
|
+
}), jsxs(Box, {
|
|
8255
|
+
sx: {
|
|
8256
|
+
mb: 1
|
|
8257
|
+
},
|
|
8258
|
+
children: [jsxs(Box, {
|
|
8259
|
+
sx: {
|
|
8260
|
+
display: 'flex',
|
|
8261
|
+
alignItems: 'center',
|
|
8262
|
+
justifyContent: 'space-between',
|
|
8263
|
+
cursor: 'pointer'
|
|
8264
|
+
},
|
|
8265
|
+
onClick: function onClick() {
|
|
8266
|
+
return setIsAbstractOpen(function (prevState) {
|
|
8267
|
+
return !prevState;
|
|
8268
|
+
});
|
|
8269
|
+
},
|
|
8270
|
+
children: [jsx(Typography, {
|
|
8271
|
+
variant: "subtitle2",
|
|
8272
|
+
fontSize: 16,
|
|
8273
|
+
fontWeight: 400,
|
|
8274
|
+
children: t('workspace-info-abstract')
|
|
8275
|
+
}), isAbstractOpen ? jsx(ChevronUp, {
|
|
8276
|
+
sx: {
|
|
8277
|
+
mr: 15
|
|
8278
|
+
}
|
|
8279
|
+
}) : jsx(ChevronDown, {
|
|
8280
|
+
sx: {
|
|
8281
|
+
mr: 15
|
|
8282
|
+
}
|
|
8283
|
+
})]
|
|
8284
|
+
}), jsx(Collapse, {
|
|
8285
|
+
"in": isAbstractOpen,
|
|
8286
|
+
unmountOnExit: true,
|
|
8287
|
+
children: jsx(Typography, {
|
|
8288
|
+
variant: "body2",
|
|
8289
|
+
color: "text.secondary",
|
|
8290
|
+
sx: {
|
|
8291
|
+
mt: 0.5,
|
|
8292
|
+
wordBreak: 'break-word',
|
|
8293
|
+
overflowWrap: 'anywhere'
|
|
8294
|
+
},
|
|
8295
|
+
children: abstractText || t('workspace-info-no-abstract')
|
|
8296
|
+
})
|
|
8297
|
+
})]
|
|
8298
|
+
}), jsxs(Box, {
|
|
8299
|
+
sx: {
|
|
8300
|
+
my: 1
|
|
8301
|
+
},
|
|
8302
|
+
children: [jsxs(Box, {
|
|
8303
|
+
sx: {
|
|
8304
|
+
display: 'flex',
|
|
8305
|
+
alignItems: 'center',
|
|
8306
|
+
justifyContent: 'space-between',
|
|
8307
|
+
cursor: 'pointer'
|
|
8308
|
+
},
|
|
8309
|
+
onClick: function onClick() {
|
|
8310
|
+
return setIsLabelsOpen(function (prevState) {
|
|
8311
|
+
return !prevState;
|
|
8312
|
+
});
|
|
8313
|
+
},
|
|
8314
|
+
children: [jsx(Typography, {
|
|
8315
|
+
variant: "subtitle2",
|
|
8316
|
+
fontSize: 16,
|
|
8317
|
+
fontWeight: 400,
|
|
8318
|
+
children: t('workspace-info-selected-labels', {
|
|
8319
|
+
count: totalLabelCount
|
|
8320
|
+
})
|
|
8321
|
+
}), isLabelsOpen ? jsx(ChevronUp, {
|
|
8322
|
+
sx: {
|
|
8323
|
+
mr: 15
|
|
8324
|
+
}
|
|
8325
|
+
}) : jsx(ChevronDown, {
|
|
8326
|
+
sx: {
|
|
8327
|
+
mr: 15
|
|
8328
|
+
}
|
|
8329
|
+
})]
|
|
8330
|
+
}), jsxs(Collapse, {
|
|
8331
|
+
"in": isLabelsOpen,
|
|
8332
|
+
unmountOnExit: true,
|
|
8333
|
+
children: [labelEntries.length === 0 && jsx(Typography, {
|
|
8334
|
+
variant: "body2",
|
|
8335
|
+
color: "text.secondary",
|
|
8336
|
+
sx: {
|
|
8337
|
+
mt: 0.5
|
|
8338
|
+
},
|
|
8339
|
+
children: t('workspace-info-no-labels')
|
|
8340
|
+
}), labelEntries.length > 0 && jsx(Stack, {
|
|
8341
|
+
spacing: 1,
|
|
8342
|
+
sx: {
|
|
8343
|
+
mt: 1
|
|
8344
|
+
},
|
|
8345
|
+
children: labelEntries.map(function (_ref4) {
|
|
8346
|
+
var group = _ref4[0],
|
|
8347
|
+
values = _ref4[1];
|
|
8348
|
+
return jsx(Box, {
|
|
8349
|
+
children: jsx(Box, {
|
|
8350
|
+
sx: {
|
|
8351
|
+
display: 'flex',
|
|
8352
|
+
flexWrap: 'wrap',
|
|
8353
|
+
gap: 0.5
|
|
8354
|
+
},
|
|
8355
|
+
children: (values != null ? values : []).map(function (value) {
|
|
8356
|
+
return jsx(Chip, {
|
|
8357
|
+
label: labelFor(group, value),
|
|
8358
|
+
size: "small",
|
|
8359
|
+
color: "secondary",
|
|
8360
|
+
sx: {
|
|
8361
|
+
fontSize: '12px',
|
|
8362
|
+
height: 24
|
|
8363
|
+
}
|
|
8364
|
+
}, group + "-" + value);
|
|
8365
|
+
})
|
|
8366
|
+
})
|
|
8367
|
+
}, group);
|
|
8368
|
+
})
|
|
8369
|
+
})]
|
|
8370
|
+
})]
|
|
8371
|
+
}), jsx(Box, {
|
|
8372
|
+
sx: {
|
|
8373
|
+
mt: 1.5,
|
|
8374
|
+
padding: 1.25,
|
|
8375
|
+
borderRadius: 1,
|
|
8376
|
+
border: '0.5px solid',
|
|
8377
|
+
borderColor: 'geowebColors.buttons.secondary.default.fill',
|
|
8378
|
+
backgroundColor: 'geowebColors.typographyAndIcons.informationDialog'
|
|
8379
|
+
},
|
|
8380
|
+
children: jsxs(Stack, {
|
|
8381
|
+
spacing: 0.5,
|
|
8382
|
+
children: [jsxs(Box, {
|
|
8383
|
+
sx: {
|
|
8384
|
+
display: 'flex',
|
|
8385
|
+
justifyContent: 'space-between'
|
|
8386
|
+
},
|
|
8387
|
+
children: [jsx(Typography, {
|
|
8388
|
+
variant: "caption",
|
|
8389
|
+
color: "text.secondary",
|
|
8390
|
+
children: t('workspace-info-updated')
|
|
8391
|
+
}), jsx(Typography, {
|
|
8392
|
+
variant: "caption",
|
|
8393
|
+
color: "text.secondary",
|
|
8394
|
+
children: t('workspace-info-author')
|
|
8395
|
+
})]
|
|
8396
|
+
}), jsxs(Box, {
|
|
8397
|
+
sx: {
|
|
8398
|
+
display: 'flex',
|
|
8399
|
+
justifyContent: 'space-between',
|
|
8400
|
+
fontSize: '13px'
|
|
8401
|
+
},
|
|
8402
|
+
children: [jsx(Typography, {
|
|
8403
|
+
variant: "body2",
|
|
8404
|
+
children: (_formatDate = formatDate(preset.updated)) != null ? _formatDate : t('workspace-info-no-date-provided')
|
|
8405
|
+
}), jsx(Typography, {
|
|
8406
|
+
variant: "body2",
|
|
8407
|
+
children: (_preset$updatedBy = preset.updatedBy) != null ? _preset$updatedBy : t('workspace-info-unknown-author')
|
|
8408
|
+
})]
|
|
8409
|
+
}), jsx(Divider, {
|
|
8410
|
+
sx: {
|
|
8411
|
+
my: 0.75
|
|
8412
|
+
}
|
|
8413
|
+
}), jsxs(Box, {
|
|
8414
|
+
sx: {
|
|
8415
|
+
display: 'flex',
|
|
8416
|
+
justifyContent: 'space-between'
|
|
8417
|
+
},
|
|
8418
|
+
children: [jsx(Typography, {
|
|
8419
|
+
variant: "caption",
|
|
8420
|
+
color: "text.secondary",
|
|
8421
|
+
children: t('workspace-info-created')
|
|
8422
|
+
}), jsx(Typography, {
|
|
8423
|
+
variant: "caption",
|
|
8424
|
+
color: "text.secondary",
|
|
8425
|
+
children: t('workspace-info-created-by')
|
|
8426
|
+
})]
|
|
8427
|
+
}), jsxs(Box, {
|
|
8428
|
+
sx: {
|
|
8429
|
+
display: 'flex',
|
|
8430
|
+
justifyContent: 'space-between',
|
|
8431
|
+
fontSize: '13px'
|
|
8432
|
+
},
|
|
8433
|
+
children: [jsx(Typography, {
|
|
8434
|
+
variant: "body2",
|
|
8435
|
+
children: (_formatDate2 = formatDate(preset.date)) != null ? _formatDate2 : t('workspace-info-no-date-provided')
|
|
8436
|
+
}), jsx(Typography, {
|
|
8437
|
+
variant: "body2",
|
|
8438
|
+
children: (_preset$username = preset.username) != null ? _preset$username : t('workspace-info-unknown-author')
|
|
8439
|
+
})]
|
|
8440
|
+
})]
|
|
8441
|
+
})
|
|
8442
|
+
})]
|
|
8443
|
+
})
|
|
8444
|
+
})
|
|
8445
|
+
});
|
|
8446
|
+
};
|
|
8447
|
+
|
|
8448
|
+
var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
8449
|
+
var panelId = _ref.panelId,
|
|
8450
|
+
_ref$isLabelFilterOpe = _ref.isLabelFilterOpen,
|
|
8451
|
+
isLabelFilterOpen = _ref$isLabelFilterOpe === void 0 ? false : _ref$isLabelFilterOpe,
|
|
8452
|
+
onToggleLabelFilter = _ref.onToggleLabelFilter,
|
|
8453
|
+
_ref$hasSpaceForLabel = _ref.hasSpaceForLabelFilter,
|
|
8454
|
+
hasSpaceForLabelFilter = _ref$hasSpaceForLabel === void 0 ? true : _ref$hasSpaceForLabel;
|
|
8455
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
8456
|
+
t = _useWorkspaceTranslat.t;
|
|
8457
|
+
var dispatch = useDispatch();
|
|
8458
|
+
var store = useStore();
|
|
8459
|
+
var _useAuthenticationCon = useAuthenticationContext(),
|
|
8460
|
+
currentRole = _useAuthenticationCon.currentRole,
|
|
8461
|
+
isLoggedIn = _useAuthenticationCon.isLoggedIn,
|
|
8462
|
+
auth = _useAuthenticationCon.auth;
|
|
8463
|
+
var username = (auth == null ? void 0 : auth.username) || '';
|
|
8464
|
+
var isAdmin = (currentRole == null ? void 0 : currentRole.name) === GEOWEB_ROLE_PRESETS_ADMIN.name;
|
|
8465
|
+
var scope = !isAdmin ? 'user' : 'system';
|
|
8466
|
+
var viewPresets = useSelector(function (store) {
|
|
8467
|
+
return getFilteredViewPresetListForView(store, panelId);
|
|
8468
|
+
});
|
|
8469
|
+
var viewPresetListFilters = useSelector(function (store) {
|
|
8470
|
+
return getViewPresetListFiltersForView(store, panelId, scope, isAdmin);
|
|
8471
|
+
});
|
|
8472
|
+
var viewPresetListSearchQuery = useSelector(function (store) {
|
|
8473
|
+
return getViewPresetListSearchQueryForView(store, panelId);
|
|
8474
|
+
});
|
|
8475
|
+
var viewPresetLabelFilters = useSelector(function (store) {
|
|
8476
|
+
return getViewPresetLabelFilters(store, panelId);
|
|
8477
|
+
});
|
|
8478
|
+
var hasActiveLabelFilters = React.useMemo(function () {
|
|
8479
|
+
if (!viewPresetLabelFilters) {
|
|
8480
|
+
return false;
|
|
8481
|
+
}
|
|
8482
|
+
return Object.values(viewPresetLabelFilters).some(function (group) {
|
|
8483
|
+
return Array.isArray(group) && group.length > 0;
|
|
8484
|
+
});
|
|
8485
|
+
}, [viewPresetLabelFilters]);
|
|
8486
|
+
var filteredPresets = React.useMemo(function () {
|
|
8487
|
+
return filterAndSortPresets(viewPresets, viewPresetListFilters, username, isAdmin, viewPresetLabelFilters != null ? viewPresetLabelFilters : undefined);
|
|
8488
|
+
}, [viewPresets, viewPresetListFilters, username, isAdmin, viewPresetLabelFilters]);
|
|
8489
|
+
var labelsFormMethods = useForm({
|
|
8490
|
+
defaultValues: {
|
|
8491
|
+
labels: viewPresetLabelFilters
|
|
8492
|
+
}
|
|
8493
|
+
});
|
|
8494
|
+
var infoPanelAnchorRef = React.useRef(null);
|
|
8495
|
+
var _React$useState = React.useState(),
|
|
8496
|
+
infoPreset = _React$useState[0],
|
|
8497
|
+
setInfoPreset = _React$useState[1];
|
|
8498
|
+
React.useEffect(function () {
|
|
8499
|
+
if (hasActiveLabelFilters && !hasSpaceForLabelFilter) {
|
|
8500
|
+
labelsFormMethods.reset({
|
|
8501
|
+
labels: undefined
|
|
8502
|
+
});
|
|
8503
|
+
dispatch(viewPresetActions.clearViewPresetLabelFilters({
|
|
8504
|
+
panelId: panelId
|
|
8505
|
+
}));
|
|
8506
|
+
}
|
|
8507
|
+
}, [dispatch, hasActiveLabelFilters, isLabelFilterOpen, hasSpaceForLabelFilter, labelsFormMethods, panelId]);
|
|
8508
|
+
var activeViewPresetId = useSelector(function (store) {
|
|
8509
|
+
return getViewPresetActiveId(store, panelId);
|
|
8510
|
+
});
|
|
8511
|
+
var viewComponentType = useSelector(function (store) {
|
|
8512
|
+
return getViewComponentType(store, panelId);
|
|
8513
|
+
});
|
|
8514
|
+
var currentMapPreset = useSelector(function (store) {
|
|
8515
|
+
return mapSelectors.getMapPreset(store, panelId);
|
|
8516
|
+
});
|
|
8517
|
+
var currentTimeSeriesPreset = useSelector(function (store) {
|
|
8518
|
+
return timeSeriesSelectors.getTimeSeriesPreset(store);
|
|
8519
|
+
});
|
|
8520
|
+
var currentWarningsPreset = useSelector(function (store) {
|
|
8521
|
+
return publicWarningsSelectors.getWarningsPresetById(store, panelId);
|
|
8522
|
+
});
|
|
8523
|
+
var relatedSyncGroupIds = useSelector(function (store) {
|
|
8524
|
+
return syncGroupsSelectors.getAllTargetGroupsForSource(store, {
|
|
8525
|
+
sourceId: panelId
|
|
8526
|
+
});
|
|
8527
|
+
});
|
|
8528
|
+
var error = useSelector(function (store) {
|
|
8529
|
+
return getViewPresetsError(store, panelId);
|
|
8530
|
+
});
|
|
8531
|
+
var isViewPresetsListFetching = useSelector(function (store) {
|
|
8532
|
+
return getViewPresetsIsFetching(store, panelId);
|
|
8533
|
+
});
|
|
8534
|
+
var openViewPresetsDialog = React.useCallback(function (viewPresetDialogOptions) {
|
|
8535
|
+
dispatch(viewPresetActions.openViewPresetDialog({
|
|
8536
|
+
viewPresetDialog: viewPresetDialogOptions
|
|
8537
|
+
}));
|
|
8538
|
+
}, [dispatch]);
|
|
8539
|
+
var selectViewPreset = React.useCallback(function (viewPresetId) {
|
|
8540
|
+
dispatch(viewPresetActions.selectViewPreset({
|
|
8541
|
+
panelId: panelId,
|
|
8542
|
+
viewPresetId: viewPresetId
|
|
8543
|
+
}));
|
|
8544
|
+
}, [dispatch, panelId]);
|
|
8545
|
+
var fetchViewPresets = React.useCallback(function () {
|
|
8546
|
+
var filterParams = constructFilterParams([], viewPresetListSearchQuery);
|
|
8547
|
+
dispatch(viewPresetActions.fetchViewPresets({
|
|
8548
|
+
panelId: panelId,
|
|
8549
|
+
filterParams: filterParams
|
|
8550
|
+
}));
|
|
8551
|
+
}, [dispatch, panelId, viewPresetListSearchQuery]);
|
|
8552
|
+
var constructInitialProps = function constructInitialProps() {
|
|
8553
|
+
switch (viewComponentType) {
|
|
8554
|
+
case 'WarningList':
|
|
8555
|
+
return currentWarningsPreset;
|
|
8556
|
+
case 'TimeSeries':
|
|
8557
|
+
return currentTimeSeriesPreset;
|
|
8558
|
+
case 'Map':
|
|
8559
|
+
return {
|
|
8560
|
+
mapPreset: currentMapPreset,
|
|
8561
|
+
syncGroupsIds: relatedSyncGroupIds
|
|
8562
|
+
};
|
|
8563
|
+
default:
|
|
8564
|
+
return undefined;
|
|
7423
8565
|
}
|
|
7424
8566
|
};
|
|
7425
8567
|
var onClickViewPresetOption = function onClickViewPresetOption(presetId, workspaceAction, preset) {
|
|
7426
8568
|
switch (workspaceAction) {
|
|
7427
8569
|
case WorkspacePresetAction.DUPLICATE:
|
|
7428
8570
|
{
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7433
|
-
|
|
7434
|
-
|
|
7435
|
-
title:
|
|
7436
|
-
|
|
7437
|
-
|
|
7438
|
-
|
|
8571
|
+
void getViewPreset(presetId, auth).then(function (presetFromBE) {
|
|
8572
|
+
var _workspaceSelectors$g, _ref2, _preset$initialProps;
|
|
8573
|
+
var preset = presetFromBE;
|
|
8574
|
+
var fallbackInitialProps = (_workspaceSelectors$g = getViewById(store.getState(), panelId)) == null ? void 0 : _workspaceSelectors$g.initialProps;
|
|
8575
|
+
var initialPropsForForm = (_ref2 = (_preset$initialProps = preset.initialProps) != null ? _preset$initialProps : fallbackInitialProps) != null ? _ref2 : constructInitialProps();
|
|
8576
|
+
openViewPresetsDialog({
|
|
8577
|
+
title: t('workspace-mappreset-save-as'),
|
|
8578
|
+
action: PresetAction.SAVE_AS,
|
|
8579
|
+
viewPresetId: presetId,
|
|
8580
|
+
panelId: panelId,
|
|
8581
|
+
formValues: {
|
|
8582
|
+
title: preset.title,
|
|
8583
|
+
description: preset.description,
|
|
8584
|
+
initialProps: initialPropsForForm,
|
|
8585
|
+
"abstract": preset["abstract"],
|
|
8586
|
+
labels: preset.labels,
|
|
8587
|
+
componentType: preset.componentType
|
|
8588
|
+
}
|
|
8589
|
+
});
|
|
8590
|
+
})["catch"](function () {
|
|
8591
|
+
openViewPresetsDialog({
|
|
8592
|
+
title: t('workspace-mappreset-save-as'),
|
|
8593
|
+
action: PresetAction.SAVE_AS,
|
|
8594
|
+
viewPresetId: presetId,
|
|
8595
|
+
panelId: panelId,
|
|
8596
|
+
formValues: {
|
|
8597
|
+
title: preset.title,
|
|
8598
|
+
description: preset.description,
|
|
8599
|
+
initialProps: constructInitialProps(),
|
|
8600
|
+
"abstract": preset["abstract"],
|
|
8601
|
+
labels: preset.labels,
|
|
8602
|
+
componentType: viewComponentType
|
|
8603
|
+
}
|
|
8604
|
+
});
|
|
7439
8605
|
});
|
|
7440
8606
|
break;
|
|
7441
8607
|
}
|
|
@@ -7449,9 +8615,30 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
7449
8615
|
viewPresetId: presetId,
|
|
7450
8616
|
formValues: {
|
|
7451
8617
|
title: presetTitle,
|
|
7452
|
-
|
|
8618
|
+
description: preset.description,
|
|
8619
|
+
"abstract": preset["abstract"],
|
|
8620
|
+
labels: preset.labels,
|
|
8621
|
+
updated: new Date().toISOString()
|
|
7453
8622
|
}
|
|
7454
8623
|
});
|
|
8624
|
+
void getViewPreset(presetId, auth).then(function (fullPreset) {
|
|
8625
|
+
openViewPresetsDialog({
|
|
8626
|
+
title: t('workspace-mappreset-dialog-title-edit'),
|
|
8627
|
+
action: PresetAction.EDIT,
|
|
8628
|
+
panelId: panelId,
|
|
8629
|
+
viewPresetId: presetId,
|
|
8630
|
+
formValues: {
|
|
8631
|
+
title: fullPreset.title,
|
|
8632
|
+
description: fullPreset.description,
|
|
8633
|
+
"abstract": fullPreset["abstract"],
|
|
8634
|
+
labels: fullPreset.labels,
|
|
8635
|
+
componentType: fullPreset.componentType,
|
|
8636
|
+
initialProps: fullPreset.initialProps
|
|
8637
|
+
}
|
|
8638
|
+
});
|
|
8639
|
+
})["catch"](function () {
|
|
8640
|
+
// Leave dialog with initial data if fetch fails; errors handled elsewhere
|
|
8641
|
+
});
|
|
7455
8642
|
break;
|
|
7456
8643
|
}
|
|
7457
8644
|
case WorkspacePresetAction.SHARE:
|
|
@@ -7465,6 +8652,7 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
7465
8652
|
viewPresetId: presetId,
|
|
7466
8653
|
action: PresetAction.SHARE,
|
|
7467
8654
|
title: preset.title,
|
|
8655
|
+
description: preset.description,
|
|
7468
8656
|
scope: scope,
|
|
7469
8657
|
"abstract": preset["abstract"],
|
|
7470
8658
|
is_shared: preset.is_shared
|
|
@@ -7518,13 +8706,38 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
7518
8706
|
toggleSelectFilterChip(id, selected);
|
|
7519
8707
|
}
|
|
7520
8708
|
};
|
|
8709
|
+
var onLabelsFilterChange = React.useCallback(function (labels) {
|
|
8710
|
+
dispatch(viewPresetActions.setViewPresetLabelFilters({
|
|
8711
|
+
labels: labels,
|
|
8712
|
+
panelId: panelId
|
|
8713
|
+
}));
|
|
8714
|
+
}, [dispatch, panelId]);
|
|
7521
8715
|
var isAllSelectedForFilters = viewPresetListFilters.every(function (filter) {
|
|
7522
8716
|
return filter.isSelected;
|
|
7523
8717
|
});
|
|
7524
|
-
var
|
|
7525
|
-
|
|
8718
|
+
var showLabelFilterToggle = Boolean(onToggleLabelFilter);
|
|
8719
|
+
var shouldHideNewWorkspace = !isAllSelectedForFilters || viewPresetListSearchQuery.length > 0 || hasActiveLabelFilters;
|
|
8720
|
+
var closeInfo = React.useCallback(function () {
|
|
8721
|
+
setInfoPreset(undefined);
|
|
8722
|
+
}, []);
|
|
8723
|
+
var onOpenPresetInfo = React.useCallback(function (preset) {
|
|
8724
|
+
setInfoPreset(function (current) {
|
|
8725
|
+
return (current == null ? void 0 : current.id) === preset.id ? undefined : preset;
|
|
8726
|
+
});
|
|
8727
|
+
}, []);
|
|
8728
|
+
React.useEffect(function () {
|
|
8729
|
+
if (infoPreset && !filteredPresets.some(function (preset) {
|
|
8730
|
+
return preset.id === infoPreset.id;
|
|
8731
|
+
})) {
|
|
8732
|
+
closeInfo();
|
|
8733
|
+
}
|
|
8734
|
+
}, [infoPreset, filteredPresets, closeInfo]);
|
|
8735
|
+
return jsxs(Box, {
|
|
7526
8736
|
"data-testid": "viewpreset-selectlist-connect",
|
|
7527
|
-
|
|
8737
|
+
sx: {
|
|
8738
|
+
bgcolor: 'geowebColors.background.surface',
|
|
8739
|
+
display: 'flex',
|
|
8740
|
+
flexDirection: 'column',
|
|
7528
8741
|
height: '100%'
|
|
7529
8742
|
},
|
|
7530
8743
|
children: [isViewPresetsListFetching && jsx(LinearProgress, {
|
|
@@ -7544,68 +8757,114 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
7544
8757
|
title: t('workspace-retry'),
|
|
7545
8758
|
onClick: fetchViewPresets
|
|
7546
8759
|
}
|
|
7547
|
-
})),
|
|
8760
|
+
})), !error && jsx(Box, {
|
|
7548
8761
|
sx: {
|
|
7549
|
-
|
|
7550
|
-
|
|
8762
|
+
padding: 1,
|
|
8763
|
+
pt: 1,
|
|
8764
|
+
flexShrink: 0
|
|
8765
|
+
},
|
|
8766
|
+
children: jsx(SearchField, {
|
|
8767
|
+
searchFilter: viewPresetListSearchQuery,
|
|
8768
|
+
setSearchFilter: onSearchFilter
|
|
8769
|
+
})
|
|
8770
|
+
}), jsxs(Box, {
|
|
8771
|
+
sx: {
|
|
8772
|
+
display: 'grid',
|
|
8773
|
+
gridTemplateColumns: isLabelFilterOpen ? '280px 1fr' : '1fr',
|
|
7551
8774
|
flexGrow: 1,
|
|
7552
8775
|
minHeight: 0,
|
|
7553
8776
|
padding: 1,
|
|
7554
|
-
|
|
8777
|
+
bgcolor: 'geowebColors.background.surface',
|
|
8778
|
+
overflow: 'hidden'
|
|
7555
8779
|
},
|
|
7556
|
-
children: [
|
|
8780
|
+
children: [isLabelFilterOpen && jsx(Box, {
|
|
8781
|
+
sx: {
|
|
8782
|
+
borderRight: '1px solid',
|
|
8783
|
+
borderColor: 'divider',
|
|
8784
|
+
bgcolor: 'geowebColors.background.surface',
|
|
8785
|
+
overflowY: 'auto',
|
|
8786
|
+
overflowX: 'hidden'
|
|
8787
|
+
},
|
|
8788
|
+
children: jsx(FormProvider, Object.assign({}, labelsFormMethods, {
|
|
8789
|
+
children: jsx(WorkspaceMenuLabelsPanel, {
|
|
8790
|
+
onChange: onLabelsFilterChange,
|
|
8791
|
+
menuLabels: viewPresetLabelFilters
|
|
8792
|
+
})
|
|
8793
|
+
}))
|
|
8794
|
+
}), jsxs(Box, {
|
|
7557
8795
|
sx: {
|
|
7558
|
-
flexShrink: 0,
|
|
7559
8796
|
display: 'flex',
|
|
7560
8797
|
flexDirection: 'column',
|
|
7561
|
-
|
|
7562
|
-
|
|
8798
|
+
height: '100%',
|
|
8799
|
+
padding: 1,
|
|
8800
|
+
overflow: 'hidden'
|
|
7563
8801
|
},
|
|
7564
|
-
|
|
8802
|
+
ref: infoPanelAnchorRef,
|
|
8803
|
+
children: [!error && jsxs(Box, {
|
|
7565
8804
|
sx: {
|
|
8805
|
+
flexShrink: 0,
|
|
7566
8806
|
display: 'flex',
|
|
7567
|
-
|
|
8807
|
+
flexDirection: 'column',
|
|
7568
8808
|
gap: 1,
|
|
7569
|
-
|
|
8809
|
+
marginBottom: 1
|
|
7570
8810
|
},
|
|
7571
|
-
children: jsx(
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
|
|
7577
|
-
|
|
7578
|
-
|
|
8811
|
+
children: [jsx(Box, {
|
|
8812
|
+
sx: {
|
|
8813
|
+
display: 'flex',
|
|
8814
|
+
flexWrap: 'wrap',
|
|
8815
|
+
gap: 1,
|
|
8816
|
+
width: '100%'
|
|
8817
|
+
},
|
|
8818
|
+
children: jsx(Filter, {
|
|
8819
|
+
filters: viewPresetListFilters,
|
|
8820
|
+
onClickFilterChip: onClickFilterChip,
|
|
8821
|
+
isAllSelected: isAllSelectedForFilters,
|
|
8822
|
+
searchQuery: viewPresetListSearchQuery,
|
|
8823
|
+
onSearch: onSearchFilter,
|
|
8824
|
+
showLabelFilterToggle: showLabelFilterToggle,
|
|
8825
|
+
isLabelFilterOpen: isLabelFilterOpen,
|
|
8826
|
+
onToggleLabelFilter: onToggleLabelFilter,
|
|
8827
|
+
showSearchField: false
|
|
8828
|
+
})
|
|
8829
|
+
}), jsx(Box, {
|
|
8830
|
+
sx: {
|
|
8831
|
+
display: 'flex',
|
|
8832
|
+
justifyContent: 'flex-start'
|
|
8833
|
+
},
|
|
8834
|
+
children: jsx(LastUpdateTime, {
|
|
8835
|
+
onPressRefresh: function onPressRefresh() {
|
|
8836
|
+
return fetchViewPresets();
|
|
8837
|
+
},
|
|
8838
|
+
hideLabel: true
|
|
8839
|
+
})
|
|
8840
|
+
})]
|
|
8841
|
+
}), jsxs(Box, {
|
|
7579
8842
|
sx: {
|
|
7580
|
-
|
|
7581
|
-
|
|
8843
|
+
flexGrow: 1,
|
|
8844
|
+
minHeight: 0
|
|
7582
8845
|
},
|
|
7583
|
-
children: jsx(
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
8846
|
+
children: [jsx(WorkspaceSelectList, {
|
|
8847
|
+
workspacePresets: filteredPresets,
|
|
8848
|
+
currentSelectedId: activeViewPresetId || undefined,
|
|
8849
|
+
onClickWorkspacePreset: selectViewPreset,
|
|
8850
|
+
onClickWorkspacePresetOption: onClickViewPresetOption,
|
|
8851
|
+
newPreset: Object.assign({}, getEmptyWorkspaceListItem(t), {
|
|
8852
|
+
title: t('workspace-mappreset-new')
|
|
8853
|
+
}),
|
|
8854
|
+
hideNewWorkspace: shouldHideNewWorkspace,
|
|
8855
|
+
searchQuery: viewPresetListSearchQuery,
|
|
8856
|
+
testIdPrefix: "viewpreset",
|
|
8857
|
+
isAdmin: isAdmin,
|
|
8858
|
+
isEditable: isLoggedIn,
|
|
8859
|
+
onOpenPresetInfo: onOpenPresetInfo,
|
|
8860
|
+
infoOpenPresetId: infoPreset == null ? void 0 : infoPreset.id
|
|
8861
|
+
}), jsx(WorkspacePresetInfo, {
|
|
8862
|
+
isOpen: Boolean(infoPreset),
|
|
8863
|
+
preset: infoPreset,
|
|
8864
|
+
anchorEl: infoPanelAnchorRef.current,
|
|
8865
|
+
onClose: closeInfo
|
|
8866
|
+
})]
|
|
7589
8867
|
})]
|
|
7590
|
-
}), jsx(Box, {
|
|
7591
|
-
sx: {
|
|
7592
|
-
flexGrow: 1,
|
|
7593
|
-
minHeight: 0
|
|
7594
|
-
},
|
|
7595
|
-
children: jsx(WorkspaceSelectList, {
|
|
7596
|
-
workspacePresets: filteredPresets,
|
|
7597
|
-
currentSelectedId: activeViewPresetId || undefined,
|
|
7598
|
-
onClickWorkspacePreset: selectViewPreset,
|
|
7599
|
-
onClickWorkspacePresetOption: onClickViewPresetOption,
|
|
7600
|
-
newPreset: Object.assign({}, getEmptyWorkspaceListItem(t), {
|
|
7601
|
-
title: t('workspace-mappreset-new')
|
|
7602
|
-
}),
|
|
7603
|
-
hideNewWorkspace: shouldHideNewWorkspace,
|
|
7604
|
-
searchQuery: viewPresetListSearchQuery,
|
|
7605
|
-
testIdPrefix: "viewpreset",
|
|
7606
|
-
isAdmin: isAdmin,
|
|
7607
|
-
isEditable: isLoggedIn
|
|
7608
|
-
})
|
|
7609
8868
|
})]
|
|
7610
8869
|
})]
|
|
7611
8870
|
});
|
|
@@ -7615,39 +8874,93 @@ var ViewPresetMenu = function ViewPresetMenu(_ref) {
|
|
|
7615
8874
|
var closeMenu = _ref.closeMenu,
|
|
7616
8875
|
panelId = _ref.panelId,
|
|
7617
8876
|
_ref$isOpen = _ref.isOpen,
|
|
7618
|
-
isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen
|
|
8877
|
+
isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
|
|
8878
|
+
_ref$initialIsLabelFi = _ref.initialIsLabelFilterOpen,
|
|
8879
|
+
initialIsLabelFilterOpen = _ref$initialIsLabelFi === void 0 ? false : _ref$initialIsLabelFi;
|
|
7619
8880
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7620
8881
|
t = _useWorkspaceTranslat.t;
|
|
7621
8882
|
renderCounter.count(ViewPresetMenu.name);
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
|
|
8883
|
+
var containerRef = React__default.useRef(null);
|
|
8884
|
+
var _React$useState = React__default.useState(initialIsLabelFilterOpen),
|
|
8885
|
+
isLabelFilterOpen = _React$useState[0],
|
|
8886
|
+
setIsLabelFilterOpen = _React$useState[1];
|
|
8887
|
+
var _React$useState2 = React__default.useState(true),
|
|
8888
|
+
hasSpaceForLabelFilter = _React$useState2[0],
|
|
8889
|
+
setHasSpaceForLabelFilter = _React$useState2[1];
|
|
8890
|
+
React__default.useEffect(function () {
|
|
8891
|
+
var _ref2, _containerRef$current, _containerRef$current2;
|
|
8892
|
+
var parentView = (_ref2 = (_containerRef$current = (_containerRef$current2 = containerRef.current) == null ? void 0 : _containerRef$current2.parentElement) != null ? _containerRef$current : containerRef.current) != null ? _ref2 : undefined;
|
|
8893
|
+
if (!parentView || typeof ResizeObserver === 'undefined') {
|
|
8894
|
+
return;
|
|
8895
|
+
}
|
|
8896
|
+
var updateSpace = function updateSpace(width) {
|
|
8897
|
+
if (!Number.isFinite(width) || width <= 0) {
|
|
8898
|
+
return;
|
|
7627
8899
|
}
|
|
8900
|
+
setHasSpaceForLabelFilter(width >= 700);
|
|
8901
|
+
};
|
|
8902
|
+
var widthObserver = new ResizeObserver(function (_ref3) {
|
|
8903
|
+
var entry = _ref3[0];
|
|
8904
|
+
updateSpace(entry.contentRect.width);
|
|
8905
|
+
});
|
|
8906
|
+
updateSpace(parentView.getBoundingClientRect().width);
|
|
8907
|
+
widthObserver.observe(parentView);
|
|
8908
|
+
// eslint-disable-next-line consistent-return
|
|
8909
|
+
return function () {
|
|
8910
|
+
widthObserver.disconnect();
|
|
8911
|
+
};
|
|
8912
|
+
}, []);
|
|
8913
|
+
React__default.useEffect(function () {
|
|
8914
|
+
if (!hasSpaceForLabelFilter && isLabelFilterOpen) {
|
|
8915
|
+
setIsLabelFilterOpen(false);
|
|
8916
|
+
}
|
|
8917
|
+
}, [hasSpaceForLabelFilter, isLabelFilterOpen]);
|
|
8918
|
+
var handleToggleLabelFilter = React__default.useCallback(function () {
|
|
8919
|
+
setIsLabelFilterOpen(function (prev) {
|
|
8920
|
+
return !prev;
|
|
8921
|
+
});
|
|
8922
|
+
}, []);
|
|
8923
|
+
var isLabelFilterVisible = isLabelFilterOpen && hasSpaceForLabelFilter;
|
|
8924
|
+
var dialogWidth = isLabelFilterVisible ? 700 : 380;
|
|
8925
|
+
return jsx("div", {
|
|
8926
|
+
ref: containerRef,
|
|
8927
|
+
style: {
|
|
8928
|
+
height: '100%'
|
|
7628
8929
|
},
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
|
|
7634
|
-
|
|
7635
|
-
shouldRenderInline: true,
|
|
7636
|
-
"data-testid": "workspace-viewpreset-menu",
|
|
7637
|
-
children: jsx(ToolContainer, {
|
|
7638
|
-
title: t('workspace-viewpreset-menu'),
|
|
7639
|
-
onClose: closeMenu,
|
|
7640
|
-
style: {
|
|
7641
|
-
width: '100%',
|
|
7642
|
-
height: '100%'
|
|
8930
|
+
children: jsx(CustomDialog, {
|
|
8931
|
+
open: isOpen,
|
|
8932
|
+
onClose: function onClose() {
|
|
8933
|
+
if (closeMenu) {
|
|
8934
|
+
closeMenu();
|
|
8935
|
+
}
|
|
7643
8936
|
},
|
|
7644
|
-
|
|
7645
|
-
|
|
8937
|
+
isResizable: true,
|
|
8938
|
+
hasLayout: false,
|
|
8939
|
+
resizableDefaultSize: {
|
|
8940
|
+
width: dialogWidth,
|
|
8941
|
+
height: '90%'
|
|
7646
8942
|
},
|
|
7647
|
-
|
|
7648
|
-
|
|
8943
|
+
minWidth: isLabelFilterVisible ? 700 : undefined,
|
|
8944
|
+
shouldRenderInline: true,
|
|
8945
|
+
"data-testid": "workspace-viewpreset-menu",
|
|
8946
|
+
children: jsx(ToolContainer, {
|
|
8947
|
+
title: t('workspace-viewpreset-menu'),
|
|
8948
|
+
onClose: closeMenu,
|
|
8949
|
+
style: {
|
|
8950
|
+
width: '100%',
|
|
8951
|
+
height: '100%'
|
|
8952
|
+
},
|
|
8953
|
+
onClick: function onClick(event) {
|
|
8954
|
+
event.stopPropagation();
|
|
8955
|
+
},
|
|
8956
|
+
children: jsx(ViewPresetMenuListConnect, {
|
|
8957
|
+
panelId: panelId,
|
|
8958
|
+
isLabelFilterOpen: isLabelFilterVisible,
|
|
8959
|
+
hasSpaceForLabelFilter: hasSpaceForLabelFilter,
|
|
8960
|
+
onToggleLabelFilter: hasSpaceForLabelFilter ? handleToggleLabelFilter : undefined
|
|
8961
|
+
})
|
|
7649
8962
|
})
|
|
7650
|
-
})
|
|
8963
|
+
}, isLabelFilterVisible ? 'wide' : 'narrow')
|
|
7651
8964
|
});
|
|
7652
8965
|
};
|
|
7653
8966
|
|
|
@@ -7700,8 +9013,14 @@ var createWorkspace = function createWorkspace(data, auth) {
|
|
|
7700
9013
|
}).then(handleResponse);
|
|
7701
9014
|
};
|
|
7702
9015
|
|
|
7703
|
-
var WorkspaceSelectListConnect = function WorkspaceSelectListConnect() {
|
|
9016
|
+
var WorkspaceSelectListConnect = function WorkspaceSelectListConnect(_ref) {
|
|
7704
9017
|
var _GENERIC$AUTH$error$c;
|
|
9018
|
+
var _ref$isLabelFilterOpe = _ref.isLabelFilterOpen,
|
|
9019
|
+
isLabelFilterOpen = _ref$isLabelFilterOpe === void 0 ? false : _ref$isLabelFilterOpe,
|
|
9020
|
+
onToggleLabelFilter = _ref.onToggleLabelFilter;
|
|
9021
|
+
var dispatch = useDispatch();
|
|
9022
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
9023
|
+
t = _useWorkspaceTranslat.t;
|
|
7705
9024
|
var _useAuthenticationCon = useAuthenticationContext(),
|
|
7706
9025
|
currentRole = _useAuthenticationCon.currentRole,
|
|
7707
9026
|
isLoggedIn = _useAuthenticationCon.isLoggedIn,
|
|
@@ -7713,9 +9032,29 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect() {
|
|
|
7713
9032
|
return getWorkspaceList(store);
|
|
7714
9033
|
});
|
|
7715
9034
|
var selectedFilters = useSelector(getWorkspaceListFilters);
|
|
9035
|
+
var labelFilters = useSelector(function (store) {
|
|
9036
|
+
return getWorkspaceLabelFilters(store);
|
|
9037
|
+
});
|
|
9038
|
+
var hasActiveLabelFilters = React.useMemo(function () {
|
|
9039
|
+
if (!labelFilters) {
|
|
9040
|
+
return false;
|
|
9041
|
+
}
|
|
9042
|
+
return Object.values(labelFilters).some(function (group) {
|
|
9043
|
+
return Array.isArray(group) && group.length > 0;
|
|
9044
|
+
});
|
|
9045
|
+
}, [labelFilters]);
|
|
7716
9046
|
var filteredPresets = React.useMemo(function () {
|
|
7717
|
-
return filterAndSortPresets(workspacePresets, selectedFilters, username, isAdmin);
|
|
7718
|
-
}, [workspacePresets, selectedFilters, username, isAdmin]);
|
|
9047
|
+
return filterAndSortPresets(workspacePresets, selectedFilters, username, isAdmin, labelFilters != null ? labelFilters : undefined);
|
|
9048
|
+
}, [workspacePresets, selectedFilters, username, isAdmin, labelFilters]);
|
|
9049
|
+
var infoPanelAnchorRef = React.useRef(null);
|
|
9050
|
+
var _React$useState = React.useState(),
|
|
9051
|
+
infoPreset = _React$useState[0],
|
|
9052
|
+
setInfoPreset = _React$useState[1];
|
|
9053
|
+
var labelsFormMethods = useForm({
|
|
9054
|
+
defaultValues: {
|
|
9055
|
+
labels: labelFilters
|
|
9056
|
+
}
|
|
9057
|
+
});
|
|
7719
9058
|
var currentView = useSelector(function (store) {
|
|
7720
9059
|
return getWorkspaceState(store);
|
|
7721
9060
|
});
|
|
@@ -7731,9 +9070,12 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect() {
|
|
|
7731
9070
|
var error = useSelector(function (store) {
|
|
7732
9071
|
return getWorkspaceListError(store);
|
|
7733
9072
|
});
|
|
7734
|
-
var
|
|
7735
|
-
|
|
7736
|
-
|
|
9073
|
+
var onLabelsFilterChange = React.useCallback(function (labels) {
|
|
9074
|
+
dispatch(workspaceListActions.setWorkspaceLabelFilters({
|
|
9075
|
+
labels: labels
|
|
9076
|
+
}));
|
|
9077
|
+
}, [dispatch]);
|
|
9078
|
+
var showLabelFilterToggle = Boolean(onToggleLabelFilter);
|
|
7737
9079
|
var fetchWorkspaceList = React.useCallback(function () {
|
|
7738
9080
|
var filterParams = constructFilterParams([], workspaceSearchQuery);
|
|
7739
9081
|
dispatch(workspaceListActions.fetchWorkspaceList(filterParams));
|
|
@@ -7806,90 +9148,82 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect() {
|
|
|
7806
9148
|
});
|
|
7807
9149
|
return result;
|
|
7808
9150
|
}, [currentView]);
|
|
7809
|
-
var onClickWorkspacePresetOption = function
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
return
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7818
|
-
|
|
7819
|
-
|
|
7820
|
-
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
|
|
7824
|
-
|
|
7825
|
-
|
|
7826
|
-
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
viewType: currentView.viewType,
|
|
7830
|
-
syncGroups: (_currentView$syncGrou = currentView.syncGroups) != null ? _currentView$syncGrou : []
|
|
7831
|
-
}
|
|
7832
|
-
});
|
|
7833
|
-
break;
|
|
7834
|
-
}
|
|
7835
|
-
case WorkspacePresetAction.EDIT:
|
|
7836
|
-
{
|
|
7837
|
-
var views = currentViewsToBE();
|
|
7838
|
-
setWorkspaceActionDialogOptions({
|
|
7839
|
-
action: workspaceAction,
|
|
7840
|
-
presetId: presetId,
|
|
7841
|
-
formValues: {
|
|
7842
|
-
title: presetTitle,
|
|
7843
|
-
"abstract": affectedPreset["abstract"],
|
|
7844
|
-
labels: affectedPreset.labels,
|
|
7845
|
-
mosaicNode: currentView.mosaicNode,
|
|
7846
|
-
scope: scope,
|
|
7847
|
-
views: views
|
|
7848
|
-
}
|
|
7849
|
-
});
|
|
7850
|
-
break;
|
|
7851
|
-
}
|
|
7852
|
-
// case WorkspacePresetAction.SAVE: {
|
|
7853
|
-
// break;
|
|
7854
|
-
// }
|
|
7855
|
-
case WorkspacePresetAction.DELETE:
|
|
7856
|
-
{
|
|
7857
|
-
setWorkspaceActionDialogOptions({
|
|
7858
|
-
action: workspaceAction,
|
|
7859
|
-
presetId: presetId,
|
|
7860
|
-
formValues: {
|
|
7861
|
-
title: presetTitle,
|
|
7862
|
-
scope: scope
|
|
7863
|
-
}
|
|
7864
|
-
});
|
|
7865
|
-
break;
|
|
7866
|
-
}
|
|
7867
|
-
case WorkspacePresetAction.DELETE_SYSTEM_PRESET:
|
|
7868
|
-
{
|
|
7869
|
-
setWorkspaceActionDialogOptions({
|
|
7870
|
-
action: workspaceAction,
|
|
7871
|
-
presetId: presetId,
|
|
7872
|
-
formValues: {
|
|
7873
|
-
title: presetTitle,
|
|
7874
|
-
scope: scope
|
|
7875
|
-
}
|
|
7876
|
-
});
|
|
7877
|
-
break;
|
|
7878
|
-
}
|
|
7879
|
-
case WorkspacePresetAction.SHARE:
|
|
7880
|
-
{
|
|
7881
|
-
void getWorkspace(presetId, auth).then(function (preset) {
|
|
7882
|
-
return updateWorkspace(presetId, Object.assign({}, preset, {
|
|
7883
|
-
is_shared: !preset.is_shared
|
|
7884
|
-
}), auth).then(function () {
|
|
7885
|
-
dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
7886
|
-
workspaceId: presetId,
|
|
7887
|
-
action: WorkspacePresetAction.SHARE,
|
|
9151
|
+
var onClickWorkspacePresetOption = /*#__PURE__*/function () {
|
|
9152
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(presetId, workspaceAction) {
|
|
9153
|
+
var affectedPreset, presetTitle, _currentView$syncGrou, currentViews, adminMetadata, buildFormValues, url;
|
|
9154
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9155
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9156
|
+
case 0:
|
|
9157
|
+
// If affectedPreset is the FE defined `New workspace` - use the definition from FE instead of BE
|
|
9158
|
+
affectedPreset = presetId === getEmptyMapWorkspace(t).id ? getEmptyMapWorkspace(t) : workspacePresets.find(function (preset) {
|
|
9159
|
+
return preset.id === presetId;
|
|
9160
|
+
});
|
|
9161
|
+
presetTitle = affectedPreset == null ? void 0 : affectedPreset.title;
|
|
9162
|
+
_context.t0 = workspaceAction;
|
|
9163
|
+
_context.next = _context.t0 === WorkspacePresetAction.DUPLICATE ? 5 : _context.t0 === WorkspacePresetAction.EDIT ? 8 : _context.t0 === WorkspacePresetAction.DELETE ? 16 : _context.t0 === WorkspacePresetAction.DELETE_SYSTEM_PRESET ? 18 : _context.t0 === WorkspacePresetAction.SHARE ? 20 : _context.t0 === WorkspacePresetAction.OPEN_TAB ? 22 : 25;
|
|
9164
|
+
break;
|
|
9165
|
+
case 5:
|
|
9166
|
+
currentViews = currentViewsToBE();
|
|
9167
|
+
setWorkspaceActionDialogOptions({
|
|
9168
|
+
action: workspaceAction,
|
|
9169
|
+
presetId: presetId,
|
|
9170
|
+
formValues: {
|
|
7888
9171
|
title: presetTitle,
|
|
9172
|
+
"abstract": affectedPreset["abstract"],
|
|
9173
|
+
description: affectedPreset.description,
|
|
7889
9174
|
scope: scope,
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
9175
|
+
views: currentViews.length ? currentViews : [],
|
|
9176
|
+
mosaicNode: currentView.mosaicNode,
|
|
9177
|
+
viewType: currentView.viewType,
|
|
9178
|
+
syncGroups: (_currentView$syncGrou = currentView.syncGroups) != null ? _currentView$syncGrou : []
|
|
9179
|
+
}
|
|
9180
|
+
});
|
|
9181
|
+
return _context.abrupt("break", 26);
|
|
9182
|
+
case 8:
|
|
9183
|
+
adminMetadata = isAdmin && auth != null && auth.username ? {
|
|
9184
|
+
updated: new Date().toISOString(),
|
|
9185
|
+
updatedBy: auth.username
|
|
9186
|
+
} : {};
|
|
9187
|
+
buildFormValues = function buildFormValues(presetDetails, presetViews) {
|
|
9188
|
+
var _ref3, _presetDetails$title, _presetDetails$abstra, _presetDetails$descri, _presetDetails$labels, _ref4, _presetDetails$mosaic, _presetDetails$scope;
|
|
9189
|
+
if (presetViews === void 0) {
|
|
9190
|
+
presetViews = [];
|
|
9191
|
+
}
|
|
9192
|
+
return Object.assign({
|
|
9193
|
+
title: (_ref3 = (_presetDetails$title = presetDetails == null ? void 0 : presetDetails.title) != null ? _presetDetails$title : presetTitle) != null ? _ref3 : '',
|
|
9194
|
+
"abstract": (_presetDetails$abstra = presetDetails == null ? void 0 : presetDetails["abstract"]) != null ? _presetDetails$abstra : affectedPreset == null ? void 0 : affectedPreset["abstract"],
|
|
9195
|
+
description: (_presetDetails$descri = presetDetails == null ? void 0 : presetDetails.description) != null ? _presetDetails$descri : affectedPreset == null ? void 0 : affectedPreset.description,
|
|
9196
|
+
labels: (_presetDetails$labels = presetDetails == null ? void 0 : presetDetails.labels) != null ? _presetDetails$labels : affectedPreset == null ? void 0 : affectedPreset.labels,
|
|
9197
|
+
mosaicNode: (_ref4 = (_presetDetails$mosaic = presetDetails == null ? void 0 : presetDetails.mosaicNode) != null ? _presetDetails$mosaic : currentView == null ? void 0 : currentView.mosaicNode) != null ? _ref4 : undefined,
|
|
9198
|
+
scope: (_presetDetails$scope = presetDetails == null ? void 0 : presetDetails.scope) != null ? _presetDetails$scope : scope,
|
|
9199
|
+
views: presetViews,
|
|
9200
|
+
updated: new Date().toISOString()
|
|
9201
|
+
}, adminMetadata);
|
|
9202
|
+
}; // If editing the active workspace, keep using the current workspace data
|
|
9203
|
+
if (!(presetId === (currentView == null ? void 0 : currentView.id) || !auth)) {
|
|
9204
|
+
_context.next = 13;
|
|
9205
|
+
break;
|
|
9206
|
+
}
|
|
9207
|
+
setWorkspaceActionDialogOptions({
|
|
9208
|
+
action: workspaceAction,
|
|
9209
|
+
presetId: presetId,
|
|
9210
|
+
formValues: buildFormValues(currentView, currentViewsToBE())
|
|
9211
|
+
});
|
|
9212
|
+
return _context.abrupt("break", 26);
|
|
9213
|
+
case 13:
|
|
9214
|
+
// Open dialog immediately with basic data, then hydrate with full preset once fetched
|
|
9215
|
+
setWorkspaceActionDialogOptions({
|
|
9216
|
+
action: workspaceAction,
|
|
9217
|
+
presetId: presetId,
|
|
9218
|
+
formValues: buildFormValues()
|
|
9219
|
+
});
|
|
9220
|
+
void getWorkspace(presetId, auth).then(function (presetFromBE) {
|
|
9221
|
+
var _presetFromBE$views;
|
|
9222
|
+
setWorkspaceActionDialogOptions({
|
|
9223
|
+
action: workspaceAction,
|
|
9224
|
+
presetId: presetId,
|
|
9225
|
+
formValues: buildFormValues(presetFromBE, (_presetFromBE$views = presetFromBE.views) != null ? _presetFromBE$views : [])
|
|
9226
|
+
});
|
|
7893
9227
|
})["catch"](function (error) {
|
|
7894
9228
|
dispatch(workspaceListActions.onErrorWorkspacePresetAction({
|
|
7895
9229
|
error: {
|
|
@@ -7899,23 +9233,89 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect() {
|
|
|
7899
9233
|
}
|
|
7900
9234
|
}));
|
|
7901
9235
|
});
|
|
7902
|
-
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
|
|
7909
|
-
|
|
9236
|
+
return _context.abrupt("break", 26);
|
|
9237
|
+
case 16:
|
|
9238
|
+
setWorkspaceActionDialogOptions({
|
|
9239
|
+
action: workspaceAction,
|
|
9240
|
+
presetId: presetId,
|
|
9241
|
+
formValues: {
|
|
9242
|
+
title: presetTitle,
|
|
9243
|
+
scope: scope
|
|
9244
|
+
}
|
|
9245
|
+
});
|
|
9246
|
+
return _context.abrupt("break", 26);
|
|
9247
|
+
case 18:
|
|
9248
|
+
setWorkspaceActionDialogOptions({
|
|
9249
|
+
action: workspaceAction,
|
|
9250
|
+
presetId: presetId,
|
|
9251
|
+
formValues: {
|
|
9252
|
+
title: presetTitle,
|
|
9253
|
+
scope: scope
|
|
9254
|
+
}
|
|
9255
|
+
});
|
|
9256
|
+
return _context.abrupt("break", 26);
|
|
9257
|
+
case 20:
|
|
9258
|
+
void getWorkspace(presetId, auth).then(function (preset) {
|
|
9259
|
+
return updateWorkspace(presetId, Object.assign({}, preset, {
|
|
9260
|
+
is_shared: !preset.is_shared
|
|
9261
|
+
}), auth).then(function () {
|
|
9262
|
+
dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
9263
|
+
workspaceId: presetId,
|
|
9264
|
+
action: WorkspacePresetAction.SHARE,
|
|
9265
|
+
title: presetTitle,
|
|
9266
|
+
scope: scope,
|
|
9267
|
+
is_shared: preset.is_shared
|
|
9268
|
+
}));
|
|
9269
|
+
fetchWorkspaceList();
|
|
9270
|
+
})["catch"](function (error) {
|
|
9271
|
+
dispatch(workspaceListActions.onErrorWorkspacePresetAction({
|
|
9272
|
+
error: {
|
|
9273
|
+
message: "" + error,
|
|
9274
|
+
type: WorkspaceListErrorType.VERBATIM_ERROR,
|
|
9275
|
+
category: WorkspaceListErrorCategory.GENERIC
|
|
9276
|
+
}
|
|
9277
|
+
}));
|
|
9278
|
+
});
|
|
9279
|
+
});
|
|
9280
|
+
return _context.abrupt("break", 26);
|
|
9281
|
+
case 22:
|
|
9282
|
+
url = getWorkspaceRouteUrl(presetId);
|
|
9283
|
+
window.open(url, '_blank');
|
|
9284
|
+
return _context.abrupt("break", 26);
|
|
9285
|
+
case 25:
|
|
9286
|
+
return _context.abrupt("break", 26);
|
|
9287
|
+
case 26:
|
|
9288
|
+
case "end":
|
|
9289
|
+
return _context.stop();
|
|
7910
9290
|
}
|
|
7911
|
-
|
|
7912
|
-
|
|
9291
|
+
}, _callee);
|
|
9292
|
+
}));
|
|
9293
|
+
return function onClickWorkspacePresetOption(_x, _x2) {
|
|
9294
|
+
return _ref2.apply(this, arguments);
|
|
9295
|
+
};
|
|
9296
|
+
}();
|
|
7913
9297
|
var isAllSelected = workspaceListFilters.length > 0 && workspaceListFilters.every(function (filter) {
|
|
7914
9298
|
return filter.isSelected;
|
|
7915
9299
|
});
|
|
7916
|
-
var shouldHideNewWorkspace = !isAllSelected || workspaceSearchQuery.length > 0;
|
|
9300
|
+
var shouldHideNewWorkspace = !isAllSelected || workspaceSearchQuery.length > 0 || hasActiveLabelFilters;
|
|
9301
|
+
var closeInfo = React.useCallback(function () {
|
|
9302
|
+
setInfoPreset(undefined);
|
|
9303
|
+
}, []);
|
|
9304
|
+
var onOpenPresetInfo = React.useCallback(function (preset) {
|
|
9305
|
+
setInfoPreset(function (current) {
|
|
9306
|
+
return (current == null ? void 0 : current.id) === preset.id ? undefined : preset;
|
|
9307
|
+
});
|
|
9308
|
+
}, []);
|
|
9309
|
+
React.useEffect(function () {
|
|
9310
|
+
if (infoPreset && !filteredPresets.some(function (preset) {
|
|
9311
|
+
return preset.id === infoPreset.id;
|
|
9312
|
+
})) {
|
|
9313
|
+
closeInfo();
|
|
9314
|
+
}
|
|
9315
|
+
}, [infoPreset, filteredPresets, closeInfo]);
|
|
7917
9316
|
return jsxs(Box, {
|
|
7918
9317
|
"data-testid": "workspace-selectlist-connect",
|
|
9318
|
+
bgcolor: "geowebColors.background.surface",
|
|
7919
9319
|
style: {
|
|
7920
9320
|
display: 'flex',
|
|
7921
9321
|
flexDirection: 'column',
|
|
@@ -7950,57 +9350,100 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect() {
|
|
|
7950
9350
|
}
|
|
7951
9351
|
}
|
|
7952
9352
|
}))
|
|
9353
|
+
}), !error && jsx(Box, {
|
|
9354
|
+
sx: {
|
|
9355
|
+
padding: 1,
|
|
9356
|
+
pt: 1
|
|
9357
|
+
},
|
|
9358
|
+
children: jsx(SearchField, {
|
|
9359
|
+
searchFilter: workspaceSearchQuery,
|
|
9360
|
+
setSearchFilter: searchFilter
|
|
9361
|
+
})
|
|
7953
9362
|
}), jsxs(Box, {
|
|
7954
9363
|
sx: {
|
|
7955
|
-
display: '
|
|
7956
|
-
|
|
9364
|
+
display: 'grid',
|
|
9365
|
+
gridTemplateColumns: isLabelFilterOpen ? '280px 1fr' : '1fr',
|
|
7957
9366
|
height: '100%',
|
|
7958
|
-
padding: 1,
|
|
7959
9367
|
overflow: 'hidden'
|
|
7960
9368
|
},
|
|
7961
|
-
children: [
|
|
9369
|
+
children: [isLabelFilterOpen && jsx(Box, {
|
|
7962
9370
|
sx: {
|
|
7963
|
-
|
|
9371
|
+
borderRight: '1px solid',
|
|
9372
|
+
borderColor: 'divider',
|
|
9373
|
+
bgcolor: 'geowebColors.background.surface',
|
|
9374
|
+
overflowY: 'auto',
|
|
9375
|
+
overflowX: 'hidden'
|
|
7964
9376
|
},
|
|
7965
|
-
children:
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
},
|
|
7970
|
-
children: jsx(Filter, {
|
|
7971
|
-
filters: workspaceListFilters,
|
|
7972
|
-
onClickFilterChip: onClickFilterChip,
|
|
7973
|
-
isAllSelected: isAllSelected,
|
|
7974
|
-
searchQuery: workspaceSearchQuery,
|
|
7975
|
-
onSearch: searchFilter
|
|
9377
|
+
children: jsx(FormProvider, Object.assign({}, labelsFormMethods, {
|
|
9378
|
+
children: jsx(WorkspaceMenuLabelsPanel, {
|
|
9379
|
+
onChange: onLabelsFilterChange,
|
|
9380
|
+
menuLabels: labelFilters
|
|
7976
9381
|
})
|
|
7977
|
-
})
|
|
9382
|
+
}))
|
|
9383
|
+
}), jsxs(Box, {
|
|
9384
|
+
sx: {
|
|
9385
|
+
display: 'flex',
|
|
9386
|
+
flexDirection: 'column',
|
|
9387
|
+
height: '100%',
|
|
9388
|
+
padding: 1,
|
|
9389
|
+
overflow: 'hidden'
|
|
9390
|
+
},
|
|
9391
|
+
ref: infoPanelAnchorRef,
|
|
9392
|
+
children: [!error && jsxs(Box, {
|
|
7978
9393
|
sx: {
|
|
7979
|
-
|
|
7980
|
-
justifyContent: 'flex-start'
|
|
9394
|
+
marginBottom: 1
|
|
7981
9395
|
},
|
|
7982
|
-
children: jsx(
|
|
7983
|
-
|
|
7984
|
-
|
|
9396
|
+
children: [jsx(Box, {
|
|
9397
|
+
sx: {
|
|
9398
|
+
display: 'flex',
|
|
9399
|
+
width: '100%'
|
|
7985
9400
|
},
|
|
7986
|
-
|
|
7987
|
-
|
|
9401
|
+
children: jsx(Filter, {
|
|
9402
|
+
filters: workspaceListFilters,
|
|
9403
|
+
onClickFilterChip: onClickFilterChip,
|
|
9404
|
+
isAllSelected: isAllSelected,
|
|
9405
|
+
searchQuery: workspaceSearchQuery,
|
|
9406
|
+
onSearch: searchFilter,
|
|
9407
|
+
showLabelFilterToggle: showLabelFilterToggle,
|
|
9408
|
+
isLabelFilterOpen: isLabelFilterOpen,
|
|
9409
|
+
onToggleLabelFilter: onToggleLabelFilter,
|
|
9410
|
+
showSearchField: false
|
|
9411
|
+
})
|
|
9412
|
+
}), jsx(Box, {
|
|
9413
|
+
sx: {
|
|
9414
|
+
display: 'flex',
|
|
9415
|
+
justifyContent: 'flex-start'
|
|
9416
|
+
},
|
|
9417
|
+
children: jsx(LastUpdateTime, {
|
|
9418
|
+
onPressRefresh: function onPressRefresh() {
|
|
9419
|
+
return fetchWorkspaceList();
|
|
9420
|
+
},
|
|
9421
|
+
hideLabel: true
|
|
9422
|
+
})
|
|
9423
|
+
})]
|
|
9424
|
+
}), jsxs(Box, {
|
|
9425
|
+
sx: {
|
|
9426
|
+
flexGrow: 1,
|
|
9427
|
+
minHeight: 0
|
|
9428
|
+
},
|
|
9429
|
+
children: [jsx(WorkspaceSelectList, {
|
|
9430
|
+
workspacePresets: filteredPresets,
|
|
9431
|
+
currentSelectedId: currentView.id || '',
|
|
9432
|
+
onClickWorkspacePreset: onClickWorkspacePreset,
|
|
9433
|
+
onClickWorkspacePresetOption: onClickWorkspacePresetOption,
|
|
9434
|
+
hideNewWorkspace: shouldHideNewWorkspace,
|
|
9435
|
+
isEditable: isLoggedIn,
|
|
9436
|
+
isAdmin: isAdmin,
|
|
9437
|
+
searchQuery: workspaceSearchQuery,
|
|
9438
|
+
onOpenPresetInfo: onOpenPresetInfo,
|
|
9439
|
+
infoOpenPresetId: infoPreset == null ? void 0 : infoPreset.id
|
|
9440
|
+
}), jsx(WorkspacePresetInfo, {
|
|
9441
|
+
isOpen: Boolean(infoPreset),
|
|
9442
|
+
preset: infoPreset,
|
|
9443
|
+
anchorEl: infoPanelAnchorRef.current,
|
|
9444
|
+
onClose: closeInfo
|
|
9445
|
+
})]
|
|
7988
9446
|
})]
|
|
7989
|
-
}), jsx(Box, {
|
|
7990
|
-
sx: {
|
|
7991
|
-
flexGrow: 1,
|
|
7992
|
-
minHeight: 0
|
|
7993
|
-
},
|
|
7994
|
-
children: jsx(WorkspaceSelectList, {
|
|
7995
|
-
workspacePresets: filteredPresets,
|
|
7996
|
-
currentSelectedId: currentView.id || '',
|
|
7997
|
-
onClickWorkspacePreset: onClickWorkspacePreset,
|
|
7998
|
-
onClickWorkspacePresetOption: onClickWorkspacePresetOption,
|
|
7999
|
-
hideNewWorkspace: shouldHideNewWorkspace,
|
|
8000
|
-
isEditable: isLoggedIn,
|
|
8001
|
-
isAdmin: isAdmin,
|
|
8002
|
-
searchQuery: workspaceSearchQuery
|
|
8003
|
-
})
|
|
8004
9447
|
})]
|
|
8005
9448
|
})]
|
|
8006
9449
|
});
|
|
@@ -8009,9 +9452,20 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect() {
|
|
|
8009
9452
|
var WorkspaceMenu = function WorkspaceMenu(_ref) {
|
|
8010
9453
|
var _ref$isOpen = _ref.isOpen,
|
|
8011
9454
|
isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
|
|
8012
|
-
closeMenu = _ref.closeMenu
|
|
9455
|
+
closeMenu = _ref.closeMenu,
|
|
9456
|
+
_ref$initialIsLabelFi = _ref.initialIsLabelFilterOpen,
|
|
9457
|
+
initialIsLabelFilterOpen = _ref$initialIsLabelFi === void 0 ? false : _ref$initialIsLabelFi;
|
|
8013
9458
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
8014
9459
|
t = _useWorkspaceTranslat.t;
|
|
9460
|
+
var _React$useState = React__default.useState(initialIsLabelFilterOpen),
|
|
9461
|
+
isLabelFilterOpen = _React$useState[0],
|
|
9462
|
+
setIsLabelFilterOpen = _React$useState[1];
|
|
9463
|
+
var handleToggleLabelFilter = React__default.useCallback(function () {
|
|
9464
|
+
setIsLabelFilterOpen(function (prev) {
|
|
9465
|
+
return !prev;
|
|
9466
|
+
});
|
|
9467
|
+
}, []);
|
|
9468
|
+
var dialogWidth = isLabelFilterOpen ? 700 : 380;
|
|
8015
9469
|
return jsx(CustomDialog, {
|
|
8016
9470
|
open: isOpen,
|
|
8017
9471
|
onClose: function onClose() {
|
|
@@ -8022,9 +9476,10 @@ var WorkspaceMenu = function WorkspaceMenu(_ref) {
|
|
|
8022
9476
|
isResizable: true,
|
|
8023
9477
|
hasLayout: false,
|
|
8024
9478
|
resizableDefaultSize: {
|
|
8025
|
-
width:
|
|
9479
|
+
width: dialogWidth,
|
|
8026
9480
|
height: '90%'
|
|
8027
9481
|
},
|
|
9482
|
+
minWidth: isLabelFilterOpen ? 700 : undefined,
|
|
8028
9483
|
slotProps: {
|
|
8029
9484
|
backdrop: {
|
|
8030
9485
|
style: Object.assign({
|
|
@@ -8048,9 +9503,12 @@ var WorkspaceMenu = function WorkspaceMenu(_ref) {
|
|
|
8048
9503
|
onClick: function onClick(event) {
|
|
8049
9504
|
event.stopPropagation();
|
|
8050
9505
|
},
|
|
8051
|
-
children: jsx(WorkspaceSelectListConnect, {
|
|
9506
|
+
children: jsx(WorkspaceSelectListConnect, {
|
|
9507
|
+
isLabelFilterOpen: isLabelFilterOpen,
|
|
9508
|
+
onToggleLabelFilter: handleToggleLabelFilter
|
|
9509
|
+
})
|
|
8052
9510
|
})
|
|
8053
|
-
});
|
|
9511
|
+
}, isLabelFilterOpen ? 'wide' : 'narrow');
|
|
8054
9512
|
};
|
|
8055
9513
|
|
|
8056
9514
|
var workspacePresetOptionId = 'workspaceMenuButton';
|
|
@@ -8373,6 +9831,8 @@ var WorkspaceViewTitleConnectNoMemo = function WorkspaceViewTitleConnectNoMemo(_
|
|
|
8373
9831
|
}
|
|
8374
9832
|
}, [hasViewPresetChanges, dispatch]);
|
|
8375
9833
|
var presetAbstract = workspaceView == null ? void 0 : workspaceView["abstract"];
|
|
9834
|
+
var presetDescription = workspaceView == null ? void 0 : workspaceView.description;
|
|
9835
|
+
var presetLabels = workspaceView == null ? void 0 : workspaceView.labels;
|
|
8376
9836
|
var title = workspaceView.title || t('workspace-mappreset-new');
|
|
8377
9837
|
var isNewActive = activeViewPresetId === '';
|
|
8378
9838
|
var showChangedInViewTitle = !!hasViewPresetChanges;
|
|
@@ -8432,11 +9892,13 @@ var WorkspaceViewTitleConnectNoMemo = function WorkspaceViewTitleConnectNoMemo(_
|
|
|
8432
9892
|
panelId: panelId,
|
|
8433
9893
|
formValues: {
|
|
8434
9894
|
title: formTitle,
|
|
9895
|
+
description: presetDescription,
|
|
8435
9896
|
initialProps: constructInitialProps(),
|
|
8436
|
-
"abstract": presetAbstract
|
|
9897
|
+
"abstract": presetAbstract,
|
|
9898
|
+
labels: presetLabels
|
|
8437
9899
|
}
|
|
8438
9900
|
});
|
|
8439
|
-
}, [activeViewPresetId, constructInitialProps, openViewPresetsDialog, panelId, t, title, presetAbstract]);
|
|
9901
|
+
}, [activeViewPresetId, constructInitialProps, openViewPresetsDialog, panelId, t, title, presetDescription, presetAbstract, presetLabels]);
|
|
8440
9902
|
var handleEditTitle = React.useCallback(function () {
|
|
8441
9903
|
var _ws$title, _view$mosaicNodeId, _ref3, _view$title;
|
|
8442
9904
|
var ws = currentWorkspace;
|
|
@@ -8468,11 +9930,13 @@ var WorkspaceViewTitleConnectNoMemo = function WorkspaceViewTitleConnectNoMemo(_
|
|
|
8468
9930
|
viewPresetId: activeViewPresetId,
|
|
8469
9931
|
formValues: {
|
|
8470
9932
|
title: formTitle,
|
|
9933
|
+
description: presetDescription,
|
|
8471
9934
|
initialProps: constructInitialProps(),
|
|
8472
|
-
"abstract": presetAbstract
|
|
9935
|
+
"abstract": presetAbstract,
|
|
9936
|
+
labels: presetLabels
|
|
8473
9937
|
}
|
|
8474
9938
|
});
|
|
8475
|
-
}, [activeViewPresetId, title, openViewPresetsDialog, panelId, constructInitialProps, presetAbstract, t]);
|
|
9939
|
+
}, [activeViewPresetId, title, openViewPresetsDialog, panelId, constructInitialProps, presetAbstract, presetDescription, presetLabels, t]);
|
|
8476
9940
|
var onReset = React.useCallback(function () {
|
|
8477
9941
|
if (isPlainWorkspaceView) {
|
|
8478
9942
|
var _ws$title2, _view$mosaicNodeId2, _ref4, _view$title2;
|
|
@@ -8570,23 +10034,15 @@ var WorkspaceViewTitleConnectNoMemo = function WorkspaceViewTitleConnectNoMemo(_
|
|
|
8570
10034
|
exit: false
|
|
8571
10035
|
}
|
|
8572
10036
|
},
|
|
8573
|
-
children:
|
|
10037
|
+
children: jsx(CustomToggleButton, {
|
|
8574
10038
|
variant: "tool",
|
|
8575
10039
|
"data-testid": "open-viewpresets",
|
|
8576
10040
|
selected: isViewPresetDialogOpen,
|
|
8577
10041
|
onClick: onClickOpenViewPreset,
|
|
8578
10042
|
disableRipple: true,
|
|
8579
10043
|
sx: {
|
|
8580
|
-
flexShrink: 1,
|
|
8581
10044
|
minWidth: 0,
|
|
8582
10045
|
maxWidth: 220,
|
|
8583
|
-
justifyContent: 'flex-start',
|
|
8584
|
-
alignItems: 'center',
|
|
8585
|
-
textAlign: 'left',
|
|
8586
|
-
fontSize: '12px',
|
|
8587
|
-
fontWeight: 500,
|
|
8588
|
-
fontStyle: hasViewPresetChanges ? 'italic' : undefined,
|
|
8589
|
-
height: 20,
|
|
8590
10046
|
overflow: 'hidden',
|
|
8591
10047
|
'&&': {
|
|
8592
10048
|
textTransform: 'none',
|
|
@@ -8596,30 +10052,27 @@ var WorkspaceViewTitleConnectNoMemo = function WorkspaceViewTitleConnectNoMemo(_
|
|
|
8596
10052
|
}
|
|
8597
10053
|
}
|
|
8598
10054
|
},
|
|
8599
|
-
children:
|
|
8600
|
-
component: "span",
|
|
10055
|
+
children: jsxs(Typography, {
|
|
8601
10056
|
sx: {
|
|
8602
|
-
|
|
8603
|
-
|
|
8604
|
-
|
|
10057
|
+
fontSize: '12px',
|
|
10058
|
+
fontStyle: hasViewPresetChanges ? 'italic' : undefined,
|
|
10059
|
+
fontWeight: 500,
|
|
8605
10060
|
overflow: 'hidden',
|
|
8606
10061
|
textOverflow: 'ellipsis',
|
|
8607
10062
|
whiteSpace: 'nowrap',
|
|
8608
|
-
|
|
8609
|
-
},
|
|
8610
|
-
children: fullTitle
|
|
8611
|
-
}), panelId && jsx(Box, {
|
|
8612
|
-
component: "span",
|
|
8613
|
-
sx: {
|
|
8614
|
-
flexShrink: 0,
|
|
8615
|
-
ml: 1,
|
|
8616
|
-
fontStyle: 'normal',
|
|
8617
|
-
fontWeight: 400,
|
|
8618
|
-
whiteSpace: 'nowrap',
|
|
8619
|
-
color: isViewPresetDialogOpen ? 'geowebColors.text.inverse' : 'geowebColors.captions.captionStatus.rgba'
|
|
10063
|
+
width: '100%'
|
|
8620
10064
|
},
|
|
8621
|
-
children:
|
|
8622
|
-
|
|
10065
|
+
children: [fullTitle, jsx(Box, {
|
|
10066
|
+
component: "span",
|
|
10067
|
+
sx: {
|
|
10068
|
+
fontStyle: 'normal',
|
|
10069
|
+
fontWeight: 400,
|
|
10070
|
+
ml: 1,
|
|
10071
|
+
color: isViewPresetDialogOpen ? 'geowebColors.text.inverse' : 'geowebColors.captions.captionStatus.rgba'
|
|
10072
|
+
},
|
|
10073
|
+
children: panelId
|
|
10074
|
+
})]
|
|
10075
|
+
})
|
|
8623
10076
|
})
|
|
8624
10077
|
}), jsx(WorkspaceOptions, {
|
|
8625
10078
|
handleSave: isEnabled ? onSave : undefined,
|
|
@@ -8868,14 +10321,79 @@ var LinkMenuConnect = function LinkMenuConnect(_ref) {
|
|
|
8868
10321
|
});
|
|
8869
10322
|
};
|
|
8870
10323
|
|
|
10324
|
+
var buttonStyle$1 = {
|
|
10325
|
+
marginLeft: 0.5,
|
|
10326
|
+
marginRight: 0.5
|
|
10327
|
+
};
|
|
10328
|
+
var SplitButtonsConnect = function SplitButtonsConnect(_ref) {
|
|
10329
|
+
var panelId = _ref.panelId,
|
|
10330
|
+
path = _ref.path;
|
|
10331
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
10332
|
+
t = _useWorkspaceTranslat.t;
|
|
10333
|
+
var _React$useContext = React__default.useContext(MosaicContext),
|
|
10334
|
+
actions = _React$useContext.mosaicActions;
|
|
10335
|
+
var dispatch = useDispatch();
|
|
10336
|
+
var viewIds = useSelector(function (store) {
|
|
10337
|
+
return getViewIds(store);
|
|
10338
|
+
});
|
|
10339
|
+
var viewComponentType = useSelector(function (store) {
|
|
10340
|
+
return getViewComponentType(store, panelId);
|
|
10341
|
+
});
|
|
10342
|
+
var addView = React__default.useCallback(function (view) {
|
|
10343
|
+
dispatch(workspaceActions.setNewWorkspaceView(view));
|
|
10344
|
+
}, [dispatch]);
|
|
10345
|
+
var createNode = React__default.useCallback(function (shiftPressed) {
|
|
10346
|
+
var newId = getUniqueId(viewIds);
|
|
10347
|
+
addView({
|
|
10348
|
+
// If shift not pressed - open new map
|
|
10349
|
+
componentType: shiftPressed ? viewComponentType : 'Map',
|
|
10350
|
+
mosaicNodeId: panelId,
|
|
10351
|
+
newId: newId,
|
|
10352
|
+
copyOriginalcontent: shiftPressed
|
|
10353
|
+
});
|
|
10354
|
+
return newId;
|
|
10355
|
+
}, [addView, panelId, viewComponentType, viewIds]);
|
|
10356
|
+
return jsxs(Fragment, {
|
|
10357
|
+
children: [jsx(CustomIconButton, {
|
|
10358
|
+
"data-testid": "split-horizontal-btn",
|
|
10359
|
+
sx: buttonStyle$1,
|
|
10360
|
+
onClick: function onClick(event) {
|
|
10361
|
+
var newNode = createNode(event.shiftKey);
|
|
10362
|
+
var previousNode = getAndAssertNodeAtPathExists(actions.getRoot(), path);
|
|
10363
|
+
actions.replaceWith(path, {
|
|
10364
|
+
direction: 'column',
|
|
10365
|
+
first: previousNode,
|
|
10366
|
+
second: newNode
|
|
10367
|
+
});
|
|
10368
|
+
},
|
|
10369
|
+
tooltipTitle: t('workspace-control-split-horizontal') + " - " + t('workspace-control-split-shift'),
|
|
10370
|
+
children: jsx(SplitVertical, {})
|
|
10371
|
+
}), jsx(CustomIconButton, {
|
|
10372
|
+
"data-testid": "split-vertical-btn",
|
|
10373
|
+
sx: buttonStyle$1,
|
|
10374
|
+
onClick: function onClick(event) {
|
|
10375
|
+
var newNode = createNode(event.shiftKey);
|
|
10376
|
+
var previousNode = getAndAssertNodeAtPathExists(actions.getRoot(), path);
|
|
10377
|
+
actions.replaceWith(path, {
|
|
10378
|
+
direction: 'row',
|
|
10379
|
+
first: previousNode,
|
|
10380
|
+
second: newNode
|
|
10381
|
+
});
|
|
10382
|
+
},
|
|
10383
|
+
tooltipTitle: t('workspace-control-split-vertical') + " - " + t('workspace-control-split-shift'),
|
|
10384
|
+
children: jsx(SplitHorizontal, {})
|
|
10385
|
+
})]
|
|
10386
|
+
});
|
|
10387
|
+
};
|
|
10388
|
+
|
|
8871
10389
|
var buttonStyle = {
|
|
8872
10390
|
marginLeft: 0.5,
|
|
8873
10391
|
marginRight: 0.5
|
|
8874
10392
|
};
|
|
8875
10393
|
var WorkspaceControls = function WorkspaceControls(_ref) {
|
|
8876
|
-
var panelId = _ref.panelId
|
|
8877
|
-
|
|
8878
|
-
path = _ref.path,
|
|
10394
|
+
var panelId = _ref.panelId;
|
|
10395
|
+
_ref.createNode;
|
|
10396
|
+
var path = _ref.path,
|
|
8879
10397
|
_ref$shouldPreventClo = _ref.shouldPreventCloseView,
|
|
8880
10398
|
shouldPreventCloseView = _ref$shouldPreventClo === void 0 ? false : _ref$shouldPreventClo,
|
|
8881
10399
|
removeLinkedMap = _ref.removeLinkedMap;
|
|
@@ -8944,34 +10462,9 @@ var WorkspaceControls = function WorkspaceControls(_ref) {
|
|
|
8944
10462
|
return jsxs(Fragment, {
|
|
8945
10463
|
children: [jsx(LinkMenuConnect, {
|
|
8946
10464
|
panelId: panelId
|
|
8947
|
-
}), jsx(
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
onClick: function onClick() {
|
|
8951
|
-
var newNode = createNode();
|
|
8952
|
-
var previousNode = getAndAssertNodeAtPathExists(actions.getRoot(), path);
|
|
8953
|
-
actions.replaceWith(path, {
|
|
8954
|
-
direction: 'column',
|
|
8955
|
-
first: previousNode,
|
|
8956
|
-
second: newNode
|
|
8957
|
-
});
|
|
8958
|
-
},
|
|
8959
|
-
tooltipTitle: t('workspace-control-split-horizontal'),
|
|
8960
|
-
children: jsx(SplitVertical, {})
|
|
8961
|
-
}), jsx(CustomIconButton, {
|
|
8962
|
-
"data-testid": "split-vertical-btn",
|
|
8963
|
-
sx: buttonStyle,
|
|
8964
|
-
onClick: function onClick() {
|
|
8965
|
-
var newNode = createNode();
|
|
8966
|
-
var previousNode = getAndAssertNodeAtPathExists(actions.getRoot(), path);
|
|
8967
|
-
actions.replaceWith(path, {
|
|
8968
|
-
direction: 'row',
|
|
8969
|
-
first: previousNode,
|
|
8970
|
-
second: newNode
|
|
8971
|
-
});
|
|
8972
|
-
},
|
|
8973
|
-
tooltipTitle: t('workspace-control-split-vertical'),
|
|
8974
|
-
children: jsx(SplitHorizontal, {})
|
|
10465
|
+
}), jsx(SplitButtonsConnect, {
|
|
10466
|
+
panelId: panelId,
|
|
10467
|
+
path: path
|
|
8975
10468
|
}), !enableUnexpand || isString(mosaicNode) ? jsx(CustomIconButton, {
|
|
8976
10469
|
"data-testid": "expand-btn",
|
|
8977
10470
|
sx: buttonStyle,
|
|
@@ -9060,7 +10553,8 @@ var WorkspaceTileConnect = /*#__PURE__*/React.memo(function (_ref) {
|
|
|
9060
10553
|
addView({
|
|
9061
10554
|
componentType: 'Map',
|
|
9062
10555
|
mosaicNodeId: mosaicNodeId,
|
|
9063
|
-
newId: newId
|
|
10556
|
+
newId: newId,
|
|
10557
|
+
copyOriginalcontent: false
|
|
9064
10558
|
});
|
|
9065
10559
|
return newId;
|
|
9066
10560
|
}, [addView, mosaicNodeId, viewIds]);
|
|
@@ -9383,13 +10877,16 @@ var WorkspaceOptionsConnect = function WorkspaceOptionsConnect(_ref) {
|
|
|
9383
10877
|
scope: viewScope
|
|
9384
10878
|
});
|
|
9385
10879
|
});
|
|
10880
|
+
var adminMetadata = isAdmin && action === WorkspacePresetAction.SAVE_SYSTEM_PRESET_AS ? {
|
|
10881
|
+
username: auth == null ? void 0 : auth.username
|
|
10882
|
+
} : {};
|
|
9386
10883
|
setWorkspaceActionDialogOptions({
|
|
9387
10884
|
action: action,
|
|
9388
10885
|
presetId: workspaceId,
|
|
9389
10886
|
formValues: Object.assign({}, workspaceData, {
|
|
9390
10887
|
scope: scope,
|
|
9391
10888
|
views: views
|
|
9392
|
-
}),
|
|
10889
|
+
}, adminMetadata),
|
|
9393
10890
|
hasSaved: false
|
|
9394
10891
|
});
|
|
9395
10892
|
};
|
|
@@ -9407,10 +10904,16 @@ var WorkspaceOptionsConnect = function WorkspaceOptionsConnect(_ref) {
|
|
|
9407
10904
|
}));
|
|
9408
10905
|
};
|
|
9409
10906
|
var onEdit = function onEdit() {
|
|
10907
|
+
var adminMetadata = isAdmin && auth != null && auth.username ? {
|
|
10908
|
+
updated: new Date().toISOString(),
|
|
10909
|
+
updatedBy: auth.username
|
|
10910
|
+
} : {};
|
|
9410
10911
|
setWorkspaceActionDialogOptions({
|
|
9411
10912
|
action: WorkspacePresetAction.EDIT,
|
|
9412
10913
|
presetId: workspaceId,
|
|
9413
|
-
formValues: Object.assign({}, workspaceData
|
|
10914
|
+
formValues: Object.assign({}, workspaceData, {
|
|
10915
|
+
updated: new Date().toISOString()
|
|
10916
|
+
}, adminMetadata)
|
|
9414
10917
|
});
|
|
9415
10918
|
};
|
|
9416
10919
|
var onSaveSystemPresetAs = function onSaveSystemPresetAs() {
|
|
@@ -9583,100 +11086,8 @@ var WorkspaceTab = function WorkspaceTab(_ref) {
|
|
|
9583
11086
|
appTitle: appTitle
|
|
9584
11087
|
}), jsx(WorkspaceOptionsConnect, {
|
|
9585
11088
|
title: title,
|
|
9586
|
-
workspaceId: workspaceId
|
|
9587
|
-
})]
|
|
9588
|
-
});
|
|
9589
|
-
};
|
|
9590
|
-
|
|
9591
|
-
/* *
|
|
9592
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9593
|
-
* you may not use this file except in compliance with the License.
|
|
9594
|
-
* You may obtain a copy of the License at
|
|
9595
|
-
*
|
|
9596
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9597
|
-
*
|
|
9598
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
9599
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9600
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9601
|
-
* See the License for the specific language governing permissions and
|
|
9602
|
-
* limitations under the License.
|
|
9603
|
-
*
|
|
9604
|
-
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
9605
|
-
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
9606
|
-
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
9607
|
-
* */
|
|
9608
|
-
var useWorkspaceLabelsConfig = function useWorkspaceLabelsConfig() {
|
|
9609
|
-
return useQuery({
|
|
9610
|
-
queryKey: ['workspace-labels-config'],
|
|
9611
|
-
queryFn: getWorkspaceLabelsConfig
|
|
9612
|
-
});
|
|
9613
|
-
};
|
|
9614
|
-
var onWorkspaceApiError = function onWorkspaceApiError(dispatch, error, t) {
|
|
9615
|
-
dispatch(workspaceListActions.onErrorWorkspacePresetAction({
|
|
9616
|
-
error: {
|
|
9617
|
-
message: error.message + " " + t('workspace-error-generic'),
|
|
9618
|
-
type: WorkspaceListErrorType.VERBATIM_ERROR,
|
|
9619
|
-
category: error.message === 'Authentication context not found' ? WorkspaceListErrorCategory.AUTH : WorkspaceListErrorCategory.GENERIC
|
|
9620
|
-
}
|
|
9621
|
-
}));
|
|
9622
|
-
};
|
|
9623
|
-
var useDeleteWorkspacePreset = function useDeleteWorkspacePreset() {
|
|
9624
|
-
var _useAuthenticationCon = useAuthenticationContext(),
|
|
9625
|
-
auth = _useAuthenticationCon.auth;
|
|
9626
|
-
var _useSelector = useSelector(getWorkspaceActionFormValues),
|
|
9627
|
-
title = _useSelector.title;
|
|
9628
|
-
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
9629
|
-
t = _useWorkspaceTranslat.t;
|
|
9630
|
-
var dispatch = useDispatch();
|
|
9631
|
-
return useMutation({
|
|
9632
|
-
mutationFn: function mutationFn(_ref) {
|
|
9633
|
-
var id = _ref.id;
|
|
9634
|
-
if (!auth) {
|
|
9635
|
-
throw new Error('Authentication context not found');
|
|
9636
|
-
}
|
|
9637
|
-
return deleteWorkspace(id, auth);
|
|
9638
|
-
},
|
|
9639
|
-
onSuccess: function onSuccess(data, variables) {
|
|
9640
|
-
dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
9641
|
-
workspaceId: variables.id,
|
|
9642
|
-
action: WorkspacePresetAction.DELETE,
|
|
9643
|
-
emptyWorkspacePresetTitle: t('workspace-new'),
|
|
9644
|
-
title: title
|
|
9645
|
-
}));
|
|
9646
|
-
},
|
|
9647
|
-
onError: function onError(error) {
|
|
9648
|
-
onWorkspaceApiError(dispatch, error, t);
|
|
9649
|
-
}
|
|
9650
|
-
});
|
|
9651
|
-
};
|
|
9652
|
-
var useCreateWorkspacePreset = function useCreateWorkspacePreset() {
|
|
9653
|
-
var _useAuthenticationCon2 = useAuthenticationContext(),
|
|
9654
|
-
auth = _useAuthenticationCon2.auth;
|
|
9655
|
-
var _useWorkspaceTranslat2 = useWorkspaceTranslation(),
|
|
9656
|
-
t = _useWorkspaceTranslat2.t;
|
|
9657
|
-
var dispatch = useDispatch();
|
|
9658
|
-
return useMutation({
|
|
9659
|
-
mutationFn: function mutationFn(_ref2) {
|
|
9660
|
-
var data = _ref2.data;
|
|
9661
|
-
if (!auth) {
|
|
9662
|
-
throw new Error('Authentication context not found');
|
|
9663
|
-
}
|
|
9664
|
-
return createWorkspace(data, auth);
|
|
9665
|
-
},
|
|
9666
|
-
onSuccess: function onSuccess(data, variables) {
|
|
9667
|
-
var location = data == null ? void 0 : data.get('location');
|
|
9668
|
-
var newId = getIdFromUrl(location);
|
|
9669
|
-
var scope = variables.data.scope || 'user';
|
|
9670
|
-
dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
9671
|
-
workspaceId: newId,
|
|
9672
|
-
action: variables.action || WorkspacePresetAction.SAVE_AS,
|
|
9673
|
-
title: variables.data.title,
|
|
9674
|
-
scope: scope
|
|
9675
|
-
}));
|
|
9676
|
-
},
|
|
9677
|
-
onError: function onError(error) {
|
|
9678
|
-
onWorkspaceApiError(dispatch, error, t);
|
|
9679
|
-
}
|
|
11089
|
+
workspaceId: workspaceId
|
|
11090
|
+
})]
|
|
9680
11091
|
});
|
|
9681
11092
|
};
|
|
9682
11093
|
|
|
@@ -9697,311 +11108,82 @@ var useCreateWorkspacePreset = function useCreateWorkspacePreset() {
|
|
|
9697
11108
|
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
9698
11109
|
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
9699
11110
|
* */
|
|
9700
|
-
var
|
|
9701
|
-
|
|
9702
|
-
|
|
9703
|
-
|
|
9704
|
-
dataType: ['observation', 'forecast', 'archive'],
|
|
9705
|
-
dataSource: ['Meps', 'Arome Arctic', 'Ecmwf', 'Ensemble', 'AIFS', 'BRIS', 'radar', 'satellite', 'synop']
|
|
9706
|
-
};
|
|
9707
|
-
|
|
9708
|
-
var normalize = function normalize(labels) {
|
|
9709
|
-
var _labels$purpose, _labels$parameters, _labels$phenomena, _labels$dataType, _labels$dataSource, _labels$viewType;
|
|
9710
|
-
return {
|
|
9711
|
-
purpose: (_labels$purpose = labels == null ? void 0 : labels.purpose) != null ? _labels$purpose : [],
|
|
9712
|
-
parameters: (_labels$parameters = labels == null ? void 0 : labels.parameters) != null ? _labels$parameters : [],
|
|
9713
|
-
phenomena: (_labels$phenomena = labels == null ? void 0 : labels.phenomena) != null ? _labels$phenomena : [],
|
|
9714
|
-
dataType: (_labels$dataType = labels == null ? void 0 : labels.dataType) != null ? _labels$dataType : [],
|
|
9715
|
-
dataSource: (_labels$dataSource = labels == null ? void 0 : labels.dataSource) != null ? _labels$dataSource : [],
|
|
9716
|
-
viewType: (_labels$viewType = labels == null ? void 0 : labels.viewType) != null ? _labels$viewType : []
|
|
9717
|
-
};
|
|
9718
|
-
};
|
|
9719
|
-
var humanize = function humanize(value) {
|
|
9720
|
-
return value.replace(/[_-]+/g, ' ').replace(/\s+/g, ' ').trim().replace(/\b\w/g, function (match) {
|
|
9721
|
-
return match.toUpperCase();
|
|
11111
|
+
var useWorkspaceLabelsConfig = function useWorkspaceLabelsConfig() {
|
|
11112
|
+
return useQuery({
|
|
11113
|
+
queryKey: ['workspace-labels-config'],
|
|
11114
|
+
queryFn: getWorkspaceLabelsConfig
|
|
9722
11115
|
});
|
|
9723
11116
|
};
|
|
9724
|
-
var
|
|
9725
|
-
|
|
9726
|
-
|
|
11117
|
+
var onWorkspaceApiError = function onWorkspaceApiError(dispatch, error, t) {
|
|
11118
|
+
dispatch(workspaceListActions.onErrorWorkspacePresetAction({
|
|
11119
|
+
error: {
|
|
11120
|
+
message: error.message + " " + t('workspace-error-generic'),
|
|
11121
|
+
type: WorkspaceListErrorType.VERBATIM_ERROR,
|
|
11122
|
+
category: error.message === 'Authentication context not found' ? WorkspaceListErrorCategory.AUTH : WorkspaceListErrorCategory.GENERIC
|
|
11123
|
+
}
|
|
11124
|
+
}));
|
|
11125
|
+
};
|
|
11126
|
+
var useDeleteWorkspacePreset = function useDeleteWorkspacePreset() {
|
|
11127
|
+
var _useAuthenticationCon = useAuthenticationContext(),
|
|
11128
|
+
auth = _useAuthenticationCon.auth;
|
|
11129
|
+
var _useSelector = useSelector(getWorkspaceActionFormValues),
|
|
11130
|
+
title = _useSelector.title;
|
|
9727
11131
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
9728
11132
|
t = _useWorkspaceTranslat.t;
|
|
9729
|
-
var
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
|
|
9740
|
-
|
|
9741
|
-
|
|
9742
|
-
|
|
9743
|
-
|
|
9744
|
-
|
|
9745
|
-
|
|
9746
|
-
|
|
9747
|
-
|
|
9748
|
-
|
|
9749
|
-
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
|
|
9764
|
-
|
|
9765
|
-
|
|
9766
|
-
|
|
9767
|
-
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9772
|
-
|
|
9773
|
-
|
|
9774
|
-
|
|
9775
|
-
|
|
9776
|
-
|
|
9777
|
-
|
|
9778
|
-
|
|
9779
|
-
Object.keys(availableLabels).forEach(function (key) {
|
|
9780
|
-
if (key !== 'viewType') {
|
|
9781
|
-
newLabels[key] = [];
|
|
9782
|
-
}
|
|
9783
|
-
});
|
|
9784
|
-
setValue('labels', newLabels, {
|
|
9785
|
-
shouldDirty: true
|
|
9786
|
-
});
|
|
9787
|
-
};
|
|
9788
|
-
var toggle = function toggle(key, item, locked) {
|
|
9789
|
-
var _labels$key, _Object$assign;
|
|
9790
|
-
if (locked) {
|
|
9791
|
-
return;
|
|
9792
|
-
}
|
|
9793
|
-
var currentGroup = (_labels$key = labels[key]) != null ? _labels$key : [];
|
|
9794
|
-
var nextGroup = currentGroup.includes(item) ? currentGroup.filter(function (label) {
|
|
9795
|
-
return label !== item;
|
|
9796
|
-
}) : [].concat(currentGroup, [item]);
|
|
9797
|
-
var newLabels = Object.assign({}, labels, (_Object$assign = {}, _Object$assign[key] = nextGroup, _Object$assign));
|
|
9798
|
-
setValue('labels', newLabels, {
|
|
9799
|
-
shouldDirty: true,
|
|
9800
|
-
shouldTouch: true
|
|
9801
|
-
});
|
|
9802
|
-
};
|
|
9803
|
-
var groups = [{
|
|
9804
|
-
key: 'purpose',
|
|
9805
|
-
title: t('workspace-labels-purpose'),
|
|
9806
|
-
items: availableLabels.purpose
|
|
9807
|
-
}, {
|
|
9808
|
-
key: 'parameters',
|
|
9809
|
-
title: t('workspace-labels-parameters'),
|
|
9810
|
-
items: availableLabels.parameters
|
|
9811
|
-
}, {
|
|
9812
|
-
key: 'phenomena',
|
|
9813
|
-
title: t('workspace-labels-phenomena'),
|
|
9814
|
-
items: availableLabels.phenomena
|
|
9815
|
-
}, {
|
|
9816
|
-
key: 'dataType',
|
|
9817
|
-
title: t('workspace-labels-dataType'),
|
|
9818
|
-
items: availableLabels.dataType
|
|
9819
|
-
}, {
|
|
9820
|
-
key: 'dataSource',
|
|
9821
|
-
title: t('workspace-labels-dataSource'),
|
|
9822
|
-
items: availableLabels.dataSource
|
|
9823
|
-
}, {
|
|
9824
|
-
key: 'viewType',
|
|
9825
|
-
title: t('workspace-labels-viewType'),
|
|
9826
|
-
items: componentTypes,
|
|
9827
|
-
locked: true
|
|
9828
|
-
}];
|
|
9829
|
-
var _React$useState = React__default.useState(false),
|
|
9830
|
-
expandAll = _React$useState[0],
|
|
9831
|
-
setExpandAll = _React$useState[1];
|
|
9832
|
-
var _React$useState2 = React__default.useState(0),
|
|
9833
|
-
resetKey = _React$useState2[0],
|
|
9834
|
-
setResetKey = _React$useState2[1];
|
|
9835
|
-
var toggleAll = function toggleAll() {
|
|
9836
|
-
setExpandAll(function (vi) {
|
|
9837
|
-
return !vi;
|
|
9838
|
-
});
|
|
9839
|
-
setResetKey(function (key) {
|
|
9840
|
-
return key + 1;
|
|
9841
|
-
});
|
|
9842
|
-
};
|
|
9843
|
-
var labelFor = function labelFor(group, value) {
|
|
9844
|
-
if (group === 'parameters') {
|
|
9845
|
-
var key = "workspace-labels-parameters-" + value;
|
|
9846
|
-
var translated = t(key);
|
|
9847
|
-
if (translated !== key) {
|
|
9848
|
-
return translated;
|
|
9849
|
-
}
|
|
9850
|
-
return humanize(value);
|
|
9851
|
-
}
|
|
9852
|
-
return humanize(value);
|
|
9853
|
-
};
|
|
9854
|
-
return jsxs(Box, {
|
|
9855
|
-
sx: {
|
|
9856
|
-
py: 1
|
|
9857
|
-
},
|
|
9858
|
-
children: [jsx(Typography, {
|
|
9859
|
-
variant: "subtitle1",
|
|
9860
|
-
sx: {
|
|
9861
|
-
px: 2,
|
|
9862
|
-
mb: 1,
|
|
9863
|
-
mt: 1
|
|
9864
|
-
},
|
|
9865
|
-
children: t('workspace-presets-form-labels-header')
|
|
9866
|
-
}), jsxs(Box, {
|
|
9867
|
-
sx: {
|
|
9868
|
-
px: 2,
|
|
9869
|
-
display: 'grid',
|
|
9870
|
-
rowGap: 1,
|
|
9871
|
-
mb: 2
|
|
9872
|
-
},
|
|
9873
|
-
children: [jsx(Button, {
|
|
9874
|
-
variant: "contained",
|
|
9875
|
-
size: "small",
|
|
9876
|
-
color: "secondary",
|
|
9877
|
-
onClick: clearAll,
|
|
9878
|
-
disabled: activeNonViewType === 0,
|
|
9879
|
-
sx: {
|
|
9880
|
-
justifySelf: 'start',
|
|
9881
|
-
letterSpacing: 0.2,
|
|
9882
|
-
boxShadow: 'none',
|
|
9883
|
-
textTransform: 'none'
|
|
9884
|
-
},
|
|
9885
|
-
children: t('workspace-presets-form-labels-clearAll', {
|
|
9886
|
-
count: totalActive
|
|
9887
|
-
})
|
|
9888
|
-
}), jsx(Typography, {
|
|
9889
|
-
variant: "caption",
|
|
9890
|
-
sx: {
|
|
9891
|
-
color: 'text.secondary'
|
|
9892
|
-
},
|
|
9893
|
-
children: t('workspace-presets-form-labels-info')
|
|
9894
|
-
}), jsx(Button, {
|
|
9895
|
-
variant: "outlined",
|
|
9896
|
-
size: "small",
|
|
9897
|
-
onClick: toggleAll,
|
|
9898
|
-
sx: {
|
|
9899
|
-
justifySelf: 'start',
|
|
9900
|
-
textTransform: 'none',
|
|
9901
|
-
minWidth: 120,
|
|
9902
|
-
maxWidth: 120
|
|
9903
|
-
},
|
|
9904
|
-
endIcon: expandAll ? jsx(ChevronUp, {}) : jsx(ChevronDown, {}),
|
|
9905
|
-
children: expandAll ? t('workspace-presets-form-labels-collapseAll') : t('workspace-presets-form-labels-expandAll')
|
|
9906
|
-
})]
|
|
9907
|
-
}), jsx(Stack, {
|
|
9908
|
-
spacing: 1,
|
|
9909
|
-
sx: {
|
|
9910
|
-
px: 1
|
|
9911
|
-
},
|
|
9912
|
-
children: groups.map(function (_ref2) {
|
|
9913
|
-
var key = _ref2.key,
|
|
9914
|
-
title = _ref2.title,
|
|
9915
|
-
items = _ref2.items,
|
|
9916
|
-
locked = _ref2.locked;
|
|
9917
|
-
var safeItems = items != null ? items : [];
|
|
9918
|
-
var active = key === 'viewType' ? componentTypes.length : labels[key].length;
|
|
9919
|
-
return jsx(CustomAccordion, {
|
|
9920
|
-
defaultExpanded: expandAll,
|
|
9921
|
-
"data-testid": "workspace-labels-drawer-" + key,
|
|
9922
|
-
sx: {
|
|
9923
|
-
border: 'none',
|
|
9924
|
-
width: '100%',
|
|
9925
|
-
boxShadow: 'none',
|
|
9926
|
-
'&::before': {
|
|
9927
|
-
display: 'none'
|
|
9928
|
-
},
|
|
9929
|
-
'& .MuiPaper-root, & .MuiAccordion-root': {
|
|
9930
|
-
boxShadow: 'none'
|
|
9931
|
-
},
|
|
9932
|
-
'& .MuiAccordionSummary-content, & .MuiAccordionSummary-content.Mui-expanded': {
|
|
9933
|
-
marginY: 0
|
|
9934
|
-
},
|
|
9935
|
-
'& .MuiAccordionDetails-root': {
|
|
9936
|
-
paddingTop: 0.25,
|
|
9937
|
-
paddingBottom: 0.75
|
|
9938
|
-
},
|
|
9939
|
-
'& .MuiAccordionSummary-root.Mui-expanded': {
|
|
9940
|
-
borderBottom: 'none'
|
|
9941
|
-
}
|
|
9942
|
-
},
|
|
9943
|
-
title: jsxs(Stack, {
|
|
9944
|
-
direction: "row",
|
|
9945
|
-
alignItems: "center",
|
|
9946
|
-
sx: {
|
|
9947
|
-
flexGrow: 1,
|
|
9948
|
-
minWidth: 0
|
|
9949
|
-
},
|
|
9950
|
-
children: [jsxs(Stack, {
|
|
9951
|
-
direction: "row",
|
|
9952
|
-
spacing: 1,
|
|
9953
|
-
alignItems: "center",
|
|
9954
|
-
children: [jsx(Typography, {
|
|
9955
|
-
children: title + " (" + safeItems.length + ")"
|
|
9956
|
-
}), locked && jsx(LockLocked, {
|
|
9957
|
-
fontSize: "small"
|
|
9958
|
-
})]
|
|
9959
|
-
}), active > 0 && jsx(Chip, {
|
|
9960
|
-
size: "small",
|
|
9961
|
-
label: active + " " + t('workspace-label-active'),
|
|
9962
|
-
color: "primary",
|
|
9963
|
-
variant: "outlined",
|
|
9964
|
-
sx: {
|
|
9965
|
-
ml: 'auto',
|
|
9966
|
-
fontWeight: 500,
|
|
9967
|
-
border: 'none',
|
|
9968
|
-
position: 'absolute',
|
|
9969
|
-
right: 35,
|
|
9970
|
-
cursor: 'default',
|
|
9971
|
-
pointerEvents: 'none',
|
|
9972
|
-
'&:hover': {
|
|
9973
|
-
backgroundColor: 'transparent',
|
|
9974
|
-
boxShadow: 'none'
|
|
9975
|
-
}
|
|
9976
|
-
}
|
|
9977
|
-
})]
|
|
9978
|
-
}),
|
|
9979
|
-
children: jsx(Stack, {
|
|
9980
|
-
spacing: 0.2,
|
|
9981
|
-
children: safeItems.map(function (it) {
|
|
9982
|
-
return jsx(FormControlLabel, {
|
|
9983
|
-
disabled: locked,
|
|
9984
|
-
control: jsx(Checkbox, {
|
|
9985
|
-
size: "small",
|
|
9986
|
-
checked: labels[key].includes(it),
|
|
9987
|
-
onChange: function onChange() {
|
|
9988
|
-
return toggle(key, it, locked);
|
|
9989
|
-
}
|
|
9990
|
-
}),
|
|
9991
|
-
label: jsx(Typography, {
|
|
9992
|
-
variant: "body2",
|
|
9993
|
-
children: labelFor(key, it)
|
|
9994
|
-
})
|
|
9995
|
-
}, it);
|
|
9996
|
-
})
|
|
9997
|
-
})
|
|
9998
|
-
}, resetKey + "-" + key + "-" + expandAll);
|
|
9999
|
-
})
|
|
10000
|
-
})]
|
|
11133
|
+
var dispatch = useDispatch();
|
|
11134
|
+
return useMutation({
|
|
11135
|
+
mutationFn: function mutationFn(_ref) {
|
|
11136
|
+
var id = _ref.id;
|
|
11137
|
+
if (!auth) {
|
|
11138
|
+
throw new Error('Authentication context not found');
|
|
11139
|
+
}
|
|
11140
|
+
return deleteWorkspace(id, auth);
|
|
11141
|
+
},
|
|
11142
|
+
onSuccess: function onSuccess(data, variables) {
|
|
11143
|
+
dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
11144
|
+
workspaceId: variables.id,
|
|
11145
|
+
action: WorkspacePresetAction.DELETE,
|
|
11146
|
+
emptyWorkspacePresetTitle: t('workspace-new'),
|
|
11147
|
+
title: title
|
|
11148
|
+
}));
|
|
11149
|
+
},
|
|
11150
|
+
onError: function onError(error) {
|
|
11151
|
+
onWorkspaceApiError(dispatch, error, t);
|
|
11152
|
+
}
|
|
11153
|
+
});
|
|
11154
|
+
};
|
|
11155
|
+
var useCreateWorkspacePreset = function useCreateWorkspacePreset() {
|
|
11156
|
+
var _useAuthenticationCon2 = useAuthenticationContext(),
|
|
11157
|
+
auth = _useAuthenticationCon2.auth;
|
|
11158
|
+
var _useWorkspaceTranslat2 = useWorkspaceTranslation(),
|
|
11159
|
+
t = _useWorkspaceTranslat2.t;
|
|
11160
|
+
var dispatch = useDispatch();
|
|
11161
|
+
return useMutation({
|
|
11162
|
+
mutationFn: function mutationFn(_ref2) {
|
|
11163
|
+
var data = _ref2.data;
|
|
11164
|
+
if (!auth) {
|
|
11165
|
+
throw new Error('Authentication context not found');
|
|
11166
|
+
}
|
|
11167
|
+
return createWorkspace(data, auth);
|
|
11168
|
+
},
|
|
11169
|
+
onSuccess: function onSuccess(data, variables) {
|
|
11170
|
+
var location = data == null ? void 0 : data.get('location');
|
|
11171
|
+
var newId = getIdFromUrl(location);
|
|
11172
|
+
var scope = variables.data.scope || 'user';
|
|
11173
|
+
dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
11174
|
+
workspaceId: newId,
|
|
11175
|
+
action: variables.action || WorkspacePresetAction.SAVE_AS,
|
|
11176
|
+
title: variables.data.title,
|
|
11177
|
+
scope: scope
|
|
11178
|
+
}));
|
|
11179
|
+
},
|
|
11180
|
+
onError: function onError(error) {
|
|
11181
|
+
onWorkspaceApiError(dispatch, error, t);
|
|
11182
|
+
}
|
|
10001
11183
|
});
|
|
10002
11184
|
};
|
|
10003
11185
|
|
|
10004
|
-
var _excluded$2 = ["title", "abstract"];
|
|
11186
|
+
var _excluded$2 = ["title", "description", "abstract"];
|
|
10005
11187
|
var ERROR_DUPLICATE_TITLE_BE = 'Preset title already in use, please choose a different title';
|
|
10006
11188
|
var ERROR_LONG_TITLE_BE = 'Preset title cannot exceed 100 characters';
|
|
10007
11189
|
var validateTitle$1 = function validateTitle(value) {
|
|
@@ -10015,7 +11197,9 @@ var emptyWorkspacePreset = {
|
|
|
10015
11197
|
title: '',
|
|
10016
11198
|
"abstract": ''
|
|
10017
11199
|
};
|
|
11200
|
+
var SHORT_DESC_LIMIT$1 = 100;
|
|
10018
11201
|
var WorkspacePresetsForm = function WorkspacePresetsForm(_ref) {
|
|
11202
|
+
var _watch;
|
|
10019
11203
|
var error = _ref.error,
|
|
10020
11204
|
onSubmit = _ref.onSubmit,
|
|
10021
11205
|
action = _ref.action,
|
|
@@ -10034,18 +11218,19 @@ var WorkspacePresetsForm = function WorkspacePresetsForm(_ref) {
|
|
|
10034
11218
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
10035
11219
|
t = _useWorkspaceTranslat.t;
|
|
10036
11220
|
var _useFormContext = useFormContext(),
|
|
10037
|
-
setError = _useFormContext.setError
|
|
11221
|
+
setError = _useFormContext.setError,
|
|
11222
|
+
watch = _useFormContext.watch;
|
|
10038
11223
|
var titleField = 'title';
|
|
10039
11224
|
var _emptyWorkspacePreset = Object.assign({}, emptyWorkspacePreset, formValues),
|
|
10040
11225
|
title = _emptyWorkspacePreset.title,
|
|
11226
|
+
description = _emptyWorkspacePreset.description,
|
|
10041
11227
|
_abstract = _emptyWorkspacePreset["abstract"],
|
|
10042
11228
|
otherFormValues = _objectWithoutPropertiesLoose(_emptyWorkspacePreset, _excluded$2);
|
|
10043
|
-
var _React$useState = React__default.useState(0),
|
|
10044
|
-
activeLabelsCount = _React$useState[0],
|
|
10045
|
-
setActiveLabelsCount = _React$useState[1];
|
|
10046
11229
|
var _formValues$views = formValues.views,
|
|
10047
11230
|
views = _formValues$views === void 0 ? [] : _formValues$views;
|
|
10048
11231
|
var isViewsOnly = action === WorkspacePresetAction.EDIT_TITLE;
|
|
11232
|
+
var descriptionValue = (_watch = watch('description')) != null ? _watch : '';
|
|
11233
|
+
var remaining = Math.max(0, SHORT_DESC_LIMIT$1 - descriptionValue.length);
|
|
10049
11234
|
var hiddenFields = Object.keys(otherFormValues).map(function (name) {
|
|
10050
11235
|
return {
|
|
10051
11236
|
name: name,
|
|
@@ -10159,9 +11344,8 @@ var WorkspacePresetsForm = function WorkspacePresetsForm(_ref) {
|
|
|
10159
11344
|
bgcolor: 'geowebColors.background.surface',
|
|
10160
11345
|
maxWidth: '80%'
|
|
10161
11346
|
},
|
|
10162
|
-
children: jsx(
|
|
10163
|
-
labelsConfig: labelsConfig
|
|
10164
|
-
onActiveLabelsChange: setActiveLabelsCount
|
|
11347
|
+
children: jsx(PresetLabelsPanel, {
|
|
11348
|
+
labelsConfig: labelsConfig
|
|
10165
11349
|
})
|
|
10166
11350
|
}), jsxs(Box, {
|
|
10167
11351
|
sx: {
|
|
@@ -10200,11 +11384,40 @@ var WorkspacePresetsForm = function WorkspacePresetsForm(_ref) {
|
|
|
10200
11384
|
defaultValue: title,
|
|
10201
11385
|
error: shouldShowTitleError
|
|
10202
11386
|
})
|
|
10203
|
-
}),
|
|
11387
|
+
}), jsxs(Box, {
|
|
10204
11388
|
sx: {
|
|
10205
11389
|
mb: 2
|
|
10206
11390
|
},
|
|
10207
|
-
children: jsx(ReactHookFormTextField, {
|
|
11391
|
+
children: [jsx(ReactHookFormTextField, {
|
|
11392
|
+
fullWidth: true,
|
|
11393
|
+
name: "description",
|
|
11394
|
+
label: t('workspace-dialog-description'),
|
|
11395
|
+
rules: {
|
|
11396
|
+
required: false,
|
|
11397
|
+
maxLength: SHORT_DESC_LIMIT$1
|
|
11398
|
+
},
|
|
11399
|
+
multiline: true,
|
|
11400
|
+
rows: 3,
|
|
11401
|
+
disabled: isDisabled,
|
|
11402
|
+
defaultValue: description
|
|
11403
|
+
}), jsxs(Typography, {
|
|
11404
|
+
variant: "caption",
|
|
11405
|
+
component: "div",
|
|
11406
|
+
marginBottom: 2,
|
|
11407
|
+
marginTop: 1,
|
|
11408
|
+
marginLeft: 1,
|
|
11409
|
+
children: [jsxs(Typography, {
|
|
11410
|
+
component: "span",
|
|
11411
|
+
variant: "inherit",
|
|
11412
|
+
color: "textSecondary",
|
|
11413
|
+
children: [t('workspace-char-limit'), ' ']
|
|
11414
|
+
}), jsx(Typography, {
|
|
11415
|
+
component: "span",
|
|
11416
|
+
variant: "inherit",
|
|
11417
|
+
color: remaining === 0 ? 'error' : 'primary',
|
|
11418
|
+
children: remaining
|
|
11419
|
+
})]
|
|
11420
|
+
}), jsx(ReactHookFormTextField, {
|
|
10208
11421
|
fullWidth: true,
|
|
10209
11422
|
name: "abstract",
|
|
10210
11423
|
label: t('workspace-dialog-abstract'),
|
|
@@ -10212,30 +11425,10 @@ var WorkspacePresetsForm = function WorkspacePresetsForm(_ref) {
|
|
|
10212
11425
|
required: false
|
|
10213
11426
|
},
|
|
10214
11427
|
multiline: true,
|
|
10215
|
-
rows:
|
|
11428
|
+
rows: 6,
|
|
10216
11429
|
disabled: isDisabled,
|
|
10217
11430
|
defaultValue: _abstract
|
|
10218
|
-
})
|
|
10219
|
-
}), shouldShowLabelsForm && jsx(Box, {
|
|
10220
|
-
sx: {
|
|
10221
|
-
mb: 2
|
|
10222
|
-
},
|
|
10223
|
-
children: jsx(Chip, {
|
|
10224
|
-
variant: "outlined",
|
|
10225
|
-
size: "medium",
|
|
10226
|
-
color: "primary",
|
|
10227
|
-
label: t('workspace-presets-form-active-labels', {
|
|
10228
|
-
count: activeLabelsCount
|
|
10229
|
-
}),
|
|
10230
|
-
sx: {
|
|
10231
|
-
cursor: 'default',
|
|
10232
|
-
pointerEvents: 'none',
|
|
10233
|
-
'&:hover': {
|
|
10234
|
-
backgroundColor: 'transparent',
|
|
10235
|
-
boxShadow: 'none'
|
|
10236
|
-
}
|
|
10237
|
-
}
|
|
10238
|
-
})
|
|
11431
|
+
})]
|
|
10239
11432
|
}), showInlineActions && jsx(Box, {
|
|
10240
11433
|
sx: {
|
|
10241
11434
|
mt: 'auto',
|
|
@@ -10262,16 +11455,7 @@ var WorkspacePresetsForm = function WorkspacePresetsForm(_ref) {
|
|
|
10262
11455
|
})]
|
|
10263
11456
|
})
|
|
10264
11457
|
}), (action === WorkspacePresetAction.DELETE || action === WorkspacePresetAction.DELETE_SYSTEM_PRESET) && jsxs(Fragment, {
|
|
10265
|
-
children: [
|
|
10266
|
-
variant: "body1",
|
|
10267
|
-
children: [jsx(Exclamation, {
|
|
10268
|
-
sx: {
|
|
10269
|
-
color: 'geowebColors.functional.warning',
|
|
10270
|
-
position: 'relative',
|
|
10271
|
-
top: '6px'
|
|
10272
|
-
}
|
|
10273
|
-
}), action === WorkspacePresetAction.DELETE_SYSTEM_PRESET ? t('workspace-dialog-confirm-delete-system') : t('workspace-dialog-confirm-delete-user')]
|
|
10274
|
-
}), jsx("br", {}), jsx(Typography, {
|
|
11458
|
+
children: [jsx(Typography, {
|
|
10275
11459
|
variant: "body1",
|
|
10276
11460
|
children: t('workspace-dialog-confirm-delete-message', {
|
|
10277
11461
|
TITLE: title
|
|
@@ -10394,6 +11578,7 @@ var WorkspacePresetsFormDialog = function WorkspacePresetsFormDialog(_ref) {
|
|
|
10394
11578
|
var _base$views;
|
|
10395
11579
|
// rawValues can be WorkspacePresetForBE OR WorkspaceFormValues
|
|
10396
11580
|
var title = rawValues.title,
|
|
11581
|
+
description = rawValues.description,
|
|
10397
11582
|
_abstract = rawValues["abstract"],
|
|
10398
11583
|
viewEdits = rawValues.views;
|
|
10399
11584
|
// Start from the full BE shape already in the form (it contains the real views array)
|
|
@@ -10401,6 +11586,7 @@ var WorkspacePresetsFormDialog = function WorkspacePresetsFormDialog(_ref) {
|
|
|
10401
11586
|
// Normalize workspace title/abstract
|
|
10402
11587
|
var trimmedWorkspaceTitle = typeof title === 'string' ? title.trim() : base.title;
|
|
10403
11588
|
var trimmedWorkspaceAbstract = typeof _abstract === 'string' ? _abstract.trim() : base["abstract"];
|
|
11589
|
+
var trimmedWorkspaceDescription = typeof description === 'string' ? description.trim() : base.description;
|
|
10404
11590
|
// Build a map of mosaicNodeId -> trimmed new title (only if present)
|
|
10405
11591
|
var editedTitles = new Map();
|
|
10406
11592
|
(Array.isArray(viewEdits) ? viewEdits : []).forEach(function (ve) {
|
|
@@ -10425,6 +11611,7 @@ var WorkspacePresetsFormDialog = function WorkspacePresetsFormDialog(_ref) {
|
|
|
10425
11611
|
var parsedFormValues = Object.assign({}, base, {
|
|
10426
11612
|
title: trimmedWorkspaceTitle,
|
|
10427
11613
|
"abstract": trimmedWorkspaceAbstract,
|
|
11614
|
+
description: trimmedWorkspaceDescription,
|
|
10428
11615
|
views: mergedViews
|
|
10429
11616
|
});
|
|
10430
11617
|
onFormSubmit(action, presetId, parsedFormValues);
|
|
@@ -10527,18 +11714,18 @@ var WorkspaceTabConnect = function WorkspaceTabConnect(_ref) {
|
|
|
10527
11714
|
}, [dispatch]);
|
|
10528
11715
|
var onSubmitForm = /*#__PURE__*/function () {
|
|
10529
11716
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(presetAction, presetId, data) {
|
|
10530
|
-
var oldWorkspace;
|
|
11717
|
+
var _data$labels, _data$scope, oldWorkspace, duplicatedWorkspace;
|
|
10531
11718
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10532
11719
|
while (1) switch (_context.prev = _context.next) {
|
|
10533
11720
|
case 0:
|
|
10534
11721
|
_context.t0 = presetAction;
|
|
10535
|
-
_context.next = _context.t0 === WorkspacePresetAction.DELETE ? 3 : _context.t0 === WorkspacePresetAction.DELETE_SYSTEM_PRESET ? 3 : _context.t0 === WorkspacePresetAction.DUPLICATE ? 5 :
|
|
11722
|
+
_context.next = _context.t0 === WorkspacePresetAction.DELETE ? 3 : _context.t0 === WorkspacePresetAction.DELETE_SYSTEM_PRESET ? 3 : _context.t0 === WorkspacePresetAction.DUPLICATE ? 5 : 16;
|
|
10536
11723
|
break;
|
|
10537
11724
|
case 3:
|
|
10538
11725
|
deleteWorkspace({
|
|
10539
11726
|
id: presetId
|
|
10540
11727
|
});
|
|
10541
|
-
return _context.abrupt("break",
|
|
11728
|
+
return _context.abrupt("break", 18);
|
|
10542
11729
|
case 5:
|
|
10543
11730
|
if (!presetId) {
|
|
10544
11731
|
_context.next = 11;
|
|
@@ -10554,12 +11741,19 @@ var WorkspaceTabConnect = function WorkspaceTabConnect(_ref) {
|
|
|
10554
11741
|
_context.t1 = emptyWorkspaceBEData;
|
|
10555
11742
|
case 12:
|
|
10556
11743
|
oldWorkspace = _context.t1;
|
|
11744
|
+
duplicatedWorkspace = Object.assign({}, oldWorkspace, {
|
|
11745
|
+
title: data.title,
|
|
11746
|
+
"abstract": data["abstract"],
|
|
11747
|
+
description: data.description,
|
|
11748
|
+
labels: (_data$labels = data.labels) != null ? _data$labels : oldWorkspace.labels,
|
|
11749
|
+
scope: (_data$scope = data.scope) != null ? _data$scope : oldWorkspace.scope
|
|
11750
|
+
});
|
|
10557
11751
|
createWorkspace({
|
|
10558
|
-
data:
|
|
11752
|
+
data: duplicatedWorkspace,
|
|
10559
11753
|
action: presetAction
|
|
10560
11754
|
});
|
|
10561
|
-
return _context.abrupt("break",
|
|
10562
|
-
case
|
|
11755
|
+
return _context.abrupt("break", 18);
|
|
11756
|
+
case 16:
|
|
10563
11757
|
dispatch(workspaceListActions.submitFormWorkspaceActionDialogOptions({
|
|
10564
11758
|
presetAction: presetAction,
|
|
10565
11759
|
presetId: presetId,
|
|
@@ -10567,8 +11761,8 @@ var WorkspaceTabConnect = function WorkspaceTabConnect(_ref) {
|
|
|
10567
11761
|
emptyMapPresetTitle: t('workspace-mappreset-new'),
|
|
10568
11762
|
emptyWorkspacePresetTitle: t('workspace-new')
|
|
10569
11763
|
}));
|
|
10570
|
-
return _context.abrupt("break",
|
|
10571
|
-
case
|
|
11764
|
+
return _context.abrupt("break", 18);
|
|
11765
|
+
case 18:
|
|
10572
11766
|
case "end":
|
|
10573
11767
|
return _context.stop();
|
|
10574
11768
|
}
|
|
@@ -10628,7 +11822,7 @@ var WorkspaceTopBar = function WorkspaceTopBar(_ref) {
|
|
|
10628
11822
|
});
|
|
10629
11823
|
};
|
|
10630
11824
|
|
|
10631
|
-
var _excluded$1 = ["title"];
|
|
11825
|
+
var _excluded$1 = ["title", "description"];
|
|
10632
11826
|
var validateTitle = function validateTitle(value) {
|
|
10633
11827
|
if (!value) {
|
|
10634
11828
|
return true;
|
|
@@ -10636,18 +11830,31 @@ var validateTitle = function validateTitle(value) {
|
|
|
10636
11830
|
// TODO: use translation from form-fields https://gitlab.com/opengeoweb/opengeoweb/-/issues/4240
|
|
10637
11831
|
return !value.trim().length ? 'This field is required' : true;
|
|
10638
11832
|
};
|
|
10639
|
-
var
|
|
11833
|
+
var SHORT_DESC_LIMIT = 100;
|
|
10640
11834
|
var ViewPresetsForm = function ViewPresetsForm(_ref) {
|
|
11835
|
+
var _watch;
|
|
10641
11836
|
var viewComponentType = _ref.viewComponentType,
|
|
10642
11837
|
error = _ref.error,
|
|
10643
11838
|
onSubmit = _ref.onSubmit,
|
|
10644
11839
|
action = _ref.action,
|
|
10645
|
-
formValues = _ref.formValues
|
|
11840
|
+
formValues = _ref.formValues,
|
|
11841
|
+
_ref$isLoading = _ref.isLoading,
|
|
11842
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
11843
|
+
_ref$showInlineAction = _ref.showInlineActions,
|
|
11844
|
+
showInlineActions = _ref$showInlineAction === void 0 ? false : _ref$showInlineAction,
|
|
11845
|
+
confirmLabel = _ref.confirmLabel,
|
|
11846
|
+
cancelLabel = _ref.cancelLabel,
|
|
11847
|
+
onClose = _ref.onClose,
|
|
11848
|
+
dialogTitle = _ref.dialogTitle,
|
|
11849
|
+
labelsConfig = _ref.labelsConfig;
|
|
10646
11850
|
var fieldName = 'title';
|
|
10647
11851
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
10648
11852
|
t = _useWorkspaceTranslat.t;
|
|
11853
|
+
var _useFormContext = useFormContext(),
|
|
11854
|
+
watch = _useFormContext.watch;
|
|
10649
11855
|
var _emptyViewPreset$form = Object.assign({}, emptyViewPreset(viewComponentType), formValues),
|
|
10650
11856
|
title = _emptyViewPreset$form.title,
|
|
11857
|
+
description = _emptyViewPreset$form.description,
|
|
10651
11858
|
otherFormValues = _objectWithoutPropertiesLoose(_emptyViewPreset$form, _excluded$1);
|
|
10652
11859
|
var hiddenFields = Object.keys(otherFormValues).map(function (name) {
|
|
10653
11860
|
return {
|
|
@@ -10655,6 +11862,8 @@ var ViewPresetsForm = function ViewPresetsForm(_ref) {
|
|
|
10655
11862
|
value: otherFormValues[name]
|
|
10656
11863
|
};
|
|
10657
11864
|
});
|
|
11865
|
+
var descriptionValue = (_watch = watch('description')) != null ? _watch : '';
|
|
11866
|
+
var remaining = Math.max(0, SHORT_DESC_LIMIT - descriptionValue.length);
|
|
10658
11867
|
React__default.useEffect(function () {
|
|
10659
11868
|
// autoFocus
|
|
10660
11869
|
var field = document.querySelector("[name=\"" + fieldName + "\"]");
|
|
@@ -10664,47 +11873,153 @@ var ViewPresetsForm = function ViewPresetsForm(_ref) {
|
|
|
10664
11873
|
event.preventDefault();
|
|
10665
11874
|
onSubmit();
|
|
10666
11875
|
};
|
|
11876
|
+
var shouldShowLabelsForm = action === PresetAction.SAVE_AS || action === PresetAction.EDIT;
|
|
11877
|
+
var marginBottom = 2;
|
|
10667
11878
|
return jsxs(Fragment, {
|
|
10668
|
-
children: [
|
|
10669
|
-
sx: {
|
|
10670
|
-
mb: marginBottom
|
|
10671
|
-
},
|
|
10672
|
-
children: jsx(AlertBanner, {
|
|
10673
|
-
title: error
|
|
10674
|
-
})
|
|
10675
|
-
}), (action === PresetAction.SAVE_AS || action === PresetAction.EDIT) && jsxs("form", {
|
|
11879
|
+
children: [(action === PresetAction.SAVE_AS || action === PresetAction.EDIT) && jsx("form", {
|
|
10676
11880
|
"data-testid": "map-preset-form",
|
|
10677
11881
|
onSubmit: onSubmitForm,
|
|
10678
|
-
|
|
10679
|
-
|
|
10680
|
-
|
|
10681
|
-
|
|
10682
|
-
required: true,
|
|
10683
|
-
validate: {
|
|
10684
|
-
validateTitle: validateTitle
|
|
10685
|
-
}
|
|
10686
|
-
},
|
|
10687
|
-
defaultValue: title,
|
|
11882
|
+
style: {
|
|
11883
|
+
height: '100%'
|
|
11884
|
+
},
|
|
11885
|
+
children: jsxs(Box, {
|
|
10688
11886
|
sx: {
|
|
10689
|
-
|
|
10690
|
-
|
|
10691
|
-
|
|
10692
|
-
name: "abstract",
|
|
10693
|
-
label: t('workspace-dialog-abstract'),
|
|
10694
|
-
rules: {
|
|
10695
|
-
required: false
|
|
11887
|
+
display: 'flex',
|
|
11888
|
+
flexDirection: 'column',
|
|
11889
|
+
height: '100%'
|
|
10696
11890
|
},
|
|
10697
|
-
|
|
10698
|
-
|
|
10699
|
-
|
|
10700
|
-
|
|
10701
|
-
|
|
10702
|
-
|
|
10703
|
-
|
|
10704
|
-
|
|
10705
|
-
|
|
10706
|
-
|
|
10707
|
-
|
|
11891
|
+
children: [Boolean(error) && jsx(AlertBanner, {
|
|
11892
|
+
title: error
|
|
11893
|
+
}), jsxs(Box, {
|
|
11894
|
+
sx: {
|
|
11895
|
+
flex: 1,
|
|
11896
|
+
minHeight: 360,
|
|
11897
|
+
overflow: 'hidden',
|
|
11898
|
+
display: 'grid',
|
|
11899
|
+
gridTemplateColumns: shouldShowLabelsForm ? {
|
|
11900
|
+
xs: '1fr',
|
|
11901
|
+
md: '300px 1fr'
|
|
11902
|
+
} : '1fr',
|
|
11903
|
+
alignItems: 'stretch'
|
|
11904
|
+
},
|
|
11905
|
+
children: [shouldShowLabelsForm && jsx(Box, {
|
|
11906
|
+
sx: {
|
|
11907
|
+
pr: {
|
|
11908
|
+
md: 2
|
|
11909
|
+
},
|
|
11910
|
+
minWidth: 288,
|
|
11911
|
+
height: '100%',
|
|
11912
|
+
overflowY: 'auto',
|
|
11913
|
+
overflowX: 'hidden',
|
|
11914
|
+
bgcolor: 'geowebColors.background.surface',
|
|
11915
|
+
maxWidth: '80%'
|
|
11916
|
+
},
|
|
11917
|
+
children: jsx(PresetLabelsPanel, {
|
|
11918
|
+
labelsConfig: labelsConfig,
|
|
11919
|
+
viewComponentType: viewComponentType
|
|
11920
|
+
})
|
|
11921
|
+
}), jsxs(Box, {
|
|
11922
|
+
sx: {
|
|
11923
|
+
pl: {
|
|
11924
|
+
md: 2
|
|
11925
|
+
},
|
|
11926
|
+
pr: 2,
|
|
11927
|
+
py: 2,
|
|
11928
|
+
minWidth: 0,
|
|
11929
|
+
overflow: 'hidden',
|
|
11930
|
+
display: 'flex',
|
|
11931
|
+
flexDirection: 'column'
|
|
11932
|
+
},
|
|
11933
|
+
children: [dialogTitle && shouldShowLabelsForm && jsx(Typography, {
|
|
11934
|
+
variant: "subtitle1",
|
|
11935
|
+
sx: {
|
|
11936
|
+
mb: 2,
|
|
11937
|
+
fontWeight: 500
|
|
11938
|
+
},
|
|
11939
|
+
children: dialogTitle
|
|
11940
|
+
}), jsx(Box, {
|
|
11941
|
+
sx: {
|
|
11942
|
+
mb: 2
|
|
11943
|
+
},
|
|
11944
|
+
children: jsx(ReactHookFormTextField, {
|
|
11945
|
+
name: "title",
|
|
11946
|
+
label: t('workspace-mappreset-dialog-title'),
|
|
11947
|
+
rules: {
|
|
11948
|
+
required: true,
|
|
11949
|
+
validate: {
|
|
11950
|
+
validateTitle: validateTitle
|
|
11951
|
+
}
|
|
11952
|
+
},
|
|
11953
|
+
defaultValue: title,
|
|
11954
|
+
sx: {
|
|
11955
|
+
mb: marginBottom
|
|
11956
|
+
}
|
|
11957
|
+
})
|
|
11958
|
+
}), jsxs(Box, {
|
|
11959
|
+
sx: {
|
|
11960
|
+
mb: 2
|
|
11961
|
+
},
|
|
11962
|
+
children: [jsx(ReactHookFormTextField, {
|
|
11963
|
+
name: "description",
|
|
11964
|
+
label: t('workspace-dialog-description'),
|
|
11965
|
+
rules: {
|
|
11966
|
+
required: false,
|
|
11967
|
+
maxLength: SHORT_DESC_LIMIT
|
|
11968
|
+
},
|
|
11969
|
+
multiline: true,
|
|
11970
|
+
rows: 3,
|
|
11971
|
+
defaultValue: description
|
|
11972
|
+
}), jsxs(Typography, {
|
|
11973
|
+
variant: "caption",
|
|
11974
|
+
component: "div",
|
|
11975
|
+
marginBottom: 2,
|
|
11976
|
+
marginTop: 1,
|
|
11977
|
+
marginLeft: 1,
|
|
11978
|
+
children: [jsxs(Typography, {
|
|
11979
|
+
component: "span",
|
|
11980
|
+
variant: "inherit",
|
|
11981
|
+
color: "textSecondary",
|
|
11982
|
+
children: [t('workspace-char-limit'), ' ']
|
|
11983
|
+
}), jsx(Typography, {
|
|
11984
|
+
component: "span",
|
|
11985
|
+
variant: "inherit",
|
|
11986
|
+
color: remaining === 0 ? 'error' : 'primary',
|
|
11987
|
+
children: remaining
|
|
11988
|
+
})]
|
|
11989
|
+
}), jsx(ReactHookFormTextField, {
|
|
11990
|
+
name: "abstract",
|
|
11991
|
+
label: t('workspace-dialog-abstract'),
|
|
11992
|
+
rules: {
|
|
11993
|
+
required: false
|
|
11994
|
+
},
|
|
11995
|
+
multiline: true,
|
|
11996
|
+
rows: 6
|
|
11997
|
+
})]
|
|
11998
|
+
}), showInlineActions && jsx(Box, {
|
|
11999
|
+
sx: {
|
|
12000
|
+
mt: 'auto',
|
|
12001
|
+
display: 'flex',
|
|
12002
|
+
justifyContent: 'flex-end'
|
|
12003
|
+
},
|
|
12004
|
+
children: jsx(ConfirmationButtons, {
|
|
12005
|
+
onClose: onClose,
|
|
12006
|
+
cancelLabel: cancelLabel != null ? cancelLabel : '',
|
|
12007
|
+
isLoading: isLoading,
|
|
12008
|
+
onSubmit: onSubmit,
|
|
12009
|
+
confirmLabel: confirmLabel != null ? confirmLabel : ''
|
|
12010
|
+
})
|
|
12011
|
+
})]
|
|
12012
|
+
})]
|
|
12013
|
+
}), hiddenFields.map(function (_ref2) {
|
|
12014
|
+
var name = _ref2.name,
|
|
12015
|
+
value = _ref2.value;
|
|
12016
|
+
return jsx(ReactHookFormHiddenInput, {
|
|
12017
|
+
name: name,
|
|
12018
|
+
defaultValue: value,
|
|
12019
|
+
"data-testid": name
|
|
12020
|
+
}, name);
|
|
12021
|
+
})]
|
|
12022
|
+
})
|
|
10708
12023
|
}), action === PresetAction.DELETE && jsxs(Fragment, {
|
|
10709
12024
|
children: [jsx(Typography, {
|
|
10710
12025
|
variant: "body1",
|
|
@@ -10740,6 +12055,7 @@ var ViewPresetsFormDialog = function ViewPresetsFormDialog(_ref) {
|
|
|
10740
12055
|
viewPresetId = _ref.viewPresetId,
|
|
10741
12056
|
viewComponentType = _ref.viewComponentType,
|
|
10742
12057
|
formValues = _ref.formValues,
|
|
12058
|
+
labelsConfig = _ref.labelsConfig,
|
|
10743
12059
|
onSuccess = _ref.onSuccess,
|
|
10744
12060
|
onClose = _ref.onClose,
|
|
10745
12061
|
title = _ref.title,
|
|
@@ -10792,77 +12108,81 @@ var ViewPresetsFormDialog = function ViewPresetsFormDialog(_ref) {
|
|
|
10792
12108
|
var confirmLabel = getConfirmLabel(action);
|
|
10793
12109
|
var onFormSubmit = /*#__PURE__*/function () {
|
|
10794
12110
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(formValues) {
|
|
10795
|
-
var scope, handleSuccess, newFormValues, newId, _yield$api$getViewPre, originalViewPreset, viewPresetEdited, submitError, message;
|
|
12111
|
+
var scope, componentType, handleSuccess, newFormValues, newId, _yield$api$getViewPre, originalViewPreset, viewPresetEdited, submitError, message;
|
|
10796
12112
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10797
12113
|
while (1) switch (_context.prev = _context.next) {
|
|
10798
12114
|
case 0:
|
|
10799
12115
|
scope = isAdmin ? 'system' : formValues.scope;
|
|
12116
|
+
componentType = formValues.componentType || viewComponentType || 'Map';
|
|
10800
12117
|
handleSuccess = function handleSuccess(id) {
|
|
10801
12118
|
setIsLoading(false);
|
|
10802
12119
|
onClose();
|
|
10803
|
-
onSuccess(action, id, newFormValues.title, newFormValues["abstract"]);
|
|
12120
|
+
onSuccess(action, id, newFormValues.title, newFormValues.description, newFormValues["abstract"], newFormValues.labels);
|
|
10804
12121
|
};
|
|
10805
12122
|
newFormValues = Object.assign({}, formValues, {
|
|
10806
|
-
scope: scope
|
|
12123
|
+
scope: scope,
|
|
12124
|
+
componentType: componentType
|
|
10807
12125
|
});
|
|
10808
|
-
_context.prev =
|
|
12126
|
+
_context.prev = 4;
|
|
10809
12127
|
setError(null);
|
|
10810
12128
|
setIsLoading(true);
|
|
10811
12129
|
_context.t0 = action;
|
|
10812
|
-
_context.next = _context.t0 === PresetAction.SAVE_AS ?
|
|
12130
|
+
_context.next = _context.t0 === PresetAction.SAVE_AS ? 10 : _context.t0 === PresetAction.DELETE ? 15 : _context.t0 === PresetAction.EDIT ? 19 : _context.t0 === PresetAction.RESET ? 28 : 31;
|
|
10813
12131
|
break;
|
|
10814
|
-
case
|
|
10815
|
-
_context.next =
|
|
12132
|
+
case 10:
|
|
12133
|
+
_context.next = 12;
|
|
10816
12134
|
return api.saveViewPresetAs(newFormValues);
|
|
10817
|
-
case
|
|
12135
|
+
case 12:
|
|
10818
12136
|
newId = _context.sent;
|
|
10819
12137
|
handleSuccess(newId);
|
|
10820
|
-
return _context.abrupt("break",
|
|
10821
|
-
case
|
|
10822
|
-
_context.next =
|
|
12138
|
+
return _context.abrupt("break", 32);
|
|
12139
|
+
case 15:
|
|
12140
|
+
_context.next = 17;
|
|
10823
12141
|
return onDelete({
|
|
10824
12142
|
id: viewPresetId
|
|
10825
12143
|
});
|
|
10826
|
-
case
|
|
12144
|
+
case 17:
|
|
10827
12145
|
handleSuccess(viewPresetId);
|
|
10828
|
-
return _context.abrupt("break",
|
|
10829
|
-
case
|
|
10830
|
-
_context.next =
|
|
12146
|
+
return _context.abrupt("break", 32);
|
|
12147
|
+
case 19:
|
|
12148
|
+
_context.next = 21;
|
|
10831
12149
|
return api.getViewPreset(viewPresetId);
|
|
10832
|
-
case
|
|
12150
|
+
case 21:
|
|
10833
12151
|
_yield$api$getViewPre = _context.sent;
|
|
10834
12152
|
originalViewPreset = _yield$api$getViewPre.data;
|
|
10835
12153
|
viewPresetEdited = Object.assign({}, originalViewPreset, {
|
|
10836
12154
|
title: newFormValues.title,
|
|
12155
|
+
description: newFormValues.description,
|
|
10837
12156
|
"abstract": newFormValues["abstract"],
|
|
12157
|
+
labels: newFormValues.labels,
|
|
10838
12158
|
scope: scope
|
|
10839
12159
|
});
|
|
10840
|
-
_context.next =
|
|
12160
|
+
_context.next = 26;
|
|
10841
12161
|
return api.saveViewPreset(viewPresetId, viewPresetEdited);
|
|
10842
|
-
case
|
|
12162
|
+
case 26:
|
|
10843
12163
|
handleSuccess(viewPresetId);
|
|
10844
|
-
return _context.abrupt("break",
|
|
10845
|
-
case
|
|
12164
|
+
return _context.abrupt("break", 32);
|
|
12165
|
+
case 28:
|
|
10846
12166
|
onReset(viewPresetId);
|
|
10847
12167
|
handleSuccess(viewPresetId);
|
|
10848
|
-
return _context.abrupt("break",
|
|
10849
|
-
case 30:
|
|
10850
|
-
return _context.abrupt("break", 31);
|
|
12168
|
+
return _context.abrupt("break", 32);
|
|
10851
12169
|
case 31:
|
|
10852
|
-
_context.
|
|
12170
|
+
return _context.abrupt("break", 32);
|
|
12171
|
+
case 32:
|
|
12172
|
+
_context.next = 40;
|
|
10853
12173
|
break;
|
|
10854
|
-
case
|
|
10855
|
-
_context.prev =
|
|
10856
|
-
_context.t1 = _context["catch"](
|
|
12174
|
+
case 34:
|
|
12175
|
+
_context.prev = 34;
|
|
12176
|
+
_context.t1 = _context["catch"](4);
|
|
10857
12177
|
setIsLoading(false);
|
|
10858
12178
|
submitError = _context.t1;
|
|
10859
12179
|
message = isAxiosError(submitError) ? getAxiosErrorMessage(submitError) : submitError.message;
|
|
10860
12180
|
setError(message);
|
|
10861
|
-
case
|
|
12181
|
+
case 40:
|
|
10862
12182
|
case "end":
|
|
10863
12183
|
return _context.stop();
|
|
10864
12184
|
}
|
|
10865
|
-
}, _callee, null, [[
|
|
12185
|
+
}, _callee, null, [[4, 34]]);
|
|
10866
12186
|
}));
|
|
10867
12187
|
return function onFormSubmit(_x) {
|
|
10868
12188
|
return _ref2.apply(this, arguments);
|
|
@@ -10907,17 +12227,32 @@ var ViewPresetsFormDialog = function ViewPresetsFormDialog(_ref) {
|
|
|
10907
12227
|
return _ref3.apply(this, arguments);
|
|
10908
12228
|
};
|
|
10909
12229
|
}();
|
|
12230
|
+
var withLabelsPanel = action === PresetAction.SAVE_AS || action === PresetAction.EDIT;
|
|
10910
12231
|
return jsx(CustomDialog, {
|
|
10911
12232
|
"data-testid": "map-preset-dialog",
|
|
10912
|
-
title: title,
|
|
12233
|
+
title: withLabelsPanel ? undefined : title,
|
|
10913
12234
|
open: isOpen,
|
|
10914
12235
|
description: "",
|
|
10915
12236
|
onClose: onClose,
|
|
10916
12237
|
onSubmit: onSubmit,
|
|
12238
|
+
isResizable: true,
|
|
10917
12239
|
resizableDefaultSize: {
|
|
10918
|
-
width:
|
|
12240
|
+
width: withLabelsPanel ? 700 : 330,
|
|
12241
|
+
height: withLabelsPanel ? 650 : 'auto'
|
|
10919
12242
|
},
|
|
10920
|
-
|
|
12243
|
+
minWidth: withLabelsPanel ? 635 : undefined,
|
|
12244
|
+
sx: withLabelsPanel ? {
|
|
12245
|
+
'& [data-testid="dialog-action-header"]': {
|
|
12246
|
+
display: 'none'
|
|
12247
|
+
},
|
|
12248
|
+
'& .MuiDialogContent-root': {
|
|
12249
|
+
padding: 0,
|
|
12250
|
+
display: 'flex',
|
|
12251
|
+
flexDirection: 'column',
|
|
12252
|
+
height: '100%',
|
|
12253
|
+
overflow: 'hidden'
|
|
12254
|
+
}
|
|
12255
|
+
} : undefined,
|
|
10921
12256
|
actions: jsx(ConfirmationButtons, {
|
|
10922
12257
|
onClose: onClose,
|
|
10923
12258
|
cancelLabel: t('workspace-cancel'),
|
|
@@ -10925,14 +12260,22 @@ var ViewPresetsFormDialog = function ViewPresetsFormDialog(_ref) {
|
|
|
10925
12260
|
onSubmit: onSubmit,
|
|
10926
12261
|
confirmLabel: confirmLabel
|
|
10927
12262
|
}),
|
|
12263
|
+
headerActions: withLabelsPanel ? [] : undefined,
|
|
10928
12264
|
children: jsx(ViewPresetsForm, {
|
|
10929
12265
|
viewComponentType: viewComponentType,
|
|
10930
12266
|
formValues: formValues,
|
|
10931
12267
|
error: error,
|
|
10932
12268
|
onSubmit: onSubmit,
|
|
10933
|
-
action: action
|
|
12269
|
+
action: action,
|
|
12270
|
+
isLoading: isLoading,
|
|
12271
|
+
showInlineActions: withLabelsPanel,
|
|
12272
|
+
confirmLabel: confirmLabel,
|
|
12273
|
+
cancelLabel: t('workspace-cancel'),
|
|
12274
|
+
onClose: onClose,
|
|
12275
|
+
dialogTitle: title,
|
|
12276
|
+
labelsConfig: labelsConfig
|
|
10934
12277
|
})
|
|
10935
|
-
});
|
|
12278
|
+
}, withLabelsPanel ? 'wide' : 'narrow');
|
|
10936
12279
|
};
|
|
10937
12280
|
var ViewPresetsFormDialogWrapper = function ViewPresetsFormDialogWrapper(_ref5) {
|
|
10938
12281
|
var props = Object.assign({}, (_objectDestructuringEmpty(_ref5), _ref5));
|
|
@@ -10974,16 +12317,19 @@ var useDeleteViewPreset = function useDeleteViewPreset() {
|
|
|
10974
12317
|
};
|
|
10975
12318
|
|
|
10976
12319
|
var ViewPresetsFormDialogConnect = function ViewPresetsFormDialogConnect(_ref) {
|
|
12320
|
+
var _dialogOptions$formVa;
|
|
10977
12321
|
var _ref$scope = _ref.scope,
|
|
10978
|
-
scope = _ref$scope === void 0 ? 'user' : _ref$scope
|
|
12322
|
+
scope = _ref$scope === void 0 ? 'user' : _ref$scope,
|
|
12323
|
+
labelsConfig = _ref.labelsConfig;
|
|
10979
12324
|
var dispatch = useDispatch();
|
|
10980
12325
|
var dialogOptions = useSelector(function (store) {
|
|
10981
12326
|
return getDialogOptions(store);
|
|
10982
12327
|
});
|
|
10983
12328
|
var panelId = dialogOptions == null ? void 0 : dialogOptions.panelId;
|
|
10984
|
-
var
|
|
12329
|
+
var fallbackComponentType = useSelector(function (store) {
|
|
10985
12330
|
return getViewComponentType(store, panelId);
|
|
10986
12331
|
});
|
|
12332
|
+
var viewComponentType = (_dialogOptions$formVa = dialogOptions == null ? void 0 : dialogOptions.formValues.componentType) != null ? _dialogOptions$formVa : fallbackComponentType;
|
|
10987
12333
|
var _useDeleteViewPreset = useDeleteViewPreset(),
|
|
10988
12334
|
deleteViewPreset = _useDeleteViewPreset.mutateAsync;
|
|
10989
12335
|
var onReset = React__default.useCallback(function (viewPresetId) {
|
|
@@ -10999,14 +12345,16 @@ var ViewPresetsFormDialogConnect = function ViewPresetsFormDialogConnect(_ref) {
|
|
|
10999
12345
|
var onClose = function onClose() {
|
|
11000
12346
|
closeDialog();
|
|
11001
12347
|
};
|
|
11002
|
-
var onSuccess = function onSuccess(action, newViewPresetId, title, _abstract) {
|
|
12348
|
+
var onSuccess = function onSuccess(action, newViewPresetId, title, description, _abstract, labels) {
|
|
11003
12349
|
dispatch(viewPresetActions.onSuccessViewPresetAction({
|
|
11004
12350
|
panelId: panelId,
|
|
11005
12351
|
viewPresetId: newViewPresetId,
|
|
11006
12352
|
action: action,
|
|
11007
12353
|
title: title,
|
|
12354
|
+
description: description,
|
|
11008
12355
|
scope: scope,
|
|
11009
|
-
"abstract": _abstract
|
|
12356
|
+
"abstract": _abstract,
|
|
12357
|
+
labels: labels
|
|
11010
12358
|
}));
|
|
11011
12359
|
};
|
|
11012
12360
|
var isOpen = dialogOptions !== undefined;
|
|
@@ -11016,6 +12364,7 @@ var ViewPresetsFormDialogConnect = function ViewPresetsFormDialogConnect(_ref) {
|
|
|
11016
12364
|
onSuccess: onSuccess,
|
|
11017
12365
|
viewComponentType: viewComponentType,
|
|
11018
12366
|
formValues: dialogOptions == null ? void 0 : dialogOptions.formValues,
|
|
12367
|
+
labelsConfig: labelsConfig,
|
|
11019
12368
|
action: (dialogOptions == null ? void 0 : dialogOptions.action) || PresetAction.SAVE,
|
|
11020
12369
|
title: (dialogOptions == null ? void 0 : dialogOptions.title) || '',
|
|
11021
12370
|
viewPresetId: (dialogOptions == null ? void 0 : dialogOptions.viewPresetId) || '',
|
|
@@ -11036,6 +12385,8 @@ var WorkspaceDetail = function WorkspaceDetail(_ref) {
|
|
|
11036
12385
|
t = _useWorkspaceTranslat.t;
|
|
11037
12386
|
var _useAuthenticationCon = useAuthenticationContext(),
|
|
11038
12387
|
currentRole = _useAuthenticationCon.currentRole;
|
|
12388
|
+
var _useWorkspaceLabelsCo = useWorkspaceLabelsConfig(),
|
|
12389
|
+
labelsConfig = _useWorkspaceLabelsCo.data;
|
|
11039
12390
|
var isAdmin = (currentRole == null ? void 0 : currentRole.name) === GEOWEB_ROLE_PRESETS_ADMIN.name;
|
|
11040
12391
|
var error = useSelector(function (store) {
|
|
11041
12392
|
return getWorkspaceError(store);
|
|
@@ -11136,9 +12487,10 @@ var WorkspaceDetail = function WorkspaceDetail(_ref) {
|
|
|
11136
12487
|
})
|
|
11137
12488
|
})]
|
|
11138
12489
|
}), jsx(ViewPresetsFormDialogConnect, {
|
|
11139
|
-
scope: isAdmin ? 'system' : 'user'
|
|
12490
|
+
scope: isAdmin ? 'system' : 'user',
|
|
12491
|
+
labelsConfig: labelsConfig
|
|
11140
12492
|
})]
|
|
11141
12493
|
});
|
|
11142
12494
|
};
|
|
11143
12495
|
|
|
11144
|
-
export { ComponentsLookUpWrapper, DemoWrapper, PresetAction, ViewPresetErrorComponent, ViewPresetErrorType, WORKSPACE_NAMESPACE, WorkspaceDetail, WorkspaceErrorType, WorkspaceI18nProvider, WorkspaceModuleProvider, WorkspacePresetAction, WorkspaceStoreWrapper, WorkspaceThemeProvider, WorkspaceTopBar, WorkspaceViewConnect, WorkspaceWrapperProviderWithStore, createBalancedMosaicNode, createCustomEmptyMapWorkspace, defaultAuthConfig, getEmptyMapWorkspace, getWorkspaceRouteUrl, selectors$2 as selectors, viewPresetActions, viewPresetsListReducer, viewPresetsListener, viewPresetsReducer, workspaceActions, workspaceListActions, workspaceListListener, workspaceListReducer, workspaceListener, workspaceMiddlewares, workspaceReducer, workspaceReducersMap, routes as workspaceRoutes, workspaceTranslations };
|
|
12496
|
+
export { ALL_COMPONENT_TYPES, AVIATION_COMPONENT_TYPES, CAP_COMPONENT_TYPES, ComponentsLookUpWrapper, DemoWrapper, PresetAction, SUPPORTED_COMPONENT_TYPES, SUPPORTED_TIMESERIES_COMPONENT_TYPES, ViewPresetErrorComponent, ViewPresetErrorType, WARNING_LIST_COMPONENT_TYPES, WORKSPACE_NAMESPACE, WorkspaceDetail, WorkspaceErrorType, WorkspaceI18nProvider, WorkspaceModuleProvider, WorkspacePresetAction, WorkspaceStoreWrapper, WorkspaceThemeProvider, WorkspaceTopBar, WorkspaceViewConnect, WorkspaceWrapperProviderWithStore, createBalancedMosaicNode, createCustomEmptyMapWorkspace, defaultAuthConfig, getEmptyMapWorkspace, getWorkspaceRouteUrl, selectors$2 as selectors, viewPresetActions, viewPresetsListReducer, viewPresetsListener, viewPresetsReducer, workspaceActions, workspaceListActions, workspaceListListener, workspaceListReducer, workspaceListener, workspaceMiddlewares, workspaceReducer, workspaceReducersMap, routes as workspaceRoutes, workspaceTranslations };
|