@opengeoweb/warnings 12.5.0 → 12.6.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 +71 -41
- package/package.json +12 -12
- package/src/lib/utils/sig-airmet-util.d.ts +2 -2
package/index.esm.js
CHANGED
|
@@ -7,7 +7,7 @@ import { SHARED_NAMESPACE, useConfirmationDialog, dateUtils, ToggleMenu, calcula
|
|
|
7
7
|
import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, current, combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
8
8
|
import { defaultBbox } from '@opengeoweb/core';
|
|
9
9
|
import { FORM_FIELDS_NAMESPACE, useDraftFormHelpers, ReactHookFormSelect, ReactHookFormHiddenInput, isValidGeoJsonCoordinates, ReactHookFormTextField, ReactHookFormProvider, defaultFormOptions, errorMessages, isEmpty, ReactHookFormDateTime, isXHoursAfter, isXHoursBefore } from '@opengeoweb/form-fields';
|
|
10
|
-
import { SA_NAMESPACE, isInstanceOfCancelSigmet, isInstanceOfCancelAirmet, getDefaultValidUntilValue, useShortTestHelpers, SigmetForm, AirmetForm, ProductAction, getConfirmationDialogCancelLabel, getConfirmationDialogButtonLabel, getConfirmationDialogContent, getConfirmationDialogTitle, isVAPhenomenon, CancelSigmetVolcanicMovements, createAirmetPostParameter, createSigmetPostParameter, prepareCancelSigmet, getProductFormMode } from '@opengeoweb/sigmet-airmet';
|
|
10
|
+
import { SA_NAMESPACE, isInstanceOfCancelSigmet, getDefaultValidFromValue, isInstanceOfCancelAirmet, getDefaultValidUntilValue, useShortTestHelpers, SigmetForm, AirmetForm, ProductAction, getConfirmationDialogCancelLabel, getConfirmationDialogButtonLabel, getConfirmationDialogContent, getConfirmationDialogTitle, isVAPhenomenon, CancelSigmetVolcanicMovements, createAirmetPostParameter, createSigmetPostParameter, prepareCancelSigmet, getProductFormMode } from '@opengeoweb/sigmet-airmet';
|
|
11
11
|
import { LayerType, generateMapId } from '@opengeoweb/webmap';
|
|
12
12
|
import { t } from 'i18next';
|
|
13
13
|
import { useTranslation } from 'react-i18next';
|
|
@@ -208,7 +208,9 @@ var en = {
|
|
|
208
208
|
"cancel-this-product": "Are you sure you want to cancel this {{product}}?",
|
|
209
209
|
"aviation-cancel-success": "{{warningType}} has succesfully been cancelled!",
|
|
210
210
|
"aviation-discard-success": "{{warningType}} has been discarded!",
|
|
211
|
-
"error-auth-login": "This feature is protected by authentication. Please log in to proceed"
|
|
211
|
+
"error-auth-login": "This feature is protected by authentication. Please log in to proceed",
|
|
212
|
+
"cancel-warningType": "Cancel {{warningType}}",
|
|
213
|
+
cancelling: "Cancelling"
|
|
212
214
|
};
|
|
213
215
|
var nl = {
|
|
214
216
|
"drawing-tool-form-tools": "Gereedschap",
|
|
@@ -356,7 +358,9 @@ var nl = {
|
|
|
356
358
|
"cancel-this-product": "Weet je zeker dat je dit {{product}} wilt annuleren?",
|
|
357
359
|
"aviation-cancel-success": "niet vertaald",
|
|
358
360
|
"aviation-discard-success": "niet vertaald",
|
|
359
|
-
"error-auth-login": "Deze functie wordt beschermd door authenticatie. Log in om verder te gaan"
|
|
361
|
+
"error-auth-login": "Deze functie wordt beschermd door authenticatie. Log in om verder te gaan",
|
|
362
|
+
"cancel-warningType": "Annuleer {{warningType}}",
|
|
363
|
+
cancelling: "Annuleren"
|
|
360
364
|
};
|
|
361
365
|
var fi = {
|
|
362
366
|
"drawing-tool-form-tools": "Työkalut",
|
|
@@ -504,7 +508,9 @@ var fi = {
|
|
|
504
508
|
"cancel-this-product": "Oletko varma, että haluat peruuttaa tämän {{product}}:n?",
|
|
505
509
|
"aviation-cancel-success": "ei käännetty",
|
|
506
510
|
"aviation-discard-success": "{{warningType}} er forkastet!",
|
|
507
|
-
"error-auth-login": "Tämän toiminnallisuuden käyttäminen vaatii tunnistautumista. Kirjaudu sisään jatkaaksesi"
|
|
511
|
+
"error-auth-login": "Tämän toiminnallisuuden käyttäminen vaatii tunnistautumista. Kirjaudu sisään jatkaaksesi",
|
|
512
|
+
"cancel-warningType": "Peruuta {{warningType}}",
|
|
513
|
+
cancelling: "Peruuttaminen"
|
|
508
514
|
};
|
|
509
515
|
var no = {
|
|
510
516
|
"drawing-tool-form-tools": "Verktøy",
|
|
@@ -652,7 +658,9 @@ var no = {
|
|
|
652
658
|
"cancel-this-product": "Er du sikker på at du vil avbryte dette {{product}}?",
|
|
653
659
|
"aviation-cancel-success": "{{warningType}} er kansellert!",
|
|
654
660
|
"aviation-discard-success": "{{warningType}} er forkastet!",
|
|
655
|
-
"error-auth-login": "Denne delen er passordbeskyttet. Vennligst logg inn."
|
|
661
|
+
"error-auth-login": "Denne delen er passordbeskyttet. Vennligst logg inn.",
|
|
662
|
+
"cancel-warningType": "Kanseller {{warningType}}",
|
|
663
|
+
cancelling: "Kansellerer"
|
|
656
664
|
};
|
|
657
665
|
var warningsTranslations = {
|
|
658
666
|
en: en,
|
|
@@ -4846,14 +4854,11 @@ var transformAirmetToProductFormat = function transformAirmetToProductFormat(war
|
|
|
4846
4854
|
};
|
|
4847
4855
|
// For the Create and Clear buttons
|
|
4848
4856
|
// The fields initialised to unknown will be set to their default values by ReactHookForm
|
|
4849
|
-
var getEmptySigmetWarning = function getEmptySigmetWarning() {
|
|
4850
|
-
var
|
|
4851
|
-
var
|
|
4852
|
-
minutes: 15
|
|
4853
|
-
});
|
|
4854
|
-
var validUntilTime = dateUtils.add(currentTime, {
|
|
4857
|
+
var getEmptySigmetWarning = function getEmptySigmetWarning(productConfig) {
|
|
4858
|
+
var validDateStart = getDefaultValidFromValue(productConfig);
|
|
4859
|
+
var validDateEnd = dateUtils.dateToString(dateUtils.add(new Date(validDateStart), {
|
|
4855
4860
|
hours: 4
|
|
4856
|
-
});
|
|
4861
|
+
}));
|
|
4857
4862
|
return {
|
|
4858
4863
|
type: undefined,
|
|
4859
4864
|
phenomenon: '',
|
|
@@ -4866,8 +4871,8 @@ var getEmptySigmetWarning = function getEmptySigmetWarning() {
|
|
|
4866
4871
|
change: '',
|
|
4867
4872
|
// Default change
|
|
4868
4873
|
sequence: undefined,
|
|
4869
|
-
validDateStart:
|
|
4870
|
-
validDateEnd:
|
|
4874
|
+
validDateStart: validDateStart,
|
|
4875
|
+
validDateEnd: validDateEnd,
|
|
4871
4876
|
level: '',
|
|
4872
4877
|
levelInfoMode: '',
|
|
4873
4878
|
movementType: '',
|
|
@@ -4876,14 +4881,11 @@ var getEmptySigmetWarning = function getEmptySigmetWarning() {
|
|
|
4876
4881
|
};
|
|
4877
4882
|
// For the Create and Clear buttons
|
|
4878
4883
|
// The fields initialised to unknown will be set to their default values by ReactHookForm
|
|
4879
|
-
var getEmptyAirmetWarning = function getEmptyAirmetWarning() {
|
|
4880
|
-
var
|
|
4881
|
-
var
|
|
4882
|
-
minutes: 15
|
|
4883
|
-
});
|
|
4884
|
-
var validUntilTime = dateUtils.add(currentTime, {
|
|
4884
|
+
var getEmptyAirmetWarning = function getEmptyAirmetWarning(productConfig) {
|
|
4885
|
+
var validDateStart = getDefaultValidFromValue(productConfig);
|
|
4886
|
+
var validDateEnd = dateUtils.dateToString(dateUtils.add(new Date(validDateStart), {
|
|
4885
4887
|
hours: 4
|
|
4886
|
-
});
|
|
4888
|
+
}));
|
|
4887
4889
|
return {
|
|
4888
4890
|
type: undefined,
|
|
4889
4891
|
phenomenon: '',
|
|
@@ -4896,8 +4898,8 @@ var getEmptyAirmetWarning = function getEmptyAirmetWarning() {
|
|
|
4896
4898
|
change: '',
|
|
4897
4899
|
// Default change
|
|
4898
4900
|
sequence: undefined,
|
|
4899
|
-
validDateStart:
|
|
4900
|
-
validDateEnd:
|
|
4901
|
+
validDateStart: validDateStart,
|
|
4902
|
+
validDateEnd: validDateEnd,
|
|
4901
4903
|
level: '',
|
|
4902
4904
|
levelInfoMode: '',
|
|
4903
4905
|
movementType: '',
|
|
@@ -5810,8 +5812,11 @@ var Form = function Form(_ref5) {
|
|
|
5810
5812
|
isPublishing = _React$useState[0],
|
|
5811
5813
|
setIsPublishing = _React$useState[1];
|
|
5812
5814
|
var _React$useState2 = React.useState(false),
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
+
isCancelling = _React$useState2[0],
|
|
5816
|
+
setIsCancelling = _React$useState2[1];
|
|
5817
|
+
var _React$useState3 = React.useState(false),
|
|
5818
|
+
isSaving = _React$useState3[0],
|
|
5819
|
+
setIsSaving = _React$useState3[1];
|
|
5815
5820
|
var _useTACApi = useTACApi(),
|
|
5816
5821
|
fetchSigmetTAC = _useTACApi.fetchSigmetTAC,
|
|
5817
5822
|
fetchAirmetTAC = _useTACApi.fetchAirmetTAC;
|
|
@@ -5822,12 +5827,12 @@ var Form = function Form(_ref5) {
|
|
|
5822
5827
|
defaultValues: {}
|
|
5823
5828
|
});
|
|
5824
5829
|
var initialPublicWarningArea = (publicWarningDetails == null || (_publicWarningDetails = publicWarningDetails.areas) == null ? void 0 : _publicWarningDetails.length) && (publicWarningDetails == null || (_publicWarningDetails2 = publicWarningDetails.areas[0]) == null ? void 0 : _publicWarningDetails2.geoJSON);
|
|
5825
|
-
var _React$
|
|
5826
|
-
warningGeoJSONFeature = _React$
|
|
5827
|
-
setWarningGeoJSONFeature = _React$
|
|
5828
|
-
var _React$
|
|
5829
|
-
originalWarningAreas = _React$
|
|
5830
|
-
setOriginalWarningAreas = _React$
|
|
5830
|
+
var _React$useState4 = React.useState(initialPublicWarningArea),
|
|
5831
|
+
warningGeoJSONFeature = _React$useState4[0],
|
|
5832
|
+
setWarningGeoJSONFeature = _React$useState4[1];
|
|
5833
|
+
var _React$useState5 = React.useState(publicWarningDetails == null ? void 0 : publicWarningDetails.areas),
|
|
5834
|
+
originalWarningAreas = _React$useState5[0],
|
|
5835
|
+
setOriginalWarningAreas = _React$useState5[1];
|
|
5831
5836
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
5832
5837
|
t = _useWarningsTranslati.t;
|
|
5833
5838
|
var _useFormContext = useFormContext(),
|
|
@@ -5920,6 +5925,20 @@ var Form = function Form(_ref5) {
|
|
|
5920
5925
|
var cancelAviationProduct = function cancelAviationProduct(warningType) {
|
|
5921
5926
|
return onSaveAviationForm(selectedAviationProduct, 'CANCELLED', warningType, isVAPhenomenon(selectedAviationProduct, ProductAction.CANCEL) && watch('vaSigmetMoveToFIR'));
|
|
5922
5927
|
};
|
|
5928
|
+
var getPublishButtonLabel = function getPublishButtonLabel() {
|
|
5929
|
+
if (isCancelling) {
|
|
5930
|
+
return t('cancelling');
|
|
5931
|
+
}
|
|
5932
|
+
if (isPublishing) {
|
|
5933
|
+
return t('warning-button-publishing');
|
|
5934
|
+
}
|
|
5935
|
+
if (selectedAviationProduct) {
|
|
5936
|
+
return t('cancel-warningType', {
|
|
5937
|
+
warningType: warningType
|
|
5938
|
+
});
|
|
5939
|
+
}
|
|
5940
|
+
return t('warning-button-publish');
|
|
5941
|
+
};
|
|
5923
5942
|
var handleSubmitAviationProduct = /*#__PURE__*/function () {
|
|
5924
5943
|
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(action, warningType) {
|
|
5925
5944
|
var formValues;
|
|
@@ -5984,10 +6003,11 @@ var Form = function Form(_ref5) {
|
|
|
5984
6003
|
return _context10.abrupt("break", 22);
|
|
5985
6004
|
case 16:
|
|
5986
6005
|
void showConfirmDialog(action).then(function () {
|
|
5987
|
-
|
|
5988
|
-
void cancelAviationProduct(warningType)
|
|
5989
|
-
|
|
5990
|
-
|
|
6006
|
+
setIsCancelling(true);
|
|
6007
|
+
void cancelAviationProduct(warningType)["finally"](function () {
|
|
6008
|
+
setIsCancelling(false);
|
|
6009
|
+
onCloseForm();
|
|
6010
|
+
});
|
|
5991
6011
|
});
|
|
5992
6012
|
return _context10.abrupt("break", 22);
|
|
5993
6013
|
case 18:
|
|
@@ -6042,10 +6062,10 @@ var Form = function Form(_ref5) {
|
|
|
6042
6062
|
var onPressClear = function onPressClear() {
|
|
6043
6063
|
switch (warningType) {
|
|
6044
6064
|
case 'sigmet':
|
|
6045
|
-
reset(getEmptySigmetWarning());
|
|
6065
|
+
reset(getEmptySigmetWarning(aviationConfig != null ? aviationConfig : {}));
|
|
6046
6066
|
break;
|
|
6047
6067
|
case 'airmet':
|
|
6048
|
-
reset(getEmptyAirmetWarning());
|
|
6068
|
+
reset(getEmptyAirmetWarning(aviationConfig != null ? aviationConfig : {}));
|
|
6049
6069
|
break;
|
|
6050
6070
|
case 'public':
|
|
6051
6071
|
default:
|
|
@@ -6380,7 +6400,7 @@ var Form = function Form(_ref5) {
|
|
|
6380
6400
|
sx: {
|
|
6381
6401
|
width: '100%'
|
|
6382
6402
|
},
|
|
6383
|
-
disabled:
|
|
6403
|
+
disabled: isPublishing || isCancelling,
|
|
6384
6404
|
onClick: function onClick() {
|
|
6385
6405
|
void (selectedAviationProduct ? handleSubmitAviationProduct(ProductAction.CANCEL, warningType) : onPressPublish());
|
|
6386
6406
|
},
|
|
@@ -6388,7 +6408,7 @@ var Form = function Form(_ref5) {
|
|
|
6388
6408
|
style: {
|
|
6389
6409
|
position: 'relative'
|
|
6390
6410
|
},
|
|
6391
|
-
children: [
|
|
6411
|
+
children: [getPublishButtonLabel(), (isPublishing || isCancelling) && jsx(CircularProgress, {
|
|
6392
6412
|
"data-testid": "spinner",
|
|
6393
6413
|
color: "inherit",
|
|
6394
6414
|
sx: spinnerSx
|
|
@@ -7655,8 +7675,18 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
7655
7675
|
var updatedWarningType = selectedSigmet ? 'sigmet' : selectedAirmet && 'airmet' || warningType;
|
|
7656
7676
|
var _useProductConfig = useProductConfig(updatedWarningType, !isDialogOpen),
|
|
7657
7677
|
aviationConfig = _useProductConfig.data;
|
|
7658
|
-
var selectedSigmetProduct
|
|
7659
|
-
|
|
7678
|
+
var selectedSigmetProduct;
|
|
7679
|
+
if (selectedSigmet && aviationConfig) {
|
|
7680
|
+
selectedSigmetProduct = transformSigmetToProductFormat(selectedSigmet);
|
|
7681
|
+
} else if (aviationConfig) {
|
|
7682
|
+
selectedSigmetProduct = getEmptySigmetWarning(aviationConfig);
|
|
7683
|
+
}
|
|
7684
|
+
var selectedAirmetProduct;
|
|
7685
|
+
if (selectedAirmet && aviationConfig) {
|
|
7686
|
+
selectedAirmetProduct = transformAirmetToProductFormat(selectedAirmet);
|
|
7687
|
+
} else if (aviationConfig) {
|
|
7688
|
+
selectedAirmetProduct = getEmptyAirmetWarning(aviationConfig);
|
|
7689
|
+
}
|
|
7660
7690
|
var selectedAviationProduct = React__default.useMemo(function () {
|
|
7661
7691
|
if (['sigmet', 'airmet'].includes((selectedWarningObject == null ? void 0 : selectedWarningObject.type) || '') && aviationConfig) {
|
|
7662
7692
|
return flattenPublicWarning(selectedWarningObject);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/warnings",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.6.0",
|
|
4
4
|
"description": "GeoWeb warinings library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -8,25 +8,25 @@
|
|
|
8
8
|
"url": "git@gitlab.com:opengeoweb/opengeoweb.git"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@opengeoweb/api": "12.
|
|
12
|
-
"@opengeoweb/shared": "12.
|
|
13
|
-
"@opengeoweb/store": "12.
|
|
14
|
-
"@opengeoweb/webmap-react": "12.
|
|
11
|
+
"@opengeoweb/api": "12.6.0",
|
|
12
|
+
"@opengeoweb/shared": "12.6.0",
|
|
13
|
+
"@opengeoweb/store": "12.6.0",
|
|
14
|
+
"@opengeoweb/webmap-react": "12.6.0",
|
|
15
15
|
"@tanstack/react-query": "^5.69.2",
|
|
16
16
|
"react-redux": "^9.2.0",
|
|
17
|
-
"@opengeoweb/theme": "12.
|
|
18
|
-
"@opengeoweb/form-fields": "12.
|
|
17
|
+
"@opengeoweb/theme": "12.6.0",
|
|
18
|
+
"@opengeoweb/form-fields": "12.6.0",
|
|
19
19
|
"react-hook-form": "^7.50.1",
|
|
20
20
|
"lodash": "^4.17.21",
|
|
21
21
|
"@reduxjs/toolkit": "^2.6.1",
|
|
22
|
-
"@opengeoweb/snackbar": "12.
|
|
22
|
+
"@opengeoweb/snackbar": "12.6.0",
|
|
23
23
|
"react-window": "^1.8.10",
|
|
24
24
|
"react-virtualized-auto-sizer": "^1.0.20",
|
|
25
25
|
"axios": "^1.7.7",
|
|
26
|
-
"@opengeoweb/core": "12.
|
|
27
|
-
"@opengeoweb/webmap": "12.
|
|
28
|
-
"@opengeoweb/authentication": "12.
|
|
29
|
-
"@opengeoweb/sigmet-airmet": "12.
|
|
26
|
+
"@opengeoweb/core": "12.6.0",
|
|
27
|
+
"@opengeoweb/webmap": "12.6.0",
|
|
28
|
+
"@opengeoweb/authentication": "12.6.0",
|
|
29
|
+
"@opengeoweb/sigmet-airmet": "12.6.0",
|
|
30
30
|
"react-i18next": "^15.1.1",
|
|
31
31
|
"i18next": "^25.0.1",
|
|
32
32
|
"@mui/material": "^7.0.1",
|
|
@@ -11,8 +11,8 @@ export declare const transformSigmetToProductFormat: (warning: SigmetFromBackend
|
|
|
11
11
|
export declare const transformAirmetToProductFormat: (warning: AirmetFromBackend | undefined) => AviationProduct;
|
|
12
12
|
export declare const transformSigmetFromBackendToProductFormat: (warning: SigmetFromBackend) => AviationProduct;
|
|
13
13
|
export declare const transformAirmetFromBackendToProductFormat: (warning: AirmetFromBackend) => AviationProduct;
|
|
14
|
-
export declare const getEmptySigmetWarning: () => AviationProduct;
|
|
15
|
-
export declare const getEmptyAirmetWarning: () => AviationProduct;
|
|
14
|
+
export declare const getEmptySigmetWarning: (productConfig: ProductConfig) => AviationProduct;
|
|
15
|
+
export declare const getEmptyAirmetWarning: (productConfig: ProductConfig) => AviationProduct;
|
|
16
16
|
export declare const renewAviationProduct: <T extends AirmetWarning | SigmetWarning>(aviationWarning: T, productConfig: ProductConfig) => T;
|
|
17
17
|
export declare const amendAviationProduct: <T extends AirmetWarning | SigmetWarning>(aviationWarning: T, productConfig: ProductConfig) => T;
|
|
18
18
|
export declare const duplicateAviationProduct: <T extends AirmetWarning | SigmetWarning>(aviationWarning: T) => T;
|