@opengeoweb/warnings 12.12.0 → 13.0.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 +808 -493
- package/package.json +13 -13
- package/src/lib/Warnings.stories.d.ts +10 -1
- package/src/lib/api/api-utils.d.ts +1 -0
- package/src/lib/api/warning-api/api.d.ts +6 -2
- package/src/lib/api/warning-api/hooks.d.ts +11 -2
- package/src/lib/components/MaritimeWarningsForm/AreaList/AreaList.d.ts +2 -2
- package/src/lib/components/MaritimeWarningsForm/AssignedAreas/AssignedAreas.d.ts +2 -2
- package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsForm.d.ts +13 -3
- package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsForm.stories.d.ts +2 -0
- package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsFormConnect.stories.d.ts +3 -0
- package/src/lib/components/MaritimeWarningsForm/WarningList/WarningList.d.ts +3 -2
- package/src/lib/components/MaritimeWarningsForm/WarningList/WarningListItem.d.ts +4 -3
- package/src/lib/components/MaritimeWarningsForm/WarningList/WarningListSelect.d.ts +2 -1
- package/src/lib/components/MaritimeWarningsForm/types.d.ts +25 -0
- package/src/lib/components/MaritimeWarningsForm/useConfirmRetractDialog.d.ts +4 -3
- package/src/lib/components/MaritimeWarningsForm/useMaritimeWarningsFormState.d.ts +4 -1
- package/src/lib/components/MaritimeWarningsForm/utils.d.ts +2 -2
- package/src/lib/components/PublicWarningList/PublicWarningList.stories.d.ts +4 -0
- package/src/lib/components/PublicWarningList/PublicWarningListConnect.maritime.integration.spec.d.ts +1 -0
- package/src/lib/components/PublicWarningList/PublicWarningListConnect.stories.d.ts +9 -1
- package/src/lib/components/PublicWarningList/WarningListItemMenu.d.ts +3 -2
- package/src/lib/components/PublicWarningsForm/ValidFromField/ValidFromField.d.ts +1 -1
- package/src/lib/components/PublicWarningsForm/ValidUntilField/ValidUntilField.d.ts +1 -1
- package/src/lib/store/publicWarningForm/types.d.ts +4 -0
- package/src/lib/utils/fakeApi/index.d.ts +4 -2
- package/src/lib/utils/sig-airmet-util.d.ts +2 -2
- package/src/lib/components/MaritimeWarningsForm/areas.d.ts +0 -2
- package/src/lib/components/MaritimeWarningsForm/options.d.ts +0 -5
package/index.esm.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useDispatch, useSelector } from 'react-redux';
|
|
3
|
-
import { Polygons, ExitDomain, Share, Edit, Delete, CoastalEvent, TemperatureLow, TemperatureHigh, Rain, Snow, Lightning, Fog, Wind, Thunderstorm, VulcanicEruption, Haze, FreezingPrecipitation, ModerateAircraftIcing, SevereAircraftIcing, ModerateTurbulence, SevereTurbulence, SandStorm, RadioactiveMaterials, DrawPolygon, Visibility, Add, ArrowUpCompact, ArrowDownCompact, breakpoints, DragHandle, Options, Close, ChevronDown, ChevronUp, Copy, Update, Cancel, Success, Expire, Remove } from '@opengeoweb/theme';
|
|
3
|
+
import { Polygons, ExitDomain, Share, Edit, Delete, CoastalEvent, TemperatureLow, TemperatureHigh, Rain, Snow, Lightning, Fog, Wind, Thunderstorm, SevereMountainWaves, VulcanicEruption, Haze, FreezingPrecipitation, ModerateAircraftIcing, SevereAircraftIcing, ModerateTurbulence, SevereTurbulence, SandStorm, RadioactiveMaterials, DrawPolygon, Visibility, Add, ArrowUpCompact, ArrowDownCompact, breakpoints, DragHandle, Options, Close, ChevronDown, ChevronUp, Copy, Update, Cancel, Success, Expire, Remove } from '@opengeoweb/theme';
|
|
4
4
|
import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawingToolSelectors, layerSelectors, uiSelectors, drawingToolActions, layerActions, mapListener, layersListener, drawingToolListener, syncGroupsListener, openlayersListener, syncGroupsReducer, drawingToolReducer, uiReducer, layerReducer, mapReducer, useSetupDialog, genericSelectors, useUpdateSharedData, genericActions, selectorMemoizationOptions } from '@opengeoweb/store';
|
|
5
5
|
import { defaultPolygon, emptyGeoJSON, MapControlButton, getIcon, rewindGeometry, getGeoJSONPropertyValue, currentlySupportedDrawModes, defaultLayers, viewUtils, OpenLayersMapView, MapControls, OpenLayersZoomControl, OpenLayersLayer, OpenLayersFeatureLayer, genericOpenLayersFeatureStyle } from '@opengeoweb/webmap-react';
|
|
6
|
-
import { SHARED_NAMESPACE, useConfirmationDialog, dateUtils, ToggleMenu, calculateStartSize, ToolContainerDraggable, AlertBanner, sessionStorageProvider, ConfirmationDialog, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, FilterChip, TooltipSelect, usePreventBrowserClose, CustomToggleButton, Filter, FilterOption, StatusTag,
|
|
6
|
+
import { SHARED_NAMESPACE, useConfirmationDialog, dateUtils, ToggleMenu, calculateStartSize, ToolContainerDraggable, AlertBanner, sessionStorageProvider, ConfirmationDialog, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, FilterChip, TooltipSelect, LastUpdateTime, usePreventBrowserClose, CustomToggleButton, Filter, FilterOption, StatusTag, getAxiosErrorMessage, ErrorBoundary } from '@opengeoweb/shared';
|
|
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, getDefaultValidFromValue, isInstanceOfCancelAirmet,
|
|
10
|
+
import { SA_NAMESPACE, isInstanceOfCancelSigmet, getDefaultValidFromValue, isInstanceOfCancelAirmet, getDefaultValidUntilValue, useShortTestHelpers, ProductAction, SigmetForm, AirmetForm, 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';
|
|
@@ -218,9 +218,7 @@ var en = {
|
|
|
218
218
|
"maritime-add-area": "Add",
|
|
219
219
|
"maritime-no-area-selected": "(no area selected)",
|
|
220
220
|
"maritime-no-district-selected": "(no district selected)",
|
|
221
|
-
"maritime-
|
|
222
|
-
"maritime-veering": "Veering",
|
|
223
|
-
"maritime-no-change": "No change",
|
|
221
|
+
"maritime-no-change-selected": "(no change selected)",
|
|
224
222
|
"maritime-windforce": "{{value}} Bft",
|
|
225
223
|
"maritime-header-direction": "Direction",
|
|
226
224
|
"maritime-header-direction-from": "Direction from",
|
|
@@ -229,22 +227,25 @@ var en = {
|
|
|
229
227
|
"maritime-header-areas": "Areas",
|
|
230
228
|
"maritime-header-districts": "Districts",
|
|
231
229
|
"maritime-header-change": "Change",
|
|
232
|
-
"maritime-direction-
|
|
233
|
-
"maritime-direction-
|
|
234
|
-
"maritime-direction-
|
|
235
|
-
"maritime-direction-
|
|
236
|
-
"maritime-direction-
|
|
237
|
-
"maritime-direction-
|
|
238
|
-
"maritime-direction-
|
|
239
|
-
"maritime-direction-
|
|
240
|
-
"maritime-direction-
|
|
241
|
-
"maritime-direction-
|
|
242
|
-
"maritime-direction-
|
|
243
|
-
"maritime-direction-
|
|
244
|
-
"maritime-direction-
|
|
245
|
-
"maritime-direction-
|
|
246
|
-
"maritime-direction-
|
|
247
|
-
"maritime-direction-
|
|
230
|
+
"maritime-direction-N": "North",
|
|
231
|
+
"maritime-direction-NNE": "North to Northeast",
|
|
232
|
+
"maritime-direction-NE": "Northeast",
|
|
233
|
+
"maritime-direction-ENE": "East to Northeast",
|
|
234
|
+
"maritime-direction-E": "East",
|
|
235
|
+
"maritime-direction-ESE": "East to Southeast",
|
|
236
|
+
"maritime-direction-SE": "Southeast",
|
|
237
|
+
"maritime-direction-SSE": "South to Southeast",
|
|
238
|
+
"maritime-direction-S": "South",
|
|
239
|
+
"maritime-direction-SSW": "South to Southwest",
|
|
240
|
+
"maritime-direction-SW": "Southwest",
|
|
241
|
+
"maritime-direction-WSW": "West to Southwest",
|
|
242
|
+
"maritime-direction-W": "West",
|
|
243
|
+
"maritime-direction-WNW": "West to Northwest",
|
|
244
|
+
"maritime-direction-NW": "Northwest",
|
|
245
|
+
"maritime-direction-NNW": "North to Northwest",
|
|
246
|
+
"maritime-change-NO_CHANGE": "No change",
|
|
247
|
+
"maritime-change-BACKING": "Backing",
|
|
248
|
+
"maritime-change-VEERING": "Veering",
|
|
248
249
|
"maritime-delete-button": "Delete",
|
|
249
250
|
"maritime-retract-warning": "Retract warning",
|
|
250
251
|
"maritime-no-change-of-direction": "(no change of direction)",
|
|
@@ -252,17 +253,18 @@ var en = {
|
|
|
252
253
|
"maritime-retract-dialog-description-suffix": "will be removed",
|
|
253
254
|
"maritime-retract-dialog-empty-warning-description": "The warning will be retracted",
|
|
254
255
|
"maritime-retract-dialog-confirm": "Retract",
|
|
255
|
-
"maritime-retract-success": "Warning retracted successfully",
|
|
256
256
|
"maritime-clear-dialog-title": "Clear all",
|
|
257
257
|
"maritime-clear-dialog-description": "All warnings will be removed from the list",
|
|
258
|
-
"maritime-clear-success": "Warning list cleared successfully",
|
|
259
258
|
"maritime-warning-title-coastal": "Warning Maritime - Coastal Waters",
|
|
260
259
|
"maritime-warning-title-northsea": "Warning Maritime - North Sea Districts",
|
|
261
260
|
"maritime-domain-coastal": "Coastal Waters",
|
|
262
261
|
"maritime-domain-northsea": "North Sea Districts",
|
|
263
262
|
"maritime-editor-on": "You are now the editor of the Maritime Warnings for {{domain}}",
|
|
264
263
|
"maritime-editor-off": "You are now no longer the editor of the Maritime Warnings for {{domain}}",
|
|
265
|
-
"maritime-warning-post-success": "Warning published successfully"
|
|
264
|
+
"maritime-warning-post-success": "Warning published successfully",
|
|
265
|
+
"maritime-loading-config": "Loading config...",
|
|
266
|
+
"maritime-config-error": "Something went wrong with loading the configuration file",
|
|
267
|
+
"maritime-warning-validuntil": "End time: "
|
|
266
268
|
};
|
|
267
269
|
var nl = {
|
|
268
270
|
"drawing-tool-form-tools": "Gereedschap",
|
|
@@ -419,9 +421,10 @@ var nl = {
|
|
|
419
421
|
"maritime-add-area": "Toevoegen",
|
|
420
422
|
"maritime-no-area-selected": "(geen gebied geselecteerd)",
|
|
421
423
|
"maritime-no-district-selected": "(geen district geselecteerd)",
|
|
422
|
-
"maritime-
|
|
423
|
-
"maritime-
|
|
424
|
-
"maritime-
|
|
424
|
+
"maritime-no-change-selected": "(geen wijziging geselecteerd)",
|
|
425
|
+
"maritime-change-NO_CHANGE": "Geen wijziging",
|
|
426
|
+
"maritime-change-BACKING": "Krimpend",
|
|
427
|
+
"maritime-change-VEERING": "Ruimend",
|
|
425
428
|
"maritime-windforce": "{{value}} Bft",
|
|
426
429
|
"maritime-header-direction": "Richting",
|
|
427
430
|
"maritime-header-direction-from": "Richting van",
|
|
@@ -430,35 +433,36 @@ var nl = {
|
|
|
430
433
|
"maritime-header-areas": "Gebieden",
|
|
431
434
|
"maritime-header-districts": "Districten",
|
|
432
435
|
"maritime-header-change": "Wijziging",
|
|
433
|
-
"maritime-direction-
|
|
434
|
-
"maritime-direction-
|
|
435
|
-
"maritime-direction-
|
|
436
|
-
"maritime-direction-
|
|
437
|
-
"maritime-direction-
|
|
438
|
-
"maritime-direction-
|
|
439
|
-
"maritime-direction-
|
|
440
|
-
"maritime-direction-
|
|
441
|
-
"maritime-direction-
|
|
442
|
-
"maritime-direction-
|
|
443
|
-
"maritime-direction-
|
|
444
|
-
"maritime-direction-
|
|
445
|
-
"maritime-direction-
|
|
446
|
-
"maritime-direction-
|
|
447
|
-
"maritime-direction-
|
|
448
|
-
"maritime-direction-
|
|
436
|
+
"maritime-direction-N": "Noord",
|
|
437
|
+
"maritime-direction-NNE": "Noord tot noordoost",
|
|
438
|
+
"maritime-direction-NE": "Noordoost",
|
|
439
|
+
"maritime-direction-ENE": "Oost tot noordoost",
|
|
440
|
+
"maritime-direction-E": "Oost",
|
|
441
|
+
"maritime-direction-ESE": "Oost tot zuidoost",
|
|
442
|
+
"maritime-direction-SE": "Zuidoost",
|
|
443
|
+
"maritime-direction-SSE": "Zuid tot zuidoost",
|
|
444
|
+
"maritime-direction-S": "Zuid",
|
|
445
|
+
"maritime-direction-SSW": "Zuid tot zuidwest",
|
|
446
|
+
"maritime-direction-SW": "Zuidwest",
|
|
447
|
+
"maritime-direction-WSW": "West tot zuidwest",
|
|
448
|
+
"maritime-direction-W": "West",
|
|
449
|
+
"maritime-direction-WNW": "West tot noordwest",
|
|
450
|
+
"maritime-direction-NW": "Noordwest",
|
|
451
|
+
"maritime-direction-NNW": "Noord tot noordwest",
|
|
449
452
|
"maritime-delete-button": "Verwijderen",
|
|
450
453
|
"maritime-retract-warning": "Waarschuwing intrekken",
|
|
451
454
|
"maritime-retract-dialog-no-change": "(geen wijziging in richting)",
|
|
452
455
|
"maritime-retract-dialog-empty-warning-description": "De waarschuwing wordt verwijderd",
|
|
453
456
|
"maritime-retract-dialog-description-suffix": "wordt verwijderd",
|
|
454
457
|
"maritime-retract-dialog-confirm": "Intrekken",
|
|
455
|
-
"maritime-retract-success": "Waarschuwing succesvol ingetrokken",
|
|
456
458
|
"maritime-clear-dialog-title": "Wissen",
|
|
457
459
|
"maritime-clear-dialog-description": "Alle waarschuwingen worden verwijderd",
|
|
458
|
-
"maritime-clear-success": "Alle waarchuwingen zijn verwijderd",
|
|
459
460
|
"maritime-warning-title-coastal": "Maritieme Waarschuwing - Kustgebieden",
|
|
460
461
|
"maritime-warning-title-northsea": "Maritieme Waarschuwing - Noordzee Districten",
|
|
461
|
-
"maritime-warning-post-success": "Waarschuwing succesvol gepubliceerd"
|
|
462
|
+
"maritime-warning-post-success": "Waarschuwing succesvol gepubliceerd",
|
|
463
|
+
"maritime-loading-config": "Laden van configuratie...",
|
|
464
|
+
"maritime-config-error": "Er is iets misgegaan bij het laden van het configuratiebestand",
|
|
465
|
+
"maritime-warning-validuntil": "Eind tijd: "
|
|
462
466
|
};
|
|
463
467
|
var fi = {
|
|
464
468
|
"drawing-tool-form-tools": "Työkalut",
|
|
@@ -622,14 +626,14 @@ var no = {
|
|
|
622
626
|
"drawing-tool-form-update": "Oppdater objekt",
|
|
623
627
|
"drawing-tool-form-exit-draw-mode": "Trykk ESC for å avslutte tegnemodus",
|
|
624
628
|
"drawing-tool-form-drawing-required": "Objekttegning kreves",
|
|
625
|
-
"close-dialog-cancel": "
|
|
629
|
+
"close-dialog-cancel": "Cancel",
|
|
626
630
|
"close-dialog-confirm": "Lukk",
|
|
627
631
|
"close-draw-dialog-title": "Lukk tegneverktøy",
|
|
628
632
|
"close-dialog-description": "Du har gjort endringer, er du sikker på at du vil lukke?",
|
|
629
633
|
"drawing-tool-title": "Tegneverktøy",
|
|
630
|
-
"object-manager-title": "
|
|
634
|
+
"object-manager-title": "Objekter for",
|
|
631
635
|
"object-manager-add": "Legg til nytt objekt",
|
|
632
|
-
"delete-dialog-cancel": "
|
|
636
|
+
"delete-dialog-cancel": "Cancel",
|
|
633
637
|
"delete-dialog-confirm": "Slett",
|
|
634
638
|
"delete-dialog-title": "Slett objekt",
|
|
635
639
|
"delete-dialog-description": "Er du sikker på at du vil slette?",
|
|
@@ -741,30 +745,30 @@ var no = {
|
|
|
741
745
|
"filter-phenomenon": "Fenomen",
|
|
742
746
|
"filter-level": "Grad",
|
|
743
747
|
"filter-source": "Kilder",
|
|
744
|
-
"warning-dialog-expire-succes": "
|
|
745
|
-
"warning-dialog-expire-title": "
|
|
746
|
-
"warning-dialog-expire-confirm": "
|
|
747
|
-
"warning-dialog-expire-description": "
|
|
748
|
-
"warning-dialog-withdraw-succes": "
|
|
749
|
-
"warning-dialog-withdraw-title": "
|
|
750
|
-
"warning-dialog-withdraw-confirm": "
|
|
751
|
-
"warning-dialog-withdraw-description": "
|
|
752
|
-
"warning-domain-aviation": "
|
|
753
|
-
"warning-domain-maritime": "
|
|
754
|
-
"warning-domain-public": "
|
|
748
|
+
"warning-dialog-expire-succes": "Varselet er utgått",
|
|
749
|
+
"warning-dialog-expire-title": "Opphør varsel",
|
|
750
|
+
"warning-dialog-expire-confirm": "Opphør",
|
|
751
|
+
"warning-dialog-expire-description": "Er du sikker på at du vil opphøre dette varselet?",
|
|
752
|
+
"warning-dialog-withdraw-succes": "Varselet er tilbaketrukket",
|
|
753
|
+
"warning-dialog-withdraw-title": "Trekk tilbake varsel",
|
|
754
|
+
"warning-dialog-withdraw-confirm": "Trekk tilbake",
|
|
755
|
+
"warning-dialog-withdraw-description": "Er du sikker på at du vil tilbaketrekke dette varselet?",
|
|
756
|
+
"warning-domain-aviation": "SIGMET/AIRMET",
|
|
757
|
+
"warning-domain-maritime": "Maritim",
|
|
758
|
+
"warning-domain-public": "Farevarsel",
|
|
755
759
|
"error-title-retry": "Prøv igjen",
|
|
756
760
|
"tac-missing-data": "Mangler data: ingen TAC kan genereres",
|
|
757
761
|
"warning-list-button-renew": "Renew",
|
|
758
|
-
"aviation-save-success": "{{warningType}}
|
|
759
|
-
"aviation-publish-success": "{{warningType}}
|
|
760
|
-
"publish-this-product": "
|
|
761
|
-
"yes-cancel": "
|
|
762
|
-
"cancel-this-product": "
|
|
763
|
-
"aviation-cancel-success": "{{warningType}}
|
|
764
|
-
"aviation-discard-success": "{{warningType}}
|
|
762
|
+
"aviation-save-success": "{{warningType}} has succesfully been saved!",
|
|
763
|
+
"aviation-publish-success": "{{warningType}} has succesfully been published!",
|
|
764
|
+
"publish-this-product": "Are you sure you want to publish this {{product}}?",
|
|
765
|
+
"yes-cancel": "Yes, cancel {{product}}",
|
|
766
|
+
"cancel-this-product": "Are you sure you want to cancel this {{product}}?",
|
|
767
|
+
"aviation-cancel-success": "{{warningType}} has succesfully been cancelled!",
|
|
768
|
+
"aviation-discard-success": "{{warningType}} has been discarded!",
|
|
765
769
|
"error-auth-login": "Denne delen er passordbeskyttet. Vennligst logg inn.",
|
|
766
|
-
"cancel-warningType": "
|
|
767
|
-
cancelling: "
|
|
770
|
+
"cancel-warningType": "Cancel {{warningType}}",
|
|
771
|
+
cancelling: "Cancelling"
|
|
768
772
|
};
|
|
769
773
|
var warningsTranslations = {
|
|
770
774
|
en: en,
|
|
@@ -2008,8 +2012,9 @@ var getPublicWarningList = function getPublicWarningList(auth) {
|
|
|
2008
2012
|
headers: getHeaders(auth)
|
|
2009
2013
|
}).then(handleResponse).then(function (warnings) {
|
|
2010
2014
|
return warnings.map(function (warning) {
|
|
2015
|
+
var _warning$warningDetai;
|
|
2011
2016
|
return Object.assign({}, warning, {
|
|
2012
|
-
type: 'public'
|
|
2017
|
+
type: ((_warning$warningDetai = warning.warningDetail) == null ? void 0 : _warning$warningDetai.domain) || 'public'
|
|
2013
2018
|
});
|
|
2014
2019
|
});
|
|
2015
2020
|
});
|
|
@@ -2027,13 +2032,26 @@ var updatePublicWarning = function updatePublicWarning(warningId, auth, data) {
|
|
|
2027
2032
|
body: JSON.stringify(data)
|
|
2028
2033
|
}).then(handleResponse);
|
|
2029
2034
|
};
|
|
2030
|
-
var
|
|
2035
|
+
var postPublicWarning = function postPublicWarning(auth, data) {
|
|
2031
2036
|
return fetch(publicWarningBaseUrl + "/warnings/", {
|
|
2032
2037
|
headers: getHeaders(auth),
|
|
2033
2038
|
method: 'POST',
|
|
2034
2039
|
body: JSON.stringify(data)
|
|
2035
2040
|
}).then(handleResponse);
|
|
2036
2041
|
};
|
|
2042
|
+
var postMaritimeWarnings = function postMaritimeWarnings(auth, data) {
|
|
2043
|
+
return fetch(publicWarningBaseUrl + "/maritime/", {
|
|
2044
|
+
headers: getHeaders(auth),
|
|
2045
|
+
method: 'POST',
|
|
2046
|
+
body: JSON.stringify(data)
|
|
2047
|
+
}).then(handleResponse);
|
|
2048
|
+
};
|
|
2049
|
+
var updateMaritimeWarningsEditor = function updateMaritimeWarningsEditor(domain, isEditor, auth, force) {
|
|
2050
|
+
return fetch(publicWarningBaseUrl + "/maritime/" + domain + "?editor=" + (isEditor ? 'true' : 'false') + "&force=" + (force ? 'true' : 'false'), {
|
|
2051
|
+
headers: getHeaders(auth),
|
|
2052
|
+
method: 'POST'
|
|
2053
|
+
}).then(handleResponse);
|
|
2054
|
+
};
|
|
2037
2055
|
var deleteWarning = function deleteWarning(warningId, auth) {
|
|
2038
2056
|
return fetch(publicWarningBaseUrl + "/warnings/" + warningId + "?delete=true", {
|
|
2039
2057
|
headers: getHeaders(auth),
|
|
@@ -2117,6 +2135,12 @@ var deleteDrawing = function deleteDrawing(auth, drawingId) {
|
|
|
2117
2135
|
headers: getHeaders(auth)
|
|
2118
2136
|
}).then(handleResponse);
|
|
2119
2137
|
};
|
|
2138
|
+
var getMaritimeWarningsConfig = function getMaritimeWarningsConfig(auth) {
|
|
2139
|
+
var url = publicWarningBaseUrl + "/maritime-warnings-config";
|
|
2140
|
+
return fetch(url, {
|
|
2141
|
+
headers: getHeaders(auth)
|
|
2142
|
+
}).then(handleResponse);
|
|
2143
|
+
};
|
|
2120
2144
|
|
|
2121
2145
|
/* *
|
|
2122
2146
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -2145,6 +2169,11 @@ var PublicWarningStatus;
|
|
|
2145
2169
|
PublicWarningStatus["IGNORED"] = "IGNORED";
|
|
2146
2170
|
PublicWarningStatus["WITHDRAWN"] = "WITHDRAWN";
|
|
2147
2171
|
})(PublicWarningStatus || (PublicWarningStatus = {}));
|
|
2172
|
+
var MaritimeWarningAction;
|
|
2173
|
+
(function (MaritimeWarningAction) {
|
|
2174
|
+
MaritimeWarningAction["SELECT"] = "SELECT";
|
|
2175
|
+
MaritimeWarningAction["UPDATE"] = "UPDATE";
|
|
2176
|
+
})(MaritimeWarningAction || (MaritimeWarningAction = {}));
|
|
2148
2177
|
|
|
2149
2178
|
/* *
|
|
2150
2179
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -2627,6 +2656,8 @@ var getAviationPhenomenaIcon = function getAviationPhenomenaIcon(key) {
|
|
|
2627
2656
|
return jsx(Haze, {});
|
|
2628
2657
|
case 'VA_CLD':
|
|
2629
2658
|
return jsx(VulcanicEruption, {});
|
|
2659
|
+
case 'SEV_MTW':
|
|
2660
|
+
return jsx(SevereMountainWaves, {});
|
|
2630
2661
|
case 'EMBD_TS':
|
|
2631
2662
|
case 'EMBD_TSGR':
|
|
2632
2663
|
case 'FRQ_TS':
|
|
@@ -3052,7 +3083,7 @@ var useMutateWarning = function useMutateWarning(snackBarMessage) {
|
|
|
3052
3083
|
if (id) {
|
|
3053
3084
|
return updatePublicWarning(id, auth, data);
|
|
3054
3085
|
}
|
|
3055
|
-
return
|
|
3086
|
+
return postPublicWarning(auth, data);
|
|
3056
3087
|
},
|
|
3057
3088
|
onError: function onError(error) {
|
|
3058
3089
|
void queryClient.invalidateQueries({
|
|
@@ -3311,7 +3342,8 @@ var useMutateDeleteDrawing = function useMutateDeleteDrawing() {
|
|
|
3311
3342
|
}
|
|
3312
3343
|
});
|
|
3313
3344
|
};
|
|
3314
|
-
var
|
|
3345
|
+
var BE_EDITOR_WARNING = 'Warning is being edited by another user and cannot be updated';
|
|
3346
|
+
var usePostMaritimeWarnings = function usePostMaritimeWarnings() {
|
|
3315
3347
|
var _useAuthenticationCon6 = useAuthenticationContext(),
|
|
3316
3348
|
auth = _useAuthenticationCon6.auth;
|
|
3317
3349
|
var queryClient = useQueryClient();
|
|
@@ -3321,35 +3353,49 @@ var usePostMaritimeWarning = function usePostMaritimeWarning() {
|
|
|
3321
3353
|
if (!auth) {
|
|
3322
3354
|
throw new Error('Authentication context not found');
|
|
3323
3355
|
}
|
|
3324
|
-
return
|
|
3356
|
+
return postMaritimeWarnings(auth, data);
|
|
3325
3357
|
},
|
|
3326
|
-
onSuccess: function () {
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
queryKey: ['public-warning-list']
|
|
3334
|
-
});
|
|
3335
|
-
case 2:
|
|
3336
|
-
dispatch(snackbarActions.openSnackbar({
|
|
3337
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
3338
|
-
key: 'maritime-warning-post-success'
|
|
3339
|
-
}));
|
|
3340
|
-
case 3:
|
|
3341
|
-
case "end":
|
|
3342
|
-
return _context6.stop();
|
|
3343
|
-
}
|
|
3344
|
-
}, _callee6);
|
|
3358
|
+
onSuccess: function onSuccess() {
|
|
3359
|
+
void queryClient.invalidateQueries({
|
|
3360
|
+
queryKey: ['public-warning-list']
|
|
3361
|
+
});
|
|
3362
|
+
dispatch(snackbarActions.openSnackbar({
|
|
3363
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
3364
|
+
key: 'maritime-warning-post-success'
|
|
3345
3365
|
}));
|
|
3346
|
-
|
|
3347
|
-
|
|
3366
|
+
},
|
|
3367
|
+
onError: function onError(error) {
|
|
3368
|
+
if (error.message === BE_EDITOR_WARNING) {
|
|
3369
|
+
// only in case of an editor conflict, we need to update the list
|
|
3370
|
+
void queryClient.invalidateQueries({
|
|
3371
|
+
queryKey: ['public-warning-list']
|
|
3372
|
+
});
|
|
3348
3373
|
}
|
|
3349
|
-
|
|
3350
|
-
}()
|
|
3374
|
+
}
|
|
3351
3375
|
});
|
|
3352
3376
|
};
|
|
3377
|
+
var useMutateMaritimeWarningsEditor = function useMutateMaritimeWarningsEditor() {
|
|
3378
|
+
var _useAuthenticationCon7 = useAuthenticationContext(),
|
|
3379
|
+
auth = _useAuthenticationCon7.auth;
|
|
3380
|
+
return useMutation({
|
|
3381
|
+
mutationFn: function mutationFn(_ref0) {
|
|
3382
|
+
var domain = _ref0.domain,
|
|
3383
|
+
isEditor = _ref0.isEditor,
|
|
3384
|
+
force = _ref0.force;
|
|
3385
|
+
if (!auth) {
|
|
3386
|
+
throw new Error('Authentication context not found');
|
|
3387
|
+
}
|
|
3388
|
+
return updateMaritimeWarningsEditor(domain, isEditor, auth, force);
|
|
3389
|
+
}
|
|
3390
|
+
});
|
|
3391
|
+
};
|
|
3392
|
+
var useMaritimeWarningsConfig = function useMaritimeWarningsConfig(disabled) {
|
|
3393
|
+
if (disabled === void 0) {
|
|
3394
|
+
disabled = false;
|
|
3395
|
+
}
|
|
3396
|
+
var maritimeConfigQuery = useAuthQuery(['maritime-warnings-config'], getMaritimeWarningsConfig, disabled);
|
|
3397
|
+
return maritimeConfigQuery;
|
|
3398
|
+
};
|
|
3353
3399
|
|
|
3354
3400
|
var getDeleteDescription = function getDeleteDescription(objectName, t) {
|
|
3355
3401
|
return t('delete-dialog-description') + " \"" + objectName + "\"?";
|
|
@@ -4757,15 +4803,12 @@ var flattenPublicWarning = function flattenPublicWarning(publicWarning) {
|
|
|
4757
4803
|
}
|
|
4758
4804
|
return {};
|
|
4759
4805
|
};
|
|
4760
|
-
var transformAirmetToWarningFormat = function transformAirmetToWarningFormat(apiAirmet
|
|
4806
|
+
var transformAirmetToWarningFormat = function transformAirmetToWarningFormat(apiAirmet) {
|
|
4807
|
+
var _airmet$startGeometry;
|
|
4761
4808
|
var airmet = apiAirmet.airmet;
|
|
4762
|
-
var tacGeometry =
|
|
4763
|
-
startGeometry: airmet.startGeometry,
|
|
4764
|
-
startGeometryIntersect: airmet.startGeometryIntersect,
|
|
4765
|
-
maxPoints: getMaxPolygonPoints(airmet.locationIndicatorATSR, productConfig)
|
|
4766
|
-
});
|
|
4809
|
+
var tacGeometry = (_airmet$startGeometry = airmet.startGeometryIntersect) != null ? _airmet$startGeometry : airmet.startGeometry;
|
|
4767
4810
|
var areas = [];
|
|
4768
|
-
if (airmet.startGeometry) {
|
|
4811
|
+
if (airmet.startGeometry && tacGeometry.features.length > 0) {
|
|
4769
4812
|
areas.push({
|
|
4770
4813
|
areaId: airmet.uuid + "-start",
|
|
4771
4814
|
geoJSON: Object.assign({}, tacGeometry, {
|
|
@@ -4802,18 +4845,11 @@ var transformAirmetToWarningFormat = function transformAirmetToWarningFormat(api
|
|
|
4802
4845
|
type: 'airmet'
|
|
4803
4846
|
};
|
|
4804
4847
|
};
|
|
4805
|
-
var transformSigmetToWarningFormat = function transformSigmetToWarningFormat(apiSigmet
|
|
4848
|
+
var transformSigmetToWarningFormat = function transformSigmetToWarningFormat(apiSigmet) {
|
|
4849
|
+
var _sigmet$startGeometry, _sigmet$endGeometryIn;
|
|
4806
4850
|
var sigmet = apiSigmet.sigmet;
|
|
4807
|
-
var tacGeometryStart =
|
|
4808
|
-
|
|
4809
|
-
startGeometryIntersect: sigmet.startGeometryIntersect,
|
|
4810
|
-
maxPoints: getMaxPolygonPoints(sigmet.locationIndicatorATSR, productConfig)
|
|
4811
|
-
});
|
|
4812
|
-
var tacGeometryEnd = getTacGeometry({
|
|
4813
|
-
startGeometry: sigmet.endGeometry,
|
|
4814
|
-
startGeometryIntersect: sigmet.endGeometryIntersect,
|
|
4815
|
-
maxPoints: getMaxPolygonPoints(sigmet.locationIndicatorATSR, productConfig)
|
|
4816
|
-
});
|
|
4851
|
+
var tacGeometryStart = (_sigmet$startGeometry = sigmet.startGeometryIntersect) != null ? _sigmet$startGeometry : sigmet.startGeometry;
|
|
4852
|
+
var tacGeometryEnd = (_sigmet$endGeometryIn = sigmet.endGeometryIntersect) != null ? _sigmet$endGeometryIn : sigmet.endGeometry;
|
|
4817
4853
|
var areas = [];
|
|
4818
4854
|
if (sigmet.startGeometry) {
|
|
4819
4855
|
areas.push({
|
|
@@ -5047,9 +5083,7 @@ var renewAviationProduct = function renewAviationProduct(aviationWarning, produc
|
|
|
5047
5083
|
};
|
|
5048
5084
|
var amendAviationProduct = function amendAviationProduct(aviationWarning, productConfig) {
|
|
5049
5085
|
var warningDetail = aviationWarning.sigmetAirmetDetails;
|
|
5050
|
-
var newValidStart = dateUtils.dateToString(
|
|
5051
|
-
minutes: 5
|
|
5052
|
-
}));
|
|
5086
|
+
var newValidStart = dateUtils.dateToString(new Date());
|
|
5053
5087
|
var newValidUntil = 'phenomenon' in warningDetail ? getDefaultValidUntilValue(productConfig, warningDetail.phenomenon, warningDetail.locationIndicatorATSR, newValidStart) : warningDetail.validDateEnd;
|
|
5054
5088
|
var amendedWarningDetail = Object.assign({}, warningDetail, {
|
|
5055
5089
|
validDateStart: newValidStart,
|
|
@@ -5560,7 +5594,7 @@ var ProbabilityField = function ProbabilityField(_ref) {
|
|
|
5560
5594
|
});
|
|
5561
5595
|
};
|
|
5562
5596
|
|
|
5563
|
-
var VALID_FROM_MAX_HOURS_AFTER_CURRENT =
|
|
5597
|
+
var VALID_FROM_MAX_HOURS_AFTER_CURRENT = 192;
|
|
5564
5598
|
var _isValueBeforeCurrentTime$1 = function isValueBeforeCurrentTime(value, t) {
|
|
5565
5599
|
return isXHoursBefore(value, dateUtils.getCurrentTimeAsString(), 0) || t('warning-valid-from-error-before-current');
|
|
5566
5600
|
};
|
|
@@ -5606,7 +5640,7 @@ var ValidFrom = function ValidFrom(_ref) {
|
|
|
5606
5640
|
});
|
|
5607
5641
|
};
|
|
5608
5642
|
|
|
5609
|
-
var VALID_UNTIL_MAX_HOURS_AFTER_CURRENT =
|
|
5643
|
+
var VALID_UNTIL_MAX_HOURS_AFTER_CURRENT = 192;
|
|
5610
5644
|
var VALID_UNTIL_MIN_HOURS_AFTER_VALID_FROM = 1;
|
|
5611
5645
|
var _isValueBeforeCurrentTime = function isValueBeforeCurrentTime(value, t) {
|
|
5612
5646
|
return isXHoursBefore(value, dateUtils.getCurrentTimeAsString(), 0) || t('warning-valid-until-error-before-current');
|
|
@@ -5729,7 +5763,7 @@ var AreaList = /*#__PURE__*/React__default.memo(function (_ref2) {
|
|
|
5729
5763
|
var _useFilterChipSelect = useFilterChipSelect({
|
|
5730
5764
|
selectedIds: selected,
|
|
5731
5765
|
assignedIds: areas.map(function (area) {
|
|
5732
|
-
return area.
|
|
5766
|
+
return area.districtName;
|
|
5733
5767
|
}),
|
|
5734
5768
|
onSelectMultiple: onSelectMultipleAreas,
|
|
5735
5769
|
onToggleSelect: onToggleSelectArea
|
|
@@ -5751,20 +5785,20 @@ var AreaList = /*#__PURE__*/React__default.memo(function (_ref2) {
|
|
|
5751
5785
|
}
|
|
5752
5786
|
},
|
|
5753
5787
|
children: areas.map(function (area) {
|
|
5754
|
-
var isDisabled = disabled.includes(area.
|
|
5755
|
-
var isSelected = !isDisabled && selected.includes(area.
|
|
5788
|
+
var isDisabled = disabled.includes(area.districtName);
|
|
5789
|
+
var isSelected = !isDisabled && selected.includes(area.districtName);
|
|
5756
5790
|
return jsx(FilterChip, {
|
|
5757
|
-
id: area.
|
|
5758
|
-
label: area.
|
|
5791
|
+
id: area.districtName,
|
|
5792
|
+
label: area.districtName,
|
|
5759
5793
|
isSelected: isSelected,
|
|
5760
5794
|
isDisabled: isDisabled,
|
|
5761
5795
|
onClick: function onClick(_ref, event) {
|
|
5762
5796
|
if (!isReadOnly) {
|
|
5763
|
-
handleChipClick == null || handleChipClick(area.
|
|
5797
|
+
handleChipClick == null || handleChipClick(area.districtName, event);
|
|
5764
5798
|
}
|
|
5765
5799
|
},
|
|
5766
5800
|
size: "medium"
|
|
5767
|
-
}, area.
|
|
5801
|
+
}, area.districtName);
|
|
5768
5802
|
})
|
|
5769
5803
|
});
|
|
5770
5804
|
});
|
|
@@ -5838,7 +5872,7 @@ var AssignedAreas = function AssignedAreas(_ref) {
|
|
|
5838
5872
|
t = _useWarningsTranslati.t;
|
|
5839
5873
|
var assignedAreaIds = React__default.useMemo(function () {
|
|
5840
5874
|
return new Set(assignedAreas.map(function (area) {
|
|
5841
|
-
return area.
|
|
5875
|
+
return area.districtName;
|
|
5842
5876
|
}));
|
|
5843
5877
|
}, [assignedAreas]);
|
|
5844
5878
|
// can add the selected areas when they don't appear in the assigned area list
|
|
@@ -5895,21 +5929,21 @@ var AssignedAreas = function AssignedAreas(_ref) {
|
|
|
5895
5929
|
pointerEvents: !isReadOnly ? 'auto' : 'none'
|
|
5896
5930
|
},
|
|
5897
5931
|
children: assignedAreas.map(function (area) {
|
|
5898
|
-
var isSelected = selectedAreaIds.includes(area.
|
|
5932
|
+
var isSelected = selectedAreaIds.includes(area.districtName);
|
|
5899
5933
|
return jsx(FilterChip, {
|
|
5900
5934
|
size: "small",
|
|
5901
|
-
id: area.
|
|
5902
|
-
label: area.
|
|
5935
|
+
id: area.districtName,
|
|
5936
|
+
label: area.districtName,
|
|
5903
5937
|
isSelected: isSelected,
|
|
5904
5938
|
onClick: function onClick(_chipRef, event) {
|
|
5905
5939
|
if (!isReadOnly) {
|
|
5906
|
-
handleChipClick(area.
|
|
5940
|
+
handleChipClick(area.districtName, event);
|
|
5907
5941
|
}
|
|
5908
5942
|
},
|
|
5909
5943
|
onClickIcon: isSelected && !isReadOnly ? function () {
|
|
5910
|
-
onDeleteClick(area.
|
|
5944
|
+
onDeleteClick(area.districtName);
|
|
5911
5945
|
} : undefined
|
|
5912
|
-
}, area.
|
|
5946
|
+
}, area.districtName);
|
|
5913
5947
|
})
|
|
5914
5948
|
}), !isReadOnly && jsx(AddButton, {
|
|
5915
5949
|
show: canAddSelectedAreas,
|
|
@@ -5951,7 +5985,9 @@ var WarningListSelect = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
5951
5985
|
gridArea = _ref.gridArea,
|
|
5952
5986
|
additionalStyling = _ref.additionalStyling,
|
|
5953
5987
|
_ref$isReadOnly = _ref.isReadOnly,
|
|
5954
|
-
isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly
|
|
5988
|
+
isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
|
|
5989
|
+
_ref$displayEmpty = _ref.displayEmpty,
|
|
5990
|
+
displayEmpty = _ref$displayEmpty === void 0 ? false : _ref$displayEmpty;
|
|
5955
5991
|
var currentIndex = options.findIndex(function (option) {
|
|
5956
5992
|
return option.value === value;
|
|
5957
5993
|
});
|
|
@@ -5969,6 +6005,7 @@ var WarningListSelect = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
5969
6005
|
isEnabled: !isReadOnly,
|
|
5970
6006
|
disabled: isReadOnly,
|
|
5971
6007
|
value: value != null ? value : '',
|
|
6008
|
+
displayEmpty: displayEmpty,
|
|
5972
6009
|
SelectDisplayProps: {
|
|
5973
6010
|
'aria-label': label
|
|
5974
6011
|
},
|
|
@@ -6124,126 +6161,6 @@ var WindForceSelect = function WindForceSelect(_ref) {
|
|
|
6124
6161
|
});
|
|
6125
6162
|
};
|
|
6126
6163
|
|
|
6127
|
-
var windDirections = [{
|
|
6128
|
-
value: 'NORTH',
|
|
6129
|
-
label: function label(t) {
|
|
6130
|
-
return t('maritime-direction-n');
|
|
6131
|
-
}
|
|
6132
|
-
}, {
|
|
6133
|
-
value: 'NORTH_TO_NORTHEAST',
|
|
6134
|
-
label: function label(t) {
|
|
6135
|
-
return t('maritime-direction-nne');
|
|
6136
|
-
}
|
|
6137
|
-
}, {
|
|
6138
|
-
value: 'NORTHEAST',
|
|
6139
|
-
label: function label(t) {
|
|
6140
|
-
return t('maritime-direction-ne');
|
|
6141
|
-
}
|
|
6142
|
-
}, {
|
|
6143
|
-
value: 'NORTHEAST_TO_NORTH',
|
|
6144
|
-
label: function label(t) {
|
|
6145
|
-
return t('maritime-direction-nen');
|
|
6146
|
-
}
|
|
6147
|
-
}, {
|
|
6148
|
-
value: 'EAST',
|
|
6149
|
-
label: function label(t) {
|
|
6150
|
-
return t('maritime-direction-e');
|
|
6151
|
-
}
|
|
6152
|
-
}, {
|
|
6153
|
-
value: 'EAST_TO_SOUTHEAST',
|
|
6154
|
-
label: function label(t) {
|
|
6155
|
-
return t('maritime-direction-ese');
|
|
6156
|
-
}
|
|
6157
|
-
}, {
|
|
6158
|
-
value: 'SOUTHEAST',
|
|
6159
|
-
label: function label(t) {
|
|
6160
|
-
return t('maritime-direction-se');
|
|
6161
|
-
}
|
|
6162
|
-
}, {
|
|
6163
|
-
value: 'SOUTHEAST_TO_SOUTH',
|
|
6164
|
-
label: function label(t) {
|
|
6165
|
-
return t('maritime-direction-ses');
|
|
6166
|
-
}
|
|
6167
|
-
}, {
|
|
6168
|
-
value: 'SOUTH',
|
|
6169
|
-
label: function label(t) {
|
|
6170
|
-
return t('maritime-direction-s');
|
|
6171
|
-
}
|
|
6172
|
-
}, {
|
|
6173
|
-
value: 'SOUTH_TO_SOUTHWEST',
|
|
6174
|
-
label: function label(t) {
|
|
6175
|
-
return t('maritime-direction-ssw');
|
|
6176
|
-
}
|
|
6177
|
-
}, {
|
|
6178
|
-
value: 'SOUTHWEST',
|
|
6179
|
-
label: function label(t) {
|
|
6180
|
-
return t('maritime-direction-sw');
|
|
6181
|
-
}
|
|
6182
|
-
}, {
|
|
6183
|
-
value: 'SOUTHWEST_TO_WEST',
|
|
6184
|
-
label: function label(t) {
|
|
6185
|
-
return t('maritime-direction-sww');
|
|
6186
|
-
}
|
|
6187
|
-
}, {
|
|
6188
|
-
value: 'WEST',
|
|
6189
|
-
label: function label(t) {
|
|
6190
|
-
return t('maritime-direction-w');
|
|
6191
|
-
}
|
|
6192
|
-
}, {
|
|
6193
|
-
value: 'WEST_TO_NORTHWEST',
|
|
6194
|
-
label: function label(t) {
|
|
6195
|
-
return t('maritime-direction-wnw');
|
|
6196
|
-
}
|
|
6197
|
-
}, {
|
|
6198
|
-
value: 'NORTHWEST',
|
|
6199
|
-
label: function label(t) {
|
|
6200
|
-
return t('maritime-direction-nw');
|
|
6201
|
-
}
|
|
6202
|
-
}, {
|
|
6203
|
-
value: 'NORTHWEST_TO_NORTH',
|
|
6204
|
-
label: function label(t) {
|
|
6205
|
-
return t('maritime-direction-nwn');
|
|
6206
|
-
}
|
|
6207
|
-
}];
|
|
6208
|
-
var change = [{
|
|
6209
|
-
value: 'NO_CHANGE',
|
|
6210
|
-
label: function label(t) {
|
|
6211
|
-
return t('maritime-no-change');
|
|
6212
|
-
}
|
|
6213
|
-
}, {
|
|
6214
|
-
value: 'BACKING',
|
|
6215
|
-
label: function label(t) {
|
|
6216
|
-
return t('maritime-backing');
|
|
6217
|
-
}
|
|
6218
|
-
}, {
|
|
6219
|
-
value: 'VEERING',
|
|
6220
|
-
label: function label(t) {
|
|
6221
|
-
return t('maritime-veering');
|
|
6222
|
-
}
|
|
6223
|
-
}];
|
|
6224
|
-
var windForce = [{
|
|
6225
|
-
level: WindForceLevel.extreme,
|
|
6226
|
-
value: '12'
|
|
6227
|
-
}, {
|
|
6228
|
-
level: WindForceLevel.extreme,
|
|
6229
|
-
value: '11'
|
|
6230
|
-
}, {
|
|
6231
|
-
level: WindForceLevel.extreme,
|
|
6232
|
-
value: '10'
|
|
6233
|
-
}, {
|
|
6234
|
-
level: WindForceLevel.severe,
|
|
6235
|
-
value: '9'
|
|
6236
|
-
}, {
|
|
6237
|
-
level: WindForceLevel.severe,
|
|
6238
|
-
value: '8'
|
|
6239
|
-
}, {
|
|
6240
|
-
level: WindForceLevel.moderate,
|
|
6241
|
-
value: '7'
|
|
6242
|
-
}, {
|
|
6243
|
-
level: WindForceLevel.moderate,
|
|
6244
|
-
value: '6'
|
|
6245
|
-
}];
|
|
6246
|
-
|
|
6247
6164
|
var WarningListDragHandle = function WarningListDragHandle() {
|
|
6248
6165
|
return jsx(CustomIconButton, {
|
|
6249
6166
|
className: "handle",
|
|
@@ -6260,6 +6177,38 @@ var WarningListDragHandle = function WarningListDragHandle() {
|
|
|
6260
6177
|
});
|
|
6261
6178
|
};
|
|
6262
6179
|
|
|
6180
|
+
var getWindDirectionsFromConfig = function getWindDirectionsFromConfig(directionConfig, t) {
|
|
6181
|
+
return directionConfig.map(function (direction) {
|
|
6182
|
+
return {
|
|
6183
|
+
value: direction.value,
|
|
6184
|
+
label: t("maritime-direction-" + direction.value) || direction.label
|
|
6185
|
+
};
|
|
6186
|
+
});
|
|
6187
|
+
};
|
|
6188
|
+
var getWindForceFromConfig = function getWindForceFromConfig(forceConfig) {
|
|
6189
|
+
if (forceConfig.maritimeLevelsSummer) {
|
|
6190
|
+
return forceConfig.maritimeLevelsSummer.map(function (force) {
|
|
6191
|
+
return {
|
|
6192
|
+
value: force.windForce,
|
|
6193
|
+
level: force.level
|
|
6194
|
+
};
|
|
6195
|
+
});
|
|
6196
|
+
}
|
|
6197
|
+
return forceConfig.maritimeLevelsWinter.map(function (force) {
|
|
6198
|
+
return {
|
|
6199
|
+
value: force.windForce,
|
|
6200
|
+
level: force.level
|
|
6201
|
+
};
|
|
6202
|
+
});
|
|
6203
|
+
};
|
|
6204
|
+
var getChangeTypeFromConfig = function getChangeTypeFromConfig(changeConfig, t) {
|
|
6205
|
+
return changeConfig.map(function (change) {
|
|
6206
|
+
return {
|
|
6207
|
+
value: change.key,
|
|
6208
|
+
label: t("maritime-change-" + change.key) || change.label
|
|
6209
|
+
};
|
|
6210
|
+
});
|
|
6211
|
+
};
|
|
6263
6212
|
var WarningListItem$1 = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
6264
6213
|
var warning = _ref.warning,
|
|
6265
6214
|
areas = _ref.areas,
|
|
@@ -6272,10 +6221,11 @@ var WarningListItem$1 = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
6272
6221
|
onRemoveArea = _ref.onRemoveArea,
|
|
6273
6222
|
isReadOnly = _ref.isReadOnly,
|
|
6274
6223
|
_ref$shouldShowDistri = _ref.shouldShowDistricts,
|
|
6275
|
-
shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri
|
|
6224
|
+
shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri,
|
|
6225
|
+
maritimeConfig = _ref.maritimeConfig;
|
|
6276
6226
|
var areasById = React__default.useMemo(function () {
|
|
6277
6227
|
return new Map(areas.map(function (area) {
|
|
6278
|
-
return [area.
|
|
6228
|
+
return [area.districtName, area];
|
|
6279
6229
|
}));
|
|
6280
6230
|
}, [areas]);
|
|
6281
6231
|
var assignedAreas = React__default.useMemo(function () {
|
|
@@ -6316,19 +6266,20 @@ var WarningListItem$1 = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
6316
6266
|
onAddClick(warning.id);
|
|
6317
6267
|
}, [warning.id, onAddClick]);
|
|
6318
6268
|
var shouldDisableDirTo = warning.changeType === 'NO_CHANGE' || isReadOnly;
|
|
6269
|
+
var changeOptions = getChangeTypeFromConfig(maritimeConfig.changeType, t);
|
|
6319
6270
|
return jsxs(StyledItem, {
|
|
6320
6271
|
"data-testid": "maritime-warning",
|
|
6321
6272
|
children: [!isReadOnly && jsx(WarningListDragHandle, {}), jsx(WarningListSelect, {
|
|
6322
6273
|
gridArea: "dirFrom",
|
|
6323
6274
|
label: t('maritime-header-direction-from'),
|
|
6324
|
-
options:
|
|
6275
|
+
options: getWindDirectionsFromConfig(maritimeConfig.windDirectionDefinition, t),
|
|
6325
6276
|
onChange: handleChangeFromDirection,
|
|
6326
6277
|
value: warning.windDirectionFrom,
|
|
6327
6278
|
isReadOnly: isReadOnly
|
|
6328
6279
|
}), jsx(WindForceSelect, {
|
|
6329
6280
|
gridArea: "windForce",
|
|
6330
6281
|
value: warning.windForce,
|
|
6331
|
-
options:
|
|
6282
|
+
options: getWindForceFromConfig(maritimeConfig.maritimeLevelDefinition),
|
|
6332
6283
|
onChange: handleChangeWindForce,
|
|
6333
6284
|
isReadOnly: isReadOnly
|
|
6334
6285
|
}), jsx(AssignedAreas, {
|
|
@@ -6343,14 +6294,31 @@ var WarningListItem$1 = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
6343
6294
|
}), jsx(WarningListSelect, {
|
|
6344
6295
|
gridArea: "changeType",
|
|
6345
6296
|
label: t('maritime-header-change'),
|
|
6346
|
-
options:
|
|
6297
|
+
options: changeOptions,
|
|
6347
6298
|
onChange: handleChangeWindChangeType,
|
|
6348
6299
|
value: warning.changeType,
|
|
6349
|
-
isReadOnly: isReadOnly
|
|
6300
|
+
isReadOnly: isReadOnly,
|
|
6301
|
+
renderValue: function renderValue(value) {
|
|
6302
|
+
if (value === '') {
|
|
6303
|
+
return jsx(Typography, {
|
|
6304
|
+
variant: "caption",
|
|
6305
|
+
color: "textSecondary",
|
|
6306
|
+
sx: {
|
|
6307
|
+
alignSelf: 'center'
|
|
6308
|
+
},
|
|
6309
|
+
children: t('maritime-no-change-selected')
|
|
6310
|
+
});
|
|
6311
|
+
}
|
|
6312
|
+
var option = changeOptions.find(function (item) {
|
|
6313
|
+
return item.value === value;
|
|
6314
|
+
});
|
|
6315
|
+
return typeof (option == null ? void 0 : option.label) === 'function' ? option.label(t) : option == null ? void 0 : option.label;
|
|
6316
|
+
},
|
|
6317
|
+
displayEmpty: true
|
|
6350
6318
|
}), jsx(WarningListSelect, {
|
|
6351
6319
|
gridArea: "dirTo",
|
|
6352
6320
|
label: t('maritime-header-direction-to'),
|
|
6353
|
-
options:
|
|
6321
|
+
options: getWindDirectionsFromConfig(maritimeConfig.windDirectionDefinition, t),
|
|
6354
6322
|
onChange: handleChangeToDirection,
|
|
6355
6323
|
value: warning.windDirectionTo,
|
|
6356
6324
|
isReadOnly: shouldDisableDirTo
|
|
@@ -6408,7 +6376,8 @@ var WarningList = function WarningList(_ref) {
|
|
|
6408
6376
|
onMoveWarning = _ref.onMoveWarning,
|
|
6409
6377
|
isReadOnly = _ref.isReadOnly,
|
|
6410
6378
|
_ref$shouldShowDistri = _ref.shouldShowDistricts,
|
|
6411
|
-
shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri
|
|
6379
|
+
shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri,
|
|
6380
|
+
maritimeConfig = _ref.maritimeConfig;
|
|
6412
6381
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
6413
6382
|
t = _useWarningsTranslati.t;
|
|
6414
6383
|
var onSort = React__default.useCallback(function (event) {
|
|
@@ -6421,7 +6390,7 @@ var WarningList = function WarningList(_ref) {
|
|
|
6421
6390
|
flexDirection: 'column',
|
|
6422
6391
|
minHeight: 0,
|
|
6423
6392
|
marginBottom: 1,
|
|
6424
|
-
'--grid-columns': '30px 150px 60px 2fr
|
|
6393
|
+
'--grid-columns': '30px 150px 60px 2fr 150px 150px 1fr'
|
|
6425
6394
|
},
|
|
6426
6395
|
children: [jsxs(Box, {
|
|
6427
6396
|
sx: (_sx = {
|
|
@@ -6469,7 +6438,8 @@ var WarningList = function WarningList(_ref) {
|
|
|
6469
6438
|
onRemove: onRemoveWarning,
|
|
6470
6439
|
onChange: onChangeWarning,
|
|
6471
6440
|
onRemoveArea: onRemoveArea,
|
|
6472
|
-
shouldShowDistricts: shouldShowDistricts
|
|
6441
|
+
shouldShowDistricts: shouldShowDistricts,
|
|
6442
|
+
maritimeConfig: maritimeConfig
|
|
6473
6443
|
}, warning.id);
|
|
6474
6444
|
})
|
|
6475
6445
|
})]
|
|
@@ -6667,6 +6637,12 @@ function reducer(state, action) {
|
|
|
6667
6637
|
selectedAreaIds: []
|
|
6668
6638
|
});
|
|
6669
6639
|
}
|
|
6640
|
+
case 'submitWarnings':
|
|
6641
|
+
{
|
|
6642
|
+
return Object.assign({}, state, {
|
|
6643
|
+
modified: false
|
|
6644
|
+
});
|
|
6645
|
+
}
|
|
6670
6646
|
default:
|
|
6671
6647
|
{
|
|
6672
6648
|
return state;
|
|
@@ -6680,36 +6656,46 @@ function useMaritimeWarningsFormState() {
|
|
|
6680
6656
|
function useConfirmRetractDialog(_ref) {
|
|
6681
6657
|
var areas = _ref.areas,
|
|
6682
6658
|
warnings = _ref.warnings,
|
|
6659
|
+
maritimeConfig = _ref.maritimeConfig,
|
|
6683
6660
|
onRemoveWarning = _ref.onRemoveWarning;
|
|
6684
6661
|
var confirmDialog = useConfirmationDialog();
|
|
6685
6662
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
6686
6663
|
t = _useWarningsTranslati.t;
|
|
6687
|
-
var
|
|
6688
|
-
var option =
|
|
6689
|
-
return
|
|
6664
|
+
var getLabelFromWindDirectionConfig = React__default.useCallback(function (directionConfig, value) {
|
|
6665
|
+
var option = directionConfig.find(function (direction) {
|
|
6666
|
+
return direction.value === value;
|
|
6667
|
+
});
|
|
6668
|
+
if (!option) {
|
|
6669
|
+
return '';
|
|
6670
|
+
}
|
|
6671
|
+
return t("maritime-direction-" + option.value);
|
|
6672
|
+
}, [t]);
|
|
6673
|
+
var getLabelFromChangeConfig = React__default.useCallback(function (changeConfig, value) {
|
|
6674
|
+
var option = changeConfig.find(function (change) {
|
|
6675
|
+
return change.key === value;
|
|
6690
6676
|
});
|
|
6691
6677
|
if (!option) {
|
|
6692
6678
|
return '';
|
|
6693
6679
|
}
|
|
6694
|
-
return
|
|
6680
|
+
return t("maritime-change-" + option.key);
|
|
6695
6681
|
}, [t]);
|
|
6696
6682
|
var getWarningDescription = React__default.useCallback(function (warning) {
|
|
6697
6683
|
if (!isPublishedWarning(warning)) {
|
|
6698
6684
|
return t('maritime-retract-dialog-empty-warning-description');
|
|
6699
6685
|
}
|
|
6700
|
-
var windDirectionFromLabel =
|
|
6686
|
+
var windDirectionFromLabel = getLabelFromWindDirectionConfig(maritimeConfig.windDirectionDefinition, warning.windDirectionFrom);
|
|
6701
6687
|
var areasById = new Map(areas.map(function (area) {
|
|
6702
|
-
return [area.
|
|
6688
|
+
return [area.districtName, area];
|
|
6703
6689
|
}));
|
|
6704
6690
|
var areaLabels = warning.assignedAreaIds.map(function (areaId) {
|
|
6705
|
-
return areasById.get(areaId).
|
|
6691
|
+
return areasById.get(areaId).districtName;
|
|
6706
6692
|
});
|
|
6707
|
-
var changeToLabel = warning.changeType === 'NO_CHANGE' ? t('maritime-retract-dialog-no-change') :
|
|
6693
|
+
var changeToLabel = warning.changeType === 'NO_CHANGE' ? t('maritime-retract-dialog-no-change') : getLabelFromChangeConfig(maritimeConfig.changeType, warning.changeType) + " " + getLabelFromWindDirectionConfig(maritimeConfig.windDirectionDefinition, warning.windDirectionTo);
|
|
6708
6694
|
var warningDescription = [windDirectionFromLabel + " " + t('maritime-windforce', {
|
|
6709
6695
|
value: warning.windForce
|
|
6710
6696
|
})].concat(areaLabels, [changeToLabel]).join(', ');
|
|
6711
6697
|
return warningDescription + ". " + t('maritime-retract-dialog-description-suffix');
|
|
6712
|
-
}, [areas, t,
|
|
6698
|
+
}, [getLabelFromWindDirectionConfig, maritimeConfig.windDirectionDefinition, maritimeConfig.changeType, areas, t, getLabelFromChangeConfig]);
|
|
6713
6699
|
return {
|
|
6714
6700
|
onRemoveWarningWithConfirmation: React__default.useCallback(/*#__PURE__*/function () {
|
|
6715
6701
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(id) {
|
|
@@ -6798,19 +6784,13 @@ var isWarningsValid = function isWarningsValid(warnings) {
|
|
|
6798
6784
|
return !isWarningEmpty(warning) && isWarningValid(warning);
|
|
6799
6785
|
});
|
|
6800
6786
|
};
|
|
6801
|
-
|
|
6802
|
-
var
|
|
6803
|
-
var
|
|
6804
|
-
|
|
6805
|
-
return
|
|
6806
|
-
}
|
|
6807
|
-
|
|
6808
|
-
return 'moderate';
|
|
6809
|
-
}
|
|
6810
|
-
if (force < 10) {
|
|
6811
|
-
return 'severe';
|
|
6812
|
-
}
|
|
6813
|
-
return 'extreme';
|
|
6787
|
+
var getLevelFromWindForce = function getLevelFromWindForce(maritimeConfig, windForce) {
|
|
6788
|
+
var _maritimeConfig$marit;
|
|
6789
|
+
var period = maritimeConfig.maritimeLevelDefinition.maritimeLevelsSummer ? 'maritimeLevelsSummer' : 'maritimeLevelsWinter';
|
|
6790
|
+
var levelInfo = (_maritimeConfig$marit = maritimeConfig.maritimeLevelDefinition) == null ? void 0 : _maritimeConfig$marit[period].find(function (level) {
|
|
6791
|
+
return (level == null ? void 0 : level.windForce) === windForce;
|
|
6792
|
+
});
|
|
6793
|
+
return (levelInfo == null ? void 0 : levelInfo.level) || 'extreme';
|
|
6814
6794
|
};
|
|
6815
6795
|
var getType = function getType(domain) {
|
|
6816
6796
|
switch (domain) {
|
|
@@ -6821,8 +6801,20 @@ var getType = function getType(domain) {
|
|
|
6821
6801
|
return 'maritimeWarningNorthSea';
|
|
6822
6802
|
}
|
|
6823
6803
|
};
|
|
6824
|
-
var mapItemsToMaritimeWarnings = function mapItemsToMaritimeWarnings(warnings, domain, editor) {
|
|
6804
|
+
var mapItemsToMaritimeWarnings = function mapItemsToMaritimeWarnings(warnings, domain, maritimeConfig, editor) {
|
|
6825
6805
|
var type = getType(domain);
|
|
6806
|
+
if (warnings.length === 1 && warnings[0].assignedAreaIds.length === 0) {
|
|
6807
|
+
// 1 warning without any areas means cancel/withdraw all warnings
|
|
6808
|
+
return [{
|
|
6809
|
+
type: type,
|
|
6810
|
+
editor: editor,
|
|
6811
|
+
status: PublicWarningStatus.PUBLISHED,
|
|
6812
|
+
warningDetail: {
|
|
6813
|
+
areas: [],
|
|
6814
|
+
domain: type
|
|
6815
|
+
}
|
|
6816
|
+
}];
|
|
6817
|
+
}
|
|
6826
6818
|
return warnings.map(function (warning) {
|
|
6827
6819
|
return {
|
|
6828
6820
|
type: type,
|
|
@@ -6832,12 +6824,15 @@ var mapItemsToMaritimeWarnings = function mapItemsToMaritimeWarnings(warnings, d
|
|
|
6832
6824
|
phenomenon: 'wind',
|
|
6833
6825
|
validFrom: new Date().toISOString(),
|
|
6834
6826
|
validUntil: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString(),
|
|
6835
|
-
level: getLevelFromWindForce(warning.windForce || ''),
|
|
6827
|
+
level: getLevelFromWindForce(maritimeConfig, warning.windForce || ''),
|
|
6836
6828
|
probability: 100,
|
|
6837
6829
|
areas: warning.assignedAreaIds.map(function (areaId) {
|
|
6830
|
+
var areaDetails = maritimeConfig.districtList[domain].find(function (district) {
|
|
6831
|
+
return district.districtName === areaId;
|
|
6832
|
+
});
|
|
6838
6833
|
return {
|
|
6839
6834
|
objectName: areaId,
|
|
6840
|
-
geoJSON: {
|
|
6835
|
+
geoJSON: (areaDetails == null ? void 0 : areaDetails.geoJSON) || {
|
|
6841
6836
|
type: 'FeatureCollection',
|
|
6842
6837
|
features: []
|
|
6843
6838
|
}
|
|
@@ -6845,7 +6840,7 @@ var mapItemsToMaritimeWarnings = function mapItemsToMaritimeWarnings(warnings, d
|
|
|
6845
6840
|
}),
|
|
6846
6841
|
windDirectionFrom: warning.windDirectionFrom,
|
|
6847
6842
|
windForce: warning.windForce,
|
|
6848
|
-
changeType: warning.changeType,
|
|
6843
|
+
changeType: warning.changeType || 'NO_CHANGE',
|
|
6849
6844
|
windDirectionTo: warning.windDirectionTo,
|
|
6850
6845
|
descriptionOriginal: '',
|
|
6851
6846
|
descriptionTranslation: '',
|
|
@@ -6865,7 +6860,9 @@ var mapMaritimeWarningsToItems = function mapMaritimeWarningsToItems(warnings) {
|
|
|
6865
6860
|
windDirectionFrom: warning.warningDetail.windDirectionFrom,
|
|
6866
6861
|
windDirectionTo: warning.warningDetail.windDirectionTo,
|
|
6867
6862
|
windForce: warning.warningDetail.windForce,
|
|
6868
|
-
changeType: warning.warningDetail.changeType
|
|
6863
|
+
changeType: warning.warningDetail.changeType,
|
|
6864
|
+
validFrom: warning.warningDetail.validFrom,
|
|
6865
|
+
validUntil: warning.warningDetail.validUntil
|
|
6869
6866
|
};
|
|
6870
6867
|
});
|
|
6871
6868
|
};
|
|
@@ -6886,6 +6883,19 @@ var MaritimeWarningAvatar = function MaritimeWarningAvatar(_ref) {
|
|
|
6886
6883
|
});
|
|
6887
6884
|
};
|
|
6888
6885
|
|
|
6886
|
+
var spinnerSx$1 = {
|
|
6887
|
+
width: '16px!important',
|
|
6888
|
+
height: '16px!important',
|
|
6889
|
+
position: 'absolute',
|
|
6890
|
+
top: 0,
|
|
6891
|
+
bottom: 0,
|
|
6892
|
+
margin: 'auto',
|
|
6893
|
+
marginLeft: 1
|
|
6894
|
+
};
|
|
6895
|
+
var getWarningsValidity = function getWarningsValidity(t, warnings) {
|
|
6896
|
+
var validUntil = warnings.length > 0 && warnings[0].validUntil ? dateUtils.dateToString(dateUtils.createDate(warnings[0].validUntil), dateUtils.DATE_FORMAT_NAME_OF_DAY_MONTH) : '';
|
|
6897
|
+
return validUntil ? "" + t('maritime-warning-validuntil') + validUntil : '';
|
|
6898
|
+
};
|
|
6889
6899
|
var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
6890
6900
|
var _sx, _sx2, _sx3, _sx4;
|
|
6891
6901
|
var areas = _ref.areas,
|
|
@@ -6904,9 +6914,17 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
|
6904
6914
|
onMoveWarning = _ref.onMoveWarning,
|
|
6905
6915
|
onToggleReadOnly = _ref.onToggleReadOnly,
|
|
6906
6916
|
isReadOnly = _ref.isReadOnly,
|
|
6917
|
+
shouldHideEditorToggle = _ref.shouldHideEditorToggle,
|
|
6907
6918
|
_ref$shouldShowDistri = _ref.shouldShowDistricts,
|
|
6908
6919
|
shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri,
|
|
6909
|
-
editor = _ref.editor
|
|
6920
|
+
editor = _ref.editor,
|
|
6921
|
+
error = _ref.error,
|
|
6922
|
+
maritimeConfig = _ref.maritimeConfig,
|
|
6923
|
+
_ref$lastUpdatedTime = _ref.lastUpdatedTime,
|
|
6924
|
+
lastUpdatedTime = _ref$lastUpdatedTime === void 0 ? '' : _ref$lastUpdatedTime;
|
|
6925
|
+
var _React$useState = React__default.useState(false),
|
|
6926
|
+
isPublishing = _React$useState[0],
|
|
6927
|
+
setIsPublishing = _React$useState[1];
|
|
6910
6928
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
6911
6929
|
t = _useWarningsTranslati.t;
|
|
6912
6930
|
var showConfirmDialog = useConfirmationDialog();
|
|
@@ -6916,6 +6934,7 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
|
6916
6934
|
var _useConfirmRetractDia = useConfirmRetractDialog({
|
|
6917
6935
|
areas: areas,
|
|
6918
6936
|
warnings: warnings,
|
|
6937
|
+
maritimeConfig: maritimeConfig,
|
|
6919
6938
|
onRemoveWarning: onRemoveWarning
|
|
6920
6939
|
}),
|
|
6921
6940
|
onRemoveWarningWithConfirmation = _useConfirmRetractDia.onRemoveWarningWithConfirmation;
|
|
@@ -6970,6 +6989,40 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
|
6970
6989
|
return _ref3.apply(this, arguments);
|
|
6971
6990
|
};
|
|
6972
6991
|
}();
|
|
6992
|
+
var validTimes = getWarningsValidity(t, warnings);
|
|
6993
|
+
var onPressPublish = /*#__PURE__*/function () {
|
|
6994
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
6995
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
6996
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
6997
|
+
case 0:
|
|
6998
|
+
if (isPublishing) {
|
|
6999
|
+
_context3.next = 12;
|
|
7000
|
+
break;
|
|
7001
|
+
}
|
|
7002
|
+
setIsPublishing(true);
|
|
7003
|
+
_context3.prev = 2;
|
|
7004
|
+
_context3.next = 5;
|
|
7005
|
+
return onSubmit();
|
|
7006
|
+
case 5:
|
|
7007
|
+
_context3.next = 9;
|
|
7008
|
+
break;
|
|
7009
|
+
case 7:
|
|
7010
|
+
_context3.prev = 7;
|
|
7011
|
+
_context3.t0 = _context3["catch"](2);
|
|
7012
|
+
case 9:
|
|
7013
|
+
_context3.prev = 9;
|
|
7014
|
+
setIsPublishing(false);
|
|
7015
|
+
return _context3.finish(9);
|
|
7016
|
+
case 12:
|
|
7017
|
+
case "end":
|
|
7018
|
+
return _context3.stop();
|
|
7019
|
+
}
|
|
7020
|
+
}, _callee3, null, [[2, 7, 9, 12]]);
|
|
7021
|
+
}));
|
|
7022
|
+
return function onPressPublish() {
|
|
7023
|
+
return _ref4.apply(this, arguments);
|
|
7024
|
+
};
|
|
7025
|
+
}();
|
|
6973
7026
|
return jsxs(Box, {
|
|
6974
7027
|
sx: (_sx = {
|
|
6975
7028
|
display: 'flex',
|
|
@@ -6986,26 +7039,61 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
|
6986
7039
|
}, _sx["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
6987
7040
|
padding: 3
|
|
6988
7041
|
}, _sx),
|
|
6989
|
-
children: [
|
|
7042
|
+
children: [error && jsx(AlertBanner, {
|
|
7043
|
+
title: error.title,
|
|
7044
|
+
severity: error.severity,
|
|
7045
|
+
shouldClose: true
|
|
7046
|
+
}), jsxs(Box, {
|
|
6990
7047
|
sx: (_sx2 = {
|
|
6991
7048
|
display: 'flex',
|
|
7049
|
+
flexWrap: 'wrap',
|
|
6992
7050
|
gap: 1,
|
|
6993
|
-
alignItems: 'center'
|
|
7051
|
+
alignItems: 'center',
|
|
7052
|
+
width: '100%'
|
|
6994
7053
|
}, _sx2["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
6995
|
-
justifyContent: '
|
|
7054
|
+
justifyContent: 'space-between'
|
|
6996
7055
|
}, _sx2),
|
|
6997
|
-
children: [jsx(
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7001
|
-
|
|
7056
|
+
children: [jsx(Typography, {
|
|
7057
|
+
sx: {
|
|
7058
|
+
color: 'geowebColors.captions.captionStatus.rgba',
|
|
7059
|
+
fontSize: '10px',
|
|
7060
|
+
lineHeight: '1.6',
|
|
7061
|
+
letterSpacing: '0.33px',
|
|
7062
|
+
minWidth: '300px'
|
|
7063
|
+
},
|
|
7064
|
+
children: validTimes
|
|
7002
7065
|
}), jsx(Box, {
|
|
7003
7066
|
sx: {
|
|
7004
|
-
|
|
7005
|
-
|
|
7067
|
+
display: 'flex',
|
|
7068
|
+
flexWrap: 'wrap',
|
|
7069
|
+
gap: 1,
|
|
7070
|
+
alignItems: 'center',
|
|
7071
|
+
height: '38px'
|
|
7006
7072
|
},
|
|
7007
|
-
children:
|
|
7008
|
-
|
|
7073
|
+
children: !shouldHideEditorToggle && jsxs(Fragment, {
|
|
7074
|
+
children: [jsx(SwitchButton, {
|
|
7075
|
+
inActiveLabel: t('warning-editor-user-viewer'),
|
|
7076
|
+
activeLabel: t('warning-editor-user-editor'),
|
|
7077
|
+
checked: !isReadOnly,
|
|
7078
|
+
onChange: onSwitchMode
|
|
7079
|
+
}), jsx(Box, {
|
|
7080
|
+
sx: {
|
|
7081
|
+
width: '16px',
|
|
7082
|
+
marginLeft: 1
|
|
7083
|
+
},
|
|
7084
|
+
children: editor && jsx(MaritimeWarningAvatar, {
|
|
7085
|
+
editor: editor
|
|
7086
|
+
})
|
|
7087
|
+
}), lastUpdatedTime && jsx(Box, {
|
|
7088
|
+
sx: {
|
|
7089
|
+
"float": 'left',
|
|
7090
|
+
paddingTop: 0.5
|
|
7091
|
+
},
|
|
7092
|
+
children: jsx(LastUpdateTime, {
|
|
7093
|
+
lastUpdateTime: lastUpdatedTime,
|
|
7094
|
+
showRefreshButton: false
|
|
7095
|
+
})
|
|
7096
|
+
})]
|
|
7009
7097
|
})
|
|
7010
7098
|
})]
|
|
7011
7099
|
}), jsx(AreaList, {
|
|
@@ -7027,7 +7115,8 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
|
7027
7115
|
onRemoveArea: onRemoveArea,
|
|
7028
7116
|
onMoveWarning: onMoveWarning,
|
|
7029
7117
|
shouldShowDistricts: shouldShowDistricts,
|
|
7030
|
-
isReadOnly: isReadOnly
|
|
7118
|
+
isReadOnly: isReadOnly,
|
|
7119
|
+
maritimeConfig: maritimeConfig
|
|
7031
7120
|
}), !isReadOnly && jsxs(Button, {
|
|
7032
7121
|
onClick: onAddWarning,
|
|
7033
7122
|
variant: "tertiary",
|
|
@@ -7067,90 +7156,79 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
|
7067
7156
|
}, _sx4["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
7068
7157
|
marginLeft: '24px!important'
|
|
7069
7158
|
}, _sx4),
|
|
7070
|
-
disabled: !modified || !isValid,
|
|
7071
|
-
onClick:
|
|
7072
|
-
children:
|
|
7159
|
+
disabled: !modified || !isValid || isPublishing,
|
|
7160
|
+
onClick: onPressPublish,
|
|
7161
|
+
children: jsxs("span", {
|
|
7162
|
+
style: {
|
|
7163
|
+
position: 'relative'
|
|
7164
|
+
},
|
|
7165
|
+
children: [isPublishing ? t('warning-button-publishing') : t('warning-button-publish'), isPublishing && jsx(CircularProgress, {
|
|
7166
|
+
"data-testid": "spinner",
|
|
7167
|
+
color: "inherit",
|
|
7168
|
+
sx: spinnerSx$1
|
|
7169
|
+
})]
|
|
7170
|
+
})
|
|
7073
7171
|
})]
|
|
7074
7172
|
})]
|
|
7075
7173
|
});
|
|
7076
7174
|
};
|
|
7077
7175
|
|
|
7078
|
-
var areasByDomain = {
|
|
7079
|
-
northSeaDistricts: [{
|
|
7080
|
-
id: 'DOVER',
|
|
7081
|
-
label: 'Dover'
|
|
7082
|
-
}, {
|
|
7083
|
-
id: 'THAMES',
|
|
7084
|
-
label: 'Thames'
|
|
7085
|
-
}, {
|
|
7086
|
-
id: 'HUMBER',
|
|
7087
|
-
label: 'Humber'
|
|
7088
|
-
}, {
|
|
7089
|
-
id: 'DOGGER',
|
|
7090
|
-
label: 'Dogger'
|
|
7091
|
-
}, {
|
|
7092
|
-
id: 'GERMAN_BIGHT',
|
|
7093
|
-
label: 'German Bight'
|
|
7094
|
-
}],
|
|
7095
|
-
coastalWaters: [{
|
|
7096
|
-
id: 'VLISSINGEN',
|
|
7097
|
-
label: 'Vlissingen'
|
|
7098
|
-
}, {
|
|
7099
|
-
id: 'ZIERIKZEE',
|
|
7100
|
-
label: 'Zierikzee'
|
|
7101
|
-
}, {
|
|
7102
|
-
id: 'HOEK_VAN_HOLLAND',
|
|
7103
|
-
label: 'Hoek van Holland'
|
|
7104
|
-
}, {
|
|
7105
|
-
id: 'IJMUIDEN',
|
|
7106
|
-
label: 'IJmuiden'
|
|
7107
|
-
}, {
|
|
7108
|
-
id: 'TEXEL',
|
|
7109
|
-
label: 'Texel'
|
|
7110
|
-
}, {
|
|
7111
|
-
id: 'HARLINGEN',
|
|
7112
|
-
label: 'Harlingen'
|
|
7113
|
-
}, {
|
|
7114
|
-
id: 'ROTTUM',
|
|
7115
|
-
label: 'Rottum'
|
|
7116
|
-
}, {
|
|
7117
|
-
id: 'DELFZIJL',
|
|
7118
|
-
label: 'Delfzijl'
|
|
7119
|
-
}, {
|
|
7120
|
-
id: 'IJSSELMEER',
|
|
7121
|
-
label: 'IJsselmeer'
|
|
7122
|
-
}, {
|
|
7123
|
-
id: 'MARKERMEER',
|
|
7124
|
-
label: 'Markermeer'
|
|
7125
|
-
}]
|
|
7126
|
-
};
|
|
7127
|
-
|
|
7128
7176
|
var MaritimeWarningsFormConnect = function MaritimeWarningsFormConnect(_ref) {
|
|
7129
7177
|
var domain = _ref.domain,
|
|
7130
7178
|
onPreventCloseView = _ref.onPreventCloseView,
|
|
7131
7179
|
onModifyForm = _ref.onModifyForm;
|
|
7132
|
-
var areas = areasByDomain[domain];
|
|
7133
|
-
var shouldShowDistricts = domain === 'northSeaDistricts';
|
|
7134
7180
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
7135
7181
|
t = _useWarningsTranslati.t;
|
|
7136
7182
|
var _useAuthenticationCon = useAuthenticationContext$1(),
|
|
7137
|
-
auth = _useAuthenticationCon.auth
|
|
7183
|
+
auth = _useAuthenticationCon.auth,
|
|
7184
|
+
isLoggedIn = _useAuthenticationCon.isLoggedIn;
|
|
7185
|
+
var confirmDialog = useConfirmationDialog();
|
|
7186
|
+
var _useState = useState(),
|
|
7187
|
+
error = _useState[0],
|
|
7188
|
+
setError = _useState[1];
|
|
7189
|
+
var domainLabel = React__default.useMemo(function () {
|
|
7190
|
+
return domain === 'coastalWaters' ? t('maritime-domain-coastal') : t('maritime-domain-northsea');
|
|
7191
|
+
}, [domain, t]);
|
|
7192
|
+
var _useMaritimeWarningsC = useMaritimeWarningsConfig(),
|
|
7193
|
+
maritimeConfig = _useMaritimeWarningsC.data,
|
|
7194
|
+
isFetchingConfig = _useMaritimeWarningsC.isFetching,
|
|
7195
|
+
configError = _useMaritimeWarningsC.error,
|
|
7196
|
+
refetchConfig = _useMaritimeWarningsC.refetch;
|
|
7197
|
+
var _usePublicWarnings = usePublicWarnings(),
|
|
7198
|
+
data = _usePublicWarnings.data,
|
|
7199
|
+
isFetchingWarnings = _usePublicWarnings.isFetching,
|
|
7200
|
+
refetchWarnings = _usePublicWarnings.refetch,
|
|
7201
|
+
dataUpdatedAt = _usePublicWarnings.dataUpdatedAt;
|
|
7202
|
+
var _usePostMaritimeWarni = usePostMaritimeWarnings(),
|
|
7203
|
+
postWarnings = _usePostMaritimeWarni.mutateAsync,
|
|
7204
|
+
publishError = _usePostMaritimeWarni.error;
|
|
7205
|
+
var _useMutateMaritimeWar = useMutateMaritimeWarningsEditor(),
|
|
7206
|
+
mutateEditor = _useMutateMaritimeWar.mutate,
|
|
7207
|
+
editorError = _useMutateMaritimeWar.error;
|
|
7208
|
+
var _useState2 = useState(isFetchingWarnings),
|
|
7209
|
+
hasFetched = _useState2[0],
|
|
7210
|
+
setHasFetched = _useState2[1];
|
|
7211
|
+
React__default.useEffect(function () {
|
|
7212
|
+
if (isFetchingWarnings) {
|
|
7213
|
+
setHasFetched(true);
|
|
7214
|
+
}
|
|
7215
|
+
}, [isFetchingWarnings]);
|
|
7216
|
+
var lastUpdateTime = dateUtils.dateToString(new Date(dataUpdatedAt), dateUtils.DATE_FORMAT_HOURS);
|
|
7217
|
+
var areas = maritimeConfig == null ? void 0 : maritimeConfig.districtList[domain];
|
|
7218
|
+
var shouldShowDistricts = domain === 'northSeaDistricts';
|
|
7138
7219
|
var maritimeWarningsType = getType(domain);
|
|
7139
|
-
// TODO this should be retrieved (and updated) from the api using a react-query
|
|
7140
|
-
var _React$useState = React__default.useState(auth == null ? void 0 : auth.username),
|
|
7141
|
-
editor = _React$useState[0],
|
|
7142
|
-
setEditor = _React$useState[1];
|
|
7143
|
-
var isReadOnly = editor !== undefined && editor !== (auth == null ? void 0 : auth.username);
|
|
7144
7220
|
var _useMaritimeWarningsF = useMaritimeWarningsFormState(),
|
|
7145
7221
|
state = _useMaritimeWarningsF[0],
|
|
7146
7222
|
dispatch = _useMaritimeWarningsF[1];
|
|
7147
|
-
var _usePublicWarnings = usePublicWarnings(),
|
|
7148
|
-
data = _usePublicWarnings.data;
|
|
7149
7223
|
var warningsFromApi = React__default.useMemo(function () {
|
|
7150
|
-
return (data == null ? void 0 : data.filter(function (warning) {
|
|
7151
|
-
return warning.
|
|
7152
|
-
})) || [];
|
|
7224
|
+
return ((data == null ? void 0 : data.filter(function (warning) {
|
|
7225
|
+
return warning.type === maritimeWarningsType && warning.status === 'PUBLISHED';
|
|
7226
|
+
})) || []).reverse();
|
|
7153
7227
|
}, [data, maritimeWarningsType]);
|
|
7228
|
+
var isNew = warningsFromApi.length === 0;
|
|
7229
|
+
var editor = warningsFromApi && warningsFromApi.length > 0 ? warningsFromApi[0].editor : undefined;
|
|
7230
|
+
var previousEditor = usePrevious(editor);
|
|
7231
|
+
var isReadOnly = !isNew && editor !== (auth == null ? void 0 : auth.username);
|
|
7154
7232
|
var warningItemsFromApi = React__default.useMemo(function () {
|
|
7155
7233
|
return mapMaritimeWarningsToItems(warningsFromApi || []);
|
|
7156
7234
|
}, [warningsFromApi]);
|
|
@@ -7203,11 +7281,7 @@ var MaritimeWarningsFormConnect = function MaritimeWarningsFormConnect(_ref) {
|
|
|
7203
7281
|
id: id
|
|
7204
7282
|
});
|
|
7205
7283
|
});
|
|
7206
|
-
|
|
7207
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
7208
|
-
key: 'maritime-retract-success'
|
|
7209
|
-
});
|
|
7210
|
-
}, [dispatch, showSnackbar]);
|
|
7284
|
+
}, [dispatch]);
|
|
7211
7285
|
var onAddWarning = React__default.useCallback(function () {
|
|
7212
7286
|
React__default.startTransition(function () {
|
|
7213
7287
|
dispatch({
|
|
@@ -7238,11 +7312,7 @@ var MaritimeWarningsFormConnect = function MaritimeWarningsFormConnect(_ref) {
|
|
|
7238
7312
|
type: 'clearWarnings'
|
|
7239
7313
|
});
|
|
7240
7314
|
});
|
|
7241
|
-
|
|
7242
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
7243
|
-
key: 'maritime-clear-success'
|
|
7244
|
-
});
|
|
7245
|
-
}, [dispatch, showSnackbar]);
|
|
7315
|
+
}, [dispatch]);
|
|
7246
7316
|
var onMoveWarning = React__default.useCallback(function (oldIndex, newIndex) {
|
|
7247
7317
|
dispatch({
|
|
7248
7318
|
type: 'moveWarning',
|
|
@@ -7250,57 +7320,174 @@ var MaritimeWarningsFormConnect = function MaritimeWarningsFormConnect(_ref) {
|
|
|
7250
7320
|
newIndex: newIndex
|
|
7251
7321
|
});
|
|
7252
7322
|
}, [dispatch]);
|
|
7253
|
-
var
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7323
|
+
var onSubmit = React__default.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
7324
|
+
var nextState, maritimeWarnings;
|
|
7325
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7326
|
+
while (1) switch (_context.prev = _context.next) {
|
|
7327
|
+
case 0:
|
|
7328
|
+
dispatch({
|
|
7329
|
+
type: 'mergeWarnings'
|
|
7330
|
+
});
|
|
7331
|
+
nextState = reducer(state, {
|
|
7332
|
+
type: 'mergeWarnings'
|
|
7333
|
+
});
|
|
7334
|
+
maritimeWarnings = mapItemsToMaritimeWarnings(nextState.warnings, domain, maritimeConfig, auth == null ? void 0 : auth.username);
|
|
7335
|
+
_context.next = 5;
|
|
7336
|
+
return postWarnings(maritimeWarnings, {
|
|
7337
|
+
onSuccess: function onSuccess() {
|
|
7338
|
+
dispatch({
|
|
7339
|
+
type: 'submitWarnings'
|
|
7340
|
+
});
|
|
7341
|
+
},
|
|
7342
|
+
onError: function onError(error) {
|
|
7343
|
+
// the BE_EDITOR_WARNING is handled in shouldGiveEditorWarning
|
|
7344
|
+
if (error.message !== BE_EDITOR_WARNING) {
|
|
7345
|
+
setError({
|
|
7346
|
+
title: error.message,
|
|
7347
|
+
severity: 'error'
|
|
7348
|
+
});
|
|
7349
|
+
}
|
|
7350
|
+
}
|
|
7351
|
+
});
|
|
7352
|
+
case 5:
|
|
7353
|
+
case "end":
|
|
7354
|
+
return _context.stop();
|
|
7355
|
+
}
|
|
7356
|
+
}, _callee);
|
|
7357
|
+
})), [dispatch, state, domain, maritimeConfig, auth == null ? void 0 : auth.username, postWarnings]);
|
|
7267
7358
|
var onToggleReadOnly = React__default.useCallback(function (isReadOnly) {
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7359
|
+
var message = isReadOnly ? t('maritime-editor-off', {
|
|
7360
|
+
domain: domainLabel
|
|
7361
|
+
}) : t('maritime-editor-on', {
|
|
7362
|
+
domain: domainLabel
|
|
7363
|
+
});
|
|
7364
|
+
var updateEditor = function updateEditor(force) {
|
|
7365
|
+
return mutateEditor({
|
|
7366
|
+
domain: getType(domain),
|
|
7367
|
+
isEditor: !isReadOnly,
|
|
7368
|
+
force: force
|
|
7369
|
+
}, {
|
|
7370
|
+
onError: function onError(e) {
|
|
7371
|
+
if (e.cause === 409) {
|
|
7372
|
+
void refetchWarnings();
|
|
7373
|
+
void confirmDialog({
|
|
7374
|
+
title: t('warning-edit-mode-title'),
|
|
7375
|
+
description: t('warning-edit-mode-description'),
|
|
7376
|
+
confirmLabel: t('warning-edit-mode-confirm'),
|
|
7377
|
+
cancelLabel: t('warning-dialog-cancel')
|
|
7378
|
+
}).then(function () {
|
|
7379
|
+
return void updateEditor(true);
|
|
7380
|
+
}); // force update editor
|
|
7381
|
+
} else {
|
|
7382
|
+
void refetchWarnings();
|
|
7383
|
+
}
|
|
7384
|
+
},
|
|
7385
|
+
onSuccess: function () {
|
|
7386
|
+
var _onSuccess = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
7387
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
7388
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
7389
|
+
case 0:
|
|
7390
|
+
void refetchWarnings();
|
|
7391
|
+
showSnackbar({
|
|
7392
|
+
type: snackbarTypes.SnackbarMessageType.VERBATIM_MESSAGE,
|
|
7393
|
+
message: message
|
|
7394
|
+
});
|
|
7395
|
+
case 2:
|
|
7396
|
+
case "end":
|
|
7397
|
+
return _context2.stop();
|
|
7398
|
+
}
|
|
7399
|
+
}, _callee2);
|
|
7400
|
+
}));
|
|
7401
|
+
function onSuccess() {
|
|
7402
|
+
return _onSuccess.apply(this, arguments);
|
|
7403
|
+
}
|
|
7404
|
+
return onSuccess;
|
|
7405
|
+
}()
|
|
7406
|
+
});
|
|
7407
|
+
};
|
|
7408
|
+
void updateEditor(false);
|
|
7409
|
+
}, [t, domainLabel, mutateEditor, domain, refetchWarnings, confirmDialog, showSnackbar]);
|
|
7410
|
+
useEffect(function () {
|
|
7411
|
+
if (editorError && editorError.cause !== 409) {
|
|
7412
|
+
setError({
|
|
7413
|
+
title: editorError.message,
|
|
7414
|
+
severity: 'error'
|
|
7415
|
+
});
|
|
7271
7416
|
} else {
|
|
7272
|
-
|
|
7417
|
+
setError(undefined);
|
|
7273
7418
|
}
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7419
|
+
}, [editorError]);
|
|
7420
|
+
var shouldGiveEditorWarning = React__default.useCallback(function (newEditor, oldEditor) {
|
|
7421
|
+
var oldEditorIsYou = oldEditor && oldEditor === (auth == null ? void 0 : auth.username);
|
|
7422
|
+
if (oldEditorIsYou && (newEditor || publishError) && newEditor !== oldEditor) {
|
|
7423
|
+
setError({
|
|
7424
|
+
title: t('maritime-editor-off', {
|
|
7425
|
+
domain: domainLabel
|
|
7426
|
+
}),
|
|
7427
|
+
severity: 'warning'
|
|
7428
|
+
});
|
|
7429
|
+
}
|
|
7430
|
+
}, [auth == null ? void 0 : auth.username, domainLabel, publishError, t]);
|
|
7431
|
+
useEffect(function () {
|
|
7432
|
+
// Only give editor warning when the change in editor is from a refetch
|
|
7433
|
+
if (hasFetched) {
|
|
7434
|
+
setHasFetched(false);
|
|
7435
|
+
shouldGiveEditorWarning(editor, previousEditor);
|
|
7436
|
+
}
|
|
7437
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7438
|
+
}, [editor]);
|
|
7439
|
+
if (!isLoggedIn) {
|
|
7440
|
+
return jsx(AlertBanner, {
|
|
7441
|
+
title: t('error-auth-login')
|
|
7283
7442
|
});
|
|
7284
|
-
}
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
|
|
7292
|
-
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7443
|
+
}
|
|
7444
|
+
if (configError) {
|
|
7445
|
+
return jsx(AlertBanner, {
|
|
7446
|
+
title: t('maritime-config-error'),
|
|
7447
|
+
info: configError.message,
|
|
7448
|
+
actionButtonProps: {
|
|
7449
|
+
title: t('error-title-retry'),
|
|
7450
|
+
onClick: function onClick() {
|
|
7451
|
+
void refetchConfig();
|
|
7452
|
+
}
|
|
7453
|
+
}
|
|
7454
|
+
});
|
|
7455
|
+
}
|
|
7456
|
+
return jsxs(Fragment, {
|
|
7457
|
+
children: [(isFetchingConfig || isFetchingWarnings || !maritimeConfig) && jsx(LinearProgress, {
|
|
7458
|
+
"data-testid": "loading-bar",
|
|
7459
|
+
color: "secondary",
|
|
7460
|
+
sx: {
|
|
7461
|
+
position: 'absolute',
|
|
7462
|
+
width: '100%',
|
|
7463
|
+
top: 0
|
|
7464
|
+
}
|
|
7465
|
+
}), !maritimeConfig ? jsxs("div", {
|
|
7466
|
+
children: [" ", t('maritime-loading-config')]
|
|
7467
|
+
}) : jsx(MaritimeWarningsForm, {
|
|
7468
|
+
areas: areas || [],
|
|
7469
|
+
selectedAreaIds: state.selectedAreaIds,
|
|
7470
|
+
warnings: state.warnings,
|
|
7471
|
+
modified: state.modified,
|
|
7472
|
+
isReadOnly: isReadOnly,
|
|
7473
|
+
shouldShowDistricts: shouldShowDistricts,
|
|
7474
|
+
editor: editor,
|
|
7475
|
+
onToggleSelectArea: onToggleSelectArea,
|
|
7476
|
+
onSelectMultipleAreas: onSelectMultipleAreas,
|
|
7477
|
+
onAddSelectedAreas: onAddSelectedAreas,
|
|
7478
|
+
onRemoveWarning: onRemoveWarning,
|
|
7479
|
+
onRemoveArea: onRemoveArea,
|
|
7480
|
+
onAddWarning: onAddWarning,
|
|
7481
|
+
onChangeWarning: onChangeWarning,
|
|
7482
|
+
onMoveWarning: onMoveWarning,
|
|
7483
|
+
onToggleReadOnly: onToggleReadOnly,
|
|
7484
|
+
onClear: onClear,
|
|
7485
|
+
onSubmit: onSubmit,
|
|
7486
|
+
maritimeConfig: maritimeConfig,
|
|
7487
|
+
lastUpdatedTime: lastUpdateTime,
|
|
7488
|
+
error: error,
|
|
7489
|
+
shouldHideEditorToggle: isNew
|
|
7490
|
+
})]
|
|
7304
7491
|
});
|
|
7305
7492
|
};
|
|
7306
7493
|
|
|
@@ -7581,6 +7768,24 @@ var Form = function Form(_ref5) {
|
|
|
7581
7768
|
var formMethods = useForm({
|
|
7582
7769
|
defaultValues: {}
|
|
7583
7770
|
});
|
|
7771
|
+
var endOfWarningValidity = publicWarningDetails == null ? void 0 : publicWarningDetails.validUntil;
|
|
7772
|
+
React.useEffect(function () {
|
|
7773
|
+
if (!endOfWarningValidity || formState !== 'amending') {
|
|
7774
|
+
return function () {};
|
|
7775
|
+
}
|
|
7776
|
+
var end = new Date(endOfWarningValidity).getTime();
|
|
7777
|
+
var now = Date.now();
|
|
7778
|
+
if (end <= now) {
|
|
7779
|
+
onCloseForm();
|
|
7780
|
+
return function () {};
|
|
7781
|
+
}
|
|
7782
|
+
var timer = setTimeout(function () {
|
|
7783
|
+
onCloseForm();
|
|
7784
|
+
}, end - now + 1000);
|
|
7785
|
+
return function () {
|
|
7786
|
+
return clearTimeout(timer);
|
|
7787
|
+
};
|
|
7788
|
+
}, [endOfWarningValidity, formState, onCloseForm]);
|
|
7584
7789
|
var initialPublicWarningArea = (publicWarningDetails == null || (_publicWarningDetails = publicWarningDetails.areas) == null ? void 0 : _publicWarningDetails.length) && (publicWarningDetails == null || (_publicWarningDetails2 = publicWarningDetails.areas[0]) == null ? void 0 : _publicWarningDetails2.geoJSON);
|
|
7585
7790
|
var _React$useState4 = React.useState(initialPublicWarningArea),
|
|
7586
7791
|
warningGeoJSONFeature = _React$useState4[0],
|
|
@@ -7677,11 +7882,27 @@ var Form = function Form(_ref5) {
|
|
|
7677
7882
|
})) : null
|
|
7678
7883
|
});
|
|
7679
7884
|
};
|
|
7680
|
-
var cancelAviationProduct = function
|
|
7681
|
-
|
|
7682
|
-
|
|
7683
|
-
|
|
7684
|
-
|
|
7885
|
+
var cancelAviationProduct = /*#__PURE__*/function () {
|
|
7886
|
+
var _ref1 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(warningType) {
|
|
7887
|
+
var result;
|
|
7888
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
7889
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
7890
|
+
case 0:
|
|
7891
|
+
_context6.next = 2;
|
|
7892
|
+
return onSaveAviationForm(selectedAviationProduct, 'CANCELLED', warningType, isVAPhenomenon(selectedAviationProduct, ProductAction.CANCEL) && watch('vaSigmetMoveToFIR'));
|
|
7893
|
+
case 2:
|
|
7894
|
+
result = _context6.sent;
|
|
7895
|
+
return _context6.abrupt("return", result != null ? result : null);
|
|
7896
|
+
case 4:
|
|
7897
|
+
case "end":
|
|
7898
|
+
return _context6.stop();
|
|
7899
|
+
}
|
|
7900
|
+
}, _callee6);
|
|
7901
|
+
}));
|
|
7902
|
+
return function cancelAviationProduct(_x3) {
|
|
7903
|
+
return _ref1.apply(this, arguments);
|
|
7904
|
+
};
|
|
7905
|
+
}();
|
|
7685
7906
|
var getPublishButtonLabel = function getPublishButtonLabel() {
|
|
7686
7907
|
if (isCancelling) {
|
|
7687
7908
|
return t('cancelling');
|
|
@@ -7697,7 +7918,7 @@ var Form = function Form(_ref5) {
|
|
|
7697
7918
|
return t('warning-button-publish');
|
|
7698
7919
|
};
|
|
7699
7920
|
var handleSubmitAviationProduct = /*#__PURE__*/function () {
|
|
7700
|
-
var
|
|
7921
|
+
var _ref10 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee0(action, warningType) {
|
|
7701
7922
|
var formValues;
|
|
7702
7923
|
return _regeneratorRuntime().wrap(function _callee0$(_context0) {
|
|
7703
7924
|
while (1) switch (_context0.prev = _context0.next) {
|
|
@@ -7732,35 +7953,35 @@ var Form = function Form(_ref5) {
|
|
|
7732
7953
|
case 14:
|
|
7733
7954
|
toggleIsDraft(false);
|
|
7734
7955
|
void handleSubmit(/*#__PURE__*/function () {
|
|
7735
|
-
var
|
|
7736
|
-
return _regeneratorRuntime().wrap(function
|
|
7737
|
-
while (1) switch (
|
|
7956
|
+
var _ref11 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(formValues) {
|
|
7957
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
7958
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
7738
7959
|
case 0:
|
|
7739
|
-
|
|
7740
|
-
return showConfirmDialog(action).then(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
7741
|
-
return _regeneratorRuntime().wrap(function
|
|
7742
|
-
while (1) switch (
|
|
7960
|
+
_context8.next = 2;
|
|
7961
|
+
return showConfirmDialog(action).then(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
7962
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
7963
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
7743
7964
|
case 0:
|
|
7744
7965
|
setIsPublishing(true);
|
|
7745
|
-
|
|
7966
|
+
_context7.next = 3;
|
|
7746
7967
|
return onSaveAviationForm(formValues, 'PUBLISHED', warningType)["catch"](function () {});
|
|
7747
7968
|
case 3:
|
|
7748
7969
|
case "end":
|
|
7749
|
-
return
|
|
7970
|
+
return _context7.stop();
|
|
7750
7971
|
}
|
|
7751
|
-
},
|
|
7972
|
+
}, _callee7);
|
|
7752
7973
|
})));
|
|
7753
7974
|
case 2:
|
|
7754
7975
|
setIsPublishing(false);
|
|
7755
7976
|
onCloseForm();
|
|
7756
7977
|
case 4:
|
|
7757
7978
|
case "end":
|
|
7758
|
-
return
|
|
7979
|
+
return _context8.stop();
|
|
7759
7980
|
}
|
|
7760
|
-
},
|
|
7981
|
+
}, _callee8);
|
|
7761
7982
|
}));
|
|
7762
|
-
return function (
|
|
7763
|
-
return
|
|
7983
|
+
return function (_x6) {
|
|
7984
|
+
return _ref11.apply(this, arguments);
|
|
7764
7985
|
};
|
|
7765
7986
|
}())();
|
|
7766
7987
|
return _context0.abrupt("break", 23);
|
|
@@ -7775,36 +7996,35 @@ var Form = function Form(_ref5) {
|
|
|
7775
7996
|
return _context0.abrupt("break", 23);
|
|
7776
7997
|
case 19:
|
|
7777
7998
|
void handleSubmit(/*#__PURE__*/function () {
|
|
7778
|
-
var
|
|
7999
|
+
var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(formValues) {
|
|
7779
8000
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
7780
8001
|
while (1) switch (_context9.prev = _context9.next) {
|
|
7781
8002
|
case 0:
|
|
7782
|
-
_context9.
|
|
7783
|
-
|
|
7784
|
-
|
|
7785
|
-
|
|
7786
|
-
|
|
7787
|
-
|
|
7788
|
-
|
|
7789
|
-
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
|
|
7799
|
-
|
|
7800
|
-
case 2:
|
|
8003
|
+
_context9.prev = 0;
|
|
8004
|
+
_context9.next = 3;
|
|
8005
|
+
return showConfirmDialog(action);
|
|
8006
|
+
case 3:
|
|
8007
|
+
setIsPublishing(true);
|
|
8008
|
+
// 1) Publish amended warning
|
|
8009
|
+
_context9.next = 6;
|
|
8010
|
+
return onSaveAviationForm(formValues, 'PUBLISHED', warningType);
|
|
8011
|
+
case 6:
|
|
8012
|
+
_context9.next = 8;
|
|
8013
|
+
return cancelAviationProduct(warningType);
|
|
8014
|
+
case 8:
|
|
8015
|
+
onCloseForm();
|
|
8016
|
+
case 9:
|
|
8017
|
+
_context9.prev = 9;
|
|
8018
|
+
setIsPublishing(false);
|
|
8019
|
+
return _context9.finish(9);
|
|
8020
|
+
case 12:
|
|
7801
8021
|
case "end":
|
|
7802
8022
|
return _context9.stop();
|
|
7803
8023
|
}
|
|
7804
|
-
}, _callee9);
|
|
8024
|
+
}, _callee9, null, [[0,, 9, 12]]);
|
|
7805
8025
|
}));
|
|
7806
|
-
return function (
|
|
7807
|
-
return
|
|
8026
|
+
return function (_x7) {
|
|
8027
|
+
return _ref13.apply(this, arguments);
|
|
7808
8028
|
};
|
|
7809
8029
|
}())();
|
|
7810
8030
|
return _context0.abrupt("break", 23);
|
|
@@ -7818,8 +8038,8 @@ var Form = function Form(_ref5) {
|
|
|
7818
8038
|
}
|
|
7819
8039
|
}, _callee0);
|
|
7820
8040
|
}));
|
|
7821
|
-
return function handleSubmitAviationProduct(
|
|
7822
|
-
return
|
|
8041
|
+
return function handleSubmitAviationProduct(_x4, _x5) {
|
|
8042
|
+
return _ref10.apply(this, arguments);
|
|
7823
8043
|
};
|
|
7824
8044
|
}();
|
|
7825
8045
|
var onPressClear = function onPressClear() {
|
|
@@ -7928,7 +8148,8 @@ var Form = function Form(_ref5) {
|
|
|
7928
8148
|
return fetchSigmetTAC(product);
|
|
7929
8149
|
},
|
|
7930
8150
|
storedGeoJSON: storedStartGeoJSON,
|
|
7931
|
-
storedEndGeoJSON: storedEndGeoJSON
|
|
8151
|
+
storedEndGeoJSON: storedEndGeoJSON,
|
|
8152
|
+
isAmending: formState === 'amending'
|
|
7932
8153
|
})
|
|
7933
8154
|
});
|
|
7934
8155
|
}
|
|
@@ -7951,7 +8172,8 @@ var Form = function Form(_ref5) {
|
|
|
7951
8172
|
getTAC: function getTAC(product) {
|
|
7952
8173
|
return fetchAirmetTAC(product);
|
|
7953
8174
|
},
|
|
7954
|
-
storedGeoJSON: storedStartGeoJSON
|
|
8175
|
+
storedGeoJSON: storedStartGeoJSON,
|
|
8176
|
+
isAmending: formState === 'amending'
|
|
7955
8177
|
})
|
|
7956
8178
|
});
|
|
7957
8179
|
}
|
|
@@ -8227,7 +8449,7 @@ var PublicWarningsForm = function PublicWarningsForm(props) {
|
|
|
8227
8449
|
var defaultValues = selectedAviationProduct || getFormData(publicWarningDetails, object);
|
|
8228
8450
|
return jsx(ReactHookFormProvider, {
|
|
8229
8451
|
options: Object.assign({}, defaultFormOptions, {
|
|
8230
|
-
mode: 'onSubmit',
|
|
8452
|
+
mode: selectedAviationProduct ? defaultFormOptions.mode : 'onSubmit',
|
|
8231
8453
|
defaultValues: defaultValues
|
|
8232
8454
|
}),
|
|
8233
8455
|
children: jsx(Form, Object.assign({}, props))
|
|
@@ -9199,18 +9421,15 @@ var useWarnings = function useWarnings(disabled) {
|
|
|
9199
9421
|
sigmetWarnings = _useSigmetList.data,
|
|
9200
9422
|
refetchSigmet = _useSigmetList.refetch,
|
|
9201
9423
|
isFetchingSigmet = _useSigmetList.isFetching;
|
|
9202
|
-
var warningType = useSelector(getWarningType);
|
|
9203
|
-
var _useProductConfig = useProductConfig(warningType, false),
|
|
9204
|
-
aviationConfig = _useProductConfig.data;
|
|
9205
9424
|
var combinedWarnings = useMemo(function () {
|
|
9206
9425
|
var transformedSigmets = (sigmetWarnings == null ? void 0 : sigmetWarnings.map(function (sigmet) {
|
|
9207
|
-
return transformSigmetToWarningFormat(sigmet
|
|
9426
|
+
return transformSigmetToWarningFormat(sigmet);
|
|
9208
9427
|
})) || [];
|
|
9209
9428
|
var transformedAirmets = (airmetWarnings == null ? void 0 : airmetWarnings.map(function (airmet) {
|
|
9210
|
-
return transformAirmetToWarningFormat(airmet
|
|
9429
|
+
return transformAirmetToWarningFormat(airmet);
|
|
9211
9430
|
})) || [];
|
|
9212
9431
|
return concat(publicWarnings || [], transformedSigmets, transformedAirmets);
|
|
9213
|
-
}, [sigmetWarnings, airmetWarnings, publicWarnings
|
|
9432
|
+
}, [sigmetWarnings, airmetWarnings, publicWarnings]);
|
|
9214
9433
|
var refetchWarnings = function refetchWarnings() {
|
|
9215
9434
|
void refetchPublicWarnings();
|
|
9216
9435
|
void refetchAirmet();
|
|
@@ -9225,6 +9444,32 @@ var useWarnings = function useWarnings(disabled) {
|
|
|
9225
9444
|
dataUpdatedAt: dataUpdatedAt
|
|
9226
9445
|
};
|
|
9227
9446
|
};
|
|
9447
|
+
function useAutoRefetchOnExpiry(combinedWarnings, refetchWarnings) {
|
|
9448
|
+
React__default.useEffect(function () {
|
|
9449
|
+
if (!combinedWarnings || combinedWarnings.length === 0) {
|
|
9450
|
+
return undefined;
|
|
9451
|
+
}
|
|
9452
|
+
var now = new Date();
|
|
9453
|
+
var futureEnds = combinedWarnings.map(function (wn) {
|
|
9454
|
+
return new Date(wn.warningDetail.validUntil);
|
|
9455
|
+
}).filter(function (date) {
|
|
9456
|
+
return date > now;
|
|
9457
|
+
});
|
|
9458
|
+
if (futureEnds.length === 0) {
|
|
9459
|
+
return undefined;
|
|
9460
|
+
}
|
|
9461
|
+
var nextExpiry = Math.min.apply(Math, futureEnds.map(function (date) {
|
|
9462
|
+
return date.getTime();
|
|
9463
|
+
}));
|
|
9464
|
+
var msUntilNext = nextExpiry - now.getTime();
|
|
9465
|
+
var timeout = setTimeout(function () {
|
|
9466
|
+
refetchWarnings();
|
|
9467
|
+
}, msUntilNext + 1000);
|
|
9468
|
+
return function () {
|
|
9469
|
+
clearTimeout(timeout);
|
|
9470
|
+
};
|
|
9471
|
+
}, [combinedWarnings, refetchWarnings]);
|
|
9472
|
+
}
|
|
9228
9473
|
|
|
9229
9474
|
var warningFormConfirmationOptions = function warningFormConfirmationOptions(t) {
|
|
9230
9475
|
return {
|
|
@@ -9877,9 +10122,17 @@ var WarningListItemMenu = function WarningListItemMenu(_ref) {
|
|
|
9877
10122
|
onWithdrawWarning = _ref$onWithdrawWarnin === void 0 ? function () {} : _ref$onWithdrawWarnin,
|
|
9878
10123
|
_ref$onActionAviation = _ref.onActionAviationWarning,
|
|
9879
10124
|
onActionAviationWarning = _ref$onActionAviation === void 0 ? function () {} : _ref$onActionAviation,
|
|
10125
|
+
_ref$onActionMaritime = _ref.onActionMaritimeWarning,
|
|
10126
|
+
onActionMaritimeWarning = _ref$onActionMaritime === void 0 ? function () {} : _ref$onActionMaritime,
|
|
9880
10127
|
t = _ref.t;
|
|
9881
|
-
if (warning.
|
|
9882
|
-
return [
|
|
10128
|
+
if (warning.type === 'maritimeWarningCoastal' || warning.type === 'maritimeWarningNorthSea') {
|
|
10129
|
+
return [{
|
|
10130
|
+
text: t('warning-list-button-update'),
|
|
10131
|
+
action: function action() {
|
|
10132
|
+
return onActionMaritimeWarning(warning, MaritimeWarningAction.UPDATE);
|
|
10133
|
+
},
|
|
10134
|
+
icon: jsx(Edit, {})
|
|
10135
|
+
}];
|
|
9883
10136
|
}
|
|
9884
10137
|
var duplicate = {
|
|
9885
10138
|
text: t('warning-list-button-duplicate'),
|
|
@@ -10012,7 +10265,7 @@ var WarningListItemMenu = function WarningListItemMenu(_ref) {
|
|
|
10012
10265
|
}
|
|
10013
10266
|
};
|
|
10014
10267
|
|
|
10015
|
-
var _excluded = ["warning", "activeWarningId", "highlightedItem", "onSelectWarning", "onEditWarning", "onDeleteWarning", "onDeleteReviewWarning", "onExpireWarning", "onWithdrawWarning", "onActionAviationWarning"];
|
|
10268
|
+
var _excluded = ["warning", "activeWarningId", "highlightedItem", "onSelectWarning", "onEditWarning", "onDeleteWarning", "onDeleteReviewWarning", "onExpireWarning", "onWithdrawWarning", "onActionAviationWarning", "onActionMaritimeWarning"];
|
|
10016
10269
|
var renderLevelText = function renderLevelText(levelString) {
|
|
10017
10270
|
if (!levelString) {
|
|
10018
10271
|
return null;
|
|
@@ -10109,6 +10362,8 @@ var WarningListItem = function WarningListItem(_ref) {
|
|
|
10109
10362
|
onWithdrawWarning = _ref$onWithdrawWarnin === void 0 ? function () {} : _ref$onWithdrawWarnin,
|
|
10110
10363
|
_ref$onActionAviation = _ref.onActionAviationWarning,
|
|
10111
10364
|
onActionAviationWarning = _ref$onActionAviation === void 0 ? function () {} : _ref$onActionAviation,
|
|
10365
|
+
_ref$onActionMaritime = _ref.onActionMaritimeWarning,
|
|
10366
|
+
onActionMaritimeWarning = _ref$onActionMaritime === void 0 ? function () {} : _ref$onActionMaritime,
|
|
10112
10367
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
10113
10368
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
10114
10369
|
t = _useWarningsTranslati.t;
|
|
@@ -10163,7 +10418,8 @@ var WarningListItem = function WarningListItem(_ref) {
|
|
|
10163
10418
|
onDeleteWarning: onDeleteWarning,
|
|
10164
10419
|
onExpireWarning: onExpireWarning,
|
|
10165
10420
|
onWithdrawWarning: onWithdrawWarning,
|
|
10166
|
-
onActionAviationWarning: onActionAviationWarning
|
|
10421
|
+
onActionAviationWarning: onActionAviationWarning,
|
|
10422
|
+
onActionMaritimeWarning: onActionMaritimeWarning
|
|
10167
10423
|
}),
|
|
10168
10424
|
buttonIcon: jsx(Options, {})
|
|
10169
10425
|
}),
|
|
@@ -10532,6 +10788,8 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
10532
10788
|
onWithdrawWarning = _ref$onWithdrawWarnin === void 0 ? function () {} : _ref$onWithdrawWarnin,
|
|
10533
10789
|
_ref$onActionAviation = _ref.onActionAviationWarning,
|
|
10534
10790
|
onActionAviationWarning = _ref$onActionAviation === void 0 ? function () {} : _ref$onActionAviation,
|
|
10791
|
+
_ref$onActionMaritime = _ref.onActionMaritimeWarning,
|
|
10792
|
+
onActionMaritimeWarning = _ref$onActionMaritime === void 0 ? function () {} : _ref$onActionMaritime,
|
|
10535
10793
|
hoveredFeatureId = _ref.hoveredFeatureId,
|
|
10536
10794
|
expandedSections = _ref.expandedSections,
|
|
10537
10795
|
setExpandedSections = _ref.setExpandedSections;
|
|
@@ -10805,7 +11063,8 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
10805
11063
|
activeWarningId: selectedWarningId,
|
|
10806
11064
|
onExpireWarning: onExpireWarning,
|
|
10807
11065
|
onWithdrawWarning: onWithdrawWarning,
|
|
10808
|
-
onActionAviationWarning: onActionAviationWarning
|
|
11066
|
+
onActionAviationWarning: onActionAviationWarning,
|
|
11067
|
+
onActionMaritimeWarning: onActionMaritimeWarning
|
|
10809
11068
|
}, key);
|
|
10810
11069
|
}
|
|
10811
11070
|
});
|
|
@@ -11055,7 +11314,7 @@ var useWarningFilters = function useWarningFilters(warnings, onUpdateFilters, sa
|
|
|
11055
11314
|
if (['SIG', 'AIR'].includes(warning.warningDetail.level)) {
|
|
11056
11315
|
return Domain.aviation;
|
|
11057
11316
|
}
|
|
11058
|
-
if (warning.
|
|
11317
|
+
if (warning.type === 'maritimeWarningCoastal' || warning.type === 'maritimeWarningNorthSea') {
|
|
11059
11318
|
return Domain.maritime;
|
|
11060
11319
|
}
|
|
11061
11320
|
return Domain["public"];
|
|
@@ -11179,6 +11438,8 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
11179
11438
|
var panelId = _ref.panelId,
|
|
11180
11439
|
presetFilterState = _ref.presetFilterState;
|
|
11181
11440
|
var updatePublicWarningEditor = useMutatePublicWarningEditor();
|
|
11441
|
+
var _useMutateMaritimeWar = useMutateMaritimeWarningsEditor(),
|
|
11442
|
+
updateMaritimeWarningEditor = _useMutateMaritimeWar.mutateAsync;
|
|
11182
11443
|
var _useMutateDeleteWarni = useMutateDeleteWarning(),
|
|
11183
11444
|
deletePublicWarning = _useMutateDeleteWarni.mutateAsync;
|
|
11184
11445
|
var _useSaveWarning = useSaveWarning(),
|
|
@@ -11195,6 +11456,7 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
11195
11456
|
isFetching = _useWarnings.isFetching,
|
|
11196
11457
|
error = _useWarnings.error,
|
|
11197
11458
|
dataUpdatedAt = _useWarnings.dataUpdatedAt;
|
|
11459
|
+
useAutoRefetchOnExpiry(combinedWarnings, refetchWarnings);
|
|
11198
11460
|
var lastUpdateTime = dateUtils.dateToString(new Date(dataUpdatedAt), dateUtils.DATE_FORMAT_HOURS);
|
|
11199
11461
|
var _React$useState = React__default.useState(undefined),
|
|
11200
11462
|
confirmDialogOptions = _React$useState[0],
|
|
@@ -11245,8 +11507,12 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
11245
11507
|
return _ref2.apply(this, arguments);
|
|
11246
11508
|
};
|
|
11247
11509
|
}();
|
|
11248
|
-
var selectWarning = function selectWarning(
|
|
11249
|
-
void
|
|
11510
|
+
var selectWarning = function selectWarning(warning) {
|
|
11511
|
+
if ((warning == null ? void 0 : warning.type) === 'maritimeWarningCoastal' || (warning == null ? void 0 : warning.type) === 'maritimeWarningNorthSea') {
|
|
11512
|
+
handleMaritimeProductClick(warning, MaritimeWarningAction.SELECT);
|
|
11513
|
+
} else {
|
|
11514
|
+
void openPublicWarningDialog('readonly', warning);
|
|
11515
|
+
}
|
|
11250
11516
|
};
|
|
11251
11517
|
var createWarning = function createWarning(warningType) {
|
|
11252
11518
|
void openPublicWarningDialog('', undefined, warningType);
|
|
@@ -11416,6 +11682,54 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
11416
11682
|
}
|
|
11417
11683
|
}
|
|
11418
11684
|
};
|
|
11685
|
+
var editMaritimeWarning = /*#__PURE__*/function () {
|
|
11686
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(warning) {
|
|
11687
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
11688
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
11689
|
+
case 0:
|
|
11690
|
+
if (!(warning && auth != null && auth.username && !warning.editor)) {
|
|
11691
|
+
_context4.next = 9;
|
|
11692
|
+
break;
|
|
11693
|
+
}
|
|
11694
|
+
_context4.prev = 1;
|
|
11695
|
+
_context4.next = 4;
|
|
11696
|
+
return updateMaritimeWarningEditor({
|
|
11697
|
+
domain: warning.type,
|
|
11698
|
+
isEditor: true
|
|
11699
|
+
});
|
|
11700
|
+
case 4:
|
|
11701
|
+
_context4.next = 8;
|
|
11702
|
+
break;
|
|
11703
|
+
case 6:
|
|
11704
|
+
_context4.prev = 6;
|
|
11705
|
+
_context4.t0 = _context4["catch"](1);
|
|
11706
|
+
case 8:
|
|
11707
|
+
refetchWarnings();
|
|
11708
|
+
case 9:
|
|
11709
|
+
void openPublicWarningDialog('', undefined, warning.type);
|
|
11710
|
+
case 10:
|
|
11711
|
+
case "end":
|
|
11712
|
+
return _context4.stop();
|
|
11713
|
+
}
|
|
11714
|
+
}, _callee4, null, [[1, 6]]);
|
|
11715
|
+
}));
|
|
11716
|
+
return function editMaritimeWarning(_x8) {
|
|
11717
|
+
return _ref5.apply(this, arguments);
|
|
11718
|
+
};
|
|
11719
|
+
}();
|
|
11720
|
+
var handleMaritimeProductClick = function handleMaritimeProductClick(warning, actionType) {
|
|
11721
|
+
if (!warning) {
|
|
11722
|
+
return;
|
|
11723
|
+
}
|
|
11724
|
+
switch (actionType) {
|
|
11725
|
+
case MaritimeWarningAction.SELECT:
|
|
11726
|
+
void openPublicWarningDialog('', undefined, warning.type);
|
|
11727
|
+
break;
|
|
11728
|
+
case MaritimeWarningAction.UPDATE:
|
|
11729
|
+
void editMaritimeWarning(warning);
|
|
11730
|
+
break;
|
|
11731
|
+
}
|
|
11732
|
+
};
|
|
11419
11733
|
var openSnackbar = function openSnackbar(message) {
|
|
11420
11734
|
dispatch(snackbarActions.openSnackbar({
|
|
11421
11735
|
type: snackbarTypes.SnackbarMessageType.VERBATIM_MESSAGE,
|
|
@@ -11558,7 +11872,8 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
11558
11872
|
onRefetchWarnings: refetchWarnings,
|
|
11559
11873
|
filterHookState: filterHookState,
|
|
11560
11874
|
hoveredFeatureId: hoveredFeatureId,
|
|
11561
|
-
onActionAviationWarning: handleAviationProductClick
|
|
11875
|
+
onActionAviationWarning: handleAviationProductClick,
|
|
11876
|
+
onActionMaritimeWarning: handleMaritimeProductClick
|
|
11562
11877
|
}), confirmDialogOptions && jsx(ConfirmDeleteWarningDialog, {
|
|
11563
11878
|
onClose: function onClose() {
|
|
11564
11879
|
return setConfirmDialogOptions(undefined);
|