@opengeoweb/workspace 14.5.1 → 14.5.2
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
CHANGED
|
@@ -1443,7 +1443,7 @@ var viewPresetsAdapter = createEntityAdapter({
|
|
|
1443
1443
|
var initialState$2 = viewPresetsAdapter.getInitialState();
|
|
1444
1444
|
var warningsPresetChangeActions = [publicWarningActions.setWarningFilters];
|
|
1445
1445
|
var syncGroupChangeActions = [syncGroupsActions.syncGroupRemoveTarget, syncGroupsActions.syncGroupAddTarget];
|
|
1446
|
-
var mapPresetChangeActions = [layerActions.setBaseLayers, layerActions.layerDelete, layerActions.addLayer, layerActions.duplicateMapLayer, layerActions.layerChangeEnabled, layerActions.layerChangeName, layerActions.layerChangeStyle, layerActions.layerChangeOpacity, layerActions.layerChangeDimension, 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];
|
|
1446
|
+
var mapPresetChangeActions = [layerActions.setBaseLayers, layerActions.layerDelete, layerActions.addLayer, layerActions.duplicateMapLayer, layerActions.layerChangeEnabled, layerActions.layerChangeName, layerActions.layerChangeStyle, layerActions.layerChangeOpacity, layerActions.layerChangeDimension, layerActions.layerChangeAcceptanceTime, 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];
|
|
1447
1447
|
var timeSeriesPresetChangeActions = [timeSeriesActions.addParameter, timeSeriesActions.addPlot, timeSeriesActions.deleteParameter, timeSeriesActions.deletePlot, timeSeriesActions.moveParameter, timeSeriesActions.movePlot, timeSeriesActions.toggleParameter, timeSeriesActions.togglePlot, timeSeriesActions.patchParameter, timeSeriesActions.updateTitle];
|
|
1448
1448
|
var supportedMapActionOrigins = [layerTypes.LayerActionOrigin.layerManager, layerTypes.LayerActionOrigin.wmsLoader, mapEnums.MapActionOrigin.map];
|
|
1449
1449
|
var supportedTimeSeriesActionOrigins = [TimeSeriesTypes.TimeSeriesActionOrigin.timeSeriesManager, TimeSeriesTypes.TimeSeriesActionOrigin.timeSeriesSelect];
|
|
@@ -5215,6 +5215,13 @@ workspaceListener.startListening({
|
|
|
5215
5215
|
payload = _ref3.payload;
|
|
5216
5216
|
// Cancel any in-progress instances of this listener
|
|
5217
5217
|
listenerApi.cancelActiveListeners();
|
|
5218
|
+
// see https://gitlab.com/opengeoweb/geoweb-assets/-/issues/4413
|
|
5219
|
+
_context4.next = 4;
|
|
5220
|
+
return listenerApi.condition(function (_action, currentState) {
|
|
5221
|
+
var _currentState$workspa;
|
|
5222
|
+
return ((_currentState$workspa = currentState.workspace) == null ? void 0 : _currentState$workspa.mosaicNode) === '';
|
|
5223
|
+
}, 500);
|
|
5224
|
+
case 4:
|
|
5218
5225
|
listenerApi.dispatch(syncGroupsActions.syncGroupClear());
|
|
5219
5226
|
listenerApi.dispatch(workspaceActions.setPreset(payload));
|
|
5220
5227
|
allSyncGroups = getSyncGroups(payload.workspacePreset.syncGroups);
|
|
@@ -5229,7 +5236,7 @@ workspaceListener.startListening({
|
|
|
5229
5236
|
isTimeScrollingEnabled: isTimeScrollingEnabled
|
|
5230
5237
|
}));
|
|
5231
5238
|
views = toViewsArray(payload.workspacePreset.views);
|
|
5232
|
-
_context4.next =
|
|
5239
|
+
_context4.next = 14;
|
|
5233
5240
|
return Promise.all(views.map(/*#__PURE__*/function () {
|
|
5234
5241
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(view) {
|
|
5235
5242
|
var _view$initialProps$sy, _view$initialProps;
|
|
@@ -5261,7 +5268,7 @@ workspaceListener.startListening({
|
|
|
5261
5268
|
return _ref4.apply(this, arguments);
|
|
5262
5269
|
};
|
|
5263
5270
|
}()));
|
|
5264
|
-
case
|
|
5271
|
+
case 14:
|
|
5265
5272
|
views.forEach(function (view) {
|
|
5266
5273
|
var panelId = view.mosaicNodeId;
|
|
5267
5274
|
if (!panelId) {
|
|
@@ -5273,7 +5280,7 @@ workspaceListener.startListening({
|
|
|
5273
5280
|
isInline: hasInlineConfig
|
|
5274
5281
|
}));
|
|
5275
5282
|
});
|
|
5276
|
-
case
|
|
5283
|
+
case 15:
|
|
5277
5284
|
case "end":
|
|
5278
5285
|
return _context4.stop();
|
|
5279
5286
|
}
|
|
@@ -6765,6 +6772,214 @@ var defaultComponentsLookUp = function defaultComponentsLookUp(_ref3) {
|
|
|
6765
6772
|
}
|
|
6766
6773
|
};
|
|
6767
6774
|
|
|
6775
|
+
var config = sessionStorageProvider.getConfig();
|
|
6776
|
+
var presetBaseUrl = (config == null ? void 0 : config.GW_PRESET_BACKEND_URL) || '';
|
|
6777
|
+
var labelsConfigUrl = '/assets/workspaceLabelsConfig.json';
|
|
6778
|
+
var getWorkspaceLabelsConfig = /*#__PURE__*/function () {
|
|
6779
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
6780
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
6781
|
+
while (1) switch (_context.prev = _context.next) {
|
|
6782
|
+
case 0:
|
|
6783
|
+
return _context.abrupt("return", fetch(labelsConfigUrl).then(handleResponse));
|
|
6784
|
+
case 1:
|
|
6785
|
+
case "end":
|
|
6786
|
+
return _context.stop();
|
|
6787
|
+
}
|
|
6788
|
+
}, _callee);
|
|
6789
|
+
}));
|
|
6790
|
+
return function getWorkspaceLabelsConfig() {
|
|
6791
|
+
return _ref.apply(this, arguments);
|
|
6792
|
+
};
|
|
6793
|
+
}();
|
|
6794
|
+
var getWorkspace = /*#__PURE__*/function () {
|
|
6795
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(workspaceId, auth) {
|
|
6796
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
6797
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
6798
|
+
case 0:
|
|
6799
|
+
return _context2.abrupt("return", fetch(presetBaseUrl + "/workspacepreset/" + workspaceId, {
|
|
6800
|
+
headers: getHeaders(auth)
|
|
6801
|
+
}).then(handleResponse));
|
|
6802
|
+
case 1:
|
|
6803
|
+
case "end":
|
|
6804
|
+
return _context2.stop();
|
|
6805
|
+
}
|
|
6806
|
+
}, _callee2);
|
|
6807
|
+
}));
|
|
6808
|
+
return function getWorkspace(_x, _x2) {
|
|
6809
|
+
return _ref2.apply(this, arguments);
|
|
6810
|
+
};
|
|
6811
|
+
}();
|
|
6812
|
+
var deleteWorkspace = /*#__PURE__*/function () {
|
|
6813
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(workspaceId, auth) {
|
|
6814
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
6815
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
6816
|
+
case 0:
|
|
6817
|
+
return _context3.abrupt("return", fetch(presetBaseUrl + "/workspacepreset/" + workspaceId, {
|
|
6818
|
+
headers: getHeaders(auth),
|
|
6819
|
+
method: 'DELETE'
|
|
6820
|
+
}).then(handleResponse));
|
|
6821
|
+
case 1:
|
|
6822
|
+
case "end":
|
|
6823
|
+
return _context3.stop();
|
|
6824
|
+
}
|
|
6825
|
+
}, _callee3);
|
|
6826
|
+
}));
|
|
6827
|
+
return function deleteWorkspace(_x3, _x4) {
|
|
6828
|
+
return _ref3.apply(this, arguments);
|
|
6829
|
+
};
|
|
6830
|
+
}();
|
|
6831
|
+
var updateWorkspace = /*#__PURE__*/function () {
|
|
6832
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(workspaceId, data, auth) {
|
|
6833
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
6834
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
6835
|
+
case 0:
|
|
6836
|
+
return _context4.abrupt("return", fetch(presetBaseUrl + "/workspacepreset/" + workspaceId, {
|
|
6837
|
+
headers: getHeaders(auth),
|
|
6838
|
+
method: 'PUT',
|
|
6839
|
+
body: JSON.stringify(data)
|
|
6840
|
+
}).then(handleResponse));
|
|
6841
|
+
case 1:
|
|
6842
|
+
case "end":
|
|
6843
|
+
return _context4.stop();
|
|
6844
|
+
}
|
|
6845
|
+
}, _callee4);
|
|
6846
|
+
}));
|
|
6847
|
+
return function updateWorkspace(_x5, _x6, _x7) {
|
|
6848
|
+
return _ref4.apply(this, arguments);
|
|
6849
|
+
};
|
|
6850
|
+
}();
|
|
6851
|
+
var createWorkspace = /*#__PURE__*/function () {
|
|
6852
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(data, auth) {
|
|
6853
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
6854
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
6855
|
+
case 0:
|
|
6856
|
+
return _context5.abrupt("return", fetch(presetBaseUrl + "/workspacepreset", {
|
|
6857
|
+
headers: getHeaders(auth),
|
|
6858
|
+
method: 'POST',
|
|
6859
|
+
body: JSON.stringify(data)
|
|
6860
|
+
}).then(handleResponse));
|
|
6861
|
+
case 1:
|
|
6862
|
+
case "end":
|
|
6863
|
+
return _context5.stop();
|
|
6864
|
+
}
|
|
6865
|
+
}, _callee5);
|
|
6866
|
+
}));
|
|
6867
|
+
return function createWorkspace(_x8, _x9) {
|
|
6868
|
+
return _ref5.apply(this, arguments);
|
|
6869
|
+
};
|
|
6870
|
+
}();
|
|
6871
|
+
|
|
6872
|
+
var useWorkspaceLabelsConfig = function useWorkspaceLabelsConfig() {
|
|
6873
|
+
return useQuery({
|
|
6874
|
+
queryKey: ['workspace-labels-config'],
|
|
6875
|
+
queryFn: getWorkspaceLabelsConfig
|
|
6876
|
+
});
|
|
6877
|
+
};
|
|
6878
|
+
var onWorkspaceApiError = function onWorkspaceApiError(dispatch, error, t) {
|
|
6879
|
+
dispatch(workspaceListActions.onErrorWorkspacePresetAction({
|
|
6880
|
+
error: {
|
|
6881
|
+
message: error.message + " " + t('workspace-error-generic'),
|
|
6882
|
+
type: WorkspaceListErrorType.VERBATIM_ERROR,
|
|
6883
|
+
category: error.message === 'Authentication context not found' ? WorkspaceListErrorCategory.AUTH : WorkspaceListErrorCategory.GENERIC
|
|
6884
|
+
}
|
|
6885
|
+
}));
|
|
6886
|
+
};
|
|
6887
|
+
var useDeleteWorkspacePreset = function useDeleteWorkspacePreset() {
|
|
6888
|
+
var _useAuthenticationCon = useAuthenticationContext(),
|
|
6889
|
+
auth = _useAuthenticationCon.auth;
|
|
6890
|
+
var _useSelector = useSelector(getWorkspaceActionFormValues),
|
|
6891
|
+
title = _useSelector.title;
|
|
6892
|
+
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
6893
|
+
t = _useWorkspaceTranslat.t;
|
|
6894
|
+
var dispatch = useDispatch();
|
|
6895
|
+
return useMutation({
|
|
6896
|
+
mutationFn: function () {
|
|
6897
|
+
var _mutationFn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
6898
|
+
var id;
|
|
6899
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
6900
|
+
while (1) switch (_context.prev = _context.next) {
|
|
6901
|
+
case 0:
|
|
6902
|
+
id = _ref.id;
|
|
6903
|
+
if (auth) {
|
|
6904
|
+
_context.next = 3;
|
|
6905
|
+
break;
|
|
6906
|
+
}
|
|
6907
|
+
throw new Error('Authentication context not found');
|
|
6908
|
+
case 3:
|
|
6909
|
+
return _context.abrupt("return", deleteWorkspace(id, auth));
|
|
6910
|
+
case 4:
|
|
6911
|
+
case "end":
|
|
6912
|
+
return _context.stop();
|
|
6913
|
+
}
|
|
6914
|
+
}, _callee);
|
|
6915
|
+
}));
|
|
6916
|
+
function mutationFn(_x) {
|
|
6917
|
+
return _mutationFn.apply(this, arguments);
|
|
6918
|
+
}
|
|
6919
|
+
return mutationFn;
|
|
6920
|
+
}(),
|
|
6921
|
+
onSuccess: function onSuccess(data, variables) {
|
|
6922
|
+
dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
6923
|
+
workspaceId: variables.id,
|
|
6924
|
+
action: WorkspacePresetAction.DELETE,
|
|
6925
|
+
emptyWorkspacePresetTitle: t('workspace-new'),
|
|
6926
|
+
title: title
|
|
6927
|
+
}));
|
|
6928
|
+
},
|
|
6929
|
+
onError: function onError(error) {
|
|
6930
|
+
onWorkspaceApiError(dispatch, error, t);
|
|
6931
|
+
}
|
|
6932
|
+
});
|
|
6933
|
+
};
|
|
6934
|
+
var useCreateWorkspacePreset = function useCreateWorkspacePreset() {
|
|
6935
|
+
var _useAuthenticationCon2 = useAuthenticationContext(),
|
|
6936
|
+
auth = _useAuthenticationCon2.auth;
|
|
6937
|
+
var _useWorkspaceTranslat2 = useWorkspaceTranslation(),
|
|
6938
|
+
t = _useWorkspaceTranslat2.t;
|
|
6939
|
+
var dispatch = useDispatch();
|
|
6940
|
+
return useMutation({
|
|
6941
|
+
mutationFn: function () {
|
|
6942
|
+
var _mutationFn2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
|
|
6943
|
+
var data;
|
|
6944
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
6945
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
6946
|
+
case 0:
|
|
6947
|
+
data = _ref2.data;
|
|
6948
|
+
if (auth) {
|
|
6949
|
+
_context2.next = 3;
|
|
6950
|
+
break;
|
|
6951
|
+
}
|
|
6952
|
+
throw new Error('Authentication context not found');
|
|
6953
|
+
case 3:
|
|
6954
|
+
return _context2.abrupt("return", createWorkspace(data, auth));
|
|
6955
|
+
case 4:
|
|
6956
|
+
case "end":
|
|
6957
|
+
return _context2.stop();
|
|
6958
|
+
}
|
|
6959
|
+
}, _callee2);
|
|
6960
|
+
}));
|
|
6961
|
+
function mutationFn(_x2) {
|
|
6962
|
+
return _mutationFn2.apply(this, arguments);
|
|
6963
|
+
}
|
|
6964
|
+
return mutationFn;
|
|
6965
|
+
}(),
|
|
6966
|
+
onSuccess: function onSuccess(data, variables) {
|
|
6967
|
+
var location = data == null ? void 0 : data.get('location');
|
|
6968
|
+
var newId = getIdFromUrl(location);
|
|
6969
|
+
var scope = variables.data.scope || 'user';
|
|
6970
|
+
dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
6971
|
+
workspaceId: newId,
|
|
6972
|
+
action: variables.action || WorkspacePresetAction.SAVE_AS,
|
|
6973
|
+
title: variables.data.title,
|
|
6974
|
+
scope: scope
|
|
6975
|
+
}));
|
|
6976
|
+
},
|
|
6977
|
+
onError: function onError(error) {
|
|
6978
|
+
onWorkspaceApiError(dispatch, error, t);
|
|
6979
|
+
}
|
|
6980
|
+
});
|
|
6981
|
+
};
|
|
6982
|
+
|
|
6768
6983
|
/* *
|
|
6769
6984
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6770
6985
|
* you may not use this file except in compliance with the License.
|
|
@@ -7185,7 +7400,8 @@ var PresetLabelsPanel = function PresetLabelsPanel(_ref) {
|
|
|
7185
7400
|
var WorkspaceMenuLabelsPanel = function WorkspaceMenuLabelsPanel(_ref) {
|
|
7186
7401
|
var value = _ref.value,
|
|
7187
7402
|
onChange = _ref.onChange,
|
|
7188
|
-
menuLabels = _ref.menuLabels
|
|
7403
|
+
menuLabels = _ref.menuLabels,
|
|
7404
|
+
labelsConfig = _ref.labelsConfig;
|
|
7189
7405
|
var methods = useForm({
|
|
7190
7406
|
defaultValues: {
|
|
7191
7407
|
labels: value != null ? value : {},
|
|
@@ -7196,6 +7412,7 @@ var WorkspaceMenuLabelsPanel = function WorkspaceMenuLabelsPanel(_ref) {
|
|
|
7196
7412
|
children: jsx(PresetLabelsPanel, {
|
|
7197
7413
|
"data-testid": "workspace-menu-labels-panel",
|
|
7198
7414
|
isMenuFilterMode: true,
|
|
7415
|
+
labelsConfig: labelsConfig,
|
|
7199
7416
|
menuLabels: menuLabels,
|
|
7200
7417
|
onLabelsChange: onChange
|
|
7201
7418
|
})
|
|
@@ -7902,6 +8119,8 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
7902
8119
|
t = _useWorkspaceTranslat.t;
|
|
7903
8120
|
var dispatch = useDispatch();
|
|
7904
8121
|
var store = useStore();
|
|
8122
|
+
var _useWorkspaceLabelsCo = useWorkspaceLabelsConfig(),
|
|
8123
|
+
labelsConfig = _useWorkspaceLabelsCo.data;
|
|
7905
8124
|
var _useAuthenticationCon = useAuthenticationContext(),
|
|
7906
8125
|
currentRole = _useAuthenticationCon.currentRole,
|
|
7907
8126
|
isLoggedIn = _useAuthenticationCon.isLoggedIn,
|
|
@@ -8233,6 +8452,7 @@ var ViewPresetMenuListConnect = function ViewPresetMenuListConnect(_ref) {
|
|
|
8233
8452
|
},
|
|
8234
8453
|
children: jsx(FormProvider, Object.assign({}, labelsFormMethods, {
|
|
8235
8454
|
children: jsx(WorkspaceMenuLabelsPanel, {
|
|
8455
|
+
labelsConfig: labelsConfig,
|
|
8236
8456
|
menuLabels: viewPresetLabelFilters,
|
|
8237
8457
|
onChange: onLabelsFilterChange
|
|
8238
8458
|
})
|
|
@@ -8410,103 +8630,6 @@ var ViewPresetMenu = function ViewPresetMenu(_ref) {
|
|
|
8410
8630
|
});
|
|
8411
8631
|
};
|
|
8412
8632
|
|
|
8413
|
-
var config = sessionStorageProvider.getConfig();
|
|
8414
|
-
var presetBaseUrl = (config == null ? void 0 : config.GW_PRESET_BACKEND_URL) || '';
|
|
8415
|
-
var labelsConfigUrl = '/assets/workspaceLabelsConfig.json';
|
|
8416
|
-
var getWorkspaceLabelsConfig = /*#__PURE__*/function () {
|
|
8417
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
8418
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8419
|
-
while (1) switch (_context.prev = _context.next) {
|
|
8420
|
-
case 0:
|
|
8421
|
-
return _context.abrupt("return", fetch(labelsConfigUrl).then(handleResponse));
|
|
8422
|
-
case 1:
|
|
8423
|
-
case "end":
|
|
8424
|
-
return _context.stop();
|
|
8425
|
-
}
|
|
8426
|
-
}, _callee);
|
|
8427
|
-
}));
|
|
8428
|
-
return function getWorkspaceLabelsConfig() {
|
|
8429
|
-
return _ref.apply(this, arguments);
|
|
8430
|
-
};
|
|
8431
|
-
}();
|
|
8432
|
-
var getWorkspace = /*#__PURE__*/function () {
|
|
8433
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(workspaceId, auth) {
|
|
8434
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8435
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
8436
|
-
case 0:
|
|
8437
|
-
return _context2.abrupt("return", fetch(presetBaseUrl + "/workspacepreset/" + workspaceId, {
|
|
8438
|
-
headers: getHeaders(auth)
|
|
8439
|
-
}).then(handleResponse));
|
|
8440
|
-
case 1:
|
|
8441
|
-
case "end":
|
|
8442
|
-
return _context2.stop();
|
|
8443
|
-
}
|
|
8444
|
-
}, _callee2);
|
|
8445
|
-
}));
|
|
8446
|
-
return function getWorkspace(_x, _x2) {
|
|
8447
|
-
return _ref2.apply(this, arguments);
|
|
8448
|
-
};
|
|
8449
|
-
}();
|
|
8450
|
-
var deleteWorkspace = /*#__PURE__*/function () {
|
|
8451
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(workspaceId, auth) {
|
|
8452
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
8453
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
8454
|
-
case 0:
|
|
8455
|
-
return _context3.abrupt("return", fetch(presetBaseUrl + "/workspacepreset/" + workspaceId, {
|
|
8456
|
-
headers: getHeaders(auth),
|
|
8457
|
-
method: 'DELETE'
|
|
8458
|
-
}).then(handleResponse));
|
|
8459
|
-
case 1:
|
|
8460
|
-
case "end":
|
|
8461
|
-
return _context3.stop();
|
|
8462
|
-
}
|
|
8463
|
-
}, _callee3);
|
|
8464
|
-
}));
|
|
8465
|
-
return function deleteWorkspace(_x3, _x4) {
|
|
8466
|
-
return _ref3.apply(this, arguments);
|
|
8467
|
-
};
|
|
8468
|
-
}();
|
|
8469
|
-
var updateWorkspace = /*#__PURE__*/function () {
|
|
8470
|
-
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(workspaceId, data, auth) {
|
|
8471
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
8472
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
8473
|
-
case 0:
|
|
8474
|
-
return _context4.abrupt("return", fetch(presetBaseUrl + "/workspacepreset/" + workspaceId, {
|
|
8475
|
-
headers: getHeaders(auth),
|
|
8476
|
-
method: 'PUT',
|
|
8477
|
-
body: JSON.stringify(data)
|
|
8478
|
-
}).then(handleResponse));
|
|
8479
|
-
case 1:
|
|
8480
|
-
case "end":
|
|
8481
|
-
return _context4.stop();
|
|
8482
|
-
}
|
|
8483
|
-
}, _callee4);
|
|
8484
|
-
}));
|
|
8485
|
-
return function updateWorkspace(_x5, _x6, _x7) {
|
|
8486
|
-
return _ref4.apply(this, arguments);
|
|
8487
|
-
};
|
|
8488
|
-
}();
|
|
8489
|
-
var createWorkspace = /*#__PURE__*/function () {
|
|
8490
|
-
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(data, auth) {
|
|
8491
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
8492
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
8493
|
-
case 0:
|
|
8494
|
-
return _context5.abrupt("return", fetch(presetBaseUrl + "/workspacepreset", {
|
|
8495
|
-
headers: getHeaders(auth),
|
|
8496
|
-
method: 'POST',
|
|
8497
|
-
body: JSON.stringify(data)
|
|
8498
|
-
}).then(handleResponse));
|
|
8499
|
-
case 1:
|
|
8500
|
-
case "end":
|
|
8501
|
-
return _context5.stop();
|
|
8502
|
-
}
|
|
8503
|
-
}, _callee5);
|
|
8504
|
-
}));
|
|
8505
|
-
return function createWorkspace(_x8, _x9) {
|
|
8506
|
-
return _ref5.apply(this, arguments);
|
|
8507
|
-
};
|
|
8508
|
-
}();
|
|
8509
|
-
|
|
8510
8633
|
var WorkspaceSelectListConnect = function WorkspaceSelectListConnect(_ref) {
|
|
8511
8634
|
var _GENERIC$AUTH$error$c;
|
|
8512
8635
|
var _ref$isLabelFilterOpe = _ref.isLabelFilterOpen,
|
|
@@ -8515,6 +8638,8 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect(_ref) {
|
|
|
8515
8638
|
var dispatch = useDispatch();
|
|
8516
8639
|
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
8517
8640
|
t = _useWorkspaceTranslat.t;
|
|
8641
|
+
var _useWorkspaceLabelsCo = useWorkspaceLabelsConfig(),
|
|
8642
|
+
labelsConfig = _useWorkspaceLabelsCo.data;
|
|
8518
8643
|
var _useAuthenticationCon = useAuthenticationContext(),
|
|
8519
8644
|
currentRole = _useAuthenticationCon.currentRole,
|
|
8520
8645
|
isLoggedIn = _useAuthenticationCon.isLoggedIn,
|
|
@@ -8883,6 +9008,7 @@ var WorkspaceSelectListConnect = function WorkspaceSelectListConnect(_ref) {
|
|
|
8883
9008
|
},
|
|
8884
9009
|
children: jsx(FormProvider, Object.assign({}, labelsFormMethods, {
|
|
8885
9010
|
children: jsx(WorkspaceMenuLabelsPanel, {
|
|
9011
|
+
labelsConfig: labelsConfig,
|
|
8886
9012
|
menuLabels: labelFilters,
|
|
8887
9013
|
onChange: onLabelsFilterChange
|
|
8888
9014
|
})
|
|
@@ -10203,117 +10329,6 @@ var WorkspaceTab = function WorkspaceTab(_ref) {
|
|
|
10203
10329
|
});
|
|
10204
10330
|
};
|
|
10205
10331
|
|
|
10206
|
-
var useWorkspaceLabelsConfig = function useWorkspaceLabelsConfig() {
|
|
10207
|
-
return useQuery({
|
|
10208
|
-
queryKey: ['workspace-labels-config'],
|
|
10209
|
-
queryFn: getWorkspaceLabelsConfig
|
|
10210
|
-
});
|
|
10211
|
-
};
|
|
10212
|
-
var onWorkspaceApiError = function onWorkspaceApiError(dispatch, error, t) {
|
|
10213
|
-
dispatch(workspaceListActions.onErrorWorkspacePresetAction({
|
|
10214
|
-
error: {
|
|
10215
|
-
message: error.message + " " + t('workspace-error-generic'),
|
|
10216
|
-
type: WorkspaceListErrorType.VERBATIM_ERROR,
|
|
10217
|
-
category: error.message === 'Authentication context not found' ? WorkspaceListErrorCategory.AUTH : WorkspaceListErrorCategory.GENERIC
|
|
10218
|
-
}
|
|
10219
|
-
}));
|
|
10220
|
-
};
|
|
10221
|
-
var useDeleteWorkspacePreset = function useDeleteWorkspacePreset() {
|
|
10222
|
-
var _useAuthenticationCon = useAuthenticationContext(),
|
|
10223
|
-
auth = _useAuthenticationCon.auth;
|
|
10224
|
-
var _useSelector = useSelector(getWorkspaceActionFormValues),
|
|
10225
|
-
title = _useSelector.title;
|
|
10226
|
-
var _useWorkspaceTranslat = useWorkspaceTranslation(),
|
|
10227
|
-
t = _useWorkspaceTranslat.t;
|
|
10228
|
-
var dispatch = useDispatch();
|
|
10229
|
-
return useMutation({
|
|
10230
|
-
mutationFn: function () {
|
|
10231
|
-
var _mutationFn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
10232
|
-
var id;
|
|
10233
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10234
|
-
while (1) switch (_context.prev = _context.next) {
|
|
10235
|
-
case 0:
|
|
10236
|
-
id = _ref.id;
|
|
10237
|
-
if (auth) {
|
|
10238
|
-
_context.next = 3;
|
|
10239
|
-
break;
|
|
10240
|
-
}
|
|
10241
|
-
throw new Error('Authentication context not found');
|
|
10242
|
-
case 3:
|
|
10243
|
-
return _context.abrupt("return", deleteWorkspace(id, auth));
|
|
10244
|
-
case 4:
|
|
10245
|
-
case "end":
|
|
10246
|
-
return _context.stop();
|
|
10247
|
-
}
|
|
10248
|
-
}, _callee);
|
|
10249
|
-
}));
|
|
10250
|
-
function mutationFn(_x) {
|
|
10251
|
-
return _mutationFn.apply(this, arguments);
|
|
10252
|
-
}
|
|
10253
|
-
return mutationFn;
|
|
10254
|
-
}(),
|
|
10255
|
-
onSuccess: function onSuccess(data, variables) {
|
|
10256
|
-
dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
10257
|
-
workspaceId: variables.id,
|
|
10258
|
-
action: WorkspacePresetAction.DELETE,
|
|
10259
|
-
emptyWorkspacePresetTitle: t('workspace-new'),
|
|
10260
|
-
title: title
|
|
10261
|
-
}));
|
|
10262
|
-
},
|
|
10263
|
-
onError: function onError(error) {
|
|
10264
|
-
onWorkspaceApiError(dispatch, error, t);
|
|
10265
|
-
}
|
|
10266
|
-
});
|
|
10267
|
-
};
|
|
10268
|
-
var useCreateWorkspacePreset = function useCreateWorkspacePreset() {
|
|
10269
|
-
var _useAuthenticationCon2 = useAuthenticationContext(),
|
|
10270
|
-
auth = _useAuthenticationCon2.auth;
|
|
10271
|
-
var _useWorkspaceTranslat2 = useWorkspaceTranslation(),
|
|
10272
|
-
t = _useWorkspaceTranslat2.t;
|
|
10273
|
-
var dispatch = useDispatch();
|
|
10274
|
-
return useMutation({
|
|
10275
|
-
mutationFn: function () {
|
|
10276
|
-
var _mutationFn2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
|
|
10277
|
-
var data;
|
|
10278
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
10279
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
10280
|
-
case 0:
|
|
10281
|
-
data = _ref2.data;
|
|
10282
|
-
if (auth) {
|
|
10283
|
-
_context2.next = 3;
|
|
10284
|
-
break;
|
|
10285
|
-
}
|
|
10286
|
-
throw new Error('Authentication context not found');
|
|
10287
|
-
case 3:
|
|
10288
|
-
return _context2.abrupt("return", createWorkspace(data, auth));
|
|
10289
|
-
case 4:
|
|
10290
|
-
case "end":
|
|
10291
|
-
return _context2.stop();
|
|
10292
|
-
}
|
|
10293
|
-
}, _callee2);
|
|
10294
|
-
}));
|
|
10295
|
-
function mutationFn(_x2) {
|
|
10296
|
-
return _mutationFn2.apply(this, arguments);
|
|
10297
|
-
}
|
|
10298
|
-
return mutationFn;
|
|
10299
|
-
}(),
|
|
10300
|
-
onSuccess: function onSuccess(data, variables) {
|
|
10301
|
-
var location = data == null ? void 0 : data.get('location');
|
|
10302
|
-
var newId = getIdFromUrl(location);
|
|
10303
|
-
var scope = variables.data.scope || 'user';
|
|
10304
|
-
dispatch(workspaceListActions.onSuccessWorkspacePresetAction({
|
|
10305
|
-
workspaceId: newId,
|
|
10306
|
-
action: variables.action || WorkspacePresetAction.SAVE_AS,
|
|
10307
|
-
title: variables.data.title,
|
|
10308
|
-
scope: scope
|
|
10309
|
-
}));
|
|
10310
|
-
},
|
|
10311
|
-
onError: function onError(error) {
|
|
10312
|
-
onWorkspaceApiError(dispatch, error, t);
|
|
10313
|
-
}
|
|
10314
|
-
});
|
|
10315
|
-
};
|
|
10316
|
-
|
|
10317
10332
|
var _excluded$3 = ["title", "description", "abstract"];
|
|
10318
10333
|
var ERROR_DUPLICATE_TITLE_BE = 'Preset title already in use, please choose a different title';
|
|
10319
10334
|
var ERROR_LONG_TITLE_BE = 'Preset title cannot exceed 100 characters';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/workspace",
|
|
3
|
-
"version": "14.5.
|
|
3
|
+
"version": "14.5.2",
|
|
4
4
|
"description": "GeoWeb Workspace library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -9,33 +9,33 @@
|
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"react-redux": "^9.2.0",
|
|
12
|
-
"@opengeoweb/shared": "14.5.
|
|
13
|
-
"@opengeoweb/store": "14.5.
|
|
14
|
-
"@opengeoweb/api": "14.5.
|
|
12
|
+
"@opengeoweb/shared": "14.5.2",
|
|
13
|
+
"@opengeoweb/store": "14.5.2",
|
|
14
|
+
"@opengeoweb/api": "14.5.2",
|
|
15
15
|
"react-hook-form": "^7.50.1",
|
|
16
|
-
"@opengeoweb/theme": "14.5.
|
|
16
|
+
"@opengeoweb/theme": "14.5.2",
|
|
17
17
|
"@reduxjs/toolkit": "^2.6.1",
|
|
18
|
-
"@opengeoweb/snackbar": "14.5.
|
|
18
|
+
"@opengeoweb/snackbar": "14.5.2",
|
|
19
19
|
"react-window": "^1.8.10",
|
|
20
20
|
"lodash": "^4.17.21",
|
|
21
21
|
"axios": "^1.7.7",
|
|
22
22
|
"react-virtualized-auto-sizer": "^1.0.21",
|
|
23
23
|
"react-mosaic-component": "^6.1.0",
|
|
24
|
-
"@opengeoweb/form-fields": "14.5.
|
|
25
|
-
"@opengeoweb/time-series": "14.5.
|
|
26
|
-
"@opengeoweb/authentication": "14.5.
|
|
27
|
-
"@opengeoweb/core": "14.5.
|
|
28
|
-
"@opengeoweb/taf": "14.5.
|
|
29
|
-
"@opengeoweb/sigmet-airmet": "14.5.
|
|
30
|
-
"@opengeoweb/warnings": "14.5.
|
|
31
|
-
"@opengeoweb/space-weather": "14.5.
|
|
24
|
+
"@opengeoweb/form-fields": "14.5.2",
|
|
25
|
+
"@opengeoweb/time-series": "14.5.2",
|
|
26
|
+
"@opengeoweb/authentication": "14.5.2",
|
|
27
|
+
"@opengeoweb/core": "14.5.2",
|
|
28
|
+
"@opengeoweb/taf": "14.5.2",
|
|
29
|
+
"@opengeoweb/sigmet-airmet": "14.5.2",
|
|
30
|
+
"@opengeoweb/warnings": "14.5.2",
|
|
31
|
+
"@opengeoweb/space-weather": "14.5.2",
|
|
32
32
|
"i18next": "^25.0.1",
|
|
33
33
|
"react-i18next": "^15.1.1",
|
|
34
34
|
"@mui/material": "^7.0.1",
|
|
35
|
-
"@opengeoweb/webmap-react": "14.5.
|
|
35
|
+
"@opengeoweb/webmap-react": "14.5.2",
|
|
36
36
|
"@tanstack/react-query": "^5.85.5",
|
|
37
|
-
"@opengeoweb/soundings": "14.5.
|
|
38
|
-
"@opengeoweb/knmi-components": "14.5.
|
|
37
|
+
"@opengeoweb/soundings": "14.5.2",
|
|
38
|
+
"@opengeoweb/knmi-components": "14.5.2",
|
|
39
39
|
"@mui/system": "^7.3.5"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { WorkspacePresetLabels } from '../../store/workspace/types';
|
|
2
|
+
import type { WorkspaceLabelsConfigResponse, WorkspacePresetLabels } from '../../store/workspace/types';
|
|
3
3
|
export interface WorkspaceMenuLabelsPanelProps {
|
|
4
4
|
value?: WorkspacePresetLabels;
|
|
5
5
|
onChange?: (labels: WorkspacePresetLabels) => void;
|
|
6
6
|
menuLabels?: WorkspacePresetLabels;
|
|
7
|
+
labelsConfig: WorkspaceLabelsConfigResponse | undefined;
|
|
7
8
|
}
|
|
8
9
|
declare const WorkspaceMenuLabelsPanel: React.FC<WorkspaceMenuLabelsPanelProps>;
|
|
9
10
|
export default WorkspaceMenuLabelsPanel;
|