@opengeoweb/warnings 14.0.1 → 14.2.1
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 +2321 -1315
- package/package.json +14 -13
- package/src/lib/api/api-utils.d.ts +2 -1
- package/src/lib/api/aviation-api/api.d.ts +6 -6
- package/src/lib/api/aviation-api/errorHandling.d.ts +1 -0
- package/src/lib/api/aviation-api/fakeApi.d.ts +3 -3
- package/src/lib/api/aviation-api/hooks.d.ts +24 -15
- package/src/lib/api/aviation-api/queryOptions.d.ts +68 -0
- package/src/lib/components/FilterList/ExpandableFilterChip.d.ts +2 -2
- package/src/lib/components/FilterList/FilterList.d.ts +5 -2
- package/src/lib/components/FilterList/TimeFilterChip.d.ts +7 -0
- package/src/lib/components/FilterList/filter-hooks.d.ts +7 -2
- package/src/lib/components/FilterList/filter-utils.d.ts +22 -7
- package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsForm.stories.d.ts +1 -1
- package/src/lib/components/MaritimeWarningsForm/WarningList/WarningListItem.d.ts +1 -1
- package/src/lib/components/MaritimeWarningsForm/WarningList/WarningListSelect.d.ts +2 -1
- package/src/lib/components/MaritimeWarningsForm/types.d.ts +11 -0
- package/src/lib/components/MaritimeWarningsForm/utils.d.ts +2 -1
- package/src/lib/components/Providers/Providers.d.ts +2 -0
- package/src/lib/components/PublicWarningList/PublicWarningList.d.ts +3 -3
- package/src/lib/components/PublicWarningList/PublicWarningListConnect.d.ts +1 -1
- package/src/lib/components/PublicWarningList/WarningListItemSeperator.d.ts +2 -0
- package/src/lib/components/PublicWarningsForm/PublicWarningsForm.stories.d.ts +1 -2
- package/src/lib/components/PublicWarningsFormDialog/AviationWarningCancelDialogContent.d.ts +4 -3
- package/src/lib/components/PublicWarningsFormDialog/CancelAviationConfirmDialog.d.ts +18 -0
- package/src/lib/utils/i18n.d.ts +1 -1
- package/src/lib/components/PublicWarningList/PublicWarningListConnect.aviation.createAndEdit.integration.spec.d.ts +0 -1
package/index.esm.js
CHANGED
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useDispatch, useSelector } from 'react-redux';
|
|
3
|
-
import { Polygons, ExitDomain, Share, Edit, Delete, CoastalEvent, TemperatureLow, TemperatureHigh, Rain, Snow, Lightning, Fog, Wind, Thunderstorm, SevereMountainWaves, VulcanicEruption, Haze, FreezingPrecipitation, ModerateAircraftIcing, SevereAircraftIcing, ModerateTurbulence, SevereTurbulence, SandStorm, RadioactiveMaterials, DrawPolygon, Visibility, Add, ArrowUpCompact, ArrowDownCompact, breakpoints, DragHandle,
|
|
3
|
+
import { Polygons, ExitDomain, Share, Edit, Delete, CoastalEvent, TemperatureLow, TemperatureHigh, Rain, Snow, Lightning, Fog, Wind, Thunderstorm, SevereMountainWaves, VulcanicEruption, Haze, FreezingPrecipitation, ModerateAircraftIcing, SevereAircraftIcing, ModerateTurbulence, SevereTurbulence, SandStorm, RadioactiveMaterials, DrawPolygon, Visibility, Add, ArrowUpCompact, ArrowDownCompact, breakpoints, DragHandle, Info, Copy, Update, Cancel, Success, Expire, Remove, Options, ChevronDown, ChevronUp, Close, Clock } 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, LastUpdateTime,
|
|
6
|
+
import { SHARED_NAMESPACE, useConfirmationDialog, dateUtils, ToggleMenu, calculateStartSize, ToolContainerDraggable, AlertBanner, sessionStorageProvider, ConfirmationDialog, usePrevious, CustomIconButton, usePreventBrowserClose, CustomTooltip, Avatar, getInitials, SwitchButton, FilterChip, TooltipSelect, LastUpdateTime, CustomToggleButton, Filter, StatusTag, FilterOption, getAxiosErrorMessage, CustomDialog, ConfirmationButtons, 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, getDefaultValidUntilValue,
|
|
10
|
+
import { SA_NAMESPACE, isInstanceOfCancelSigmet, getDefaultValidFromValue, isInstanceOfCancelAirmet, getDefaultValidUntilValue, useShortTestHelpers, ProductAction, SigmetForm, AirmetForm, getConfirmationDialogCancelLabel, getConfirmationDialogButtonLabel, getConfirmationDialogContent, getConfirmationDialogTitle, isVAPhenomenon, CancelSigmetVolcanicMovements, createAirmetPostParameter, createSigmetPostParameter, prepareCancelSigmet, getProductFormMode, findSequenceNumber, getSequenceStyling } 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';
|
|
14
14
|
import * as React from 'react';
|
|
15
15
|
import React__default, { useState, useEffect, useRef, useMemo, useCallback } from 'react';
|
|
16
16
|
import { useAuthenticationContext as useAuthenticationContext$1 } from '@opengeoweb/authentication';
|
|
17
|
-
import { styled, Box, Typography, ListItem, Paper, ListItemButton, Stack, Grid, LinearProgress, Button, MenuItem, FormHelperText, Card, CardContent, Tabs, Tab, useTheme, FormControl, CircularProgress, Menu, DialogTitle, DialogContent, Switch,
|
|
17
|
+
import { styled, Box, Typography, ListItem, Paper, ListItemButton, Stack, Grid, LinearProgress, Button, MenuItem, FormHelperText, Card, CardContent, Tabs, Tab, useTheme, FormControl, CircularProgress, Menu, ListItemText, DialogTitle, DialogContent, Switch, RadioGroup, FormControlLabel, Radio, InputAdornment, Collapse } from '@mui/material';
|
|
18
18
|
import { VariableSizeList } from 'react-window';
|
|
19
19
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
20
20
|
import { getHeaders, handleResponse, AirmetPhenomena, SigmetPhenomena, useAuthQuery, useAuthenticationContext, optimisticUpdate, ProductStatus } from '@opengeoweb/api';
|
|
21
|
-
import { useQueryClient, useMutation } from '@tanstack/react-query';
|
|
21
|
+
import { useQueryClient, useMutation, queryOptions, QueryClient, useQuery } from '@tanstack/react-query';
|
|
22
22
|
import { snackbarListener, snackbarReducer, snackbarActions, snackbarTypes } from '@opengeoweb/snackbar';
|
|
23
23
|
import { useFormContext, useForm, FormProvider } from 'react-hook-form';
|
|
24
24
|
import { isEqual, cloneDeep, clamp, concat, groupBy, pick } from 'lodash';
|
|
25
25
|
import { ReactSortable } from 'react-sortablejs';
|
|
26
|
+
import { LocalizationProvider } from '@mui/x-date-pickers';
|
|
27
|
+
import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns';
|
|
28
|
+
import { DateTimePicker } from '@mui/x-date-pickers/DateTimePicker';
|
|
26
29
|
|
|
27
30
|
var en = {
|
|
28
31
|
"drawing-tool-form-tools": "Tools",
|
|
@@ -125,6 +128,7 @@ var en = {
|
|
|
125
128
|
"warning-list-status-published": "Published",
|
|
126
129
|
"warning-list-status-todo": "Reviews",
|
|
127
130
|
"warning-list-status-expired": "Expired & Withdrawn (last 24 hours)",
|
|
131
|
+
"warning-list-status-expired-custom-time": "Expired & Withdrawn",
|
|
128
132
|
"warning-list-header-incident": "Incident",
|
|
129
133
|
"warning-list-header-incidents": "Incidents",
|
|
130
134
|
"warning-list-header-last-update": "Last update",
|
|
@@ -159,6 +163,15 @@ var en = {
|
|
|
159
163
|
"filter-source": "Sources",
|
|
160
164
|
"filter-hide": "Hide {{subject}}",
|
|
161
165
|
"filter-show": "Show {{subject}}",
|
|
166
|
+
"filter-time": "Timefilter",
|
|
167
|
+
"filter-time-no-filter": "No filter",
|
|
168
|
+
"filter-time-today": "Today",
|
|
169
|
+
"filter-time-tomorrow": "Tomorrow",
|
|
170
|
+
"filter-time-custom": "Select time span",
|
|
171
|
+
"filter-time-apply": "Apply",
|
|
172
|
+
"filter-choose-date-time": "Choose a date and time",
|
|
173
|
+
"filter-start": "Start",
|
|
174
|
+
"filter-end": "End",
|
|
162
175
|
"warning-domain-aviation": "Aviation",
|
|
163
176
|
"warning-domain-maritime": "Maritime",
|
|
164
177
|
"warning-domain-public": "Public",
|
|
@@ -210,16 +223,16 @@ var en = {
|
|
|
210
223
|
"aviation-save-success": "{{warningType}} has succesfully been saved!",
|
|
211
224
|
"aviation-publish-success": "{{warningType}} has succesfully been published!",
|
|
212
225
|
"publish-this-product": "Are you sure you want to publish this {{product}}?",
|
|
213
|
-
"yes-cancel": "
|
|
226
|
+
"yes-cancel": "Cancel {{product}}",
|
|
214
227
|
"cancel-this-product": "Are you sure you want to cancel this {{product}}?",
|
|
215
228
|
"cancel-message": "Cancel message",
|
|
216
229
|
"will-cancel-message": "Will cancel warning",
|
|
217
|
-
"tac-label": "TAC:",
|
|
218
230
|
"aviation-cancel-success": "{{warningType}} has succesfully been cancelled!",
|
|
219
231
|
"aviation-discard-success": "{{warningType}} has been discarded!",
|
|
220
232
|
"error-auth-login": "This feature is protected by authentication. Please log in to proceed",
|
|
221
233
|
"cancel-warningType": "Cancel {{warningType}}",
|
|
222
234
|
cancelling: "Cancelling",
|
|
235
|
+
loading: "Loading...",
|
|
223
236
|
"maritime-new-warning": "New warning",
|
|
224
237
|
"maritime-add-area": "Add",
|
|
225
238
|
"maritime-no-area-selected": "(no area selected)",
|
|
@@ -269,7 +282,9 @@ var en = {
|
|
|
269
282
|
"maritime-warning-post-success": "Warning published successfully",
|
|
270
283
|
"maritime-loading-config": "Loading config...",
|
|
271
284
|
"maritime-config-error": "Something went wrong with loading the configuration file",
|
|
272
|
-
"maritime-warning-validuntil": "End time: "
|
|
285
|
+
"maritime-warning-validuntil": "End time: ",
|
|
286
|
+
"maritime-wind-change-warning": "The entered wind change exceeds 180°. Please check if veering / backing is correct.",
|
|
287
|
+
"maritime-wind-change-error": "A wind change less than 45° is not allowed."
|
|
273
288
|
};
|
|
274
289
|
var nl = {
|
|
275
290
|
"drawing-tool-form-tools": "Gereedschap",
|
|
@@ -369,6 +384,7 @@ var nl = {
|
|
|
369
384
|
"warning-list-status-published": "Gepubliceerd",
|
|
370
385
|
"warning-list-status-todo": "Te doen",
|
|
371
386
|
"warning-list-status-expired": "Verlopen en Ingetrokken (laatste 24 uur)",
|
|
387
|
+
"warning-list-status-expired-custom-time": "Verlopen en Ingetrokken",
|
|
372
388
|
"warning-list-header-incident": "Incident",
|
|
373
389
|
"warning-list-header-incidents": "Incidenten",
|
|
374
390
|
"warning-list-header-last-update": "Laatste update",
|
|
@@ -401,6 +417,15 @@ var nl = {
|
|
|
401
417
|
"filter-phenomenon": "Fenomenen",
|
|
402
418
|
"filter-level": "Niveaus",
|
|
403
419
|
"filter-source": "Bronnen",
|
|
420
|
+
"filter-time": "Tijdsfilter",
|
|
421
|
+
"filter-time-no-filter": "Geen filter",
|
|
422
|
+
"filter-time-today": "Vandaag",
|
|
423
|
+
"filter-time-tomorrow": "Morgen",
|
|
424
|
+
"filter-time-custom": "Selecteer een tijdsspanne",
|
|
425
|
+
"filter-time-apply": "Pas toe",
|
|
426
|
+
"filter-choose-date-time": "Kies een datum en tijd",
|
|
427
|
+
"filter-start": "Start",
|
|
428
|
+
"filter-end": "Eind",
|
|
404
429
|
"warning-dialog-expire-succes": "Waarschuwing laten verlopen is succesvol",
|
|
405
430
|
"warning-dialog-expire-title": "Waarschuwing laten verlopen",
|
|
406
431
|
"warning-dialog-expire-confirm": "Verlopen",
|
|
@@ -425,6 +450,7 @@ var nl = {
|
|
|
425
450
|
"error-auth-login": "Deze functie wordt beschermd door authenticatie. Log in om verder te gaan",
|
|
426
451
|
"cancel-warningType": "Annuleer {{warningType}}",
|
|
427
452
|
cancelling: "Annuleren",
|
|
453
|
+
loading: "Laden...",
|
|
428
454
|
"maritime-new-warning": "Nieuwe waarschuwing",
|
|
429
455
|
"maritime-add-area": "Toevoegen",
|
|
430
456
|
"maritime-no-area-selected": "(geen gebied geselecteerd)",
|
|
@@ -470,7 +496,9 @@ var nl = {
|
|
|
470
496
|
"maritime-warning-post-success": "Waarschuwing succesvol gepubliceerd",
|
|
471
497
|
"maritime-loading-config": "Laden van configuratie...",
|
|
472
498
|
"maritime-config-error": "Er is iets misgegaan bij het laden van het configuratiebestand",
|
|
473
|
-
"maritime-warning-validuntil": "Eind tijd: "
|
|
499
|
+
"maritime-warning-validuntil": "Eind tijd: ",
|
|
500
|
+
"maritime-wind-change-warning": "De ingevulde wind wijziging overschrijdt 180°. Controleer of ruimend / krimpend klopt.",
|
|
501
|
+
"maritime-wind-change-error": "Een wind wijziging van minder dan 45° is niet toegestaan."
|
|
474
502
|
};
|
|
475
503
|
var fi = {
|
|
476
504
|
"drawing-tool-form-tools": "Työkalut",
|
|
@@ -570,6 +598,7 @@ var fi = {
|
|
|
570
598
|
"warning-list-status-published": "Julkaistua",
|
|
571
599
|
"warning-list-status-todo": "Arvostelua",
|
|
572
600
|
"warning-list-status-expired": "Vanhentunutta (viimeiset 24 tuntia)",
|
|
601
|
+
"warning-list-status-expired-custom-time": "Vanhentunutta",
|
|
573
602
|
"warning-list-header-incident": "Ongelmaa",
|
|
574
603
|
"warning-list-header-incidents": "Ongelmia",
|
|
575
604
|
"warning-list-header-last-update": "Viimeisin päivitys",
|
|
@@ -602,6 +631,15 @@ var fi = {
|
|
|
602
631
|
"filter-phenomenon": "ei käännetty",
|
|
603
632
|
"filter-level": "ei käännetty",
|
|
604
633
|
"filter-source": "ei käännetty",
|
|
634
|
+
"filter-time": "Aikarajaus",
|
|
635
|
+
"filter-time-no-filter": "Ei rajausta",
|
|
636
|
+
"filter-time-today": "Tänään",
|
|
637
|
+
"filter-time-tomorrow": "Huomenna",
|
|
638
|
+
"filter-time-custom": "Valitse aikaväli",
|
|
639
|
+
"filter-time-apply": "Käytä",
|
|
640
|
+
"filter-choose-date-time": "Valitse päivämäärä ja aika",
|
|
641
|
+
"filter-start": "Alku",
|
|
642
|
+
"filter-end": "Loppu",
|
|
605
643
|
"warning-dialog-expire-succes": "ei käännetty",
|
|
606
644
|
"warning-dialog-expire-title": "ei käännetty",
|
|
607
645
|
"warning-dialog-expire-confirm": "ei käännetty",
|
|
@@ -626,6 +664,7 @@ var fi = {
|
|
|
626
664
|
"error-auth-login": "Tämän toiminnallisuuden käyttäminen vaatii tunnistautumista. Kirjaudu sisään jatkaaksesi",
|
|
627
665
|
"cancel-warningType": "Peruuta {{warningType}}",
|
|
628
666
|
cancelling: "Peruuttaminen",
|
|
667
|
+
loading: "Ladataan...",
|
|
629
668
|
"maritime-editor-off": "Et ole enää {{domain}} -merivaroitusten muokkaaja",
|
|
630
669
|
"maritime-warning-post-success": "Varoitus julkaistu onnistuneesti"
|
|
631
670
|
};
|
|
@@ -727,6 +766,7 @@ var no = {
|
|
|
727
766
|
"warning-list-status-published": "Publisert",
|
|
728
767
|
"warning-list-status-todo": "Til sjekk",
|
|
729
768
|
"warning-list-status-expired": "Utgått (siste 24 timer)",
|
|
769
|
+
"warning-list-status-expired-custom-time": "Utgått",
|
|
730
770
|
"warning-list-header-incident": "Hendelse",
|
|
731
771
|
"warning-list-header-incidents": "Hendelser",
|
|
732
772
|
"warning-list-header-last-update": "Sist oppdatert",
|
|
@@ -759,6 +799,15 @@ var no = {
|
|
|
759
799
|
"filter-phenomenon": "Fenomen",
|
|
760
800
|
"filter-level": "Grad",
|
|
761
801
|
"filter-source": "Kilder",
|
|
802
|
+
"filter-time": "Tidsfilter",
|
|
803
|
+
"filter-time-no-filter": "Ingen filter",
|
|
804
|
+
"filter-time-today": "I dag",
|
|
805
|
+
"filter-time-tomorrow": "I morgen",
|
|
806
|
+
"filter-time-custom": "Velg tidsintervall",
|
|
807
|
+
"filter-time-apply": "Bruk",
|
|
808
|
+
"filter-choose-date-time": "Velg data og tid",
|
|
809
|
+
"filter-start": "Start",
|
|
810
|
+
"filter-end": "Slutt",
|
|
762
811
|
"warning-dialog-expire-succes": "Varselet er utgått",
|
|
763
812
|
"warning-dialog-expire-title": "Opphør varsel",
|
|
764
813
|
"warning-dialog-expire-confirm": "Opphør",
|
|
@@ -776,13 +825,14 @@ var no = {
|
|
|
776
825
|
"aviation-save-success": "{{warningType}} has succesfully been saved!",
|
|
777
826
|
"aviation-publish-success": "{{warningType}} has succesfully been published!",
|
|
778
827
|
"publish-this-product": "Are you sure you want to publish this {{product}}?",
|
|
779
|
-
"yes-cancel": "
|
|
828
|
+
"yes-cancel": "Cancel {{product}}",
|
|
780
829
|
"cancel-this-product": "Are you sure you want to cancel this {{product}}?",
|
|
781
830
|
"aviation-cancel-success": "{{warningType}} has succesfully been cancelled!",
|
|
782
831
|
"aviation-discard-success": "{{warningType}} has been discarded!",
|
|
783
832
|
"error-auth-login": "Denne delen er passordbeskyttet. Vennligst logg inn.",
|
|
784
833
|
"cancel-warningType": "Cancel {{warningType}}",
|
|
785
|
-
cancelling: "Cancelling"
|
|
834
|
+
cancelling: "Cancelling",
|
|
835
|
+
loading: "Laster..."
|
|
786
836
|
};
|
|
787
837
|
var warningsTranslations = {
|
|
788
838
|
en: en,
|
|
@@ -2457,12 +2507,6 @@ var domainPhenomena = {
|
|
|
2457
2507
|
"public": [].concat(Object.keys(Phenomenon$1))
|
|
2458
2508
|
};
|
|
2459
2509
|
var defaultPhenomenonFilter = makeFilterFromList(Object.keys(AllPhenomenaKeys));
|
|
2460
|
-
var initialFilters = {
|
|
2461
|
-
source: defaultEmptyFilter,
|
|
2462
|
-
domain: defaultDomainFilter,
|
|
2463
|
-
phenomenon: defaultPhenomenonFilter,
|
|
2464
|
-
level: defaultLevelFilter
|
|
2465
|
-
};
|
|
2466
2510
|
var getSelectedOptions = function getSelectedOptions(options) {
|
|
2467
2511
|
if (options === void 0) {
|
|
2468
2512
|
options = {};
|
|
@@ -2497,13 +2541,14 @@ var updateState = function updateState(state, optionKey, value, only) {
|
|
|
2497
2541
|
};
|
|
2498
2542
|
/** Make sure our value is in the filter */
|
|
2499
2543
|
var getValue = function getValue(values, value) {
|
|
2500
|
-
|
|
2544
|
+
var _Object$values$find;
|
|
2545
|
+
return (_Object$values$find = Object.values(values).find(function (existingValue) {
|
|
2501
2546
|
return existingValue === value;
|
|
2502
|
-
})
|
|
2547
|
+
})) != null ? _Object$values$find : emptyFilterId;
|
|
2503
2548
|
};
|
|
2504
2549
|
var getFiltersFromWarnings = function getFiltersFromWarnings(warnings, filterKey) {
|
|
2505
2550
|
var filterOptions = [emptyFilterId];
|
|
2506
|
-
if (!warnings
|
|
2551
|
+
if (!(warnings != null && warnings.length)) {
|
|
2507
2552
|
// return default list
|
|
2508
2553
|
return filterOptions;
|
|
2509
2554
|
}
|
|
@@ -2517,6 +2562,84 @@ var getFiltersFromWarnings = function getFiltersFromWarnings(warnings, filterKey
|
|
|
2517
2562
|
});
|
|
2518
2563
|
return filterOptions;
|
|
2519
2564
|
};
|
|
2565
|
+
var TimeFilterMode;
|
|
2566
|
+
(function (TimeFilterMode) {
|
|
2567
|
+
TimeFilterMode["all"] = "all";
|
|
2568
|
+
TimeFilterMode["today"] = "today";
|
|
2569
|
+
TimeFilterMode["tomorrow"] = "tomorrow";
|
|
2570
|
+
TimeFilterMode["custom"] = "custom";
|
|
2571
|
+
})(TimeFilterMode || (TimeFilterMode = {}));
|
|
2572
|
+
var defaultTimeFilter = {
|
|
2573
|
+
mode: TimeFilterMode.all
|
|
2574
|
+
};
|
|
2575
|
+
var isWarningWithinInterval = function isWarningWithinInterval(warning, timeFilter) {
|
|
2576
|
+
// "NO FILTER"
|
|
2577
|
+
if (timeFilter.mode === TimeFilterMode.all) {
|
|
2578
|
+
return true;
|
|
2579
|
+
}
|
|
2580
|
+
var warningStart = new Date(warning.warningDetail.validFrom);
|
|
2581
|
+
var warningEnd = new Date(warning.warningDetail.validUntil);
|
|
2582
|
+
// CUSTOM TIME SPAN
|
|
2583
|
+
if (timeFilter.mode === TimeFilterMode.custom) {
|
|
2584
|
+
if (!timeFilter.customStart || !timeFilter.customEnd) {
|
|
2585
|
+
return true;
|
|
2586
|
+
}
|
|
2587
|
+
var filterStart = new Date(timeFilter.customStart);
|
|
2588
|
+
var filterEnd = new Date(timeFilter.customEnd);
|
|
2589
|
+
return warningEnd >= filterStart && warningStart <= filterEnd;
|
|
2590
|
+
}
|
|
2591
|
+
// TODAY or TOMORROW
|
|
2592
|
+
var now = new Date();
|
|
2593
|
+
var rangeStart;
|
|
2594
|
+
var rangeEnd;
|
|
2595
|
+
if (timeFilter.mode === TimeFilterMode.today) {
|
|
2596
|
+
// TODAY
|
|
2597
|
+
rangeStart = dateUtils.startOfDayUTC(now);
|
|
2598
|
+
rangeEnd = dateUtils.set(rangeStart, {
|
|
2599
|
+
date: rangeStart.getUTCDate() + 1,
|
|
2600
|
+
hours: 0,
|
|
2601
|
+
minutes: 0,
|
|
2602
|
+
seconds: 0
|
|
2603
|
+
});
|
|
2604
|
+
} else {
|
|
2605
|
+
// TOMORROW
|
|
2606
|
+
rangeStart = dateUtils.set(now, {
|
|
2607
|
+
date: now.getUTCDate() + 1,
|
|
2608
|
+
hours: 0,
|
|
2609
|
+
minutes: 0,
|
|
2610
|
+
seconds: 0
|
|
2611
|
+
});
|
|
2612
|
+
rangeEnd = dateUtils.set(rangeStart, {
|
|
2613
|
+
date: rangeStart.getUTCDate() + 1,
|
|
2614
|
+
hours: 0,
|
|
2615
|
+
minutes: 0,
|
|
2616
|
+
seconds: 0
|
|
2617
|
+
});
|
|
2618
|
+
}
|
|
2619
|
+
return warningEnd >= rangeStart && warningStart <= rangeEnd;
|
|
2620
|
+
};
|
|
2621
|
+
var getApiParams = function getApiParams(timeFilter) {
|
|
2622
|
+
if (timeFilter.mode === TimeFilterMode.all) {
|
|
2623
|
+
return {};
|
|
2624
|
+
}
|
|
2625
|
+
if (timeFilter.mode === TimeFilterMode.custom) {
|
|
2626
|
+
if (!timeFilter.customStart || !timeFilter.customEnd) {
|
|
2627
|
+
return {};
|
|
2628
|
+
}
|
|
2629
|
+
return {
|
|
2630
|
+
start_time: new Date(timeFilter.customStart).toISOString(),
|
|
2631
|
+
end_time: new Date(timeFilter.customEnd).toISOString()
|
|
2632
|
+
};
|
|
2633
|
+
}
|
|
2634
|
+
return {};
|
|
2635
|
+
};
|
|
2636
|
+
var initialFilters = {
|
|
2637
|
+
source: defaultEmptyFilter,
|
|
2638
|
+
domain: defaultDomainFilter,
|
|
2639
|
+
phenomenon: defaultPhenomenonFilter,
|
|
2640
|
+
level: defaultLevelFilter,
|
|
2641
|
+
time: defaultTimeFilter
|
|
2642
|
+
};
|
|
2520
2643
|
|
|
2521
2644
|
/* *
|
|
2522
2645
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -4152,6 +4275,10 @@ var DrawingToolFormConnect = function DrawingToolFormConnect() {
|
|
|
4152
4275
|
var featureLayerGeoJSONProperties = useSelector(function (store) {
|
|
4153
4276
|
return layerSelectors.getFeatureLayerGeoJSONProperties(store, drawTool == null ? void 0 : drawTool.geoJSONLayerId);
|
|
4154
4277
|
});
|
|
4278
|
+
var isFormDirty = useSelector(function (store) {
|
|
4279
|
+
return getWarningFormDirty(store, drawingDialogType);
|
|
4280
|
+
});
|
|
4281
|
+
usePreventBrowserClose(isFormDirty || isLayerInEditMode);
|
|
4155
4282
|
var onSubmitForm = React.useCallback(function (formValues) {
|
|
4156
4283
|
saveOrUpdateDrawing({
|
|
4157
4284
|
id: drawing == null ? void 0 : drawing.id,
|
|
@@ -4498,16 +4625,70 @@ var config = sessionStorageProvider.getConfig();
|
|
|
4498
4625
|
var airmetBaseUrl = config.GW_AIRMET_BASE_URL || '';
|
|
4499
4626
|
var sigmetBaseUrl = config.GW_SIGMET_BASE_URL || '';
|
|
4500
4627
|
// API
|
|
4501
|
-
var getAirmetList = function
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4628
|
+
var getAirmetList = /*#__PURE__*/function () {
|
|
4629
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(auth, params) {
|
|
4630
|
+
var queryParams, url, response, data;
|
|
4631
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
4632
|
+
while (1) switch (_context.prev = _context.next) {
|
|
4633
|
+
case 0:
|
|
4634
|
+
if (params === void 0) {
|
|
4635
|
+
params = {};
|
|
4636
|
+
}
|
|
4637
|
+
queryParams = new URLSearchParams(params);
|
|
4638
|
+
url = airmetBaseUrl + "/airmetlist" + (queryParams.toString() ? "?" + queryParams.toString() : '');
|
|
4639
|
+
_context.next = 5;
|
|
4640
|
+
return fetch(url, {
|
|
4641
|
+
headers: getHeaders(auth)
|
|
4642
|
+
});
|
|
4643
|
+
case 5:
|
|
4644
|
+
response = _context.sent;
|
|
4645
|
+
_context.next = 8;
|
|
4646
|
+
return handleResponse(response);
|
|
4647
|
+
case 8:
|
|
4648
|
+
data = _context.sent;
|
|
4649
|
+
return _context.abrupt("return", data);
|
|
4650
|
+
case 10:
|
|
4651
|
+
case "end":
|
|
4652
|
+
return _context.stop();
|
|
4653
|
+
}
|
|
4654
|
+
}, _callee);
|
|
4655
|
+
}));
|
|
4656
|
+
return function getAirmetList(_x, _x2) {
|
|
4657
|
+
return _ref.apply(this, arguments);
|
|
4658
|
+
};
|
|
4659
|
+
}();
|
|
4660
|
+
var getSigmetList = /*#__PURE__*/function () {
|
|
4661
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(auth, params) {
|
|
4662
|
+
var queryParams, url, response, data;
|
|
4663
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
4664
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
4665
|
+
case 0:
|
|
4666
|
+
if (params === void 0) {
|
|
4667
|
+
params = {};
|
|
4668
|
+
}
|
|
4669
|
+
queryParams = new URLSearchParams(params);
|
|
4670
|
+
url = sigmetBaseUrl + "/sigmetlist" + (queryParams.toString() ? "?" + queryParams.toString() : '');
|
|
4671
|
+
_context2.next = 5;
|
|
4672
|
+
return fetch(url, {
|
|
4673
|
+
headers: getHeaders(auth)
|
|
4674
|
+
});
|
|
4675
|
+
case 5:
|
|
4676
|
+
response = _context2.sent;
|
|
4677
|
+
_context2.next = 8;
|
|
4678
|
+
return handleResponse(response);
|
|
4679
|
+
case 8:
|
|
4680
|
+
data = _context2.sent;
|
|
4681
|
+
return _context2.abrupt("return", data);
|
|
4682
|
+
case 10:
|
|
4683
|
+
case "end":
|
|
4684
|
+
return _context2.stop();
|
|
4685
|
+
}
|
|
4686
|
+
}, _callee2);
|
|
4687
|
+
}));
|
|
4688
|
+
return function getSigmetList(_x3, _x4) {
|
|
4689
|
+
return _ref2.apply(this, arguments);
|
|
4690
|
+
};
|
|
4691
|
+
}();
|
|
4511
4692
|
var getAirmetConfig = function getAirmetConfig(auth) {
|
|
4512
4693
|
return fetch(airmetBaseUrl + "/airmet-config", {
|
|
4513
4694
|
headers: getHeaders(auth)
|
|
@@ -4522,144 +4703,144 @@ var getSigmetConfig = function getSigmetConfig(auth) {
|
|
|
4522
4703
|
return result.json();
|
|
4523
4704
|
});
|
|
4524
4705
|
};
|
|
4525
|
-
var getAirmetTAC = function getAirmetTAC(
|
|
4706
|
+
var getAirmetTAC = function getAirmetTAC(product, auth) {
|
|
4526
4707
|
return fetch(airmetBaseUrl + "/airmet2tac", {
|
|
4527
4708
|
body: JSON.stringify(product),
|
|
4528
4709
|
method: 'POST',
|
|
4529
4710
|
headers: getHeaders(auth)
|
|
4530
4711
|
}).then(/*#__PURE__*/function () {
|
|
4531
|
-
var
|
|
4712
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(result) {
|
|
4532
4713
|
var textData;
|
|
4533
|
-
return _regeneratorRuntime().wrap(function
|
|
4534
|
-
while (1) switch (
|
|
4714
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
4715
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
4535
4716
|
case 0:
|
|
4536
4717
|
if (!(result.status === 200)) {
|
|
4537
|
-
|
|
4718
|
+
_context3.next = 5;
|
|
4538
4719
|
break;
|
|
4539
4720
|
}
|
|
4540
|
-
|
|
4721
|
+
_context3.next = 3;
|
|
4541
4722
|
return result.text();
|
|
4542
4723
|
case 3:
|
|
4543
|
-
textData =
|
|
4544
|
-
return
|
|
4724
|
+
textData = _context3.sent;
|
|
4725
|
+
return _context3.abrupt("return", {
|
|
4545
4726
|
data: textData
|
|
4546
4727
|
});
|
|
4547
4728
|
case 5:
|
|
4548
4729
|
throw new Error("Failed to fetch TAC data: " + result.statusText);
|
|
4549
4730
|
case 6:
|
|
4550
4731
|
case "end":
|
|
4551
|
-
return
|
|
4732
|
+
return _context3.stop();
|
|
4552
4733
|
}
|
|
4553
|
-
},
|
|
4734
|
+
}, _callee3);
|
|
4554
4735
|
}));
|
|
4555
|
-
return function (
|
|
4556
|
-
return
|
|
4736
|
+
return function (_x5) {
|
|
4737
|
+
return _ref3.apply(this, arguments);
|
|
4557
4738
|
};
|
|
4558
4739
|
}());
|
|
4559
4740
|
};
|
|
4560
|
-
var getSigmetTAC = function getSigmetTAC(
|
|
4741
|
+
var getSigmetTAC = function getSigmetTAC(product, auth) {
|
|
4561
4742
|
return fetch(sigmetBaseUrl + "/sigmet2tac", {
|
|
4562
4743
|
body: JSON.stringify(product),
|
|
4563
4744
|
method: 'POST',
|
|
4564
4745
|
headers: getHeaders(auth)
|
|
4565
4746
|
}).then(/*#__PURE__*/function () {
|
|
4566
|
-
var
|
|
4747
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(result) {
|
|
4567
4748
|
var textData;
|
|
4568
|
-
return _regeneratorRuntime().wrap(function
|
|
4569
|
-
while (1) switch (
|
|
4749
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
4750
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
4570
4751
|
case 0:
|
|
4571
4752
|
if (!(result.status === 200)) {
|
|
4572
|
-
|
|
4753
|
+
_context4.next = 5;
|
|
4573
4754
|
break;
|
|
4574
4755
|
}
|
|
4575
|
-
|
|
4756
|
+
_context4.next = 3;
|
|
4576
4757
|
return result.text();
|
|
4577
4758
|
case 3:
|
|
4578
|
-
textData =
|
|
4579
|
-
return
|
|
4759
|
+
textData = _context4.sent;
|
|
4760
|
+
return _context4.abrupt("return", {
|
|
4580
4761
|
data: textData
|
|
4581
4762
|
});
|
|
4582
4763
|
case 5:
|
|
4583
4764
|
throw new Error("Failed to fetch TAC data: " + result.statusText);
|
|
4584
4765
|
case 6:
|
|
4585
4766
|
case "end":
|
|
4586
|
-
return
|
|
4767
|
+
return _context4.stop();
|
|
4587
4768
|
}
|
|
4588
|
-
},
|
|
4769
|
+
}, _callee4);
|
|
4589
4770
|
}));
|
|
4590
|
-
return function (
|
|
4591
|
-
return
|
|
4771
|
+
return function (_x6) {
|
|
4772
|
+
return _ref4.apply(this, arguments);
|
|
4592
4773
|
};
|
|
4593
4774
|
}());
|
|
4594
4775
|
};
|
|
4595
4776
|
// For cancel TAC (not normal TAC)
|
|
4596
|
-
var getAirmetCancelTAC = function getAirmetCancelTAC(
|
|
4777
|
+
var getAirmetCancelTAC = function getAirmetCancelTAC(product, auth) {
|
|
4597
4778
|
return fetch(airmetBaseUrl + "/airmet2cancel2tac", {
|
|
4598
4779
|
body: JSON.stringify(product),
|
|
4599
4780
|
method: 'POST',
|
|
4600
4781
|
headers: getHeaders(auth)
|
|
4601
4782
|
}).then(/*#__PURE__*/function () {
|
|
4602
|
-
var
|
|
4783
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(result) {
|
|
4603
4784
|
var textData;
|
|
4604
|
-
return _regeneratorRuntime().wrap(function
|
|
4605
|
-
while (1) switch (
|
|
4785
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
4786
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
4606
4787
|
case 0:
|
|
4607
4788
|
if (!(result.status === 200)) {
|
|
4608
|
-
|
|
4789
|
+
_context5.next = 5;
|
|
4609
4790
|
break;
|
|
4610
4791
|
}
|
|
4611
|
-
|
|
4792
|
+
_context5.next = 3;
|
|
4612
4793
|
return result.text();
|
|
4613
4794
|
case 3:
|
|
4614
|
-
textData =
|
|
4615
|
-
return
|
|
4795
|
+
textData = _context5.sent;
|
|
4796
|
+
return _context5.abrupt("return", {
|
|
4616
4797
|
data: textData
|
|
4617
4798
|
});
|
|
4618
4799
|
case 5:
|
|
4619
4800
|
throw new Error("Failed to fetch Cancel TAC data: " + result.statusText);
|
|
4620
4801
|
case 6:
|
|
4621
4802
|
case "end":
|
|
4622
|
-
return
|
|
4803
|
+
return _context5.stop();
|
|
4623
4804
|
}
|
|
4624
|
-
},
|
|
4805
|
+
}, _callee5);
|
|
4625
4806
|
}));
|
|
4626
|
-
return function (
|
|
4627
|
-
return
|
|
4807
|
+
return function (_x7) {
|
|
4808
|
+
return _ref5.apply(this, arguments);
|
|
4628
4809
|
};
|
|
4629
4810
|
}());
|
|
4630
4811
|
};
|
|
4631
|
-
var getSigmetCancelTAC = function getSigmetCancelTAC(
|
|
4812
|
+
var getSigmetCancelTAC = function getSigmetCancelTAC(product, auth) {
|
|
4632
4813
|
return fetch(sigmetBaseUrl + "/sigmet2cancel2tac", {
|
|
4633
4814
|
body: JSON.stringify(product),
|
|
4634
4815
|
method: 'POST',
|
|
4635
4816
|
headers: getHeaders(auth)
|
|
4636
4817
|
}).then(/*#__PURE__*/function () {
|
|
4637
|
-
var
|
|
4818
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(result) {
|
|
4638
4819
|
var textData;
|
|
4639
|
-
return _regeneratorRuntime().wrap(function
|
|
4640
|
-
while (1) switch (
|
|
4820
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
4821
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
4641
4822
|
case 0:
|
|
4642
4823
|
if (!(result.status === 200)) {
|
|
4643
|
-
|
|
4824
|
+
_context6.next = 5;
|
|
4644
4825
|
break;
|
|
4645
4826
|
}
|
|
4646
|
-
|
|
4827
|
+
_context6.next = 3;
|
|
4647
4828
|
return result.text();
|
|
4648
4829
|
case 3:
|
|
4649
|
-
textData =
|
|
4650
|
-
return
|
|
4830
|
+
textData = _context6.sent;
|
|
4831
|
+
return _context6.abrupt("return", {
|
|
4651
4832
|
data: textData
|
|
4652
4833
|
});
|
|
4653
4834
|
case 5:
|
|
4654
4835
|
throw new Error("Failed to fetch Cancel TAC data: " + result.statusText);
|
|
4655
4836
|
case 6:
|
|
4656
4837
|
case "end":
|
|
4657
|
-
return
|
|
4838
|
+
return _context6.stop();
|
|
4658
4839
|
}
|
|
4659
|
-
},
|
|
4840
|
+
}, _callee6);
|
|
4660
4841
|
}));
|
|
4661
|
-
return function (
|
|
4662
|
-
return
|
|
4842
|
+
return function (_x8) {
|
|
4843
|
+
return _ref6.apply(this, arguments);
|
|
4663
4844
|
};
|
|
4664
4845
|
}());
|
|
4665
4846
|
};
|
|
@@ -4678,6 +4859,137 @@ var postAirmet = function postAirmet(auth, data) {
|
|
|
4678
4859
|
}).then(handleResponse);
|
|
4679
4860
|
};
|
|
4680
4861
|
|
|
4862
|
+
/* *
|
|
4863
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4864
|
+
* you may not use this file except in compliance with the License.
|
|
4865
|
+
* You may obtain a copy of the License at
|
|
4866
|
+
*
|
|
4867
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4868
|
+
*
|
|
4869
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4870
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4871
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4872
|
+
* See the License for the specific language governing permissions and
|
|
4873
|
+
* limitations under the License.
|
|
4874
|
+
*
|
|
4875
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4876
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
4877
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
4878
|
+
* */
|
|
4879
|
+
var LIB_KEY = 'warnings';
|
|
4880
|
+
var API_KEY = 'aviation';
|
|
4881
|
+
var generateAviationQueryKeys = function generateAviationQueryKeys(queryKeys) {
|
|
4882
|
+
return [LIB_KEY, API_KEY].concat(queryKeys);
|
|
4883
|
+
};
|
|
4884
|
+
// 2) Unique keys per query
|
|
4885
|
+
var aviationQueryOptions = {
|
|
4886
|
+
getSigmetTAC: function getSigmetTAC$1(product, credentials) {
|
|
4887
|
+
var _product$uuid;
|
|
4888
|
+
return queryOptions({
|
|
4889
|
+
queryKey: generateAviationQueryKeys(['sigmet', 'tac', (_product$uuid = product.uuid) != null ? _product$uuid : product.firName]),
|
|
4890
|
+
queryFn: function queryFn() {
|
|
4891
|
+
return getSigmetTAC(product, credentials);
|
|
4892
|
+
}
|
|
4893
|
+
});
|
|
4894
|
+
},
|
|
4895
|
+
getAirmetTAC: function getAirmetTAC$1(product, credentials) {
|
|
4896
|
+
var _product$uuid2;
|
|
4897
|
+
return queryOptions({
|
|
4898
|
+
queryKey: generateAviationQueryKeys(['airmet', 'tac', (_product$uuid2 = product.uuid) != null ? _product$uuid2 : product.firName]),
|
|
4899
|
+
queryFn: function queryFn() {
|
|
4900
|
+
return getAirmetTAC(product, credentials);
|
|
4901
|
+
}
|
|
4902
|
+
});
|
|
4903
|
+
},
|
|
4904
|
+
getSigmetCancelTAC: function getSigmetCancelTAC$1(product, credentials) {
|
|
4905
|
+
var _product$uuid3;
|
|
4906
|
+
return queryOptions({
|
|
4907
|
+
queryKey: generateAviationQueryKeys(['sigmet', 'cancel', (_product$uuid3 = product.uuid) != null ? _product$uuid3 : product.firName]),
|
|
4908
|
+
queryFn: function queryFn() {
|
|
4909
|
+
return getSigmetCancelTAC(product, credentials);
|
|
4910
|
+
}
|
|
4911
|
+
});
|
|
4912
|
+
},
|
|
4913
|
+
getAirmetCancelTAC: function getAirmetCancelTAC$1(product, credentials) {
|
|
4914
|
+
var _product$uuid4;
|
|
4915
|
+
return queryOptions({
|
|
4916
|
+
queryKey: generateAviationQueryKeys(['airmet', 'cancel', (_product$uuid4 = product.uuid) != null ? _product$uuid4 : product.firName]),
|
|
4917
|
+
queryFn: function queryFn() {
|
|
4918
|
+
return getAirmetCancelTAC(product, credentials);
|
|
4919
|
+
}
|
|
4920
|
+
});
|
|
4921
|
+
}
|
|
4922
|
+
};
|
|
4923
|
+
|
|
4924
|
+
/* *
|
|
4925
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4926
|
+
* you may not use this file except in compliance with the License.
|
|
4927
|
+
* You may obtain a copy of the License at
|
|
4928
|
+
*
|
|
4929
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4930
|
+
*
|
|
4931
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4932
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4933
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4934
|
+
* See the License for the specific language governing permissions and
|
|
4935
|
+
* limitations under the License.
|
|
4936
|
+
*
|
|
4937
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4938
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
4939
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
4940
|
+
* */
|
|
4941
|
+
var tryParse = function tryParse(st) {
|
|
4942
|
+
try {
|
|
4943
|
+
return JSON.parse(st);
|
|
4944
|
+
} catch (_unused) {
|
|
4945
|
+
return null;
|
|
4946
|
+
}
|
|
4947
|
+
};
|
|
4948
|
+
var joinLoc = function joinLoc(loc) {
|
|
4949
|
+
if (!Array.isArray(loc) || loc.length === 0) {
|
|
4950
|
+
return '';
|
|
4951
|
+
}
|
|
4952
|
+
var start = typeof loc[0] === 'string' && (loc[0] === 'body' || loc[0] === 'query') ? 1 : 0;
|
|
4953
|
+
return loc.slice(start).join('.');
|
|
4954
|
+
};
|
|
4955
|
+
function humanizeApiErrorMessage(err) {
|
|
4956
|
+
// 1) Best effort to extract a message we can parse
|
|
4957
|
+
var raw =
|
|
4958
|
+
// eslint-disable-next-line no-nested-ternary
|
|
4959
|
+
err instanceof Error ? typeof err.message === 'string' ? err.message : String(err.message) : typeof err === 'string' ? err : '';
|
|
4960
|
+
var parsed = raw && (raw.startsWith('{') || raw.startsWith('[')) ? tryParse(raw) : null;
|
|
4961
|
+
// 3) If array of validation errors
|
|
4962
|
+
if (Array.isArray(parsed)) {
|
|
4963
|
+
var lines = parsed.map(function (vi) {
|
|
4964
|
+
var _vi$msg, _vi$msg2;
|
|
4965
|
+
var path = joinLoc(vi.loc);
|
|
4966
|
+
return path ? path + ": " + ((_vi$msg = vi.msg) != null ? _vi$msg : 'Invalid') : (_vi$msg2 = vi.msg) != null ? _vi$msg2 : 'Invalid';
|
|
4967
|
+
});
|
|
4968
|
+
return lines.slice(0, 5).join('; ');
|
|
4969
|
+
}
|
|
4970
|
+
// 4) If parsed is an object with common fields
|
|
4971
|
+
if (parsed && typeof parsed === 'object') {
|
|
4972
|
+
var obj = parsed;
|
|
4973
|
+
if (typeof obj.detail === 'string' && typeof obj.title === 'string') {
|
|
4974
|
+
return obj.title + ": " + obj.detail;
|
|
4975
|
+
}
|
|
4976
|
+
if (typeof obj.message === 'string') {
|
|
4977
|
+
return obj.message;
|
|
4978
|
+
}
|
|
4979
|
+
if (Array.isArray(obj.errors)) {
|
|
4980
|
+
return obj.errors.map(function (e) {
|
|
4981
|
+
var _e$message;
|
|
4982
|
+
return typeof e === 'string' ? e : (_e$message = e == null ? void 0 : e.message) != null ? _e$message : JSON.stringify(e);
|
|
4983
|
+
}).join('; ');
|
|
4984
|
+
}
|
|
4985
|
+
}
|
|
4986
|
+
// 5) If message is [object Object]
|
|
4987
|
+
if (raw.includes('[object Object]')) {
|
|
4988
|
+
return 'Validation failed — check required fields.';
|
|
4989
|
+
}
|
|
4990
|
+
return raw || 'Unknown error occurred';
|
|
4991
|
+
}
|
|
4992
|
+
|
|
4681
4993
|
var getAviationSnackbarKey = function getAviationSnackbarKey(status) {
|
|
4682
4994
|
switch (status) {
|
|
4683
4995
|
case 'PUBLISHED':
|
|
@@ -4690,24 +5002,30 @@ var getAviationSnackbarKey = function getAviationSnackbarKey(status) {
|
|
|
4690
5002
|
return 'aviation-save-success';
|
|
4691
5003
|
}
|
|
4692
5004
|
};
|
|
4693
|
-
var useAirmetList = function useAirmetList(disabled) {
|
|
5005
|
+
var useAirmetList = function useAirmetList(disabled, timeFilter) {
|
|
4694
5006
|
if (disabled === void 0) {
|
|
4695
5007
|
disabled = false;
|
|
4696
5008
|
}
|
|
4697
|
-
|
|
5009
|
+
var apiParams = timeFilter ? getApiParams(timeFilter) : {};
|
|
5010
|
+
return useAuthQuery(['airmet-list', JSON.stringify(apiParams)], function (auth) {
|
|
5011
|
+
return getAirmetList(auth, apiParams);
|
|
5012
|
+
}, disabled);
|
|
4698
5013
|
};
|
|
4699
|
-
var useSigmetList = function useSigmetList(disabled) {
|
|
5014
|
+
var useSigmetList = function useSigmetList(disabled, timeFilter) {
|
|
4700
5015
|
if (disabled === void 0) {
|
|
4701
5016
|
disabled = false;
|
|
4702
5017
|
}
|
|
4703
|
-
|
|
5018
|
+
var apiParams = timeFilter ? getApiParams(timeFilter) : {};
|
|
5019
|
+
return useAuthQuery(['sigmet-list', JSON.stringify(apiParams)], function (auth) {
|
|
5020
|
+
return getSigmetList(auth, apiParams);
|
|
5021
|
+
}, disabled);
|
|
4704
5022
|
};
|
|
4705
5023
|
var useAviationWarnings = function useAviationWarnings() {
|
|
4706
5024
|
var _useAirmetList = useAirmetList(),
|
|
4707
5025
|
airmets = _useAirmetList.data;
|
|
4708
5026
|
var _useSigmetList = useSigmetList(),
|
|
4709
5027
|
sigmets = _useSigmetList.data;
|
|
4710
|
-
return (airmets
|
|
5028
|
+
return (airmets != null ? airmets : []).concat(sigmets != null ? sigmets : []);
|
|
4711
5029
|
};
|
|
4712
5030
|
var useProductConfig = function useProductConfig(warningType, disabled) {
|
|
4713
5031
|
if (disabled === void 0) {
|
|
@@ -4717,108 +5035,192 @@ var useProductConfig = function useProductConfig(warningType, disabled) {
|
|
|
4717
5035
|
var sigmetQuery = useAuthQuery(['sigmet-config'], getSigmetConfig, disabled);
|
|
4718
5036
|
return warningType === 'airmet' ? airmetQuery : sigmetQuery;
|
|
4719
5037
|
};
|
|
4720
|
-
var
|
|
5038
|
+
var useFetchSigmetTAC = function useFetchSigmetTAC(product, enabled) {
|
|
5039
|
+
if (enabled === void 0) {
|
|
5040
|
+
enabled = true;
|
|
5041
|
+
}
|
|
4721
5042
|
var _useAuthenticationCon = useAuthenticationContext(),
|
|
4722
5043
|
auth = _useAuthenticationCon.auth;
|
|
4723
|
-
|
|
4724
|
-
|
|
4725
|
-
|
|
4726
|
-
queryKey: ['sigmet-tac', product],
|
|
4727
|
-
queryFn: function queryFn() {
|
|
4728
|
-
return getSigmetTAC(auth, product);
|
|
4729
|
-
},
|
|
4730
|
-
staleTime: 1000 * 15
|
|
4731
|
-
});
|
|
4732
|
-
};
|
|
4733
|
-
var fetchAirmetTAC = function fetchAirmetTAC(product) {
|
|
4734
|
-
return queryClient.fetchQuery({
|
|
4735
|
-
queryKey: ['airmet-tac', product],
|
|
4736
|
-
queryFn: function queryFn() {
|
|
4737
|
-
return getAirmetTAC(auth, product);
|
|
4738
|
-
},
|
|
4739
|
-
staleTime: 1000 * 15
|
|
4740
|
-
});
|
|
4741
|
-
};
|
|
4742
|
-
var fetchSigmetCancelTAC = function fetchSigmetCancelTAC(product) {
|
|
4743
|
-
return queryClient.fetchQuery({
|
|
4744
|
-
queryKey: ['sigmet-cancel-tac', product],
|
|
4745
|
-
queryFn: function queryFn() {
|
|
4746
|
-
return getSigmetCancelTAC(auth, product);
|
|
4747
|
-
},
|
|
4748
|
-
staleTime: 1000 * 15
|
|
4749
|
-
});
|
|
4750
|
-
};
|
|
4751
|
-
var fetchAirmetCancelTAC = function fetchAirmetCancelTAC(product) {
|
|
4752
|
-
return queryClient.fetchQuery({
|
|
4753
|
-
queryKey: ['airmet-cancel-tac', product],
|
|
4754
|
-
queryFn: function queryFn() {
|
|
4755
|
-
return getAirmetCancelTAC(auth, product);
|
|
4756
|
-
},
|
|
4757
|
-
staleTime: 1000 * 15
|
|
4758
|
-
});
|
|
4759
|
-
};
|
|
4760
|
-
return {
|
|
4761
|
-
fetchSigmetTAC: fetchSigmetTAC,
|
|
4762
|
-
fetchAirmetTAC: fetchAirmetTAC,
|
|
4763
|
-
fetchSigmetCancelTAC: fetchSigmetCancelTAC,
|
|
4764
|
-
fetchAirmetCancelTAC: fetchAirmetCancelTAC
|
|
4765
|
-
};
|
|
5044
|
+
return useQuery(Object.assign({}, aviationQueryOptions.getSigmetTAC(product, auth), {
|
|
5045
|
+
enabled: enabled
|
|
5046
|
+
}));
|
|
4766
5047
|
};
|
|
4767
|
-
|
|
4768
|
-
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
* @param onDialogClose - Optional callback to close a dialog.
|
|
4772
|
-
* @returns A mutation result for posting a SIGMET.
|
|
4773
|
-
*/
|
|
4774
|
-
var usePostSigmet = function usePostSigmet() {
|
|
5048
|
+
var useFetchAirmetTAC = function useFetchAirmetTAC(product, enabled) {
|
|
5049
|
+
if (enabled === void 0) {
|
|
5050
|
+
enabled = true;
|
|
5051
|
+
}
|
|
4775
5052
|
var _useAuthenticationCon2 = useAuthenticationContext(),
|
|
4776
5053
|
auth = _useAuthenticationCon2.auth;
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
5054
|
+
return useQuery(Object.assign({}, aviationQueryOptions.getAirmetTAC(product, auth), {
|
|
5055
|
+
enabled: enabled
|
|
5056
|
+
}));
|
|
5057
|
+
};
|
|
5058
|
+
var useFetchSigmetCancelTAC = function useFetchSigmetCancelTAC(product, enabled) {
|
|
5059
|
+
if (enabled === void 0) {
|
|
5060
|
+
enabled = true;
|
|
5061
|
+
}
|
|
5062
|
+
var _useAuthenticationCon3 = useAuthenticationContext(),
|
|
5063
|
+
auth = _useAuthenticationCon3.auth;
|
|
5064
|
+
return useQuery(Object.assign({}, aviationQueryOptions.getSigmetCancelTAC(product, auth), {
|
|
5065
|
+
enabled: enabled
|
|
5066
|
+
}));
|
|
5067
|
+
};
|
|
5068
|
+
var useFetchAirmetCancelTAC = function useFetchAirmetCancelTAC(product, enabled) {
|
|
5069
|
+
if (enabled === void 0) {
|
|
5070
|
+
enabled = true;
|
|
5071
|
+
}
|
|
5072
|
+
var _useAuthenticationCon4 = useAuthenticationContext(),
|
|
5073
|
+
auth = _useAuthenticationCon4.auth;
|
|
5074
|
+
return useQuery(Object.assign({}, aviationQueryOptions.getAirmetCancelTAC(product, auth), {
|
|
5075
|
+
enabled: enabled
|
|
5076
|
+
}));
|
|
5077
|
+
};
|
|
5078
|
+
var useTACApi = function useTACApi() {
|
|
5079
|
+
var _useAuthenticationCon5 = useAuthenticationContext(),
|
|
5080
|
+
auth = _useAuthenticationCon5.auth;
|
|
5081
|
+
var queryClient = new QueryClient();
|
|
5082
|
+
return {
|
|
5083
|
+
fetchSigmetTAC: function () {
|
|
5084
|
+
var _fetchSigmetTAC = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(product) {
|
|
5085
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
5086
|
+
while (1) switch (_context.prev = _context.next) {
|
|
5087
|
+
case 0:
|
|
5088
|
+
return _context.abrupt("return", queryClient.fetchQuery(aviationQueryOptions.getSigmetTAC(product, auth)));
|
|
5089
|
+
case 1:
|
|
5090
|
+
case "end":
|
|
5091
|
+
return _context.stop();
|
|
5092
|
+
}
|
|
5093
|
+
}, _callee);
|
|
5094
|
+
}));
|
|
5095
|
+
function fetchSigmetTAC(_x) {
|
|
5096
|
+
return _fetchSigmetTAC.apply(this, arguments);
|
|
4785
5097
|
}
|
|
4786
|
-
return
|
|
4787
|
-
},
|
|
5098
|
+
return fetchSigmetTAC;
|
|
5099
|
+
}(),
|
|
5100
|
+
fetchAirmetTAC: function () {
|
|
5101
|
+
var _fetchAirmetTAC = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(product) {
|
|
5102
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
5103
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
5104
|
+
case 0:
|
|
5105
|
+
return _context2.abrupt("return", queryClient.fetchQuery(aviationQueryOptions.getAirmetTAC(product, auth)));
|
|
5106
|
+
case 1:
|
|
5107
|
+
case "end":
|
|
5108
|
+
return _context2.stop();
|
|
5109
|
+
}
|
|
5110
|
+
}, _callee2);
|
|
5111
|
+
}));
|
|
5112
|
+
function fetchAirmetTAC(_x2) {
|
|
5113
|
+
return _fetchAirmetTAC.apply(this, arguments);
|
|
5114
|
+
}
|
|
5115
|
+
return fetchAirmetTAC;
|
|
5116
|
+
}(),
|
|
5117
|
+
fetchSigmetCancelTAC: function () {
|
|
5118
|
+
var _fetchSigmetCancelTAC = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(product) {
|
|
5119
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
5120
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
5121
|
+
case 0:
|
|
5122
|
+
return _context3.abrupt("return", queryClient.fetchQuery(aviationQueryOptions.getSigmetCancelTAC(product, auth)));
|
|
5123
|
+
case 1:
|
|
5124
|
+
case "end":
|
|
5125
|
+
return _context3.stop();
|
|
5126
|
+
}
|
|
5127
|
+
}, _callee3);
|
|
5128
|
+
}));
|
|
5129
|
+
function fetchSigmetCancelTAC(_x3) {
|
|
5130
|
+
return _fetchSigmetCancelTAC.apply(this, arguments);
|
|
5131
|
+
}
|
|
5132
|
+
return fetchSigmetCancelTAC;
|
|
5133
|
+
}(),
|
|
5134
|
+
fetchAirmetCancelTAC: function () {
|
|
5135
|
+
var _fetchAirmetCancelTAC = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(product) {
|
|
5136
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
5137
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
5138
|
+
case 0:
|
|
5139
|
+
return _context4.abrupt("return", queryClient.fetchQuery(aviationQueryOptions.getAirmetCancelTAC(product, auth)));
|
|
5140
|
+
case 1:
|
|
5141
|
+
case "end":
|
|
5142
|
+
return _context4.stop();
|
|
5143
|
+
}
|
|
5144
|
+
}, _callee4);
|
|
5145
|
+
}));
|
|
5146
|
+
function fetchAirmetCancelTAC(_x4) {
|
|
5147
|
+
return _fetchAirmetCancelTAC.apply(this, arguments);
|
|
5148
|
+
}
|
|
5149
|
+
return fetchAirmetCancelTAC;
|
|
5150
|
+
}()
|
|
5151
|
+
};
|
|
5152
|
+
};
|
|
5153
|
+
/**
|
|
5154
|
+
* Hook for posting a SIGMET, with feedback.
|
|
5155
|
+
*
|
|
5156
|
+
* @param snackBarMessage - Message to show on success.
|
|
5157
|
+
* @param onDialogClose - Optional callback to close a dialog.
|
|
5158
|
+
* @returns A mutation result for posting a SIGMET.
|
|
5159
|
+
*/
|
|
5160
|
+
var usePostSigmet = function usePostSigmet() {
|
|
5161
|
+
var _useAuthenticationCon6 = useAuthenticationContext(),
|
|
5162
|
+
auth = _useAuthenticationCon6.auth;
|
|
5163
|
+
var dispatch = useDispatch();
|
|
5164
|
+
var queryClient = useQueryClient();
|
|
5165
|
+
var _useWarningsTranslati = useWarningsTranslation(),
|
|
5166
|
+
t = _useWarningsTranslati.t;
|
|
5167
|
+
return useMutation({
|
|
5168
|
+
mutationFn: function () {
|
|
5169
|
+
var _mutationFn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(formData) {
|
|
5170
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
5171
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
5172
|
+
case 0:
|
|
5173
|
+
if (auth) {
|
|
5174
|
+
_context5.next = 2;
|
|
5175
|
+
break;
|
|
5176
|
+
}
|
|
5177
|
+
throw new Error('Authentication context not found');
|
|
5178
|
+
case 2:
|
|
5179
|
+
return _context5.abrupt("return", postSigmet(auth, formData));
|
|
5180
|
+
case 3:
|
|
5181
|
+
case "end":
|
|
5182
|
+
return _context5.stop();
|
|
5183
|
+
}
|
|
5184
|
+
}, _callee5);
|
|
5185
|
+
}));
|
|
5186
|
+
function mutationFn(_x5) {
|
|
5187
|
+
return _mutationFn.apply(this, arguments);
|
|
5188
|
+
}
|
|
5189
|
+
return mutationFn;
|
|
5190
|
+
}(),
|
|
4788
5191
|
onError: function onError(error) {
|
|
4789
5192
|
void queryClient.invalidateQueries({
|
|
4790
5193
|
queryKey: ['sigmet']
|
|
4791
5194
|
});
|
|
4792
|
-
var
|
|
5195
|
+
var formattedError = humanizeApiErrorMessage(error);
|
|
4793
5196
|
dispatch(publicWarningFormActions.setFormError({
|
|
4794
|
-
message: "Failed to save SIGMET: " +
|
|
5197
|
+
message: "Failed to save SIGMET: " + formattedError
|
|
4795
5198
|
}));
|
|
4796
5199
|
},
|
|
4797
5200
|
onSuccess: function () {
|
|
4798
|
-
var _onSuccess = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4799
|
-
var snackbarKey
|
|
4800
|
-
return _regeneratorRuntime().wrap(function
|
|
4801
|
-
while (1) switch (
|
|
5201
|
+
var _onSuccess = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(data, variables) {
|
|
5202
|
+
var snackbarKey;
|
|
5203
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
5204
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
4802
5205
|
case 0:
|
|
4803
5206
|
snackbarKey = getAviationSnackbarKey(variables.changeStatusTo);
|
|
4804
|
-
warningType = 'SIGMET';
|
|
4805
5207
|
dispatch(snackbarActions.openSnackbar({
|
|
4806
5208
|
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
4807
5209
|
key: t(snackbarKey, {
|
|
4808
|
-
warningType:
|
|
5210
|
+
warningType: 'SIGMET'
|
|
4809
5211
|
})
|
|
4810
5212
|
}));
|
|
4811
|
-
|
|
5213
|
+
_context6.next = 4;
|
|
4812
5214
|
return queryClient.invalidateQueries({
|
|
4813
5215
|
queryKey: ['sigmet-list']
|
|
4814
5216
|
});
|
|
4815
|
-
case
|
|
5217
|
+
case 4:
|
|
4816
5218
|
case "end":
|
|
4817
|
-
return
|
|
5219
|
+
return _context6.stop();
|
|
4818
5220
|
}
|
|
4819
|
-
},
|
|
5221
|
+
}, _callee6);
|
|
4820
5222
|
}));
|
|
4821
|
-
function onSuccess(
|
|
5223
|
+
function onSuccess(_x6, _x7) {
|
|
4822
5224
|
return _onSuccess.apply(this, arguments);
|
|
4823
5225
|
}
|
|
4824
5226
|
return onSuccess;
|
|
@@ -4833,53 +5235,69 @@ var usePostSigmet = function usePostSigmet() {
|
|
|
4833
5235
|
* @returns A mutation result for posting an AIRMET.
|
|
4834
5236
|
*/
|
|
4835
5237
|
var usePostAirmet = function usePostAirmet() {
|
|
4836
|
-
var
|
|
4837
|
-
auth =
|
|
5238
|
+
var _useAuthenticationCon7 = useAuthenticationContext(),
|
|
5239
|
+
auth = _useAuthenticationCon7.auth;
|
|
4838
5240
|
var dispatch = useDispatch();
|
|
4839
5241
|
var queryClient = useQueryClient();
|
|
4840
5242
|
var _useWarningsTranslati2 = useWarningsTranslation(),
|
|
4841
5243
|
t = _useWarningsTranslati2.t;
|
|
4842
5244
|
return useMutation({
|
|
4843
|
-
mutationFn: function
|
|
4844
|
-
|
|
4845
|
-
|
|
5245
|
+
mutationFn: function () {
|
|
5246
|
+
var _mutationFn2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(formData) {
|
|
5247
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
5248
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
5249
|
+
case 0:
|
|
5250
|
+
if (auth) {
|
|
5251
|
+
_context7.next = 2;
|
|
5252
|
+
break;
|
|
5253
|
+
}
|
|
5254
|
+
throw new Error('Authentication context not found');
|
|
5255
|
+
case 2:
|
|
5256
|
+
return _context7.abrupt("return", postAirmet(auth, formData));
|
|
5257
|
+
case 3:
|
|
5258
|
+
case "end":
|
|
5259
|
+
return _context7.stop();
|
|
5260
|
+
}
|
|
5261
|
+
}, _callee7);
|
|
5262
|
+
}));
|
|
5263
|
+
function mutationFn(_x8) {
|
|
5264
|
+
return _mutationFn2.apply(this, arguments);
|
|
4846
5265
|
}
|
|
4847
|
-
return
|
|
4848
|
-
},
|
|
5266
|
+
return mutationFn;
|
|
5267
|
+
}(),
|
|
4849
5268
|
onError: function onError(error) {
|
|
4850
5269
|
void queryClient.invalidateQueries({
|
|
4851
5270
|
queryKey: ['airmet']
|
|
4852
5271
|
});
|
|
4853
|
-
var
|
|
5272
|
+
var formattedError = humanizeApiErrorMessage(error);
|
|
4854
5273
|
dispatch(publicWarningFormActions.setFormError({
|
|
4855
|
-
message: "Failed to save AIRMET: " +
|
|
5274
|
+
message: "Failed to save AIRMET: " + formattedError
|
|
4856
5275
|
}));
|
|
4857
5276
|
},
|
|
4858
5277
|
onSuccess: function () {
|
|
4859
|
-
var _onSuccess2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function
|
|
4860
|
-
var snackbarKey
|
|
4861
|
-
return _regeneratorRuntime().wrap(function
|
|
4862
|
-
while (1) switch (
|
|
5278
|
+
var _onSuccess2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(data, variables) {
|
|
5279
|
+
var snackbarKey;
|
|
5280
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
5281
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
4863
5282
|
case 0:
|
|
4864
5283
|
snackbarKey = getAviationSnackbarKey(variables.changeStatusTo);
|
|
4865
|
-
warningType = 'AIRMET';
|
|
4866
5284
|
dispatch(snackbarActions.openSnackbar({
|
|
4867
5285
|
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
4868
5286
|
key: t(snackbarKey, {
|
|
4869
|
-
warningType:
|
|
5287
|
+
warningType: 'AIRMET'
|
|
4870
5288
|
})
|
|
4871
5289
|
}));
|
|
4872
|
-
|
|
5290
|
+
_context8.next = 4;
|
|
4873
5291
|
return queryClient.invalidateQueries({
|
|
4874
5292
|
queryKey: ['airmet-list']
|
|
4875
5293
|
});
|
|
4876
|
-
case
|
|
5294
|
+
case 4:
|
|
4877
5295
|
case "end":
|
|
4878
|
-
return
|
|
5296
|
+
return _context8.stop();
|
|
4879
5297
|
}
|
|
4880
|
-
},
|
|
5298
|
+
}, _callee8);
|
|
4881
5299
|
}));
|
|
4882
|
-
function onSuccess(
|
|
5300
|
+
function onSuccess(_x9, _x0) {
|
|
4883
5301
|
return _onSuccess2.apply(this, arguments);
|
|
4884
5302
|
}
|
|
4885
5303
|
return onSuccess;
|
|
@@ -5182,8 +5600,13 @@ var renewAviationProduct = function renewAviationProduct(aviationWarning, produc
|
|
|
5182
5600
|
};
|
|
5183
5601
|
var amendAviationProduct = function amendAviationProduct(aviationWarning, productConfig) {
|
|
5184
5602
|
var warningDetail = aviationWarning.sigmetAirmetDetails;
|
|
5185
|
-
|
|
5186
|
-
var
|
|
5603
|
+
// Use your shared util to get an ISO "now" in UTC
|
|
5604
|
+
var nowIso = dateUtils.getCurrentTimeAsString();
|
|
5605
|
+
// Active if published start has passed (you can also include end > now if you prefer)
|
|
5606
|
+
var hasStarted = !!warningDetail.validDateStart && new Date(warningDetail.validDateStart).getTime() <= new Date(nowIso).getTime();
|
|
5607
|
+
// Only when already active do we snap start to now and recompute end
|
|
5608
|
+
var newValidStart = hasStarted ? nowIso : warningDetail.validDateStart;
|
|
5609
|
+
var newValidUntil = hasStarted && 'phenomenon' in warningDetail ? getDefaultValidUntilValue(productConfig, warningDetail.phenomenon, warningDetail.locationIndicatorATSR, newValidStart) : warningDetail.validDateEnd;
|
|
5187
5610
|
var amendedWarningDetail = Object.assign({}, warningDetail, {
|
|
5188
5611
|
validDateStart: newValidStart,
|
|
5189
5612
|
validDateEnd: newValidUntil,
|
|
@@ -6101,6 +6524,23 @@ var AddButton = function AddButton(_ref2) {
|
|
|
6101
6524
|
});
|
|
6102
6525
|
};
|
|
6103
6526
|
|
|
6527
|
+
var WarningListDragHandle = function WarningListDragHandle() {
|
|
6528
|
+
return jsx(CustomIconButton, {
|
|
6529
|
+
className: "handle",
|
|
6530
|
+
tabIndex: -1,
|
|
6531
|
+
disableTouchRipple: true,
|
|
6532
|
+
sx: {
|
|
6533
|
+
'&.handle:hover': function handleHover(theme) {
|
|
6534
|
+
return Object.assign({}, theme.palette.geowebColors.layerManager.dragHandleHover);
|
|
6535
|
+
},
|
|
6536
|
+
cursor: 'grab',
|
|
6537
|
+
marginTop: 0.5,
|
|
6538
|
+
paddingLeft: 0
|
|
6539
|
+
},
|
|
6540
|
+
children: jsx(DragHandle, {})
|
|
6541
|
+
});
|
|
6542
|
+
};
|
|
6543
|
+
|
|
6104
6544
|
var WarningListSelect = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
6105
6545
|
var options = _ref.options,
|
|
6106
6546
|
value = _ref.value,
|
|
@@ -6113,7 +6553,9 @@ var WarningListSelect = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
6113
6553
|
_ref$isReadOnly = _ref.isReadOnly,
|
|
6114
6554
|
isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
|
|
6115
6555
|
_ref$displayEmpty = _ref.displayEmpty,
|
|
6116
|
-
displayEmpty = _ref$displayEmpty === void 0 ? false : _ref$displayEmpty
|
|
6556
|
+
displayEmpty = _ref$displayEmpty === void 0 ? false : _ref$displayEmpty,
|
|
6557
|
+
_ref$validationResult = _ref.validationResult,
|
|
6558
|
+
validationResult = _ref$validationResult === void 0 ? true : _ref$validationResult;
|
|
6117
6559
|
var currentIndex = options.findIndex(function (option) {
|
|
6118
6560
|
return option.value === value;
|
|
6119
6561
|
});
|
|
@@ -6146,6 +6588,8 @@ var WarningListSelect = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
6146
6588
|
WebkitTextFillColor: 'inherit'
|
|
6147
6589
|
}
|
|
6148
6590
|
}
|
|
6591
|
+
}, validationResult !== true && {
|
|
6592
|
+
backgroundColor: "geowebColors.functional." + validationResult + "Outline.fill"
|
|
6149
6593
|
}, additionalStyling),
|
|
6150
6594
|
currentIndex: currentIndex > -1 ? currentIndex : undefined,
|
|
6151
6595
|
renderValue: renderValue,
|
|
@@ -6287,100 +6731,257 @@ var WindForceSelect = function WindForceSelect(_ref) {
|
|
|
6287
6731
|
});
|
|
6288
6732
|
};
|
|
6289
6733
|
|
|
6290
|
-
|
|
6291
|
-
|
|
6292
|
-
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6734
|
+
/* *
|
|
6735
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6736
|
+
* you may not use this file except in compliance with the License.
|
|
6737
|
+
* You may obtain a copy of the License at
|
|
6738
|
+
*
|
|
6739
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6740
|
+
*
|
|
6741
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6742
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6743
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6744
|
+
* See the License for the specific language governing permissions and
|
|
6745
|
+
* limitations under the License.
|
|
6746
|
+
*
|
|
6747
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
6748
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
6749
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
6750
|
+
* */
|
|
6751
|
+
var isWarningEmpty = function isWarningEmpty(item) {
|
|
6752
|
+
var windDirectionFrom = item.windDirectionFrom,
|
|
6753
|
+
windForce = item.windForce,
|
|
6754
|
+
changeType = item.changeType,
|
|
6755
|
+
windDirectionTo = item.windDirectionTo,
|
|
6756
|
+
assignedAreaIds = item.assignedAreaIds;
|
|
6757
|
+
if (assignedAreaIds.length) {
|
|
6758
|
+
return false;
|
|
6759
|
+
}
|
|
6760
|
+
return [windDirectionFrom, windForce, changeType, windDirectionTo].every(function (value) {
|
|
6761
|
+
return value === undefined || value.trim() === '';
|
|
6303
6762
|
});
|
|
6304
6763
|
};
|
|
6305
|
-
|
|
6306
|
-
var
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
|
|
6310
|
-
|
|
6311
|
-
|
|
6312
|
-
|
|
6764
|
+
var isWarningValid = function isWarningValid(item, config) {
|
|
6765
|
+
var windDirectionFrom = item.windDirectionFrom,
|
|
6766
|
+
windForce = item.windForce,
|
|
6767
|
+
assignedAreaIds = item.assignedAreaIds,
|
|
6768
|
+
changeType = item.changeType,
|
|
6769
|
+
windDirectionTo = item.windDirectionTo;
|
|
6770
|
+
// Direction, windspeed and areas are required.
|
|
6771
|
+
if (!windDirectionFrom || !windForce || !assignedAreaIds.length) {
|
|
6772
|
+
return false;
|
|
6773
|
+
}
|
|
6774
|
+
// If there is a Change selected, Direction to is also required
|
|
6775
|
+
if (changeType && changeType !== 'NO_CHANGE' && !windDirectionTo) {
|
|
6776
|
+
return false;
|
|
6777
|
+
}
|
|
6778
|
+
if (windDirectionTo && changeType) {
|
|
6779
|
+
var result = validateWindDirectionChange(windDirectionFrom, windDirectionTo, changeType, config);
|
|
6780
|
+
return result !== 'error';
|
|
6781
|
+
}
|
|
6782
|
+
return true;
|
|
6313
6783
|
};
|
|
6314
|
-
var
|
|
6315
|
-
if
|
|
6316
|
-
|
|
6317
|
-
|
|
6318
|
-
value: force.windForce,
|
|
6319
|
-
level: force.level
|
|
6320
|
-
};
|
|
6321
|
-
});
|
|
6784
|
+
var isWarningsValid = function isWarningsValid(warnings, config) {
|
|
6785
|
+
// One single empty row is allowed, if not empty it should be valid
|
|
6786
|
+
if (warnings.length === 1) {
|
|
6787
|
+
return isWarningEmpty(warnings[0]) || isWarningValid(warnings[0], config);
|
|
6322
6788
|
}
|
|
6323
|
-
return
|
|
6324
|
-
return
|
|
6325
|
-
value: force.windForce,
|
|
6326
|
-
level: force.level
|
|
6327
|
-
};
|
|
6789
|
+
return warnings.every(function (warning) {
|
|
6790
|
+
return !isWarningEmpty(warning) && isWarningValid(warning, config);
|
|
6328
6791
|
});
|
|
6329
6792
|
};
|
|
6330
|
-
var
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
|
|
6335
|
-
};
|
|
6793
|
+
var getLevelFromWindForce = function getLevelFromWindForce(maritimeConfig, windForce) {
|
|
6794
|
+
var _maritimeConfig$marit;
|
|
6795
|
+
var period = maritimeConfig.maritimeLevelDefinition.maritimeLevelsSummer ? 'maritimeLevelsSummer' : 'maritimeLevelsWinter';
|
|
6796
|
+
var levelInfo = (_maritimeConfig$marit = maritimeConfig.maritimeLevelDefinition) == null ? void 0 : _maritimeConfig$marit[period].find(function (level) {
|
|
6797
|
+
return (level == null ? void 0 : level.windForce) === windForce;
|
|
6336
6798
|
});
|
|
6799
|
+
return (levelInfo == null ? void 0 : levelInfo.level) || 'extreme';
|
|
6337
6800
|
};
|
|
6338
|
-
var
|
|
6339
|
-
|
|
6340
|
-
|
|
6341
|
-
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
|
|
6351
|
-
|
|
6352
|
-
|
|
6353
|
-
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6361
|
-
|
|
6362
|
-
|
|
6363
|
-
|
|
6364
|
-
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
|
|
6368
|
-
|
|
6369
|
-
|
|
6370
|
-
|
|
6371
|
-
|
|
6372
|
-
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
|
|
6377
|
-
|
|
6378
|
-
|
|
6379
|
-
|
|
6380
|
-
|
|
6381
|
-
|
|
6382
|
-
|
|
6383
|
-
|
|
6801
|
+
var getType = function getType(domain) {
|
|
6802
|
+
switch (domain) {
|
|
6803
|
+
case 'coastalWaters':
|
|
6804
|
+
return 'maritimeWarningCoastal';
|
|
6805
|
+
case 'northSeaDistricts':
|
|
6806
|
+
default:
|
|
6807
|
+
return 'maritimeWarningNorthSea';
|
|
6808
|
+
}
|
|
6809
|
+
};
|
|
6810
|
+
var mapItemsToMaritimeWarnings = function mapItemsToMaritimeWarnings(warnings, domain, maritimeConfig, editor) {
|
|
6811
|
+
var type = getType(domain);
|
|
6812
|
+
if (warnings.length === 1 && warnings[0].assignedAreaIds.length === 0) {
|
|
6813
|
+
// 1 warning without any areas means cancel/withdraw all warnings
|
|
6814
|
+
return [{
|
|
6815
|
+
type: type,
|
|
6816
|
+
editor: editor,
|
|
6817
|
+
status: PublicWarningStatus.PUBLISHED,
|
|
6818
|
+
warningDetail: {
|
|
6819
|
+
areas: [],
|
|
6820
|
+
domain: type
|
|
6821
|
+
}
|
|
6822
|
+
}];
|
|
6823
|
+
}
|
|
6824
|
+
return warnings.map(function (warning) {
|
|
6825
|
+
return {
|
|
6826
|
+
type: type,
|
|
6827
|
+
editor: editor,
|
|
6828
|
+
status: PublicWarningStatus.PUBLISHED,
|
|
6829
|
+
warningDetail: {
|
|
6830
|
+
phenomenon: 'wind',
|
|
6831
|
+
validFrom: new Date().toISOString(),
|
|
6832
|
+
validUntil: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString(),
|
|
6833
|
+
level: getLevelFromWindForce(maritimeConfig, warning.windForce || ''),
|
|
6834
|
+
probability: 100,
|
|
6835
|
+
areas: warning.assignedAreaIds.map(function (areaId) {
|
|
6836
|
+
var areaDetails = maritimeConfig.districtList[domain].find(function (district) {
|
|
6837
|
+
return district.districtName === areaId;
|
|
6838
|
+
});
|
|
6839
|
+
return {
|
|
6840
|
+
objectName: areaId,
|
|
6841
|
+
geoJSON: (areaDetails == null ? void 0 : areaDetails.geoJSON) || {
|
|
6842
|
+
type: 'FeatureCollection',
|
|
6843
|
+
features: []
|
|
6844
|
+
}
|
|
6845
|
+
};
|
|
6846
|
+
}),
|
|
6847
|
+
windDirectionFrom: warning.windDirectionFrom,
|
|
6848
|
+
windForce: warning.windForce,
|
|
6849
|
+
changeType: warning.changeType || 'NO_CHANGE',
|
|
6850
|
+
windDirectionTo: warning.windDirectionTo,
|
|
6851
|
+
descriptionOriginal: '',
|
|
6852
|
+
descriptionTranslation: '',
|
|
6853
|
+
domain: type
|
|
6854
|
+
}
|
|
6855
|
+
};
|
|
6856
|
+
});
|
|
6857
|
+
};
|
|
6858
|
+
var mapMaritimeWarningsToItems = function mapMaritimeWarningsToItems(warnings) {
|
|
6859
|
+
return warnings.map(function (warning) {
|
|
6860
|
+
var _warning$warningDetai;
|
|
6861
|
+
return {
|
|
6862
|
+
id: warning.id || '',
|
|
6863
|
+
assignedAreaIds: ((_warning$warningDetai = warning.warningDetail.areas) == null ? void 0 : _warning$warningDetai.map(function (area) {
|
|
6864
|
+
return area.objectName;
|
|
6865
|
+
})) || [],
|
|
6866
|
+
windDirectionFrom: warning.warningDetail.windDirectionFrom,
|
|
6867
|
+
windDirectionTo: warning.warningDetail.windDirectionTo,
|
|
6868
|
+
windForce: warning.warningDetail.windForce,
|
|
6869
|
+
changeType: warning.warningDetail.changeType,
|
|
6870
|
+
validFrom: warning.warningDetail.validFrom,
|
|
6871
|
+
validUntil: warning.warningDetail.validUntil
|
|
6872
|
+
};
|
|
6873
|
+
});
|
|
6874
|
+
};
|
|
6875
|
+
var getDegreesFromDirection = function getDegreesFromDirection(maritimeConfig, direction) {
|
|
6876
|
+
var _directionDefinition$;
|
|
6877
|
+
var directionDefinition = maritimeConfig.windDirectionDefinition.find(function (item) {
|
|
6878
|
+
return item.value === direction;
|
|
6879
|
+
});
|
|
6880
|
+
return (_directionDefinition$ = directionDefinition == null ? void 0 : directionDefinition.degrees) != null ? _directionDefinition$ : undefined;
|
|
6881
|
+
};
|
|
6882
|
+
var validateWindDirectionChange = function validateWindDirectionChange(directionFrom, directionTo, changeType, config) {
|
|
6883
|
+
if (!directionFrom || !directionTo || !changeType || !config || changeType === 'NO_CHANGE') {
|
|
6884
|
+
return true;
|
|
6885
|
+
}
|
|
6886
|
+
var directionFromDegrees = getDegreesFromDirection(config, directionFrom);
|
|
6887
|
+
var directionToDegrees = getDegreesFromDirection(config, directionTo);
|
|
6888
|
+
if (directionFromDegrees === undefined || directionToDegrees === undefined) {
|
|
6889
|
+
return true;
|
|
6890
|
+
}
|
|
6891
|
+
if (directionFromDegrees === directionToDegrees) {
|
|
6892
|
+
return 'error';
|
|
6893
|
+
}
|
|
6894
|
+
var max = config.validation.dirTo.max_wind_change;
|
|
6895
|
+
var min = config.validation.dirTo.min_wind_change;
|
|
6896
|
+
// Calculate the absolute angular difference (0-360)
|
|
6897
|
+
var diff = changeType === 'BACKING' ? (directionFromDegrees - directionToDegrees + 360) % 360 : (directionToDegrees - directionFromDegrees + 360) % 360;
|
|
6898
|
+
if (diff > max.value) {
|
|
6899
|
+
return max.level;
|
|
6900
|
+
}
|
|
6901
|
+
if (diff < min.value) {
|
|
6902
|
+
return min.level;
|
|
6903
|
+
}
|
|
6904
|
+
return true;
|
|
6905
|
+
};
|
|
6906
|
+
|
|
6907
|
+
var getWindDirectionsFromConfig = function getWindDirectionsFromConfig(directionConfig, t) {
|
|
6908
|
+
return directionConfig.map(function (direction) {
|
|
6909
|
+
return {
|
|
6910
|
+
value: direction.value,
|
|
6911
|
+
label: t("maritime-direction-" + direction.value) || direction.label
|
|
6912
|
+
};
|
|
6913
|
+
});
|
|
6914
|
+
};
|
|
6915
|
+
var getWindForceFromConfig = function getWindForceFromConfig(forceConfig) {
|
|
6916
|
+
if (forceConfig.maritimeLevelsSummer) {
|
|
6917
|
+
return forceConfig.maritimeLevelsSummer.map(function (force) {
|
|
6918
|
+
return {
|
|
6919
|
+
value: force.windForce,
|
|
6920
|
+
level: force.level
|
|
6921
|
+
};
|
|
6922
|
+
});
|
|
6923
|
+
}
|
|
6924
|
+
return forceConfig.maritimeLevelsWinter.map(function (force) {
|
|
6925
|
+
return {
|
|
6926
|
+
value: force.windForce,
|
|
6927
|
+
level: force.level
|
|
6928
|
+
};
|
|
6929
|
+
});
|
|
6930
|
+
};
|
|
6931
|
+
var getChangeTypeFromConfig = function getChangeTypeFromConfig(changeConfig, t) {
|
|
6932
|
+
return changeConfig.map(function (change) {
|
|
6933
|
+
return {
|
|
6934
|
+
value: change.key,
|
|
6935
|
+
label: t("maritime-change-" + change.key) || change.label
|
|
6936
|
+
};
|
|
6937
|
+
});
|
|
6938
|
+
};
|
|
6939
|
+
var WarningListItem$1 = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
6940
|
+
var warning = _ref.warning,
|
|
6941
|
+
areas = _ref.areas,
|
|
6942
|
+
selectedAreaIds = _ref.selectedAreaIds,
|
|
6943
|
+
onAddClick = _ref.onAddClick,
|
|
6944
|
+
onRemove = _ref.onRemove,
|
|
6945
|
+
onChange = _ref.onChange,
|
|
6946
|
+
onToggleSelectArea = _ref.onToggleSelectArea,
|
|
6947
|
+
onSelectMultipleAreas = _ref.onSelectMultipleAreas,
|
|
6948
|
+
onRemoveArea = _ref.onRemoveArea,
|
|
6949
|
+
isReadOnly = _ref.isReadOnly,
|
|
6950
|
+
_ref$shouldShowDistri = _ref.shouldShowDistricts,
|
|
6951
|
+
shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri,
|
|
6952
|
+
maritimeConfig = _ref.maritimeConfig;
|
|
6953
|
+
var areasById = React__default.useMemo(function () {
|
|
6954
|
+
return new Map(areas.map(function (area) {
|
|
6955
|
+
return [area.districtName, area];
|
|
6956
|
+
}));
|
|
6957
|
+
}, [areas]);
|
|
6958
|
+
var assignedAreas = React__default.useMemo(function () {
|
|
6959
|
+
return warning.assignedAreaIds.map(function (areaId) {
|
|
6960
|
+
return areasById.get(areaId);
|
|
6961
|
+
}).filter(function (area) {
|
|
6962
|
+
return area !== undefined;
|
|
6963
|
+
});
|
|
6964
|
+
}, [warning.assignedAreaIds, areasById]);
|
|
6965
|
+
var _useWarningsTranslati = useWarningsTranslation(),
|
|
6966
|
+
t = _useWarningsTranslati.t;
|
|
6967
|
+
var handleChangeFromDirection = React__default.useCallback(function (value) {
|
|
6968
|
+
onChange(warning.id, {
|
|
6969
|
+
windDirectionFrom: value
|
|
6970
|
+
});
|
|
6971
|
+
}, [onChange, warning.id]);
|
|
6972
|
+
var handleChangeWindForce = React__default.useCallback(function (value) {
|
|
6973
|
+
onChange(warning.id, {
|
|
6974
|
+
windForce: value
|
|
6975
|
+
});
|
|
6976
|
+
}, [onChange, warning]);
|
|
6977
|
+
var handleChangeWindChangeType = React__default.useCallback(function (value) {
|
|
6978
|
+
onChange(warning.id, {
|
|
6979
|
+
changeType: value
|
|
6980
|
+
});
|
|
6981
|
+
if (value === 'NO_CHANGE') {
|
|
6982
|
+
onChange(warning.id, {
|
|
6983
|
+
windDirectionTo: ''
|
|
6984
|
+
});
|
|
6384
6985
|
}
|
|
6385
6986
|
}, [onChange, warning]);
|
|
6386
6987
|
var handleChangeToDirection = React__default.useCallback(function (value) {
|
|
@@ -6393,6 +6994,8 @@ var WarningListItem$1 = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
6393
6994
|
}, [warning.id, onAddClick]);
|
|
6394
6995
|
var shouldDisableDirTo = warning.changeType === 'NO_CHANGE' || isReadOnly;
|
|
6395
6996
|
var changeOptions = getChangeTypeFromConfig(maritimeConfig.changeType, t);
|
|
6997
|
+
var validationResult = validateWindDirectionChange(warning.windDirectionFrom, warning.windDirectionTo, warning.changeType, maritimeConfig);
|
|
6998
|
+
var showInfoIcon = validationResult !== true;
|
|
6396
6999
|
return jsxs(StyledItem, {
|
|
6397
7000
|
"data-testid": "maritime-warning",
|
|
6398
7001
|
children: [!isReadOnly && jsx(WarningListDragHandle, {}), jsx(WarningListSelect, {
|
|
@@ -6440,7 +7043,8 @@ var WarningListItem$1 = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
6440
7043
|
});
|
|
6441
7044
|
return typeof (option == null ? void 0 : option.label) === 'function' ? option.label(t) : option == null ? void 0 : option.label;
|
|
6442
7045
|
},
|
|
6443
|
-
displayEmpty: true
|
|
7046
|
+
displayEmpty: true,
|
|
7047
|
+
validationResult: validationResult
|
|
6444
7048
|
}), jsx(WarningListSelect, {
|
|
6445
7049
|
gridArea: "dirTo",
|
|
6446
7050
|
label: t('maritime-header-direction-to'),
|
|
@@ -6448,7 +7052,24 @@ var WarningListItem$1 = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
6448
7052
|
onChange: handleChangeToDirection,
|
|
6449
7053
|
value: warning.windDirectionTo,
|
|
6450
7054
|
isReadOnly: shouldDisableDirTo
|
|
6451
|
-
}),
|
|
7055
|
+
}), showInfoIcon ? jsx(Box, {
|
|
7056
|
+
sx: {
|
|
7057
|
+
gridArea: 'info',
|
|
7058
|
+
justifySelf: 'left',
|
|
7059
|
+
height: '24px'
|
|
7060
|
+
},
|
|
7061
|
+
children: jsx(CustomTooltip, {
|
|
7062
|
+
title: t("maritime-wind-change-" + validationResult),
|
|
7063
|
+
children: jsx("span", {
|
|
7064
|
+
children: jsx(Info, {
|
|
7065
|
+
sx: {
|
|
7066
|
+
marginTop: 0.5,
|
|
7067
|
+
color: "geowebColors.functional." + validationResult
|
|
7068
|
+
}
|
|
7069
|
+
})
|
|
7070
|
+
})
|
|
7071
|
+
})
|
|
7072
|
+
}) : null, !isReadOnly && jsx(CustomIconButton, {
|
|
6452
7073
|
sx: {
|
|
6453
7074
|
gridArea: 'delete',
|
|
6454
7075
|
justifySelf: 'end',
|
|
@@ -6480,10 +7101,10 @@ var StyledItem = styled('div')(function (_ref2) {
|
|
|
6480
7101
|
gap: theme.spacing(0.5),
|
|
6481
7102
|
paddingInline: theme.spacing(0.25),
|
|
6482
7103
|
// styling for small windows
|
|
6483
|
-
gridTemplateAreas: "\n \"drag dirFrom dirFrom windForce delete\"\n \". areas areas areas .\"\n \". changeType dirTo
|
|
6484
|
-
gridTemplateColumns: '
|
|
7104
|
+
gridTemplateAreas: "\n \"drag dirFrom dirFrom windForce windForce delete\"\n \". areas areas areas areas .\"\n \". changeType dirTo dirTo info .\" \n ",
|
|
7105
|
+
gridTemplateColumns: '16px minmax(82px, 1fr) 1fr minmax(60px, 1fr) 20px 20px'
|
|
6485
7106
|
}, _ref3["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
6486
|
-
gridTemplateAreas: "\n \"drag dirFrom windForce areas changeType dirTo delete\" \n ",
|
|
7107
|
+
gridTemplateAreas: "\n \"drag dirFrom windForce areas changeType dirTo info delete\" \n ",
|
|
6487
7108
|
gridTemplateColumns: 'var(--grid-columns)'
|
|
6488
7109
|
}, _ref3;
|
|
6489
7110
|
});
|
|
@@ -6516,7 +7137,7 @@ var WarningList = function WarningList(_ref) {
|
|
|
6516
7137
|
flexDirection: 'column',
|
|
6517
7138
|
minHeight: 0,
|
|
6518
7139
|
marginBottom: 1,
|
|
6519
|
-
'--grid-columns': '
|
|
7140
|
+
'--grid-columns': '16px 150px 60px 2fr 150px 150px 0.5fr 0.5fr'
|
|
6520
7141
|
},
|
|
6521
7142
|
children: [jsxs(Box, {
|
|
6522
7143
|
sx: (_sx = {
|
|
@@ -6855,172 +7476,34 @@ function useConfirmDeleteDialog(_ref) {
|
|
|
6855
7476
|
};
|
|
6856
7477
|
}
|
|
6857
7478
|
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
|
|
6862
|
-
|
|
6863
|
-
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6867
|
-
|
|
6868
|
-
|
|
6869
|
-
|
|
6870
|
-
|
|
6871
|
-
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
6872
|
-
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
6873
|
-
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
6874
|
-
* */
|
|
6875
|
-
var isWarningEmpty = function isWarningEmpty(item) {
|
|
6876
|
-
var windDirectionFrom = item.windDirectionFrom,
|
|
6877
|
-
windForce = item.windForce,
|
|
6878
|
-
changeType = item.changeType,
|
|
6879
|
-
windDirectionTo = item.windDirectionTo,
|
|
6880
|
-
assignedAreaIds = item.assignedAreaIds;
|
|
6881
|
-
if (assignedAreaIds.length) {
|
|
6882
|
-
return false;
|
|
6883
|
-
}
|
|
6884
|
-
return [windDirectionFrom, windForce, changeType, windDirectionTo].every(function (value) {
|
|
6885
|
-
return value === undefined || value.trim() === '';
|
|
7479
|
+
var MaritimeWarningAvatar = function MaritimeWarningAvatar(_ref) {
|
|
7480
|
+
var editor = _ref.editor,
|
|
7481
|
+
_ref$tooltipPlacement = _ref.tooltipPlacement,
|
|
7482
|
+
tooltipPlacement = _ref$tooltipPlacement === void 0 ? 'bottom' : _ref$tooltipPlacement;
|
|
7483
|
+
return jsx(CustomTooltip, {
|
|
7484
|
+
title: "Editor: " + editor,
|
|
7485
|
+
placement: tooltipPlacement,
|
|
7486
|
+
children: jsx("span", {
|
|
7487
|
+
children: jsx(Avatar, {
|
|
7488
|
+
size: "small",
|
|
7489
|
+
children: getInitials(editor)
|
|
7490
|
+
})
|
|
7491
|
+
})
|
|
6886
7492
|
});
|
|
6887
7493
|
};
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
|
|
6891
|
-
|
|
6892
|
-
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
}
|
|
6898
|
-
// If there is a Change selected, Direction to is also required
|
|
6899
|
-
if (changeType && changeType !== 'NO_CHANGE') {
|
|
6900
|
-
return !!windDirectionTo;
|
|
6901
|
-
}
|
|
6902
|
-
return true;
|
|
6903
|
-
};
|
|
6904
|
-
var isWarningsValid = function isWarningsValid(warnings) {
|
|
6905
|
-
// One single empty row is allowed, if not empty it should be valid
|
|
6906
|
-
if (warnings.length === 1) {
|
|
6907
|
-
return isWarningEmpty(warnings[0]) || isWarningValid(warnings[0]);
|
|
6908
|
-
}
|
|
6909
|
-
return warnings.every(function (warning) {
|
|
6910
|
-
return !isWarningEmpty(warning) && isWarningValid(warning);
|
|
6911
|
-
});
|
|
7494
|
+
|
|
7495
|
+
var spinnerSx$1 = {
|
|
7496
|
+
width: '16px!important',
|
|
7497
|
+
height: '16px!important',
|
|
7498
|
+
position: 'absolute',
|
|
7499
|
+
top: 0,
|
|
7500
|
+
bottom: 0,
|
|
7501
|
+
margin: 'auto',
|
|
7502
|
+
marginLeft: 1
|
|
6912
7503
|
};
|
|
6913
|
-
var
|
|
6914
|
-
var
|
|
6915
|
-
|
|
6916
|
-
var levelInfo = (_maritimeConfig$marit = maritimeConfig.maritimeLevelDefinition) == null ? void 0 : _maritimeConfig$marit[period].find(function (level) {
|
|
6917
|
-
return (level == null ? void 0 : level.windForce) === windForce;
|
|
6918
|
-
});
|
|
6919
|
-
return (levelInfo == null ? void 0 : levelInfo.level) || 'extreme';
|
|
6920
|
-
};
|
|
6921
|
-
var getType = function getType(domain) {
|
|
6922
|
-
switch (domain) {
|
|
6923
|
-
case 'coastalWaters':
|
|
6924
|
-
return 'maritimeWarningCoastal';
|
|
6925
|
-
case 'northSeaDistricts':
|
|
6926
|
-
default:
|
|
6927
|
-
return 'maritimeWarningNorthSea';
|
|
6928
|
-
}
|
|
6929
|
-
};
|
|
6930
|
-
var mapItemsToMaritimeWarnings = function mapItemsToMaritimeWarnings(warnings, domain, maritimeConfig, editor) {
|
|
6931
|
-
var type = getType(domain);
|
|
6932
|
-
if (warnings.length === 1 && warnings[0].assignedAreaIds.length === 0) {
|
|
6933
|
-
// 1 warning without any areas means cancel/withdraw all warnings
|
|
6934
|
-
return [{
|
|
6935
|
-
type: type,
|
|
6936
|
-
editor: editor,
|
|
6937
|
-
status: PublicWarningStatus.PUBLISHED,
|
|
6938
|
-
warningDetail: {
|
|
6939
|
-
areas: [],
|
|
6940
|
-
domain: type
|
|
6941
|
-
}
|
|
6942
|
-
}];
|
|
6943
|
-
}
|
|
6944
|
-
return warnings.map(function (warning) {
|
|
6945
|
-
return {
|
|
6946
|
-
type: type,
|
|
6947
|
-
editor: editor,
|
|
6948
|
-
status: PublicWarningStatus.PUBLISHED,
|
|
6949
|
-
warningDetail: {
|
|
6950
|
-
phenomenon: 'wind',
|
|
6951
|
-
validFrom: new Date().toISOString(),
|
|
6952
|
-
validUntil: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString(),
|
|
6953
|
-
level: getLevelFromWindForce(maritimeConfig, warning.windForce || ''),
|
|
6954
|
-
probability: 100,
|
|
6955
|
-
areas: warning.assignedAreaIds.map(function (areaId) {
|
|
6956
|
-
var areaDetails = maritimeConfig.districtList[domain].find(function (district) {
|
|
6957
|
-
return district.districtName === areaId;
|
|
6958
|
-
});
|
|
6959
|
-
return {
|
|
6960
|
-
objectName: areaId,
|
|
6961
|
-
geoJSON: (areaDetails == null ? void 0 : areaDetails.geoJSON) || {
|
|
6962
|
-
type: 'FeatureCollection',
|
|
6963
|
-
features: []
|
|
6964
|
-
}
|
|
6965
|
-
};
|
|
6966
|
-
}),
|
|
6967
|
-
windDirectionFrom: warning.windDirectionFrom,
|
|
6968
|
-
windForce: warning.windForce,
|
|
6969
|
-
changeType: warning.changeType || 'NO_CHANGE',
|
|
6970
|
-
windDirectionTo: warning.windDirectionTo,
|
|
6971
|
-
descriptionOriginal: '',
|
|
6972
|
-
descriptionTranslation: '',
|
|
6973
|
-
domain: type
|
|
6974
|
-
}
|
|
6975
|
-
};
|
|
6976
|
-
});
|
|
6977
|
-
};
|
|
6978
|
-
var mapMaritimeWarningsToItems = function mapMaritimeWarningsToItems(warnings) {
|
|
6979
|
-
return warnings.map(function (warning) {
|
|
6980
|
-
var _warning$warningDetai;
|
|
6981
|
-
return {
|
|
6982
|
-
id: warning.id || '',
|
|
6983
|
-
assignedAreaIds: ((_warning$warningDetai = warning.warningDetail.areas) == null ? void 0 : _warning$warningDetai.map(function (area) {
|
|
6984
|
-
return area.objectName;
|
|
6985
|
-
})) || [],
|
|
6986
|
-
windDirectionFrom: warning.warningDetail.windDirectionFrom,
|
|
6987
|
-
windDirectionTo: warning.warningDetail.windDirectionTo,
|
|
6988
|
-
windForce: warning.warningDetail.windForce,
|
|
6989
|
-
changeType: warning.warningDetail.changeType,
|
|
6990
|
-
validFrom: warning.warningDetail.validFrom,
|
|
6991
|
-
validUntil: warning.warningDetail.validUntil
|
|
6992
|
-
};
|
|
6993
|
-
});
|
|
6994
|
-
};
|
|
6995
|
-
|
|
6996
|
-
var MaritimeWarningAvatar = function MaritimeWarningAvatar(_ref) {
|
|
6997
|
-
var editor = _ref.editor,
|
|
6998
|
-
_ref$tooltipPlacement = _ref.tooltipPlacement,
|
|
6999
|
-
tooltipPlacement = _ref$tooltipPlacement === void 0 ? 'bottom' : _ref$tooltipPlacement;
|
|
7000
|
-
return jsx(CustomTooltip, {
|
|
7001
|
-
title: "Editor: " + editor,
|
|
7002
|
-
placement: tooltipPlacement,
|
|
7003
|
-
children: jsx("span", {
|
|
7004
|
-
children: jsx(Avatar, {
|
|
7005
|
-
size: "small",
|
|
7006
|
-
children: getInitials(editor)
|
|
7007
|
-
})
|
|
7008
|
-
})
|
|
7009
|
-
});
|
|
7010
|
-
};
|
|
7011
|
-
|
|
7012
|
-
var spinnerSx$1 = {
|
|
7013
|
-
width: '16px!important',
|
|
7014
|
-
height: '16px!important',
|
|
7015
|
-
position: 'absolute',
|
|
7016
|
-
top: 0,
|
|
7017
|
-
bottom: 0,
|
|
7018
|
-
margin: 'auto',
|
|
7019
|
-
marginLeft: 1
|
|
7020
|
-
};
|
|
7021
|
-
var getWarningsValidity = function getWarningsValidity(t, warnings) {
|
|
7022
|
-
var validUntil = warnings.length > 0 && warnings[0].validUntil ? dateUtils.dateToString(dateUtils.createDate(warnings[0].validUntil), dateUtils.DATE_FORMAT_NAME_OF_DAY_MONTH) : '';
|
|
7023
|
-
return validUntil ? "" + t('maritime-warning-validuntil') + validUntil : '';
|
|
7504
|
+
var getWarningsValidity = function getWarningsValidity(t, warnings) {
|
|
7505
|
+
var validUntil = warnings.length > 0 && warnings[0].validUntil ? dateUtils.dateToString(dateUtils.createDate(warnings[0].validUntil), dateUtils.DATE_FORMAT_NAME_OF_DAY_MONTH) : '';
|
|
7506
|
+
return validUntil ? "" + t('maritime-warning-validuntil') + validUntil : '';
|
|
7024
7507
|
};
|
|
7025
7508
|
var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
7026
7509
|
var _sx, _sx2, _sx3, _sx4;
|
|
@@ -7083,7 +7566,7 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
|
7083
7566
|
}
|
|
7084
7567
|
}, _callee);
|
|
7085
7568
|
})), [onClear, t, showConfirmDialog]);
|
|
7086
|
-
var isValid = isWarningsValid(warnings);
|
|
7569
|
+
var isValid = isWarningsValid(warnings, maritimeConfig);
|
|
7087
7570
|
var onSwitchMode = /*#__PURE__*/function () {
|
|
7088
7571
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(event) {
|
|
7089
7572
|
var checked, isReadOnly;
|
|
@@ -7614,173 +8097,6 @@ var MaritimeWarningsFormConnect = function MaritimeWarningsFormConnect(_ref) {
|
|
|
7614
8097
|
});
|
|
7615
8098
|
};
|
|
7616
8099
|
|
|
7617
|
-
var CancelAviationDialogContent = function CancelAviationDialogContent(_ref) {
|
|
7618
|
-
var product = _ref.product,
|
|
7619
|
-
warningType = _ref.warningType;
|
|
7620
|
-
var _useTACApi = useTACApi(),
|
|
7621
|
-
fetchSigmetCancelTAC = _useTACApi.fetchSigmetCancelTAC,
|
|
7622
|
-
fetchAirmetCancelTAC = _useTACApi.fetchAirmetCancelTAC,
|
|
7623
|
-
fetchSigmetTAC = _useTACApi.fetchSigmetTAC,
|
|
7624
|
-
fetchAirmetTAC = _useTACApi.fetchAirmetTAC;
|
|
7625
|
-
var _React$useState = React__default.useState(null),
|
|
7626
|
-
cancelTAC = _React$useState[0],
|
|
7627
|
-
setCancelTAC = _React$useState[1];
|
|
7628
|
-
var _React$useState2 = React__default.useState(null),
|
|
7629
|
-
currentTAC = _React$useState2[0],
|
|
7630
|
-
setCurrentTAC = _React$useState2[1];
|
|
7631
|
-
var _useWarningsTranslati = useWarningsTranslation(),
|
|
7632
|
-
t = _useWarningsTranslati.t;
|
|
7633
|
-
React__default.useEffect(function () {
|
|
7634
|
-
var fetchData = /*#__PURE__*/function () {
|
|
7635
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
7636
|
-
var cancelResult, currentResult;
|
|
7637
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
7638
|
-
while (1) switch (_context.prev = _context.next) {
|
|
7639
|
-
case 0:
|
|
7640
|
-
_context.prev = 0;
|
|
7641
|
-
if (!(warningType === 'sigmet')) {
|
|
7642
|
-
_context.next = 7;
|
|
7643
|
-
break;
|
|
7644
|
-
}
|
|
7645
|
-
_context.next = 4;
|
|
7646
|
-
return fetchSigmetCancelTAC(product);
|
|
7647
|
-
case 4:
|
|
7648
|
-
_context.t0 = _context.sent;
|
|
7649
|
-
_context.next = 10;
|
|
7650
|
-
break;
|
|
7651
|
-
case 7:
|
|
7652
|
-
_context.next = 9;
|
|
7653
|
-
return fetchAirmetCancelTAC(product);
|
|
7654
|
-
case 9:
|
|
7655
|
-
_context.t0 = _context.sent;
|
|
7656
|
-
case 10:
|
|
7657
|
-
cancelResult = _context.t0;
|
|
7658
|
-
setCancelTAC(cancelResult.data);
|
|
7659
|
-
if (!(warningType === 'sigmet')) {
|
|
7660
|
-
_context.next = 18;
|
|
7661
|
-
break;
|
|
7662
|
-
}
|
|
7663
|
-
_context.next = 15;
|
|
7664
|
-
return fetchSigmetTAC(product);
|
|
7665
|
-
case 15:
|
|
7666
|
-
_context.t1 = _context.sent;
|
|
7667
|
-
_context.next = 21;
|
|
7668
|
-
break;
|
|
7669
|
-
case 18:
|
|
7670
|
-
_context.next = 20;
|
|
7671
|
-
return fetchAirmetTAC(product);
|
|
7672
|
-
case 20:
|
|
7673
|
-
_context.t1 = _context.sent;
|
|
7674
|
-
case 21:
|
|
7675
|
-
currentResult = _context.t1;
|
|
7676
|
-
setCurrentTAC(currentResult.data);
|
|
7677
|
-
_context.next = 27;
|
|
7678
|
-
break;
|
|
7679
|
-
case 25:
|
|
7680
|
-
_context.prev = 25;
|
|
7681
|
-
_context.t2 = _context["catch"](0);
|
|
7682
|
-
case 27:
|
|
7683
|
-
case "end":
|
|
7684
|
-
return _context.stop();
|
|
7685
|
-
}
|
|
7686
|
-
}, _callee, null, [[0, 25]]);
|
|
7687
|
-
}));
|
|
7688
|
-
return function fetchData() {
|
|
7689
|
-
return _ref2.apply(this, arguments);
|
|
7690
|
-
};
|
|
7691
|
-
}();
|
|
7692
|
-
void fetchData();
|
|
7693
|
-
}, [fetchAirmetCancelTAC, fetchAirmetTAC, fetchSigmetCancelTAC, fetchSigmetTAC, product, warningType]);
|
|
7694
|
-
var tacBlockStyle = {
|
|
7695
|
-
whiteSpace: 'pre-wrap',
|
|
7696
|
-
wordBreak: 'break-word',
|
|
7697
|
-
overflowX: 'auto',
|
|
7698
|
-
overflowY: 'auto',
|
|
7699
|
-
maxWidth: '100%',
|
|
7700
|
-
fontFamily: 'monospace',
|
|
7701
|
-
fontSize: '0.9rem',
|
|
7702
|
-
minHeight: 120,
|
|
7703
|
-
maxHeight: 140
|
|
7704
|
-
};
|
|
7705
|
-
var renderTacWithSequence = function renderTacWithSequence(tac, noTacKey, product) {
|
|
7706
|
-
if (!tac) {
|
|
7707
|
-
return jsx(Box, {
|
|
7708
|
-
component: "pre",
|
|
7709
|
-
sx: tacBlockStyle,
|
|
7710
|
-
children: t(noTacKey)
|
|
7711
|
-
});
|
|
7712
|
-
}
|
|
7713
|
-
var noTac = t(noTacKey);
|
|
7714
|
-
var hasTac = tac.split('\n').length > 0 && tac !== noTac;
|
|
7715
|
-
var sequenceNumberInTac = findSequenceNumber(tac, noTac);
|
|
7716
|
-
var sequenceStyle = getSequenceStyling(product, hasTac);
|
|
7717
|
-
var words = tac.split(' ');
|
|
7718
|
-
return jsxs(Box, {
|
|
7719
|
-
component: "pre",
|
|
7720
|
-
sx: tacBlockStyle,
|
|
7721
|
-
children: [jsx(Box, {
|
|
7722
|
-
component: "span",
|
|
7723
|
-
sx: {
|
|
7724
|
-
fontWeight: 'bold',
|
|
7725
|
-
fontSize: 12,
|
|
7726
|
-
mr: 1.5
|
|
7727
|
-
},
|
|
7728
|
-
children: t('tac-label')
|
|
7729
|
-
}), words.map(function (word, i) {
|
|
7730
|
-
return jsx(Box
|
|
7731
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
7732
|
-
, {
|
|
7733
|
-
component: "span",
|
|
7734
|
-
sx: hasTac && word === sequenceNumberInTac ? sequenceStyle : {},
|
|
7735
|
-
children: word + (i < words.length - 1 ? ' ' : '')
|
|
7736
|
-
}, word + "-" + i);
|
|
7737
|
-
})]
|
|
7738
|
-
});
|
|
7739
|
-
};
|
|
7740
|
-
return jsxs(Box, {
|
|
7741
|
-
sx: {
|
|
7742
|
-
width: '500px',
|
|
7743
|
-
maxWidth: '600px'
|
|
7744
|
-
},
|
|
7745
|
-
children: [jsx(Typography, {
|
|
7746
|
-
variant: "subtitle2",
|
|
7747
|
-
marginTop: "15px",
|
|
7748
|
-
children: jsx("strong", {
|
|
7749
|
-
children: t('cancel-message')
|
|
7750
|
-
})
|
|
7751
|
-
}), jsx("div", {
|
|
7752
|
-
style: {
|
|
7753
|
-
display: 'flex',
|
|
7754
|
-
alignItems: 'flex-start'
|
|
7755
|
-
},
|
|
7756
|
-
children: renderTacWithSequence(cancelTAC, 'tac-missing-data')
|
|
7757
|
-
}), jsx(Typography, {
|
|
7758
|
-
variant: "subtitle2",
|
|
7759
|
-
children: jsx("strong", {
|
|
7760
|
-
children: t('will-cancel-message')
|
|
7761
|
-
})
|
|
7762
|
-
}), jsx("div", {
|
|
7763
|
-
style: {
|
|
7764
|
-
display: 'flex',
|
|
7765
|
-
alignItems: 'flex-start'
|
|
7766
|
-
},
|
|
7767
|
-
children: jsxs(Box, {
|
|
7768
|
-
component: "pre",
|
|
7769
|
-
sx: tacBlockStyle,
|
|
7770
|
-
children: [jsx(Box, {
|
|
7771
|
-
component: "span",
|
|
7772
|
-
sx: {
|
|
7773
|
-
fontWeight: 'bold',
|
|
7774
|
-
fontSize: 12,
|
|
7775
|
-
mr: 1.5
|
|
7776
|
-
},
|
|
7777
|
-
children: t('tac-label')
|
|
7778
|
-
}), currentTAC != null ? currentTAC : t('tac-missing-data')]
|
|
7779
|
-
})
|
|
7780
|
-
})]
|
|
7781
|
-
});
|
|
7782
|
-
};
|
|
7783
|
-
|
|
7784
8100
|
var _excluded$3 = ["IS_DRAFT", "object", "translation-select"];
|
|
7785
8101
|
var useScrollTopOnError = function useScrollTopOnError(error) {
|
|
7786
8102
|
var ref = React.useRef(null);
|
|
@@ -8044,11 +8360,8 @@ var Form = function Form(_ref5) {
|
|
|
8044
8360
|
isPublishing = _React$useState[0],
|
|
8045
8361
|
setIsPublishing = _React$useState[1];
|
|
8046
8362
|
var _React$useState2 = React.useState(false),
|
|
8047
|
-
|
|
8048
|
-
|
|
8049
|
-
var _React$useState3 = React.useState(false),
|
|
8050
|
-
isSaving = _React$useState3[0],
|
|
8051
|
-
setIsSaving = _React$useState3[1];
|
|
8363
|
+
isSaving = _React$useState2[0],
|
|
8364
|
+
setIsSaving = _React$useState2[1];
|
|
8052
8365
|
var _useTACApi = useTACApi(),
|
|
8053
8366
|
fetchSigmetTAC = _useTACApi.fetchSigmetTAC,
|
|
8054
8367
|
fetchAirmetTAC = _useTACApi.fetchAirmetTAC;
|
|
@@ -8077,12 +8390,12 @@ var Form = function Form(_ref5) {
|
|
|
8077
8390
|
};
|
|
8078
8391
|
}, [endOfWarningValidity, formState, onCloseForm]);
|
|
8079
8392
|
var initialPublicWarningArea = (publicWarningDetails == null || (_publicWarningDetails = publicWarningDetails.areas) == null ? void 0 : _publicWarningDetails.length) && (publicWarningDetails == null || (_publicWarningDetails2 = publicWarningDetails.areas[0]) == null ? void 0 : _publicWarningDetails2.geoJSON);
|
|
8080
|
-
var _React$
|
|
8081
|
-
warningGeoJSONFeature = _React$
|
|
8082
|
-
setWarningGeoJSONFeature = _React$
|
|
8083
|
-
var _React$
|
|
8084
|
-
originalWarningAreas = _React$
|
|
8085
|
-
setOriginalWarningAreas = _React$
|
|
8393
|
+
var _React$useState3 = React.useState(initialPublicWarningArea),
|
|
8394
|
+
warningGeoJSONFeature = _React$useState3[0],
|
|
8395
|
+
setWarningGeoJSONFeature = _React$useState3[1];
|
|
8396
|
+
var _React$useState4 = React.useState(publicWarningDetails == null ? void 0 : publicWarningDetails.areas),
|
|
8397
|
+
originalWarningAreas = _React$useState4[0],
|
|
8398
|
+
setOriginalWarningAreas = _React$useState4[1];
|
|
8086
8399
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
8087
8400
|
t = _useWarningsTranslati.t;
|
|
8088
8401
|
var _useFormContext = useFormContext(),
|
|
@@ -8164,12 +8477,7 @@ var Form = function Form(_ref5) {
|
|
|
8164
8477
|
confirmLabel: getConfirmationDialogButtonLabel(t, action, warningType || 'airmet'),
|
|
8165
8478
|
cancelLabel: getConfirmationDialogCancelLabel(t, action),
|
|
8166
8479
|
catchOnCancel: action === ProductAction.CLOSE,
|
|
8167
|
-
content:
|
|
8168
|
-
// eslint-disable-next-line no-nested-ternary
|
|
8169
|
-
action === ProductAction.CANCEL ? jsx(CancelAviationDialogContent, {
|
|
8170
|
-
product: selectedAviationProduct,
|
|
8171
|
-
warningType: warningType
|
|
8172
|
-
}) : isVAPhenomenon(selectedAviationProduct, action) && !isShortTest() ? jsx(FormProvider, Object.assign({}, formMethods, {
|
|
8480
|
+
content: isVAPhenomenon(selectedAviationProduct, action) && !isShortTest() ? jsx(FormProvider, Object.assign({}, formMethods, {
|
|
8173
8481
|
children: jsx(CancelSigmetVolcanicMovements, {
|
|
8174
8482
|
sigmet: selectedAviationProduct,
|
|
8175
8483
|
productConfig: aviationConfig
|
|
@@ -8199,9 +8507,6 @@ var Form = function Form(_ref5) {
|
|
|
8199
8507
|
};
|
|
8200
8508
|
}();
|
|
8201
8509
|
var getPublishButtonLabel = function getPublishButtonLabel() {
|
|
8202
|
-
if (isCancelling) {
|
|
8203
|
-
return t('cancelling');
|
|
8204
|
-
}
|
|
8205
8510
|
if (isPublishing) {
|
|
8206
8511
|
return t('warning-button-publishing');
|
|
8207
8512
|
}
|
|
@@ -8225,7 +8530,7 @@ var Form = function Form(_ref5) {
|
|
|
8225
8530
|
return _context0.abrupt("return");
|
|
8226
8531
|
case 2:
|
|
8227
8532
|
_context0.t0 = action;
|
|
8228
|
-
_context0.next = _context0.t0 === ProductAction.SAVE ? 5 : _context0.t0 === ProductAction.PUBLISH ? 14 : _context0.t0 === ProductAction.
|
|
8533
|
+
_context0.next = _context0.t0 === ProductAction.SAVE ? 5 : _context0.t0 === ProductAction.PUBLISH ? 14 : _context0.t0 === ProductAction.AMEND ? 17 : _context0.t0 === ProductAction.RENEW ? 19 : _context0.t0 === ProductAction.DISCARD ? 19 : _context0.t0 === ProductAction.DUPLICATE ? 19 : _context0.t0 === ProductAction.CLOSE ? 19 : 20;
|
|
8229
8534
|
break;
|
|
8230
8535
|
case 5:
|
|
8231
8536
|
toggleIsDraft(true);
|
|
@@ -8244,7 +8549,7 @@ var Form = function Form(_ref5) {
|
|
|
8244
8549
|
})["catch"](function () {});
|
|
8245
8550
|
case 12:
|
|
8246
8551
|
setIsSaving(false);
|
|
8247
|
-
return _context0.abrupt("break",
|
|
8552
|
+
return _context0.abrupt("break", 21);
|
|
8248
8553
|
case 14:
|
|
8249
8554
|
toggleIsDraft(false);
|
|
8250
8555
|
void handleSubmit(/*#__PURE__*/function () {
|
|
@@ -8279,17 +8584,8 @@ var Form = function Form(_ref5) {
|
|
|
8279
8584
|
return _ref11.apply(this, arguments);
|
|
8280
8585
|
};
|
|
8281
8586
|
}())();
|
|
8282
|
-
return _context0.abrupt("break",
|
|
8587
|
+
return _context0.abrupt("break", 21);
|
|
8283
8588
|
case 17:
|
|
8284
|
-
void showConfirmDialog(action).then(function () {
|
|
8285
|
-
setIsCancelling(true);
|
|
8286
|
-
void cancelAviationProduct(warningType)["finally"](function () {
|
|
8287
|
-
setIsCancelling(false);
|
|
8288
|
-
onCloseForm();
|
|
8289
|
-
});
|
|
8290
|
-
});
|
|
8291
|
-
return _context0.abrupt("break", 23);
|
|
8292
|
-
case 19:
|
|
8293
8589
|
void handleSubmit(/*#__PURE__*/function () {
|
|
8294
8590
|
var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(formValues) {
|
|
8295
8591
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
@@ -8322,12 +8618,12 @@ var Form = function Form(_ref5) {
|
|
|
8322
8618
|
return _ref13.apply(this, arguments);
|
|
8323
8619
|
};
|
|
8324
8620
|
}())();
|
|
8325
|
-
return _context0.abrupt("break",
|
|
8326
|
-
case
|
|
8327
|
-
return _context0.abrupt("break",
|
|
8328
|
-
case
|
|
8621
|
+
return _context0.abrupt("break", 21);
|
|
8622
|
+
case 19:
|
|
8623
|
+
return _context0.abrupt("break", 21);
|
|
8624
|
+
case 20:
|
|
8329
8625
|
console.warn("Unhandled product action: " + action);
|
|
8330
|
-
case
|
|
8626
|
+
case 21:
|
|
8331
8627
|
case "end":
|
|
8332
8628
|
return _context0.stop();
|
|
8333
8629
|
}
|
|
@@ -8404,6 +8700,9 @@ var Form = function Form(_ref5) {
|
|
|
8404
8700
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8405
8701
|
}, [initialPublicWarningArea]);
|
|
8406
8702
|
var aviationId = selectedAviationProduct == null ? void 0 : selectedAviationProduct.uuid;
|
|
8703
|
+
var publishedStart = publicWarningDetails == null ? void 0 : publicWarningDetails.validFrom;
|
|
8704
|
+
var nowIso = dateUtils.getCurrentTimeAsString();
|
|
8705
|
+
var lockValidFrom = formState === 'amending' && !!publishedStart && new Date(publishedStart).getTime() <= new Date(nowIso).getTime();
|
|
8407
8706
|
React.useEffect(function () {
|
|
8408
8707
|
if (!selectedAviationProduct) {
|
|
8409
8708
|
return;
|
|
@@ -8444,7 +8743,7 @@ var Form = function Form(_ref5) {
|
|
|
8444
8743
|
},
|
|
8445
8744
|
storedGeoJSON: storedStartGeoJSON,
|
|
8446
8745
|
storedEndGeoJSON: storedEndGeoJSON,
|
|
8447
|
-
|
|
8746
|
+
lockValidFrom: lockValidFrom
|
|
8448
8747
|
})
|
|
8449
8748
|
});
|
|
8450
8749
|
}
|
|
@@ -8468,7 +8767,7 @@ var Form = function Form(_ref5) {
|
|
|
8468
8767
|
return fetchAirmetTAC(product);
|
|
8469
8768
|
},
|
|
8470
8769
|
storedGeoJSON: storedStartGeoJSON,
|
|
8471
|
-
|
|
8770
|
+
lockValidFrom: lockValidFrom
|
|
8472
8771
|
})
|
|
8473
8772
|
});
|
|
8474
8773
|
}
|
|
@@ -8716,7 +9015,7 @@ var Form = function Form(_ref5) {
|
|
|
8716
9015
|
sx: {
|
|
8717
9016
|
width: '100%'
|
|
8718
9017
|
},
|
|
8719
|
-
disabled: isPublishing
|
|
9018
|
+
disabled: isPublishing,
|
|
8720
9019
|
onClick: function onClick() {
|
|
8721
9020
|
void (selectedAviationProduct ? handleSubmitAviationProduct(ProductAction.CANCEL, warningType) : onPressPublish());
|
|
8722
9021
|
},
|
|
@@ -8724,7 +9023,7 @@ var Form = function Form(_ref5) {
|
|
|
8724
9023
|
style: {
|
|
8725
9024
|
position: 'relative'
|
|
8726
9025
|
},
|
|
8727
|
-
children: [getPublishButtonLabel(),
|
|
9026
|
+
children: [getPublishButtonLabel(), isPublishing && jsx(CircularProgress, {
|
|
8728
9027
|
"data-testid": "spinner",
|
|
8729
9028
|
color: "inherit",
|
|
8730
9029
|
sx: spinnerSx
|
|
@@ -9728,18 +10027,18 @@ var AreaObjectLoaderConnect = function AreaObjectLoaderConnect(_ref) {
|
|
|
9728
10027
|
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
9729
10028
|
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
9730
10029
|
* */
|
|
9731
|
-
var useWarnings = function useWarnings(disabled) {
|
|
10030
|
+
var useWarnings = function useWarnings(disabled, timeFilter) {
|
|
9732
10031
|
var _usePublicWarnings = usePublicWarnings(disabled),
|
|
9733
10032
|
publicWarnings = _usePublicWarnings.data,
|
|
9734
10033
|
refetchPublicWarnings = _usePublicWarnings.refetch,
|
|
9735
10034
|
isFetchingPublicWarnings = _usePublicWarnings.isFetching,
|
|
9736
10035
|
publicWarningsError = _usePublicWarnings.error,
|
|
9737
10036
|
dataUpdatedAt = _usePublicWarnings.dataUpdatedAt;
|
|
9738
|
-
var _useAirmetList = useAirmetList(disabled),
|
|
10037
|
+
var _useAirmetList = useAirmetList(disabled, timeFilter),
|
|
9739
10038
|
airmetWarnings = _useAirmetList.data,
|
|
9740
10039
|
refetchAirmet = _useAirmetList.refetch,
|
|
9741
10040
|
isFetchingAirmet = _useAirmetList.isFetching;
|
|
9742
|
-
var _useSigmetList = useSigmetList(disabled),
|
|
10041
|
+
var _useSigmetList = useSigmetList(disabled, timeFilter),
|
|
9743
10042
|
sigmetWarnings = _useSigmetList.data,
|
|
9744
10043
|
refetchSigmet = _useSigmetList.refetch,
|
|
9745
10044
|
isFetchingSigmet = _useSigmetList.isFetching;
|
|
@@ -9828,6 +10127,7 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
9828
10127
|
var isFormDirty = useSelector(function (store) {
|
|
9829
10128
|
return getSelectedPublicIsFormDirty(store);
|
|
9830
10129
|
});
|
|
10130
|
+
usePreventBrowserClose(isFormDirty);
|
|
9831
10131
|
var publicWarningState = useSelector(getPublicWarning);
|
|
9832
10132
|
var _ref2 = publicWarningState || {},
|
|
9833
10133
|
status = _ref2.status,
|
|
@@ -9879,6 +10179,9 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
9879
10179
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9880
10180
|
}, [dispatch, linkedMaps == null ? void 0 : linkedMaps.join(',')]);
|
|
9881
10181
|
React__default.useEffect(function () {
|
|
10182
|
+
if (updatedWarningType === 'airmet' || updatedWarningType === 'sigmet') {
|
|
10183
|
+
return;
|
|
10184
|
+
}
|
|
9882
10185
|
if (editor !== (selectedWarning == null ? void 0 : selectedWarning.editor) && status !== 'TODO') {
|
|
9883
10186
|
void setIsEditor(editor !== (auth == null ? void 0 : auth.username));
|
|
9884
10187
|
}
|
|
@@ -10103,300 +10406,133 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
10103
10406
|
});
|
|
10104
10407
|
};
|
|
10105
10408
|
|
|
10106
|
-
|
|
10107
|
-
|
|
10108
|
-
|
|
10109
|
-
|
|
10110
|
-
|
|
10111
|
-
|
|
10112
|
-
*
|
|
10113
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
10114
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
10115
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
10116
|
-
* See the License for the specific language governing permissions and
|
|
10117
|
-
* limitations under the License.
|
|
10118
|
-
*
|
|
10119
|
-
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
10120
|
-
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
10121
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
10122
|
-
* */
|
|
10123
|
-
var warningColors = Object.assign({}, LevelColors);
|
|
10124
|
-
|
|
10125
|
-
var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
|
|
10126
|
-
var id = _ref.id,
|
|
10127
|
-
options = _ref.options,
|
|
10128
|
-
updateFilter = _ref.updateFilter;
|
|
10409
|
+
var BUTTON_AIRMET = 'AIRMET';
|
|
10410
|
+
var BUTTON_SIGMET = 'SIGMET';
|
|
10411
|
+
var NewWarningButton = function NewWarningButton(_ref) {
|
|
10412
|
+
var onCreateWarning = _ref.onCreateWarning,
|
|
10413
|
+
_ref$isDefaultOpen = _ref.isDefaultOpen,
|
|
10414
|
+
isDefaultOpen = _ref$isDefaultOpen === void 0 ? false : _ref$isDefaultOpen;
|
|
10129
10415
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
10130
10416
|
t = _useWarningsTranslati.t;
|
|
10131
|
-
var
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
10135
|
-
|
|
10136
|
-
|
|
10137
|
-
var
|
|
10138
|
-
|
|
10139
|
-
|
|
10140
|
-
|
|
10141
|
-
|
|
10142
|
-
|
|
10143
|
-
|
|
10144
|
-
|
|
10145
|
-
|
|
10146
|
-
|
|
10147
|
-
|
|
10148
|
-
|
|
10149
|
-
|
|
10150
|
-
|
|
10151
|
-
|
|
10152
|
-
|
|
10153
|
-
|
|
10154
|
-
|
|
10155
|
-
|
|
10156
|
-
|
|
10157
|
-
|
|
10158
|
-
|
|
10159
|
-
|
|
10160
|
-
|
|
10161
|
-
|
|
10162
|
-
|
|
10163
|
-
|
|
10164
|
-
|
|
10165
|
-
|
|
10166
|
-
|
|
10167
|
-
|
|
10168
|
-
|
|
10169
|
-
|
|
10170
|
-
|
|
10171
|
-
|
|
10172
|
-
|
|
10173
|
-
})
|
|
10174
|
-
})
|
|
10417
|
+
var config = sessionStorageProvider.getConfig();
|
|
10418
|
+
var showMartimeWarningOption = !!config.GW_WARNINGS_MARITIME_WARNINGS;
|
|
10419
|
+
var _React$useState = React__default.useState(null),
|
|
10420
|
+
anchorEl = _React$useState[0],
|
|
10421
|
+
setAnchorEl = _React$useState[1];
|
|
10422
|
+
var isOpen = Boolean(anchorEl);
|
|
10423
|
+
var handleClick = function handleClick(event) {
|
|
10424
|
+
event.stopPropagation();
|
|
10425
|
+
setAnchorEl(event.currentTarget);
|
|
10426
|
+
};
|
|
10427
|
+
var handleClose = function handleClose(event) {
|
|
10428
|
+
event.stopPropagation();
|
|
10429
|
+
setAnchorEl(null);
|
|
10430
|
+
};
|
|
10431
|
+
var onCreateNewWarning = function onCreateNewWarning(warningType, event) {
|
|
10432
|
+
onCreateWarning(warningType);
|
|
10433
|
+
handleClose(event);
|
|
10434
|
+
};
|
|
10435
|
+
var buttonId = 'newWarningButton';
|
|
10436
|
+
React__default.useEffect(function () {
|
|
10437
|
+
if (isDefaultOpen) {
|
|
10438
|
+
setAnchorEl(document.getElementById(buttonId));
|
|
10439
|
+
}
|
|
10440
|
+
}, [isDefaultOpen, buttonId]);
|
|
10441
|
+
return jsxs(Fragment, {
|
|
10442
|
+
children: [jsxs(CustomToggleButton, {
|
|
10443
|
+
id: buttonId,
|
|
10444
|
+
onClick: handleClick,
|
|
10445
|
+
sx: Object.assign({
|
|
10446
|
+
textTransform: 'initial!important',
|
|
10447
|
+
marginBottom: '8px',
|
|
10448
|
+
fontSize: '12px',
|
|
10449
|
+
height: '32px!important',
|
|
10450
|
+
whiteSpace: 'nowrap',
|
|
10451
|
+
minWidth: 'auto',
|
|
10452
|
+
paddingRight: '12px!important'
|
|
10453
|
+
}, isOpen ? {
|
|
10454
|
+
'&.MuiToggleButton-root.primary': {
|
|
10455
|
+
backgroundColor: 'geowebColors.buttons.primary.mouseOver.fill'
|
|
10456
|
+
}
|
|
10457
|
+
} : {}),
|
|
10458
|
+
children: [jsx(Add, {}), t('warning-list-button_create')]
|
|
10175
10459
|
}), jsxs(Menu, {
|
|
10176
|
-
open: Boolean(anchorEl),
|
|
10177
|
-
onClose: function onClose() {
|
|
10178
|
-
return setAnchorEl(null);
|
|
10179
|
-
},
|
|
10180
10460
|
anchorEl: anchorEl,
|
|
10181
|
-
|
|
10182
|
-
|
|
10183
|
-
|
|
10184
|
-
|
|
10185
|
-
transition: 'none'
|
|
10186
|
-
}
|
|
10461
|
+
open: isOpen,
|
|
10462
|
+
onClose: function onClose(event, reason) {
|
|
10463
|
+
if (reason === 'tabKeyDown') {
|
|
10464
|
+
return;
|
|
10187
10465
|
}
|
|
10466
|
+
handleClose(event);
|
|
10188
10467
|
},
|
|
10189
|
-
|
|
10190
|
-
|
|
10468
|
+
anchorOrigin: {
|
|
10469
|
+
vertical: 'bottom',
|
|
10470
|
+
horizontal: 'center'
|
|
10191
10471
|
},
|
|
10192
|
-
|
|
10193
|
-
|
|
10194
|
-
|
|
10195
|
-
|
|
10196
|
-
|
|
10197
|
-
|
|
10198
|
-
|
|
10199
|
-
|
|
10200
|
-
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
fontSize: '20px',
|
|
10204
|
-
fontWeight: 500,
|
|
10205
|
-
paddingRight: 1
|
|
10206
|
-
},
|
|
10207
|
-
"data-testid": "customDialog-title",
|
|
10208
|
-
component: "span",
|
|
10209
|
-
children: t("filter-" + id)
|
|
10210
|
-
}), jsx(CustomIconButton, {
|
|
10211
|
-
"aria-label": t('close-dialog-confirm'),
|
|
10212
|
-
onClick: function onClick() {
|
|
10213
|
-
return setAnchorEl(null);
|
|
10214
|
-
},
|
|
10215
|
-
sx: {
|
|
10216
|
-
'&.MuiIconButton-root': {
|
|
10217
|
-
color: 'geowebColors.greys.accessible'
|
|
10218
|
-
}
|
|
10219
|
-
},
|
|
10220
|
-
children: jsx(Close, {})
|
|
10221
|
-
})]
|
|
10222
|
-
}), jsxs(DialogContent, {
|
|
10223
|
-
sx: {
|
|
10224
|
-
padding: '0px 24px 16px 24px'
|
|
10225
|
-
},
|
|
10226
|
-
children: [jsxs(Grid, {
|
|
10227
|
-
container: true,
|
|
10228
|
-
justifyContent: "space-between",
|
|
10229
|
-
alignItems: "center",
|
|
10230
|
-
children: [t('filter-select-all'), jsx(Switch, {
|
|
10231
|
-
slotProps: {
|
|
10232
|
-
input: {
|
|
10233
|
-
'aria-label': t('filter-select-all')
|
|
10472
|
+
transformOrigin: {
|
|
10473
|
+
vertical: 'top',
|
|
10474
|
+
horizontal: 'center'
|
|
10475
|
+
},
|
|
10476
|
+
slotProps: {
|
|
10477
|
+
root: {
|
|
10478
|
+
slotProps: {
|
|
10479
|
+
backdrop: {
|
|
10480
|
+
style: {
|
|
10481
|
+
opacity: 0,
|
|
10482
|
+
transition: 'none'
|
|
10234
10483
|
}
|
|
10235
|
-
},
|
|
10236
|
-
checked: allSelected,
|
|
10237
|
-
onChange: function onChange() {
|
|
10238
|
-
return updateFilter(id, 'ALL', !allSelected);
|
|
10239
|
-
},
|
|
10240
|
-
sx: {
|
|
10241
|
-
marginRight: '-12px',
|
|
10242
|
-
marginTop: '-6px'
|
|
10243
10484
|
}
|
|
10244
|
-
}
|
|
10245
|
-
}), jsxs(Box, {
|
|
10246
|
-
children: [options[emptyFilterId] !== undefined && jsx(FilterOption, {
|
|
10247
|
-
optionId: emptyFilterId,
|
|
10248
|
-
checked: options[emptyFilterId],
|
|
10249
|
-
onClick: function onClick(checked, only) {
|
|
10250
|
-
return updateFilter(id, emptyFilterId, checked, only);
|
|
10251
|
-
},
|
|
10252
|
-
labelStyle: {
|
|
10253
|
-
fontSize: '16px'
|
|
10254
|
-
},
|
|
10255
|
-
label: jsx(Fragment, {
|
|
10256
|
-
children: t(getTranslationKey(emptyFilterId, id))
|
|
10257
|
-
})
|
|
10258
|
-
}, id + "-" + emptyFilterId), Object.keys(options).map(function (optionId) {
|
|
10259
|
-
if (optionId === emptyFilterId) {
|
|
10260
|
-
return null;
|
|
10261
|
-
}
|
|
10262
|
-
var warningColor = warningColors[optionId];
|
|
10263
|
-
return jsx(FilterOption, {
|
|
10264
|
-
optionId: optionId,
|
|
10265
|
-
checked: options[optionId],
|
|
10266
|
-
onClick: function onClick(checked, only) {
|
|
10267
|
-
return updateFilter(id, optionId, checked, only);
|
|
10268
|
-
},
|
|
10269
|
-
labelStyle: Object.assign({}, getLevelStyle(warningColor), {
|
|
10270
|
-
width: LevelColors[optionId] ? 'fit-content' : '100%',
|
|
10271
|
-
fontSize: '16px'
|
|
10272
|
-
}),
|
|
10273
|
-
label: jsx(CustomTooltip, {
|
|
10274
|
-
title: t(getTranslationKey(optionId, id)),
|
|
10275
|
-
placement: "bottom",
|
|
10276
|
-
children: jsxs(Box, {
|
|
10277
|
-
"data-testid": "wrapper-" + optionId,
|
|
10278
|
-
sx: {
|
|
10279
|
-
display: 'flex',
|
|
10280
|
-
alignItems: 'center',
|
|
10281
|
-
gap: 1,
|
|
10282
|
-
maxWidth: 200
|
|
10283
|
-
},
|
|
10284
|
-
children: [getPhenomenaIcon(optionId), jsx(Typography, {
|
|
10285
|
-
noWrap: true,
|
|
10286
|
-
variant: "body2",
|
|
10287
|
-
sx: {
|
|
10288
|
-
fontSize: '16px'
|
|
10289
|
-
},
|
|
10290
|
-
children: t(getTranslationKey(optionId, id))
|
|
10291
|
-
})]
|
|
10292
|
-
})
|
|
10293
|
-
})
|
|
10294
|
-
}, id + "-" + optionId);
|
|
10295
|
-
})]
|
|
10296
|
-
})]
|
|
10297
|
-
})]
|
|
10298
|
-
})]
|
|
10299
|
-
});
|
|
10300
|
-
};
|
|
10301
|
-
|
|
10302
|
-
var filterOrder = ['source', 'domain', 'phenomenon', 'level'];
|
|
10303
|
-
var FilterList = function FilterList(_ref) {
|
|
10304
|
-
var _ref$onClickAll = _ref.onClickAll,
|
|
10305
|
-
onClickAll = _ref$onClickAll === void 0 ? function () {} : _ref$onClickAll,
|
|
10306
|
-
_ref$isAllSelected = _ref.isAllSelected,
|
|
10307
|
-
isAllSelected = _ref$isAllSelected === void 0 ? true : _ref$isAllSelected,
|
|
10308
|
-
filterState = _ref.filterState,
|
|
10309
|
-
updateFilter = _ref.updateFilter;
|
|
10310
|
-
var _useWarningsTranslati = useWarningsTranslation(),
|
|
10311
|
-
t = _useWarningsTranslati.t;
|
|
10312
|
-
return jsxs(Stack, {
|
|
10313
|
-
direction: "row",
|
|
10314
|
-
spacing: 1,
|
|
10315
|
-
sx: {
|
|
10316
|
-
display: 'block',
|
|
10317
|
-
'.MuiChip-root': {
|
|
10318
|
-
margin: 0,
|
|
10319
|
-
marginRight: 1,
|
|
10320
|
-
marginBottom: 1
|
|
10321
|
-
}
|
|
10322
|
-
},
|
|
10323
|
-
children: [jsx(CustomTooltip, {
|
|
10324
|
-
title: isAllSelected ? t('filter-hide-all') : t('filter-show-all'),
|
|
10325
|
-
placement: "bottom",
|
|
10326
|
-
children: jsx("span", {
|
|
10327
|
-
style: {
|
|
10328
|
-
margin: 0
|
|
10485
|
+
}
|
|
10329
10486
|
},
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
return onClickAll(isAllSelected);
|
|
10336
|
-
},
|
|
10337
|
-
size: "medium"
|
|
10338
|
-
})
|
|
10339
|
-
})
|
|
10340
|
-
}), filterOrder.map(function (filterId) {
|
|
10341
|
-
return jsx(ExpandableFilterChip, {
|
|
10342
|
-
id: filterId,
|
|
10343
|
-
options: filterState[filterId],
|
|
10344
|
-
updateFilter: updateFilter
|
|
10345
|
-
}, filterId);
|
|
10346
|
-
})]
|
|
10347
|
-
});
|
|
10348
|
-
};
|
|
10349
|
-
|
|
10350
|
-
var _excluded$2 = ["totalWarnings", "status", "isExpanded", "onClick"];
|
|
10351
|
-
var HEADER_SIZE = 32;
|
|
10352
|
-
var WarningListItemSeperator = function WarningListItemSeperator(_ref) {
|
|
10353
|
-
var totalWarnings = _ref.totalWarnings,
|
|
10354
|
-
status = _ref.status,
|
|
10355
|
-
isExpanded = _ref.isExpanded,
|
|
10356
|
-
onClick = _ref.onClick,
|
|
10357
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
10358
|
-
var _useWarningsTranslati = useWarningsTranslation(),
|
|
10359
|
-
t = _useWarningsTranslati.t;
|
|
10360
|
-
var getStatus = function getStatus(status) {
|
|
10361
|
-
switch (status) {
|
|
10362
|
-
case 'DRAFT':
|
|
10363
|
-
return t('warning-list-status-draft');
|
|
10364
|
-
case 'PUBLISHED':
|
|
10365
|
-
return t('warning-list-status-published');
|
|
10366
|
-
case 'TODO':
|
|
10367
|
-
return t('warning-list-status-todo');
|
|
10368
|
-
default:
|
|
10369
|
-
return t('warning-list-status-expired');
|
|
10370
|
-
}
|
|
10371
|
-
};
|
|
10372
|
-
var headerText = totalWarnings + " " + getStatus(status);
|
|
10373
|
-
return jsx(ListItem, Object.assign({}, props, {
|
|
10374
|
-
sx: {
|
|
10375
|
-
height: HEADER_SIZE,
|
|
10376
|
-
padding: 0
|
|
10377
|
-
},
|
|
10378
|
-
"aria-label": "warninglist " + status,
|
|
10379
|
-
children: jsxs(ListItemButton, {
|
|
10380
|
-
sx: {
|
|
10381
|
-
height: HEADER_SIZE,
|
|
10382
|
-
padding: 0
|
|
10487
|
+
list: {
|
|
10488
|
+
style: {
|
|
10489
|
+
padding: '0px'
|
|
10490
|
+
}
|
|
10491
|
+
}
|
|
10383
10492
|
},
|
|
10384
|
-
|
|
10385
|
-
|
|
10386
|
-
|
|
10387
|
-
|
|
10388
|
-
|
|
10389
|
-
|
|
10390
|
-
|
|
10391
|
-
|
|
10493
|
+
children: [jsx(MenuItem, {
|
|
10494
|
+
onClick: function onClick(event) {
|
|
10495
|
+
onCreateNewWarning('public', event);
|
|
10496
|
+
},
|
|
10497
|
+
children: jsx(ListItemText, {
|
|
10498
|
+
children: t('public-warning-title').toUpperCase()
|
|
10499
|
+
})
|
|
10500
|
+
}, "Public"), jsx(MenuItem, {
|
|
10501
|
+
onClick: function onClick(event) {
|
|
10502
|
+
onCreateNewWarning('airmet', event);
|
|
10392
10503
|
},
|
|
10393
|
-
children:
|
|
10394
|
-
|
|
10395
|
-
|
|
10396
|
-
|
|
10504
|
+
children: jsx(ListItemText, {
|
|
10505
|
+
children: BUTTON_AIRMET
|
|
10506
|
+
})
|
|
10507
|
+
}, "Airmet"), jsx(MenuItem, {
|
|
10508
|
+
onClick: function onClick(event) {
|
|
10509
|
+
onCreateNewWarning('sigmet', event);
|
|
10510
|
+
},
|
|
10511
|
+
children: jsx(ListItemText, {
|
|
10512
|
+
children: BUTTON_SIGMET
|
|
10513
|
+
})
|
|
10514
|
+
}, "Sigmet"), showMartimeWarningOption ? jsxs(Fragment, {
|
|
10515
|
+
children: [jsx(MenuItem, {
|
|
10516
|
+
onClick: function onClick(event) {
|
|
10517
|
+
onCreateNewWarning('maritimeWarningCoastal', event);
|
|
10518
|
+
},
|
|
10519
|
+
children: jsx(ListItemText, {
|
|
10520
|
+
children: t('maritime-warning-coastal-title').toUpperCase()
|
|
10521
|
+
})
|
|
10522
|
+
}, "MaritimeWarningCoastal"), jsx(MenuItem, {
|
|
10523
|
+
onClick: function onClick(event) {
|
|
10524
|
+
onCreateNewWarning('maritimeWarningNorthSea', event);
|
|
10525
|
+
},
|
|
10526
|
+
children: jsx(ListItemText, {
|
|
10527
|
+
children: t('maritime-warning-northsea-title').toUpperCase()
|
|
10528
|
+
})
|
|
10529
|
+
}, "MaritimeWarningNorthSea")]
|
|
10530
|
+
}) : null]
|
|
10531
|
+
})]
|
|
10532
|
+
});
|
|
10397
10533
|
};
|
|
10398
10534
|
|
|
10399
|
-
var _excluded$
|
|
10535
|
+
var _excluded$2 = ["title", "status", "children", "width"];
|
|
10400
10536
|
var WarningListColumnContent = function WarningListColumnContent(_ref) {
|
|
10401
10537
|
var _sx;
|
|
10402
10538
|
var title = _ref.title,
|
|
@@ -10404,7 +10540,7 @@ var WarningListColumnContent = function WarningListColumnContent(_ref) {
|
|
|
10404
10540
|
children = _ref.children,
|
|
10405
10541
|
_ref$width = _ref.width,
|
|
10406
10542
|
width = _ref$width === void 0 ? 76 : _ref$width,
|
|
10407
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
10543
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
10408
10544
|
return jsxs(Grid, {
|
|
10409
10545
|
sx: Object.assign({}, props.sx, {
|
|
10410
10546
|
width: width
|
|
@@ -10592,7 +10728,7 @@ var WarningListItemMenu = function WarningListItemMenu(_ref) {
|
|
|
10592
10728
|
}
|
|
10593
10729
|
};
|
|
10594
10730
|
|
|
10595
|
-
var _excluded = ["warning", "activeWarningId", "highlightedItem", "onSelectWarning", "onEditWarning", "onDeleteWarning", "onDeleteReviewWarning", "onExpireWarning", "onWithdrawWarning", "onActionAviationWarning", "onActionMaritimeWarning"];
|
|
10731
|
+
var _excluded$1 = ["warning", "activeWarningId", "highlightedItem", "onSelectWarning", "onEditWarning", "onDeleteWarning", "onDeleteReviewWarning", "onExpireWarning", "onWithdrawWarning", "onActionAviationWarning", "onActionMaritimeWarning"];
|
|
10596
10732
|
var renderLevelText = function renderLevelText(levelString) {
|
|
10597
10733
|
if (!levelString) {
|
|
10598
10734
|
return null;
|
|
@@ -10691,7 +10827,7 @@ var WarningListItem = function WarningListItem(_ref) {
|
|
|
10691
10827
|
onActionAviationWarning = _ref$onActionAviation === void 0 ? function () {} : _ref$onActionAviation,
|
|
10692
10828
|
_ref$onActionMaritime = _ref.onActionMaritimeWarning,
|
|
10693
10829
|
onActionMaritimeWarning = _ref$onActionMaritime === void 0 ? function () {} : _ref$onActionMaritime,
|
|
10694
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
10830
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
10695
10831
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
10696
10832
|
t = _useWarningsTranslati.t;
|
|
10697
10833
|
var phenomenonDetails = allPhenomenaDict[warning.warningDetail.phenomenon];
|
|
@@ -10881,182 +11017,661 @@ var WarningListItem = function WarningListItem(_ref) {
|
|
|
10881
11017
|
// Show sigmet-airmet level
|
|
10882
11018
|
return warning.warningDetail.level;
|
|
10883
11019
|
}
|
|
10884
|
-
return renderLevelText(defaultLevelText);
|
|
10885
|
-
}()
|
|
10886
|
-
})
|
|
10887
|
-
}), jsx(WarningListColumnContent, {
|
|
10888
|
-
title: t('areas'),
|
|
10889
|
-
status: status,
|
|
10890
|
-
children: jsx(Box, {
|
|
10891
|
-
display: "inline-block",
|
|
10892
|
-
component: "div",
|
|
10893
|
-
ref: objectNameRef,
|
|
10894
|
-
sx: {
|
|
10895
|
-
textOverflow: 'ellipsis',
|
|
10896
|
-
overflow: 'hidden',
|
|
10897
|
-
width: 70,
|
|
10898
|
-
whiteSpace: 'nowrap'
|
|
11020
|
+
return renderLevelText(defaultLevelText);
|
|
11021
|
+
}()
|
|
11022
|
+
})
|
|
11023
|
+
}), jsx(WarningListColumnContent, {
|
|
11024
|
+
title: t('areas'),
|
|
11025
|
+
status: status,
|
|
11026
|
+
children: jsx(Box, {
|
|
11027
|
+
display: "inline-block",
|
|
11028
|
+
component: "div",
|
|
11029
|
+
ref: objectNameRef,
|
|
11030
|
+
sx: {
|
|
11031
|
+
textOverflow: 'ellipsis',
|
|
11032
|
+
overflow: 'hidden',
|
|
11033
|
+
width: 70,
|
|
11034
|
+
whiteSpace: 'nowrap'
|
|
11035
|
+
},
|
|
11036
|
+
children: jsx(CustomTooltip, {
|
|
11037
|
+
title: objectHoverText,
|
|
11038
|
+
placement: "top",
|
|
11039
|
+
sx: {
|
|
11040
|
+
zIndex: 1000
|
|
11041
|
+
},
|
|
11042
|
+
children: jsx("span", {
|
|
11043
|
+
children: objectNameText
|
|
11044
|
+
})
|
|
11045
|
+
})
|
|
11046
|
+
})
|
|
11047
|
+
}), jsx(WarningListColumnContent, {
|
|
11048
|
+
title: t('warning-list-header-status'),
|
|
11049
|
+
status: status,
|
|
11050
|
+
width: 96,
|
|
11051
|
+
children: jsxs(Box, {
|
|
11052
|
+
sx: {
|
|
11053
|
+
position: 'relative'
|
|
11054
|
+
},
|
|
11055
|
+
children: [renderStatusIcon(warning, status), warning.editor && jsx(Box, {
|
|
11056
|
+
sx: {
|
|
11057
|
+
width: '16px',
|
|
11058
|
+
position: 'absolute',
|
|
11059
|
+
top: '1px',
|
|
11060
|
+
right: '4px'
|
|
11061
|
+
},
|
|
11062
|
+
children: jsx(WarningAvatar, {
|
|
11063
|
+
editor: warning.editor,
|
|
11064
|
+
status: warning.productStatus
|
|
11065
|
+
})
|
|
11066
|
+
})]
|
|
11067
|
+
})
|
|
11068
|
+
})]
|
|
11069
|
+
})
|
|
11070
|
+
})
|
|
11071
|
+
}), warning.id);
|
|
11072
|
+
};
|
|
11073
|
+
|
|
11074
|
+
var _excluded = ["totalWarnings", "status", "isExpanded", "timeFilter", "onClick"];
|
|
11075
|
+
var HEADER_SIZE = 32;
|
|
11076
|
+
var WarningListItemSeperator = function WarningListItemSeperator(_ref) {
|
|
11077
|
+
var totalWarnings = _ref.totalWarnings,
|
|
11078
|
+
status = _ref.status,
|
|
11079
|
+
isExpanded = _ref.isExpanded,
|
|
11080
|
+
timeFilter = _ref.timeFilter,
|
|
11081
|
+
onClick = _ref.onClick,
|
|
11082
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
11083
|
+
var _useWarningsTranslati = useWarningsTranslation(),
|
|
11084
|
+
t = _useWarningsTranslati.t;
|
|
11085
|
+
var getStatus = function getStatus(status) {
|
|
11086
|
+
switch (status) {
|
|
11087
|
+
case 'DRAFT':
|
|
11088
|
+
return t('warning-list-status-draft');
|
|
11089
|
+
case 'PUBLISHED':
|
|
11090
|
+
return t('warning-list-status-published');
|
|
11091
|
+
case 'TODO':
|
|
11092
|
+
return t('warning-list-status-todo');
|
|
11093
|
+
default:
|
|
11094
|
+
return timeFilter.mode === 'custom' ? t('warning-list-status-expired-custom-time') : t('warning-list-status-expired');
|
|
11095
|
+
}
|
|
11096
|
+
};
|
|
11097
|
+
var headerText = totalWarnings + " " + getStatus(status);
|
|
11098
|
+
return jsx(ListItem, Object.assign({}, props, {
|
|
11099
|
+
sx: {
|
|
11100
|
+
height: HEADER_SIZE,
|
|
11101
|
+
padding: 0
|
|
11102
|
+
},
|
|
11103
|
+
"aria-label": "warninglist " + status,
|
|
11104
|
+
children: jsxs(ListItemButton, {
|
|
11105
|
+
sx: {
|
|
11106
|
+
height: HEADER_SIZE,
|
|
11107
|
+
padding: 0
|
|
11108
|
+
},
|
|
11109
|
+
onClick: onClick,
|
|
11110
|
+
"data-testid": "warninglist-" + status,
|
|
11111
|
+
"aria-expanded": isExpanded,
|
|
11112
|
+
children: [isExpanded ? jsx(ChevronDown, {}) : jsx(ChevronUp, {}), jsx(Typography, {
|
|
11113
|
+
variant: "caption",
|
|
11114
|
+
sx: {
|
|
11115
|
+
opacity: 0.67,
|
|
11116
|
+
marginLeft: 1
|
|
11117
|
+
},
|
|
11118
|
+
children: headerText
|
|
11119
|
+
})]
|
|
11120
|
+
})
|
|
11121
|
+
}));
|
|
11122
|
+
};
|
|
11123
|
+
|
|
11124
|
+
/* *
|
|
11125
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11126
|
+
* you may not use this file except in compliance with the License.
|
|
11127
|
+
* You may obtain a copy of the License at
|
|
11128
|
+
*
|
|
11129
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11130
|
+
*
|
|
11131
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11132
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11133
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11134
|
+
* See the License for the specific language governing permissions and
|
|
11135
|
+
* limitations under the License.
|
|
11136
|
+
*
|
|
11137
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
11138
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
11139
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
11140
|
+
* */
|
|
11141
|
+
var warningColors = Object.assign({}, LevelColors);
|
|
11142
|
+
|
|
11143
|
+
var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
|
|
11144
|
+
var id = _ref.id,
|
|
11145
|
+
options = _ref.options,
|
|
11146
|
+
updateFilter = _ref.updateFilter;
|
|
11147
|
+
var _useWarningsTranslati = useWarningsTranslation(),
|
|
11148
|
+
t = _useWarningsTranslati.t;
|
|
11149
|
+
var _useState = useState(null),
|
|
11150
|
+
anchorEl = _useState[0],
|
|
11151
|
+
setAnchorEl = _useState[1];
|
|
11152
|
+
var _getSelectedOptions = getSelectedOptions(options),
|
|
11153
|
+
noSelectedOptions = _getSelectedOptions.noSelectedOptions,
|
|
11154
|
+
allSelected = _getSelectedOptions.allSelected;
|
|
11155
|
+
var isDisabled = Object.keys(options).length < 2;
|
|
11156
|
+
return jsxs(Fragment, {
|
|
11157
|
+
children: [jsx(CustomTooltip, {
|
|
11158
|
+
title: isDisabled ? t('filter-no-results') : t('filter-options'),
|
|
11159
|
+
placement: "bottom",
|
|
11160
|
+
children: jsx("span", {
|
|
11161
|
+
style: {
|
|
11162
|
+
margin: 0
|
|
11163
|
+
},
|
|
11164
|
+
children: jsx(FilterChip, {
|
|
11165
|
+
id: id,
|
|
11166
|
+
label: t("filter-" + id),
|
|
11167
|
+
isSelected: !isDisabled && noSelectedOptions > 0,
|
|
11168
|
+
onClick: function onClick(ref) {
|
|
11169
|
+
return setAnchorEl(ref);
|
|
11170
|
+
},
|
|
11171
|
+
onClickIcon: function onClickIcon(ref) {
|
|
11172
|
+
return setAnchorEl(ref);
|
|
11173
|
+
},
|
|
11174
|
+
isDisabled: isDisabled,
|
|
11175
|
+
size: "medium",
|
|
11176
|
+
actionIcon: jsxs(Grid, {
|
|
11177
|
+
container: true,
|
|
11178
|
+
alignItems: "center",
|
|
11179
|
+
style: {
|
|
11180
|
+
marginRight: '8px',
|
|
11181
|
+
minWidth: '36px'
|
|
11182
|
+
},
|
|
11183
|
+
children: [jsx(Options, {}), jsx(Typography, {
|
|
11184
|
+
variant: "body2",
|
|
11185
|
+
sx: {
|
|
11186
|
+
paddingLeft: 0.5
|
|
11187
|
+
},
|
|
11188
|
+
children: !isDisabled && noSelectedOptions > 0 && noSelectedOptions
|
|
11189
|
+
})]
|
|
11190
|
+
})
|
|
11191
|
+
})
|
|
11192
|
+
})
|
|
11193
|
+
}), jsxs(Menu, {
|
|
11194
|
+
open: Boolean(anchorEl),
|
|
11195
|
+
onClose: function onClose() {
|
|
11196
|
+
return setAnchorEl(null);
|
|
11197
|
+
},
|
|
11198
|
+
anchorEl: anchorEl,
|
|
11199
|
+
slotProps: {
|
|
11200
|
+
backdrop: {
|
|
11201
|
+
style: {
|
|
11202
|
+
opacity: 0,
|
|
11203
|
+
transition: 'none'
|
|
11204
|
+
}
|
|
11205
|
+
}
|
|
11206
|
+
},
|
|
11207
|
+
sx: {
|
|
11208
|
+
padding: 3
|
|
11209
|
+
},
|
|
11210
|
+
children: [jsxs(DialogTitle, {
|
|
11211
|
+
id: "dialog-title",
|
|
11212
|
+
sx: {
|
|
11213
|
+
zIndex: 1,
|
|
11214
|
+
padding: '8px 18px 16px 24px',
|
|
11215
|
+
display: 'flex',
|
|
11216
|
+
justifyContent: 'space-between',
|
|
11217
|
+
alignItems: 'center'
|
|
11218
|
+
},
|
|
11219
|
+
children: [jsx(Typography, {
|
|
11220
|
+
sx: {
|
|
11221
|
+
fontSize: '20px',
|
|
11222
|
+
fontWeight: 500,
|
|
11223
|
+
paddingRight: 1
|
|
11224
|
+
},
|
|
11225
|
+
"data-testid": "customDialog-title",
|
|
11226
|
+
component: "span",
|
|
11227
|
+
children: t("filter-" + id)
|
|
11228
|
+
}), jsx(CustomIconButton, {
|
|
11229
|
+
"aria-label": t('close-dialog-confirm'),
|
|
11230
|
+
onClick: function onClick() {
|
|
11231
|
+
return setAnchorEl(null);
|
|
11232
|
+
},
|
|
11233
|
+
sx: {
|
|
11234
|
+
'&.MuiIconButton-root': {
|
|
11235
|
+
color: 'geowebColors.greys.accessible'
|
|
11236
|
+
}
|
|
11237
|
+
},
|
|
11238
|
+
children: jsx(Close, {})
|
|
11239
|
+
})]
|
|
11240
|
+
}), jsxs(DialogContent, {
|
|
11241
|
+
sx: {
|
|
11242
|
+
padding: '0px 24px 16px 24px'
|
|
11243
|
+
},
|
|
11244
|
+
children: [jsxs(Grid, {
|
|
11245
|
+
container: true,
|
|
11246
|
+
justifyContent: "space-between",
|
|
11247
|
+
alignItems: "center",
|
|
11248
|
+
children: [t('filter-select-all'), jsx(Switch, {
|
|
11249
|
+
slotProps: {
|
|
11250
|
+
input: {
|
|
11251
|
+
'aria-label': t('filter-select-all')
|
|
11252
|
+
}
|
|
11253
|
+
},
|
|
11254
|
+
checked: allSelected,
|
|
11255
|
+
onChange: function onChange() {
|
|
11256
|
+
return updateFilter(id, 'ALL', !allSelected);
|
|
10899
11257
|
},
|
|
10900
|
-
children: jsx(CustomTooltip, {
|
|
10901
|
-
title: objectHoverText,
|
|
10902
|
-
placement: "top",
|
|
10903
|
-
sx: {
|
|
10904
|
-
zIndex: 1000
|
|
10905
|
-
},
|
|
10906
|
-
children: jsx("span", {
|
|
10907
|
-
children: objectNameText
|
|
10908
|
-
})
|
|
10909
|
-
})
|
|
10910
|
-
})
|
|
10911
|
-
}), jsx(WarningListColumnContent, {
|
|
10912
|
-
title: t('warning-list-header-status'),
|
|
10913
|
-
status: status,
|
|
10914
|
-
width: 96,
|
|
10915
|
-
children: jsxs(Box, {
|
|
10916
11258
|
sx: {
|
|
10917
|
-
|
|
11259
|
+
marginRight: '-12px',
|
|
11260
|
+
marginTop: '-6px'
|
|
11261
|
+
}
|
|
11262
|
+
})]
|
|
11263
|
+
}), jsxs(Box, {
|
|
11264
|
+
children: [options[emptyFilterId] !== undefined && jsx(FilterOption, {
|
|
11265
|
+
optionId: emptyFilterId,
|
|
11266
|
+
checked: options[emptyFilterId],
|
|
11267
|
+
onClick: function onClick(checked, only) {
|
|
11268
|
+
return updateFilter(id, emptyFilterId, checked, only);
|
|
10918
11269
|
},
|
|
10919
|
-
|
|
10920
|
-
|
|
10921
|
-
|
|
10922
|
-
|
|
10923
|
-
|
|
10924
|
-
|
|
11270
|
+
labelStyle: {
|
|
11271
|
+
fontSize: '16px'
|
|
11272
|
+
},
|
|
11273
|
+
label: jsx(Fragment, {
|
|
11274
|
+
children: t(getTranslationKey(emptyFilterId, id))
|
|
11275
|
+
})
|
|
11276
|
+
}, id + "-" + emptyFilterId), Object.keys(options).map(function (optionId) {
|
|
11277
|
+
if (optionId === emptyFilterId) {
|
|
11278
|
+
return null;
|
|
11279
|
+
}
|
|
11280
|
+
var warningColor = warningColors[optionId];
|
|
11281
|
+
return jsx(FilterOption, {
|
|
11282
|
+
optionId: optionId,
|
|
11283
|
+
checked: options[optionId],
|
|
11284
|
+
onClick: function onClick(checked, only) {
|
|
11285
|
+
return updateFilter(id, optionId, checked, only);
|
|
10925
11286
|
},
|
|
10926
|
-
|
|
10927
|
-
|
|
10928
|
-
|
|
11287
|
+
labelStyle: Object.assign({}, getLevelStyle(warningColor), {
|
|
11288
|
+
width: LevelColors[optionId] ? 'fit-content' : '100%',
|
|
11289
|
+
fontSize: '16px'
|
|
11290
|
+
}),
|
|
11291
|
+
label: jsx(CustomTooltip, {
|
|
11292
|
+
title: t(getTranslationKey(optionId, id)),
|
|
11293
|
+
placement: "bottom",
|
|
11294
|
+
children: jsxs(Box, {
|
|
11295
|
+
"data-testid": "wrapper-" + optionId,
|
|
11296
|
+
sx: {
|
|
11297
|
+
display: 'flex',
|
|
11298
|
+
alignItems: 'center',
|
|
11299
|
+
gap: 1,
|
|
11300
|
+
maxWidth: 200
|
|
11301
|
+
},
|
|
11302
|
+
children: [getPhenomenaIcon(optionId), jsx(Typography, {
|
|
11303
|
+
noWrap: true,
|
|
11304
|
+
variant: "body2",
|
|
11305
|
+
sx: {
|
|
11306
|
+
fontSize: '16px'
|
|
11307
|
+
},
|
|
11308
|
+
children: t(getTranslationKey(optionId, id))
|
|
11309
|
+
})]
|
|
11310
|
+
})
|
|
10929
11311
|
})
|
|
10930
|
-
})
|
|
10931
|
-
})
|
|
11312
|
+
}, id + "-" + optionId);
|
|
11313
|
+
})]
|
|
10932
11314
|
})]
|
|
10933
|
-
})
|
|
10934
|
-
})
|
|
10935
|
-
})
|
|
11315
|
+
})]
|
|
11316
|
+
})]
|
|
11317
|
+
});
|
|
10936
11318
|
};
|
|
10937
11319
|
|
|
10938
|
-
var
|
|
10939
|
-
var
|
|
10940
|
-
var
|
|
10941
|
-
|
|
10942
|
-
_ref$isDefaultOpen = _ref.isDefaultOpen,
|
|
10943
|
-
isDefaultOpen = _ref$isDefaultOpen === void 0 ? false : _ref$isDefaultOpen;
|
|
11320
|
+
var TimeFilterChip = function TimeFilterChip(_ref) {
|
|
11321
|
+
var _getPickerValue;
|
|
11322
|
+
var timeFilter = _ref.timeFilter,
|
|
11323
|
+
onUpdateTimeFilter = _ref.onUpdateTimeFilter;
|
|
10944
11324
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
10945
11325
|
t = _useWarningsTranslati.t;
|
|
10946
|
-
var
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
|
|
10950
|
-
|
|
10951
|
-
|
|
10952
|
-
var
|
|
10953
|
-
|
|
10954
|
-
|
|
11326
|
+
var _useState = useState(null),
|
|
11327
|
+
anchorEl = _useState[0],
|
|
11328
|
+
setAnchorEl = _useState[1];
|
|
11329
|
+
var _useState2 = useState(),
|
|
11330
|
+
tempCustomStart = _useState2[0],
|
|
11331
|
+
setTempCustomStart = _useState2[1];
|
|
11332
|
+
var _useState3 = useState(),
|
|
11333
|
+
tempCustomEnd = _useState3[0],
|
|
11334
|
+
setTempCustomEnd = _useState3[1];
|
|
11335
|
+
var isSelected = timeFilter.mode !== TimeFilterMode.all;
|
|
11336
|
+
var pickerStartValue = tempCustomStart != null ? tempCustomStart : timeFilter.customStart;
|
|
11337
|
+
var pickerEndValue = tempCustomEnd != null ? tempCustomEnd : timeFilter.customEnd;
|
|
11338
|
+
var handleModeChange = function handleModeChange(mode) {
|
|
11339
|
+
if (mode === TimeFilterMode.custom) {
|
|
11340
|
+
var _timeFilter$customSta, _timeFilter$customEnd;
|
|
11341
|
+
setTempCustomStart((_timeFilter$customSta = timeFilter.customStart) != null ? _timeFilter$customSta : new Date(Date.now()).toISOString());
|
|
11342
|
+
setTempCustomEnd((_timeFilter$customEnd = timeFilter.customEnd) != null ? _timeFilter$customEnd : new Date(Date.now()).toISOString());
|
|
11343
|
+
}
|
|
11344
|
+
var newFilter = {
|
|
11345
|
+
mode: mode,
|
|
11346
|
+
customStart: mode === TimeFilterMode.custom ? timeFilter.customStart : undefined,
|
|
11347
|
+
customEnd: mode === TimeFilterMode.custom ? timeFilter.customEnd : undefined
|
|
11348
|
+
};
|
|
11349
|
+
onUpdateTimeFilter(newFilter);
|
|
10955
11350
|
};
|
|
10956
|
-
var
|
|
10957
|
-
|
|
11351
|
+
var handleTempTimeChange = function handleTempTimeChange(field, value) {
|
|
11352
|
+
var _dateUtils$setUTCDate;
|
|
11353
|
+
if (!value) {
|
|
11354
|
+
if (field === 'customStart') {
|
|
11355
|
+
setTempCustomStart(undefined);
|
|
11356
|
+
} else {
|
|
11357
|
+
setTempCustomEnd(undefined);
|
|
11358
|
+
}
|
|
11359
|
+
return;
|
|
11360
|
+
}
|
|
11361
|
+
var isoString = (_dateUtils$setUTCDate = dateUtils.setUTCDate(value)) == null ? void 0 : _dateUtils$setUTCDate.toISOString();
|
|
11362
|
+
if (field === 'customStart') {
|
|
11363
|
+
setTempCustomStart(isoString);
|
|
11364
|
+
} else {
|
|
11365
|
+
setTempCustomEnd(isoString);
|
|
11366
|
+
}
|
|
11367
|
+
};
|
|
11368
|
+
var getPickerValue = function getPickerValue(isoString) {
|
|
11369
|
+
if (!isoString) {
|
|
11370
|
+
return null;
|
|
11371
|
+
}
|
|
11372
|
+
var utc = new Date(isoString);
|
|
11373
|
+
return new Date(utc.getUTCFullYear(), utc.getUTCMonth(), utc.getUTCDate(), utc.getUTCHours(), utc.getUTCMinutes());
|
|
11374
|
+
};
|
|
11375
|
+
var handleApply = function handleApply() {
|
|
11376
|
+
onUpdateTimeFilter({
|
|
11377
|
+
mode: TimeFilterMode.custom,
|
|
11378
|
+
customStart: tempCustomStart,
|
|
11379
|
+
customEnd: tempCustomEnd
|
|
11380
|
+
});
|
|
10958
11381
|
setAnchorEl(null);
|
|
10959
11382
|
};
|
|
10960
|
-
var
|
|
10961
|
-
|
|
10962
|
-
|
|
11383
|
+
var getTimeFilterLabel = function getTimeFilterLabel(mode, t) {
|
|
11384
|
+
var baseLabel = t('filter-time');
|
|
11385
|
+
if (mode === TimeFilterMode.all) {
|
|
11386
|
+
return baseLabel;
|
|
11387
|
+
}
|
|
11388
|
+
if (mode === TimeFilterMode.custom) {
|
|
11389
|
+
if (!timeFilter.customStart || !timeFilter.customEnd) {
|
|
11390
|
+
return baseLabel + " (" + t('filter-time-custom') + ")";
|
|
11391
|
+
}
|
|
11392
|
+
var currentYear = new Date().getUTCFullYear();
|
|
11393
|
+
var startYear = dateUtils.getYear(timeFilter.customStart);
|
|
11394
|
+
var endYear = dateUtils.getYear(timeFilter.customEnd);
|
|
11395
|
+
var includeYear = startYear !== currentYear || endYear !== currentYear;
|
|
11396
|
+
var dateFormat = includeYear ? dateUtils.DATE_FORMAT_DATEPICKER : dateUtils.DATE_FORMAT_DATEPICKER_NO_YEAR;
|
|
11397
|
+
var start = dateUtils.dateToString(new Date(timeFilter.customStart), dateFormat);
|
|
11398
|
+
var end = dateUtils.dateToString(new Date(timeFilter.customEnd), dateFormat);
|
|
11399
|
+
return baseLabel + " (" + start + " - " + end + ")";
|
|
11400
|
+
}
|
|
11401
|
+
return baseLabel + " (" + t("filter-time-" + mode) + ")";
|
|
10963
11402
|
};
|
|
10964
|
-
var buttonId = 'newWarningButton';
|
|
10965
|
-
React__default.useEffect(function () {
|
|
10966
|
-
if (isDefaultOpen) {
|
|
10967
|
-
setAnchorEl(document.getElementById(buttonId));
|
|
10968
|
-
}
|
|
10969
|
-
}, [isDefaultOpen, buttonId]);
|
|
10970
11403
|
return jsxs(Fragment, {
|
|
10971
|
-
children: [
|
|
10972
|
-
|
|
10973
|
-
|
|
10974
|
-
|
|
10975
|
-
|
|
10976
|
-
|
|
10977
|
-
|
|
10978
|
-
|
|
10979
|
-
|
|
10980
|
-
|
|
10981
|
-
|
|
10982
|
-
|
|
10983
|
-
|
|
10984
|
-
|
|
10985
|
-
|
|
10986
|
-
|
|
10987
|
-
|
|
11404
|
+
children: [jsx(CustomTooltip, {
|
|
11405
|
+
title: t('filter-time'),
|
|
11406
|
+
placement: "bottom",
|
|
11407
|
+
children: jsx(Box, {
|
|
11408
|
+
children: jsx(FilterChip, {
|
|
11409
|
+
id: "time",
|
|
11410
|
+
label: jsxs(Box, {
|
|
11411
|
+
sx: {
|
|
11412
|
+
display: 'flex',
|
|
11413
|
+
alignItems: 'center',
|
|
11414
|
+
gap: 0.5
|
|
11415
|
+
},
|
|
11416
|
+
children: [jsx(Clock, {
|
|
11417
|
+
sx: {
|
|
11418
|
+
mr: 1
|
|
11419
|
+
}
|
|
11420
|
+
}), getTimeFilterLabel(timeFilter.mode, t)]
|
|
11421
|
+
}),
|
|
11422
|
+
isSelected: isSelected,
|
|
11423
|
+
onClick: function onClick(ref) {
|
|
11424
|
+
return setAnchorEl(ref);
|
|
11425
|
+
},
|
|
11426
|
+
size: "medium",
|
|
11427
|
+
actionIcon: jsx(Grid, {
|
|
11428
|
+
container: true,
|
|
11429
|
+
alignItems: "center",
|
|
11430
|
+
style: {
|
|
11431
|
+
marginRight: '8px',
|
|
11432
|
+
minWidth: '24px'
|
|
11433
|
+
},
|
|
11434
|
+
children: jsx(ChevronDown, {
|
|
11435
|
+
fontSize: "small",
|
|
11436
|
+
sx: {
|
|
11437
|
+
ml: 1
|
|
11438
|
+
}
|
|
11439
|
+
})
|
|
11440
|
+
}),
|
|
11441
|
+
onClickIcon: function onClickIcon(ref) {
|
|
11442
|
+
return setAnchorEl(ref);
|
|
11443
|
+
}
|
|
11444
|
+
})
|
|
11445
|
+
})
|
|
10988
11446
|
}), jsxs(Menu, {
|
|
10989
|
-
|
|
10990
|
-
|
|
10991
|
-
|
|
10992
|
-
if (reason === 'tabKeyDown') {
|
|
10993
|
-
return;
|
|
10994
|
-
}
|
|
10995
|
-
handleClose(event);
|
|
10996
|
-
},
|
|
10997
|
-
anchorOrigin: {
|
|
10998
|
-
vertical: 'bottom',
|
|
10999
|
-
horizontal: 'center'
|
|
11000
|
-
},
|
|
11001
|
-
transformOrigin: {
|
|
11002
|
-
vertical: 'top',
|
|
11003
|
-
horizontal: 'center'
|
|
11447
|
+
open: Boolean(anchorEl),
|
|
11448
|
+
onClose: function onClose() {
|
|
11449
|
+
return setAnchorEl(null);
|
|
11004
11450
|
},
|
|
11451
|
+
anchorEl: anchorEl,
|
|
11005
11452
|
slotProps: {
|
|
11006
|
-
|
|
11007
|
-
slotProps: {
|
|
11008
|
-
backdrop: {
|
|
11009
|
-
style: {
|
|
11010
|
-
opacity: 0,
|
|
11011
|
-
transition: 'none'
|
|
11012
|
-
}
|
|
11013
|
-
}
|
|
11014
|
-
}
|
|
11015
|
-
},
|
|
11016
|
-
list: {
|
|
11453
|
+
backdrop: {
|
|
11017
11454
|
style: {
|
|
11018
|
-
|
|
11455
|
+
opacity: 0,
|
|
11456
|
+
transition: 'none'
|
|
11019
11457
|
}
|
|
11020
11458
|
}
|
|
11021
11459
|
},
|
|
11022
|
-
|
|
11023
|
-
|
|
11024
|
-
|
|
11025
|
-
|
|
11026
|
-
|
|
11027
|
-
|
|
11028
|
-
|
|
11029
|
-
|
|
11030
|
-
|
|
11031
|
-
|
|
11460
|
+
sx: {
|
|
11461
|
+
padding: 3
|
|
11462
|
+
},
|
|
11463
|
+
children: [jsxs(DialogTitle, {
|
|
11464
|
+
id: "dialog-title",
|
|
11465
|
+
sx: {
|
|
11466
|
+
zIndex: 1,
|
|
11467
|
+
padding: '8px 18px 16px 24px',
|
|
11468
|
+
display: 'flex',
|
|
11469
|
+
justifyContent: 'space-between',
|
|
11470
|
+
alignItems: 'center'
|
|
11032
11471
|
},
|
|
11033
|
-
children: jsx(
|
|
11034
|
-
|
|
11035
|
-
|
|
11036
|
-
|
|
11037
|
-
|
|
11038
|
-
|
|
11472
|
+
children: [jsx(Typography, {
|
|
11473
|
+
sx: {
|
|
11474
|
+
fontSize: '20px',
|
|
11475
|
+
fontWeight: 500,
|
|
11476
|
+
paddingRight: 1
|
|
11477
|
+
},
|
|
11478
|
+
component: "span",
|
|
11479
|
+
children: t('filter-time')
|
|
11480
|
+
}), jsx(CustomIconButton, {
|
|
11481
|
+
"aria-label": t('close-dialog-confirm'),
|
|
11482
|
+
onClick: function onClick() {
|
|
11483
|
+
return setAnchorEl(null);
|
|
11484
|
+
},
|
|
11485
|
+
sx: {
|
|
11486
|
+
'&.MuiIconButton-root': {
|
|
11487
|
+
color: 'geowebColors.greys.accessible'
|
|
11488
|
+
}
|
|
11489
|
+
},
|
|
11490
|
+
children: jsx(Close, {})
|
|
11491
|
+
})]
|
|
11492
|
+
}), jsxs(DialogContent, {
|
|
11493
|
+
sx: {
|
|
11494
|
+
padding: '0px 24px 16px 24px'
|
|
11039
11495
|
},
|
|
11040
|
-
children:
|
|
11041
|
-
|
|
11042
|
-
|
|
11043
|
-
|
|
11044
|
-
children: [jsx(MenuItem, {
|
|
11045
|
-
onClick: function onClick(event) {
|
|
11046
|
-
onCreateNewWarning('maritimeWarningCoastal', event);
|
|
11496
|
+
children: [jsxs(RadioGroup, {
|
|
11497
|
+
value: timeFilter.mode,
|
|
11498
|
+
onChange: function onChange(e) {
|
|
11499
|
+
return handleModeChange(e.target.value);
|
|
11047
11500
|
},
|
|
11048
|
-
children: jsx(
|
|
11049
|
-
|
|
11050
|
-
|
|
11051
|
-
|
|
11052
|
-
|
|
11053
|
-
|
|
11501
|
+
children: [jsx(FormControlLabel, {
|
|
11502
|
+
value: TimeFilterMode.all,
|
|
11503
|
+
control: jsx(Radio, {}),
|
|
11504
|
+
label: t('filter-time-no-filter')
|
|
11505
|
+
}), jsx(FormControlLabel, {
|
|
11506
|
+
value: TimeFilterMode.today,
|
|
11507
|
+
control: jsx(Radio, {}),
|
|
11508
|
+
label: t('filter-time-today')
|
|
11509
|
+
}), jsx(FormControlLabel, {
|
|
11510
|
+
value: TimeFilterMode.tomorrow,
|
|
11511
|
+
control: jsx(Radio, {}),
|
|
11512
|
+
label: t('filter-time-tomorrow')
|
|
11513
|
+
}), jsx(FormControlLabel, {
|
|
11514
|
+
value: TimeFilterMode.custom,
|
|
11515
|
+
control: jsx(Radio, {}),
|
|
11516
|
+
label: t('filter-time-custom')
|
|
11517
|
+
})]
|
|
11518
|
+
}), timeFilter.mode === TimeFilterMode.custom && jsxs(Box, {
|
|
11519
|
+
sx: {
|
|
11520
|
+
mt: 2,
|
|
11521
|
+
display: 'flex',
|
|
11522
|
+
flexDirection: 'column',
|
|
11523
|
+
gap: 2
|
|
11054
11524
|
},
|
|
11055
|
-
children:
|
|
11056
|
-
|
|
11057
|
-
|
|
11058
|
-
|
|
11059
|
-
|
|
11525
|
+
children: [jsxs(LocalizationProvider, {
|
|
11526
|
+
dateAdapter: AdapterDateFns,
|
|
11527
|
+
children: [jsxs(Box, {
|
|
11528
|
+
sx: {
|
|
11529
|
+
display: 'flex',
|
|
11530
|
+
justifyContent: 'space-between',
|
|
11531
|
+
alignItems: 'center'
|
|
11532
|
+
},
|
|
11533
|
+
children: [jsx(Typography, {
|
|
11534
|
+
sx: {
|
|
11535
|
+
mr: 1
|
|
11536
|
+
},
|
|
11537
|
+
children: t('filter-start')
|
|
11538
|
+
}), jsx(DateTimePicker, {
|
|
11539
|
+
label: t('filter-choose-date-time'),
|
|
11540
|
+
ampm: false,
|
|
11541
|
+
value: (_getPickerValue = getPickerValue(pickerStartValue)) != null ? _getPickerValue : new Date(Date.now()),
|
|
11542
|
+
onChange: function onChange(value) {
|
|
11543
|
+
return handleTempTimeChange('customStart', value);
|
|
11544
|
+
},
|
|
11545
|
+
format: dateUtils.DATE_FORMAT_DATEPICKER,
|
|
11546
|
+
slotProps: {
|
|
11547
|
+
textField: {
|
|
11548
|
+
variant: 'filled',
|
|
11549
|
+
InputProps: {
|
|
11550
|
+
endAdornment: jsx(InputAdornment, {
|
|
11551
|
+
position: "end",
|
|
11552
|
+
children: "UTC"
|
|
11553
|
+
})
|
|
11554
|
+
}
|
|
11555
|
+
},
|
|
11556
|
+
field: {
|
|
11557
|
+
clearable: true,
|
|
11558
|
+
openPickerButtonPosition: 'start'
|
|
11559
|
+
}
|
|
11560
|
+
},
|
|
11561
|
+
timeSteps: {
|
|
11562
|
+
minutes: 1
|
|
11563
|
+
}
|
|
11564
|
+
})]
|
|
11565
|
+
}), jsxs(Box, {
|
|
11566
|
+
sx: {
|
|
11567
|
+
display: 'flex',
|
|
11568
|
+
justifyContent: 'space-between',
|
|
11569
|
+
alignItems: 'center'
|
|
11570
|
+
},
|
|
11571
|
+
children: [jsx(Typography, {
|
|
11572
|
+
sx: {
|
|
11573
|
+
mr: 1
|
|
11574
|
+
},
|
|
11575
|
+
children: t('filter-end')
|
|
11576
|
+
}), jsx(DateTimePicker, {
|
|
11577
|
+
label: t('filter-choose-date-time'),
|
|
11578
|
+
ampm: false,
|
|
11579
|
+
value: getPickerValue(pickerEndValue),
|
|
11580
|
+
onChange: function onChange(value) {
|
|
11581
|
+
return handleTempTimeChange('customEnd', value);
|
|
11582
|
+
},
|
|
11583
|
+
format: dateUtils.DATE_FORMAT_DATEPICKER,
|
|
11584
|
+
slotProps: {
|
|
11585
|
+
textField: {
|
|
11586
|
+
variant: 'filled',
|
|
11587
|
+
InputProps: {
|
|
11588
|
+
endAdornment: jsx(InputAdornment, {
|
|
11589
|
+
position: "end",
|
|
11590
|
+
children: "UTC"
|
|
11591
|
+
})
|
|
11592
|
+
}
|
|
11593
|
+
},
|
|
11594
|
+
field: {
|
|
11595
|
+
clearable: true,
|
|
11596
|
+
openPickerButtonPosition: 'start'
|
|
11597
|
+
}
|
|
11598
|
+
},
|
|
11599
|
+
timeSteps: {
|
|
11600
|
+
minutes: 1
|
|
11601
|
+
}
|
|
11602
|
+
})]
|
|
11603
|
+
})]
|
|
11604
|
+
}), jsx(Box, {
|
|
11605
|
+
sx: {
|
|
11606
|
+
display: 'flex',
|
|
11607
|
+
justifyContent: 'flex-end'
|
|
11608
|
+
},
|
|
11609
|
+
children: jsx(Button, {
|
|
11610
|
+
onClick: handleApply,
|
|
11611
|
+
sx: {
|
|
11612
|
+
textTransform: 'none',
|
|
11613
|
+
px: 6,
|
|
11614
|
+
py: 1,
|
|
11615
|
+
backgroundColor: 'geowebColors.buttons.tool.active.fill',
|
|
11616
|
+
color: 'white'
|
|
11617
|
+
},
|
|
11618
|
+
children: t('filter-time-apply')
|
|
11619
|
+
})
|
|
11620
|
+
})]
|
|
11621
|
+
})]
|
|
11622
|
+
})]
|
|
11623
|
+
})]
|
|
11624
|
+
});
|
|
11625
|
+
};
|
|
11626
|
+
|
|
11627
|
+
var filterOrder = ['source', 'domain', 'phenomenon', 'level'];
|
|
11628
|
+
var FilterList = function FilterList(_ref) {
|
|
11629
|
+
var _ref$onClickAll = _ref.onClickAll,
|
|
11630
|
+
onClickAll = _ref$onClickAll === void 0 ? function () {} : _ref$onClickAll,
|
|
11631
|
+
_ref$isAllSelected = _ref.isAllSelected,
|
|
11632
|
+
isAllSelected = _ref$isAllSelected === void 0 ? true : _ref$isAllSelected,
|
|
11633
|
+
filterState = _ref.filterState,
|
|
11634
|
+
updateFilter = _ref.updateFilter,
|
|
11635
|
+
timeFilter = _ref.timeFilter,
|
|
11636
|
+
onUpdateTimeFilter = _ref.onUpdateTimeFilter;
|
|
11637
|
+
var _useWarningsTranslati = useWarningsTranslation(),
|
|
11638
|
+
t = _useWarningsTranslati.t;
|
|
11639
|
+
return jsxs(Box, {
|
|
11640
|
+
sx: {
|
|
11641
|
+
display: 'flex',
|
|
11642
|
+
flexWrap: 'wrap',
|
|
11643
|
+
alignItems: 'center',
|
|
11644
|
+
gap: 1,
|
|
11645
|
+
pb: 4
|
|
11646
|
+
},
|
|
11647
|
+
children: [jsx(CustomTooltip, {
|
|
11648
|
+
title: isAllSelected ? t('filter-hide-all') : t('filter-show-all'),
|
|
11649
|
+
placement: "bottom",
|
|
11650
|
+
children: jsx("div", {
|
|
11651
|
+
children: jsx(FilterChip, {
|
|
11652
|
+
id: "all",
|
|
11653
|
+
label: t('filter-all'),
|
|
11654
|
+
isSelected: isAllSelected,
|
|
11655
|
+
handleClick: function handleClick() {
|
|
11656
|
+
return onClickAll(isAllSelected);
|
|
11657
|
+
},
|
|
11658
|
+
size: "medium"
|
|
11659
|
+
})
|
|
11660
|
+
})
|
|
11661
|
+
}), filterOrder.map(function (filterId) {
|
|
11662
|
+
return jsx(ExpandableFilterChip, {
|
|
11663
|
+
id: filterId,
|
|
11664
|
+
options: filterState[filterId],
|
|
11665
|
+
updateFilter: updateFilter
|
|
11666
|
+
}, filterId);
|
|
11667
|
+
}), jsx(Box, {
|
|
11668
|
+
sx: {
|
|
11669
|
+
marginLeft: 'auto'
|
|
11670
|
+
},
|
|
11671
|
+
children: jsx(TimeFilterChip, {
|
|
11672
|
+
timeFilter: timeFilter,
|
|
11673
|
+
onUpdateTimeFilter: onUpdateTimeFilter
|
|
11674
|
+
})
|
|
11060
11675
|
})]
|
|
11061
11676
|
});
|
|
11062
11677
|
};
|
|
@@ -11065,15 +11680,17 @@ var groupWarningsOnStatus = function groupWarningsOnStatus(warnings, sortState)
|
|
|
11065
11680
|
var key = sortState.key,
|
|
11066
11681
|
direction = sortState.direction;
|
|
11067
11682
|
var sortedWarnings = warnings.sort(function (warningA, warningB) {
|
|
11683
|
+
var _dateStringB$localeCo;
|
|
11068
11684
|
var dateStringA = key === 'lastUpdatedTime' ? warningA[key] : warningA.warningDetail[key];
|
|
11069
11685
|
var dateStringB = key === 'lastUpdatedTime' ? warningB[key] : warningB.warningDetail[key];
|
|
11070
|
-
return (dateStringB == null ? void 0 : dateStringB.localeCompare(dateStringA
|
|
11686
|
+
return (_dateStringB$localeCo = dateStringB == null ? void 0 : dateStringB.localeCompare(dateStringA != null ? dateStringA : '')) != null ? _dateStringB$localeCo : 0;
|
|
11071
11687
|
});
|
|
11072
11688
|
if (direction === 'asc') {
|
|
11073
11689
|
sortedWarnings.reverse();
|
|
11074
11690
|
}
|
|
11075
11691
|
var groupedWarnings = groupBy(sortedWarnings, function (warning) {
|
|
11076
|
-
var status
|
|
11692
|
+
var _warning$status;
|
|
11693
|
+
var status = (_warning$status = warning.status) != null ? _warning$status : mapProductStatusToWarningStatus(warning.productStatus);
|
|
11077
11694
|
switch (status) {
|
|
11078
11695
|
case PublicWarningStatus.DRAFT:
|
|
11079
11696
|
case PublicWarningStatus.DRAFT_PUBLISHED:
|
|
@@ -11097,7 +11714,7 @@ var groupWarningsOnStatus = function groupWarningsOnStatus(warnings, sortState)
|
|
|
11097
11714
|
}, groupedWarnings);
|
|
11098
11715
|
};
|
|
11099
11716
|
var PublicWarningList = function PublicWarningList(_ref) {
|
|
11100
|
-
var _sx, _sx2
|
|
11717
|
+
var _sx, _sx2;
|
|
11101
11718
|
var _ref$warnings = _ref.warnings,
|
|
11102
11719
|
warnings = _ref$warnings === void 0 ? [] : _ref$warnings,
|
|
11103
11720
|
filterHookState = _ref.filterHookState,
|
|
@@ -11132,7 +11749,9 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
11132
11749
|
setExpandedSections = _ref.setExpandedSections;
|
|
11133
11750
|
var updateFilter = filterHookState.updateFilter,
|
|
11134
11751
|
allSelected = filterHookState.allSelected,
|
|
11135
|
-
filterState = filterHookState.filterState
|
|
11752
|
+
filterState = filterHookState.filterState,
|
|
11753
|
+
timeFilter = filterHookState.timeFilter,
|
|
11754
|
+
updateTimeFilter = filterHookState.updateTimeFilter;
|
|
11136
11755
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
11137
11756
|
t = _useWarningsTranslati.t;
|
|
11138
11757
|
var _React$useState = React__default.useState({
|
|
@@ -11217,7 +11836,7 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
11217
11836
|
}
|
|
11218
11837
|
}, [hoveredFeatureId, items]);
|
|
11219
11838
|
return jsxs(Fragment, {
|
|
11220
|
-
children: [isLoading
|
|
11839
|
+
children: [isLoading ? jsx(LinearProgress, {
|
|
11221
11840
|
"data-testid": "loading-bar",
|
|
11222
11841
|
color: "secondary",
|
|
11223
11842
|
sx: {
|
|
@@ -11225,7 +11844,7 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
11225
11844
|
width: '100%',
|
|
11226
11845
|
top: 0
|
|
11227
11846
|
}
|
|
11228
|
-
}), jsxs(Box, {
|
|
11847
|
+
}) : null, jsxs(Box, {
|
|
11229
11848
|
sx: {
|
|
11230
11849
|
padding: 3,
|
|
11231
11850
|
height: '100%',
|
|
@@ -11236,67 +11855,50 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
11236
11855
|
"data-testid": "publicWarningList",
|
|
11237
11856
|
children: [jsxs(Box, {
|
|
11238
11857
|
ref: filterRef,
|
|
11239
|
-
sx:
|
|
11858
|
+
sx: {
|
|
11240
11859
|
display: 'flex',
|
|
11241
|
-
|
|
11242
|
-
|
|
11243
|
-
|
|
11244
|
-
|
|
11245
|
-
flexDirection: 'row',
|
|
11246
|
-
' .create-warning': {
|
|
11247
|
-
order: 2
|
|
11248
|
-
}
|
|
11249
|
-
}, _sx),
|
|
11250
|
-
children: [jsx(Box, {
|
|
11251
|
-
className: "warning-filter",
|
|
11860
|
+
flexDirection: 'column',
|
|
11861
|
+
gap: 2
|
|
11862
|
+
},
|
|
11863
|
+
children: [jsxs(Box, {
|
|
11252
11864
|
sx: {
|
|
11253
|
-
|
|
11254
|
-
|
|
11255
|
-
|
|
11256
|
-
alignSelf: 'flex-start'
|
|
11865
|
+
display: 'flex',
|
|
11866
|
+
justifyContent: 'flex-end',
|
|
11867
|
+
alignItems: 'center'
|
|
11257
11868
|
},
|
|
11869
|
+
children: [lastUpdatedTime ? jsx(LastUpdateTime, {
|
|
11870
|
+
onPressRefresh: onRefetchWarnings,
|
|
11871
|
+
lastUpdateTime: lastUpdatedTime
|
|
11872
|
+
}) : jsx(Box, {}), jsx(NewWarningButton, {
|
|
11873
|
+
onCreateWarning: onCreateWarning
|
|
11874
|
+
})]
|
|
11875
|
+
}), jsx(Box, {
|
|
11258
11876
|
children: jsx(FilterList, {
|
|
11259
11877
|
isAllSelected: allSelected,
|
|
11260
11878
|
onClickAll: onClickAll,
|
|
11261
11879
|
filterState: filterState,
|
|
11262
|
-
updateFilter: updateFilter
|
|
11880
|
+
updateFilter: updateFilter,
|
|
11881
|
+
timeFilter: timeFilter,
|
|
11882
|
+
onUpdateTimeFilter: updateTimeFilter
|
|
11263
11883
|
})
|
|
11264
|
-
}), jsxs(Box, {
|
|
11265
|
-
className: "create-warning",
|
|
11266
|
-
sx: {
|
|
11267
|
-
order: 1
|
|
11268
|
-
},
|
|
11269
|
-
children: [lastUpdatedTime && jsx(Box, {
|
|
11270
|
-
sx: {
|
|
11271
|
-
"float": 'left',
|
|
11272
|
-
minWidth: 140,
|
|
11273
|
-
paddingTop: 0.5
|
|
11274
|
-
},
|
|
11275
|
-
children: jsx(LastUpdateTime, {
|
|
11276
|
-
onPressRefresh: onRefetchWarnings,
|
|
11277
|
-
lastUpdateTime: lastUpdatedTime
|
|
11278
|
-
})
|
|
11279
|
-
}), jsx(NewWarningButton, {
|
|
11280
|
-
onCreateWarning: onCreateWarning
|
|
11281
|
-
})]
|
|
11282
11884
|
})]
|
|
11283
|
-
}), error
|
|
11885
|
+
}), error ? jsx(AlertBanner, {
|
|
11284
11886
|
title: error.message,
|
|
11285
11887
|
shouldClose: true
|
|
11286
|
-
}), !error && jsxs(Grid, {
|
|
11888
|
+
}) : null, !error && jsxs(Grid, {
|
|
11287
11889
|
container: true,
|
|
11288
11890
|
rowSpacing: 0,
|
|
11289
11891
|
columnSpacing: 0,
|
|
11290
11892
|
alignItems: "center",
|
|
11291
11893
|
justifyContent: "space-between",
|
|
11292
11894
|
size: "grow",
|
|
11293
|
-
sx: (
|
|
11895
|
+
sx: (_sx = {
|
|
11294
11896
|
maxWidth: '100%',
|
|
11295
11897
|
display: 'none',
|
|
11296
11898
|
marginTop: '4px'
|
|
11297
|
-
},
|
|
11899
|
+
}, _sx["@container publicWarningList (min-width: " + breakpoints.desktop + "px)"] = {
|
|
11298
11900
|
display: 'flex'
|
|
11299
|
-
},
|
|
11901
|
+
}, _sx),
|
|
11300
11902
|
children: [jsx(WarningListHeaderContent, {
|
|
11301
11903
|
title: t('warning-list-header-incidents'),
|
|
11302
11904
|
sx: {
|
|
@@ -11336,9 +11938,9 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
11336
11938
|
width: 140
|
|
11337
11939
|
}), jsx(WarningListHeaderContent, {
|
|
11338
11940
|
title: t('warning-list-header-levels'),
|
|
11339
|
-
sx: (
|
|
11941
|
+
sx: (_sx2 = {}, _sx2["@container publicWarningList (min-width: " + breakpoints.desktop + "px)"] = {
|
|
11340
11942
|
width: 56
|
|
11341
|
-
},
|
|
11943
|
+
}, _sx2)
|
|
11342
11944
|
}), jsx(WarningListHeaderContent, {
|
|
11343
11945
|
title: t('areas'),
|
|
11344
11946
|
width: 100
|
|
@@ -11349,7 +11951,7 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
11349
11951
|
marginRight: '48px'
|
|
11350
11952
|
}
|
|
11351
11953
|
})]
|
|
11352
|
-
}), sortedWarnings && !error
|
|
11954
|
+
}), sortedWarnings && !error ? jsx(Box, {
|
|
11353
11955
|
"data-testid": "warnings-list",
|
|
11354
11956
|
sx: {
|
|
11355
11957
|
height: "calc(100% - " + filterHeight + "px)",
|
|
@@ -11378,6 +11980,7 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
11378
11980
|
if (warning.totalWarnings !== undefined) {
|
|
11379
11981
|
var header = warning;
|
|
11380
11982
|
return jsx(WarningListItemSeperator, {
|
|
11983
|
+
timeFilter: timeFilter,
|
|
11381
11984
|
status: header.status,
|
|
11382
11985
|
totalWarnings: header.totalWarnings,
|
|
11383
11986
|
style: style,
|
|
@@ -11407,11 +12010,86 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
11407
12010
|
});
|
|
11408
12011
|
}
|
|
11409
12012
|
})
|
|
11410
|
-
})]
|
|
12013
|
+
}) : null]
|
|
11411
12014
|
})]
|
|
11412
12015
|
});
|
|
11413
12016
|
};
|
|
11414
12017
|
|
|
12018
|
+
var ConfirmDeleteWarningDialog = function ConfirmDeleteWarningDialog(_ref) {
|
|
12019
|
+
var _ref$onClose = _ref.onClose,
|
|
12020
|
+
onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
|
|
12021
|
+
title = _ref.title,
|
|
12022
|
+
description = _ref.description,
|
|
12023
|
+
request = _ref.request,
|
|
12024
|
+
confirmLabel = _ref.confirmLabel,
|
|
12025
|
+
callback = _ref.callback,
|
|
12026
|
+
isLocked = _ref.isLocked;
|
|
12027
|
+
var _useWarningsTranslati = useWarningsTranslation(),
|
|
12028
|
+
t = _useWarningsTranslati.t;
|
|
12029
|
+
var defaultError = isLocked ? t('warning-dialog-delete-islocked') : undefined;
|
|
12030
|
+
var _React$useState = React__default.useState(false),
|
|
12031
|
+
isLoading = _React$useState[0],
|
|
12032
|
+
setIsLoading = _React$useState[1];
|
|
12033
|
+
var _React$useState2 = React__default.useState(defaultError),
|
|
12034
|
+
error = _React$useState2[0],
|
|
12035
|
+
setError = _React$useState2[1];
|
|
12036
|
+
var onSubmit = /*#__PURE__*/function () {
|
|
12037
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
12038
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
12039
|
+
while (1) switch (_context.prev = _context.next) {
|
|
12040
|
+
case 0:
|
|
12041
|
+
setIsLoading(true);
|
|
12042
|
+
_context.prev = 1;
|
|
12043
|
+
_context.next = 4;
|
|
12044
|
+
return request();
|
|
12045
|
+
case 4:
|
|
12046
|
+
callback && callback();
|
|
12047
|
+
setIsLoading(false);
|
|
12048
|
+
_context.next = 12;
|
|
12049
|
+
break;
|
|
12050
|
+
case 8:
|
|
12051
|
+
_context.prev = 8;
|
|
12052
|
+
_context.t0 = _context["catch"](1);
|
|
12053
|
+
setError(getAxiosErrorMessage(_context.t0));
|
|
12054
|
+
setIsLoading(false);
|
|
12055
|
+
case 12:
|
|
12056
|
+
case "end":
|
|
12057
|
+
return _context.stop();
|
|
12058
|
+
}
|
|
12059
|
+
}, _callee, null, [[1, 8]]);
|
|
12060
|
+
}));
|
|
12061
|
+
return function onSubmit() {
|
|
12062
|
+
return _ref2.apply(this, arguments);
|
|
12063
|
+
};
|
|
12064
|
+
}();
|
|
12065
|
+
return jsx(ConfirmationDialog, Object.assign({
|
|
12066
|
+
title: title,
|
|
12067
|
+
open: true,
|
|
12068
|
+
confirmLabel: confirmLabel,
|
|
12069
|
+
cancelLabel: t('warning-dialog-cancel'),
|
|
12070
|
+
description: !error ? description : '',
|
|
12071
|
+
onClose: onClose,
|
|
12072
|
+
onSubmit: onSubmit,
|
|
12073
|
+
isLoading: isLoading
|
|
12074
|
+
}, error && {
|
|
12075
|
+
content: jsxs(Box, {
|
|
12076
|
+
sx: {
|
|
12077
|
+
marginBottom: 0
|
|
12078
|
+
},
|
|
12079
|
+
children: [jsx(AlertBanner, {
|
|
12080
|
+
title: error,
|
|
12081
|
+
severity: isLocked ? 'warning' : 'error'
|
|
12082
|
+
}), jsx(Typography, {
|
|
12083
|
+
variant: "body1",
|
|
12084
|
+
sx: {
|
|
12085
|
+
marginTop: 1
|
|
12086
|
+
},
|
|
12087
|
+
children: description
|
|
12088
|
+
})]
|
|
12089
|
+
})
|
|
12090
|
+
}));
|
|
12091
|
+
};
|
|
12092
|
+
|
|
11415
12093
|
/* *
|
|
11416
12094
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11417
12095
|
* you may not use this file except in compliance with the License.
|
|
@@ -11527,7 +12205,8 @@ var useWarningFilters = function useWarningFilters(warnings, onUpdateFilters, sa
|
|
|
11527
12205
|
var savedDomainFilter = savedFilterState.domain,
|
|
11528
12206
|
savedPhenomenonFilter = savedFilterState.phenomenon,
|
|
11529
12207
|
savedLevelFilter = savedFilterState.level,
|
|
11530
|
-
savedSourceFilter = savedFilterState.source
|
|
12208
|
+
savedSourceFilter = savedFilterState.source,
|
|
12209
|
+
savedTimeFilter = savedFilterState.time;
|
|
11531
12210
|
/** Levels for selected domain(s) */
|
|
11532
12211
|
var relevantLevels = useMemo(function () {
|
|
11533
12212
|
return getLevelsForDomainFilter(savedDomainFilter);
|
|
@@ -11558,7 +12237,7 @@ var useWarningFilters = function useWarningFilters(warnings, onUpdateFilters, sa
|
|
|
11558
12237
|
var defaultSourceFilter = useMemo(function () {
|
|
11559
12238
|
return Object.fromEntries(relevantSources.map(function (key) {
|
|
11560
12239
|
var presetValue = presetFilterState == null ? void 0 : presetFilterState.source[key];
|
|
11561
|
-
return [key, presetValue
|
|
12240
|
+
return [key, presetValue != null ? presetValue : true];
|
|
11562
12241
|
}));
|
|
11563
12242
|
},
|
|
11564
12243
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -11572,11 +12251,13 @@ var useWarningFilters = function useWarningFilters(warnings, onUpdateFilters, sa
|
|
|
11572
12251
|
};
|
|
11573
12252
|
}, [defaultSourceFilter]);
|
|
11574
12253
|
var initialFiltersWithPresets = useMemo(function () {
|
|
12254
|
+
var _presetFilterState$ti;
|
|
11575
12255
|
return {
|
|
11576
12256
|
source: defaultSourceFilter || defaultEmptyFilter,
|
|
11577
12257
|
domain: Object.assign({}, initialFilters.domain, presetFilterState == null ? void 0 : presetFilterState.domain),
|
|
11578
12258
|
phenomenon: Object.assign({}, initialFilters.phenomenon, presetFilterState == null ? void 0 : presetFilterState.phenomenon),
|
|
11579
|
-
level: Object.assign({}, initialFilters.level, presetFilterState == null ? void 0 : presetFilterState.level)
|
|
12259
|
+
level: Object.assign({}, initialFilters.level, presetFilterState == null ? void 0 : presetFilterState.level),
|
|
12260
|
+
time: (_presetFilterState$ti = presetFilterState == null ? void 0 : presetFilterState.time) != null ? _presetFilterState$ti : defaultTimeFilter
|
|
11580
12261
|
};
|
|
11581
12262
|
},
|
|
11582
12263
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -11626,7 +12307,16 @@ var useWarningFilters = function useWarningFilters(warnings, onUpdateFilters, sa
|
|
|
11626
12307
|
});
|
|
11627
12308
|
}
|
|
11628
12309
|
};
|
|
12310
|
+
var updateTimeFilter = useCallback(function (timeFilter) {
|
|
12311
|
+
onUpdateFilters({
|
|
12312
|
+
time: timeFilter
|
|
12313
|
+
});
|
|
12314
|
+
}, [onUpdateFilters]);
|
|
11629
12315
|
var byFilterState = useCallback(function (warning) {
|
|
12316
|
+
var _relevantSources$find;
|
|
12317
|
+
if (!isWarningWithinInterval(warning, savedTimeFilter)) {
|
|
12318
|
+
return false;
|
|
12319
|
+
}
|
|
11630
12320
|
var levelDomain = function () {
|
|
11631
12321
|
if (['SIG', 'AIR'].includes(warning.warningDetail.level)) {
|
|
11632
12322
|
return Domain.aviation;
|
|
@@ -11647,100 +12337,256 @@ var useWarningFilters = function useWarningFilters(warnings, onUpdateFilters, sa
|
|
|
11647
12337
|
if (!pickedPhenomenaFilter[phenomenon]) {
|
|
11648
12338
|
return false;
|
|
11649
12339
|
}
|
|
11650
|
-
var source = relevantSources.find(function (source) {
|
|
12340
|
+
var source = (_relevantSources$find = relevantSources.find(function (source) {
|
|
11651
12341
|
return source === warning.warningDetail.warningProposalSource;
|
|
11652
|
-
})
|
|
12342
|
+
})) != null ? _relevantSources$find : emptyFilterId;
|
|
11653
12343
|
if (!savedSourceFilter[source]) {
|
|
11654
12344
|
return false;
|
|
11655
12345
|
}
|
|
11656
12346
|
return true;
|
|
11657
|
-
}, [savedDomainFilter, pickedLevelFilter, pickedPhenomenaFilter, relevantSources, savedSourceFilter]);
|
|
12347
|
+
}, [savedDomainFilter, pickedLevelFilter, pickedPhenomenaFilter, relevantSources, savedSourceFilter, savedTimeFilter]);
|
|
11658
12348
|
return {
|
|
11659
12349
|
allSelected: allSelected,
|
|
11660
12350
|
updateFilter: updateFilter,
|
|
12351
|
+
updateTimeFilter: updateTimeFilter,
|
|
11661
12352
|
byFilterState: byFilterState,
|
|
11662
12353
|
filterState: {
|
|
11663
12354
|
domain: savedDomainFilter,
|
|
11664
12355
|
level: pickedLevelFilter,
|
|
11665
12356
|
phenomenon: pickedPhenomenaFilter,
|
|
11666
|
-
source: savedSourceFilter
|
|
12357
|
+
source: savedSourceFilter,
|
|
12358
|
+
time: savedTimeFilter
|
|
12359
|
+
},
|
|
12360
|
+
timeFilter: savedTimeFilter
|
|
12361
|
+
};
|
|
12362
|
+
};
|
|
12363
|
+
|
|
12364
|
+
var CancelAviationDialogContent = function CancelAviationDialogContent(_ref) {
|
|
12365
|
+
var _cancelQuery$data$dat, _cancelQuery$data, _currentQuery$data$da, _currentQuery$data, _t;
|
|
12366
|
+
var product = _ref.product,
|
|
12367
|
+
warningType = _ref.warningType,
|
|
12368
|
+
errorMessage = _ref.errorMessage;
|
|
12369
|
+
var _useWarningsTranslati = useWarningsTranslation(),
|
|
12370
|
+
t = _useWarningsTranslati.t;
|
|
12371
|
+
var isSigmet = warningType === 'sigmet';
|
|
12372
|
+
var enabled = !!(product != null && product.uuid);
|
|
12373
|
+
// Only run the two queries we actually need
|
|
12374
|
+
var sigCancel = useFetchSigmetCancelTAC(product, isSigmet && enabled);
|
|
12375
|
+
var airCancel = useFetchAirmetCancelTAC(product, !isSigmet && enabled);
|
|
12376
|
+
var sigCurrent = useFetchSigmetTAC(product, isSigmet && enabled);
|
|
12377
|
+
var airCurrent = useFetchAirmetTAC(product, !isSigmet && enabled);
|
|
12378
|
+
// Pick active queries per warning type
|
|
12379
|
+
var cancelQuery = isSigmet ? sigCancel : airCancel;
|
|
12380
|
+
var currentQuery = isSigmet ? sigCurrent : airCurrent;
|
|
12381
|
+
// Derived TAC strings
|
|
12382
|
+
var cancelTAC = (_cancelQuery$data$dat = (_cancelQuery$data = cancelQuery.data) == null ? void 0 : _cancelQuery$data.data) != null ? _cancelQuery$data$dat : null;
|
|
12383
|
+
var currentTAC = (_currentQuery$data$da = (_currentQuery$data = currentQuery.data) == null ? void 0 : _currentQuery$data.data) != null ? _currentQuery$data$da : null;
|
|
12384
|
+
// Per-section loading/error
|
|
12385
|
+
var isLoadingCancel = cancelQuery.isLoading || !enabled;
|
|
12386
|
+
var isLoadingCurrent = currentQuery.isLoading || !enabled;
|
|
12387
|
+
var isErrorCancel = !!cancelQuery.error;
|
|
12388
|
+
var isErrorCurrent = !!currentQuery.error;
|
|
12389
|
+
var loadingLabel = (_t = t('loading')) != null ? _t : 'Loading...';
|
|
12390
|
+
var noTacLabel = t('tac-missing-data');
|
|
12391
|
+
var COLLAPSED = 90; // px
|
|
12392
|
+
var tacBlockStyle = {
|
|
12393
|
+
whiteSpace: 'pre-wrap',
|
|
12394
|
+
wordBreak: 'break-word',
|
|
12395
|
+
overflowX: 'auto',
|
|
12396
|
+
overflowY: 'auto',
|
|
12397
|
+
maxWidth: '100%',
|
|
12398
|
+
fontFamily: 'monospace',
|
|
12399
|
+
fontSize: '0.9rem',
|
|
12400
|
+
lineHeight: 1.4
|
|
12401
|
+
};
|
|
12402
|
+
var renderPre = function renderPre(text) {
|
|
12403
|
+
return jsx(Box, {
|
|
12404
|
+
component: "pre",
|
|
12405
|
+
sx: tacBlockStyle,
|
|
12406
|
+
children: text
|
|
12407
|
+
});
|
|
12408
|
+
};
|
|
12409
|
+
var renderTacWithSequence = function renderTacWithSequence(tac, noTacKey, prod) {
|
|
12410
|
+
if (!tac) {
|
|
12411
|
+
return jsx(Box, {
|
|
12412
|
+
component: "pre",
|
|
12413
|
+
sx: tacBlockStyle,
|
|
12414
|
+
children: t(noTacKey)
|
|
12415
|
+
});
|
|
11667
12416
|
}
|
|
12417
|
+
var noTac = t(noTacKey);
|
|
12418
|
+
var hasTac = tac.split('\n').length > 0 && tac !== noTac;
|
|
12419
|
+
var sequenceNumberInTac = findSequenceNumber(tac, noTac);
|
|
12420
|
+
var sequenceStyle = getSequenceStyling(prod, hasTac);
|
|
12421
|
+
var words = tac.split(' ');
|
|
12422
|
+
return jsx(Box, {
|
|
12423
|
+
component: "pre",
|
|
12424
|
+
sx: tacBlockStyle,
|
|
12425
|
+
children: words.map(function (word, i) {
|
|
12426
|
+
return jsx(Box, {
|
|
12427
|
+
component: "span",
|
|
12428
|
+
sx: hasTac && word === sequenceNumberInTac ? sequenceStyle : {},
|
|
12429
|
+
children: word + (i < words.length - 1 ? ' ' : '')
|
|
12430
|
+
}, word + "-" + i);
|
|
12431
|
+
})
|
|
12432
|
+
});
|
|
11668
12433
|
};
|
|
12434
|
+
var cancelContent;
|
|
12435
|
+
if (isLoadingCancel) {
|
|
12436
|
+
cancelContent = renderPre(loadingLabel);
|
|
12437
|
+
} else if (isErrorCancel) {
|
|
12438
|
+
cancelContent = renderPre(noTacLabel);
|
|
12439
|
+
} else {
|
|
12440
|
+
cancelContent = renderTacWithSequence(cancelTAC, 'tac-missing-data');
|
|
12441
|
+
}
|
|
12442
|
+
var currentContent;
|
|
12443
|
+
if (isLoadingCurrent) {
|
|
12444
|
+
currentContent = renderPre(loadingLabel);
|
|
12445
|
+
} else if (isErrorCurrent) {
|
|
12446
|
+
currentContent = renderPre(noTacLabel);
|
|
12447
|
+
} else {
|
|
12448
|
+
currentContent = jsx(Box, {
|
|
12449
|
+
component: "pre",
|
|
12450
|
+
sx: tacBlockStyle,
|
|
12451
|
+
children: currentTAC != null ? currentTAC : noTacLabel
|
|
12452
|
+
});
|
|
12453
|
+
}
|
|
12454
|
+
return jsxs(Box, {
|
|
12455
|
+
sx: {
|
|
12456
|
+
width: 500,
|
|
12457
|
+
maxWidth: 600
|
|
12458
|
+
},
|
|
12459
|
+
children: [jsx(Typography, {
|
|
12460
|
+
fontWeight: "medium",
|
|
12461
|
+
variant: "inherit",
|
|
12462
|
+
children: t('cancel-message')
|
|
12463
|
+
}), jsx("div", {
|
|
12464
|
+
style: {
|
|
12465
|
+
display: 'flex',
|
|
12466
|
+
paddingLeft: 12
|
|
12467
|
+
},
|
|
12468
|
+
children: jsx(Collapse, {
|
|
12469
|
+
collapsedSize: COLLAPSED,
|
|
12470
|
+
easing: "ease",
|
|
12471
|
+
"in": true,
|
|
12472
|
+
timeout: 200,
|
|
12473
|
+
children: cancelContent
|
|
12474
|
+
})
|
|
12475
|
+
}), jsx(Typography, {
|
|
12476
|
+
fontWeight: "medium",
|
|
12477
|
+
variant: "inherit",
|
|
12478
|
+
children: t('will-cancel-message')
|
|
12479
|
+
}), jsx("div", {
|
|
12480
|
+
style: {
|
|
12481
|
+
display: 'flex',
|
|
12482
|
+
paddingLeft: 12
|
|
12483
|
+
},
|
|
12484
|
+
children: jsx(Collapse, {
|
|
12485
|
+
collapsedSize: COLLAPSED,
|
|
12486
|
+
easing: "ease",
|
|
12487
|
+
"in": true,
|
|
12488
|
+
timeout: 200,
|
|
12489
|
+
children: currentContent
|
|
12490
|
+
})
|
|
12491
|
+
}), errorMessage ? jsx(Box, {
|
|
12492
|
+
sx: {
|
|
12493
|
+
marginBottom: 2
|
|
12494
|
+
},
|
|
12495
|
+
children: jsx(AlertBanner, {
|
|
12496
|
+
title: errorMessage,
|
|
12497
|
+
shouldClose: true
|
|
12498
|
+
})
|
|
12499
|
+
}) : null]
|
|
12500
|
+
});
|
|
11669
12501
|
};
|
|
11670
12502
|
|
|
11671
|
-
var
|
|
11672
|
-
var
|
|
11673
|
-
|
|
11674
|
-
|
|
11675
|
-
|
|
11676
|
-
|
|
12503
|
+
var CancelAviationConfirmDialog = function CancelAviationConfirmDialog(_ref) {
|
|
12504
|
+
var open = _ref.open,
|
|
12505
|
+
type = _ref.type,
|
|
12506
|
+
product = _ref.product,
|
|
12507
|
+
showVA = _ref.showVA,
|
|
12508
|
+
aviationConfig = _ref.aviationConfig,
|
|
12509
|
+
sigmet = _ref.sigmet,
|
|
11677
12510
|
confirmLabel = _ref.confirmLabel,
|
|
11678
|
-
|
|
11679
|
-
|
|
11680
|
-
|
|
11681
|
-
|
|
11682
|
-
var
|
|
11683
|
-
|
|
11684
|
-
|
|
11685
|
-
|
|
11686
|
-
|
|
11687
|
-
|
|
11688
|
-
|
|
11689
|
-
|
|
12511
|
+
title = _ref.title,
|
|
12512
|
+
onClose = _ref.onClose,
|
|
12513
|
+
cancelAviationProduct = _ref.cancelAviationProduct,
|
|
12514
|
+
onSuccess = _ref.onSuccess;
|
|
12515
|
+
var _React$useState = React__default.useState(null),
|
|
12516
|
+
errorMsg = _React$useState[0],
|
|
12517
|
+
setErrorMsg = _React$useState[1];
|
|
12518
|
+
var _React$useState2 = React__default.useState(false),
|
|
12519
|
+
isSubmitting = _React$useState2[0],
|
|
12520
|
+
setIsSubmitting = _React$useState2[1];
|
|
12521
|
+
var vaForm = useForm({
|
|
12522
|
+
mode: 'onChange',
|
|
12523
|
+
defaultValues: {}
|
|
12524
|
+
});
|
|
12525
|
+
var handleSubmit = /*#__PURE__*/function () {
|
|
11690
12526
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
11691
12527
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
11692
12528
|
while (1) switch (_context.prev = _context.next) {
|
|
11693
12529
|
case 0:
|
|
11694
|
-
|
|
11695
|
-
|
|
11696
|
-
_context.
|
|
11697
|
-
|
|
11698
|
-
|
|
11699
|
-
|
|
11700
|
-
|
|
11701
|
-
|
|
12530
|
+
setIsSubmitting(true);
|
|
12531
|
+
setErrorMsg(null);
|
|
12532
|
+
_context.prev = 2;
|
|
12533
|
+
_context.next = 5;
|
|
12534
|
+
return cancelAviationProduct(product, type);
|
|
12535
|
+
case 5:
|
|
12536
|
+
setIsSubmitting(false);
|
|
12537
|
+
onSuccess == null || onSuccess();
|
|
12538
|
+
onClose();
|
|
12539
|
+
_context.next = 14;
|
|
11702
12540
|
break;
|
|
11703
|
-
case
|
|
11704
|
-
_context.prev =
|
|
11705
|
-
_context.t0 = _context["catch"](
|
|
11706
|
-
|
|
11707
|
-
|
|
11708
|
-
case
|
|
12541
|
+
case 10:
|
|
12542
|
+
_context.prev = 10;
|
|
12543
|
+
_context.t0 = _context["catch"](2);
|
|
12544
|
+
setIsSubmitting(false);
|
|
12545
|
+
setErrorMsg("Failed to cancel " + type.toUpperCase() + ": " + humanizeApiErrorMessage(_context.t0));
|
|
12546
|
+
case 14:
|
|
11709
12547
|
case "end":
|
|
11710
12548
|
return _context.stop();
|
|
11711
12549
|
}
|
|
11712
|
-
}, _callee, null, [[
|
|
12550
|
+
}, _callee, null, [[2, 10]]);
|
|
11713
12551
|
}));
|
|
11714
|
-
return function
|
|
12552
|
+
return function handleSubmit() {
|
|
11715
12553
|
return _ref2.apply(this, arguments);
|
|
11716
12554
|
};
|
|
11717
12555
|
}();
|
|
11718
|
-
return
|
|
12556
|
+
return jsxs(CustomDialog, {
|
|
12557
|
+
"data-testid": "cancel-aviation-dialog",
|
|
11719
12558
|
title: title,
|
|
11720
|
-
|
|
11721
|
-
|
|
11722
|
-
cancelLabel: t('warning-dialog-cancel'),
|
|
11723
|
-
description: !error ? description : '',
|
|
12559
|
+
description: "",
|
|
12560
|
+
open: open,
|
|
11724
12561
|
onClose: onClose,
|
|
11725
|
-
|
|
11726
|
-
|
|
11727
|
-
|
|
11728
|
-
|
|
11729
|
-
|
|
11730
|
-
|
|
11731
|
-
|
|
11732
|
-
|
|
11733
|
-
|
|
11734
|
-
|
|
11735
|
-
|
|
11736
|
-
|
|
12562
|
+
isResizable: true,
|
|
12563
|
+
resizableDefaultSize: {
|
|
12564
|
+
width: 560,
|
|
12565
|
+
height: 'auto'
|
|
12566
|
+
},
|
|
12567
|
+
actions: jsx(ConfirmationButtons, {
|
|
12568
|
+
confirmLabel: confirmLabel,
|
|
12569
|
+
cancelLabel: "Close",
|
|
12570
|
+
isLoading: isSubmitting,
|
|
12571
|
+
onSubmit: handleSubmit,
|
|
12572
|
+
onClose: onClose
|
|
12573
|
+
}),
|
|
12574
|
+
children: [jsx(CancelAviationDialogContent, {
|
|
12575
|
+
product: product,
|
|
12576
|
+
warningType: type,
|
|
12577
|
+
errorMessage: errorMsg != null ? errorMsg : undefined
|
|
12578
|
+
}), showVA ? jsxs(FormProvider, Object.assign({}, vaForm, {
|
|
12579
|
+
children: [jsx(Box, {
|
|
12580
|
+
component: "hr",
|
|
11737
12581
|
sx: {
|
|
11738
|
-
|
|
11739
|
-
}
|
|
11740
|
-
|
|
12582
|
+
my: 1
|
|
12583
|
+
}
|
|
12584
|
+
}), jsx(CancelSigmetVolcanicMovements, {
|
|
12585
|
+
productConfig: aviationConfig,
|
|
12586
|
+
sigmet: sigmet
|
|
11741
12587
|
})]
|
|
11742
|
-
})
|
|
11743
|
-
})
|
|
12588
|
+
})) : null]
|
|
12589
|
+
});
|
|
11744
12590
|
};
|
|
11745
12591
|
|
|
11746
12592
|
var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
@@ -11759,8 +12605,12 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
11759
12605
|
var dispatch = useDispatch();
|
|
11760
12606
|
var confirmDialog = useConfirmationDialog();
|
|
11761
12607
|
var _useAuthenticationCon = useAuthenticationContext$1(),
|
|
11762
|
-
auth = _useAuthenticationCon.auth
|
|
11763
|
-
|
|
12608
|
+
auth = _useAuthenticationCon.auth,
|
|
12609
|
+
isLoggedIn = _useAuthenticationCon.isLoggedIn;
|
|
12610
|
+
var savedFilterState = useSelector(function (store) {
|
|
12611
|
+
return getWarningsFilterById(store, panelId);
|
|
12612
|
+
});
|
|
12613
|
+
var _useWarnings = useWarnings(false, savedFilterState.time),
|
|
11764
12614
|
combinedWarnings = _useWarnings.combinedWarnings,
|
|
11765
12615
|
refetchWarnings = _useWarnings.refetchWarnings,
|
|
11766
12616
|
isFetching = _useWarnings.isFetching,
|
|
@@ -11772,9 +12622,6 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
11772
12622
|
confirmDialogOptions = _React$useState[0],
|
|
11773
12623
|
setConfirmDialogOptions = _React$useState[1];
|
|
11774
12624
|
var selectedWarningId = useSelector(getSelectedWarningId);
|
|
11775
|
-
var savedFilterState = useSelector(function (store) {
|
|
11776
|
-
return getWarningsFilterById(store, panelId);
|
|
11777
|
-
});
|
|
11778
12625
|
var isFormDirty = useSelector(getSelectedPublicIsFormDirty);
|
|
11779
12626
|
var openPublicWarningDialog = /*#__PURE__*/function () {
|
|
11780
12627
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(formAction, warning, warningType) {
|
|
@@ -11868,14 +12715,28 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
11868
12715
|
confirmLabel: t('warning-dialog-expire-confirm'),
|
|
11869
12716
|
title: t('warning-dialog-expire-title'),
|
|
11870
12717
|
description: t('warning-dialog-expire-description'),
|
|
11871
|
-
request: function
|
|
11872
|
-
|
|
11873
|
-
|
|
11874
|
-
|
|
11875
|
-
|
|
11876
|
-
|
|
11877
|
-
|
|
11878
|
-
|
|
12718
|
+
request: function () {
|
|
12719
|
+
var _request = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
12720
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
12721
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
12722
|
+
case 0:
|
|
12723
|
+
return _context3.abrupt("return", saveWarning({
|
|
12724
|
+
id: expiredWarning.id,
|
|
12725
|
+
data: Object.assign({}, expiredWarning, {
|
|
12726
|
+
type: 'public'
|
|
12727
|
+
})
|
|
12728
|
+
}));
|
|
12729
|
+
case 1:
|
|
12730
|
+
case "end":
|
|
12731
|
+
return _context3.stop();
|
|
12732
|
+
}
|
|
12733
|
+
}, _callee3);
|
|
12734
|
+
}));
|
|
12735
|
+
function request() {
|
|
12736
|
+
return _request.apply(this, arguments);
|
|
12737
|
+
}
|
|
12738
|
+
return request;
|
|
12739
|
+
}(),
|
|
11879
12740
|
callback: function callback() {
|
|
11880
12741
|
return onRemoveSuccess(expiredWarning.id, t('warning-dialog-expire-succes'));
|
|
11881
12742
|
}
|
|
@@ -11889,14 +12750,28 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
11889
12750
|
confirmLabel: t('warning-dialog-withdraw-confirm'),
|
|
11890
12751
|
title: t('warning-dialog-withdraw-title'),
|
|
11891
12752
|
description: t('warning-dialog-withdraw-description'),
|
|
11892
|
-
request: function
|
|
11893
|
-
|
|
11894
|
-
|
|
11895
|
-
|
|
11896
|
-
|
|
11897
|
-
|
|
11898
|
-
|
|
11899
|
-
|
|
12753
|
+
request: function () {
|
|
12754
|
+
var _request2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
12755
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
12756
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
12757
|
+
case 0:
|
|
12758
|
+
return _context4.abrupt("return", saveWarning({
|
|
12759
|
+
id: withdrawnWarning.id,
|
|
12760
|
+
data: Object.assign({}, withdrawnWarning, {
|
|
12761
|
+
type: 'public'
|
|
12762
|
+
})
|
|
12763
|
+
}));
|
|
12764
|
+
case 1:
|
|
12765
|
+
case "end":
|
|
12766
|
+
return _context4.stop();
|
|
12767
|
+
}
|
|
12768
|
+
}, _callee4);
|
|
12769
|
+
}));
|
|
12770
|
+
function request() {
|
|
12771
|
+
return _request2.apply(this, arguments);
|
|
12772
|
+
}
|
|
12773
|
+
return request;
|
|
12774
|
+
}(),
|
|
11900
12775
|
callback: function callback() {
|
|
11901
12776
|
return onRemoveSuccess(withdrawnWarning.id, t('warning-dialog-withdraw-succes'));
|
|
11902
12777
|
}
|
|
@@ -11910,48 +12785,89 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
11910
12785
|
postSigmet = _usePostSigmet.mutateAsync;
|
|
11911
12786
|
var _usePostAirmet = usePostAirmet(),
|
|
11912
12787
|
postAirmet = _usePostAirmet.mutateAsync;
|
|
11913
|
-
var
|
|
11914
|
-
|
|
11915
|
-
|
|
11916
|
-
return
|
|
11917
|
-
|
|
12788
|
+
var aviationWarnings = useAviationWarnings();
|
|
12789
|
+
var selectedBackendProduct = React__default.useMemo(function () {
|
|
12790
|
+
return aviationWarnings.find(function (aviationProduct) {
|
|
12791
|
+
return aviationProduct.uuid === selectedWarningId;
|
|
12792
|
+
});
|
|
12793
|
+
}, [aviationWarnings, selectedWarningId]);
|
|
12794
|
+
var postAviationProduct = /*#__PURE__*/function () {
|
|
12795
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(productToPost, newStatus, type, opts) {
|
|
12796
|
+
var _productToPost$uuid, _opts$vaSigmetMoveToF;
|
|
12797
|
+
var uuid, body, _param, param;
|
|
12798
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
12799
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
11918
12800
|
case 0:
|
|
11919
|
-
|
|
11920
|
-
|
|
11921
|
-
if (!(
|
|
11922
|
-
|
|
12801
|
+
uuid = (_productToPost$uuid = productToPost == null ? void 0 : productToPost.uuid) != null ? _productToPost$uuid : null;
|
|
12802
|
+
body = newStatus === 'CANCELLED' && selectedBackendProduct ? getCancelSigmet(selectedBackendProduct, (_opts$vaSigmetMoveToF = opts == null ? void 0 : opts.vaSigmetMoveToFIR) != null ? _opts$vaSigmetMoveToF : 'UNKNOWN') : productToPost;
|
|
12803
|
+
if (!(type === 'sigmet')) {
|
|
12804
|
+
_context5.next = 5;
|
|
11923
12805
|
break;
|
|
11924
12806
|
}
|
|
11925
|
-
|
|
11926
|
-
|
|
11927
|
-
|
|
11928
|
-
|
|
11929
|
-
return
|
|
12807
|
+
_param = createSigmetPostParameter(body, newStatus, uuid);
|
|
12808
|
+
return _context5.abrupt("return", postSigmet(_param));
|
|
12809
|
+
case 5:
|
|
12810
|
+
param = createAirmetPostParameter(body, newStatus, uuid);
|
|
12811
|
+
return _context5.abrupt("return", postAirmet(param));
|
|
11930
12812
|
case 7:
|
|
11931
|
-
postProductParam = createAirmetPostParameter(productToPost.sigmetAirmetDetails, newStatus, uuid);
|
|
11932
|
-
_context3.next = 10;
|
|
11933
|
-
return postAirmet(postProductParam);
|
|
11934
|
-
case 10:
|
|
11935
|
-
return _context3.abrupt("return", _context3.sent);
|
|
11936
|
-
case 13:
|
|
11937
|
-
_context3.prev = 13;
|
|
11938
|
-
_context3.t0 = _context3["catch"](0);
|
|
11939
|
-
errorMessage = _context3.t0 instanceof Error ? _context3.t0 : 'Unknown error occurred';
|
|
11940
|
-
dispatch(snackbarActions.openSnackbar({
|
|
11941
|
-
type: snackbarTypes.SnackbarMessageType.VERBATIM_MESSAGE,
|
|
11942
|
-
message: "Failed to save " + warningType.toUpperCase() + ": " + errorMessage
|
|
11943
|
-
}));
|
|
11944
|
-
throw _context3.t0;
|
|
11945
|
-
case 18:
|
|
11946
12813
|
case "end":
|
|
11947
|
-
return
|
|
12814
|
+
return _context5.stop();
|
|
11948
12815
|
}
|
|
11949
|
-
},
|
|
12816
|
+
}, _callee5);
|
|
11950
12817
|
}));
|
|
11951
|
-
return function
|
|
12818
|
+
return function postAviationProduct(_x5, _x6, _x7, _x8) {
|
|
11952
12819
|
return _ref4.apply(this, arguments);
|
|
11953
12820
|
};
|
|
11954
12821
|
}();
|
|
12822
|
+
var getCancelSigmet = function getCancelSigmet(selectedProduct, vaSigmetMoveToFIR) {
|
|
12823
|
+
if ('sigmet' in selectedProduct) {
|
|
12824
|
+
return prepareCancelSigmet(selectedProduct.sigmet, vaSigmetMoveToFIR != null ? vaSigmetMoveToFIR : 'UNKNOWN');
|
|
12825
|
+
}
|
|
12826
|
+
return selectedProduct.airmet;
|
|
12827
|
+
};
|
|
12828
|
+
var _cancelAviationProduct = /*#__PURE__*/function () {
|
|
12829
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(warning, type) {
|
|
12830
|
+
var result;
|
|
12831
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
12832
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
12833
|
+
case 0:
|
|
12834
|
+
_context6.next = 2;
|
|
12835
|
+
return postAviationProduct(warning, 'CANCELLED', type);
|
|
12836
|
+
case 2:
|
|
12837
|
+
result = _context6.sent;
|
|
12838
|
+
return _context6.abrupt("return", result != null ? result : null);
|
|
12839
|
+
case 4:
|
|
12840
|
+
case "end":
|
|
12841
|
+
return _context6.stop();
|
|
12842
|
+
}
|
|
12843
|
+
}, _callee6);
|
|
12844
|
+
}));
|
|
12845
|
+
return function cancelAviationProduct(_x9, _x0) {
|
|
12846
|
+
return _ref5.apply(this, arguments);
|
|
12847
|
+
};
|
|
12848
|
+
}();
|
|
12849
|
+
var _React$useState2 = React__default.useState(false),
|
|
12850
|
+
cancelOpen = _React$useState2[0],
|
|
12851
|
+
setCancelOpen = _React$useState2[1];
|
|
12852
|
+
var _React$useState3 = React__default.useState(null),
|
|
12853
|
+
cancelCtx = _React$useState3[0],
|
|
12854
|
+
setCancelCtx = _React$useState3[1];
|
|
12855
|
+
var openCancelDialog = function openCancelDialog(warning) {
|
|
12856
|
+
var type = warning.warningDetail.level === 'SIG' ? 'sigmet' : 'airmet';
|
|
12857
|
+
var product = warning.sigmetAirmetDetails;
|
|
12858
|
+
var showVA = isVAPhenomenon(warning.sigmetAirmetDetails, ProductAction.CANCEL);
|
|
12859
|
+
setCancelCtx({
|
|
12860
|
+
type: type,
|
|
12861
|
+
product: product,
|
|
12862
|
+
showVA: showVA,
|
|
12863
|
+
sigmet: warning.sigmetAirmetDetails
|
|
12864
|
+
});
|
|
12865
|
+
setCancelOpen(true);
|
|
12866
|
+
};
|
|
12867
|
+
var closeCancelDialog = function closeCancelDialog() {
|
|
12868
|
+
setCancelOpen(false);
|
|
12869
|
+
setCancelCtx(null);
|
|
12870
|
+
};
|
|
11955
12871
|
var handleAviationProductClick = function handleAviationProductClick(warning, actionType) {
|
|
11956
12872
|
if (!warning) {
|
|
11957
12873
|
return;
|
|
@@ -11970,19 +12886,38 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
11970
12886
|
updatedWarning = duplicateAviationProduct(warning);
|
|
11971
12887
|
void openPublicWarningDialog('edit', updatedWarning, type);
|
|
11972
12888
|
break;
|
|
11973
|
-
case
|
|
11974
|
-
|
|
11975
|
-
|
|
12889
|
+
case ProductAction.CANCEL:
|
|
12890
|
+
{
|
|
12891
|
+
openCancelDialog(warning);
|
|
12892
|
+
break;
|
|
12893
|
+
}
|
|
11976
12894
|
case 'DISCARD':
|
|
11977
12895
|
{
|
|
11978
|
-
var
|
|
12896
|
+
var _warning$editor, _auth$username;
|
|
12897
|
+
var editor = (_warning$editor = warning.editor) != null ? _warning$editor : '';
|
|
12898
|
+
var currentUser = (_auth$username = auth == null ? void 0 : auth.username) != null ? _auth$username : '';
|
|
12899
|
+
var isLocked = editor !== '' && editor !== currentUser;
|
|
11979
12900
|
setConfirmDialogOptions({
|
|
11980
12901
|
confirmLabel: t('warning-dialog-delete-confirm'),
|
|
11981
12902
|
title: t('warning-dialog-delete-title'),
|
|
11982
12903
|
description: t('warning-dialog-delete-description'),
|
|
11983
|
-
request: function
|
|
11984
|
-
|
|
11985
|
-
|
|
12904
|
+
request: function () {
|
|
12905
|
+
var _request3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
12906
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
12907
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
12908
|
+
case 0:
|
|
12909
|
+
return _context7.abrupt("return", postAviationProduct(warning.sigmetAirmetDetails, 'DISCARDED', type));
|
|
12910
|
+
case 1:
|
|
12911
|
+
case "end":
|
|
12912
|
+
return _context7.stop();
|
|
12913
|
+
}
|
|
12914
|
+
}, _callee7);
|
|
12915
|
+
}));
|
|
12916
|
+
function request() {
|
|
12917
|
+
return _request3.apply(this, arguments);
|
|
12918
|
+
}
|
|
12919
|
+
return request;
|
|
12920
|
+
}(),
|
|
11986
12921
|
callback: function callback() {
|
|
11987
12922
|
return onRemoveSuccess(warning.id);
|
|
11988
12923
|
},
|
|
@@ -11993,38 +12928,38 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
11993
12928
|
}
|
|
11994
12929
|
};
|
|
11995
12930
|
var editMaritimeWarning = /*#__PURE__*/function () {
|
|
11996
|
-
var
|
|
11997
|
-
return _regeneratorRuntime().wrap(function
|
|
11998
|
-
while (1) switch (
|
|
12931
|
+
var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(warning) {
|
|
12932
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
12933
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
11999
12934
|
case 0:
|
|
12000
12935
|
if (!(warning && auth != null && auth.username && !warning.editor)) {
|
|
12001
|
-
|
|
12936
|
+
_context8.next = 9;
|
|
12002
12937
|
break;
|
|
12003
12938
|
}
|
|
12004
|
-
|
|
12005
|
-
|
|
12939
|
+
_context8.prev = 1;
|
|
12940
|
+
_context8.next = 4;
|
|
12006
12941
|
return updateMaritimeWarningEditor({
|
|
12007
12942
|
domain: warning.type,
|
|
12008
12943
|
isEditor: true
|
|
12009
12944
|
});
|
|
12010
12945
|
case 4:
|
|
12011
|
-
|
|
12946
|
+
_context8.next = 8;
|
|
12012
12947
|
break;
|
|
12013
12948
|
case 6:
|
|
12014
|
-
|
|
12015
|
-
|
|
12949
|
+
_context8.prev = 6;
|
|
12950
|
+
_context8.t0 = _context8["catch"](1);
|
|
12016
12951
|
case 8:
|
|
12017
12952
|
refetchWarnings();
|
|
12018
12953
|
case 9:
|
|
12019
12954
|
void openPublicWarningDialog('', undefined, warning.type);
|
|
12020
12955
|
case 10:
|
|
12021
12956
|
case "end":
|
|
12022
|
-
return
|
|
12957
|
+
return _context8.stop();
|
|
12023
12958
|
}
|
|
12024
|
-
},
|
|
12959
|
+
}, _callee8, null, [[1, 6]]);
|
|
12025
12960
|
}));
|
|
12026
|
-
return function editMaritimeWarning(
|
|
12027
|
-
return
|
|
12961
|
+
return function editMaritimeWarning(_x1) {
|
|
12962
|
+
return _ref6.apply(this, arguments);
|
|
12028
12963
|
};
|
|
12029
12964
|
}();
|
|
12030
12965
|
var handleMaritimeProductClick = function handleMaritimeProductClick(warning, actionType) {
|
|
@@ -12047,20 +12982,37 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
12047
12982
|
}));
|
|
12048
12983
|
};
|
|
12049
12984
|
var deleteWarning = function deleteWarning(warningId, warningEditor) {
|
|
12050
|
-
var
|
|
12985
|
+
var _auth$username2;
|
|
12986
|
+
var editor = warningEditor != null ? warningEditor : '';
|
|
12987
|
+
var currentUser = (_auth$username2 = auth == null ? void 0 : auth.username) != null ? _auth$username2 : '';
|
|
12988
|
+
var isLocked = editor !== '' && editor !== currentUser;
|
|
12051
12989
|
setConfirmDialogOptions({
|
|
12052
12990
|
confirmLabel: t('warning-dialog-delete-confirm'),
|
|
12053
12991
|
title: t('warning-dialog-delete-title'),
|
|
12054
12992
|
description: t('warning-dialog-delete-description'),
|
|
12055
|
-
request: function
|
|
12056
|
-
|
|
12057
|
-
|
|
12058
|
-
|
|
12059
|
-
|
|
12060
|
-
|
|
12061
|
-
|
|
12062
|
-
|
|
12063
|
-
|
|
12993
|
+
request: function () {
|
|
12994
|
+
var _request4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
12995
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
12996
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
12997
|
+
case 0:
|
|
12998
|
+
return _context9.abrupt("return", deletePublicWarning({
|
|
12999
|
+
id: warningId
|
|
13000
|
+
}, {
|
|
13001
|
+
onSuccess: function onSuccess() {
|
|
13002
|
+
return onRemoveSuccessHooks(warningId);
|
|
13003
|
+
}
|
|
13004
|
+
}));
|
|
13005
|
+
case 1:
|
|
13006
|
+
case "end":
|
|
13007
|
+
return _context9.stop();
|
|
13008
|
+
}
|
|
13009
|
+
}, _callee9);
|
|
13010
|
+
}));
|
|
13011
|
+
function request() {
|
|
13012
|
+
return _request4.apply(this, arguments);
|
|
13013
|
+
}
|
|
13014
|
+
return request;
|
|
13015
|
+
}(),
|
|
12064
13016
|
isLocked: isLocked
|
|
12065
13017
|
});
|
|
12066
13018
|
};
|
|
@@ -12072,14 +13024,28 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
12072
13024
|
confirmLabel: t('warning-dialog-delete-confirm'),
|
|
12073
13025
|
title: t('warning-dialog-delete-title'),
|
|
12074
13026
|
description: t('warning-dialog-delete-description'),
|
|
12075
|
-
request: function
|
|
12076
|
-
|
|
12077
|
-
|
|
12078
|
-
|
|
12079
|
-
|
|
12080
|
-
|
|
12081
|
-
|
|
12082
|
-
|
|
13027
|
+
request: function () {
|
|
13028
|
+
var _request5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee0() {
|
|
13029
|
+
return _regeneratorRuntime().wrap(function _callee0$(_context0) {
|
|
13030
|
+
while (1) switch (_context0.prev = _context0.next) {
|
|
13031
|
+
case 0:
|
|
13032
|
+
return _context0.abrupt("return", saveWarning({
|
|
13033
|
+
id: ignoredWarning.id,
|
|
13034
|
+
data: Object.assign({}, ignoredWarning, {
|
|
13035
|
+
type: 'public'
|
|
13036
|
+
})
|
|
13037
|
+
}));
|
|
13038
|
+
case 1:
|
|
13039
|
+
case "end":
|
|
13040
|
+
return _context0.stop();
|
|
13041
|
+
}
|
|
13042
|
+
}, _callee0);
|
|
13043
|
+
}));
|
|
13044
|
+
function request() {
|
|
13045
|
+
return _request5.apply(this, arguments);
|
|
13046
|
+
}
|
|
13047
|
+
return request;
|
|
13048
|
+
}(),
|
|
12083
13049
|
callback: function callback() {
|
|
12084
13050
|
return onRemoveSuccess(ignoredWarning.id, t('warning-dialog-delete-succes'));
|
|
12085
13051
|
}
|
|
@@ -12126,17 +13092,18 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
12126
13092
|
var filteredWarnings = React__default.useMemo(function () {
|
|
12127
13093
|
return combinedWarnings.filter(filterHookState.byFilterState);
|
|
12128
13094
|
}, [combinedWarnings, filterHookState.byFilterState]);
|
|
12129
|
-
var _React$
|
|
13095
|
+
var _React$useState4 = React__default.useState({
|
|
12130
13096
|
TODO: false,
|
|
12131
13097
|
DRAFT: false,
|
|
12132
13098
|
PUBLISHED: true,
|
|
12133
13099
|
EXPIRED: false
|
|
12134
13100
|
}),
|
|
12135
|
-
expandedSections = _React$
|
|
12136
|
-
setExpandedSections = _React$
|
|
13101
|
+
expandedSections = _React$useState4[0],
|
|
13102
|
+
setExpandedSections = _React$useState4[1];
|
|
12137
13103
|
var filteredWarningsByExpandedSections = React__default.useMemo(function () {
|
|
12138
13104
|
return filteredWarnings.filter(function (warning) {
|
|
12139
|
-
|
|
13105
|
+
var _ref7;
|
|
13106
|
+
return (_ref7 = warning.status && expandedSections[warning.status]) != null ? _ref7 : warning.productStatus && expandedSections[warning.productStatus];
|
|
12140
13107
|
});
|
|
12141
13108
|
}, [filteredWarnings, expandedSections]);
|
|
12142
13109
|
var selectedAviationProductId = (_filteredWarnings$fin = filteredWarnings.find(function (warning) {
|
|
@@ -12144,57 +13111,96 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
12144
13111
|
})) == null ? void 0 : _filteredWarnings$fin.id;
|
|
12145
13112
|
var allFeatures = React__default.useMemo(function () {
|
|
12146
13113
|
return filteredWarningsByExpandedSections.flatMap(function (warning) {
|
|
12147
|
-
|
|
12148
|
-
|
|
13114
|
+
var _warning$warningDetai, _warning$warningDetai2;
|
|
13115
|
+
var id = warning == null ? void 0 : warning.id;
|
|
13116
|
+
if (!id || id === selectedAviationProductId) {
|
|
13117
|
+
return [];
|
|
13118
|
+
}
|
|
13119
|
+
var areas = (_warning$warningDetai = warning == null || (_warning$warningDetai2 = warning.warningDetail) == null ? void 0 : _warning$warningDetai2.areas) != null ? _warning$warningDetai : [];
|
|
13120
|
+
return areas.filter(function (area) {
|
|
13121
|
+
return !!area.geoJSON;
|
|
12149
13122
|
}).map(function (area) {
|
|
13123
|
+
var _warning$warningDetai3, _area$areaId;
|
|
13124
|
+
var level = warning == null || (_warning$warningDetai3 = warning.warningDetail) == null ? void 0 : _warning$warningDetai3.level;
|
|
12150
13125
|
var isAviationWarning = warning.warningDetail.level === 'SIG' || warning.warningDetail.level === 'AIR';
|
|
12151
|
-
var styledGeoJSON = warningLevelFeatureColors(
|
|
13126
|
+
var styledGeoJSON = level ? warningLevelFeatureColors(level, area.geoJSON, isAviationWarning) : area.geoJSON;
|
|
12152
13127
|
return {
|
|
12153
|
-
id:
|
|
12154
|
-
originalId:
|
|
13128
|
+
id: id + ((_area$areaId = area.areaId) != null ? _area$areaId : ''),
|
|
13129
|
+
originalId: id,
|
|
12155
13130
|
geoJSON: styledGeoJSON
|
|
12156
13131
|
};
|
|
12157
|
-
})
|
|
13132
|
+
});
|
|
12158
13133
|
}).filter(function (feature) {
|
|
12159
|
-
return feature.id;
|
|
13134
|
+
return !!feature.id;
|
|
12160
13135
|
});
|
|
12161
13136
|
}, [filteredWarningsByExpandedSections, selectedAviationProductId]);
|
|
12162
13137
|
var _useUpdateSharedData = useUpdateSharedData({
|
|
12163
13138
|
features: allFeatures
|
|
12164
13139
|
}, panelId),
|
|
12165
13140
|
hoveredFeatureId = _useUpdateSharedData.hoverId;
|
|
12166
|
-
return jsxs(Fragment, {
|
|
13141
|
+
return isLoggedIn ? jsxs(Fragment, {
|
|
12167
13142
|
children: [jsx(PublicWarningList, {
|
|
12168
|
-
|
|
13143
|
+
error: error != null ? error : undefined,
|
|
12169
13144
|
expandedSections: expandedSections,
|
|
12170
|
-
|
|
13145
|
+
filterHookState: filterHookState,
|
|
13146
|
+
hoveredFeatureId: hoveredFeatureId,
|
|
12171
13147
|
isLoading: isFetching,
|
|
12172
|
-
|
|
12173
|
-
|
|
13148
|
+
lastUpdatedTime: lastUpdateTime,
|
|
13149
|
+
onActionAviationWarning: handleAviationProductClick,
|
|
13150
|
+
onActionMaritimeWarning: handleMaritimeProductClick,
|
|
12174
13151
|
onCreateWarning: createWarning,
|
|
12175
|
-
onEditWarning: editWarning,
|
|
12176
|
-
onDeleteWarning: deleteWarning,
|
|
12177
13152
|
onDeleteReviewWarning: deleteReviewWarning,
|
|
13153
|
+
onDeleteWarning: deleteWarning,
|
|
13154
|
+
onEditWarning: editWarning,
|
|
12178
13155
|
onExpireWarning: expireWarning,
|
|
13156
|
+
onRefetchWarnings: refetchWarnings,
|
|
13157
|
+
onSelectWarning: selectWarning,
|
|
12179
13158
|
onWithdrawWarning: withdrawWarning,
|
|
12180
13159
|
selectedWarningId: selectedWarningId,
|
|
12181
|
-
|
|
12182
|
-
|
|
12183
|
-
|
|
12184
|
-
|
|
12185
|
-
|
|
12186
|
-
|
|
12187
|
-
|
|
13160
|
+
setExpandedSections: setExpandedSections,
|
|
13161
|
+
warnings: filteredWarnings
|
|
13162
|
+
}), confirmDialogOptions ? jsx(ConfirmDeleteWarningDialog, {
|
|
13163
|
+
callback: confirmDialogOptions.callback,
|
|
13164
|
+
confirmLabel: confirmDialogOptions.confirmLabel,
|
|
13165
|
+
description: confirmDialogOptions.description,
|
|
13166
|
+
isLocked: confirmDialogOptions.isLocked,
|
|
12188
13167
|
onClose: function onClose() {
|
|
12189
13168
|
return setConfirmDialogOptions(undefined);
|
|
12190
13169
|
},
|
|
12191
|
-
title: confirmDialogOptions.title,
|
|
12192
|
-
description: confirmDialogOptions.description,
|
|
12193
13170
|
request: confirmDialogOptions.request,
|
|
12194
|
-
|
|
12195
|
-
|
|
12196
|
-
|
|
13171
|
+
title: confirmDialogOptions.title
|
|
13172
|
+
}) : null, cancelCtx && jsx(CancelAviationConfirmDialog, {
|
|
13173
|
+
open: cancelOpen,
|
|
13174
|
+
type: cancelCtx.type,
|
|
13175
|
+
product: cancelCtx.product,
|
|
13176
|
+
showVA: cancelCtx.showVA,
|
|
13177
|
+
aviationConfig: aviationConfig,
|
|
13178
|
+
sigmet: cancelCtx.sigmet,
|
|
13179
|
+
title: getConfirmationDialogTitle(t, ProductAction.CANCEL, cancelCtx.type),
|
|
13180
|
+
confirmLabel: getConfirmationDialogButtonLabel(t, ProductAction.CANCEL, cancelCtx.type),
|
|
13181
|
+
onClose: closeCancelDialog,
|
|
13182
|
+
cancelAviationProduct: function () {
|
|
13183
|
+
var _cancelAviationProduct2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee1(product, t) {
|
|
13184
|
+
return _regeneratorRuntime().wrap(function _callee1$(_context1) {
|
|
13185
|
+
while (1) switch (_context1.prev = _context1.next) {
|
|
13186
|
+
case 0:
|
|
13187
|
+
return _context1.abrupt("return", _cancelAviationProduct(product, t));
|
|
13188
|
+
case 1:
|
|
13189
|
+
case "end":
|
|
13190
|
+
return _context1.stop();
|
|
13191
|
+
}
|
|
13192
|
+
}, _callee1);
|
|
13193
|
+
}));
|
|
13194
|
+
function cancelAviationProduct(_x10, _x11) {
|
|
13195
|
+
return _cancelAviationProduct2.apply(this, arguments);
|
|
13196
|
+
}
|
|
13197
|
+
return cancelAviationProduct;
|
|
13198
|
+
}()
|
|
12197
13199
|
})]
|
|
13200
|
+
}) : jsx(AlertBanner, {
|
|
13201
|
+
severity: "error",
|
|
13202
|
+
title: t('error-auth-login'),
|
|
13203
|
+
dataTestId: "public-warning-list-auth-error"
|
|
12198
13204
|
});
|
|
12199
13205
|
};
|
|
12200
13206
|
|