@opengeoweb/workspace 19.6.1 → 20.0.0-nightly-20260918
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/dist/index.esm.js +454 -33
- package/dist/src/lib/api/types.d.ts +11 -0
- package/dist/src/lib/api/user-preferences/api.d.ts +8 -0
- package/dist/src/lib/api/user-preferences/fakeApi.d.ts +2 -0
- package/dist/src/lib/api/user-preferences/hooks.d.ts +3 -0
- package/dist/src/lib/api/utils.d.ts +5 -1
- package/dist/src/lib/components/WorkspaceSelectList/WorkspaceSelectList.d.ts +3 -0
- package/dist/src/lib/components/WorkspaceSelectList/WorkspaceSelectListRow.d.ts +3 -0
- package/dist/src/lib/store/viewPresets/selectors.d.ts +91 -0
- package/dist/src/lib/store/viewPresets/types.d.ts +1 -0
- package/dist/src/lib/store/workspace/selectors.d.ts +4 -4
- package/dist/src/lib/store/workspace/types.d.ts +2 -0
- package/dist/src/lib/store/workspaceList/selectors.d.ts +22 -0
- package/dist/src/lib/store/workspaceList/types.d.ts +3 -1
- package/package.json +67 -67
package/dist/index.esm.js
CHANGED
|
@@ -5,7 +5,7 @@ import { syncGroupsTypes, FEATURE_GROUP_PREFIX, syncGroupsActions, layerActions,
|
|
|
5
5
|
import { timeSeriesActions, TimeSeriesTypes, timeSeriesSelectors, timeSeriesReducer } from '@opengeoweb/time-series';
|
|
6
6
|
import { chunk, cloneDeep, isEqual, isString } from 'lodash';
|
|
7
7
|
import { getLeaves, createBalancedTreeFromLeaves, MosaicContext, getAndAssertNodeAtPathExists, MosaicWindow, Mosaic } from 'react-mosaic-component';
|
|
8
|
-
import { queryOptions,
|
|
8
|
+
import { queryOptions, useQueryClient, useQuery, useMutation, useIsMutating } from '@tanstack/react-query';
|
|
9
9
|
import { sessionStorageProvider, isAxiosError, getAxiosErrorMessage, isAuthError, isAxiosAuthError, SHARED_NAMESPACE, safelyInitI18nForTestsAndStories, sharedTranslations, ConfirmationServiceProvider, CustomIconButton, useConfirmationDialog, usePrevious, AlertBanner, CustomAccordion, CustomTooltip, linkifyText, dateUtils, SystemScope, SearchHighlight, ToggleMenu, SearchField, Filter, LastUpdateTime, renderCounter, CustomDialog, ToolContainer, CustomToggleButton, ConfirmationButtons } from '@opengeoweb/shared';
|
|
10
10
|
import { pluginsActions, getPluginState, pluginsReducer, PluginProvider, PluginDebugProvider, OverlayPluginMenuButton, usePluginCatalog } from '@opengeoweb/plugins';
|
|
11
11
|
import { warningsFiltersActions, publicWarningsSelectors, warningsTranslations, WARN_NAMESPACE } from '@opengeoweb/warnings';
|
|
@@ -15,7 +15,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
15
15
|
import { useTranslation, I18nextProvider } from 'react-i18next';
|
|
16
16
|
import { Provider, useDispatch, useSelector, useStore, shallowEqual } from 'react-redux';
|
|
17
17
|
import { AuthenticationProvider, useAuthenticationContext, GEOWEB_ROLE_PRESETS_ADMIN } from '@opengeoweb/authentication';
|
|
18
|
-
import { ThemeWrapper, lightTheme, Link, LinkOff, SplitHorizontal, SplitVertical, SplitHorizontalWithContent, SplitVerticalWithContent, Expand, UnExpand, ChevronDown, Close, ChevronUp, LockLocked, Info, WorkspacePresetsSystemIcon, WorkspacePresetsPluginIcon, SharedPresetsMyUser, SharedPresetsOtherUsers, WorkspacePresetsMyIcon, BackdropStyle, Options, CloudLoading, CloudIdle, WebAssetOff, Exclamation } from '@opengeoweb/theme';
|
|
18
|
+
import { ThemeWrapper, lightTheme, Link, LinkOff, SplitHorizontal, SplitVertical, SplitHorizontalWithContent, SplitVerticalWithContent, Expand, UnExpand, ChevronDown, Close, ChevronUp, LockLocked, Star, StarOutline, Info, WorkspacePresetsSystemIcon, WorkspacePresetsPluginIcon, SharedPresetsMyUser, SharedPresetsOtherUsers, WorkspacePresetsMyIcon, BackdropStyle, Options, CloudLoading, CloudIdle, WebAssetOff, Exclamation } from '@opengeoweb/theme';
|
|
19
19
|
import i18n from 'i18next';
|
|
20
20
|
import { coreTranslations, CORE_NAMESPACE, LoadingIndicatorProgressBar } from '@opengeoweb/core';
|
|
21
21
|
import { formFieldsTranslations, FORM_FIELDS_NAMESPACE, ReactHookFormHiddenInput, ReactHookFormTextField, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
|
|
@@ -28,6 +28,10 @@ import { List as List$1 } from 'react-window';
|
|
|
28
28
|
import { http, HttpResponse, delay } from 'msw';
|
|
29
29
|
|
|
30
30
|
var en = {
|
|
31
|
+
"workspace-favourites": "Favourites",
|
|
32
|
+
"workspace-add-favourite": "Add {{title}} to favourites",
|
|
33
|
+
"workspace-remove-favourite": "Remove {{title}} from favourites",
|
|
34
|
+
"workspace-favourites-error": "Could not load or save favourites. Please try again.",
|
|
31
35
|
"workspace-menu": "Workspace menu",
|
|
32
36
|
"workspace-new": "New workspace",
|
|
33
37
|
"workspace-new-soundings": "New soundings workspace",
|
|
@@ -154,6 +158,9 @@ var en = {
|
|
|
154
158
|
"fetch-config-error-title": "An error has occured whilst fetching the label configuration",
|
|
155
159
|
"fetch-config-no-labels-available": "There are no labels available, please contact your administrator",
|
|
156
160
|
"workspace-versions": "Choose version",
|
|
161
|
+
"workspace-version": "Version {{version}}",
|
|
162
|
+
"workspace-version-current": "Version {{version}} (current)",
|
|
163
|
+
"workspace-version-default": "Version {{version}} (default)",
|
|
157
164
|
"workspace-copy-to-clipboard": "Copy workspace",
|
|
158
165
|
"workspace-paste-from-clipboard": "Paste workspace",
|
|
159
166
|
"workspace-copy-viewpreset-to-clipboard": "Copy view preset",
|
|
@@ -178,6 +185,10 @@ var en = {
|
|
|
178
185
|
"viewpreset-paste-validation-wrong-preset-type": "The clipboard contains a workspace preset, not a view preset."
|
|
179
186
|
};
|
|
180
187
|
var fi = {
|
|
188
|
+
"workspace-favourites": "Suosikit",
|
|
189
|
+
"workspace-add-favourite": "Lisää {{title}} suosikkeihin",
|
|
190
|
+
"workspace-remove-favourite": "Poista {{title}} suosikeista",
|
|
191
|
+
"workspace-favourites-error": "Suosikkeja ei voitu ladata tai tallentaa. Yritä uudelleen.",
|
|
181
192
|
"workspace-menu": "Workspace menu",
|
|
182
193
|
"workspace-new": "Uusi workspace",
|
|
183
194
|
"workspace-new-soundings": "Uusi luotaustyötila",
|
|
@@ -296,6 +307,9 @@ var fi = {
|
|
|
296
307
|
"workspace-presets-form-active-labels": "ei käännetty ({{count}})",
|
|
297
308
|
"workspace-label-active": "ACTIVE",
|
|
298
309
|
"workspace-versions": "Valitse versio",
|
|
310
|
+
"workspace-version": "Versio {{version}}",
|
|
311
|
+
"workspace-version-current": "Versio {{version}} (nykyinen)",
|
|
312
|
+
"workspace-version-default": "Versio {{version}} (oletus)",
|
|
299
313
|
"workspace-copy-to-clipboard": "Copy workspace",
|
|
300
314
|
"workspace-paste-from-clipboard": "Paste workspace",
|
|
301
315
|
"workspace-copy-viewpreset-to-clipboard": "Copy view preset",
|
|
@@ -320,6 +334,10 @@ var fi = {
|
|
|
320
334
|
"viewpreset-paste-validation-wrong-preset-type": "The clipboard contains a workspace preset, not a view preset."
|
|
321
335
|
};
|
|
322
336
|
var no = {
|
|
337
|
+
"workspace-favourites": "Favoritter",
|
|
338
|
+
"workspace-add-favourite": "Legg til {{title}} i favoritter",
|
|
339
|
+
"workspace-remove-favourite": "Fjern {{title}} fra favoritter",
|
|
340
|
+
"workspace-favourites-error": "Kunne ikke laste eller lagre favoritter. Vennligst prøv igjen.",
|
|
323
341
|
"workspace-menu": "Arbeidsflater",
|
|
324
342
|
"workspace-new": "Ny arbeidsflate",
|
|
325
343
|
"workspace-new-soundings": "New soundings workspace",
|
|
@@ -439,6 +457,9 @@ var no = {
|
|
|
439
457
|
"workspace-presets-form-active-labels": "Aktive valg ({{count}})",
|
|
440
458
|
"workspace-label-active": "AKTIV",
|
|
441
459
|
"workspace-versions": "Velg versjon",
|
|
460
|
+
"workspace-version": "Versjon {{version}}",
|
|
461
|
+
"workspace-version-current": "Versjon {{version}} (gjeldende)",
|
|
462
|
+
"workspace-version-default": "Versjon {{version}} (standard)",
|
|
442
463
|
"workspace-copy-to-clipboard": "Kopier arbeidsflate som JSON",
|
|
443
464
|
"workspace-paste-from-clipboard": "Last arbeidsflate fra JSON",
|
|
444
465
|
"workspace-copy-viewpreset-to-clipboard": "Kopier snarvei som JSON",
|
|
@@ -463,6 +484,10 @@ var no = {
|
|
|
463
484
|
"viewpreset-paste-validation-wrong-preset-type": "Utklippstavlen inneholder en Arbeidsflate, ikke en Snarvei."
|
|
464
485
|
};
|
|
465
486
|
var nl = {
|
|
487
|
+
"workspace-favourites": "Favorieten",
|
|
488
|
+
"workspace-add-favourite": "Voeg {{title}} toe aan favorieten",
|
|
489
|
+
"workspace-remove-favourite": "Verwijder {{title}} uit favorieten",
|
|
490
|
+
"workspace-favourites-error": "Kon favorieten niet laden of opslaan. Probeer het opnieuw.",
|
|
466
491
|
"workspace-menu": "Workspace menu",
|
|
467
492
|
"workspace-new": "Nieuwe workspace",
|
|
468
493
|
"workspace-new-soundings": "Nieuwe soundings workspace",
|
|
@@ -587,6 +612,9 @@ var nl = {
|
|
|
587
612
|
"fetch-config-error-title": "Het ophalen van de label configuratie is mislukt",
|
|
588
613
|
"fetch-config-no-labels-available": "Er zijn geen labels beschikbaar, neem contact op met de administrator",
|
|
589
614
|
"workspace-versions": "Kies een versie",
|
|
615
|
+
"workspace-version": "Versie {{version}}",
|
|
616
|
+
"workspace-version-current": "Versie {{version}} (huidig)",
|
|
617
|
+
"workspace-version-default": "Versie {{version}} (standaard)",
|
|
590
618
|
"workspace-copy-to-clipboard": "Kopieer als JSON",
|
|
591
619
|
"workspace-paste-from-clipboard": "Laad vanuit JSON",
|
|
592
620
|
"workspace-copy-viewpreset-to-clipboard": "Kopieer view preset als JSON",
|
|
@@ -1246,6 +1274,20 @@ var filterWorkspacePresetList = function filterWorkspacePresetList(params) {
|
|
|
1246
1274
|
return true;
|
|
1247
1275
|
});
|
|
1248
1276
|
};
|
|
1277
|
+
var favouritePresetKey = function favouritePresetKey(type, preset) {
|
|
1278
|
+
return type + ":" + preset.id;
|
|
1279
|
+
};
|
|
1280
|
+
var updateCachedFavourite = function updateCachedFavourite(client, queryKey, key, isFavourite) {
|
|
1281
|
+
client.setQueryData(queryKey, function (preferences) {
|
|
1282
|
+
var _preferences$favourit;
|
|
1283
|
+
var favourites = (_preferences$favourit = preferences == null ? void 0 : preferences.favouritePresets) != null ? _preferences$favourit : [];
|
|
1284
|
+
return Object.assign({}, preferences, {
|
|
1285
|
+
favouritePresets: isFavourite ? Array.from(new Set([].concat(favourites, [key]))) : favourites.filter(function (value) {
|
|
1286
|
+
return value !== key;
|
|
1287
|
+
})
|
|
1288
|
+
});
|
|
1289
|
+
});
|
|
1290
|
+
};
|
|
1249
1291
|
|
|
1250
1292
|
var getViewPreset = /*#__PURE__*/function () {
|
|
1251
1293
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(viewpresetId, auth) {
|
|
@@ -1602,6 +1644,7 @@ var PresetFilterType;
|
|
|
1602
1644
|
PresetFilterType["shared"] = "shared";
|
|
1603
1645
|
PresetFilterType["system"] = "system";
|
|
1604
1646
|
PresetFilterType["plugin"] = "plugin";
|
|
1647
|
+
PresetFilterType["favourites"] = "favourites";
|
|
1605
1648
|
})(PresetFilterType || (PresetFilterType = {}));
|
|
1606
1649
|
|
|
1607
1650
|
/* *
|
|
@@ -1699,6 +1742,18 @@ var slice$2 = createSlice({
|
|
|
1699
1742
|
id = _action$payload.id,
|
|
1700
1743
|
isSelected = _action$payload.isSelected,
|
|
1701
1744
|
isAdmin = _action$payload.isAdmin;
|
|
1745
|
+
if (id === PresetFilterType.favourites) {
|
|
1746
|
+
draft.favouritesOnly = isSelected;
|
|
1747
|
+
draft.workspaceListFilters = draft.workspaceListFilters.map(function (filter) {
|
|
1748
|
+
return Object.assign({}, filter, {
|
|
1749
|
+
isSelected: true
|
|
1750
|
+
});
|
|
1751
|
+
});
|
|
1752
|
+
return;
|
|
1753
|
+
}
|
|
1754
|
+
if (draft.favouritesOnly) {
|
|
1755
|
+
draft.favouritesOnly = false;
|
|
1756
|
+
}
|
|
1702
1757
|
var relevantFilters = isAdmin ? draft.workspaceListFilters.filter(function (filter) {
|
|
1703
1758
|
return filter.id === 'system' || filter.id === 'shared';
|
|
1704
1759
|
}) : draft.workspaceListFilters;
|
|
@@ -1735,6 +1790,9 @@ var slice$2 = createSlice({
|
|
|
1735
1790
|
}
|
|
1736
1791
|
},
|
|
1737
1792
|
setSelectAllFilterChip: function setSelectAllFilterChip(draft) {
|
|
1793
|
+
if (draft.favouritesOnly) {
|
|
1794
|
+
draft.favouritesOnly = false;
|
|
1795
|
+
}
|
|
1738
1796
|
draft.workspaceListFilters = draft.workspaceListFilters.map(function (filter) {
|
|
1739
1797
|
return Object.assign({}, filter, {
|
|
1740
1798
|
isSelected: true
|
|
@@ -1816,7 +1874,7 @@ var viewPresetsAdapter = createEntityAdapter({
|
|
|
1816
1874
|
var initialState$1 = viewPresetsAdapter.getInitialState();
|
|
1817
1875
|
var warningsPresetChangeActions = [warningsFiltersActions.setWarningFilters, warningsFiltersActions.setExpandedSectionsForPanel];
|
|
1818
1876
|
var syncGroupChangeActions = [syncGroupsActions.syncGroupRemoveTarget, syncGroupsActions.syncGroupAddTarget];
|
|
1819
|
-
var mapPresetChangeActions = [layerActions.setBaseLayers, layerActions.layerDelete, layerActions.addLayer, layerActions.duplicateMapLayer, layerActions.layerChangeEnabled, layerActions.layerChangeName, layerActions.layerChangeStyle, layerActions.layerChangeOpacity, layerActions.layerChangeDimension, layerActions.layerChangeAcceptanceTime, layerActions.SetLayerLegendVisibilityPayload, mapActions.layerMoveLayer, mapActions.setAutoLayerId, mapActions.setAutoTimestepLayerId, mapActions.setAutoUpdateLayerId, mapActions.toggleAutoUpdate, mapActions.mapStartAnimation, mapActions.mapStopAnimation, mapActions.toggleTimeSliderIsVisible, mapActions.setTimeStep, mapActions.setTimeSliderSpan, mapActions.toggleTimeSpanAuto, mapActions.setAnimationDelay, mapActions.toggleTimestepAuto, mapActions.setAnimationStartTime, mapActions.setAnimationEndTime, mapActions.changeOverlayer, uiActions.setActiveMapIdForDialog, uiActions.setToggleOpenDialog, genericActions.setBbox, mapActions.setBbox, mapActions.toggleClock, mapActions.toggleClockOptions, mapActions.setClockPositionSize, mapActions.setLegendPositionSize, mapActions.setDockedLayerManagerSize, mapActions.setDockedLayerManagerPosition, mapActions.setDockedLayerManagerDimensions];
|
|
1877
|
+
var mapPresetChangeActions = [layerActions.setBaseLayers, layerActions.layerDelete, layerActions.addLayer, layerActions.duplicateMapLayer, layerActions.layerChangeEnabled, layerActions.layerChangeName, layerActions.layerChangeStyle, layerActions.layerChangeOpacity, layerActions.layerChangeDimension, layerActions.layerChangeAcceptanceTime, layerActions.SetLayerLegendVisibilityPayload, mapActions.layerMoveLayer, mapActions.setAutoLayerId, mapActions.setAutoTimestepLayerId, mapActions.setAutoUpdateLayerId, mapActions.toggleAutoUpdate, mapActions.mapStartAnimation, mapActions.mapStopAnimation, mapActions.toggleTimeSliderIsVisible, mapActions.setTimeStep, mapActions.setTimeSliderSpan, mapActions.toggleTimeSpanAuto, mapActions.setAnimationDelay, mapActions.toggleTimestepAuto, mapActions.setAnimationStartTime, mapActions.setAnimationEndTime, mapActions.setAnimationLength, mapActions.changeOverlayer, uiActions.setActiveMapIdForDialog, uiActions.setToggleOpenDialog, genericActions.setBbox, mapActions.setBbox, mapActions.toggleClock, mapActions.toggleClockOptions, mapActions.setClockPositionSize, mapActions.setLegendPositionSize, mapActions.setDockedLayerManagerSize, mapActions.setDockedLayerManagerPosition, mapActions.setDockedLayerManagerDimensions];
|
|
1820
1878
|
var pluginPresetChangeActions = [pluginsActions.setGeoWebPluginState];
|
|
1821
1879
|
var timeSeriesPresetChangeActions = [timeSeriesActions.addParameter, timeSeriesActions.addPlot, timeSeriesActions.deleteParameter, timeSeriesActions.deletePlot, timeSeriesActions.moveParameter, timeSeriesActions.movePlot, timeSeriesActions.toggleParameter, timeSeriesActions.togglePlot, timeSeriesActions.patchParameter, timeSeriesActions.updateTitle, timeSeriesActions.setLocationMenuSizeAndPosition, timeSeriesActions.setLocationsDialogOpen];
|
|
1822
1880
|
var soundingsChangeActions = [soundingsActions.updateSelectedSource, soundingsActions.updateSelectedLocation, soundingsActions.updateDiagramType, soundingsActions.toggleLocationMarkers, soundingsActions.updateProfileDataPreferences, soundingsActions.changeSoundingPanelOrder, soundingsActions.toggleSoundingPanelVisibility, soundingsActions.setPanelIsOpen, soundingsActions.setPanelCustomWidth, soundingsActions.toggleLegendVisibility, soundingsActions.updateSelectedTime, soundingsActions.toggleTimeSliderVisibility, soundingsActions.setLocationMenuSizeAndPosition, soundingsActions.setLocationsMenuOpen];
|
|
@@ -1993,6 +2051,18 @@ var slice$1 = createSlice({
|
|
|
1993
2051
|
isAdmin = _action$payload1.isAdmin;
|
|
1994
2052
|
var entity = draft.entities[panelId];
|
|
1995
2053
|
if (entity) {
|
|
2054
|
+
if (id === PresetFilterType.favourites) {
|
|
2055
|
+
entity.favouritesOnly = isSelected;
|
|
2056
|
+
entity.filters = entity.filters.map(function (filter) {
|
|
2057
|
+
return Object.assign({}, filter, {
|
|
2058
|
+
isSelected: true
|
|
2059
|
+
});
|
|
2060
|
+
});
|
|
2061
|
+
return;
|
|
2062
|
+
}
|
|
2063
|
+
if (entity.favouritesOnly) {
|
|
2064
|
+
entity.favouritesOnly = false;
|
|
2065
|
+
}
|
|
1996
2066
|
var relevantFilters = isAdmin ? entity.filters.filter(function (filter) {
|
|
1997
2067
|
return filter.id === 'system' || filter.id === 'shared';
|
|
1998
2068
|
}) : entity.filters;
|
|
@@ -2033,6 +2103,9 @@ var slice$1 = createSlice({
|
|
|
2033
2103
|
var panelId = action.payload.panelId;
|
|
2034
2104
|
var entity = draft.entities[panelId];
|
|
2035
2105
|
if (entity) {
|
|
2106
|
+
if (entity.favouritesOnly) {
|
|
2107
|
+
entity.favouritesOnly = false;
|
|
2108
|
+
}
|
|
2036
2109
|
entity.filters = entity.filters.map(function (filter) {
|
|
2037
2110
|
return Object.assign({}, filter, {
|
|
2038
2111
|
isSelected: true
|
|
@@ -3272,6 +3345,10 @@ var getViewPresetLabelFilters = createSelector(getViewPresetById, function (_sto
|
|
|
3272
3345
|
}, function (viewPreset) {
|
|
3273
3346
|
return viewPreset == null ? void 0 : viewPreset.labelFilters;
|
|
3274
3347
|
}, selectorMemoizationOptions);
|
|
3348
|
+
var getFavouritesOnly$1 = createSelector(getViewPresetById, function (entity) {
|
|
3349
|
+
var _entity$favouritesOnl;
|
|
3350
|
+
return (_entity$favouritesOnl = entity == null ? void 0 : entity.favouritesOnly) != null ? _entity$favouritesOnl : false;
|
|
3351
|
+
});
|
|
3275
3352
|
|
|
3276
3353
|
/* *
|
|
3277
3354
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -3722,6 +3799,17 @@ var getWorkspaceLabelFilters = createSelector(getWorkspaceListStore, function (s
|
|
|
3722
3799
|
}, function (state) {
|
|
3723
3800
|
return state.workspaceLabelFilters;
|
|
3724
3801
|
}, selectorMemoizationOptions);
|
|
3802
|
+
var getFavouritesOnly = createSelector(getWorkspaceListStore, function (state) {
|
|
3803
|
+
var _state$favouritesOnly;
|
|
3804
|
+
return (_state$favouritesOnly = state == null ? void 0 : state.favouritesOnly) != null ? _state$favouritesOnly : false;
|
|
3805
|
+
});
|
|
3806
|
+
var filterAndSortFavouritePresets = function filterAndSortFavouritePresets(presets, isFavourite, favouritesOnly) {
|
|
3807
|
+
return presets.filter(function (preset) {
|
|
3808
|
+
return !favouritesOnly || isFavourite(preset);
|
|
3809
|
+
}).sort(function (first, second) {
|
|
3810
|
+
return Number(isFavourite(second)) - Number(isFavourite(first));
|
|
3811
|
+
});
|
|
3812
|
+
};
|
|
3725
3813
|
|
|
3726
3814
|
var emptyWorkspaceBEData = Object.assign({}, getEmptyMapWorkspace(), {
|
|
3727
3815
|
views: [{
|
|
@@ -4730,7 +4818,7 @@ viewPresetsListener.startListening({
|
|
|
4730
4818
|
mosaicNodeId: panelId,
|
|
4731
4819
|
viewPreset: {
|
|
4732
4820
|
componentType: 'Plugin',
|
|
4733
|
-
title: pluginMetaData.name,
|
|
4821
|
+
title: pluginMetaData.version ? pluginMetaData.name + " (" + pluginMetaData.version + ")" : pluginMetaData.name,
|
|
4734
4822
|
initialProps: {
|
|
4735
4823
|
id: pluginMetaData == null ? void 0 : pluginMetaData.id,
|
|
4736
4824
|
version: pluginMetaData == null ? void 0 : pluginMetaData.version
|
|
@@ -5746,6 +5834,171 @@ var defaultComponentsLookUp = function defaultComponentsLookUp(_ref3) {
|
|
|
5746
5834
|
}
|
|
5747
5835
|
};
|
|
5748
5836
|
|
|
5837
|
+
var getUserPreferences = /*#__PURE__*/function () {
|
|
5838
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(auth) {
|
|
5839
|
+
return _regenerator().w(function (_context) {
|
|
5840
|
+
while (1) switch (_context.n) {
|
|
5841
|
+
case 0:
|
|
5842
|
+
return _context.a(2, fetch(getPresetBaseUrl() + "/user/preferences", {
|
|
5843
|
+
headers: getHeaders(auth)
|
|
5844
|
+
}).then(handleResponse));
|
|
5845
|
+
}
|
|
5846
|
+
}, _callee);
|
|
5847
|
+
}));
|
|
5848
|
+
return function getUserPreferences(_x) {
|
|
5849
|
+
return _ref.apply(this, arguments);
|
|
5850
|
+
};
|
|
5851
|
+
}();
|
|
5852
|
+
var setFavouritePreset = /*#__PURE__*/function () {
|
|
5853
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(presetType, presetId, isFavourite, auth) {
|
|
5854
|
+
return _regenerator().w(function (_context2) {
|
|
5855
|
+
while (1) switch (_context2.n) {
|
|
5856
|
+
case 0:
|
|
5857
|
+
return _context2.a(2, fetch(getPresetBaseUrl() + "/user/preferences/favourite-presets/" + presetType + "/" + encodeURIComponent(presetId), {
|
|
5858
|
+
method: isFavourite ? 'PUT' : 'DELETE',
|
|
5859
|
+
headers: getHeaders(auth)
|
|
5860
|
+
}).then(handleResponse));
|
|
5861
|
+
}
|
|
5862
|
+
}, _callee2);
|
|
5863
|
+
}));
|
|
5864
|
+
return function setFavouritePreset(_x2, _x3, _x4, _x5) {
|
|
5865
|
+
return _ref2.apply(this, arguments);
|
|
5866
|
+
};
|
|
5867
|
+
}();
|
|
5868
|
+
|
|
5869
|
+
var useFavouritePresets = function useFavouritePresets(type) {
|
|
5870
|
+
var _useAuthenticationCon = useAuthenticationContext(),
|
|
5871
|
+
auth = _useAuthenticationCon.auth,
|
|
5872
|
+
isLoggedIn = _useAuthenticationCon.isLoggedIn;
|
|
5873
|
+
var client = useQueryClient();
|
|
5874
|
+
var queryKey = [LIB_KEY, 'user-preferences', auth == null ? void 0 : auth.username];
|
|
5875
|
+
var enabled = Boolean(auth && isLoggedIn && !hasNoPresetBackend());
|
|
5876
|
+
var query = useQuery({
|
|
5877
|
+
queryKey: queryKey,
|
|
5878
|
+
queryFn: function () {
|
|
5879
|
+
var _queryFn = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
5880
|
+
return _regenerator().w(function (_context) {
|
|
5881
|
+
while (1) switch (_context.n) {
|
|
5882
|
+
case 0:
|
|
5883
|
+
return _context.a(2, getUserPreferences(auth));
|
|
5884
|
+
}
|
|
5885
|
+
}, _callee);
|
|
5886
|
+
}));
|
|
5887
|
+
function queryFn() {
|
|
5888
|
+
return _queryFn.apply(this, arguments);
|
|
5889
|
+
}
|
|
5890
|
+
return queryFn;
|
|
5891
|
+
}(),
|
|
5892
|
+
enabled: enabled,
|
|
5893
|
+
retry: false
|
|
5894
|
+
});
|
|
5895
|
+
var mutation = useMutation({
|
|
5896
|
+
mutationKey: queryKey,
|
|
5897
|
+
scope: {
|
|
5898
|
+
id: JSON.stringify(queryKey)
|
|
5899
|
+
},
|
|
5900
|
+
mutationFn: function () {
|
|
5901
|
+
var _mutationFn = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(_ref) {
|
|
5902
|
+
var id, isFavourite;
|
|
5903
|
+
return _regenerator().w(function (_context2) {
|
|
5904
|
+
while (1) switch (_context2.n) {
|
|
5905
|
+
case 0:
|
|
5906
|
+
id = _ref.id, isFavourite = _ref.isFavourite;
|
|
5907
|
+
return _context2.a(2, setFavouritePreset(type, id, isFavourite, auth));
|
|
5908
|
+
}
|
|
5909
|
+
}, _callee2);
|
|
5910
|
+
}));
|
|
5911
|
+
function mutationFn(_x) {
|
|
5912
|
+
return _mutationFn.apply(this, arguments);
|
|
5913
|
+
}
|
|
5914
|
+
return mutationFn;
|
|
5915
|
+
}(),
|
|
5916
|
+
onMutate: function () {
|
|
5917
|
+
var _onMutate = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(_ref2) {
|
|
5918
|
+
var _previous$favouritePr, _previous$favouritePr2;
|
|
5919
|
+
var id, isFavourite, key, previous, wasFavourite;
|
|
5920
|
+
return _regenerator().w(function (_context3) {
|
|
5921
|
+
while (1) switch (_context3.n) {
|
|
5922
|
+
case 0:
|
|
5923
|
+
id = _ref2.id, isFavourite = _ref2.isFavourite;
|
|
5924
|
+
_context3.n = 1;
|
|
5925
|
+
return client.cancelQueries({
|
|
5926
|
+
queryKey: queryKey
|
|
5927
|
+
});
|
|
5928
|
+
case 1:
|
|
5929
|
+
key = favouritePresetKey(type, {
|
|
5930
|
+
id: id
|
|
5931
|
+
});
|
|
5932
|
+
previous = client.getQueryData(queryKey);
|
|
5933
|
+
wasFavourite = (_previous$favouritePr = previous == null || (_previous$favouritePr2 = previous.favouritePresets) == null ? void 0 : _previous$favouritePr2.includes(key)) != null ? _previous$favouritePr : false;
|
|
5934
|
+
updateCachedFavourite(client, queryKey, key, isFavourite);
|
|
5935
|
+
// Undo only this favourite, preserving other cached preference changes.
|
|
5936
|
+
return _context3.a(2, function () {
|
|
5937
|
+
return updateCachedFavourite(client, queryKey, key, wasFavourite);
|
|
5938
|
+
});
|
|
5939
|
+
}
|
|
5940
|
+
}, _callee3);
|
|
5941
|
+
}));
|
|
5942
|
+
function onMutate(_x2) {
|
|
5943
|
+
return _onMutate.apply(this, arguments);
|
|
5944
|
+
}
|
|
5945
|
+
return onMutate;
|
|
5946
|
+
}(),
|
|
5947
|
+
onError: function onError(_error, _variables, rollback) {
|
|
5948
|
+
return rollback == null ? void 0 : rollback();
|
|
5949
|
+
},
|
|
5950
|
+
onSuccess: function () {
|
|
5951
|
+
var _onSuccess = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(preferences) {
|
|
5952
|
+
return _regenerator().w(function (_context4) {
|
|
5953
|
+
while (1) switch (_context4.n) {
|
|
5954
|
+
case 0:
|
|
5955
|
+
_context4.n = 1;
|
|
5956
|
+
return client.cancelQueries({
|
|
5957
|
+
queryKey: queryKey
|
|
5958
|
+
});
|
|
5959
|
+
case 1:
|
|
5960
|
+
client.setQueryData(queryKey, preferences);
|
|
5961
|
+
case 2:
|
|
5962
|
+
return _context4.a(2);
|
|
5963
|
+
}
|
|
5964
|
+
}, _callee4);
|
|
5965
|
+
}));
|
|
5966
|
+
function onSuccess(_x3) {
|
|
5967
|
+
return _onSuccess.apply(this, arguments);
|
|
5968
|
+
}
|
|
5969
|
+
return onSuccess;
|
|
5970
|
+
}()
|
|
5971
|
+
});
|
|
5972
|
+
var isSaving = useIsMutating({
|
|
5973
|
+
mutationKey: queryKey
|
|
5974
|
+
}) > 0;
|
|
5975
|
+
var isFavourite = function isFavourite(preset) {
|
|
5976
|
+
var _query$data;
|
|
5977
|
+
return enabled && Array.isArray((_query$data = query.data) == null ? void 0 : _query$data.favouritePresets) && query.data.favouritePresets.includes(favouritePresetKey(type, preset));
|
|
5978
|
+
};
|
|
5979
|
+
return {
|
|
5980
|
+
isFavourite: isFavourite,
|
|
5981
|
+
toggleFavourite: function toggleFavourite(preset) {
|
|
5982
|
+
if (enabled) {
|
|
5983
|
+
mutation.mutate({
|
|
5984
|
+
id: preset.id,
|
|
5985
|
+
isFavourite: !isFavourite(preset)
|
|
5986
|
+
});
|
|
5987
|
+
}
|
|
5988
|
+
},
|
|
5989
|
+
disabled: !enabled || !query.isSuccess || query.isFetching || isSaving,
|
|
5990
|
+
isLoading: enabled && query.isFetching,
|
|
5991
|
+
isSaving: isSaving,
|
|
5992
|
+
error: enabled ? query.error || mutation.error : null,
|
|
5993
|
+
retry: function retry() {
|
|
5994
|
+
mutation.reset();
|
|
5995
|
+
if (enabled) {
|
|
5996
|
+
void query.refetch();
|
|
5997
|
+
}
|
|
5998
|
+
}
|
|
5999
|
+
};
|
|
6000
|
+
};
|
|
6001
|
+
|
|
5749
6002
|
var useDeleteViewPreset = function useDeleteViewPreset() {
|
|
5750
6003
|
var _useAuthenticationCon = useAuthenticationContext(),
|
|
5751
6004
|
auth = _useAuthenticationCon.auth;
|
|
@@ -7169,8 +7422,12 @@ var getPresetIcon = function getPresetIcon(preset, currentUsername) {
|
|
|
7169
7422
|
return null;
|
|
7170
7423
|
};
|
|
7171
7424
|
var WorkspaceSelectListRow = function WorkspaceSelectListRow(_ref) {
|
|
7172
|
-
var _workspacePreset$desc, _workspacePreset$orig, _workspacePreset$orig2;
|
|
7425
|
+
var _workspacePreset$desc, _workspacePreset$orig, _workspacePreset$orig2, _workspacePreset$orig3, _workspacePreset$orig4;
|
|
7173
7426
|
var workspacePreset = _ref.workspacePreset,
|
|
7427
|
+
_ref$isFavourite = _ref.isFavourite,
|
|
7428
|
+
isFavourite = _ref$isFavourite === void 0 ? false : _ref$isFavourite,
|
|
7429
|
+
onToggleFavourite = _ref.onToggleFavourite,
|
|
7430
|
+
favouritesDisabled = _ref.favouritesDisabled,
|
|
7174
7431
|
isSelected = _ref.isSelected,
|
|
7175
7432
|
onClickWorkspacePreset = _ref.onClickWorkspacePreset,
|
|
7176
7433
|
onClickWorkspacePresetOption = _ref.onClickWorkspacePresetOption,
|
|
@@ -7259,6 +7516,17 @@ var WorkspaceSelectListRow = function WorkspaceSelectListRow(_ref) {
|
|
|
7259
7516
|
});
|
|
7260
7517
|
}
|
|
7261
7518
|
var versions = workspacePreset.scope === 'plugin' ? (_workspacePreset$orig = (_workspacePreset$orig2 = workspacePreset.origin) == null ? void 0 : _workspacePreset$orig2.versions) != null ? _workspacePreset$orig : [] : [];
|
|
7519
|
+
var defaultVersion = (_workspacePreset$orig3 = workspacePreset.origin) == null ? void 0 : _workspacePreset$orig3.version;
|
|
7520
|
+
var activeVersion = (_workspacePreset$orig4 = workspacePreset.origin) == null ? void 0 : _workspacePreset$orig4.activeVersion;
|
|
7521
|
+
var getVersionLabelKey = function getVersionLabelKey(version) {
|
|
7522
|
+
if (version === activeVersion) {
|
|
7523
|
+
return 'workspace-version-current';
|
|
7524
|
+
}
|
|
7525
|
+
if (version === defaultVersion) {
|
|
7526
|
+
return 'workspace-version-default';
|
|
7527
|
+
}
|
|
7528
|
+
return 'workspace-version';
|
|
7529
|
+
};
|
|
7262
7530
|
var showInfoIcon = !!workspacePreset.id && workspacePreset.id !== LOCAL_SOUNDINGS_ID;
|
|
7263
7531
|
return jsx(ListItem, {
|
|
7264
7532
|
disablePadding: true,
|
|
@@ -7300,12 +7568,42 @@ var WorkspaceSelectListRow = function WorkspaceSelectListRow(_ref) {
|
|
|
7300
7568
|
role: "listitem",
|
|
7301
7569
|
selected: isSelected,
|
|
7302
7570
|
sx: {
|
|
7303
|
-
pl: 2,
|
|
7571
|
+
pl: isNewPreset ? 2 : 1,
|
|
7572
|
+
minWidth: 0,
|
|
7304
7573
|
pr: 1,
|
|
7305
7574
|
py: 1,
|
|
7306
7575
|
height: WORKSPACE_SELECT_LIST_ROW_HEIGHT + "px"
|
|
7307
7576
|
},
|
|
7308
|
-
children: [jsx(
|
|
7577
|
+
children: [!isNewPreset ? jsx(Box, {
|
|
7578
|
+
onClick: function onClick(event) {
|
|
7579
|
+
// Disabled icon buttons pass pointer clicks to their container.
|
|
7580
|
+
event.stopPropagation();
|
|
7581
|
+
},
|
|
7582
|
+
sx: {
|
|
7583
|
+
pr: 1,
|
|
7584
|
+
flexShrink: 0
|
|
7585
|
+
},
|
|
7586
|
+
children: jsx(CustomIconButton, {
|
|
7587
|
+
"aria-label": t(isFavourite ? 'workspace-remove-favourite' : 'workspace-add-favourite', {
|
|
7588
|
+
title: workspacePreset.title
|
|
7589
|
+
}),
|
|
7590
|
+
disabled: favouritesDisabled || !onToggleFavourite,
|
|
7591
|
+
isSelected: isFavourite,
|
|
7592
|
+
onClick: function onClick(event) {
|
|
7593
|
+
event.stopPropagation();
|
|
7594
|
+
onToggleFavourite == null || onToggleFavourite(workspacePreset);
|
|
7595
|
+
},
|
|
7596
|
+
tooltipTitle: t(isFavourite ? 'workspace-remove-favourite' : 'workspace-add-favourite', {
|
|
7597
|
+
title: workspacePreset.title
|
|
7598
|
+
}),
|
|
7599
|
+
variant: "flat",
|
|
7600
|
+
children: isFavourite ? jsx(Star, {
|
|
7601
|
+
fontSize: "small"
|
|
7602
|
+
}) : jsx(StarOutline, {
|
|
7603
|
+
fontSize: "small"
|
|
7604
|
+
})
|
|
7605
|
+
})
|
|
7606
|
+
}) : null, jsx(ListItemIcon, {
|
|
7309
7607
|
children: getPresetIcon(workspacePreset, auth == null ? void 0 : auth.username)
|
|
7310
7608
|
}), jsx(ListItemText, {
|
|
7311
7609
|
primary: jsx(CustomTooltip, {
|
|
@@ -7385,12 +7683,15 @@ var WorkspaceSelectListRow = function WorkspaceSelectListRow(_ref) {
|
|
|
7385
7683
|
menuItems: menuItems,
|
|
7386
7684
|
menuPosition: "right",
|
|
7387
7685
|
menuTitle: t('workspace-options')
|
|
7388
|
-
}),
|
|
7389
|
-
buttonTestId: testIdPrefix + "-
|
|
7686
|
+
}), versions.length > 1 && jsx(ToggleMenu, {
|
|
7687
|
+
buttonTestId: testIdPrefix + "-listVersionsButton",
|
|
7390
7688
|
isDefaultOpen: isOptionsMenuOpen,
|
|
7391
7689
|
menuItems: versions.map(function (version) {
|
|
7392
7690
|
return {
|
|
7393
|
-
text:
|
|
7691
|
+
text: t(getVersionLabelKey(version), {
|
|
7692
|
+
version: version
|
|
7693
|
+
}),
|
|
7694
|
+
isSelected: version === (activeVersion != null ? activeVersion : defaultVersion),
|
|
7394
7695
|
action: function action() {
|
|
7395
7696
|
return onSelectVersion == null ? void 0 : onSelectVersion(workspacePreset.id, version);
|
|
7396
7697
|
}
|
|
@@ -7418,21 +7719,27 @@ var RowComponent = function RowComponent(_ref) {
|
|
|
7418
7719
|
isAdmin = _ref.isAdmin,
|
|
7419
7720
|
searchQuery = _ref.searchQuery,
|
|
7420
7721
|
testIdPrefix = _ref.testIdPrefix,
|
|
7421
|
-
onSelectVersion = _ref.onSelectVersion
|
|
7722
|
+
onSelectVersion = _ref.onSelectVersion,
|
|
7723
|
+
isFavourite = _ref.isFavourite,
|
|
7724
|
+
onToggleFavourite = _ref.onToggleFavourite,
|
|
7725
|
+
favouritesDisabled = _ref.favouritesDisabled;
|
|
7422
7726
|
var preset = items[index];
|
|
7423
7727
|
return jsx("div", {
|
|
7424
7728
|
style: Object.assign({}, style, {
|
|
7425
7729
|
paddingRight: '8px'
|
|
7426
7730
|
}),
|
|
7427
7731
|
children: jsx(WorkspaceSelectListRow, {
|
|
7732
|
+
favouritesDisabled: favouritesDisabled,
|
|
7428
7733
|
infoOpenPresetId: infoOpenPresetId,
|
|
7429
7734
|
isAdmin: isAdmin,
|
|
7430
7735
|
isEditable: isEditable,
|
|
7736
|
+
isFavourite: isFavourite == null ? void 0 : isFavourite(preset),
|
|
7431
7737
|
isSelected: currentSelectedId === preset.id || currentSelectedId === '' && preset.id === undefined,
|
|
7432
7738
|
onClickWorkspacePreset: onClickWorkspacePreset,
|
|
7433
7739
|
onClickWorkspacePresetOption: onClickWorkspacePresetOption,
|
|
7434
7740
|
onOpenPresetInfo: onOpenPresetInfo,
|
|
7435
7741
|
onSelectVersion: onSelectVersion,
|
|
7742
|
+
onToggleFavourite: onToggleFavourite,
|
|
7436
7743
|
searchQuery: searchQuery,
|
|
7437
7744
|
testIdPrefix: testIdPrefix,
|
|
7438
7745
|
workspacePreset: preset
|
|
@@ -7457,13 +7764,22 @@ var WorkspaceSelectList = function WorkspaceSelectList(_ref2) {
|
|
|
7457
7764
|
testIdPrefix = _ref2$testIdPrefix === void 0 ? 'workspace' : _ref2$testIdPrefix,
|
|
7458
7765
|
onOpenPresetInfo = _ref2.onOpenPresetInfo,
|
|
7459
7766
|
infoOpenPresetId = _ref2.infoOpenPresetId,
|
|
7460
|
-
onSelectVersion = _ref2.onSelectVersion
|
|
7767
|
+
onSelectVersion = _ref2.onSelectVersion,
|
|
7768
|
+
isFavourite = _ref2.isFavourite,
|
|
7769
|
+
onToggleFavourite = _ref2.onToggleFavourite,
|
|
7770
|
+
favouritesDisabled = _ref2.favouritesDisabled;
|
|
7461
7771
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7462
7772
|
t = _useWorkspaceTranslat.t;
|
|
7463
7773
|
var items = React.useMemo(function () {
|
|
7464
7774
|
var newPresetsTruthy = newPresets && newPresets.length > 0 ? newPresets : [getEmptyWorkspaceListItem(t), getNewSoundingsWorkspaceListItem(t)];
|
|
7465
|
-
|
|
7466
|
-
|
|
7775
|
+
var favourites = workspacePresets.filter(function (preset) {
|
|
7776
|
+
return isFavourite == null ? void 0 : isFavourite(preset);
|
|
7777
|
+
});
|
|
7778
|
+
var otherPresets = workspacePresets.filter(function (preset) {
|
|
7779
|
+
return !(isFavourite != null && isFavourite(preset));
|
|
7780
|
+
});
|
|
7781
|
+
return [].concat(favourites, !hideNewWorkspace ? newPresetsTruthy : [], otherPresets);
|
|
7782
|
+
}, [hideNewWorkspace, newPresets, workspacePresets, isFavourite, t]);
|
|
7467
7783
|
return jsxs(Box, {
|
|
7468
7784
|
"data-testid": testIdPrefix + "-selectList",
|
|
7469
7785
|
sx: {
|
|
@@ -7498,7 +7814,10 @@ var WorkspaceSelectList = function WorkspaceSelectList(_ref2) {
|
|
|
7498
7814
|
isAdmin: isAdmin,
|
|
7499
7815
|
searchQuery: searchQuery,
|
|
7500
7816
|
testIdPrefix: testIdPrefix,
|
|
7501
|
-
onSelectVersion: onSelectVersion
|
|
7817
|
+
onSelectVersion: onSelectVersion,
|
|
7818
|
+
isFavourite: isFavourite,
|
|
7819
|
+
onToggleFavourite: onToggleFavourite,
|
|
7820
|
+
favouritesDisabled: favouritesDisabled
|
|
7502
7821
|
}
|
|
7503
7822
|
})
|
|
7504
7823
|
})]
|
|
@@ -7514,6 +7833,10 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
7514
7833
|
hasSpaceForLabelFilter = _ref$hasSpaceForLabel === void 0 ? true : _ref$hasSpaceForLabel;
|
|
7515
7834
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
7516
7835
|
t = _useWorkspaceTranslat.t;
|
|
7836
|
+
var favourites = useFavouritePresets('view');
|
|
7837
|
+
var selectedFavouritesOnly = useSelector(function (state) {
|
|
7838
|
+
return getFavouritesOnly$1(state, panelId);
|
|
7839
|
+
});
|
|
7517
7840
|
var dispatch = useDispatch();
|
|
7518
7841
|
var queryClient = useQueryClient();
|
|
7519
7842
|
var store = useStore();
|
|
@@ -7521,11 +7844,18 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
7521
7844
|
currentRole = _useAuthenticationCon.currentRole,
|
|
7522
7845
|
isLoggedIn = _useAuthenticationCon.isLoggedIn,
|
|
7523
7846
|
auth = _useAuthenticationCon.auth;
|
|
7847
|
+
var favouritesOnly = isLoggedIn && selectedFavouritesOnly;
|
|
7524
7848
|
var username = (auth == null ? void 0 : auth.username) || '';
|
|
7525
7849
|
var isAdmin = (currentRole == null ? void 0 : currentRole.name) === GEOWEB_ROLE_PRESETS_ADMIN.name;
|
|
7526
7850
|
var scope = !isAdmin ? 'user' : 'system';
|
|
7527
7851
|
var _usePluginCatalog = usePluginCatalog(),
|
|
7528
7852
|
pluginCatalog = _usePluginCatalog.data;
|
|
7853
|
+
var panelView = useSelector(function (store) {
|
|
7854
|
+
return getViewById(store, panelId);
|
|
7855
|
+
});
|
|
7856
|
+
var runningPlugin = (panelView == null ? void 0 : panelView.componentType) === 'Plugin' ? panelView.initialProps : undefined;
|
|
7857
|
+
var runningPluginId = runningPlugin == null ? void 0 : runningPlugin.id;
|
|
7858
|
+
var runningPluginVersion = runningPlugin == null ? void 0 : runningPlugin.version;
|
|
7529
7859
|
var pluginCatalogAsPresets = React.useMemo(function () {
|
|
7530
7860
|
return Object.entries(pluginCatalog != null ? pluginCatalog : {}).filter(function (_ref2) {
|
|
7531
7861
|
var plugin = _ref2[1];
|
|
@@ -7547,13 +7877,16 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
7547
7877
|
origin: {
|
|
7548
7878
|
type: 'plugin',
|
|
7549
7879
|
pluginId: id,
|
|
7550
|
-
versions: plugin.versions
|
|
7880
|
+
versions: plugin.versions,
|
|
7881
|
+
version: plugin.version,
|
|
7882
|
+
// Adds active version for plugins
|
|
7883
|
+
activeVersion: runningPluginId === id ? runningPluginVersion != null ? runningPluginVersion : plugin.version : undefined
|
|
7551
7884
|
},
|
|
7552
7885
|
date: plugin.created,
|
|
7553
7886
|
updated: plugin.modified
|
|
7554
7887
|
};
|
|
7555
7888
|
});
|
|
7556
|
-
}, [pluginCatalog]);
|
|
7889
|
+
}, [pluginCatalog, runningPluginId, runningPluginVersion]);
|
|
7557
7890
|
var _useViewPresets = useViewPresets(),
|
|
7558
7891
|
viewPresets = _useViewPresets.data,
|
|
7559
7892
|
isViewPresetsListFetching = _useViewPresets.isFetching;
|
|
@@ -7580,12 +7913,13 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
7580
7913
|
}
|
|
7581
7914
|
return Object.values(viewPresetLabelFilters).flat().length;
|
|
7582
7915
|
}, [viewPresetLabelFilters]);
|
|
7583
|
-
var
|
|
7916
|
+
var matchingPresets = React.useMemo(function () {
|
|
7584
7917
|
if (viewPresets) {
|
|
7585
7918
|
return [].concat(filterAndSortPresets([].concat(viewPresets, pluginCatalogAsPresets), viewPresetListFilters, username, isAdmin, viewPresetLabelFilters != null ? viewPresetLabelFilters : undefined, viewPresetListSearchQuery));
|
|
7586
7919
|
}
|
|
7587
7920
|
return [];
|
|
7588
7921
|
}, [viewPresets, viewPresetListFilters, username, isAdmin, viewPresetLabelFilters, viewPresetListSearchQuery, pluginCatalogAsPresets]);
|
|
7922
|
+
var filteredPresets = filterAndSortFavouritePresets(matchingPresets, favourites.isFavourite, favouritesOnly);
|
|
7589
7923
|
var labelsFormMethods = useForm({
|
|
7590
7924
|
defaultValues: {
|
|
7591
7925
|
labels: viewPresetLabelFilters
|
|
@@ -7916,15 +8250,23 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
7916
8250
|
flexDirection: 'column',
|
|
7917
8251
|
height: '100%'
|
|
7918
8252
|
},
|
|
7919
|
-
children: [jsx(
|
|
8253
|
+
children: [!!favourites.error && jsx(AlertBanner, {
|
|
8254
|
+
actionButtonProps: {
|
|
8255
|
+
title: t('workspace-retry'),
|
|
8256
|
+
onClick: favourites.retry
|
|
8257
|
+
},
|
|
8258
|
+
info: t('workspace-favourites-error'),
|
|
8259
|
+
title: t('workspace-favourites')
|
|
8260
|
+
}), jsx(Box, {
|
|
7920
8261
|
sx: {
|
|
7921
8262
|
height: 4,
|
|
8263
|
+
flexShrink: 0,
|
|
7922
8264
|
overflow: 'hidden'
|
|
7923
8265
|
},
|
|
7924
|
-
children:
|
|
8266
|
+
children: isViewPresetsListFetching || favourites.isLoading || favourites.isSaving ? jsx(LinearProgress, {
|
|
7925
8267
|
color: "secondary",
|
|
7926
8268
|
"data-testid": "loading-bar"
|
|
7927
|
-
})
|
|
8269
|
+
}) : null
|
|
7928
8270
|
}), !isViewPresetsListFetching && !!error && jsx(AlertBanner, Object.assign({
|
|
7929
8271
|
info: error.message,
|
|
7930
8272
|
shouldClose: true,
|
|
@@ -7987,8 +8329,17 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
7987
8329
|
},
|
|
7988
8330
|
children: jsx(Filter, {
|
|
7989
8331
|
activeLabelFilterCount: activeLabelFilterCount,
|
|
7990
|
-
filters: viewPresetListFilters
|
|
7991
|
-
|
|
8332
|
+
filters: [].concat(viewPresetListFilters.map(function (filter) {
|
|
8333
|
+
return Object.assign({}, filter, {
|
|
8334
|
+
isSelected: !favouritesOnly && !isAllSelectedForFilters && filter.isSelected
|
|
8335
|
+
});
|
|
8336
|
+
}), [{
|
|
8337
|
+
id: 'favourites',
|
|
8338
|
+
label: t('workspace-favourites'),
|
|
8339
|
+
isSelected: favouritesOnly,
|
|
8340
|
+
isDisabled: !isLoggedIn
|
|
8341
|
+
}]),
|
|
8342
|
+
isAllSelected: isAllSelectedForFilters ? !favouritesOnly : false,
|
|
7992
8343
|
isLabelFilterOpen: isLabelFilterOpen,
|
|
7993
8344
|
onClickFilterChip: onClickFilterChip,
|
|
7994
8345
|
onSearch: onSearchFilter,
|
|
@@ -8027,10 +8378,12 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
8027
8378
|
},
|
|
8028
8379
|
children: [jsx(WorkspaceSelectList, {
|
|
8029
8380
|
currentSelectedId: activeViewPresetId || undefined,
|
|
8030
|
-
|
|
8381
|
+
favouritesDisabled: favourites.disabled,
|
|
8382
|
+
hideNewWorkspace: shouldHideNewWorkspace || favouritesOnly,
|
|
8031
8383
|
infoOpenPresetId: infoPreset == null ? void 0 : infoPreset.id,
|
|
8032
8384
|
isAdmin: isAdmin,
|
|
8033
8385
|
isEditable: isLoggedIn,
|
|
8386
|
+
isFavourite: favourites.isFavourite,
|
|
8034
8387
|
newPresets: [Object.assign({}, getEmptyWorkspaceListItem(t), {
|
|
8035
8388
|
title: t('workspace-mappreset-new')
|
|
8036
8389
|
})],
|
|
@@ -8038,6 +8391,7 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
8038
8391
|
onClickWorkspacePresetOption: onClickViewPresetOption,
|
|
8039
8392
|
onOpenPresetInfo: onOpenPresetInfo,
|
|
8040
8393
|
onSelectVersion: onSelectVersion,
|
|
8394
|
+
onToggleFavourite: favourites.toggleFavourite,
|
|
8041
8395
|
searchQuery: viewPresetListSearchQuery,
|
|
8042
8396
|
testIdPrefix: "viewpreset",
|
|
8043
8397
|
workspacePresets: filteredPresets
|
|
@@ -8262,6 +8616,10 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect(_ref) {
|
|
|
8262
8616
|
var _ref$isLabelFilterOpe = _ref.isLabelFilterOpen,
|
|
8263
8617
|
isLabelFilterOpen = _ref$isLabelFilterOpe === void 0 ? false : _ref$isLabelFilterOpe,
|
|
8264
8618
|
onToggleLabelFilter = _ref.onToggleLabelFilter;
|
|
8619
|
+
var favourites = useFavouritePresets('workspace');
|
|
8620
|
+
var selectedFavouritesOnly = useSelector(function (state) {
|
|
8621
|
+
return getFavouritesOnly(state);
|
|
8622
|
+
});
|
|
8265
8623
|
var dispatch = useDispatch();
|
|
8266
8624
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
8267
8625
|
t = _useWorkspaceTranslat.t;
|
|
@@ -8269,6 +8627,7 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect(_ref) {
|
|
|
8269
8627
|
currentRole = _useAuthenticationCon.currentRole,
|
|
8270
8628
|
isLoggedIn = _useAuthenticationCon.isLoggedIn,
|
|
8271
8629
|
auth = _useAuthenticationCon.auth;
|
|
8630
|
+
var favouritesOnly = isLoggedIn && selectedFavouritesOnly;
|
|
8272
8631
|
var username = (auth == null ? void 0 : auth.username) || '';
|
|
8273
8632
|
var isAdmin = (currentRole == null ? void 0 : currentRole.name) === GEOWEB_ROLE_PRESETS_ADMIN.name;
|
|
8274
8633
|
var scope = !isAdmin ? 'user' : 'system';
|
|
@@ -8299,9 +8658,10 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect(_ref) {
|
|
|
8299
8658
|
}
|
|
8300
8659
|
return Object.values(labelFilters).flat().length;
|
|
8301
8660
|
}, [labelFilters]);
|
|
8302
|
-
var
|
|
8661
|
+
var matchingPresets = React.useMemo(function () {
|
|
8303
8662
|
return filterAndSortPresets(workspacePresets, selectedFilters, username, isAdmin, labelFilters != null ? labelFilters : undefined, workspaceSearchQuery);
|
|
8304
8663
|
}, [workspacePresets, selectedFilters, username, isAdmin, labelFilters, workspaceSearchQuery]);
|
|
8664
|
+
var filteredPresets = filterAndSortFavouritePresets(matchingPresets, favourites.isFavourite, favouritesOnly);
|
|
8305
8665
|
var infoPanelAnchorRef = React.useRef(null);
|
|
8306
8666
|
var _React$useState = React.useState(),
|
|
8307
8667
|
infoPreset = _React$useState[0],
|
|
@@ -8635,15 +8995,23 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect(_ref) {
|
|
|
8635
8995
|
bgcolor: 'geowebColors.background.surface'
|
|
8636
8996
|
},
|
|
8637
8997
|
tabIndex: 0,
|
|
8638
|
-
children: [jsx(
|
|
8998
|
+
children: [!!favourites.error && jsx(AlertBanner, {
|
|
8999
|
+
actionButtonProps: {
|
|
9000
|
+
title: t('workspace-retry'),
|
|
9001
|
+
onClick: favourites.retry
|
|
9002
|
+
},
|
|
9003
|
+
info: t('workspace-favourites-error'),
|
|
9004
|
+
title: t('workspace-favourites')
|
|
9005
|
+
}), jsx(Box, {
|
|
8639
9006
|
sx: {
|
|
8640
9007
|
height: 4,
|
|
9008
|
+
flexShrink: 0,
|
|
8641
9009
|
overflow: 'hidden'
|
|
8642
9010
|
},
|
|
8643
|
-
children:
|
|
9011
|
+
children: isFetching || favourites.isLoading || favourites.isSaving ? jsx(LinearProgress, {
|
|
8644
9012
|
color: "secondary",
|
|
8645
9013
|
"data-testid": "loading-bar"
|
|
8646
|
-
})
|
|
9014
|
+
}) : null
|
|
8647
9015
|
}), !!error && jsx("div", {
|
|
8648
9016
|
style: {
|
|
8649
9017
|
whiteSpace: 'normal'
|
|
@@ -8708,8 +9076,17 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect(_ref) {
|
|
|
8708
9076
|
},
|
|
8709
9077
|
children: jsx(Filter, {
|
|
8710
9078
|
activeLabelFilterCount: activeLabelFilterCount,
|
|
8711
|
-
filters: workspaceListFilters
|
|
8712
|
-
|
|
9079
|
+
filters: [].concat(workspaceListFilters.map(function (filter) {
|
|
9080
|
+
return Object.assign({}, filter, {
|
|
9081
|
+
isSelected: !favouritesOnly && !isAllSelected && filter.isSelected
|
|
9082
|
+
});
|
|
9083
|
+
}), [{
|
|
9084
|
+
id: 'favourites',
|
|
9085
|
+
label: t('workspace-favourites'),
|
|
9086
|
+
isSelected: favouritesOnly,
|
|
9087
|
+
isDisabled: !isLoggedIn
|
|
9088
|
+
}]),
|
|
9089
|
+
isAllSelected: isAllSelected ? !favouritesOnly : false,
|
|
8713
9090
|
isLabelFilterOpen: isLabelFilterOpen,
|
|
8714
9091
|
onClickFilterChip: onClickFilterChip,
|
|
8715
9092
|
onSearch: searchFilter,
|
|
@@ -8740,13 +9117,16 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect(_ref) {
|
|
|
8740
9117
|
},
|
|
8741
9118
|
children: [jsx(WorkspaceSelectList, {
|
|
8742
9119
|
currentSelectedId: currentView.id || '',
|
|
8743
|
-
|
|
9120
|
+
favouritesDisabled: favourites.disabled,
|
|
9121
|
+
hideNewWorkspace: shouldHideNewWorkspace || favouritesOnly,
|
|
8744
9122
|
infoOpenPresetId: infoPreset == null ? void 0 : infoPreset.id,
|
|
8745
9123
|
isAdmin: isAdmin,
|
|
8746
9124
|
isEditable: isLoggedIn,
|
|
9125
|
+
isFavourite: favourites.isFavourite,
|
|
8747
9126
|
onClickWorkspacePreset: onClickWorkspacePreset,
|
|
8748
9127
|
onClickWorkspacePresetOption: onClickWorkspacePresetOption,
|
|
8749
9128
|
onOpenPresetInfo: onOpenPresetInfo,
|
|
9129
|
+
onToggleFavourite: favourites.toggleFavourite,
|
|
8750
9130
|
searchQuery: workspaceSearchQuery,
|
|
8751
9131
|
workspacePresets: filteredPresets
|
|
8752
9132
|
}), jsx(WorkspacePresetInfo, {
|
|
@@ -12875,6 +13255,47 @@ var workspacePresets = [
|
|
|
12875
13255
|
}
|
|
12876
13256
|
];
|
|
12877
13257
|
|
|
13258
|
+
/* *
|
|
13259
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13260
|
+
* you may not use this file except in compliance with the License.
|
|
13261
|
+
* You may obtain a copy of the License at
|
|
13262
|
+
*
|
|
13263
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13264
|
+
*
|
|
13265
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13266
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13267
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13268
|
+
* See the License for the specific language governing permissions and
|
|
13269
|
+
* limitations under the License.
|
|
13270
|
+
*
|
|
13271
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
13272
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
13273
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
13274
|
+
* */
|
|
13275
|
+
var createUserPreferencesEndpoints = function createUserPreferencesEndpoints() {
|
|
13276
|
+
var preferences = {};
|
|
13277
|
+
return [http.get(/.*\/user\/preferences$/, function () {
|
|
13278
|
+
return HttpResponse.json(preferences);
|
|
13279
|
+
}), http.all(/.*\/user\/preferences\/favourite-presets\/(workspace|view)\/(.+)$/, function (_ref) {
|
|
13280
|
+
var _preferences$favourit;
|
|
13281
|
+
var request = _ref.request,
|
|
13282
|
+
params = _ref.params;
|
|
13283
|
+
if (!['PUT', 'DELETE'].includes(request.method)) {
|
|
13284
|
+
return HttpResponse.json({}, {
|
|
13285
|
+
status: 405
|
|
13286
|
+
});
|
|
13287
|
+
}
|
|
13288
|
+
var key = params[0] + ":" + decodeURIComponent(String(params[1]));
|
|
13289
|
+
var favourites = (_preferences$favourit = preferences.favouritePresets) != null ? _preferences$favourit : [];
|
|
13290
|
+
preferences = Object.assign({}, preferences, {
|
|
13291
|
+
favouritePresets: request.method === 'PUT' ? Array.from(new Set([].concat(favourites, [key]))) : favourites.filter(function (value) {
|
|
13292
|
+
return value !== key;
|
|
13293
|
+
})
|
|
13294
|
+
});
|
|
13295
|
+
return HttpResponse.json(preferences);
|
|
13296
|
+
})];
|
|
13297
|
+
};
|
|
13298
|
+
|
|
12878
13299
|
var defaultWorkspacePresets = workspacePresets;
|
|
12879
13300
|
// Transforms full workspace presets to list items
|
|
12880
13301
|
var workspacePresetList = defaultWorkspacePresets.map(function (preset) {
|
|
@@ -12889,7 +13310,7 @@ var workspacePresetList = defaultWorkspacePresets.map(function (preset) {
|
|
|
12889
13310
|
username: preset.username
|
|
12890
13311
|
};
|
|
12891
13312
|
});
|
|
12892
|
-
var workspaceEndpoints = [http["delete"](/^.*\/workspacepreset\/(.*)$/, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
13313
|
+
var workspaceEndpoints = [].concat(createUserPreferencesEndpoints(), [http["delete"](/^.*\/workspacepreset\/(.*)$/, /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
12893
13314
|
return _regenerator().w(function (_context) {
|
|
12894
13315
|
while (1) switch (_context.n) {
|
|
12895
13316
|
case 0:
|
|
@@ -12973,6 +13394,6 @@ var workspaceEndpoints = [http["delete"](/^.*\/workspacepreset\/(.*)$/, /*#__PUR
|
|
|
12973
13394
|
return _context6.a(2, HttpResponse.json(LABELS_CONFIG_DEFAULT));
|
|
12974
13395
|
}
|
|
12975
13396
|
}, _callee6);
|
|
12976
|
-
})))];
|
|
13397
|
+
})))]);
|
|
12977
13398
|
|
|
12978
13399
|
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, WorkspacePresetAction, WorkspaceStoreWrapper, WorkspaceThemeProvider, WorkspaceTopBar, WorkspaceViewConnect, WorkspaceWrapperProviderWithStore, createBalancedMosaicNode, createCustomEmptyMapWorkspace, defaultAuthConfig, defaultViewPresetsFilters, getEmptyMapWorkspace, getWorkspaceRouteUrl, selectors$1 as selectors, viewPresetActions, viewPresetsListener, viewPresetsReducer, workspaceActions, workspaceEndpoints, workspaceListActions, workspaceListListener, workspaceListReducer, workspaceListener, workspaceMiddlewares, workspaceReducer, workspaceReducersMap, routes as workspaceRoutes, workspaceTranslations };
|