@opengeoweb/warnings 12.5.0 → 12.7.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
|
@@ -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, getTacGeometry, getMaxPolygonPoints, 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,
|
|
@@ -2981,7 +2989,7 @@ var useMutateWarning = function useMutateWarning(snackBarMessage) {
|
|
|
2981
2989
|
var _useAuthenticationCon2 = useAuthenticationContext(),
|
|
2982
2990
|
auth = _useAuthenticationCon2.auth;
|
|
2983
2991
|
var dispatch = useDispatch();
|
|
2984
|
-
return useMutation(
|
|
2992
|
+
return useMutation({
|
|
2985
2993
|
mutationFn: function mutationFn(_ref4) {
|
|
2986
2994
|
var id = _ref4.id,
|
|
2987
2995
|
data = _ref4.data;
|
|
@@ -2993,15 +3001,7 @@ var useMutateWarning = function useMutateWarning(snackBarMessage) {
|
|
|
2993
3001
|
return updatePublicWarning(id, auth, data);
|
|
2994
3002
|
}
|
|
2995
3003
|
return postPublicWarning(auth, data);
|
|
2996
|
-
}
|
|
2997
|
-
}, optimisticUpdate(['public-warning-list'], queryClient, function (_, _ref5) {
|
|
2998
|
-
var data = _ref5.data,
|
|
2999
|
-
id = _ref5.id;
|
|
3000
|
-
return Object.assign({}, data, {
|
|
3001
|
-
id: id,
|
|
3002
|
-
lastUpdatedTime: new Date().toISOString()
|
|
3003
|
-
});
|
|
3004
|
-
}), {
|
|
3004
|
+
},
|
|
3005
3005
|
onError: function onError(error) {
|
|
3006
3006
|
void queryClient.invalidateQueries({
|
|
3007
3007
|
queryKey: ['public-warning-list']
|
|
@@ -3012,34 +3012,17 @@ var useMutateWarning = function useMutateWarning(snackBarMessage) {
|
|
|
3012
3012
|
},
|
|
3013
3013
|
onSuccess: function () {
|
|
3014
3014
|
var _onSuccess2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data, variables) {
|
|
3015
|
-
var location,
|
|
3015
|
+
var location, warningDetail, newId, newWarning;
|
|
3016
3016
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
3017
3017
|
while (1) switch (_context2.prev = _context2.next) {
|
|
3018
3018
|
case 0:
|
|
3019
|
+
_context2.next = 2;
|
|
3020
|
+
return queryClient.invalidateQueries({
|
|
3021
|
+
queryKey: ['public-warning-list']
|
|
3022
|
+
});
|
|
3023
|
+
case 2:
|
|
3019
3024
|
location = data == null ? void 0 : data.get('location');
|
|
3020
|
-
|
|
3021
|
-
if (
|
|
3022
|
-
// DRAFT_PUBLISHED warnings have linked_to_id to the published warning it is based on
|
|
3023
|
-
// When publishing a DRAFT_PUBLISHED warning we need to update the published warning and delete the draft
|
|
3024
|
-
warningDetail.linked_to_id && status === PublicWarningStatus.PUBLISHED) {
|
|
3025
|
-
queryClient.setQueryData(['public-warning-list'], function (old) {
|
|
3026
|
-
return old == null ? void 0 : old.reduce(function (acc, warning) {
|
|
3027
|
-
if (warning.id === warningDetail.linked_to_id) {
|
|
3028
|
-
return acc;
|
|
3029
|
-
}
|
|
3030
|
-
if (warning.id === warningDetail.id) {
|
|
3031
|
-
return [].concat(acc, [Object.assign({}, warning, {
|
|
3032
|
-
id: warningDetail.linked_to_id,
|
|
3033
|
-
warningDetail: Object.assign({}, warning.warningDetail, {
|
|
3034
|
-
id: warningDetail.linked_to_id
|
|
3035
|
-
}),
|
|
3036
|
-
lastUpdatedTime: new Date().toISOString()
|
|
3037
|
-
})]);
|
|
3038
|
-
}
|
|
3039
|
-
return [].concat(acc, [warning]);
|
|
3040
|
-
}, []);
|
|
3041
|
-
});
|
|
3042
|
-
}
|
|
3025
|
+
warningDetail = variables.data.warningDetail;
|
|
3043
3026
|
if (location) {
|
|
3044
3027
|
// When making a new warning we get it's ID from the location header
|
|
3045
3028
|
newId = getIdFromUrl(location);
|
|
@@ -3051,9 +3034,6 @@ var useMutateWarning = function useMutateWarning(snackBarMessage) {
|
|
|
3051
3034
|
domain: 'public'
|
|
3052
3035
|
})
|
|
3053
3036
|
});
|
|
3054
|
-
queryClient.setQueryData(['public-warning-list'], function (old) {
|
|
3055
|
-
return [].concat(old || [], [newWarning]);
|
|
3056
|
-
});
|
|
3057
3037
|
dispatch(publicWarningFormActions.openPublicWarningFormDialog({
|
|
3058
3038
|
warning: newWarning,
|
|
3059
3039
|
formState: '',
|
|
@@ -3070,7 +3050,7 @@ var useMutateWarning = function useMutateWarning(snackBarMessage) {
|
|
|
3070
3050
|
setOpen: false
|
|
3071
3051
|
}));
|
|
3072
3052
|
}
|
|
3073
|
-
case
|
|
3053
|
+
case 7:
|
|
3074
3054
|
case "end":
|
|
3075
3055
|
return _context2.stop();
|
|
3076
3056
|
}
|
|
@@ -3081,7 +3061,7 @@ var useMutateWarning = function useMutateWarning(snackBarMessage) {
|
|
|
3081
3061
|
}
|
|
3082
3062
|
return onSuccess;
|
|
3083
3063
|
}()
|
|
3084
|
-
})
|
|
3064
|
+
});
|
|
3085
3065
|
};
|
|
3086
3066
|
var useMutateDeleteWarning = function useMutateDeleteWarning() {
|
|
3087
3067
|
var queryClient = useQueryClient();
|
|
@@ -3089,8 +3069,8 @@ var useMutateDeleteWarning = function useMutateDeleteWarning() {
|
|
|
3089
3069
|
var _useAuthenticationCon3 = useAuthenticationContext(),
|
|
3090
3070
|
auth = _useAuthenticationCon3.auth;
|
|
3091
3071
|
return useMutation({
|
|
3092
|
-
mutationFn: function mutationFn(
|
|
3093
|
-
var id =
|
|
3072
|
+
mutationFn: function mutationFn(_ref5) {
|
|
3073
|
+
var id = _ref5.id;
|
|
3094
3074
|
if (!auth) {
|
|
3095
3075
|
throw new Error('Authentication context not found');
|
|
3096
3076
|
}
|
|
@@ -3165,12 +3145,12 @@ var useMutateSaveOrUpdateDrawing = function useMutateSaveOrUpdateDrawing() {
|
|
|
3165
3145
|
var queryClient = useQueryClient();
|
|
3166
3146
|
return useMutation({
|
|
3167
3147
|
mutationFn: function () {
|
|
3168
|
-
var _mutationFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(
|
|
3148
|
+
var _mutationFn = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref6) {
|
|
3169
3149
|
var data, id, headers, location, newId;
|
|
3170
3150
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
3171
3151
|
while (1) switch (_context4.prev = _context4.next) {
|
|
3172
3152
|
case 0:
|
|
3173
|
-
data =
|
|
3153
|
+
data = _ref6.data, id = _ref6.id;
|
|
3174
3154
|
if (auth) {
|
|
3175
3155
|
_context4.next = 3;
|
|
3176
3156
|
break;
|
|
@@ -3214,8 +3194,8 @@ var useMutateSaveOrUpdateDrawing = function useMutateSaveOrUpdateDrawing() {
|
|
|
3214
3194
|
}
|
|
3215
3195
|
return mutationFn;
|
|
3216
3196
|
}(),
|
|
3217
|
-
onSuccess: function onSuccess(
|
|
3218
|
-
var id =
|
|
3197
|
+
onSuccess: function onSuccess(_ref7, variables) {
|
|
3198
|
+
var id = _ref7.id;
|
|
3219
3199
|
dispatch(warningsDrawingsActions.setDrawValues({
|
|
3220
3200
|
drawingInstanceId: drawingDialogType,
|
|
3221
3201
|
id: String(id),
|
|
@@ -3235,12 +3215,12 @@ var useMutateDeleteDrawing = function useMutateDeleteDrawing() {
|
|
|
3235
3215
|
var dispatch = useDispatch();
|
|
3236
3216
|
return useMutation({
|
|
3237
3217
|
mutationFn: function () {
|
|
3238
|
-
var _mutationFn2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(
|
|
3218
|
+
var _mutationFn2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref8) {
|
|
3239
3219
|
var drawingId;
|
|
3240
3220
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
3241
3221
|
while (1) switch (_context5.prev = _context5.next) {
|
|
3242
3222
|
case 0:
|
|
3243
|
-
drawingId =
|
|
3223
|
+
drawingId = _ref8.drawingId;
|
|
3244
3224
|
if (auth) {
|
|
3245
3225
|
_context5.next = 3;
|
|
3246
3226
|
break;
|
|
@@ -3264,8 +3244,8 @@ var useMutateDeleteDrawing = function useMutateDeleteDrawing() {
|
|
|
3264
3244
|
}
|
|
3265
3245
|
return mutationFn;
|
|
3266
3246
|
}(),
|
|
3267
|
-
onSuccess: function onSuccess(_,
|
|
3268
|
-
var objectName =
|
|
3247
|
+
onSuccess: function onSuccess(_, _ref9) {
|
|
3248
|
+
var objectName = _ref9.objectName;
|
|
3269
3249
|
void queryClient.invalidateQueries({
|
|
3270
3250
|
queryKey: ['drawings']
|
|
3271
3251
|
});
|
|
@@ -4180,14 +4160,19 @@ var DrawingToolConnect = function DrawingToolConnect(_ref) {
|
|
|
4180
4160
|
|
|
4181
4161
|
var WarningAvatar = function WarningAvatar(_ref) {
|
|
4182
4162
|
var editor = _ref.editor,
|
|
4163
|
+
status = _ref.status,
|
|
4183
4164
|
_ref$tooltipPlacement = _ref.tooltipPlacement,
|
|
4184
4165
|
tooltipPlacement = _ref$tooltipPlacement === void 0 ? 'bottom' : _ref$tooltipPlacement;
|
|
4166
|
+
var effectiveStatus = status != null ? status : 'DRAFT';
|
|
4167
|
+
var isDraft = effectiveStatus === 'DRAFT';
|
|
4168
|
+
var label = isDraft ? 'Editor' : 'Author';
|
|
4185
4169
|
return jsx(CustomTooltip, {
|
|
4186
|
-
title: "
|
|
4170
|
+
title: label + ": " + editor,
|
|
4187
4171
|
placement: tooltipPlacement,
|
|
4188
4172
|
children: jsx("span", {
|
|
4189
4173
|
children: jsx(Avatar, {
|
|
4190
4174
|
size: "small",
|
|
4175
|
+
author: !isDraft,
|
|
4191
4176
|
children: getInitials(editor)
|
|
4192
4177
|
})
|
|
4193
4178
|
})
|
|
@@ -4328,7 +4313,8 @@ var PublicWarningsFormDialog = function PublicWarningsFormDialog(_ref) {
|
|
|
4328
4313
|
width: '16px'
|
|
4329
4314
|
},
|
|
4330
4315
|
children: publicWarningEditor && jsx(WarningAvatar, {
|
|
4331
|
-
editor: publicWarningEditor
|
|
4316
|
+
editor: publicWarningEditor,
|
|
4317
|
+
status: selectedAviationProduct == null ? void 0 : selectedAviationProduct.status
|
|
4332
4318
|
})
|
|
4333
4319
|
})]
|
|
4334
4320
|
})
|
|
@@ -4651,16 +4637,23 @@ var flattenPublicWarning = function flattenPublicWarning(publicWarning) {
|
|
|
4651
4637
|
rest = _objectWithoutPropertiesLoose(publicWarning, _excluded$6);
|
|
4652
4638
|
return Object.assign({}, rest, sigmetAirmetDetails);
|
|
4653
4639
|
};
|
|
4654
|
-
var transformAirmetToWarningFormat = function transformAirmetToWarningFormat(apiAirmet) {
|
|
4640
|
+
var transformAirmetToWarningFormat = function transformAirmetToWarningFormat(apiAirmet, productConfig) {
|
|
4655
4641
|
var airmet = apiAirmet.airmet;
|
|
4642
|
+
var tacGeometry = getTacGeometry({
|
|
4643
|
+
startGeometry: airmet.startGeometry,
|
|
4644
|
+
startGeometryIntersect: airmet.startGeometryIntersect,
|
|
4645
|
+
maxPoints: getMaxPolygonPoints(airmet.locationIndicatorATSR, productConfig)
|
|
4646
|
+
});
|
|
4656
4647
|
var areas = [];
|
|
4657
4648
|
if (airmet.startGeometry) {
|
|
4658
4649
|
areas.push({
|
|
4659
|
-
|
|
4660
|
-
|
|
4650
|
+
areaId: airmet.uuid + "-start",
|
|
4651
|
+
geoJSON: Object.assign({}, tacGeometry, {
|
|
4652
|
+
features: tacGeometry.features.map(function (feature) {
|
|
4661
4653
|
return Object.assign({}, feature, {
|
|
4662
4654
|
properties: Object.assign({}, feature.properties, {
|
|
4663
|
-
isStartGeometry: true
|
|
4655
|
+
isStartGeometry: true,
|
|
4656
|
+
source: tacGeometry === airmet.startGeometry ? 'drawn' : 'intersected'
|
|
4664
4657
|
})
|
|
4665
4658
|
});
|
|
4666
4659
|
})
|
|
@@ -4672,6 +4665,7 @@ var transformAirmetToWarningFormat = function transformAirmetToWarningFormat(api
|
|
|
4672
4665
|
id: apiAirmet.uuid,
|
|
4673
4666
|
lastUpdatedTime: apiAirmet.lastUpdateDate,
|
|
4674
4667
|
productStatus: airmet.status,
|
|
4668
|
+
editor: apiAirmet.author,
|
|
4675
4669
|
warningDetail: {
|
|
4676
4670
|
id: airmet.uuid,
|
|
4677
4671
|
phenomenon: airmet.phenomenon,
|
|
@@ -4688,14 +4682,24 @@ var transformAirmetToWarningFormat = function transformAirmetToWarningFormat(api
|
|
|
4688
4682
|
type: 'airmet'
|
|
4689
4683
|
};
|
|
4690
4684
|
};
|
|
4691
|
-
var transformSigmetToWarningFormat = function transformSigmetToWarningFormat(apiSigmet) {
|
|
4685
|
+
var transformSigmetToWarningFormat = function transformSigmetToWarningFormat(apiSigmet, productConfig) {
|
|
4692
4686
|
var sigmet = apiSigmet.sigmet;
|
|
4687
|
+
var tacGeometryStart = getTacGeometry({
|
|
4688
|
+
startGeometry: sigmet.startGeometry,
|
|
4689
|
+
startGeometryIntersect: sigmet.startGeometryIntersect,
|
|
4690
|
+
maxPoints: getMaxPolygonPoints(sigmet.locationIndicatorATSR, productConfig)
|
|
4691
|
+
});
|
|
4692
|
+
var tacGeometryEnd = getTacGeometry({
|
|
4693
|
+
startGeometry: sigmet.endGeometry,
|
|
4694
|
+
startGeometryIntersect: sigmet.endGeometryIntersect,
|
|
4695
|
+
maxPoints: getMaxPolygonPoints(sigmet.locationIndicatorATSR, productConfig)
|
|
4696
|
+
});
|
|
4693
4697
|
var areas = [];
|
|
4694
4698
|
if (sigmet.startGeometry) {
|
|
4695
4699
|
areas.push({
|
|
4696
4700
|
areaId: sigmet.uuid + "-start",
|
|
4697
|
-
geoJSON: Object.assign({},
|
|
4698
|
-
features:
|
|
4701
|
+
geoJSON: Object.assign({}, tacGeometryStart, {
|
|
4702
|
+
features: tacGeometryStart.features.map(function (feature) {
|
|
4699
4703
|
return Object.assign({}, feature, {
|
|
4700
4704
|
properties: Object.assign({}, feature.properties, {
|
|
4701
4705
|
isStartGeometry: true
|
|
@@ -4709,8 +4713,8 @@ var transformSigmetToWarningFormat = function transformSigmetToWarningFormat(api
|
|
|
4709
4713
|
if (sigmet.endGeometry) {
|
|
4710
4714
|
areas.push({
|
|
4711
4715
|
areaId: sigmet.uuid + "-end",
|
|
4712
|
-
geoJSON: Object.assign({},
|
|
4713
|
-
features:
|
|
4716
|
+
geoJSON: Object.assign({}, tacGeometryEnd, {
|
|
4717
|
+
features: tacGeometryEnd.features.map(function (feature) {
|
|
4714
4718
|
return Object.assign({}, feature, {
|
|
4715
4719
|
properties: Object.assign({}, feature.properties, {
|
|
4716
4720
|
isStartGeometry: false
|
|
@@ -4725,6 +4729,7 @@ var transformSigmetToWarningFormat = function transformSigmetToWarningFormat(api
|
|
|
4725
4729
|
id: apiSigmet.uuid,
|
|
4726
4730
|
lastUpdatedTime: apiSigmet.lastUpdateDate,
|
|
4727
4731
|
productStatus: sigmet.status,
|
|
4732
|
+
editor: apiSigmet.author,
|
|
4728
4733
|
warningDetail: {
|
|
4729
4734
|
id: sigmet.uuid,
|
|
4730
4735
|
phenomenon: sigmet.phenomenon,
|
|
@@ -4846,14 +4851,11 @@ var transformAirmetToProductFormat = function transformAirmetToProductFormat(war
|
|
|
4846
4851
|
};
|
|
4847
4852
|
// For the Create and Clear buttons
|
|
4848
4853
|
// 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, {
|
|
4854
|
+
var getEmptySigmetWarning = function getEmptySigmetWarning(productConfig) {
|
|
4855
|
+
var validDateStart = getDefaultValidFromValue(productConfig);
|
|
4856
|
+
var validDateEnd = dateUtils.dateToString(dateUtils.add(new Date(validDateStart), {
|
|
4855
4857
|
hours: 4
|
|
4856
|
-
});
|
|
4858
|
+
}));
|
|
4857
4859
|
return {
|
|
4858
4860
|
type: undefined,
|
|
4859
4861
|
phenomenon: '',
|
|
@@ -4866,8 +4868,8 @@ var getEmptySigmetWarning = function getEmptySigmetWarning() {
|
|
|
4866
4868
|
change: '',
|
|
4867
4869
|
// Default change
|
|
4868
4870
|
sequence: undefined,
|
|
4869
|
-
validDateStart:
|
|
4870
|
-
validDateEnd:
|
|
4871
|
+
validDateStart: validDateStart,
|
|
4872
|
+
validDateEnd: validDateEnd,
|
|
4871
4873
|
level: '',
|
|
4872
4874
|
levelInfoMode: '',
|
|
4873
4875
|
movementType: '',
|
|
@@ -4876,14 +4878,11 @@ var getEmptySigmetWarning = function getEmptySigmetWarning() {
|
|
|
4876
4878
|
};
|
|
4877
4879
|
// For the Create and Clear buttons
|
|
4878
4880
|
// 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, {
|
|
4881
|
+
var getEmptyAirmetWarning = function getEmptyAirmetWarning(productConfig) {
|
|
4882
|
+
var validDateStart = getDefaultValidFromValue(productConfig);
|
|
4883
|
+
var validDateEnd = dateUtils.dateToString(dateUtils.add(new Date(validDateStart), {
|
|
4885
4884
|
hours: 4
|
|
4886
|
-
});
|
|
4885
|
+
}));
|
|
4887
4886
|
return {
|
|
4888
4887
|
type: undefined,
|
|
4889
4888
|
phenomenon: '',
|
|
@@ -4896,8 +4895,8 @@ var getEmptyAirmetWarning = function getEmptyAirmetWarning() {
|
|
|
4896
4895
|
change: '',
|
|
4897
4896
|
// Default change
|
|
4898
4897
|
sequence: undefined,
|
|
4899
|
-
validDateStart:
|
|
4900
|
-
validDateEnd:
|
|
4898
|
+
validDateStart: validDateStart,
|
|
4899
|
+
validDateEnd: validDateEnd,
|
|
4901
4900
|
level: '',
|
|
4902
4901
|
levelInfoMode: '',
|
|
4903
4902
|
movementType: '',
|
|
@@ -5810,8 +5809,11 @@ var Form = function Form(_ref5) {
|
|
|
5810
5809
|
isPublishing = _React$useState[0],
|
|
5811
5810
|
setIsPublishing = _React$useState[1];
|
|
5812
5811
|
var _React$useState2 = React.useState(false),
|
|
5813
|
-
|
|
5814
|
-
|
|
5812
|
+
isCancelling = _React$useState2[0],
|
|
5813
|
+
setIsCancelling = _React$useState2[1];
|
|
5814
|
+
var _React$useState3 = React.useState(false),
|
|
5815
|
+
isSaving = _React$useState3[0],
|
|
5816
|
+
setIsSaving = _React$useState3[1];
|
|
5815
5817
|
var _useTACApi = useTACApi(),
|
|
5816
5818
|
fetchSigmetTAC = _useTACApi.fetchSigmetTAC,
|
|
5817
5819
|
fetchAirmetTAC = _useTACApi.fetchAirmetTAC;
|
|
@@ -5822,12 +5824,12 @@ var Form = function Form(_ref5) {
|
|
|
5822
5824
|
defaultValues: {}
|
|
5823
5825
|
});
|
|
5824
5826
|
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$
|
|
5827
|
+
var _React$useState4 = React.useState(initialPublicWarningArea),
|
|
5828
|
+
warningGeoJSONFeature = _React$useState4[0],
|
|
5829
|
+
setWarningGeoJSONFeature = _React$useState4[1];
|
|
5830
|
+
var _React$useState5 = React.useState(publicWarningDetails == null ? void 0 : publicWarningDetails.areas),
|
|
5831
|
+
originalWarningAreas = _React$useState5[0],
|
|
5832
|
+
setOriginalWarningAreas = _React$useState5[1];
|
|
5831
5833
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
5832
5834
|
t = _useWarningsTranslati.t;
|
|
5833
5835
|
var _useFormContext = useFormContext(),
|
|
@@ -5920,6 +5922,20 @@ var Form = function Form(_ref5) {
|
|
|
5920
5922
|
var cancelAviationProduct = function cancelAviationProduct(warningType) {
|
|
5921
5923
|
return onSaveAviationForm(selectedAviationProduct, 'CANCELLED', warningType, isVAPhenomenon(selectedAviationProduct, ProductAction.CANCEL) && watch('vaSigmetMoveToFIR'));
|
|
5922
5924
|
};
|
|
5925
|
+
var getPublishButtonLabel = function getPublishButtonLabel() {
|
|
5926
|
+
if (isCancelling) {
|
|
5927
|
+
return t('cancelling');
|
|
5928
|
+
}
|
|
5929
|
+
if (isPublishing) {
|
|
5930
|
+
return t('warning-button-publishing');
|
|
5931
|
+
}
|
|
5932
|
+
if (selectedAviationProduct) {
|
|
5933
|
+
return t('cancel-warningType', {
|
|
5934
|
+
warningType: warningType
|
|
5935
|
+
});
|
|
5936
|
+
}
|
|
5937
|
+
return t('warning-button-publish');
|
|
5938
|
+
};
|
|
5923
5939
|
var handleSubmitAviationProduct = /*#__PURE__*/function () {
|
|
5924
5940
|
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(action, warningType) {
|
|
5925
5941
|
var formValues;
|
|
@@ -5984,10 +6000,11 @@ var Form = function Form(_ref5) {
|
|
|
5984
6000
|
return _context10.abrupt("break", 22);
|
|
5985
6001
|
case 16:
|
|
5986
6002
|
void showConfirmDialog(action).then(function () {
|
|
5987
|
-
|
|
5988
|
-
void cancelAviationProduct(warningType)
|
|
5989
|
-
|
|
5990
|
-
|
|
6003
|
+
setIsCancelling(true);
|
|
6004
|
+
void cancelAviationProduct(warningType)["finally"](function () {
|
|
6005
|
+
setIsCancelling(false);
|
|
6006
|
+
onCloseForm();
|
|
6007
|
+
});
|
|
5991
6008
|
});
|
|
5992
6009
|
return _context10.abrupt("break", 22);
|
|
5993
6010
|
case 18:
|
|
@@ -6042,10 +6059,10 @@ var Form = function Form(_ref5) {
|
|
|
6042
6059
|
var onPressClear = function onPressClear() {
|
|
6043
6060
|
switch (warningType) {
|
|
6044
6061
|
case 'sigmet':
|
|
6045
|
-
reset(getEmptySigmetWarning());
|
|
6062
|
+
reset(getEmptySigmetWarning(aviationConfig != null ? aviationConfig : {}));
|
|
6046
6063
|
break;
|
|
6047
6064
|
case 'airmet':
|
|
6048
|
-
reset(getEmptyAirmetWarning());
|
|
6065
|
+
reset(getEmptyAirmetWarning(aviationConfig != null ? aviationConfig : {}));
|
|
6049
6066
|
break;
|
|
6050
6067
|
case 'public':
|
|
6051
6068
|
default:
|
|
@@ -6380,7 +6397,7 @@ var Form = function Form(_ref5) {
|
|
|
6380
6397
|
sx: {
|
|
6381
6398
|
width: '100%'
|
|
6382
6399
|
},
|
|
6383
|
-
disabled:
|
|
6400
|
+
disabled: isPublishing || isCancelling,
|
|
6384
6401
|
onClick: function onClick() {
|
|
6385
6402
|
void (selectedAviationProduct ? handleSubmitAviationProduct(ProductAction.CANCEL, warningType) : onPressPublish());
|
|
6386
6403
|
},
|
|
@@ -6388,7 +6405,7 @@ var Form = function Form(_ref5) {
|
|
|
6388
6405
|
style: {
|
|
6389
6406
|
position: 'relative'
|
|
6390
6407
|
},
|
|
6391
|
-
children: [
|
|
6408
|
+
children: [getPublishButtonLabel(), (isPublishing || isCancelling) && jsx(CircularProgress, {
|
|
6392
6409
|
"data-testid": "spinner",
|
|
6393
6410
|
color: "inherit",
|
|
6394
6411
|
sx: spinnerSx
|
|
@@ -7382,11 +7399,18 @@ var useWarnings = function useWarnings(disabled) {
|
|
|
7382
7399
|
sigmetWarnings = _useSigmetList.data,
|
|
7383
7400
|
refetchSigmet = _useSigmetList.refetch,
|
|
7384
7401
|
isFetchingSigmet = _useSigmetList.isFetching;
|
|
7402
|
+
var warningType = useSelector(getWarningType);
|
|
7403
|
+
var _useProductConfig = useProductConfig(warningType, false),
|
|
7404
|
+
aviationConfig = _useProductConfig.data;
|
|
7385
7405
|
var combinedWarnings = useMemo(function () {
|
|
7386
|
-
var transformedSigmets = (sigmetWarnings == null ? void 0 : sigmetWarnings.map(
|
|
7387
|
-
|
|
7406
|
+
var transformedSigmets = (sigmetWarnings == null ? void 0 : sigmetWarnings.map(function (sigmet) {
|
|
7407
|
+
return transformSigmetToWarningFormat(sigmet, aviationConfig);
|
|
7408
|
+
})) || [];
|
|
7409
|
+
var transformedAirmets = (airmetWarnings == null ? void 0 : airmetWarnings.map(function (airmet) {
|
|
7410
|
+
return transformAirmetToWarningFormat(airmet, aviationConfig);
|
|
7411
|
+
})) || [];
|
|
7388
7412
|
return concat(publicWarnings || [], transformedSigmets, transformedAirmets);
|
|
7389
|
-
}, [
|
|
7413
|
+
}, [sigmetWarnings, airmetWarnings, publicWarnings, aviationConfig]);
|
|
7390
7414
|
var refetchWarnings = function refetchWarnings() {
|
|
7391
7415
|
void refetchPublicWarnings();
|
|
7392
7416
|
void refetchAirmet();
|
|
@@ -7464,7 +7488,7 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
7464
7488
|
var isEditor = (selectedWarning == null ? void 0 : selectedWarning.editor) === (auth == null ? void 0 : auth.username) || false;
|
|
7465
7489
|
var shouldGiveEditorWarning = React__default.useCallback(function (newEditor, oldEditor) {
|
|
7466
7490
|
var oldEditorIsYou = oldEditor && oldEditor === (auth == null ? void 0 : auth.username);
|
|
7467
|
-
if (oldEditorIsYou && newEditor !== oldEditor) {
|
|
7491
|
+
if (oldEditorIsYou && newEditor && newEditor !== oldEditor) {
|
|
7468
7492
|
dispatch(publicWarningFormActions.setFormError({
|
|
7469
7493
|
severity: 'warning',
|
|
7470
7494
|
message: TAKEOVER_MESSAGE
|
|
@@ -7655,8 +7679,18 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
7655
7679
|
var updatedWarningType = selectedSigmet ? 'sigmet' : selectedAirmet && 'airmet' || warningType;
|
|
7656
7680
|
var _useProductConfig = useProductConfig(updatedWarningType, !isDialogOpen),
|
|
7657
7681
|
aviationConfig = _useProductConfig.data;
|
|
7658
|
-
var selectedSigmetProduct
|
|
7659
|
-
|
|
7682
|
+
var selectedSigmetProduct;
|
|
7683
|
+
if (selectedSigmet && aviationConfig) {
|
|
7684
|
+
selectedSigmetProduct = transformSigmetToProductFormat(selectedSigmet);
|
|
7685
|
+
} else if (aviationConfig) {
|
|
7686
|
+
selectedSigmetProduct = getEmptySigmetWarning(aviationConfig);
|
|
7687
|
+
}
|
|
7688
|
+
var selectedAirmetProduct;
|
|
7689
|
+
if (selectedAirmet && aviationConfig) {
|
|
7690
|
+
selectedAirmetProduct = transformAirmetToProductFormat(selectedAirmet);
|
|
7691
|
+
} else if (aviationConfig) {
|
|
7692
|
+
selectedAirmetProduct = getEmptyAirmetWarning(aviationConfig);
|
|
7693
|
+
}
|
|
7660
7694
|
var selectedAviationProduct = React__default.useMemo(function () {
|
|
7661
7695
|
if (['sigmet', 'airmet'].includes((selectedWarningObject == null ? void 0 : selectedWarningObject.type) || '') && aviationConfig) {
|
|
7662
7696
|
return flattenPublicWarning(selectedWarningObject);
|
|
@@ -8491,7 +8525,8 @@ var WarningListItem = function WarningListItem(_ref) {
|
|
|
8491
8525
|
right: '4px'
|
|
8492
8526
|
},
|
|
8493
8527
|
children: jsx(WarningAvatar, {
|
|
8494
|
-
editor: warning.editor
|
|
8528
|
+
editor: warning.editor,
|
|
8529
|
+
status: warning.productStatus
|
|
8495
8530
|
})
|
|
8496
8531
|
})]
|
|
8497
8532
|
})
|
|
@@ -9586,18 +9621,22 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
9586
9621
|
void openPublicWarningDialog('cancel', warning, type);
|
|
9587
9622
|
break;
|
|
9588
9623
|
case 'DISCARD':
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
|
|
9596
|
-
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
|
|
9624
|
+
{
|
|
9625
|
+
var isLocked = warning.editor && warning.editor !== (auth == null ? void 0 : auth.username) || false;
|
|
9626
|
+
setConfirmDialogOptions({
|
|
9627
|
+
confirmLabel: t('warning-dialog-delete-confirm'),
|
|
9628
|
+
title: t('warning-dialog-delete-title'),
|
|
9629
|
+
description: t('warning-dialog-delete-description'),
|
|
9630
|
+
request: function request() {
|
|
9631
|
+
return deleteAviationProduct(warning, 'DISCARDED', type);
|
|
9632
|
+
},
|
|
9633
|
+
callback: function callback() {
|
|
9634
|
+
return onRemoveSuccess(warning.id);
|
|
9635
|
+
},
|
|
9636
|
+
isLocked: isLocked
|
|
9637
|
+
});
|
|
9638
|
+
break;
|
|
9639
|
+
}
|
|
9601
9640
|
}
|
|
9602
9641
|
};
|
|
9603
9642
|
var openSnackbar = function openSnackbar(message) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/warnings",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.7.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.7.0",
|
|
12
|
+
"@opengeoweb/shared": "12.7.0",
|
|
13
|
+
"@opengeoweb/store": "12.7.0",
|
|
14
|
+
"@opengeoweb/webmap-react": "12.7.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.7.0",
|
|
18
|
+
"@opengeoweb/form-fields": "12.7.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.7.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.7.0",
|
|
27
|
+
"@opengeoweb/webmap": "12.7.0",
|
|
28
|
+
"@opengeoweb/authentication": "12.7.0",
|
|
29
|
+
"@opengeoweb/sigmet-airmet": "12.7.0",
|
|
30
30
|
"react-i18next": "^15.1.1",
|
|
31
31
|
"i18next": "^25.0.1",
|
|
32
32
|
"@mui/material": "^7.0.1",
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { AirmetFromBackend, SigmetFromBackend } from '@opengeoweb/api';
|
|
2
|
+
export declare const airmetList: AirmetFromBackend[];
|
|
3
|
+
export declare const sigmetList: SigmetFromBackend[];
|
|
1
4
|
export declare const fakeSigmetTAC = "EHAA SIGMET 1 VALID 121249/121449 EHDB- EHAA AMSTERDAM FIR FRQ TS OBS ENTIRE FIR FL010 STNR WKN";
|
|
2
5
|
export declare const fakeAirmetTAC = "EHAA AIRMET -1 VALID 310700/311100 EHDB- EHAA AMSTERDAM FIR ISOL CB OBS ENTIRE FIR FL020 STNR NC";
|
|
3
6
|
export declare const aviationEndpoints: import("msw").HttpHandler[];
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { TooltipProps } from '@mui/material';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
interface WarningAvatarProps {
|
|
3
|
+
export interface WarningAvatarProps {
|
|
4
4
|
editor: string;
|
|
5
|
+
status?: string;
|
|
5
6
|
tooltipPlacement?: TooltipProps['placement'];
|
|
6
7
|
}
|
|
7
8
|
declare const WarningAvatar: React.FC<WarningAvatarProps>;
|
|
@@ -4,15 +4,15 @@ import { Warning, PublicWarningStatus, AviationWarningDetails, AirmetWarning, Si
|
|
|
4
4
|
export declare function isCancelAirmet(warningDetail: AviationWarningDetails): warningDetail is CancelAirmet;
|
|
5
5
|
export declare function isCancelSigmet(warningDetail: AviationWarningDetails): warningDetail is CancelSigmet;
|
|
6
6
|
export declare const flattenPublicWarning: (publicWarning: Warning) => Partial<AviationWarningDetails>;
|
|
7
|
-
export declare const transformAirmetToWarningFormat: (apiAirmet: AirmetFromBackend) => AirmetWarning;
|
|
8
|
-
export declare const transformSigmetToWarningFormat: (apiSigmet: SigmetFromBackend) => SigmetWarning;
|
|
7
|
+
export declare const transformAirmetToWarningFormat: (apiAirmet: AirmetFromBackend, productConfig: ProductConfig) => AirmetWarning;
|
|
8
|
+
export declare const transformSigmetToWarningFormat: (apiSigmet: SigmetFromBackend, productConfig: ProductConfig) => SigmetWarning;
|
|
9
9
|
export declare const mapProductStatusToWarningStatus: (productStatus?: ProductStatus) => PublicWarningStatus;
|
|
10
10
|
export declare const transformSigmetToProductFormat: (warning: SigmetFromBackend | undefined) => AviationProduct;
|
|
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;
|