@opengeoweb/warnings 12.11.0 → 12.13.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 +1035 -410
- package/package.json +12 -12
- package/src/lib/Warnings.stories.d.ts +10 -1
- package/src/lib/api/warning-api/api.d.ts +5 -1
- package/src/lib/api/warning-api/hooks.d.ts +11 -2
- package/src/lib/components/MaritimeWarningsForm/AreaList/AreaList.d.ts +6 -4
- package/src/lib/components/MaritimeWarningsForm/AssignedAreas/AssignedAreas.d.ts +4 -2
- package/src/lib/components/MaritimeWarningsForm/AssignedAreas/AssignedAreas.spec.d.ts +1 -0
- package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsAvatar.d.ts +8 -0
- package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsForm.d.ts +16 -2
- package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsForm.spec.d.ts +1 -2
- package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsForm.stories.d.ts +9 -3
- package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsFormConnect.stories.d.ts +2 -0
- package/src/lib/components/MaritimeWarningsForm/WarningList/WarningList.d.ts +5 -2
- package/src/lib/components/MaritimeWarningsForm/WarningList/WarningListItem.d.ts +6 -3
- package/src/lib/components/MaritimeWarningsForm/WarningList/WarningListSelect.d.ts +3 -2
- package/src/lib/components/MaritimeWarningsForm/WarningList/WindForceSelect.d.ts +4 -2
- package/src/lib/components/MaritimeWarningsForm/testUtils.d.ts +3 -0
- 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/useFilterChipSelect.d.ts +12 -0
- package/src/lib/components/MaritimeWarningsForm/useFilterChipSelect.spec.d.ts +1 -0
- package/src/lib/components/MaritimeWarningsForm/useMaritimeWarningsFormState.d.ts +11 -1
- package/src/lib/components/MaritimeWarningsForm/utils.d.ts +5 -1
- 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/store/publicWarningForm/types.d.ts +16 -2
- 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
|
@@ -3,11 +3,11 @@ import { useDispatch, useSelector } from 'react-redux';
|
|
|
3
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';
|
|
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,12 +253,19 @@ 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
|
-
"maritime-warning-title-northsea": "Warning Maritime - North Sea Districts"
|
|
259
|
+
"maritime-warning-title-northsea": "Warning Maritime - North Sea Districts",
|
|
260
|
+
"maritime-domain-coastal": "Coastal Waters",
|
|
261
|
+
"maritime-domain-northsea": "North Sea Districts",
|
|
262
|
+
"maritime-editor-on": "You are now the editor of the Maritime Warnings for {{domain}}",
|
|
263
|
+
"maritime-editor-off": "You are now no longer the editor of the Maritime Warnings for {{domain}}",
|
|
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-validfrom": "Start time: ",
|
|
268
|
+
"maritime-warning-validuntil": "End time: "
|
|
261
269
|
};
|
|
262
270
|
var nl = {
|
|
263
271
|
"drawing-tool-form-tools": "Gereedschap",
|
|
@@ -414,9 +422,10 @@ var nl = {
|
|
|
414
422
|
"maritime-add-area": "Toevoegen",
|
|
415
423
|
"maritime-no-area-selected": "(geen gebied geselecteerd)",
|
|
416
424
|
"maritime-no-district-selected": "(geen district geselecteerd)",
|
|
417
|
-
"maritime-
|
|
418
|
-
"maritime-
|
|
419
|
-
"maritime-
|
|
425
|
+
"maritime-no-change-selected": "(geen wijziging geselecteerd)",
|
|
426
|
+
"maritime-change-NO_CHANGE": "Geen wijziging",
|
|
427
|
+
"maritime-change-BACKING": "Krimpend",
|
|
428
|
+
"maritime-change-VEERING": "Ruimend",
|
|
420
429
|
"maritime-windforce": "{{value}} Bft",
|
|
421
430
|
"maritime-header-direction": "Richting",
|
|
422
431
|
"maritime-header-direction-from": "Richting van",
|
|
@@ -425,34 +434,37 @@ var nl = {
|
|
|
425
434
|
"maritime-header-areas": "Gebieden",
|
|
426
435
|
"maritime-header-districts": "Districten",
|
|
427
436
|
"maritime-header-change": "Wijziging",
|
|
428
|
-
"maritime-direction-
|
|
429
|
-
"maritime-direction-
|
|
430
|
-
"maritime-direction-
|
|
431
|
-
"maritime-direction-
|
|
432
|
-
"maritime-direction-
|
|
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-
|
|
437
|
+
"maritime-direction-N": "Noord",
|
|
438
|
+
"maritime-direction-NNE": "Noord tot noordoost",
|
|
439
|
+
"maritime-direction-NE": "Noordoost",
|
|
440
|
+
"maritime-direction-ENE": "Oost tot noordoost",
|
|
441
|
+
"maritime-direction-E": "Oost",
|
|
442
|
+
"maritime-direction-ESE": "Oost tot zuidoost",
|
|
443
|
+
"maritime-direction-SE": "Zuidoost",
|
|
444
|
+
"maritime-direction-SSE": "Zuid tot zuidoost",
|
|
445
|
+
"maritime-direction-S": "Zuid",
|
|
446
|
+
"maritime-direction-SSW": "Zuid tot zuidwest",
|
|
447
|
+
"maritime-direction-SW": "Zuidwest",
|
|
448
|
+
"maritime-direction-WSW": "West tot zuidwest",
|
|
449
|
+
"maritime-direction-W": "West",
|
|
450
|
+
"maritime-direction-WNW": "West tot noordwest",
|
|
451
|
+
"maritime-direction-NW": "Noordwest",
|
|
452
|
+
"maritime-direction-NNW": "Noord tot noordwest",
|
|
444
453
|
"maritime-delete-button": "Verwijderen",
|
|
445
454
|
"maritime-retract-warning": "Waarschuwing intrekken",
|
|
446
455
|
"maritime-retract-dialog-no-change": "(geen wijziging in richting)",
|
|
447
456
|
"maritime-retract-dialog-empty-warning-description": "De waarschuwing wordt verwijderd",
|
|
448
457
|
"maritime-retract-dialog-description-suffix": "wordt verwijderd",
|
|
449
458
|
"maritime-retract-dialog-confirm": "Intrekken",
|
|
450
|
-
"maritime-retract-success": "Waarschuwing succesvol ingetrokken",
|
|
451
459
|
"maritime-clear-dialog-title": "Wissen",
|
|
452
460
|
"maritime-clear-dialog-description": "Alle waarschuwingen worden verwijderd",
|
|
453
|
-
"maritime-clear-success": "Alle waarchuwingen zijn verwijderd",
|
|
454
461
|
"maritime-warning-title-coastal": "Maritieme Waarschuwing - Kustgebieden",
|
|
455
|
-
"maritime-warning-title-northsea": "Maritieme Waarschuwing - Noordzee Districten"
|
|
462
|
+
"maritime-warning-title-northsea": "Maritieme Waarschuwing - Noordzee Districten",
|
|
463
|
+
"maritime-warning-post-success": "Waarschuwing succesvol gepubliceerd",
|
|
464
|
+
"maritime-loading-config": "Laden van configuratie...",
|
|
465
|
+
"maritime-config-error": "Er is iets misgegaan bij het laden van het configuratiebestand",
|
|
466
|
+
"maritime-warning-validfrom": "Start tijd: ",
|
|
467
|
+
"maritime-warning-validuntil": "Eind tijd: "
|
|
456
468
|
};
|
|
457
469
|
var fi = {
|
|
458
470
|
"drawing-tool-form-tools": "Työkalut",
|
|
@@ -604,7 +616,9 @@ var fi = {
|
|
|
604
616
|
"aviation-discard-success": "{{warningType}} er forkastet!",
|
|
605
617
|
"error-auth-login": "Tämän toiminnallisuuden käyttäminen vaatii tunnistautumista. Kirjaudu sisään jatkaaksesi",
|
|
606
618
|
"cancel-warningType": "Peruuta {{warningType}}",
|
|
607
|
-
cancelling: "Peruuttaminen"
|
|
619
|
+
cancelling: "Peruuttaminen",
|
|
620
|
+
"maritime-editor-off": "Et ole enää {{domain}} -merivaroitusten muokkaaja",
|
|
621
|
+
"maritime-warning-post-success": "Varoitus julkaistu onnistuneesti"
|
|
608
622
|
};
|
|
609
623
|
var no = {
|
|
610
624
|
"drawing-tool-form-tools": "Verktøy",
|
|
@@ -2000,8 +2014,9 @@ var getPublicWarningList = function getPublicWarningList(auth) {
|
|
|
2000
2014
|
headers: getHeaders(auth)
|
|
2001
2015
|
}).then(handleResponse).then(function (warnings) {
|
|
2002
2016
|
return warnings.map(function (warning) {
|
|
2017
|
+
var _warning$warningDetai;
|
|
2003
2018
|
return Object.assign({}, warning, {
|
|
2004
|
-
type: 'public'
|
|
2019
|
+
type: ((_warning$warningDetai = warning.warningDetail) == null ? void 0 : _warning$warningDetai.domain) || 'public'
|
|
2005
2020
|
});
|
|
2006
2021
|
});
|
|
2007
2022
|
});
|
|
@@ -2026,6 +2041,19 @@ var postPublicWarning = function postPublicWarning(auth, data) {
|
|
|
2026
2041
|
body: JSON.stringify(data)
|
|
2027
2042
|
}).then(handleResponse);
|
|
2028
2043
|
};
|
|
2044
|
+
var postMaritimeWarnings = function postMaritimeWarnings(auth, data) {
|
|
2045
|
+
return fetch(publicWarningBaseUrl + "/maritime/", {
|
|
2046
|
+
headers: getHeaders(auth),
|
|
2047
|
+
method: 'POST',
|
|
2048
|
+
body: JSON.stringify(data)
|
|
2049
|
+
}).then(handleResponse);
|
|
2050
|
+
};
|
|
2051
|
+
var updateMaritimeWarningsEditor = function updateMaritimeWarningsEditor(domain, isEditor, auth, force) {
|
|
2052
|
+
return fetch(publicWarningBaseUrl + "/maritime/" + domain + "?editor=" + (isEditor ? 'true' : 'false') + "&force=" + (force ? 'true' : 'false'), {
|
|
2053
|
+
headers: getHeaders(auth),
|
|
2054
|
+
method: 'POST'
|
|
2055
|
+
}).then(handleResponse);
|
|
2056
|
+
};
|
|
2029
2057
|
var deleteWarning = function deleteWarning(warningId, auth) {
|
|
2030
2058
|
return fetch(publicWarningBaseUrl + "/warnings/" + warningId + "?delete=true", {
|
|
2031
2059
|
headers: getHeaders(auth),
|
|
@@ -2109,6 +2137,12 @@ var deleteDrawing = function deleteDrawing(auth, drawingId) {
|
|
|
2109
2137
|
headers: getHeaders(auth)
|
|
2110
2138
|
}).then(handleResponse);
|
|
2111
2139
|
};
|
|
2140
|
+
var getMaritimeWarningsConfig = function getMaritimeWarningsConfig(auth) {
|
|
2141
|
+
var url = publicWarningBaseUrl + "/maritime-warnings-config";
|
|
2142
|
+
return fetch(url, {
|
|
2143
|
+
headers: getHeaders(auth)
|
|
2144
|
+
}).then(handleResponse);
|
|
2145
|
+
};
|
|
2112
2146
|
|
|
2113
2147
|
/* *
|
|
2114
2148
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -2137,6 +2171,11 @@ var PublicWarningStatus;
|
|
|
2137
2171
|
PublicWarningStatus["IGNORED"] = "IGNORED";
|
|
2138
2172
|
PublicWarningStatus["WITHDRAWN"] = "WITHDRAWN";
|
|
2139
2173
|
})(PublicWarningStatus || (PublicWarningStatus = {}));
|
|
2174
|
+
var MaritimeWarningAction;
|
|
2175
|
+
(function (MaritimeWarningAction) {
|
|
2176
|
+
MaritimeWarningAction["SELECT"] = "SELECT";
|
|
2177
|
+
MaritimeWarningAction["UPDATE"] = "UPDATE";
|
|
2178
|
+
})(MaritimeWarningAction || (MaritimeWarningAction = {}));
|
|
2140
2179
|
|
|
2141
2180
|
/* *
|
|
2142
2181
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -2384,7 +2423,7 @@ var defaultDomainFilter = {
|
|
|
2384
2423
|
};
|
|
2385
2424
|
var domainLevels = {
|
|
2386
2425
|
aviation: [Level.airmet, Level.sigmet],
|
|
2387
|
-
maritime: [],
|
|
2426
|
+
maritime: [Level.extreme, Level.moderate, Level.severe],
|
|
2388
2427
|
"public": [Level.extreme, Level.moderate, Level.severe]
|
|
2389
2428
|
};
|
|
2390
2429
|
var defaultLevelFilter = (_defaultLevelFilter = {}, _defaultLevelFilter[emptyFilterId] = true, _defaultLevelFilter.extreme = true, _defaultLevelFilter.moderate = true, _defaultLevelFilter.severe = true, _defaultLevelFilter.AIR = true, _defaultLevelFilter.SIG = true, _defaultLevelFilter);
|
|
@@ -2394,9 +2433,9 @@ var makeFilterFromList = function makeFilterFromList(options, value) {
|
|
|
2394
2433
|
if (value === void 0) {
|
|
2395
2434
|
value = true;
|
|
2396
2435
|
}
|
|
2397
|
-
return options.reduce(function (acc,
|
|
2436
|
+
return options.reduce(function (acc, property) {
|
|
2398
2437
|
var _Object$assign;
|
|
2399
|
-
return
|
|
2438
|
+
return property ? Object.assign({}, acc, (_Object$assign = {}, _Object$assign[property] = value, _Object$assign)) : acc;
|
|
2400
2439
|
}, (_options$reduce = {}, _options$reduce[emptyFilterId] = value, _options$reduce));
|
|
2401
2440
|
};
|
|
2402
2441
|
var AllPhenomena = Object.assign({}, AirmetPhenomena, SigmetPhenomena, Phenomenon$1);
|
|
@@ -2405,7 +2444,7 @@ var AllPhenomenaKeys = Object.fromEntries(Object.keys(AllPhenomena).map(function
|
|
|
2405
2444
|
}));
|
|
2406
2445
|
var domainPhenomena = {
|
|
2407
2446
|
aviation: [].concat(Object.keys(SigmetPhenomena), Object.keys(AirmetPhenomena)),
|
|
2408
|
-
maritime: [],
|
|
2447
|
+
maritime: [Phenomenon$1.wind],
|
|
2409
2448
|
"public": [].concat(Object.keys(Phenomenon$1))
|
|
2410
2449
|
};
|
|
2411
2450
|
var defaultPhenomenonFilter = makeFilterFromList(Object.keys(AllPhenomenaKeys));
|
|
@@ -2420,8 +2459,8 @@ var getSelectedOptions = function getSelectedOptions(options) {
|
|
|
2420
2459
|
if (options === void 0) {
|
|
2421
2460
|
options = {};
|
|
2422
2461
|
}
|
|
2423
|
-
var selectedOptions = Object.keys(options).filter(function (
|
|
2424
|
-
return options[
|
|
2462
|
+
var selectedOptions = Object.keys(options).filter(function (key) {
|
|
2463
|
+
return options[key];
|
|
2425
2464
|
});
|
|
2426
2465
|
var allSelected = selectedOptions.length === Object.keys(options).length;
|
|
2427
2466
|
return {
|
|
@@ -2432,26 +2471,26 @@ var getSelectedOptions = function getSelectedOptions(options) {
|
|
|
2432
2471
|
var updateState = function updateState(state, optionKey, value, only) {
|
|
2433
2472
|
var _Object$assign4;
|
|
2434
2473
|
if (only) {
|
|
2435
|
-
return Object.keys(state).reduce(function (acc,
|
|
2474
|
+
return Object.keys(state).reduce(function (acc, key) {
|
|
2436
2475
|
var _Object$assign2;
|
|
2437
|
-
return Object.assign({}, acc, (_Object$assign2 = {}, _Object$assign2[
|
|
2476
|
+
return Object.assign({}, acc, (_Object$assign2 = {}, _Object$assign2[key] = key === optionKey, _Object$assign2));
|
|
2438
2477
|
}, {});
|
|
2439
2478
|
}
|
|
2440
2479
|
if (optionKey === 'ALL') {
|
|
2441
2480
|
if (Object.keys(state).length < 2) {
|
|
2442
2481
|
return state;
|
|
2443
2482
|
}
|
|
2444
|
-
return Object.keys(state).reduce(function (acc,
|
|
2483
|
+
return Object.keys(state).reduce(function (acc, key) {
|
|
2445
2484
|
var _Object$assign3;
|
|
2446
|
-
return Object.assign({}, acc, (_Object$assign3 = {}, _Object$assign3[
|
|
2485
|
+
return Object.assign({}, acc, (_Object$assign3 = {}, _Object$assign3[key] = value, _Object$assign3));
|
|
2447
2486
|
}, {});
|
|
2448
2487
|
}
|
|
2449
2488
|
return Object.assign({}, state, (_Object$assign4 = {}, _Object$assign4[optionKey] = value, _Object$assign4));
|
|
2450
2489
|
};
|
|
2451
2490
|
/** Make sure our value is in the filter */
|
|
2452
2491
|
var getValue = function getValue(values, value) {
|
|
2453
|
-
return Object.values(values).find(function (
|
|
2454
|
-
return
|
|
2492
|
+
return Object.values(values).find(function (existingValue) {
|
|
2493
|
+
return existingValue === value;
|
|
2455
2494
|
}) || emptyFilterId;
|
|
2456
2495
|
};
|
|
2457
2496
|
var getFiltersFromWarnings = function getFiltersFromWarnings(warnings, filterKey) {
|
|
@@ -3303,6 +3342,68 @@ var useMutateDeleteDrawing = function useMutateDeleteDrawing() {
|
|
|
3303
3342
|
}
|
|
3304
3343
|
});
|
|
3305
3344
|
};
|
|
3345
|
+
var usePostMaritimeWarnings = function usePostMaritimeWarnings() {
|
|
3346
|
+
var _useAuthenticationCon6 = useAuthenticationContext(),
|
|
3347
|
+
auth = _useAuthenticationCon6.auth;
|
|
3348
|
+
var queryClient = useQueryClient();
|
|
3349
|
+
var dispatch = useDispatch();
|
|
3350
|
+
return useMutation({
|
|
3351
|
+
mutationFn: function mutationFn(data) {
|
|
3352
|
+
if (!auth) {
|
|
3353
|
+
throw new Error('Authentication context not found');
|
|
3354
|
+
}
|
|
3355
|
+
return postMaritimeWarnings(auth, data);
|
|
3356
|
+
},
|
|
3357
|
+
onSuccess: function onSuccess() {
|
|
3358
|
+
dispatch(snackbarActions.openSnackbar({
|
|
3359
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
3360
|
+
key: 'maritime-warning-post-success'
|
|
3361
|
+
}));
|
|
3362
|
+
},
|
|
3363
|
+
onSettled: function () {
|
|
3364
|
+
var _onSettled = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
3365
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
3366
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
3367
|
+
case 0:
|
|
3368
|
+
_context6.next = 2;
|
|
3369
|
+
return queryClient.invalidateQueries({
|
|
3370
|
+
queryKey: ['public-warning-list']
|
|
3371
|
+
});
|
|
3372
|
+
case 2:
|
|
3373
|
+
case "end":
|
|
3374
|
+
return _context6.stop();
|
|
3375
|
+
}
|
|
3376
|
+
}, _callee6);
|
|
3377
|
+
}));
|
|
3378
|
+
function onSettled() {
|
|
3379
|
+
return _onSettled.apply(this, arguments);
|
|
3380
|
+
}
|
|
3381
|
+
return onSettled;
|
|
3382
|
+
}()
|
|
3383
|
+
});
|
|
3384
|
+
};
|
|
3385
|
+
var useMutateMaritimeWarningsEditor = function useMutateMaritimeWarningsEditor() {
|
|
3386
|
+
var _useAuthenticationCon7 = useAuthenticationContext(),
|
|
3387
|
+
auth = _useAuthenticationCon7.auth;
|
|
3388
|
+
return useMutation({
|
|
3389
|
+
mutationFn: function mutationFn(_ref0) {
|
|
3390
|
+
var domain = _ref0.domain,
|
|
3391
|
+
isEditor = _ref0.isEditor,
|
|
3392
|
+
force = _ref0.force;
|
|
3393
|
+
if (!auth) {
|
|
3394
|
+
throw new Error('Authentication context not found');
|
|
3395
|
+
}
|
|
3396
|
+
return updateMaritimeWarningsEditor(domain, isEditor, auth, force);
|
|
3397
|
+
}
|
|
3398
|
+
});
|
|
3399
|
+
};
|
|
3400
|
+
var useMaritimeWarningsConfig = function useMaritimeWarningsConfig(disabled) {
|
|
3401
|
+
if (disabled === void 0) {
|
|
3402
|
+
disabled = false;
|
|
3403
|
+
}
|
|
3404
|
+
var maritimeConfigQuery = useAuthQuery(['maritime-warnings-config'], getMaritimeWarningsConfig, disabled);
|
|
3405
|
+
return maritimeConfigQuery;
|
|
3406
|
+
};
|
|
3306
3407
|
|
|
3307
3408
|
var getDeleteDescription = function getDeleteDescription(objectName, t) {
|
|
3308
3409
|
return t('delete-dialog-description') + " \"" + objectName + "\"?";
|
|
@@ -4410,15 +4511,15 @@ var getSigmetList = function getSigmetList(auth) {
|
|
|
4410
4511
|
var getAirmetConfig = function getAirmetConfig(auth) {
|
|
4411
4512
|
return fetch(airmetBaseUrl + "/airmet-config", {
|
|
4412
4513
|
headers: getHeaders(auth)
|
|
4413
|
-
}).then(function (
|
|
4414
|
-
return
|
|
4514
|
+
}).then(function (result) {
|
|
4515
|
+
return result.json();
|
|
4415
4516
|
});
|
|
4416
4517
|
};
|
|
4417
4518
|
var getSigmetConfig = function getSigmetConfig(auth) {
|
|
4418
4519
|
return fetch(sigmetBaseUrl + "/sigmet-config", {
|
|
4419
4520
|
headers: getHeaders(auth)
|
|
4420
|
-
}).then(function (
|
|
4421
|
-
return
|
|
4521
|
+
}).then(function (result) {
|
|
4522
|
+
return result.json();
|
|
4422
4523
|
});
|
|
4423
4524
|
};
|
|
4424
4525
|
var getAirmetTAC = function getAirmetTAC(auth, product) {
|
|
@@ -4427,24 +4528,24 @@ var getAirmetTAC = function getAirmetTAC(auth, product) {
|
|
|
4427
4528
|
method: 'POST',
|
|
4428
4529
|
headers: getHeaders(auth)
|
|
4429
4530
|
}).then(/*#__PURE__*/function () {
|
|
4430
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(
|
|
4531
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(result) {
|
|
4431
4532
|
var textData;
|
|
4432
4533
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
4433
4534
|
while (1) switch (_context.prev = _context.next) {
|
|
4434
4535
|
case 0:
|
|
4435
|
-
if (!(
|
|
4536
|
+
if (!(result.status === 200)) {
|
|
4436
4537
|
_context.next = 5;
|
|
4437
4538
|
break;
|
|
4438
4539
|
}
|
|
4439
4540
|
_context.next = 3;
|
|
4440
|
-
return
|
|
4541
|
+
return result.text();
|
|
4441
4542
|
case 3:
|
|
4442
4543
|
textData = _context.sent;
|
|
4443
4544
|
return _context.abrupt("return", {
|
|
4444
4545
|
data: textData
|
|
4445
4546
|
});
|
|
4446
4547
|
case 5:
|
|
4447
|
-
throw new Error("Failed to fetch TAC data: " +
|
|
4548
|
+
throw new Error("Failed to fetch TAC data: " + result.statusText);
|
|
4448
4549
|
case 6:
|
|
4449
4550
|
case "end":
|
|
4450
4551
|
return _context.stop();
|
|
@@ -4462,24 +4563,24 @@ var getSigmetTAC = function getSigmetTAC(auth, product) {
|
|
|
4462
4563
|
method: 'POST',
|
|
4463
4564
|
headers: getHeaders(auth)
|
|
4464
4565
|
}).then(/*#__PURE__*/function () {
|
|
4465
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(
|
|
4566
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(result) {
|
|
4466
4567
|
var textData;
|
|
4467
4568
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
4468
4569
|
while (1) switch (_context2.prev = _context2.next) {
|
|
4469
4570
|
case 0:
|
|
4470
|
-
if (!(
|
|
4571
|
+
if (!(result.status === 200)) {
|
|
4471
4572
|
_context2.next = 5;
|
|
4472
4573
|
break;
|
|
4473
4574
|
}
|
|
4474
4575
|
_context2.next = 3;
|
|
4475
|
-
return
|
|
4576
|
+
return result.text();
|
|
4476
4577
|
case 3:
|
|
4477
4578
|
textData = _context2.sent;
|
|
4478
4579
|
return _context2.abrupt("return", {
|
|
4479
4580
|
data: textData
|
|
4480
4581
|
});
|
|
4481
4582
|
case 5:
|
|
4482
|
-
throw new Error("Failed to fetch TAC data: " +
|
|
4583
|
+
throw new Error("Failed to fetch TAC data: " + result.statusText);
|
|
4483
4584
|
case 6:
|
|
4484
4585
|
case "end":
|
|
4485
4586
|
return _context2.stop();
|
|
@@ -4703,22 +4804,19 @@ function isCancelSigmet(warningDetail) {
|
|
|
4703
4804
|
return warningDetail.cancelsSigmetSequenceId !== undefined;
|
|
4704
4805
|
}
|
|
4705
4806
|
var flattenPublicWarning = function flattenPublicWarning(publicWarning) {
|
|
4706
|
-
if (publicWarning.type === '
|
|
4707
|
-
|
|
4807
|
+
if (publicWarning.type === 'airmet' || publicWarning.type === 'sigmet') {
|
|
4808
|
+
var sigmetAirmetDetails = publicWarning.sigmetAirmetDetails,
|
|
4809
|
+
rest = _objectWithoutPropertiesLoose(publicWarning, _excluded$6);
|
|
4810
|
+
return Object.assign({}, rest, sigmetAirmetDetails);
|
|
4708
4811
|
}
|
|
4709
|
-
|
|
4710
|
-
rest = _objectWithoutPropertiesLoose(publicWarning, _excluded$6);
|
|
4711
|
-
return Object.assign({}, rest, sigmetAirmetDetails);
|
|
4812
|
+
return {};
|
|
4712
4813
|
};
|
|
4713
|
-
var transformAirmetToWarningFormat = function transformAirmetToWarningFormat(apiAirmet
|
|
4814
|
+
var transformAirmetToWarningFormat = function transformAirmetToWarningFormat(apiAirmet) {
|
|
4815
|
+
var _airmet$startGeometry;
|
|
4714
4816
|
var airmet = apiAirmet.airmet;
|
|
4715
|
-
var tacGeometry =
|
|
4716
|
-
startGeometry: airmet.startGeometry,
|
|
4717
|
-
startGeometryIntersect: airmet.startGeometryIntersect,
|
|
4718
|
-
maxPoints: getMaxPolygonPoints(airmet.locationIndicatorATSR, productConfig)
|
|
4719
|
-
});
|
|
4817
|
+
var tacGeometry = (_airmet$startGeometry = airmet.startGeometryIntersect) != null ? _airmet$startGeometry : airmet.startGeometry;
|
|
4720
4818
|
var areas = [];
|
|
4721
|
-
if (airmet.startGeometry) {
|
|
4819
|
+
if (airmet.startGeometry && tacGeometry.features.length > 0) {
|
|
4722
4820
|
areas.push({
|
|
4723
4821
|
areaId: airmet.uuid + "-start",
|
|
4724
4822
|
geoJSON: Object.assign({}, tacGeometry, {
|
|
@@ -4755,18 +4853,11 @@ var transformAirmetToWarningFormat = function transformAirmetToWarningFormat(api
|
|
|
4755
4853
|
type: 'airmet'
|
|
4756
4854
|
};
|
|
4757
4855
|
};
|
|
4758
|
-
var transformSigmetToWarningFormat = function transformSigmetToWarningFormat(apiSigmet
|
|
4856
|
+
var transformSigmetToWarningFormat = function transformSigmetToWarningFormat(apiSigmet) {
|
|
4857
|
+
var _sigmet$startGeometry, _sigmet$endGeometryIn;
|
|
4759
4858
|
var sigmet = apiSigmet.sigmet;
|
|
4760
|
-
var tacGeometryStart =
|
|
4761
|
-
|
|
4762
|
-
startGeometryIntersect: sigmet.startGeometryIntersect,
|
|
4763
|
-
maxPoints: getMaxPolygonPoints(sigmet.locationIndicatorATSR, productConfig)
|
|
4764
|
-
});
|
|
4765
|
-
var tacGeometryEnd = getTacGeometry({
|
|
4766
|
-
startGeometry: sigmet.endGeometry,
|
|
4767
|
-
startGeometryIntersect: sigmet.endGeometryIntersect,
|
|
4768
|
-
maxPoints: getMaxPolygonPoints(sigmet.locationIndicatorATSR, productConfig)
|
|
4769
|
-
});
|
|
4859
|
+
var tacGeometryStart = (_sigmet$startGeometry = sigmet.startGeometryIntersect) != null ? _sigmet$startGeometry : sigmet.startGeometry;
|
|
4860
|
+
var tacGeometryEnd = (_sigmet$endGeometryIn = sigmet.endGeometryIntersect) != null ? _sigmet$endGeometryIn : sigmet.endGeometry;
|
|
4770
4861
|
var areas = [];
|
|
4771
4862
|
if (sigmet.startGeometry) {
|
|
4772
4863
|
areas.push({
|
|
@@ -5621,15 +5712,80 @@ var ValidUntil = function ValidUntil(_ref) {
|
|
|
5621
5712
|
});
|
|
5622
5713
|
};
|
|
5623
5714
|
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5715
|
+
/* *
|
|
5716
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5717
|
+
* you may not use this file except in compliance with the License.
|
|
5718
|
+
* You may obtain a copy of the License at
|
|
5719
|
+
*
|
|
5720
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5721
|
+
*
|
|
5722
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5723
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5724
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5725
|
+
* See the License for the specific language governing permissions and
|
|
5726
|
+
* limitations under the License.
|
|
5727
|
+
*
|
|
5728
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5729
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
5730
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
5731
|
+
* */
|
|
5732
|
+
function useFilterChipSelect(_ref) {
|
|
5733
|
+
var selectedIds = _ref.selectedIds,
|
|
5734
|
+
assignedIds = _ref.assignedIds,
|
|
5735
|
+
onToggleSelect = _ref.onToggleSelect,
|
|
5736
|
+
onSelectMultiple = _ref.onSelectMultiple;
|
|
5737
|
+
var lastSelectedByClick = React__default.useRef(null);
|
|
5738
|
+
// reset lastSelectedByClick when it disappears from ids list
|
|
5739
|
+
React__default.useEffect(function () {
|
|
5740
|
+
if (lastSelectedByClick.current && (!assignedIds.includes(lastSelectedByClick.current) || !selectedIds.includes(lastSelectedByClick.current))) {
|
|
5741
|
+
lastSelectedByClick.current = null;
|
|
5742
|
+
}
|
|
5743
|
+
}, [assignedIds, selectedIds]);
|
|
5744
|
+
return {
|
|
5745
|
+
handleChipClick: function handleChipClick(id, event) {
|
|
5746
|
+
if (event.shiftKey && lastSelectedByClick.current) {
|
|
5747
|
+
var assignedAreasIdsArray = Array.from(assignedIds);
|
|
5748
|
+
var lastClickedIndex = assignedAreasIdsArray.indexOf(lastSelectedByClick.current);
|
|
5749
|
+
var clickedIndex = assignedAreasIdsArray.indexOf(id);
|
|
5750
|
+
var firstIndex = Math.min(clickedIndex, lastClickedIndex);
|
|
5751
|
+
var secondIndex = Math.max(clickedIndex, lastClickedIndex);
|
|
5752
|
+
onSelectMultiple == null || onSelectMultiple(assignedAreasIdsArray.slice(firstIndex, secondIndex + 1));
|
|
5753
|
+
} else {
|
|
5754
|
+
var idIsSelected = selectedIds.includes(id);
|
|
5755
|
+
if (!idIsSelected) {
|
|
5756
|
+
lastSelectedByClick.current = id;
|
|
5757
|
+
} else {
|
|
5758
|
+
lastSelectedByClick.current = null;
|
|
5759
|
+
}
|
|
5760
|
+
onToggleSelect == null || onToggleSelect(id);
|
|
5761
|
+
}
|
|
5762
|
+
}
|
|
5763
|
+
};
|
|
5764
|
+
}
|
|
5765
|
+
|
|
5766
|
+
var AreaList = /*#__PURE__*/React__default.memo(function (_ref2) {
|
|
5767
|
+
var areas = _ref2.areas,
|
|
5768
|
+
selected = _ref2.selected,
|
|
5769
|
+
disabled = _ref2.disabled,
|
|
5770
|
+
isReadOnly = _ref2.isReadOnly,
|
|
5771
|
+
onToggleSelectArea = _ref2.onToggleSelectArea,
|
|
5772
|
+
onSelectMultipleAreas = _ref2.onSelectMultipleAreas;
|
|
5773
|
+
var _useFilterChipSelect = useFilterChipSelect({
|
|
5774
|
+
selectedIds: selected,
|
|
5775
|
+
assignedIds: areas.map(function (area) {
|
|
5776
|
+
return area.districtName;
|
|
5777
|
+
}),
|
|
5778
|
+
onSelectMultiple: onSelectMultipleAreas,
|
|
5779
|
+
onToggleSelect: onToggleSelectArea
|
|
5780
|
+
}),
|
|
5781
|
+
handleChipClick = _useFilterChipSelect.handleChipClick;
|
|
5629
5782
|
return jsx(Stack, {
|
|
5630
5783
|
"data-testid": "arealist",
|
|
5631
5784
|
direction: "row",
|
|
5632
5785
|
spacing: 1,
|
|
5786
|
+
style: {
|
|
5787
|
+
pointerEvents: !isReadOnly ? 'auto' : 'none'
|
|
5788
|
+
},
|
|
5633
5789
|
sx: {
|
|
5634
5790
|
display: 'block',
|
|
5635
5791
|
'.MuiChip-root': {
|
|
@@ -5639,18 +5795,20 @@ var AreaList = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
5639
5795
|
}
|
|
5640
5796
|
},
|
|
5641
5797
|
children: areas.map(function (area) {
|
|
5642
|
-
var isDisabled = disabled.includes(area.
|
|
5643
|
-
var isSelected = !isDisabled && selected.includes(area.
|
|
5798
|
+
var isDisabled = disabled.includes(area.districtName);
|
|
5799
|
+
var isSelected = !isDisabled && selected.includes(area.districtName);
|
|
5644
5800
|
return jsx(FilterChip, {
|
|
5645
|
-
id: area.
|
|
5646
|
-
label: area.
|
|
5801
|
+
id: area.districtName,
|
|
5802
|
+
label: area.districtName,
|
|
5647
5803
|
isSelected: isSelected,
|
|
5648
5804
|
isDisabled: isDisabled,
|
|
5649
|
-
onClick: function onClick() {
|
|
5650
|
-
|
|
5805
|
+
onClick: function onClick(_ref, event) {
|
|
5806
|
+
if (!isReadOnly) {
|
|
5807
|
+
handleChipClick == null || handleChipClick(area.districtName, event);
|
|
5808
|
+
}
|
|
5651
5809
|
},
|
|
5652
5810
|
size: "medium"
|
|
5653
|
-
}, area.
|
|
5811
|
+
}, area.districtName);
|
|
5654
5812
|
})
|
|
5655
5813
|
});
|
|
5656
5814
|
});
|
|
@@ -5709,38 +5867,52 @@ var WarningListHeaderContent = function WarningListHeaderContent(_ref) {
|
|
|
5709
5867
|
};
|
|
5710
5868
|
|
|
5711
5869
|
var AssignedAreas = function AssignedAreas(_ref) {
|
|
5712
|
-
var _sx;
|
|
5870
|
+
var _sx, _sx2;
|
|
5713
5871
|
var assignedAreas = _ref.assignedAreas,
|
|
5714
5872
|
selectedAreaIds = _ref.selectedAreaIds,
|
|
5715
5873
|
onAddClick = _ref.onAddClick,
|
|
5716
5874
|
onDeleteClick = _ref.onDeleteClick,
|
|
5717
5875
|
onToggleSelectArea = _ref.onToggleSelectArea,
|
|
5876
|
+
onSelectMultipleAreas = _ref.onSelectMultipleAreas,
|
|
5877
|
+
_ref$isReadOnly = _ref.isReadOnly,
|
|
5878
|
+
isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
|
|
5718
5879
|
_ref$shouldShowDistri = _ref.shouldShowDistricts,
|
|
5719
5880
|
shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri;
|
|
5720
5881
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
5721
5882
|
t = _useWarningsTranslati.t;
|
|
5722
5883
|
var assignedAreaIds = React__default.useMemo(function () {
|
|
5723
5884
|
return new Set(assignedAreas.map(function (area) {
|
|
5724
|
-
return area.
|
|
5885
|
+
return area.districtName;
|
|
5725
5886
|
}));
|
|
5726
5887
|
}, [assignedAreas]);
|
|
5727
5888
|
// can add the selected areas when they don't appear in the assigned area list
|
|
5728
5889
|
var canAddSelectedAreas = React__default.useMemo(function () {
|
|
5729
|
-
return selectedAreaIds.length > 0 && selectedAreaIds.
|
|
5890
|
+
return !isReadOnly && selectedAreaIds.length > 0 && selectedAreaIds.some(function (id) {
|
|
5730
5891
|
return !assignedAreaIds.has(id);
|
|
5731
5892
|
});
|
|
5732
|
-
}, [selectedAreaIds, assignedAreaIds]);
|
|
5893
|
+
}, [isReadOnly, selectedAreaIds, assignedAreaIds]);
|
|
5894
|
+
var assignedAreaIdsArray = React__default.useMemo(function () {
|
|
5895
|
+
return Array.from(assignedAreaIds);
|
|
5896
|
+
}, [assignedAreaIds]);
|
|
5897
|
+
var _useFilterChipSelect = useFilterChipSelect({
|
|
5898
|
+
selectedIds: selectedAreaIds,
|
|
5899
|
+
assignedIds: assignedAreaIdsArray,
|
|
5900
|
+
onSelectMultiple: onSelectMultipleAreas,
|
|
5901
|
+
onToggleSelect: onToggleSelectArea
|
|
5902
|
+
}),
|
|
5903
|
+
handleChipClick = _useFilterChipSelect.handleChipClick;
|
|
5733
5904
|
var theme = useTheme();
|
|
5734
5905
|
return jsxs(Box, {
|
|
5735
|
-
sx: {
|
|
5906
|
+
sx: (_sx = {
|
|
5736
5907
|
display: 'flex',
|
|
5737
5908
|
gridArea: 'areas',
|
|
5738
5909
|
gap: 1,
|
|
5739
5910
|
minHeight: 32,
|
|
5740
|
-
marginLeft: 1,
|
|
5741
5911
|
paddingInline: 0.5,
|
|
5742
5912
|
borderRadius: 1
|
|
5743
|
-
},
|
|
5913
|
+
}, _sx["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
5914
|
+
marginLeft: 1
|
|
5915
|
+
}, _sx),
|
|
5744
5916
|
style: {
|
|
5745
5917
|
backgroundColor: canAddSelectedAreas ? theme.palette.geowebColors.cards.cardContainerMouseOver : undefined
|
|
5746
5918
|
},
|
|
@@ -5752,33 +5924,38 @@ var AssignedAreas = function AssignedAreas(_ref) {
|
|
|
5752
5924
|
},
|
|
5753
5925
|
children: shouldShowDistricts ? t('maritime-no-district-selected') : t('maritime-no-area-selected')
|
|
5754
5926
|
}), jsx(Box, {
|
|
5755
|
-
sx: (
|
|
5927
|
+
sx: (_sx2 = {
|
|
5756
5928
|
flexGrow: 1,
|
|
5757
5929
|
display: 'flex',
|
|
5758
5930
|
flexDirection: 'column',
|
|
5759
5931
|
gap: 0.5,
|
|
5760
5932
|
paddingBlock: 0.5,
|
|
5761
5933
|
alignItems: 'flex-start'
|
|
5762
|
-
},
|
|
5934
|
+
}, _sx2["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
5763
5935
|
flexWrap: 'wrap',
|
|
5764
5936
|
flexDirection: 'row'
|
|
5765
|
-
},
|
|
5937
|
+
}, _sx2),
|
|
5938
|
+
style: {
|
|
5939
|
+
pointerEvents: !isReadOnly ? 'auto' : 'none'
|
|
5940
|
+
},
|
|
5766
5941
|
children: assignedAreas.map(function (area) {
|
|
5767
|
-
var isSelected = selectedAreaIds.includes(area.
|
|
5942
|
+
var isSelected = selectedAreaIds.includes(area.districtName);
|
|
5768
5943
|
return jsx(FilterChip, {
|
|
5769
5944
|
size: "small",
|
|
5770
|
-
id: area.
|
|
5771
|
-
label: area.
|
|
5945
|
+
id: area.districtName,
|
|
5946
|
+
label: area.districtName,
|
|
5772
5947
|
isSelected: isSelected,
|
|
5773
|
-
onClick: function onClick() {
|
|
5774
|
-
|
|
5948
|
+
onClick: function onClick(_chipRef, event) {
|
|
5949
|
+
if (!isReadOnly) {
|
|
5950
|
+
handleChipClick(area.districtName, event);
|
|
5951
|
+
}
|
|
5775
5952
|
},
|
|
5776
|
-
onClickIcon: isSelected ? function () {
|
|
5777
|
-
|
|
5953
|
+
onClickIcon: isSelected && !isReadOnly ? function () {
|
|
5954
|
+
onDeleteClick(area.districtName);
|
|
5778
5955
|
} : undefined
|
|
5779
|
-
}, area.
|
|
5956
|
+
}, area.districtName);
|
|
5780
5957
|
})
|
|
5781
|
-
}), jsx(AddButton, {
|
|
5958
|
+
}), !isReadOnly && jsx(AddButton, {
|
|
5782
5959
|
show: canAddSelectedAreas,
|
|
5783
5960
|
onClick: onAddClick
|
|
5784
5961
|
})]
|
|
@@ -5817,8 +5994,10 @@ var WarningListSelect = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
5817
5994
|
renderValue = _ref.renderValue,
|
|
5818
5995
|
gridArea = _ref.gridArea,
|
|
5819
5996
|
additionalStyling = _ref.additionalStyling,
|
|
5820
|
-
_ref$
|
|
5821
|
-
|
|
5997
|
+
_ref$isReadOnly = _ref.isReadOnly,
|
|
5998
|
+
isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
|
|
5999
|
+
_ref$displayEmpty = _ref.displayEmpty,
|
|
6000
|
+
displayEmpty = _ref$displayEmpty === void 0 ? false : _ref$displayEmpty;
|
|
5822
6001
|
var currentIndex = options.findIndex(function (option) {
|
|
5823
6002
|
return option.value === value;
|
|
5824
6003
|
});
|
|
@@ -5833,14 +6012,25 @@ var WarningListSelect = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
5833
6012
|
style: {
|
|
5834
6013
|
maxWidth: '100%'
|
|
5835
6014
|
},
|
|
5836
|
-
isEnabled: !
|
|
5837
|
-
disabled:
|
|
6015
|
+
isEnabled: !isReadOnly,
|
|
6016
|
+
disabled: isReadOnly,
|
|
5838
6017
|
value: value != null ? value : '',
|
|
6018
|
+
displayEmpty: displayEmpty,
|
|
5839
6019
|
SelectDisplayProps: {
|
|
5840
6020
|
'aria-label': label
|
|
5841
6021
|
},
|
|
5842
6022
|
list: options,
|
|
5843
|
-
additionalStyling:
|
|
6023
|
+
additionalStyling: Object.assign({
|
|
6024
|
+
'&.Mui-disabled .MuiSvgIcon-root': {
|
|
6025
|
+
display: 'none'
|
|
6026
|
+
},
|
|
6027
|
+
'&.Mui-disabled': {
|
|
6028
|
+
color: 'inherit',
|
|
6029
|
+
'& .MuiInput-input': {
|
|
6030
|
+
WebkitTextFillColor: 'inherit'
|
|
6031
|
+
}
|
|
6032
|
+
}
|
|
6033
|
+
}, additionalStyling),
|
|
5844
6034
|
currentIndex: currentIndex > -1 ? currentIndex : undefined,
|
|
5845
6035
|
renderValue: renderValue,
|
|
5846
6036
|
onChange: function onChange(event) {
|
|
@@ -5899,7 +6089,8 @@ var WindForceSelect = function WindForceSelect(_ref) {
|
|
|
5899
6089
|
var onChange = _ref.onChange,
|
|
5900
6090
|
value = _ref.value,
|
|
5901
6091
|
gridArea = _ref.gridArea,
|
|
5902
|
-
options = _ref.options
|
|
6092
|
+
options = _ref.options,
|
|
6093
|
+
isReadOnly = _ref.isReadOnly;
|
|
5903
6094
|
var warningListOptions = React__default.useMemo(function () {
|
|
5904
6095
|
return options.map(function (option) {
|
|
5905
6096
|
return {
|
|
@@ -5968,6 +6159,7 @@ var WindForceSelect = function WindForceSelect(_ref) {
|
|
|
5968
6159
|
onChange: onChange,
|
|
5969
6160
|
renderOption: renderOption,
|
|
5970
6161
|
renderValue: renderValue,
|
|
6162
|
+
isReadOnly: isReadOnly,
|
|
5971
6163
|
additionalStyling: {
|
|
5972
6164
|
'& .MuiSvgIcon-root': {
|
|
5973
6165
|
fill: arrowColor
|
|
@@ -5979,126 +6171,6 @@ var WindForceSelect = function WindForceSelect(_ref) {
|
|
|
5979
6171
|
});
|
|
5980
6172
|
};
|
|
5981
6173
|
|
|
5982
|
-
var windDirections = [{
|
|
5983
|
-
value: 'NORTH',
|
|
5984
|
-
label: function label(t) {
|
|
5985
|
-
return t('maritime-direction-n');
|
|
5986
|
-
}
|
|
5987
|
-
}, {
|
|
5988
|
-
value: 'NORTH_TO_NORTHEAST',
|
|
5989
|
-
label: function label(t) {
|
|
5990
|
-
return t('maritime-direction-nne');
|
|
5991
|
-
}
|
|
5992
|
-
}, {
|
|
5993
|
-
value: 'NORTHEAST',
|
|
5994
|
-
label: function label(t) {
|
|
5995
|
-
return t('maritime-direction-ne');
|
|
5996
|
-
}
|
|
5997
|
-
}, {
|
|
5998
|
-
value: 'NORTHEAST_TO_NORTH',
|
|
5999
|
-
label: function label(t) {
|
|
6000
|
-
return t('maritime-direction-nen');
|
|
6001
|
-
}
|
|
6002
|
-
}, {
|
|
6003
|
-
value: 'EAST',
|
|
6004
|
-
label: function label(t) {
|
|
6005
|
-
return t('maritime-direction-e');
|
|
6006
|
-
}
|
|
6007
|
-
}, {
|
|
6008
|
-
value: 'EAST_TO_SOUTHEAST',
|
|
6009
|
-
label: function label(t) {
|
|
6010
|
-
return t('maritime-direction-ese');
|
|
6011
|
-
}
|
|
6012
|
-
}, {
|
|
6013
|
-
value: 'SOUTHEAST',
|
|
6014
|
-
label: function label(t) {
|
|
6015
|
-
return t('maritime-direction-se');
|
|
6016
|
-
}
|
|
6017
|
-
}, {
|
|
6018
|
-
value: 'SOUTHEAST_TO_SOUTH',
|
|
6019
|
-
label: function label(t) {
|
|
6020
|
-
return t('maritime-direction-ses');
|
|
6021
|
-
}
|
|
6022
|
-
}, {
|
|
6023
|
-
value: 'SOUTH',
|
|
6024
|
-
label: function label(t) {
|
|
6025
|
-
return t('maritime-direction-s');
|
|
6026
|
-
}
|
|
6027
|
-
}, {
|
|
6028
|
-
value: 'SOUTH_TO_SOUTHWEST',
|
|
6029
|
-
label: function label(t) {
|
|
6030
|
-
return t('maritime-direction-ssw');
|
|
6031
|
-
}
|
|
6032
|
-
}, {
|
|
6033
|
-
value: 'SOUTHWEST',
|
|
6034
|
-
label: function label(t) {
|
|
6035
|
-
return t('maritime-direction-sw');
|
|
6036
|
-
}
|
|
6037
|
-
}, {
|
|
6038
|
-
value: 'SOUTHWEST_TO_WEST',
|
|
6039
|
-
label: function label(t) {
|
|
6040
|
-
return t('maritime-direction-sww');
|
|
6041
|
-
}
|
|
6042
|
-
}, {
|
|
6043
|
-
value: 'WEST',
|
|
6044
|
-
label: function label(t) {
|
|
6045
|
-
return t('maritime-direction-w');
|
|
6046
|
-
}
|
|
6047
|
-
}, {
|
|
6048
|
-
value: 'WEST_TO_NORTHWEST',
|
|
6049
|
-
label: function label(t) {
|
|
6050
|
-
return t('maritime-direction-wnw');
|
|
6051
|
-
}
|
|
6052
|
-
}, {
|
|
6053
|
-
value: 'NORTHWEST',
|
|
6054
|
-
label: function label(t) {
|
|
6055
|
-
return t('maritime-direction-nw');
|
|
6056
|
-
}
|
|
6057
|
-
}, {
|
|
6058
|
-
value: 'NORTHWEST_TO_NORTH',
|
|
6059
|
-
label: function label(t) {
|
|
6060
|
-
return t('maritime-direction-nwn');
|
|
6061
|
-
}
|
|
6062
|
-
}];
|
|
6063
|
-
var change = [{
|
|
6064
|
-
value: 'NO_CHANGE',
|
|
6065
|
-
label: function label(t) {
|
|
6066
|
-
return t('maritime-no-change');
|
|
6067
|
-
}
|
|
6068
|
-
}, {
|
|
6069
|
-
value: 'BACKING',
|
|
6070
|
-
label: function label(t) {
|
|
6071
|
-
return t('maritime-backing');
|
|
6072
|
-
}
|
|
6073
|
-
}, {
|
|
6074
|
-
value: 'VEERING',
|
|
6075
|
-
label: function label(t) {
|
|
6076
|
-
return t('maritime-veering');
|
|
6077
|
-
}
|
|
6078
|
-
}];
|
|
6079
|
-
var windForce = [{
|
|
6080
|
-
level: WindForceLevel.extreme,
|
|
6081
|
-
value: '12'
|
|
6082
|
-
}, {
|
|
6083
|
-
level: WindForceLevel.extreme,
|
|
6084
|
-
value: '11'
|
|
6085
|
-
}, {
|
|
6086
|
-
level: WindForceLevel.extreme,
|
|
6087
|
-
value: '10'
|
|
6088
|
-
}, {
|
|
6089
|
-
level: WindForceLevel.severe,
|
|
6090
|
-
value: '9'
|
|
6091
|
-
}, {
|
|
6092
|
-
level: WindForceLevel.severe,
|
|
6093
|
-
value: '8'
|
|
6094
|
-
}, {
|
|
6095
|
-
level: WindForceLevel.moderate,
|
|
6096
|
-
value: '7'
|
|
6097
|
-
}, {
|
|
6098
|
-
level: WindForceLevel.moderate,
|
|
6099
|
-
value: '6'
|
|
6100
|
-
}];
|
|
6101
|
-
|
|
6102
6174
|
var WarningListDragHandle = function WarningListDragHandle() {
|
|
6103
6175
|
return jsx(CustomIconButton, {
|
|
6104
6176
|
className: "handle",
|
|
@@ -6115,6 +6187,38 @@ var WarningListDragHandle = function WarningListDragHandle() {
|
|
|
6115
6187
|
});
|
|
6116
6188
|
};
|
|
6117
6189
|
|
|
6190
|
+
var getWindDirectionsFromConfig = function getWindDirectionsFromConfig(directionConfig, t) {
|
|
6191
|
+
return directionConfig.map(function (direction) {
|
|
6192
|
+
return {
|
|
6193
|
+
value: direction.value,
|
|
6194
|
+
label: t("maritime-direction-" + direction.value) || direction.label
|
|
6195
|
+
};
|
|
6196
|
+
});
|
|
6197
|
+
};
|
|
6198
|
+
var getWindForceFromConfig = function getWindForceFromConfig(forceConfig) {
|
|
6199
|
+
if (forceConfig.maritimeLevelsSummer) {
|
|
6200
|
+
return forceConfig.maritimeLevelsSummer.map(function (force) {
|
|
6201
|
+
return {
|
|
6202
|
+
value: force.windForce,
|
|
6203
|
+
level: force.level
|
|
6204
|
+
};
|
|
6205
|
+
});
|
|
6206
|
+
}
|
|
6207
|
+
return forceConfig.maritimeLevelsWinter.map(function (force) {
|
|
6208
|
+
return {
|
|
6209
|
+
value: force.windForce,
|
|
6210
|
+
level: force.level
|
|
6211
|
+
};
|
|
6212
|
+
});
|
|
6213
|
+
};
|
|
6214
|
+
var getChangeTypeFromConfig = function getChangeTypeFromConfig(changeConfig, t) {
|
|
6215
|
+
return changeConfig.map(function (change) {
|
|
6216
|
+
return {
|
|
6217
|
+
value: change.key,
|
|
6218
|
+
label: t("maritime-change-" + change.key) || change.label
|
|
6219
|
+
};
|
|
6220
|
+
});
|
|
6221
|
+
};
|
|
6118
6222
|
var WarningListItem$1 = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
6119
6223
|
var warning = _ref.warning,
|
|
6120
6224
|
areas = _ref.areas,
|
|
@@ -6123,12 +6227,15 @@ var WarningListItem$1 = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
6123
6227
|
onRemove = _ref.onRemove,
|
|
6124
6228
|
onChange = _ref.onChange,
|
|
6125
6229
|
onToggleSelectArea = _ref.onToggleSelectArea,
|
|
6230
|
+
onSelectMultipleAreas = _ref.onSelectMultipleAreas,
|
|
6126
6231
|
onRemoveArea = _ref.onRemoveArea,
|
|
6232
|
+
isReadOnly = _ref.isReadOnly,
|
|
6127
6233
|
_ref$shouldShowDistri = _ref.shouldShowDistricts,
|
|
6128
|
-
shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri
|
|
6234
|
+
shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri,
|
|
6235
|
+
maritimeConfig = _ref.maritimeConfig;
|
|
6129
6236
|
var areasById = React__default.useMemo(function () {
|
|
6130
6237
|
return new Map(areas.map(function (area) {
|
|
6131
|
-
return [area.
|
|
6238
|
+
return [area.districtName, area];
|
|
6132
6239
|
}));
|
|
6133
6240
|
}, [areas]);
|
|
6134
6241
|
var assignedAreas = React__default.useMemo(function () {
|
|
@@ -6168,41 +6275,64 @@ var WarningListItem$1 = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
6168
6275
|
var handleAddClick = React__default.useCallback(function () {
|
|
6169
6276
|
onAddClick(warning.id);
|
|
6170
6277
|
}, [warning.id, onAddClick]);
|
|
6171
|
-
var shouldDisableDirTo = warning.changeType === 'NO_CHANGE';
|
|
6278
|
+
var shouldDisableDirTo = warning.changeType === 'NO_CHANGE' || isReadOnly;
|
|
6279
|
+
var changeOptions = getChangeTypeFromConfig(maritimeConfig.changeType, t);
|
|
6172
6280
|
return jsxs(StyledItem, {
|
|
6173
6281
|
"data-testid": "maritime-warning",
|
|
6174
|
-
children: [jsx(WarningListDragHandle, {}), jsx(WarningListSelect, {
|
|
6282
|
+
children: [!isReadOnly && jsx(WarningListDragHandle, {}), jsx(WarningListSelect, {
|
|
6175
6283
|
gridArea: "dirFrom",
|
|
6176
6284
|
label: t('maritime-header-direction-from'),
|
|
6177
|
-
options:
|
|
6285
|
+
options: getWindDirectionsFromConfig(maritimeConfig.windDirectionDefinition, t),
|
|
6178
6286
|
onChange: handleChangeFromDirection,
|
|
6179
|
-
value: warning.windDirectionFrom
|
|
6287
|
+
value: warning.windDirectionFrom,
|
|
6288
|
+
isReadOnly: isReadOnly
|
|
6180
6289
|
}), jsx(WindForceSelect, {
|
|
6181
6290
|
gridArea: "windForce",
|
|
6182
6291
|
value: warning.windForce,
|
|
6183
|
-
options:
|
|
6184
|
-
onChange: handleChangeWindForce
|
|
6292
|
+
options: getWindForceFromConfig(maritimeConfig.maritimeLevelDefinition),
|
|
6293
|
+
onChange: handleChangeWindForce,
|
|
6294
|
+
isReadOnly: isReadOnly
|
|
6185
6295
|
}), jsx(AssignedAreas, {
|
|
6186
6296
|
assignedAreas: assignedAreas,
|
|
6187
6297
|
selectedAreaIds: selectedAreaIds,
|
|
6188
6298
|
onAddClick: handleAddClick,
|
|
6189
6299
|
onToggleSelectArea: onToggleSelectArea,
|
|
6300
|
+
onSelectMultipleAreas: onSelectMultipleAreas,
|
|
6190
6301
|
onDeleteClick: onRemoveArea,
|
|
6191
|
-
shouldShowDistricts: shouldShowDistricts
|
|
6302
|
+
shouldShowDistricts: shouldShowDistricts,
|
|
6303
|
+
isReadOnly: isReadOnly
|
|
6192
6304
|
}), jsx(WarningListSelect, {
|
|
6193
6305
|
gridArea: "changeType",
|
|
6194
6306
|
label: t('maritime-header-change'),
|
|
6195
|
-
options:
|
|
6307
|
+
options: changeOptions,
|
|
6196
6308
|
onChange: handleChangeWindChangeType,
|
|
6197
|
-
value: warning.changeType
|
|
6309
|
+
value: warning.changeType,
|
|
6310
|
+
isReadOnly: isReadOnly,
|
|
6311
|
+
renderValue: function renderValue(value) {
|
|
6312
|
+
if (value === '') {
|
|
6313
|
+
return jsx(Typography, {
|
|
6314
|
+
variant: "caption",
|
|
6315
|
+
color: "textSecondary",
|
|
6316
|
+
sx: {
|
|
6317
|
+
alignSelf: 'center'
|
|
6318
|
+
},
|
|
6319
|
+
children: t('maritime-no-change-selected')
|
|
6320
|
+
});
|
|
6321
|
+
}
|
|
6322
|
+
var option = changeOptions.find(function (item) {
|
|
6323
|
+
return item.value === value;
|
|
6324
|
+
});
|
|
6325
|
+
return typeof (option == null ? void 0 : option.label) === 'function' ? option.label(t) : option == null ? void 0 : option.label;
|
|
6326
|
+
},
|
|
6327
|
+
displayEmpty: true
|
|
6198
6328
|
}), jsx(WarningListSelect, {
|
|
6199
6329
|
gridArea: "dirTo",
|
|
6200
6330
|
label: t('maritime-header-direction-to'),
|
|
6201
|
-
options:
|
|
6331
|
+
options: getWindDirectionsFromConfig(maritimeConfig.windDirectionDefinition, t),
|
|
6202
6332
|
onChange: handleChangeToDirection,
|
|
6203
6333
|
value: warning.windDirectionTo,
|
|
6204
|
-
|
|
6205
|
-
}), jsx(CustomIconButton, {
|
|
6334
|
+
isReadOnly: shouldDisableDirTo
|
|
6335
|
+
}), !isReadOnly && jsx(CustomIconButton, {
|
|
6206
6336
|
sx: {
|
|
6207
6337
|
gridArea: 'delete',
|
|
6208
6338
|
justifySelf: 'end',
|
|
@@ -6235,7 +6365,7 @@ var StyledItem = styled('div')(function (_ref2) {
|
|
|
6235
6365
|
paddingInline: theme.spacing(0.25),
|
|
6236
6366
|
// styling for small windows
|
|
6237
6367
|
gridTemplateAreas: "\n \"drag dirFrom dirFrom windForce delete\"\n \". areas areas areas .\"\n \". changeType dirTo dirTo .\" \n ",
|
|
6238
|
-
gridTemplateColumns: '
|
|
6368
|
+
gridTemplateColumns: '20px minmax(87px, 1fr) 1fr minmax(60px, 1fr) 20px'
|
|
6239
6369
|
}, _ref3["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
6240
6370
|
gridTemplateAreas: "\n \"drag dirFrom windForce areas changeType dirTo delete\" \n ",
|
|
6241
6371
|
gridTemplateColumns: 'var(--grid-columns)'
|
|
@@ -6252,9 +6382,12 @@ var WarningList = function WarningList(_ref) {
|
|
|
6252
6382
|
onRemoveArea = _ref.onRemoveArea,
|
|
6253
6383
|
onChangeWarning = _ref.onChangeWarning,
|
|
6254
6384
|
onToggleSelectArea = _ref.onToggleSelectArea,
|
|
6385
|
+
onSelectMultipleAreas = _ref.onSelectMultipleAreas,
|
|
6255
6386
|
onMoveWarning = _ref.onMoveWarning,
|
|
6387
|
+
isReadOnly = _ref.isReadOnly,
|
|
6256
6388
|
_ref$shouldShowDistri = _ref.shouldShowDistricts,
|
|
6257
|
-
shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri
|
|
6389
|
+
shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri,
|
|
6390
|
+
maritimeConfig = _ref.maritimeConfig;
|
|
6258
6391
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
6259
6392
|
t = _useWarningsTranslati.t;
|
|
6260
6393
|
var onSort = React__default.useCallback(function (event) {
|
|
@@ -6266,7 +6399,8 @@ var WarningList = function WarningList(_ref) {
|
|
|
6266
6399
|
display: 'flex',
|
|
6267
6400
|
flexDirection: 'column',
|
|
6268
6401
|
minHeight: 0,
|
|
6269
|
-
|
|
6402
|
+
marginBottom: 1,
|
|
6403
|
+
'--grid-columns': '30px 150px 60px 2fr 150px 150px 1fr'
|
|
6270
6404
|
},
|
|
6271
6405
|
children: [jsxs(Box, {
|
|
6272
6406
|
sx: (_sx = {
|
|
@@ -6307,12 +6441,15 @@ var WarningList = function WarningList(_ref) {
|
|
|
6307
6441
|
warning: warning,
|
|
6308
6442
|
areas: areas,
|
|
6309
6443
|
selectedAreaIds: selectedAreaIds,
|
|
6444
|
+
isReadOnly: isReadOnly,
|
|
6310
6445
|
onToggleSelectArea: onToggleSelectArea,
|
|
6446
|
+
onSelectMultipleAreas: onSelectMultipleAreas,
|
|
6311
6447
|
onAddClick: onAddSelectedAreas,
|
|
6312
6448
|
onRemove: onRemoveWarning,
|
|
6313
6449
|
onChange: onChangeWarning,
|
|
6314
6450
|
onRemoveArea: onRemoveArea,
|
|
6315
|
-
shouldShowDistricts: shouldShowDistricts
|
|
6451
|
+
shouldShowDistricts: shouldShowDistricts,
|
|
6452
|
+
maritimeConfig: maritimeConfig
|
|
6316
6453
|
}, warning.id);
|
|
6317
6454
|
})
|
|
6318
6455
|
})]
|
|
@@ -6379,6 +6516,16 @@ function reducer(state, action) {
|
|
|
6379
6516
|
selectedAreaIds: [].concat(state.selectedAreaIds, [action.id])
|
|
6380
6517
|
});
|
|
6381
6518
|
}
|
|
6519
|
+
case 'selectMultipleAreas':
|
|
6520
|
+
{
|
|
6521
|
+
var newSelectedAreaIds = new Set([].concat(state.selectedAreaIds, action.ids));
|
|
6522
|
+
if (newSelectedAreaIds.size === state.selectedAreaIds.length) {
|
|
6523
|
+
return state;
|
|
6524
|
+
}
|
|
6525
|
+
return Object.assign({}, state, {
|
|
6526
|
+
selectedAreaIds: Array.from(newSelectedAreaIds)
|
|
6527
|
+
});
|
|
6528
|
+
}
|
|
6382
6529
|
case 'removeArea':
|
|
6383
6530
|
{
|
|
6384
6531
|
return Object.assign({}, state, {
|
|
@@ -6464,6 +6611,32 @@ function reducer(state, action) {
|
|
|
6464
6611
|
modified: true
|
|
6465
6612
|
});
|
|
6466
6613
|
}
|
|
6614
|
+
case 'mergeWarnings':
|
|
6615
|
+
{
|
|
6616
|
+
var clonedWarnings = new Set();
|
|
6617
|
+
var mergedWarnings = state.warnings.reduce(function (acc, warning) {
|
|
6618
|
+
var relatedWarningIndex = acc.findLastIndex(function (otherWarning) {
|
|
6619
|
+
return warning.windDirectionFrom === otherWarning.windDirectionFrom && warning.windForce === otherWarning.windForce && warning.changeType === otherWarning.changeType && warning.windDirectionTo === otherWarning.windDirectionTo;
|
|
6620
|
+
});
|
|
6621
|
+
if (relatedWarningIndex > -1) {
|
|
6622
|
+
var relatedWarning = acc[relatedWarningIndex];
|
|
6623
|
+
// clone the warning to make sure React knows that it is a new warning
|
|
6624
|
+
if (!clonedWarnings.has(relatedWarningIndex)) {
|
|
6625
|
+
clonedWarnings.add(relatedWarningIndex);
|
|
6626
|
+
var clonedRelatedWarning = Object.assign({}, relatedWarning, {
|
|
6627
|
+
assignedAreaIds: [].concat(relatedWarning.assignedAreaIds, warning.assignedAreaIds)
|
|
6628
|
+
});
|
|
6629
|
+
return acc["with"](relatedWarningIndex, clonedRelatedWarning);
|
|
6630
|
+
}
|
|
6631
|
+
relatedWarning.assignedAreaIds = [].concat(relatedWarning.assignedAreaIds, warning.assignedAreaIds);
|
|
6632
|
+
return acc;
|
|
6633
|
+
}
|
|
6634
|
+
return [].concat(acc, [warning]);
|
|
6635
|
+
}, []);
|
|
6636
|
+
return Object.assign({}, state, {
|
|
6637
|
+
warnings: mergedWarnings
|
|
6638
|
+
});
|
|
6639
|
+
}
|
|
6467
6640
|
case 'initialize':
|
|
6468
6641
|
{
|
|
6469
6642
|
if (action.warnings.length === 0) {
|
|
@@ -6474,6 +6647,12 @@ function reducer(state, action) {
|
|
|
6474
6647
|
selectedAreaIds: []
|
|
6475
6648
|
});
|
|
6476
6649
|
}
|
|
6650
|
+
case 'submitWarnings':
|
|
6651
|
+
{
|
|
6652
|
+
return Object.assign({}, state, {
|
|
6653
|
+
modified: false
|
|
6654
|
+
});
|
|
6655
|
+
}
|
|
6477
6656
|
default:
|
|
6478
6657
|
{
|
|
6479
6658
|
return state;
|
|
@@ -6487,36 +6666,46 @@ function useMaritimeWarningsFormState() {
|
|
|
6487
6666
|
function useConfirmRetractDialog(_ref) {
|
|
6488
6667
|
var areas = _ref.areas,
|
|
6489
6668
|
warnings = _ref.warnings,
|
|
6669
|
+
maritimeConfig = _ref.maritimeConfig,
|
|
6490
6670
|
onRemoveWarning = _ref.onRemoveWarning;
|
|
6491
6671
|
var confirmDialog = useConfirmationDialog();
|
|
6492
6672
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
6493
6673
|
t = _useWarningsTranslati.t;
|
|
6494
|
-
var
|
|
6495
|
-
var option =
|
|
6496
|
-
return
|
|
6674
|
+
var getLabelFromWindDirectionConfig = React__default.useCallback(function (directionConfig, value) {
|
|
6675
|
+
var option = directionConfig.find(function (direction) {
|
|
6676
|
+
return direction.value === value;
|
|
6677
|
+
});
|
|
6678
|
+
if (!option) {
|
|
6679
|
+
return '';
|
|
6680
|
+
}
|
|
6681
|
+
return t("maritime-direction-" + option.value);
|
|
6682
|
+
}, [t]);
|
|
6683
|
+
var getLabelFromChangeConfig = React__default.useCallback(function (changeConfig, value) {
|
|
6684
|
+
var option = changeConfig.find(function (change) {
|
|
6685
|
+
return change.key === value;
|
|
6497
6686
|
});
|
|
6498
6687
|
if (!option) {
|
|
6499
6688
|
return '';
|
|
6500
6689
|
}
|
|
6501
|
-
return
|
|
6690
|
+
return t("maritime-change-" + option.key);
|
|
6502
6691
|
}, [t]);
|
|
6503
6692
|
var getWarningDescription = React__default.useCallback(function (warning) {
|
|
6504
6693
|
if (!isPublishedWarning(warning)) {
|
|
6505
6694
|
return t('maritime-retract-dialog-empty-warning-description');
|
|
6506
6695
|
}
|
|
6507
|
-
var windDirectionFromLabel =
|
|
6696
|
+
var windDirectionFromLabel = getLabelFromWindDirectionConfig(maritimeConfig.windDirectionDefinition, warning.windDirectionFrom);
|
|
6508
6697
|
var areasById = new Map(areas.map(function (area) {
|
|
6509
|
-
return [area.
|
|
6698
|
+
return [area.districtName, area];
|
|
6510
6699
|
}));
|
|
6511
6700
|
var areaLabels = warning.assignedAreaIds.map(function (areaId) {
|
|
6512
|
-
return areasById.get(areaId).
|
|
6701
|
+
return areasById.get(areaId).districtName;
|
|
6513
6702
|
});
|
|
6514
|
-
var changeToLabel = warning.changeType === 'NO_CHANGE' ? t('maritime-retract-dialog-no-change') :
|
|
6703
|
+
var changeToLabel = warning.changeType === 'NO_CHANGE' ? t('maritime-retract-dialog-no-change') : getLabelFromChangeConfig(maritimeConfig.changeType, warning.changeType) + " " + getLabelFromWindDirectionConfig(maritimeConfig.windDirectionDefinition, warning.windDirectionTo);
|
|
6515
6704
|
var warningDescription = [windDirectionFromLabel + " " + t('maritime-windforce', {
|
|
6516
6705
|
value: warning.windForce
|
|
6517
6706
|
})].concat(areaLabels, [changeToLabel]).join(', ');
|
|
6518
6707
|
return warningDescription + ". " + t('maritime-retract-dialog-description-suffix');
|
|
6519
|
-
}, [areas, t,
|
|
6708
|
+
}, [getLabelFromWindDirectionConfig, maritimeConfig.windDirectionDefinition, maritimeConfig.changeType, areas, t, getLabelFromChangeConfig]);
|
|
6520
6709
|
return {
|
|
6521
6710
|
onRemoveWarningWithConfirmation: React__default.useCallback(/*#__PURE__*/function () {
|
|
6522
6711
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(id) {
|
|
@@ -6605,14 +6794,118 @@ var isWarningsValid = function isWarningsValid(warnings) {
|
|
|
6605
6794
|
return !isWarningEmpty(warning) && isWarningValid(warning);
|
|
6606
6795
|
});
|
|
6607
6796
|
};
|
|
6797
|
+
var getLevelFromWindForce = function getLevelFromWindForce(maritimeConfig, windForce) {
|
|
6798
|
+
var _maritimeConfig$marit;
|
|
6799
|
+
var period = maritimeConfig.maritimeLevelDefinition.maritimeLevelsSummer ? 'maritimeLevelsSummer' : 'maritimeLevelsWinter';
|
|
6800
|
+
var levelInfo = (_maritimeConfig$marit = maritimeConfig.maritimeLevelDefinition) == null ? void 0 : _maritimeConfig$marit[period].find(function (level) {
|
|
6801
|
+
return (level == null ? void 0 : level.windForce) === windForce;
|
|
6802
|
+
});
|
|
6803
|
+
return (levelInfo == null ? void 0 : levelInfo.level) || 'extreme';
|
|
6804
|
+
};
|
|
6805
|
+
var getType = function getType(domain) {
|
|
6806
|
+
switch (domain) {
|
|
6807
|
+
case 'coastalWaters':
|
|
6808
|
+
return 'maritimeWarningCoastal';
|
|
6809
|
+
case 'northSeaDistricts':
|
|
6810
|
+
default:
|
|
6811
|
+
return 'maritimeWarningNorthSea';
|
|
6812
|
+
}
|
|
6813
|
+
};
|
|
6814
|
+
var mapItemsToMaritimeWarnings = function mapItemsToMaritimeWarnings(warnings, domain, maritimeConfig, editor) {
|
|
6815
|
+
var type = getType(domain);
|
|
6816
|
+
if (warnings.length === 1 && warnings[0].assignedAreaIds.length === 0) {
|
|
6817
|
+
// 1 warning without any areas means cancel/withdraw all warnings
|
|
6818
|
+
return [{
|
|
6819
|
+
type: type,
|
|
6820
|
+
editor: editor,
|
|
6821
|
+
status: PublicWarningStatus.PUBLISHED,
|
|
6822
|
+
warningDetail: {
|
|
6823
|
+
areas: [],
|
|
6824
|
+
domain: type
|
|
6825
|
+
}
|
|
6826
|
+
}];
|
|
6827
|
+
}
|
|
6828
|
+
return warnings.map(function (warning) {
|
|
6829
|
+
return {
|
|
6830
|
+
type: type,
|
|
6831
|
+
editor: editor,
|
|
6832
|
+
status: PublicWarningStatus.PUBLISHED,
|
|
6833
|
+
warningDetail: {
|
|
6834
|
+
phenomenon: 'wind',
|
|
6835
|
+
validFrom: new Date().toISOString(),
|
|
6836
|
+
validUntil: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString(),
|
|
6837
|
+
level: getLevelFromWindForce(maritimeConfig, warning.windForce || ''),
|
|
6838
|
+
probability: 100,
|
|
6839
|
+
areas: warning.assignedAreaIds.map(function (areaId) {
|
|
6840
|
+
var areaDetails = maritimeConfig.districtList[domain].find(function (district) {
|
|
6841
|
+
return district.districtName === areaId;
|
|
6842
|
+
});
|
|
6843
|
+
return {
|
|
6844
|
+
objectName: areaId,
|
|
6845
|
+
geoJSON: (areaDetails == null ? void 0 : areaDetails.geoJSON) || {
|
|
6846
|
+
type: 'FeatureCollection',
|
|
6847
|
+
features: []
|
|
6848
|
+
}
|
|
6849
|
+
};
|
|
6850
|
+
}),
|
|
6851
|
+
windDirectionFrom: warning.windDirectionFrom,
|
|
6852
|
+
windForce: warning.windForce,
|
|
6853
|
+
changeType: warning.changeType || 'NO_CHANGE',
|
|
6854
|
+
windDirectionTo: warning.windDirectionTo,
|
|
6855
|
+
descriptionOriginal: '',
|
|
6856
|
+
descriptionTranslation: '',
|
|
6857
|
+
domain: type
|
|
6858
|
+
}
|
|
6859
|
+
};
|
|
6860
|
+
});
|
|
6861
|
+
};
|
|
6862
|
+
var mapMaritimeWarningsToItems = function mapMaritimeWarningsToItems(warnings) {
|
|
6863
|
+
return warnings.map(function (warning) {
|
|
6864
|
+
var _warning$warningDetai;
|
|
6865
|
+
return {
|
|
6866
|
+
id: warning.id || '',
|
|
6867
|
+
assignedAreaIds: ((_warning$warningDetai = warning.warningDetail.areas) == null ? void 0 : _warning$warningDetai.map(function (area) {
|
|
6868
|
+
return area.objectName;
|
|
6869
|
+
})) || [],
|
|
6870
|
+
windDirectionFrom: warning.warningDetail.windDirectionFrom,
|
|
6871
|
+
windDirectionTo: warning.warningDetail.windDirectionTo,
|
|
6872
|
+
windForce: warning.warningDetail.windForce,
|
|
6873
|
+
changeType: warning.warningDetail.changeType,
|
|
6874
|
+
validFrom: warning.warningDetail.validFrom,
|
|
6875
|
+
validUntil: warning.warningDetail.validUntil
|
|
6876
|
+
};
|
|
6877
|
+
});
|
|
6878
|
+
};
|
|
6879
|
+
|
|
6880
|
+
var MaritimeWarningAvatar = function MaritimeWarningAvatar(_ref) {
|
|
6881
|
+
var editor = _ref.editor,
|
|
6882
|
+
_ref$tooltipPlacement = _ref.tooltipPlacement,
|
|
6883
|
+
tooltipPlacement = _ref$tooltipPlacement === void 0 ? 'bottom' : _ref$tooltipPlacement;
|
|
6884
|
+
return jsx(CustomTooltip, {
|
|
6885
|
+
title: "Editor: " + editor,
|
|
6886
|
+
placement: tooltipPlacement,
|
|
6887
|
+
children: jsx("span", {
|
|
6888
|
+
children: jsx(Avatar, {
|
|
6889
|
+
size: "small",
|
|
6890
|
+
children: getInitials(editor)
|
|
6891
|
+
})
|
|
6892
|
+
})
|
|
6893
|
+
});
|
|
6894
|
+
};
|
|
6608
6895
|
|
|
6896
|
+
var getWarningsValidity = function getWarningsValidity(t, warnings) {
|
|
6897
|
+
var validFrom = warnings.length > 0 && warnings[0].validFrom ? dateUtils.dateToString(dateUtils.createDate(warnings[0].validFrom), dateUtils.DATE_FORMAT_NAME_OF_DAY_MONTH) : '';
|
|
6898
|
+
var validUntil = warnings.length > 0 && warnings[0].validUntil ? dateUtils.dateToString(dateUtils.createDate(warnings[0].validUntil), dateUtils.DATE_FORMAT_NAME_OF_DAY_MONTH) : '';
|
|
6899
|
+
return validFrom && validUntil ? "" + t('maritime-warning-validfrom') + validFrom + " - " + t('maritime-warning-validuntil') + validUntil : '';
|
|
6900
|
+
};
|
|
6609
6901
|
var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
6610
|
-
var _sx, _sx2, _sx3;
|
|
6902
|
+
var _sx, _sx2, _sx3, _sx4;
|
|
6611
6903
|
var areas = _ref.areas,
|
|
6612
6904
|
selectedAreaIds = _ref.selectedAreaIds,
|
|
6613
6905
|
modified = _ref.modified,
|
|
6614
6906
|
warnings = _ref.warnings,
|
|
6615
6907
|
onToggleSelectArea = _ref.onToggleSelectArea,
|
|
6908
|
+
onSelectMultipleAreas = _ref.onSelectMultipleAreas,
|
|
6616
6909
|
onAddSelectedAreas = _ref.onAddSelectedAreas,
|
|
6617
6910
|
onRemoveWarning = _ref.onRemoveWarning,
|
|
6618
6911
|
onRemoveArea = _ref.onRemoveArea,
|
|
@@ -6621,20 +6914,29 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
|
6621
6914
|
onSubmit = _ref.onSubmit,
|
|
6622
6915
|
onClear = _ref.onClear,
|
|
6623
6916
|
onMoveWarning = _ref.onMoveWarning,
|
|
6917
|
+
onToggleReadOnly = _ref.onToggleReadOnly,
|
|
6918
|
+
isReadOnly = _ref.isReadOnly,
|
|
6919
|
+
shouldHideEditorToggle = _ref.shouldHideEditorToggle,
|
|
6624
6920
|
_ref$shouldShowDistri = _ref.shouldShowDistricts,
|
|
6625
|
-
shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri
|
|
6921
|
+
shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri,
|
|
6922
|
+
editor = _ref.editor,
|
|
6923
|
+
error = _ref.error,
|
|
6924
|
+
maritimeConfig = _ref.maritimeConfig,
|
|
6925
|
+
_ref$lastUpdatedTime = _ref.lastUpdatedTime,
|
|
6926
|
+
lastUpdatedTime = _ref$lastUpdatedTime === void 0 ? '' : _ref$lastUpdatedTime;
|
|
6626
6927
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
6627
6928
|
t = _useWarningsTranslati.t;
|
|
6929
|
+
var showConfirmDialog = useConfirmationDialog();
|
|
6628
6930
|
var disabledAreaIds = warnings.flatMap(function (warning) {
|
|
6629
6931
|
return warning.assignedAreaIds;
|
|
6630
6932
|
});
|
|
6631
6933
|
var _useConfirmRetractDia = useConfirmRetractDialog({
|
|
6632
6934
|
areas: areas,
|
|
6633
6935
|
warnings: warnings,
|
|
6936
|
+
maritimeConfig: maritimeConfig,
|
|
6634
6937
|
onRemoveWarning: onRemoveWarning
|
|
6635
6938
|
}),
|
|
6636
6939
|
onRemoveWarningWithConfirmation = _useConfirmRetractDia.onRemoveWarningWithConfirmation;
|
|
6637
|
-
var showConfirmDialog = useConfirmationDialog();
|
|
6638
6940
|
var onClearWithConfirmation = React__default.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
6639
6941
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
6640
6942
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -6655,22 +6957,118 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
|
6655
6957
|
}, _callee);
|
|
6656
6958
|
})), [onClear, t, showConfirmDialog]);
|
|
6657
6959
|
var isValid = isWarningsValid(warnings);
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6960
|
+
var onSwitchMode = /*#__PURE__*/function () {
|
|
6961
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(event) {
|
|
6962
|
+
var checked, isReadOnly;
|
|
6963
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
6964
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
6965
|
+
case 0:
|
|
6966
|
+
checked = event.target.checked;
|
|
6967
|
+
isReadOnly = !checked;
|
|
6968
|
+
if (!(modified && isReadOnly)) {
|
|
6969
|
+
_context2.next = 5;
|
|
6970
|
+
break;
|
|
6971
|
+
}
|
|
6972
|
+
_context2.next = 5;
|
|
6973
|
+
return showConfirmDialog({
|
|
6974
|
+
title: t('warning-view-mode-title'),
|
|
6975
|
+
description: t('warning-view-mode-description'),
|
|
6976
|
+
confirmLabel: t('warning-view-mode-confirm'),
|
|
6977
|
+
cancelLabel: t('warning-dialog-cancel')
|
|
6978
|
+
});
|
|
6979
|
+
case 5:
|
|
6980
|
+
onToggleReadOnly(isReadOnly);
|
|
6981
|
+
case 6:
|
|
6982
|
+
case "end":
|
|
6983
|
+
return _context2.stop();
|
|
6984
|
+
}
|
|
6985
|
+
}, _callee2);
|
|
6986
|
+
}));
|
|
6987
|
+
return function onSwitchMode(_x) {
|
|
6988
|
+
return _ref3.apply(this, arguments);
|
|
6989
|
+
};
|
|
6990
|
+
}();
|
|
6991
|
+
var validTimes = getWarningsValidity(t, warnings);
|
|
6992
|
+
return jsxs(Box, {
|
|
6661
6993
|
sx: (_sx = {
|
|
6994
|
+
display: 'flex',
|
|
6995
|
+
flexDirection: 'column',
|
|
6996
|
+
gap: 1,
|
|
6662
6997
|
height: '100%',
|
|
6663
6998
|
containerName: 'maritime',
|
|
6664
6999
|
containerType: 'inline-size',
|
|
6665
|
-
padding: 2
|
|
7000
|
+
padding: 2,
|
|
7001
|
+
// in a dialog there is an additional empty footer that messes up styling. This hack fixes that.
|
|
7002
|
+
'[role="dialog"] &': {
|
|
7003
|
+
paddingBottom: 0
|
|
7004
|
+
}
|
|
6666
7005
|
}, _sx["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
6667
7006
|
padding: 3
|
|
6668
7007
|
}, _sx),
|
|
6669
|
-
children: [jsx(
|
|
7008
|
+
children: [error && jsx(AlertBanner, {
|
|
7009
|
+
title: error.title,
|
|
7010
|
+
severity: error.severity,
|
|
7011
|
+
shouldClose: true
|
|
7012
|
+
}), jsxs(Box, {
|
|
7013
|
+
sx: (_sx2 = {
|
|
7014
|
+
display: 'flex',
|
|
7015
|
+
flexWrap: 'wrap',
|
|
7016
|
+
gap: 1,
|
|
7017
|
+
alignItems: 'center',
|
|
7018
|
+
width: '100%'
|
|
7019
|
+
}, _sx2["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
7020
|
+
justifyContent: 'space-between'
|
|
7021
|
+
}, _sx2),
|
|
7022
|
+
children: [jsx(Typography, {
|
|
7023
|
+
sx: {
|
|
7024
|
+
color: 'geowebColors.captions.captionStatus.rgba',
|
|
7025
|
+
fontSize: '10px',
|
|
7026
|
+
lineHeight: '1.6',
|
|
7027
|
+
letterSpacing: '0.33px',
|
|
7028
|
+
minWidth: '300px'
|
|
7029
|
+
},
|
|
7030
|
+
children: validTimes
|
|
7031
|
+
}), jsx(Box, {
|
|
7032
|
+
sx: {
|
|
7033
|
+
display: 'flex',
|
|
7034
|
+
flexWrap: 'wrap',
|
|
7035
|
+
gap: 1,
|
|
7036
|
+
alignItems: 'center',
|
|
7037
|
+
height: '38px'
|
|
7038
|
+
},
|
|
7039
|
+
children: !shouldHideEditorToggle && jsxs(Fragment, {
|
|
7040
|
+
children: [jsx(SwitchButton, {
|
|
7041
|
+
inActiveLabel: t('warning-editor-user-viewer'),
|
|
7042
|
+
activeLabel: t('warning-editor-user-editor'),
|
|
7043
|
+
checked: !isReadOnly,
|
|
7044
|
+
onChange: onSwitchMode
|
|
7045
|
+
}), jsx(Box, {
|
|
7046
|
+
sx: {
|
|
7047
|
+
width: '16px',
|
|
7048
|
+
marginLeft: 1
|
|
7049
|
+
},
|
|
7050
|
+
children: editor && jsx(MaritimeWarningAvatar, {
|
|
7051
|
+
editor: editor
|
|
7052
|
+
})
|
|
7053
|
+
}), lastUpdatedTime && jsx(Box, {
|
|
7054
|
+
sx: {
|
|
7055
|
+
"float": 'left',
|
|
7056
|
+
paddingTop: 0.5
|
|
7057
|
+
},
|
|
7058
|
+
children: jsx(LastUpdateTime, {
|
|
7059
|
+
lastUpdateTime: lastUpdatedTime,
|
|
7060
|
+
showRefreshButton: false
|
|
7061
|
+
})
|
|
7062
|
+
})]
|
|
7063
|
+
})
|
|
7064
|
+
})]
|
|
7065
|
+
}), jsx(AreaList, {
|
|
6670
7066
|
areas: areas,
|
|
6671
7067
|
selected: selectedAreaIds,
|
|
6672
7068
|
disabled: disabledAreaIds,
|
|
6673
|
-
|
|
7069
|
+
isReadOnly: isReadOnly,
|
|
7070
|
+
onToggleSelectArea: onToggleSelectArea,
|
|
7071
|
+
onSelectMultipleAreas: onSelectMultipleAreas
|
|
6674
7072
|
}), jsx(WarningList, {
|
|
6675
7073
|
warnings: warnings,
|
|
6676
7074
|
areas: areas,
|
|
@@ -6679,10 +7077,13 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
|
6679
7077
|
onRemoveWarning: onRemoveWarningWithConfirmation,
|
|
6680
7078
|
onChangeWarning: onChangeWarning,
|
|
6681
7079
|
onToggleSelectArea: onToggleSelectArea,
|
|
7080
|
+
onSelectMultipleAreas: onSelectMultipleAreas,
|
|
6682
7081
|
onRemoveArea: onRemoveArea,
|
|
6683
7082
|
onMoveWarning: onMoveWarning,
|
|
6684
|
-
shouldShowDistricts: shouldShowDistricts
|
|
6685
|
-
|
|
7083
|
+
shouldShowDistricts: shouldShowDistricts,
|
|
7084
|
+
isReadOnly: isReadOnly,
|
|
7085
|
+
maritimeConfig: maritimeConfig
|
|
7086
|
+
}), !isReadOnly && jsxs(Button, {
|
|
6686
7087
|
onClick: onAddWarning,
|
|
6687
7088
|
variant: "tertiary",
|
|
6688
7089
|
size: "small",
|
|
@@ -6691,15 +7092,20 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
|
6691
7092
|
paddingInline: 2
|
|
6692
7093
|
},
|
|
6693
7094
|
children: [jsx(Add, {}), t('maritime-new-warning')]
|
|
6694
|
-
}), jsxs(Stack, {
|
|
7095
|
+
}), !isReadOnly && jsxs(Stack, {
|
|
6695
7096
|
spacing: 2,
|
|
6696
7097
|
direction: "row",
|
|
6697
|
-
sx: (
|
|
7098
|
+
sx: (_sx3 = {}, _sx3["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
6698
7099
|
position: 'absolute',
|
|
6699
7100
|
bottom: 0,
|
|
6700
7101
|
right: 0,
|
|
6701
|
-
|
|
6702
|
-
|
|
7102
|
+
paddingInline: 2,
|
|
7103
|
+
paddingBottom: 2,
|
|
7104
|
+
// in a dialog there is an additional empty footer that messes up styling. This hack fixes that.
|
|
7105
|
+
'[role="dialog"] &': {
|
|
7106
|
+
paddingBottom: 0
|
|
7107
|
+
}
|
|
7108
|
+
}, _sx3),
|
|
6703
7109
|
children: [jsx(Button, {
|
|
6704
7110
|
onClick: onClearWithConfirmation,
|
|
6705
7111
|
variant: "tertiary",
|
|
@@ -6711,11 +7117,11 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
|
6711
7117
|
}), jsx(Button, {
|
|
6712
7118
|
variant: "primary",
|
|
6713
7119
|
size: "small",
|
|
6714
|
-
sx: (
|
|
7120
|
+
sx: (_sx4 = {
|
|
6715
7121
|
width: '134px'
|
|
6716
|
-
},
|
|
7122
|
+
}, _sx4["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
6717
7123
|
marginLeft: '24px!important'
|
|
6718
|
-
},
|
|
7124
|
+
}, _sx4),
|
|
6719
7125
|
disabled: !modified || !isValid,
|
|
6720
7126
|
onClick: onSubmit,
|
|
6721
7127
|
children: t('warning-button-publish')
|
|
@@ -6724,72 +7130,71 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
|
6724
7130
|
});
|
|
6725
7131
|
};
|
|
6726
7132
|
|
|
6727
|
-
var areasByDomain = {
|
|
6728
|
-
northSeaDistricts: [{
|
|
6729
|
-
id: 'DOVER',
|
|
6730
|
-
label: 'Dover'
|
|
6731
|
-
}, {
|
|
6732
|
-
id: 'THAMES',
|
|
6733
|
-
label: 'Thames'
|
|
6734
|
-
}, {
|
|
6735
|
-
id: 'HUMBER',
|
|
6736
|
-
label: 'Humber'
|
|
6737
|
-
}, {
|
|
6738
|
-
id: 'DOGGER',
|
|
6739
|
-
label: 'Dogger'
|
|
6740
|
-
}, {
|
|
6741
|
-
id: 'GERMAN_BIGHT',
|
|
6742
|
-
label: 'German Bight'
|
|
6743
|
-
}],
|
|
6744
|
-
coastalWaters: [{
|
|
6745
|
-
id: 'VLISSINGEN',
|
|
6746
|
-
label: 'Vlissingen'
|
|
6747
|
-
}, {
|
|
6748
|
-
id: 'ZIERIKZEE',
|
|
6749
|
-
label: 'Zierikzee'
|
|
6750
|
-
}, {
|
|
6751
|
-
id: 'HOEK_VAN_HOLLAND',
|
|
6752
|
-
label: 'Hoek van Holland'
|
|
6753
|
-
}, {
|
|
6754
|
-
id: 'IJMUIDEN',
|
|
6755
|
-
label: 'IJmuiden'
|
|
6756
|
-
}, {
|
|
6757
|
-
id: 'TEXEL',
|
|
6758
|
-
label: 'Texel'
|
|
6759
|
-
}, {
|
|
6760
|
-
id: 'HARLINGEN',
|
|
6761
|
-
label: 'Harlingen'
|
|
6762
|
-
}, {
|
|
6763
|
-
id: 'ROTTUM',
|
|
6764
|
-
label: 'Rottum'
|
|
6765
|
-
}, {
|
|
6766
|
-
id: 'DELFZIJL',
|
|
6767
|
-
label: 'Delfzijl'
|
|
6768
|
-
}, {
|
|
6769
|
-
id: 'IJSSELMEER',
|
|
6770
|
-
label: 'IJsselmeer'
|
|
6771
|
-
}, {
|
|
6772
|
-
id: 'MARKERMEER',
|
|
6773
|
-
label: 'Markermeer'
|
|
6774
|
-
}]
|
|
6775
|
-
};
|
|
6776
|
-
|
|
6777
7133
|
var MaritimeWarningsFormConnect = function MaritimeWarningsFormConnect(_ref) {
|
|
6778
7134
|
var domain = _ref.domain,
|
|
6779
7135
|
onPreventCloseView = _ref.onPreventCloseView,
|
|
6780
7136
|
onModifyForm = _ref.onModifyForm;
|
|
6781
|
-
var
|
|
7137
|
+
var _useWarningsTranslati = useWarningsTranslation(),
|
|
7138
|
+
t = _useWarningsTranslati.t;
|
|
7139
|
+
var _useAuthenticationCon = useAuthenticationContext$1(),
|
|
7140
|
+
auth = _useAuthenticationCon.auth,
|
|
7141
|
+
isLoggedIn = _useAuthenticationCon.isLoggedIn;
|
|
7142
|
+
var confirmDialog = useConfirmationDialog();
|
|
7143
|
+
var _useState = useState(),
|
|
7144
|
+
error = _useState[0],
|
|
7145
|
+
setError = _useState[1];
|
|
7146
|
+
var domainLabel = React__default.useMemo(function () {
|
|
7147
|
+
return domain === 'coastalWaters' ? t('maritime-domain-coastal') : t('maritime-domain-northsea');
|
|
7148
|
+
}, [domain, t]);
|
|
7149
|
+
var _useMaritimeWarningsC = useMaritimeWarningsConfig(),
|
|
7150
|
+
maritimeConfig = _useMaritimeWarningsC.data,
|
|
7151
|
+
isFetchingConfig = _useMaritimeWarningsC.isFetching,
|
|
7152
|
+
configError = _useMaritimeWarningsC.error,
|
|
7153
|
+
refetchConfig = _useMaritimeWarningsC.refetch;
|
|
7154
|
+
var _usePublicWarnings = usePublicWarnings(),
|
|
7155
|
+
data = _usePublicWarnings.data,
|
|
7156
|
+
isFetchingWarnings = _usePublicWarnings.isFetching,
|
|
7157
|
+
refetchWarnings = _usePublicWarnings.refetch,
|
|
7158
|
+
dataUpdatedAt = _usePublicWarnings.dataUpdatedAt;
|
|
7159
|
+
var _usePostMaritimeWarni = usePostMaritimeWarnings(),
|
|
7160
|
+
postWarnings = _usePostMaritimeWarni.mutate,
|
|
7161
|
+
publishError = _usePostMaritimeWarni.error;
|
|
7162
|
+
var _useMutateMaritimeWar = useMutateMaritimeWarningsEditor(),
|
|
7163
|
+
mutateEditor = _useMutateMaritimeWar.mutate,
|
|
7164
|
+
editorError = _useMutateMaritimeWar.error;
|
|
7165
|
+
var _useState2 = useState(isFetchingWarnings),
|
|
7166
|
+
hasFetched = _useState2[0],
|
|
7167
|
+
setHasFetched = _useState2[1];
|
|
7168
|
+
React__default.useEffect(function () {
|
|
7169
|
+
if (isFetchingWarnings) {
|
|
7170
|
+
setHasFetched(true);
|
|
7171
|
+
}
|
|
7172
|
+
}, [isFetchingWarnings]);
|
|
7173
|
+
var lastUpdateTime = dateUtils.dateToString(new Date(dataUpdatedAt), dateUtils.DATE_FORMAT_HOURS);
|
|
7174
|
+
var areas = maritimeConfig == null ? void 0 : maritimeConfig.districtList[domain];
|
|
6782
7175
|
var shouldShowDistricts = domain === 'northSeaDistricts';
|
|
7176
|
+
var maritimeWarningsType = getType(domain);
|
|
6783
7177
|
var _useMaritimeWarningsF = useMaritimeWarningsFormState(),
|
|
6784
7178
|
state = _useMaritimeWarningsF[0],
|
|
6785
7179
|
dispatch = _useMaritimeWarningsF[1];
|
|
7180
|
+
var warningsFromApi = React__default.useMemo(function () {
|
|
7181
|
+
return ((data == null ? void 0 : data.filter(function (warning) {
|
|
7182
|
+
return warning.type === maritimeWarningsType && warning.status === 'PUBLISHED';
|
|
7183
|
+
})) || []).reverse();
|
|
7184
|
+
}, [data, maritimeWarningsType]);
|
|
7185
|
+
var isNew = warningsFromApi.length === 0;
|
|
7186
|
+
var editor = warningsFromApi && warningsFromApi.length > 0 ? warningsFromApi[0].editor : undefined;
|
|
7187
|
+
var previousEditor = usePrevious(editor);
|
|
7188
|
+
var isReadOnly = !isNew && editor !== (auth == null ? void 0 : auth.username);
|
|
7189
|
+
var warningItemsFromApi = React__default.useMemo(function () {
|
|
7190
|
+
return mapMaritimeWarningsToItems(warningsFromApi || []);
|
|
7191
|
+
}, [warningsFromApi]);
|
|
6786
7192
|
React__default.useEffect(function () {
|
|
6787
|
-
// FIXME: replace this by warnings from api
|
|
6788
7193
|
dispatch({
|
|
6789
7194
|
type: 'initialize',
|
|
6790
|
-
warnings:
|
|
7195
|
+
warnings: warningItemsFromApi
|
|
6791
7196
|
});
|
|
6792
|
-
}, [dispatch,
|
|
7197
|
+
}, [dispatch, warningItemsFromApi]);
|
|
6793
7198
|
React__default.useEffect(function () {
|
|
6794
7199
|
onPreventCloseView == null || onPreventCloseView(state.modified);
|
|
6795
7200
|
if (onModifyForm) {
|
|
@@ -6810,6 +7215,14 @@ var MaritimeWarningsFormConnect = function MaritimeWarningsFormConnect(_ref) {
|
|
|
6810
7215
|
});
|
|
6811
7216
|
});
|
|
6812
7217
|
}, [dispatch]);
|
|
7218
|
+
var onSelectMultipleAreas = React__default.useCallback(function (ids) {
|
|
7219
|
+
React__default.startTransition(function () {
|
|
7220
|
+
dispatch({
|
|
7221
|
+
type: 'selectMultipleAreas',
|
|
7222
|
+
ids: ids
|
|
7223
|
+
});
|
|
7224
|
+
});
|
|
7225
|
+
}, [dispatch]);
|
|
6813
7226
|
var onAddSelectedAreas = React__default.useCallback(function (id) {
|
|
6814
7227
|
React__default.startTransition(function () {
|
|
6815
7228
|
dispatch({
|
|
@@ -6825,11 +7238,7 @@ var MaritimeWarningsFormConnect = function MaritimeWarningsFormConnect(_ref) {
|
|
|
6825
7238
|
id: id
|
|
6826
7239
|
});
|
|
6827
7240
|
});
|
|
6828
|
-
|
|
6829
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
6830
|
-
key: 'maritime-retract-success'
|
|
6831
|
-
});
|
|
6832
|
-
}, [dispatch, showSnackbar]);
|
|
7241
|
+
}, [dispatch]);
|
|
6833
7242
|
var onAddWarning = React__default.useCallback(function () {
|
|
6834
7243
|
React__default.startTransition(function () {
|
|
6835
7244
|
dispatch({
|
|
@@ -6860,11 +7269,7 @@ var MaritimeWarningsFormConnect = function MaritimeWarningsFormConnect(_ref) {
|
|
|
6860
7269
|
type: 'clearWarnings'
|
|
6861
7270
|
});
|
|
6862
7271
|
});
|
|
6863
|
-
|
|
6864
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
6865
|
-
key: 'maritime-clear-success'
|
|
6866
|
-
});
|
|
6867
|
-
}, [dispatch, showSnackbar]);
|
|
7272
|
+
}, [dispatch]);
|
|
6868
7273
|
var onMoveWarning = React__default.useCallback(function (oldIndex, newIndex) {
|
|
6869
7274
|
dispatch({
|
|
6870
7275
|
type: 'moveWarning',
|
|
@@ -6872,26 +7277,169 @@ var MaritimeWarningsFormConnect = function MaritimeWarningsFormConnect(_ref) {
|
|
|
6872
7277
|
newIndex: newIndex
|
|
6873
7278
|
});
|
|
6874
7279
|
}, [dispatch]);
|
|
6875
|
-
var onSubmit = React__default.useCallback(function () {
|
|
6876
|
-
|
|
6877
|
-
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
7280
|
+
var onSubmit = React__default.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
7281
|
+
var nextState, maritimeWarnings;
|
|
7282
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7283
|
+
while (1) switch (_context.prev = _context.next) {
|
|
7284
|
+
case 0:
|
|
7285
|
+
dispatch({
|
|
7286
|
+
type: 'mergeWarnings'
|
|
7287
|
+
});
|
|
7288
|
+
nextState = reducer(state, {
|
|
7289
|
+
type: 'mergeWarnings'
|
|
7290
|
+
});
|
|
7291
|
+
maritimeWarnings = mapItemsToMaritimeWarnings(nextState.warnings, domain, maritimeConfig, auth == null ? void 0 : auth.username);
|
|
7292
|
+
postWarnings(maritimeWarnings, {
|
|
7293
|
+
onSuccess: function onSuccess() {
|
|
7294
|
+
dispatch({
|
|
7295
|
+
type: 'submitWarnings'
|
|
7296
|
+
});
|
|
7297
|
+
}
|
|
7298
|
+
});
|
|
7299
|
+
case 4:
|
|
7300
|
+
case "end":
|
|
7301
|
+
return _context.stop();
|
|
7302
|
+
}
|
|
7303
|
+
}, _callee);
|
|
7304
|
+
})), [dispatch, state, domain, maritimeConfig, auth == null ? void 0 : auth.username, postWarnings]);
|
|
7305
|
+
var onToggleReadOnly = React__default.useCallback(function (isReadOnly) {
|
|
7306
|
+
var message = isReadOnly ? t('maritime-editor-off', {
|
|
7307
|
+
domain: domainLabel
|
|
7308
|
+
}) : t('maritime-editor-on', {
|
|
7309
|
+
domain: domainLabel
|
|
7310
|
+
});
|
|
7311
|
+
var updateEditor = function updateEditor(force) {
|
|
7312
|
+
return mutateEditor({
|
|
7313
|
+
domain: getType(domain),
|
|
7314
|
+
isEditor: !isReadOnly,
|
|
7315
|
+
force: force
|
|
7316
|
+
}, {
|
|
7317
|
+
onError: function onError(e) {
|
|
7318
|
+
if (e.cause === 409) {
|
|
7319
|
+
void refetchWarnings();
|
|
7320
|
+
void confirmDialog({
|
|
7321
|
+
title: t('warning-edit-mode-title'),
|
|
7322
|
+
description: t('warning-edit-mode-description'),
|
|
7323
|
+
confirmLabel: t('warning-edit-mode-confirm'),
|
|
7324
|
+
cancelLabel: t('warning-dialog-cancel')
|
|
7325
|
+
}).then(function () {
|
|
7326
|
+
return void updateEditor(true);
|
|
7327
|
+
}); // force update editor
|
|
7328
|
+
} else {
|
|
7329
|
+
void refetchWarnings();
|
|
7330
|
+
}
|
|
7331
|
+
},
|
|
7332
|
+
onSuccess: function () {
|
|
7333
|
+
var _onSuccess = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
7334
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
7335
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
7336
|
+
case 0:
|
|
7337
|
+
void refetchWarnings();
|
|
7338
|
+
showSnackbar({
|
|
7339
|
+
type: snackbarTypes.SnackbarMessageType.VERBATIM_MESSAGE,
|
|
7340
|
+
message: message
|
|
7341
|
+
});
|
|
7342
|
+
case 2:
|
|
7343
|
+
case "end":
|
|
7344
|
+
return _context2.stop();
|
|
7345
|
+
}
|
|
7346
|
+
}, _callee2);
|
|
7347
|
+
}));
|
|
7348
|
+
function onSuccess() {
|
|
7349
|
+
return _onSuccess.apply(this, arguments);
|
|
7350
|
+
}
|
|
7351
|
+
return onSuccess;
|
|
7352
|
+
}()
|
|
7353
|
+
});
|
|
7354
|
+
};
|
|
7355
|
+
void updateEditor(false);
|
|
7356
|
+
}, [t, domainLabel, mutateEditor, domain, refetchWarnings, confirmDialog, showSnackbar]);
|
|
7357
|
+
useEffect(function () {
|
|
7358
|
+
if (publishError) {
|
|
7359
|
+
setError({
|
|
7360
|
+
title: publishError.message,
|
|
7361
|
+
severity: 'error'
|
|
7362
|
+
});
|
|
7363
|
+
} else if (editorError && editorError.cause !== 409) {
|
|
7364
|
+
setError({
|
|
7365
|
+
title: editorError.message,
|
|
7366
|
+
severity: 'error'
|
|
7367
|
+
});
|
|
7368
|
+
} else {
|
|
7369
|
+
setError(undefined);
|
|
7370
|
+
}
|
|
7371
|
+
}, [publishError, editorError]);
|
|
7372
|
+
var shouldGiveEditorWarning = React__default.useCallback(function (newEditor, oldEditor) {
|
|
7373
|
+
var oldEditorIsYou = oldEditor && oldEditor === (auth == null ? void 0 : auth.username);
|
|
7374
|
+
if (oldEditorIsYou && newEditor && newEditor !== oldEditor) {
|
|
7375
|
+
setError({
|
|
7376
|
+
title: t('maritime-editor-off', {
|
|
7377
|
+
domain: domainLabel
|
|
7378
|
+
}),
|
|
7379
|
+
severity: 'warning'
|
|
7380
|
+
});
|
|
7381
|
+
}
|
|
7382
|
+
}, [auth == null ? void 0 : auth.username, domainLabel, t]);
|
|
7383
|
+
useEffect(function () {
|
|
7384
|
+
// Only give editor warning when the change in editor is from a refetch
|
|
7385
|
+
if (hasFetched) {
|
|
7386
|
+
setHasFetched(false);
|
|
7387
|
+
shouldGiveEditorWarning(editor, previousEditor);
|
|
7388
|
+
}
|
|
7389
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7390
|
+
}, [editor]);
|
|
7391
|
+
if (!isLoggedIn) {
|
|
7392
|
+
return jsx(AlertBanner, {
|
|
7393
|
+
title: t('error-auth-login')
|
|
7394
|
+
});
|
|
7395
|
+
}
|
|
7396
|
+
if (configError) {
|
|
7397
|
+
return jsx(AlertBanner, {
|
|
7398
|
+
title: t('maritime-config-error'),
|
|
7399
|
+
info: configError.message,
|
|
7400
|
+
actionButtonProps: {
|
|
7401
|
+
title: t('error-title-retry'),
|
|
7402
|
+
onClick: function onClick() {
|
|
7403
|
+
void refetchConfig();
|
|
7404
|
+
}
|
|
7405
|
+
}
|
|
7406
|
+
});
|
|
7407
|
+
}
|
|
7408
|
+
return jsxs(Fragment, {
|
|
7409
|
+
children: [(isFetchingConfig || isFetchingWarnings || !maritimeConfig) && jsx(LinearProgress, {
|
|
7410
|
+
"data-testid": "loading-bar",
|
|
7411
|
+
color: "secondary",
|
|
7412
|
+
sx: {
|
|
7413
|
+
position: 'absolute',
|
|
7414
|
+
width: '100%',
|
|
7415
|
+
top: 0
|
|
7416
|
+
}
|
|
7417
|
+
}), !maritimeConfig ? jsxs("div", {
|
|
7418
|
+
children: [" ", t('maritime-loading-config')]
|
|
7419
|
+
}) : jsx(MaritimeWarningsForm, {
|
|
7420
|
+
areas: areas || [],
|
|
7421
|
+
selectedAreaIds: state.selectedAreaIds,
|
|
7422
|
+
warnings: state.warnings,
|
|
7423
|
+
modified: state.modified,
|
|
7424
|
+
isReadOnly: isReadOnly,
|
|
7425
|
+
shouldShowDistricts: shouldShowDistricts,
|
|
7426
|
+
editor: editor,
|
|
7427
|
+
onToggleSelectArea: onToggleSelectArea,
|
|
7428
|
+
onSelectMultipleAreas: onSelectMultipleAreas,
|
|
7429
|
+
onAddSelectedAreas: onAddSelectedAreas,
|
|
7430
|
+
onRemoveWarning: onRemoveWarning,
|
|
7431
|
+
onRemoveArea: onRemoveArea,
|
|
7432
|
+
onAddWarning: onAddWarning,
|
|
7433
|
+
onChangeWarning: onChangeWarning,
|
|
7434
|
+
onMoveWarning: onMoveWarning,
|
|
7435
|
+
onToggleReadOnly: onToggleReadOnly,
|
|
7436
|
+
onClear: onClear,
|
|
7437
|
+
onSubmit: onSubmit,
|
|
7438
|
+
maritimeConfig: maritimeConfig,
|
|
7439
|
+
lastUpdatedTime: lastUpdateTime,
|
|
7440
|
+
error: error,
|
|
7441
|
+
shouldHideEditorToggle: isNew
|
|
7442
|
+
})]
|
|
6895
7443
|
});
|
|
6896
7444
|
};
|
|
6897
7445
|
|
|
@@ -7657,12 +8205,14 @@ var Form = function Form(_ref5) {
|
|
|
7657
8205
|
})
|
|
7658
8206
|
});
|
|
7659
8207
|
};
|
|
8208
|
+
if (isMaritimeWarning) {
|
|
8209
|
+
return getFormContent();
|
|
8210
|
+
}
|
|
7660
8211
|
return jsxs(ContainerWrapper, {
|
|
7661
8212
|
children: [jsxs(ContainerFormWrapper, {
|
|
7662
8213
|
isReadOnly: isReadOnly,
|
|
7663
8214
|
ref: ref,
|
|
7664
8215
|
"data-testid": "scroll-container",
|
|
7665
|
-
addPadding: !isMaritimeWarning,
|
|
7666
8216
|
children: [errors && jsx(Box, {
|
|
7667
8217
|
sx: {
|
|
7668
8218
|
marginBottom: 2
|
|
@@ -7676,7 +8226,7 @@ var Form = function Form(_ref5) {
|
|
|
7676
8226
|
}), getFormContent(), jsx(DraftFieldHelper, {}), jsx(ReactHookFormHiddenInput, {
|
|
7677
8227
|
name: "id"
|
|
7678
8228
|
})]
|
|
7679
|
-
}),
|
|
8229
|
+
}), formState !== 'cancel' && !isReadOnly && jsx(Box, {
|
|
7680
8230
|
sx: {
|
|
7681
8231
|
padding: '24px 10px 14px 10px',
|
|
7682
8232
|
position: 'absolute',
|
|
@@ -7761,7 +8311,7 @@ var Form = function Form(_ref5) {
|
|
|
7761
8311
|
})]
|
|
7762
8312
|
})
|
|
7763
8313
|
})
|
|
7764
|
-
}),
|
|
8314
|
+
}), formState === 'cancel' && jsx(Box, {
|
|
7765
8315
|
sx: {
|
|
7766
8316
|
padding: '24px 10px 14px 10px',
|
|
7767
8317
|
position: 'absolute',
|
|
@@ -7816,7 +8366,7 @@ var PublicWarningsForm = function PublicWarningsForm(props) {
|
|
|
7816
8366
|
var defaultValues = selectedAviationProduct || getFormData(publicWarningDetails, object);
|
|
7817
8367
|
return jsx(ReactHookFormProvider, {
|
|
7818
8368
|
options: Object.assign({}, defaultFormOptions, {
|
|
7819
|
-
mode: 'onSubmit',
|
|
8369
|
+
mode: selectedAviationProduct ? defaultFormOptions.mode : 'onSubmit',
|
|
7820
8370
|
defaultValues: defaultValues
|
|
7821
8371
|
}),
|
|
7822
8372
|
children: jsx(Form, Object.assign({}, props))
|
|
@@ -8788,18 +9338,15 @@ var useWarnings = function useWarnings(disabled) {
|
|
|
8788
9338
|
sigmetWarnings = _useSigmetList.data,
|
|
8789
9339
|
refetchSigmet = _useSigmetList.refetch,
|
|
8790
9340
|
isFetchingSigmet = _useSigmetList.isFetching;
|
|
8791
|
-
var warningType = useSelector(getWarningType);
|
|
8792
|
-
var _useProductConfig = useProductConfig(warningType, false),
|
|
8793
|
-
aviationConfig = _useProductConfig.data;
|
|
8794
9341
|
var combinedWarnings = useMemo(function () {
|
|
8795
9342
|
var transformedSigmets = (sigmetWarnings == null ? void 0 : sigmetWarnings.map(function (sigmet) {
|
|
8796
|
-
return transformSigmetToWarningFormat(sigmet
|
|
9343
|
+
return transformSigmetToWarningFormat(sigmet);
|
|
8797
9344
|
})) || [];
|
|
8798
9345
|
var transformedAirmets = (airmetWarnings == null ? void 0 : airmetWarnings.map(function (airmet) {
|
|
8799
|
-
return transformAirmetToWarningFormat(airmet
|
|
9346
|
+
return transformAirmetToWarningFormat(airmet);
|
|
8800
9347
|
})) || [];
|
|
8801
9348
|
return concat(publicWarnings || [], transformedSigmets, transformedAirmets);
|
|
8802
|
-
}, [sigmetWarnings, airmetWarnings, publicWarnings
|
|
9349
|
+
}, [sigmetWarnings, airmetWarnings, publicWarnings]);
|
|
8803
9350
|
var refetchWarnings = function refetchWarnings() {
|
|
8804
9351
|
void refetchPublicWarnings();
|
|
8805
9352
|
void refetchAirmet();
|
|
@@ -8869,8 +9416,8 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
8869
9416
|
var selectedWarningId = useSelector(getSelectedWarningId);
|
|
8870
9417
|
var selectedWarningObject = useSelector(getPublicWarning);
|
|
8871
9418
|
var warningType = useSelector(getWarningType);
|
|
8872
|
-
var selectedWarning = combinedWarnings == null ? void 0 : combinedWarnings.find(function (
|
|
8873
|
-
return
|
|
9419
|
+
var selectedWarning = combinedWarnings == null ? void 0 : combinedWarnings.find(function (warning) {
|
|
9420
|
+
return warning.id === selectedWarningId;
|
|
8874
9421
|
});
|
|
8875
9422
|
var _useAuthenticationCon = useAuthenticationContext$1(),
|
|
8876
9423
|
auth = _useAuthenticationCon.auth;
|
|
@@ -9466,7 +10013,18 @@ var WarningListItemMenu = function WarningListItemMenu(_ref) {
|
|
|
9466
10013
|
onWithdrawWarning = _ref$onWithdrawWarnin === void 0 ? function () {} : _ref$onWithdrawWarnin,
|
|
9467
10014
|
_ref$onActionAviation = _ref.onActionAviationWarning,
|
|
9468
10015
|
onActionAviationWarning = _ref$onActionAviation === void 0 ? function () {} : _ref$onActionAviation,
|
|
10016
|
+
_ref$onActionMaritime = _ref.onActionMaritimeWarning,
|
|
10017
|
+
onActionMaritimeWarning = _ref$onActionMaritime === void 0 ? function () {} : _ref$onActionMaritime,
|
|
9469
10018
|
t = _ref.t;
|
|
10019
|
+
if (warning.type === 'maritimeWarningCoastal' || warning.type === 'maritimeWarningNorthSea') {
|
|
10020
|
+
return [{
|
|
10021
|
+
text: t('warning-list-button-update'),
|
|
10022
|
+
action: function action() {
|
|
10023
|
+
return onActionMaritimeWarning(warning, MaritimeWarningAction.UPDATE);
|
|
10024
|
+
},
|
|
10025
|
+
icon: jsx(Edit, {})
|
|
10026
|
+
}];
|
|
10027
|
+
}
|
|
9470
10028
|
var duplicate = {
|
|
9471
10029
|
text: t('warning-list-button-duplicate'),
|
|
9472
10030
|
action: function action() {
|
|
@@ -9550,7 +10108,7 @@ var WarningListItemMenu = function WarningListItemMenu(_ref) {
|
|
|
9550
10108
|
case ProductStatus.DRAFT:
|
|
9551
10109
|
return [aviationDuplicate, aviationDelete];
|
|
9552
10110
|
case ProductStatus.PUBLISHED:
|
|
9553
|
-
if (warning.type
|
|
10111
|
+
if ((warning.type === 'airmet' || warning.type === 'sigmet') && (isInstanceOfCancelSigmet(warning.sigmetAirmetDetails) || isInstanceOfCancelAirmet(warning.sigmetAirmetDetails))) {
|
|
9554
10112
|
return [];
|
|
9555
10113
|
}
|
|
9556
10114
|
return [{
|
|
@@ -9580,7 +10138,7 @@ var WarningListItemMenu = function WarningListItemMenu(_ref) {
|
|
|
9580
10138
|
case ProductStatus.CANCELLED:
|
|
9581
10139
|
return [];
|
|
9582
10140
|
case ProductStatus.EXPIRED:
|
|
9583
|
-
if (warning.type
|
|
10141
|
+
if ((warning.type === 'airmet' || warning.type === 'sigmet') && (isInstanceOfCancelSigmet(warning.sigmetAirmetDetails) || isInstanceOfCancelAirmet(warning.sigmetAirmetDetails))) {
|
|
9584
10142
|
return [];
|
|
9585
10143
|
}
|
|
9586
10144
|
return [{
|
|
@@ -9598,7 +10156,7 @@ var WarningListItemMenu = function WarningListItemMenu(_ref) {
|
|
|
9598
10156
|
}
|
|
9599
10157
|
};
|
|
9600
10158
|
|
|
9601
|
-
var _excluded = ["warning", "activeWarningId", "highlightedItem", "onSelectWarning", "onEditWarning", "onDeleteWarning", "onDeleteReviewWarning", "onExpireWarning", "onWithdrawWarning", "onActionAviationWarning"];
|
|
10159
|
+
var _excluded = ["warning", "activeWarningId", "highlightedItem", "onSelectWarning", "onEditWarning", "onDeleteWarning", "onDeleteReviewWarning", "onExpireWarning", "onWithdrawWarning", "onActionAviationWarning", "onActionMaritimeWarning"];
|
|
9602
10160
|
var renderLevelText = function renderLevelText(levelString) {
|
|
9603
10161
|
if (!levelString) {
|
|
9604
10162
|
return null;
|
|
@@ -9635,10 +10193,10 @@ var renderStatusIcon = function renderStatusIcon(warning, status) {
|
|
|
9635
10193
|
icon: icon
|
|
9636
10194
|
});
|
|
9637
10195
|
};
|
|
9638
|
-
if (warning.productStatus === ProductStatus.PUBLISHED && warning.type
|
|
10196
|
+
if (warning.productStatus === ProductStatus.PUBLISHED && (warning.type === 'airmet' || warning.type === 'sigmet') && (isCancelAirmet(warning.sigmetAirmetDetails) || isCancelSigmet(warning.sigmetAirmetDetails))) {
|
|
9639
10197
|
return getStatusTag("Cnls " + (isCancelAirmet(warning.sigmetAirmetDetails) ? warning.sigmetAirmetDetails.cancelsAirmetSequenceId : warning.sigmetAirmetDetails.cancelsSigmetSequenceId), 'red');
|
|
9640
10198
|
}
|
|
9641
|
-
if (warning.productStatus === ProductStatus.CANCELLED && warning.type
|
|
10199
|
+
if (warning.productStatus === ProductStatus.CANCELLED && (warning.type === 'airmet' || warning.type === 'sigmet')) {
|
|
9642
10200
|
return getStatusTag('Cnld', 'red');
|
|
9643
10201
|
}
|
|
9644
10202
|
switch (status) {
|
|
@@ -9695,12 +10253,14 @@ var WarningListItem = function WarningListItem(_ref) {
|
|
|
9695
10253
|
onWithdrawWarning = _ref$onWithdrawWarnin === void 0 ? function () {} : _ref$onWithdrawWarnin,
|
|
9696
10254
|
_ref$onActionAviation = _ref.onActionAviationWarning,
|
|
9697
10255
|
onActionAviationWarning = _ref$onActionAviation === void 0 ? function () {} : _ref$onActionAviation,
|
|
10256
|
+
_ref$onActionMaritime = _ref.onActionMaritimeWarning,
|
|
10257
|
+
onActionMaritimeWarning = _ref$onActionMaritime === void 0 ? function () {} : _ref$onActionMaritime,
|
|
9698
10258
|
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
9699
10259
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
9700
10260
|
t = _useWarningsTranslati.t;
|
|
9701
10261
|
var phenomenonDetails = allPhenomenaDict[warning.warningDetail.phenomenon];
|
|
9702
10262
|
var objectNameText = ((_warning$warningDetai = warning.warningDetail.areas) == null || (_warning$warningDetai = _warning$warningDetai[0]) == null ? void 0 : _warning$warningDetai.objectName) || '-';
|
|
9703
|
-
var objectHoverText = warning.type
|
|
10263
|
+
var objectHoverText = warning.type === 'airmet' || warning.type === 'sigmet' ? warning.sigmetAirmetDetails.firName : objectNameText;
|
|
9704
10264
|
var _useOverflowCheck = useOverflowCheck(objectNameText),
|
|
9705
10265
|
objectNameRef = _useOverflowCheck.ref;
|
|
9706
10266
|
var phenomenonText = phenomenonDetails != null && phenomenonDetails.translationKey ? t(phenomenonDetails.translationKey) : '-';
|
|
@@ -9749,7 +10309,8 @@ var WarningListItem = function WarningListItem(_ref) {
|
|
|
9749
10309
|
onDeleteWarning: onDeleteWarning,
|
|
9750
10310
|
onExpireWarning: onExpireWarning,
|
|
9751
10311
|
onWithdrawWarning: onWithdrawWarning,
|
|
9752
|
-
onActionAviationWarning: onActionAviationWarning
|
|
10312
|
+
onActionAviationWarning: onActionAviationWarning,
|
|
10313
|
+
onActionMaritimeWarning: onActionMaritimeWarning
|
|
9753
10314
|
}),
|
|
9754
10315
|
buttonIcon: jsx(Options, {})
|
|
9755
10316
|
}),
|
|
@@ -10057,9 +10618,9 @@ var NewWarningButton = function NewWarningButton(_ref) {
|
|
|
10057
10618
|
var groupWarningsOnStatus = function groupWarningsOnStatus(warnings, sortState) {
|
|
10058
10619
|
var key = sortState.key,
|
|
10059
10620
|
direction = sortState.direction;
|
|
10060
|
-
var sortedWarnings = warnings.sort(function (
|
|
10061
|
-
var dateStringA = key === 'lastUpdatedTime' ?
|
|
10062
|
-
var dateStringB = key === 'lastUpdatedTime' ?
|
|
10621
|
+
var sortedWarnings = warnings.sort(function (warningA, warningB) {
|
|
10622
|
+
var dateStringA = key === 'lastUpdatedTime' ? warningA[key] : warningA.warningDetail[key];
|
|
10623
|
+
var dateStringB = key === 'lastUpdatedTime' ? warningB[key] : warningB.warningDetail[key];
|
|
10063
10624
|
return (dateStringB == null ? void 0 : dateStringB.localeCompare(dateStringA || '')) || 0;
|
|
10064
10625
|
});
|
|
10065
10626
|
if (direction === 'asc') {
|
|
@@ -10118,6 +10679,8 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
10118
10679
|
onWithdrawWarning = _ref$onWithdrawWarnin === void 0 ? function () {} : _ref$onWithdrawWarnin,
|
|
10119
10680
|
_ref$onActionAviation = _ref.onActionAviationWarning,
|
|
10120
10681
|
onActionAviationWarning = _ref$onActionAviation === void 0 ? function () {} : _ref$onActionAviation,
|
|
10682
|
+
_ref$onActionMaritime = _ref.onActionMaritimeWarning,
|
|
10683
|
+
onActionMaritimeWarning = _ref$onActionMaritime === void 0 ? function () {} : _ref$onActionMaritime,
|
|
10121
10684
|
hoveredFeatureId = _ref.hoveredFeatureId,
|
|
10122
10685
|
expandedSections = _ref.expandedSections,
|
|
10123
10686
|
setExpandedSections = _ref.setExpandedSections;
|
|
@@ -10391,7 +10954,8 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
10391
10954
|
activeWarningId: selectedWarningId,
|
|
10392
10955
|
onExpireWarning: onExpireWarning,
|
|
10393
10956
|
onWithdrawWarning: onWithdrawWarning,
|
|
10394
|
-
onActionAviationWarning: onActionAviationWarning
|
|
10957
|
+
onActionAviationWarning: onActionAviationWarning,
|
|
10958
|
+
onActionMaritimeWarning: onActionMaritimeWarning
|
|
10395
10959
|
}, key);
|
|
10396
10960
|
}
|
|
10397
10961
|
});
|
|
@@ -10637,9 +11201,15 @@ var useWarningFilters = function useWarningFilters(warnings, onUpdateFilters, sa
|
|
|
10637
11201
|
}
|
|
10638
11202
|
};
|
|
10639
11203
|
var byFilterState = useCallback(function (warning) {
|
|
10640
|
-
var levelDomain =
|
|
10641
|
-
|
|
10642
|
-
|
|
11204
|
+
var levelDomain = function () {
|
|
11205
|
+
if (['SIG', 'AIR'].includes(warning.warningDetail.level)) {
|
|
11206
|
+
return Domain.aviation;
|
|
11207
|
+
}
|
|
11208
|
+
if (warning.type === 'maritimeWarningCoastal' || warning.type === 'maritimeWarningNorthSea') {
|
|
11209
|
+
return Domain.maritime;
|
|
11210
|
+
}
|
|
11211
|
+
return Domain["public"];
|
|
11212
|
+
}();
|
|
10643
11213
|
if (!savedDomainFilter[levelDomain]) {
|
|
10644
11214
|
return false;
|
|
10645
11215
|
}
|
|
@@ -10759,6 +11329,8 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
10759
11329
|
var panelId = _ref.panelId,
|
|
10760
11330
|
presetFilterState = _ref.presetFilterState;
|
|
10761
11331
|
var updatePublicWarningEditor = useMutatePublicWarningEditor();
|
|
11332
|
+
var _useMutateMaritimeWar = useMutateMaritimeWarningsEditor(),
|
|
11333
|
+
updateMaritimeWarningEditor = _useMutateMaritimeWar.mutateAsync;
|
|
10762
11334
|
var _useMutateDeleteWarni = useMutateDeleteWarning(),
|
|
10763
11335
|
deletePublicWarning = _useMutateDeleteWarni.mutateAsync;
|
|
10764
11336
|
var _useSaveWarning = useSaveWarning(),
|
|
@@ -10825,8 +11397,12 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
10825
11397
|
return _ref2.apply(this, arguments);
|
|
10826
11398
|
};
|
|
10827
11399
|
}();
|
|
10828
|
-
var selectWarning = function selectWarning(
|
|
10829
|
-
void
|
|
11400
|
+
var selectWarning = function selectWarning(warning) {
|
|
11401
|
+
if ((warning == null ? void 0 : warning.type) === 'maritimeWarningCoastal' || (warning == null ? void 0 : warning.type) === 'maritimeWarningNorthSea') {
|
|
11402
|
+
handleMaritimeProductClick(warning, MaritimeWarningAction.SELECT);
|
|
11403
|
+
} else {
|
|
11404
|
+
void openPublicWarningDialog('readonly', warning);
|
|
11405
|
+
}
|
|
10830
11406
|
};
|
|
10831
11407
|
var createWarning = function createWarning(warningType) {
|
|
10832
11408
|
void openPublicWarningDialog('', undefined, warningType);
|
|
@@ -10996,6 +11572,54 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
10996
11572
|
}
|
|
10997
11573
|
}
|
|
10998
11574
|
};
|
|
11575
|
+
var editMaritimeWarning = /*#__PURE__*/function () {
|
|
11576
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(warning) {
|
|
11577
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
11578
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
11579
|
+
case 0:
|
|
11580
|
+
if (!(warning && auth != null && auth.username && !warning.editor)) {
|
|
11581
|
+
_context4.next = 9;
|
|
11582
|
+
break;
|
|
11583
|
+
}
|
|
11584
|
+
_context4.prev = 1;
|
|
11585
|
+
_context4.next = 4;
|
|
11586
|
+
return updateMaritimeWarningEditor({
|
|
11587
|
+
domain: warning.type,
|
|
11588
|
+
isEditor: true
|
|
11589
|
+
});
|
|
11590
|
+
case 4:
|
|
11591
|
+
_context4.next = 8;
|
|
11592
|
+
break;
|
|
11593
|
+
case 6:
|
|
11594
|
+
_context4.prev = 6;
|
|
11595
|
+
_context4.t0 = _context4["catch"](1);
|
|
11596
|
+
case 8:
|
|
11597
|
+
refetchWarnings();
|
|
11598
|
+
case 9:
|
|
11599
|
+
void openPublicWarningDialog('', undefined, warning.type);
|
|
11600
|
+
case 10:
|
|
11601
|
+
case "end":
|
|
11602
|
+
return _context4.stop();
|
|
11603
|
+
}
|
|
11604
|
+
}, _callee4, null, [[1, 6]]);
|
|
11605
|
+
}));
|
|
11606
|
+
return function editMaritimeWarning(_x8) {
|
|
11607
|
+
return _ref5.apply(this, arguments);
|
|
11608
|
+
};
|
|
11609
|
+
}();
|
|
11610
|
+
var handleMaritimeProductClick = function handleMaritimeProductClick(warning, actionType) {
|
|
11611
|
+
if (!warning) {
|
|
11612
|
+
return;
|
|
11613
|
+
}
|
|
11614
|
+
switch (actionType) {
|
|
11615
|
+
case MaritimeWarningAction.SELECT:
|
|
11616
|
+
void openPublicWarningDialog('', undefined, warning.type);
|
|
11617
|
+
break;
|
|
11618
|
+
case MaritimeWarningAction.UPDATE:
|
|
11619
|
+
void editMaritimeWarning(warning);
|
|
11620
|
+
break;
|
|
11621
|
+
}
|
|
11622
|
+
};
|
|
10999
11623
|
var openSnackbar = function openSnackbar(message) {
|
|
11000
11624
|
dispatch(snackbarActions.openSnackbar({
|
|
11001
11625
|
type: snackbarTypes.SnackbarMessageType.VERBATIM_MESSAGE,
|
|
@@ -11138,7 +11762,8 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
11138
11762
|
onRefetchWarnings: refetchWarnings,
|
|
11139
11763
|
filterHookState: filterHookState,
|
|
11140
11764
|
hoveredFeatureId: hoveredFeatureId,
|
|
11141
|
-
onActionAviationWarning: handleAviationProductClick
|
|
11765
|
+
onActionAviationWarning: handleAviationProductClick,
|
|
11766
|
+
onActionMaritimeWarning: handleMaritimeProductClick
|
|
11142
11767
|
}), confirmDialogOptions && jsx(ConfirmDeleteWarningDialog, {
|
|
11143
11768
|
onClose: function onClose() {
|
|
11144
11769
|
return setConfirmDialogOptions(undefined);
|