@opengeoweb/workspace 9.22.0 → 9.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.esm.js +269 -250
- package/package.json +2 -3
- package/src/index.d.ts +1 -1
- package/src/lib/store/config.d.ts +1 -10
- package/src/lib/store/store.d.ts +0 -4
- package/src/lib/store/types.d.ts +13 -0
- package/src/lib/store/viewPresets/listener.d.ts +2 -0
- package/src/lib/store/viewPresets/selectors.d.ts +1 -1
- package/src/lib/store/viewPresetsList/selectors.d.ts +1 -1
- package/src/lib/store/workspace/selectors.d.ts +1 -1
- package/src/lib/store/workspaceList/selectors.d.ts +1 -1
- package/src/lib/store/viewPresets/sagas.d.ts +0 -9
- /package/src/lib/store/viewPresets/{sagas.spec.d.ts → listener.integration.spec.d.ts} +0 -0
package/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createEntityAdapter, createSlice, createSelector } from '@reduxjs/toolkit';
|
|
1
|
+
import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware } from '@reduxjs/toolkit';
|
|
2
2
|
import _, { chunk, cloneDeep, isEmpty, isEqual, isString } from 'lodash';
|
|
3
3
|
import { syncGroupsTypes, syncGroupsActions, layerActions, mapStoreActions, uiActions, genericActions, mapActions, layerTypes, mapEnums, selectorMemoizationOptions, genericSelectors, mapSelectors, syncGroupsSelectors, routerActions, coreModuleConfig, loadingIndicatorSelectors, uiSelectors } from '@opengeoweb/store';
|
|
4
4
|
import { createApiInstance, createNonAuthApiInstance, getApi, createFakeApiInstance, ApiProvider, useApiContext } from '@opengeoweb/api';
|
|
@@ -11,6 +11,7 @@ import { CORE_NAMESPACE, coreTranslations } from '@opengeoweb/core';
|
|
|
11
11
|
import { FORM_FIELDS_NAMESPACE, formFieldsTranslations, ReactHookFormTextField, ReactHookFormHiddenInput, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
|
|
12
12
|
import { takeLatest, takeEvery, debounce, delay, put, all, select, call as call$g, takeLeading } from 'redux-saga/effects';
|
|
13
13
|
import { snackbarActions, SnackbarWrapperConnect } from '@opengeoweb/snackbar';
|
|
14
|
+
import { isAxiosError as isAxiosError$1 } from 'axios';
|
|
14
15
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
15
16
|
import { ThemeWrapper, lightTheme, SplitVertical, SplitHorizontal, Expand, UnExpand, Close, Delete, Preset, PresetWorkspace, PresetTiles, Search, Clear, CloudLoading, CloudIdle, WebAssetOff } from '@opengeoweb/theme';
|
|
16
17
|
import { Provider, useDispatch, useSelector, useStore, shallowEqual } from 'react-redux';
|
|
@@ -25,7 +26,6 @@ import { LinearProgress, Typography, ListItem, ListItemButton, ListItemIcon, Lis
|
|
|
25
26
|
import 'react-mosaic-component/react-mosaic-component.css';
|
|
26
27
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
27
28
|
import { FixedSizeList } from 'react-window';
|
|
28
|
-
import { Box as Box$1 } from '@mui/system';
|
|
29
29
|
import { useFormContext } from 'react-hook-form';
|
|
30
30
|
|
|
31
31
|
var en = {
|
|
@@ -90,65 +90,65 @@ var en = {
|
|
|
90
90
|
"workspace-viewpreset-menu": "View presets menu"
|
|
91
91
|
};
|
|
92
92
|
var fi = {
|
|
93
|
-
"workspace-menu": "
|
|
94
|
-
"workspace-new": "
|
|
95
|
-
"workspace-my-presets": "
|
|
96
|
-
"workspace-system-presets": "
|
|
97
|
-
"workspace-all-button": "
|
|
98
|
-
"workspace-search": "
|
|
99
|
-
"workspace-loading": "
|
|
100
|
-
"workspace-options": "
|
|
101
|
-
"workspace-results": "
|
|
102
|
-
"workspace-delete": "
|
|
103
|
-
"workspce-clear": "
|
|
104
|
-
"workspace-save": "
|
|
105
|
-
"workspace-save-as": "
|
|
106
|
-
"workspace-save-incl-viewpresets": "
|
|
107
|
-
"workspace-edit": "
|
|
108
|
-
"workspace-edit-both": "
|
|
109
|
-
"geoweb-welcome": "
|
|
110
|
-
"workspace-modified-new": "
|
|
111
|
-
"workspace-modified-existing": "ei
|
|
112
|
-
"workspace-dialog-delete": "
|
|
113
|
-
"workspace-duplicate": "
|
|
114
|
-
"workspace-cancel": "
|
|
115
|
-
"workspace-dialog-name": "
|
|
116
|
-
"workspace-dialog-abstract": "
|
|
117
|
-
"workspace-dialog-confirm-delete-message": "
|
|
118
|
-
"workspace-error-fetch": "
|
|
119
|
-
"workspace-error-fetch-detail": "
|
|
120
|
-
"workspace-retry": "
|
|
121
|
-
"workspace-delete-tooltip": "
|
|
122
|
-
"workspace-control-split-horizontal": "
|
|
123
|
-
"workspace-control-split-vertical": "
|
|
124
|
-
"workspace-control-expand": "
|
|
125
|
-
"workspace-control-unexpand": "
|
|
126
|
-
"workspace-control-close": "
|
|
127
|
-
"workspace-control-close-message-title": "
|
|
128
|
-
"workspace-control-close-message-description": "
|
|
129
|
-
"workspace-mappreset-delete-message": "
|
|
130
|
-
"workspace-viewpresets-fail-fetch": "
|
|
131
|
-
"workspace-viewpresets-error": "
|
|
132
|
-
"workspace-mappreset-dialog-title": "
|
|
133
|
-
"workspace-mappreset-save-as": "
|
|
134
|
-
"workspace-mappreset-new": "
|
|
135
|
-
"workspace-mappreset-dialog-title-delete": "
|
|
136
|
-
"workspace-mappreset-dialog-title-edit": "
|
|
137
|
-
"workspace-mappreset-error-save": "
|
|
138
|
-
"workspace-mappreset-error-fetch": "
|
|
139
|
-
"workspace-list-error": "
|
|
140
|
-
"workspace-list-success-save-all": "
|
|
141
|
-
"workspace-list-success-delete": "
|
|
142
|
-
"workspace-list-success-duplicate": "
|
|
143
|
-
"workspace-list-success-edit": "
|
|
144
|
-
"workspace-list-success-save": "
|
|
145
|
-
"workspace-save-error": "
|
|
146
|
-
"workspace-error-generic": "
|
|
147
|
-
"workspace-viewpreset-success-delete": "
|
|
148
|
-
"workspace-viewpreset-success-save-as": "
|
|
149
|
-
"workspace-viewpreset-success-edit": "
|
|
150
|
-
"workspace-viewpreset-success-save": "
|
|
151
|
-
"workspace-viewpreset-menu": "
|
|
93
|
+
"workspace-menu": "Workspace menu",
|
|
94
|
+
"workspace-new": "Uusi workspace",
|
|
95
|
+
"workspace-my-presets": "Omat presetit",
|
|
96
|
+
"workspace-system-presets": "Järestelmä presetit",
|
|
97
|
+
"workspace-all-button": "Kaikki",
|
|
98
|
+
"workspace-search": "Etsi",
|
|
99
|
+
"workspace-loading": "Ladataan",
|
|
100
|
+
"workspace-options": "Valinnat",
|
|
101
|
+
"workspace-results": "tulokset",
|
|
102
|
+
"workspace-delete": "Poista",
|
|
103
|
+
"workspce-clear": "Tyhjennä",
|
|
104
|
+
"workspace-save": "Tallenna",
|
|
105
|
+
"workspace-save-as": "Tallenna nimellä",
|
|
106
|
+
"workspace-save-incl-viewpresets": "Tallenna (sisältäen viewpresetit)",
|
|
107
|
+
"workspace-edit": "Muokkaa (nimeä)",
|
|
108
|
+
"workspace-edit-both": "Muokkaa (nimeä ja tiivistelmää)",
|
|
109
|
+
"geoweb-welcome": "Tervetuloa Geoweb-sovellukseen. Valitse jokin preset avataksesi uusia näkymiä",
|
|
110
|
+
"workspace-modified-new": "muokattu",
|
|
111
|
+
"workspace-modified-existing": "ei tallennettu",
|
|
112
|
+
"workspace-dialog-delete": "Poista workspace",
|
|
113
|
+
"workspace-duplicate": "Monista",
|
|
114
|
+
"workspace-cancel": "Peruuta",
|
|
115
|
+
"workspace-dialog-name": "Nimi",
|
|
116
|
+
"workspace-dialog-abstract": "Tiivistelmä",
|
|
117
|
+
"workspace-dialog-confirm-delete-message": "Oletko varma, että haluat poistaa workspace presetin: \"{{TITLE}}\"?",
|
|
118
|
+
"workspace-error-fetch": "Workspace listan hakeminen epäonnistui",
|
|
119
|
+
"workspace-error-fetch-detail": "Workspacen \"{{WORKSPACE_ID}}\" hakeminen epäonnistui",
|
|
120
|
+
"workspace-retry": "Yritä uudelleen",
|
|
121
|
+
"workspace-delete-tooltip": "Poista preset",
|
|
122
|
+
"workspace-control-split-horizontal": "Jaa ikkuna vaakasuoraan",
|
|
123
|
+
"workspace-control-split-vertical": "Jaa ikkuna pystysuoraan",
|
|
124
|
+
"workspace-control-expand": "Laajenna ikkuna",
|
|
125
|
+
"workspace-control-unexpand": "Supista ikkuna",
|
|
126
|
+
"workspace-control-close": "Sulje ikkuna",
|
|
127
|
+
"workspace-control-close-message-title": "Hups",
|
|
128
|
+
"workspace-control-close-message-description": "Oletko varma, että haluat sulkea tämän ikkunan? Kaikki muutokset menetetään",
|
|
129
|
+
"workspace-mappreset-delete-message": "Haluatko varmasti poistaa map presetin: \"{{TITLE}}\"?",
|
|
130
|
+
"workspace-viewpresets-fail-fetch": "Näkymän \"{{VIEWPRESET_ID}}\" hakeminen epäonnistui",
|
|
131
|
+
"workspace-viewpresets-error": "View presetit eivät ole käytettävissä",
|
|
132
|
+
"workspace-mappreset-dialog-title": "Map presetin nimi",
|
|
133
|
+
"workspace-mappreset-save-as": "Tallenna map preset nimellä",
|
|
134
|
+
"workspace-mappreset-new": "Uusi map preset",
|
|
135
|
+
"workspace-mappreset-dialog-title-delete": "Poista map preset",
|
|
136
|
+
"workspace-mappreset-dialog-title-edit": "Muokkaa map presettiä",
|
|
137
|
+
"workspace-mappreset-error-save": "Map presetin tallentaminen epäonnistui. Yritä myöhemmin uudelleen",
|
|
138
|
+
"workspace-mappreset-error-fetch": "Map presettien hakeminen epäonnistui",
|
|
139
|
+
"workspace-list-error": "Workspace presettien hakeminen epäonnistui",
|
|
140
|
+
"workspace-list-success-save-all": "Workspace \"{{TITLE}}\" ja siihen sisältyvät viewpresetit tallennettu onnistuneesti",
|
|
141
|
+
"workspace-list-success-delete": "Workspace \"{{TITLE}}\" poistettu onnistuneesti",
|
|
142
|
+
"workspace-list-success-duplicate": "Workspace \"{{TITLE}}\" tallennettu onnistuneesti",
|
|
143
|
+
"workspace-list-success-edit": "Workspacea \"{{TITLE}}\" muokattu onnistuneesti",
|
|
144
|
+
"workspace-list-success-save": "Workspace \"{{TITLE}}\" tallennettu onnistuneesti",
|
|
145
|
+
"workspace-save-error": "Workspacen \"{{TITLE}}\" tallentaminen epäonnistui",
|
|
146
|
+
"workspace-error-generic": "Jotain meni mönkään. Yritä uudelleen.",
|
|
147
|
+
"workspace-viewpreset-success-delete": "Map preset \"{{TITLE}}\" poistettu onnistuneesti",
|
|
148
|
+
"workspace-viewpreset-success-save-as": "Uusi map preset \"{{TITLE}}\" tallennettu onnistuneesti",
|
|
149
|
+
"workspace-viewpreset-success-edit": "Map presettiä \"{{TITLE}}\" muokattu onnistuneesti",
|
|
150
|
+
"workspace-viewpreset-success-save": "Map preset \"{{TITLE}}\" tallennettu onnistuneesti",
|
|
151
|
+
"workspace-viewpreset-menu": "View preset menu"
|
|
152
152
|
};
|
|
153
153
|
var no = {
|
|
154
154
|
"workspace-menu": "Arbeidsrommeny",
|
|
@@ -4064,7 +4064,6 @@ const getSnackbarMessage = (action, title) => {
|
|
|
4064
4064
|
});
|
|
4065
4065
|
}
|
|
4066
4066
|
};
|
|
4067
|
-
const getPresetsApi = () => getApi(API_NAME);
|
|
4068
4067
|
const emptyMapViewPreset = {
|
|
4069
4068
|
componentType: 'Map',
|
|
4070
4069
|
keywords: '',
|
|
@@ -7515,12 +7514,56 @@ function* submitFormWorkspaceDialogSaga({
|
|
|
7515
7514
|
}));
|
|
7516
7515
|
}
|
|
7517
7516
|
}
|
|
7518
|
-
function* rootSaga
|
|
7517
|
+
function* rootSaga() {
|
|
7519
7518
|
yield takeLeading(workspaceListActions.fetchWorkspaceList.type, fetchWorkspaceListSaga);
|
|
7520
7519
|
yield takeLatest(workspaceListActions.onSuccessWorkspacePresetAction, onSuccessWorkspacePresetsActionSaga);
|
|
7521
7520
|
yield takeLatest(workspaceListActions.submitFormWorkspaceActionDialogOptions, submitFormWorkspaceDialogSaga);
|
|
7522
7521
|
}
|
|
7523
7522
|
|
|
7523
|
+
/******************************************************************************
|
|
7524
|
+
Copyright (c) Microsoft Corporation.
|
|
7525
|
+
|
|
7526
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
7527
|
+
purpose with or without fee is hereby granted.
|
|
7528
|
+
|
|
7529
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
7530
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
7531
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
7532
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
7533
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
7534
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
7535
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
7536
|
+
***************************************************************************** */
|
|
7537
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
7538
|
+
|
|
7539
|
+
|
|
7540
|
+
function __rest(s, e) {
|
|
7541
|
+
var t = {};
|
|
7542
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
7543
|
+
t[p] = s[p];
|
|
7544
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7545
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7546
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
7547
|
+
t[p[i]] = s[p[i]];
|
|
7548
|
+
}
|
|
7549
|
+
return t;
|
|
7550
|
+
}
|
|
7551
|
+
|
|
7552
|
+
function __awaiter(thisArg, _arguments, P, generator) {
|
|
7553
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7554
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7555
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7556
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7557
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7558
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7559
|
+
});
|
|
7560
|
+
}
|
|
7561
|
+
|
|
7562
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
7563
|
+
var e = new Error(message);
|
|
7564
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
7565
|
+
};
|
|
7566
|
+
|
|
7524
7567
|
/* *
|
|
7525
7568
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7526
7569
|
* you may not use this file except in compliance with the License.
|
|
@@ -7538,7 +7581,7 @@ function* rootSaga$1() {
|
|
|
7538
7581
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
7539
7582
|
* */
|
|
7540
7583
|
const processError = (error, component, errorMessageKey) => {
|
|
7541
|
-
const message = isAxiosError(error) ? getAxiosErrorMessage(error) : translateKeyOutsideComponents(errorMessageKey);
|
|
7584
|
+
const message = isAxiosError$1(error) ? getAxiosErrorMessage(error) : translateKeyOutsideComponents(errorMessageKey);
|
|
7542
7585
|
const errorType = isAxiosAuthError(error) ? ViewPresetErrorType.AUTH : ViewPresetErrorType.GENERIC;
|
|
7543
7586
|
return {
|
|
7544
7587
|
message,
|
|
@@ -7546,161 +7589,180 @@ const processError = (error, component, errorMessageKey) => {
|
|
|
7546
7589
|
errorType
|
|
7547
7590
|
};
|
|
7548
7591
|
};
|
|
7549
|
-
|
|
7550
|
-
|
|
7551
|
-
|
|
7552
|
-
|
|
7553
|
-
|
|
7554
|
-
|
|
7555
|
-
|
|
7556
|
-
|
|
7557
|
-
viewPresets
|
|
7558
|
-
|
|
7559
|
-
|
|
7560
|
-
|
|
7561
|
-
|
|
7562
|
-
|
|
7563
|
-
|
|
7564
|
-
}
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
})
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7592
|
+
const viewPresetsListener = createListenerMiddleware();
|
|
7593
|
+
// fetch initial view presets
|
|
7594
|
+
viewPresetsListener.startListening({
|
|
7595
|
+
actionCreator: viewPresetActions.fetchInitialViewPresets,
|
|
7596
|
+
effect: (_, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7597
|
+
listenerApi.cancelActiveListeners();
|
|
7598
|
+
try {
|
|
7599
|
+
const workspaceApi = getWorkspaceApi();
|
|
7600
|
+
// No filters so we don't need to pass any params for this viewPresets list call
|
|
7601
|
+
const {
|
|
7602
|
+
data: viewPresets
|
|
7603
|
+
} = yield workspaceApi.getViewPresets();
|
|
7604
|
+
listenerApi.dispatch(viewPresetActions.fetchedInitialViewPresets({
|
|
7605
|
+
viewPresets
|
|
7606
|
+
}));
|
|
7607
|
+
} catch (error) {
|
|
7608
|
+
listenerApi.dispatch(viewPresetActions.errorInitialViewPresets({
|
|
7609
|
+
error: processError(error, ViewPresetErrorComponent.PRESET_LIST, 'workspace-mappreset-error-fetch')
|
|
7610
|
+
}));
|
|
7611
|
+
}
|
|
7612
|
+
})
|
|
7613
|
+
});
|
|
7614
|
+
// fetch view presets
|
|
7615
|
+
viewPresetsListener.startListening({
|
|
7616
|
+
actionCreator: viewPresetActions.fetchViewPresets,
|
|
7617
|
+
effect: ({
|
|
7618
|
+
payload
|
|
7619
|
+
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7620
|
+
listenerApi.cancelActiveListeners();
|
|
7574
7621
|
const {
|
|
7575
|
-
data: viewPresets
|
|
7576
|
-
} = yield call$g(presetsApi.getViewPresets, filterParams);
|
|
7577
|
-
yield put(viewPresetActions.fetchedViewPresets({
|
|
7578
|
-
viewPresets,
|
|
7579
7622
|
panelId,
|
|
7580
7623
|
filterParams
|
|
7581
|
-
}
|
|
7582
|
-
|
|
7583
|
-
|
|
7584
|
-
|
|
7585
|
-
|
|
7586
|
-
|
|
7587
|
-
|
|
7588
|
-
|
|
7589
|
-
|
|
7590
|
-
|
|
7591
|
-
})
|
|
7592
|
-
|
|
7593
|
-
|
|
7594
|
-
|
|
7595
|
-
|
|
7596
|
-
|
|
7597
|
-
|
|
7598
|
-
|
|
7599
|
-
|
|
7600
|
-
|
|
7601
|
-
|
|
7602
|
-
|
|
7603
|
-
|
|
7604
|
-
|
|
7605
|
-
|
|
7606
|
-
|
|
7607
|
-
|
|
7608
|
-
yield put(viewPresetActions.errorViewPreset({
|
|
7609
|
-
error: processError(error, ViewPresetErrorComponent.PRESET_DETAIL, 'workspace-mappreset-error-save'),
|
|
7624
|
+
} = payload;
|
|
7625
|
+
try {
|
|
7626
|
+
const workspaceApi = getWorkspaceApi();
|
|
7627
|
+
const {
|
|
7628
|
+
data: viewPresets
|
|
7629
|
+
} = yield workspaceApi.getViewPresets(filterParams);
|
|
7630
|
+
listenerApi.dispatch(viewPresetActions.fetchedViewPresets({
|
|
7631
|
+
viewPresets,
|
|
7632
|
+
panelId,
|
|
7633
|
+
filterParams
|
|
7634
|
+
}));
|
|
7635
|
+
} catch (error) {
|
|
7636
|
+
listenerApi.dispatch(viewPresetActions.errorViewPreset({
|
|
7637
|
+
error: processError(error, ViewPresetErrorComponent.PRESET_LIST, 'workspace-mappreset-error-fetch'),
|
|
7638
|
+
panelId
|
|
7639
|
+
}));
|
|
7640
|
+
}
|
|
7641
|
+
})
|
|
7642
|
+
});
|
|
7643
|
+
// save view preset
|
|
7644
|
+
viewPresetsListener.startListening({
|
|
7645
|
+
actionCreator: viewPresetActions.saveViewPreset,
|
|
7646
|
+
effect: ({
|
|
7647
|
+
payload
|
|
7648
|
+
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7649
|
+
listenerApi.cancelActiveListeners();
|
|
7650
|
+
const {
|
|
7610
7651
|
panelId,
|
|
7652
|
+
viewPreset,
|
|
7611
7653
|
viewPresetId
|
|
7612
|
-
}
|
|
7613
|
-
|
|
7614
|
-
|
|
7615
|
-
|
|
7616
|
-
|
|
7617
|
-
|
|
7618
|
-
|
|
7619
|
-
|
|
7620
|
-
|
|
7621
|
-
|
|
7622
|
-
|
|
7623
|
-
|
|
7624
|
-
|
|
7625
|
-
|
|
7626
|
-
}));
|
|
7627
|
-
}
|
|
7628
|
-
// fetch existing map preset selected
|
|
7629
|
-
if (viewPresetId !== '') {
|
|
7630
|
-
yield put(workspaceActions.fetchWorkspaceViewPreset({
|
|
7631
|
-
mosaicNodeId: panelId,
|
|
7632
|
-
viewPresetId
|
|
7633
|
-
}));
|
|
7634
|
-
} else {
|
|
7635
|
-
// new map preset selected
|
|
7636
|
-
yield put(mapStoreActions.setMapPreset({
|
|
7637
|
-
mapId: panelId,
|
|
7638
|
-
initialProps: emptyMapViewPreset.initialProps
|
|
7639
|
-
}));
|
|
7640
|
-
// update workspace with new empy view map
|
|
7641
|
-
yield put(workspaceActions.updateWorkspaceView({
|
|
7642
|
-
viewPreset: emptyMapViewPreset,
|
|
7643
|
-
mosaicNodeId: panelId
|
|
7644
|
-
}));
|
|
7645
|
-
yield put(viewPresetActions.fetchedViewPreset({
|
|
7646
|
-
panelId,
|
|
7647
|
-
viewPresetId,
|
|
7648
|
-
viewPreset: emptyMapViewPreset
|
|
7649
|
-
}));
|
|
7650
|
-
}
|
|
7651
|
-
}
|
|
7652
|
-
function* onSuccessViewPresetActionSaga({
|
|
7653
|
-
payload
|
|
7654
|
-
}) {
|
|
7655
|
-
const {
|
|
7656
|
-
action,
|
|
7657
|
-
viewPresetId,
|
|
7658
|
-
title,
|
|
7659
|
-
panelId
|
|
7660
|
-
} = payload;
|
|
7661
|
-
try {
|
|
7662
|
-
yield put(snackbarActions.openSnackbar({
|
|
7663
|
-
message: getSnackbarMessage(action, title)
|
|
7664
|
-
}));
|
|
7665
|
-
const activeMapPresetId = yield select(getViewPresetActiveId, panelId);
|
|
7666
|
-
// if active preset has been deleted, select the empty new preset
|
|
7667
|
-
if (action === PresetAction.DELETE && viewPresetId === activeMapPresetId) {
|
|
7668
|
-
yield put(viewPresetActions.setActiveViewPresetId({
|
|
7654
|
+
} = payload;
|
|
7655
|
+
try {
|
|
7656
|
+
const workspaceApi = getWorkspaceApi();
|
|
7657
|
+
yield workspaceApi.saveViewPreset(viewPresetId, viewPreset);
|
|
7658
|
+
listenerApi.dispatch(snackbarActions.openSnackbar({
|
|
7659
|
+
message: getSnackbarMessage(PresetAction.SAVE, viewPreset.title)
|
|
7660
|
+
}));
|
|
7661
|
+
listenerApi.dispatch(viewPresetActions.savedViewPreset({
|
|
7662
|
+
panelId,
|
|
7663
|
+
viewPresetId
|
|
7664
|
+
}));
|
|
7665
|
+
} catch (error) {
|
|
7666
|
+
listenerApi.dispatch(viewPresetActions.errorViewPreset({
|
|
7667
|
+
error: processError(error, ViewPresetErrorComponent.PRESET_DETAIL, 'workspace-mappreset-error-save'),
|
|
7669
7668
|
panelId,
|
|
7670
|
-
viewPresetId
|
|
7669
|
+
viewPresetId
|
|
7671
7670
|
}));
|
|
7672
7671
|
}
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7672
|
+
})
|
|
7673
|
+
});
|
|
7674
|
+
// select view preset
|
|
7675
|
+
viewPresetsListener.startListening({
|
|
7676
|
+
actionCreator: viewPresetActions.selectViewPreset,
|
|
7677
|
+
effect: ({
|
|
7678
|
+
payload
|
|
7679
|
+
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7680
|
+
listenerApi.cancelActiveListeners();
|
|
7681
|
+
const {
|
|
7678
7682
|
panelId,
|
|
7679
|
-
|
|
7680
|
-
}
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
+
viewPresetId = ''
|
|
7684
|
+
} = payload;
|
|
7685
|
+
const isMapAnimating = mapSelectors.isAnimating(listenerApi.getState(), panelId);
|
|
7686
|
+
if (isMapAnimating) {
|
|
7687
|
+
listenerApi.dispatch(mapStoreActions.mapStopAnimation({
|
|
7688
|
+
mapId: panelId
|
|
7689
|
+
}));
|
|
7690
|
+
}
|
|
7691
|
+
// fetch existing map preset selected
|
|
7692
|
+
if (viewPresetId !== '') {
|
|
7693
|
+
listenerApi.dispatch(workspaceActions.fetchWorkspaceViewPreset({
|
|
7694
|
+
mosaicNodeId: panelId,
|
|
7695
|
+
viewPresetId
|
|
7696
|
+
}));
|
|
7697
|
+
} else {
|
|
7698
|
+
// new map preset selected
|
|
7699
|
+
listenerApi.dispatch(mapStoreActions.setMapPreset({
|
|
7700
|
+
mapId: panelId,
|
|
7701
|
+
initialProps: emptyMapViewPreset.initialProps
|
|
7702
|
+
}));
|
|
7703
|
+
// update workspace with new empy view map
|
|
7704
|
+
listenerApi.dispatch(workspaceActions.updateWorkspaceView({
|
|
7705
|
+
viewPreset: emptyMapViewPreset,
|
|
7706
|
+
mosaicNodeId: panelId
|
|
7707
|
+
}));
|
|
7708
|
+
listenerApi.dispatch(viewPresetActions.fetchedViewPreset({
|
|
7683
7709
|
panelId,
|
|
7684
|
-
|
|
7710
|
+
viewPresetId,
|
|
7711
|
+
viewPreset: emptyMapViewPreset
|
|
7685
7712
|
}));
|
|
7686
7713
|
}
|
|
7687
|
-
|
|
7688
|
-
|
|
7714
|
+
})
|
|
7715
|
+
});
|
|
7716
|
+
// success view preset
|
|
7717
|
+
viewPresetsListener.startListening({
|
|
7718
|
+
actionCreator: viewPresetActions.onSuccessViewPresetAction,
|
|
7719
|
+
effect: ({
|
|
7720
|
+
payload
|
|
7721
|
+
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7722
|
+
listenerApi.cancelActiveListeners();
|
|
7723
|
+
const {
|
|
7724
|
+
action,
|
|
7725
|
+
viewPresetId,
|
|
7726
|
+
title,
|
|
7727
|
+
panelId
|
|
7728
|
+
} = payload;
|
|
7729
|
+
try {
|
|
7730
|
+
listenerApi.dispatch(snackbarActions.openSnackbar({
|
|
7731
|
+
message: getSnackbarMessage(action, title)
|
|
7732
|
+
}));
|
|
7733
|
+
const activeMapPresetId = getViewPresetActiveId(listenerApi.getState(), panelId);
|
|
7734
|
+
// if active preset has been deleted, select the empty new preset
|
|
7735
|
+
if (action === PresetAction.DELETE && viewPresetId === activeMapPresetId) {
|
|
7736
|
+
listenerApi.dispatch(viewPresetActions.setActiveViewPresetId({
|
|
7737
|
+
panelId,
|
|
7738
|
+
viewPresetId: ''
|
|
7739
|
+
}));
|
|
7740
|
+
}
|
|
7741
|
+
// Retrieve new list with current filter and search query
|
|
7742
|
+
const viewPresetFilters = getViewPresetListFiltersForView(listenerApi.getState(), panelId);
|
|
7743
|
+
// Retrieve new list with current filter
|
|
7744
|
+
const viewPresetSearchQuery = getViewPresetListSearchQueryForView(listenerApi.getState(), panelId);
|
|
7745
|
+
listenerApi.dispatch(viewPresetActions.fetchViewPresets({
|
|
7689
7746
|
panelId,
|
|
7690
|
-
|
|
7747
|
+
filterParams: constructFilterParams(viewPresetFilters, viewPresetSearchQuery)
|
|
7691
7748
|
}));
|
|
7749
|
+
if (action !== PresetAction.EDIT) {
|
|
7750
|
+
listenerApi.dispatch(viewPresetActions.setViewPresetHasChanges({
|
|
7751
|
+
panelId,
|
|
7752
|
+
hasChanges: false
|
|
7753
|
+
}));
|
|
7754
|
+
}
|
|
7755
|
+
if (action === PresetAction.SAVE_AS && viewPresetId) {
|
|
7756
|
+
listenerApi.dispatch(viewPresetActions.setActiveViewPresetId({
|
|
7757
|
+
panelId,
|
|
7758
|
+
viewPresetId
|
|
7759
|
+
}));
|
|
7760
|
+
}
|
|
7761
|
+
} catch (error) {
|
|
7762
|
+
// TODO: use error handling of mapPreset https://gitlab.com/opengeoweb/opengeoweb/-/issues/3043
|
|
7692
7763
|
}
|
|
7693
|
-
}
|
|
7694
|
-
|
|
7695
|
-
}
|
|
7696
|
-
}
|
|
7697
|
-
function* rootSaga() {
|
|
7698
|
-
yield takeLeading(viewPresetActions.fetchInitialViewPresets, fetchInitialViewPresetsSaga);
|
|
7699
|
-
yield takeLatest(viewPresetActions.fetchViewPresets, fetchViewPresetsSaga);
|
|
7700
|
-
yield takeLatest(viewPresetActions.saveViewPreset, saveViewPresetSaga);
|
|
7701
|
-
yield takeLatest(viewPresetActions.selectViewPreset, selectViewPresetSaga);
|
|
7702
|
-
yield takeLatest(viewPresetActions.onSuccessViewPresetAction, onSuccessViewPresetActionSaga);
|
|
7703
|
-
}
|
|
7764
|
+
})
|
|
7765
|
+
});
|
|
7704
7766
|
|
|
7705
7767
|
/* *
|
|
7706
7768
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -7726,51 +7788,8 @@ const workspaceModuleConfig = {
|
|
|
7726
7788
|
viewPresetsList: reducer,
|
|
7727
7789
|
viewPresets: reducer$2
|
|
7728
7790
|
},
|
|
7729
|
-
sagas: [workspaceSaga, rootSaga
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
/******************************************************************************
|
|
7733
|
-
Copyright (c) Microsoft Corporation.
|
|
7734
|
-
|
|
7735
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
7736
|
-
purpose with or without fee is hereby granted.
|
|
7737
|
-
|
|
7738
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
7739
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
7740
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
7741
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
7742
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
7743
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
7744
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
7745
|
-
***************************************************************************** */
|
|
7746
|
-
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
function __rest(s, e) {
|
|
7750
|
-
var t = {};
|
|
7751
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
7752
|
-
t[p] = s[p];
|
|
7753
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7754
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7755
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
7756
|
-
t[p[i]] = s[p[i]];
|
|
7757
|
-
}
|
|
7758
|
-
return t;
|
|
7759
|
-
}
|
|
7760
|
-
|
|
7761
|
-
function __awaiter(thisArg, _arguments, P, generator) {
|
|
7762
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7763
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7764
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7765
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7766
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7767
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7768
|
-
});
|
|
7769
|
-
}
|
|
7770
|
-
|
|
7771
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
7772
|
-
var e = new Error(message);
|
|
7773
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
7791
|
+
sagas: [workspaceSaga, rootSaga],
|
|
7792
|
+
middlewares: [viewPresetsListener.middleware]
|
|
7774
7793
|
};
|
|
7775
7794
|
|
|
7776
7795
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
|
@@ -9898,7 +9917,7 @@ const WorkspaceTab = ({
|
|
|
9898
9917
|
activeTab,
|
|
9899
9918
|
workspaceId
|
|
9900
9919
|
}) => {
|
|
9901
|
-
return jsxs(Box
|
|
9920
|
+
return jsxs(Box, Object.assign({
|
|
9902
9921
|
sx: {
|
|
9903
9922
|
display: 'flex',
|
|
9904
9923
|
flexDirection: 'row',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/workspace",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.23.1",
|
|
4
4
|
"description": "GeoWeb Workspace library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
"@reduxjs/toolkit": "^1.9.7",
|
|
19
19
|
"@opengeoweb/snackbar": "*",
|
|
20
20
|
"react-window": "^1.8.10",
|
|
21
|
-
"@mui/system": "^5.15.1",
|
|
22
21
|
"lodash": "^4.17.21",
|
|
23
22
|
"@redux-eggs/core": "^2.2.0",
|
|
24
23
|
"@redux-eggs/redux-toolkit": "^2.2.0",
|
|
@@ -37,7 +36,7 @@
|
|
|
37
36
|
"@opengeoweb/warnings": "*",
|
|
38
37
|
"i18next": "^23.11.5",
|
|
39
38
|
"react-i18next": "^14.1.2",
|
|
40
|
-
"@opengeoweb/webmap-react": "9.
|
|
39
|
+
"@opengeoweb/webmap-react": "9.23.1"
|
|
41
40
|
},
|
|
42
41
|
"peerDependencies": {
|
|
43
42
|
"react": "18"
|
package/src/index.d.ts
CHANGED
|
@@ -14,4 +14,4 @@ export { WORKSPACE_NAMESPACE } from './lib/utils/i18n';
|
|
|
14
14
|
export { workspaceTranslations };
|
|
15
15
|
export { routes as workspaceRoutes, getWorkspaceRouteUrl, } from './lib/utils/routes';
|
|
16
16
|
export { emptyMapWorkspace, createCustomEmptyMapWorkspace, } from './lib/store/workspaceList/utils';
|
|
17
|
-
export type { WorkspaceModuleStore } from './lib/store/
|
|
17
|
+
export type { WorkspaceModuleStore } from './lib/store/types';
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
import { Egg } from '@redux-eggs/core';
|
|
2
2
|
import { Store } from '@reduxjs/toolkit';
|
|
3
|
-
import {
|
|
4
|
-
import { WorkspaceListState } from './workspaceList/types';
|
|
5
|
-
import { ViewPresetListState } from './viewPresetsList/types';
|
|
6
|
-
import { ViewPresetState } from './viewPresets/types';
|
|
7
|
-
export interface WorkspaceModuleStore {
|
|
8
|
-
workspace?: WorkspaceState;
|
|
9
|
-
workspaceList?: WorkspaceListState;
|
|
10
|
-
viewPresetsList?: ViewPresetListState;
|
|
11
|
-
viewPresets?: ViewPresetState;
|
|
12
|
-
}
|
|
3
|
+
import { WorkspaceModuleStore } from './types';
|
|
13
4
|
declare const workspaceModuleConfig: Egg<Store<WorkspaceModuleStore>>;
|
|
14
5
|
export default workspaceModuleConfig;
|
package/src/lib/store/store.d.ts
CHANGED
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
import type { CoreAppStore } from '@opengeoweb/store';
|
|
2
|
-
import type { WorkspaceModuleStore } from './config';
|
|
3
|
-
export interface AppStore extends WorkspaceModuleStore, CoreAppStore {
|
|
4
|
-
}
|
|
5
1
|
declare const store: import("@redux-eggs/core").EggExt & import("@reduxjs/toolkit/dist/configureStore").ToolkitStore<any, import("redux").AnyAction, [import("@reduxjs/toolkit").ThunkMiddleware<any, import("redux").AnyAction, undefined>]>;
|
|
6
2
|
export { store };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CoreAppStore } from '@opengeoweb/store';
|
|
2
|
+
import { WorkspaceState } from './workspace/types';
|
|
3
|
+
import { WorkspaceListState } from './workspaceList/types';
|
|
4
|
+
import { ViewPresetListState } from './viewPresetsList/types';
|
|
5
|
+
import { ViewPresetState } from './viewPresets/types';
|
|
6
|
+
export interface AppStore extends WorkspaceModuleStore, CoreAppStore {
|
|
7
|
+
}
|
|
8
|
+
export interface WorkspaceModuleStore {
|
|
9
|
+
workspace?: WorkspaceState;
|
|
10
|
+
workspaceList?: WorkspaceListState;
|
|
11
|
+
viewPresetsList?: ViewPresetListState;
|
|
12
|
+
viewPresets?: ViewPresetState;
|
|
13
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { WorkspaceModuleStore } from '../types';
|
|
2
|
+
export declare const viewPresetsListener: import("@reduxjs/toolkit").ListenerMiddlewareInstance<WorkspaceModuleStore, import("@reduxjs/toolkit").ThunkDispatch<WorkspaceModuleStore, unknown, import("redux").AnyAction>, unknown>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AppStore } from '../
|
|
1
|
+
import type { AppStore } from '../types';
|
|
2
2
|
import { ViewPresetListItem } from '../workspace/types';
|
|
3
3
|
import { ViewPresetEntity, ViewPresetError, ViewPresetState } from './types';
|
|
4
4
|
export declare const getViewPresetsStore: (store: AppStore) => ViewPresetState;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AppStore } from '../
|
|
1
|
+
import { AppStore } from '../types';
|
|
2
2
|
import { ViewPresetListItem, ViewPresetListState } from './types';
|
|
3
3
|
import { ViewPresetsListFilter } from '../viewPresets/types';
|
|
4
4
|
export declare const getViewPresetsListStore: (store: AppStore) => ViewPresetListState;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WorkspaceListState } from './types';
|
|
2
|
-
import { AppStore } from '../
|
|
2
|
+
import { AppStore } from '../types';
|
|
3
3
|
export declare const getWorkspaceListStore: (store: AppStore) => WorkspaceListState;
|
|
4
4
|
export declare const getWorkspaceList: (state: AppStore) => import("../workspace/types").WorkspacePresetListItem[];
|
|
5
5
|
export declare const getIsWorkspaceListFetching: ((state: AppStore) => boolean) & import("reselect").OutputSelectorFields<(args_0: WorkspaceListState, args_1: AppStore) => boolean, {
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { SagaIterator } from 'redux-saga';
|
|
2
|
-
import { viewPresetActions } from './reducer';
|
|
3
|
-
export declare function fetchInitialViewPresetsSaga(): SagaIterator;
|
|
4
|
-
export declare function fetchViewPresetsSaga({ payload, }: ReturnType<typeof viewPresetActions.fetchViewPresets>): SagaIterator;
|
|
5
|
-
export declare function saveViewPresetSaga({ payload, }: ReturnType<typeof viewPresetActions.saveViewPreset>): SagaIterator;
|
|
6
|
-
export declare function selectViewPresetSaga({ payload, }: ReturnType<typeof viewPresetActions.selectViewPreset>): SagaIterator;
|
|
7
|
-
export declare function onSuccessViewPresetActionSaga({ payload, }: ReturnType<typeof viewPresetActions.onSuccessViewPresetAction>): SagaIterator;
|
|
8
|
-
export declare function rootSaga(): SagaIterator;
|
|
9
|
-
export default rootSaga;
|
|
File without changes
|