@opengeoweb/taf 12.4.2 → 12.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js
CHANGED
|
@@ -2640,8 +2640,8 @@ var postTaf = function postTaf(auth, data) {
|
|
|
2640
2640
|
body: JSON.stringify(data)
|
|
2641
2641
|
}).then(handleResponse);
|
|
2642
2642
|
};
|
|
2643
|
-
var patchTaf = function patchTaf(auth, data) {
|
|
2644
|
-
return fetch(tafBaseUrl + "/taf?force=true
|
|
2643
|
+
var patchTaf = function patchTaf(auth, data, force) {
|
|
2644
|
+
return fetch(tafBaseUrl + "/taf?force=" + (force ? 'true' : 'false'), {
|
|
2645
2645
|
method: 'PATCH',
|
|
2646
2646
|
headers: getHeaders(auth),
|
|
2647
2647
|
body: JSON.stringify(data)
|
|
@@ -3011,12 +3011,13 @@ var usePatchTaf = function usePatchTaf() {
|
|
|
3011
3011
|
return useMutation({
|
|
3012
3012
|
mutationFn: function mutationFn(_ref4) {
|
|
3013
3013
|
var tafData = _ref4.tafData,
|
|
3014
|
-
setError = _ref4.setError
|
|
3014
|
+
setError = _ref4.setError,
|
|
3015
|
+
force = _ref4.force;
|
|
3015
3016
|
if (!auth) {
|
|
3016
3017
|
throw new Error('Authentication context not found');
|
|
3017
3018
|
}
|
|
3018
3019
|
setError(null);
|
|
3019
|
-
return patchTaf(auth, tafData);
|
|
3020
|
+
return patchTaf(auth, tafData, force);
|
|
3020
3021
|
},
|
|
3021
3022
|
onSuccess: function () {
|
|
3022
3023
|
var _onSuccess2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
@@ -3038,12 +3039,39 @@ var usePatchTaf = function usePatchTaf() {
|
|
|
3038
3039
|
}
|
|
3039
3040
|
return onSuccess;
|
|
3040
3041
|
}(),
|
|
3041
|
-
onError: function
|
|
3042
|
-
var
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3042
|
+
onError: function () {
|
|
3043
|
+
var _onError2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(error, _ref5) {
|
|
3044
|
+
var tafData, setError, newError;
|
|
3045
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3046
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
3047
|
+
case 0:
|
|
3048
|
+
tafData = _ref5.tafData, setError = _ref5.setError;
|
|
3049
|
+
if (!(error.cause === 409)) {
|
|
3050
|
+
_context4.next = 6;
|
|
3051
|
+
break;
|
|
3052
|
+
}
|
|
3053
|
+
_context4.next = 4;
|
|
3054
|
+
return queryClient.invalidateQueries({
|
|
3055
|
+
queryKey: ['taf-list']
|
|
3056
|
+
});
|
|
3057
|
+
case 4:
|
|
3058
|
+
_context4.next = 8;
|
|
3059
|
+
break;
|
|
3060
|
+
case 6:
|
|
3061
|
+
// no refetch, show error message
|
|
3062
|
+
newError = parseErrorMessage(error, tafData, t);
|
|
3063
|
+
setError(newError);
|
|
3064
|
+
case 8:
|
|
3065
|
+
case "end":
|
|
3066
|
+
return _context4.stop();
|
|
3067
|
+
}
|
|
3068
|
+
}, _callee4);
|
|
3069
|
+
}));
|
|
3070
|
+
function onError(_x5, _x6) {
|
|
3071
|
+
return _onError2.apply(this, arguments);
|
|
3072
|
+
}
|
|
3073
|
+
return onError;
|
|
3074
|
+
}()
|
|
3047
3075
|
});
|
|
3048
3076
|
};
|
|
3049
3077
|
var useGetTAC = function useGetTAC() {
|
|
@@ -4926,60 +4954,18 @@ var TafForm = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
4926
4954
|
message: message
|
|
4927
4955
|
}));
|
|
4928
4956
|
}, [dispatch]);
|
|
4929
|
-
var isLatestEditor = function isLatestEditor(latestEditor, userName) {
|
|
4930
|
-
return latestEditor !== '' && latestEditor !== null && latestEditor !== userName;
|
|
4931
|
-
};
|
|
4932
|
-
var _useTafList = useTafList(true),
|
|
4933
|
-
fetchNewTafList = _useTafList.refetch;
|
|
4934
4957
|
var setIsEditor = /*#__PURE__*/function () {
|
|
4935
4958
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(checked) {
|
|
4936
|
-
var username,
|
|
4959
|
+
var username, didSucceed;
|
|
4937
4960
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
4938
4961
|
while (1) switch (_context.prev = _context.next) {
|
|
4939
4962
|
case 0:
|
|
4940
|
-
username = checked ? auth == null ? void 0 : auth.username : '';
|
|
4963
|
+
username = checked ? auth == null ? void 0 : auth.username : '';
|
|
4941
4964
|
_context.next = 3;
|
|
4942
|
-
return fetchNewTafList();
|
|
4943
|
-
case 3:
|
|
4944
|
-
_yield$fetchNewTafLis = _context.sent;
|
|
4945
|
-
latestList = _yield$fetchNewTafLis.data;
|
|
4946
|
-
if (latestList) {
|
|
4947
|
-
_context.next = 7;
|
|
4948
|
-
break;
|
|
4949
|
-
}
|
|
4950
|
-
return _context.abrupt("return", false);
|
|
4951
|
-
case 7:
|
|
4952
|
-
_latestList$find = latestList.find(function (taf) {
|
|
4953
|
-
return taf.taf.uuid === originalTaf.uuid;
|
|
4954
|
-
}), latestEditor = _latestList$find.editor;
|
|
4955
|
-
if (!(username === latestEditor)) {
|
|
4956
|
-
_context.next = 10;
|
|
4957
|
-
break;
|
|
4958
|
-
}
|
|
4959
|
-
return _context.abrupt("return", true);
|
|
4960
|
-
case 10:
|
|
4961
|
-
if (!(!checked && isLatestEditor(latestEditor, auth == null ? void 0 : auth.username))) {
|
|
4962
|
-
_context.next = 12;
|
|
4963
|
-
break;
|
|
4964
|
-
}
|
|
4965
|
-
return _context.abrupt("return", true);
|
|
4966
|
-
case 12:
|
|
4967
|
-
if (!(checked && isLatestEditor(latestEditor, auth == null ? void 0 : auth.username))) {
|
|
4968
|
-
_context.next = 15;
|
|
4969
|
-
break;
|
|
4970
|
-
}
|
|
4971
|
-
_context.next = 15;
|
|
4972
|
-
return confirmDialog({
|
|
4973
|
-
title: t('switch-title'),
|
|
4974
|
-
description: t('switch-description'),
|
|
4975
|
-
confirmLabel: t('switch-confirm')
|
|
4976
|
-
});
|
|
4977
|
-
case 15:
|
|
4978
|
-
_context.next = 17;
|
|
4979
4965
|
return onSwitchEditor(Object.assign({}, tafFromBackend, {
|
|
4980
4966
|
editor: username
|
|
4981
4967
|
}));
|
|
4982
|
-
case
|
|
4968
|
+
case 3:
|
|
4983
4969
|
didSucceed = _context.sent;
|
|
4984
4970
|
if (didSucceed) {
|
|
4985
4971
|
showSnackbar(checked ? t('editor-on', {
|
|
@@ -4989,7 +4975,7 @@ var TafForm = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
4989
4975
|
}));
|
|
4990
4976
|
}
|
|
4991
4977
|
return _context.abrupt("return", didSucceed);
|
|
4992
|
-
case
|
|
4978
|
+
case 6:
|
|
4993
4979
|
case "end":
|
|
4994
4980
|
return _context.stop();
|
|
4995
4981
|
}
|
|
@@ -5495,7 +5481,7 @@ var AdverseWeatherTACMessage = function AdverseWeatherTACMessage(_ref) {
|
|
|
5495
5481
|
letterSpacing: '0.4px',
|
|
5496
5482
|
color: 'geowebColors.captions.captionStatus.rgba'
|
|
5497
5483
|
},
|
|
5498
|
-
children: TAC.tac.map(function (line, index) {
|
|
5484
|
+
children: TAC == null ? void 0 : TAC.tac.map(function (line, index) {
|
|
5499
5485
|
return jsx(Box$1, {
|
|
5500
5486
|
component: "span",
|
|
5501
5487
|
sx: {
|
|
@@ -6392,31 +6378,60 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
6392
6378
|
return _ref2.apply(this, arguments);
|
|
6393
6379
|
};
|
|
6394
6380
|
}();
|
|
6395
|
-
var
|
|
6396
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data) {
|
|
6381
|
+
var updateEditor = /*#__PURE__*/function () {
|
|
6382
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data, force) {
|
|
6397
6383
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
6398
6384
|
while (1) switch (_context2.prev = _context2.next) {
|
|
6399
6385
|
case 0:
|
|
6400
|
-
_context2.
|
|
6401
|
-
_context2.next = 3;
|
|
6402
|
-
return patchTafRequest({
|
|
6386
|
+
return _context2.abrupt("return", patchTafRequest({
|
|
6403
6387
|
tafData: data,
|
|
6404
|
-
setError: setError
|
|
6405
|
-
|
|
6388
|
+
setError: setError,
|
|
6389
|
+
force: force
|
|
6390
|
+
}, {
|
|
6391
|
+
onError: function onError(e) {
|
|
6392
|
+
if (e.cause === 409) {
|
|
6393
|
+
void confirmDialog({
|
|
6394
|
+
title: t('switch-title'),
|
|
6395
|
+
description: t('switch-description'),
|
|
6396
|
+
confirmLabel: t('switch-confirm')
|
|
6397
|
+
}).then(function () {
|
|
6398
|
+
return void updateEditor(data, true);
|
|
6399
|
+
});
|
|
6400
|
+
}
|
|
6401
|
+
}
|
|
6402
|
+
}));
|
|
6403
|
+
case 1:
|
|
6404
|
+
case "end":
|
|
6405
|
+
return _context2.stop();
|
|
6406
|
+
}
|
|
6407
|
+
}, _callee2);
|
|
6408
|
+
}));
|
|
6409
|
+
return function updateEditor(_x3, _x4) {
|
|
6410
|
+
return _ref3.apply(this, arguments);
|
|
6411
|
+
};
|
|
6412
|
+
}();
|
|
6413
|
+
var patchTaf = /*#__PURE__*/function () {
|
|
6414
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data) {
|
|
6415
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
6416
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
6417
|
+
case 0:
|
|
6418
|
+
_context3.prev = 0;
|
|
6419
|
+
_context3.next = 3;
|
|
6420
|
+
return updateEditor(data, false);
|
|
6406
6421
|
case 3:
|
|
6407
|
-
return
|
|
6422
|
+
return _context3.abrupt("return", true);
|
|
6408
6423
|
case 6:
|
|
6409
|
-
|
|
6410
|
-
|
|
6411
|
-
return
|
|
6424
|
+
_context3.prev = 6;
|
|
6425
|
+
_context3.t0 = _context3["catch"](0);
|
|
6426
|
+
return _context3.abrupt("return", false);
|
|
6412
6427
|
case 9:
|
|
6413
6428
|
case "end":
|
|
6414
|
-
return
|
|
6429
|
+
return _context3.stop();
|
|
6415
6430
|
}
|
|
6416
|
-
},
|
|
6431
|
+
}, _callee3, null, [[0, 6]]);
|
|
6417
6432
|
}));
|
|
6418
|
-
return function patchTaf(
|
|
6419
|
-
return
|
|
6433
|
+
return function patchTaf(_x5) {
|
|
6434
|
+
return _ref4.apply(this, arguments);
|
|
6420
6435
|
};
|
|
6421
6436
|
}();
|
|
6422
6437
|
var CONFIRM_DIALOG_OPTIONS = {
|
|
@@ -6424,51 +6439,51 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
6424
6439
|
description: t('confirm-dialog-description'),
|
|
6425
6440
|
confirmLabel: t('confirm-dialog-confirm-label')
|
|
6426
6441
|
};
|
|
6427
|
-
function onChangeTab(
|
|
6442
|
+
function onChangeTab(_x6, _x7, _x8) {
|
|
6428
6443
|
return _onChangeTab.apply(this, arguments);
|
|
6429
6444
|
}
|
|
6430
6445
|
function _onChangeTab() {
|
|
6431
|
-
_onChangeTab = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
6446
|
+
_onChangeTab = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(action, value, isFormDirty) {
|
|
6432
6447
|
var taf;
|
|
6433
|
-
return _regeneratorRuntime().wrap(function
|
|
6434
|
-
while (1) switch (
|
|
6448
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
6449
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
6435
6450
|
case 0:
|
|
6436
6451
|
if (!isFormDirty) {
|
|
6437
|
-
|
|
6452
|
+
_context4.next = 15;
|
|
6438
6453
|
break;
|
|
6439
6454
|
}
|
|
6440
|
-
|
|
6441
|
-
|
|
6455
|
+
_context4.prev = 1;
|
|
6456
|
+
_context4.next = 4;
|
|
6442
6457
|
return onValidateForm();
|
|
6443
6458
|
case 4:
|
|
6444
|
-
taf =
|
|
6445
|
-
|
|
6459
|
+
taf = _context4.sent;
|
|
6460
|
+
_context4.next = 7;
|
|
6446
6461
|
return postTaf({
|
|
6447
6462
|
taf: taf,
|
|
6448
6463
|
changeStatusTo: fromActionToStatus(tafActionToDraftAction(tafAction))
|
|
6449
6464
|
}, true);
|
|
6450
6465
|
case 7:
|
|
6451
6466
|
action(value);
|
|
6452
|
-
|
|
6467
|
+
_context4.next = 13;
|
|
6453
6468
|
break;
|
|
6454
6469
|
case 10:
|
|
6455
|
-
|
|
6456
|
-
|
|
6470
|
+
_context4.prev = 10;
|
|
6471
|
+
_context4.t0 = _context4["catch"](1);
|
|
6457
6472
|
void confirmDialog(CONFIRM_DIALOG_OPTIONS).then(function () {
|
|
6458
6473
|
action(value);
|
|
6459
6474
|
setError(null);
|
|
6460
6475
|
});
|
|
6461
6476
|
case 13:
|
|
6462
|
-
|
|
6477
|
+
_context4.next = 17;
|
|
6463
6478
|
break;
|
|
6464
6479
|
case 15:
|
|
6465
6480
|
action(value);
|
|
6466
6481
|
setError(null);
|
|
6467
6482
|
case 17:
|
|
6468
6483
|
case "end":
|
|
6469
|
-
return
|
|
6484
|
+
return _context4.stop();
|
|
6470
6485
|
}
|
|
6471
|
-
},
|
|
6486
|
+
}, _callee4, null, [[1, 10]]);
|
|
6472
6487
|
}));
|
|
6473
6488
|
return _onChangeTab.apply(this, arguments);
|
|
6474
6489
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/taf",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.5.0",
|
|
4
4
|
"description": "GeoWeb TAF library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -8,15 +8,15 @@
|
|
|
8
8
|
"url": "git@gitlab.com:opengeoweb/opengeoweb.git"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@opengeoweb/api": "12.
|
|
12
|
-
"@opengeoweb/shared": "12.
|
|
11
|
+
"@opengeoweb/api": "12.5.0",
|
|
12
|
+
"@opengeoweb/shared": "12.5.0",
|
|
13
13
|
"react-hook-form": "^7.50.1",
|
|
14
|
-
"@opengeoweb/theme": "12.
|
|
15
|
-
"@opengeoweb/form-fields": "12.
|
|
16
|
-
"@opengeoweb/authentication": "12.
|
|
14
|
+
"@opengeoweb/theme": "12.5.0",
|
|
15
|
+
"@opengeoweb/form-fields": "12.5.0",
|
|
16
|
+
"@opengeoweb/authentication": "12.5.0",
|
|
17
17
|
"@reduxjs/toolkit": "^2.6.1",
|
|
18
18
|
"react-redux": "^9.2.0",
|
|
19
|
-
"@opengeoweb/snackbar": "12.
|
|
19
|
+
"@opengeoweb/snackbar": "12.5.0",
|
|
20
20
|
"react-sortablejs": "^6.1.4",
|
|
21
21
|
"sortablejs": "^1.15.1",
|
|
22
22
|
"@emotion/react": "^11.11.1",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AdverseWeatherTAC } from '../../../types';
|
|
3
3
|
interface AdverseWeatherTACProps {
|
|
4
|
-
TAC
|
|
4
|
+
TAC?: AdverseWeatherTAC;
|
|
5
5
|
isActive: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare const AdverseWeatherTACMessage: React.FC<AdverseWeatherTACProps>;
|
|
@@ -2,5 +2,5 @@ import { Credentials } from '@opengeoweb/authentication';
|
|
|
2
2
|
import { TAC, Taf, TafFromBackend, TafFromFrontEnd } from '../../types';
|
|
3
3
|
export declare const getTafList: (auth: Credentials) => Promise<TafFromBackend[]>;
|
|
4
4
|
export declare const postTaf: (auth: Credentials, data: TafFromFrontEnd) => Promise<Response>;
|
|
5
|
-
export declare const patchTaf: (auth: Credentials, data: TafFromFrontEnd) => Promise<Response>;
|
|
5
|
+
export declare const patchTaf: (auth: Credentials, data: TafFromFrontEnd, force?: boolean) => Promise<Response>;
|
|
6
6
|
export declare const getTAC: (auth: Credentials, data: Taf) => Promise<TAC>;
|
|
@@ -14,6 +14,7 @@ type PatchReturnType<T> = UseMutationResult<Response | null, Error, T>;
|
|
|
14
14
|
interface PatchTafProps {
|
|
15
15
|
tafData: TafFromFrontEnd;
|
|
16
16
|
setError: React.Dispatch<React.SetStateAction<TafError | null>>;
|
|
17
|
+
force?: boolean;
|
|
17
18
|
}
|
|
18
19
|
export declare const usePatchTaf: () => PatchReturnType<PatchTafProps>;
|
|
19
20
|
type GetTACReturnType<T> = UseMutationResult<TAC, Error, T>;
|