@opengeoweb/warnings 14.0.1 → 14.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js CHANGED
@@ -1,24 +1,24 @@
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, Options, Close, ChevronDown, ChevronUp, Copy, Update, Cancel, Success, Expire, Remove } from '@opengeoweb/theme';
3
+ import { Polygons, ExitDomain, Share, Edit, Delete, CoastalEvent, TemperatureLow, TemperatureHigh, Rain, Snow, Lightning, Fog, Wind, Thunderstorm, SevereMountainWaves, VulcanicEruption, Haze, FreezingPrecipitation, ModerateAircraftIcing, SevereAircraftIcing, ModerateTurbulence, SevereTurbulence, SandStorm, RadioactiveMaterials, DrawPolygon, Visibility, Add, ArrowUpCompact, ArrowDownCompact, breakpoints, DragHandle, Info, Options, Close, ChevronDown, ChevronUp, Copy, Update, Cancel, Success, Expire, Remove } from '@opengeoweb/theme';
4
4
  import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawingToolSelectors, layerSelectors, uiSelectors, drawingToolActions, layerActions, mapListener, layersListener, drawingToolListener, syncGroupsListener, openlayersListener, syncGroupsReducer, drawingToolReducer, uiReducer, layerReducer, mapReducer, useSetupDialog, genericSelectors, useUpdateSharedData, genericActions, selectorMemoizationOptions } from '@opengeoweb/store';
5
5
  import { defaultPolygon, emptyGeoJSON, MapControlButton, getIcon, rewindGeometry, getGeoJSONPropertyValue, currentlySupportedDrawModes, defaultLayers, viewUtils, OpenLayersMapView, MapControls, OpenLayersZoomControl, OpenLayersLayer, OpenLayersFeatureLayer, genericOpenLayersFeatureStyle } from '@opengeoweb/webmap-react';
6
- import { SHARED_NAMESPACE, useConfirmationDialog, dateUtils, ToggleMenu, calculateStartSize, ToolContainerDraggable, AlertBanner, sessionStorageProvider, ConfirmationDialog, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, FilterChip, TooltipSelect, LastUpdateTime, usePreventBrowserClose, CustomToggleButton, Filter, FilterOption, StatusTag, getAxiosErrorMessage, ErrorBoundary } from '@opengeoweb/shared';
6
+ import { SHARED_NAMESPACE, useConfirmationDialog, dateUtils, ToggleMenu, calculateStartSize, ToolContainerDraggable, AlertBanner, sessionStorageProvider, ConfirmationDialog, usePrevious, CustomIconButton, usePreventBrowserClose, CustomTooltip, Avatar, getInitials, SwitchButton, FilterChip, TooltipSelect, LastUpdateTime, CustomToggleButton, Filter, FilterOption, StatusTag, 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, findSequenceNumber, getSequenceStyling, useShortTestHelpers, ProductAction, SigmetForm, AirmetForm, getConfirmationDialogCancelLabel, getConfirmationDialogButtonLabel, getConfirmationDialogContent, getConfirmationDialogTitle, isVAPhenomenon, CancelSigmetVolcanicMovements, createAirmetPostParameter, createSigmetPostParameter, prepareCancelSigmet, getProductFormMode } from '@opengeoweb/sigmet-airmet';
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, ListItemText } from '@mui/material';
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, ListItemText, 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';
@@ -210,16 +210,16 @@ var en = {
210
210
  "aviation-save-success": "{{warningType}} has succesfully been saved!",
211
211
  "aviation-publish-success": "{{warningType}} has succesfully been published!",
212
212
  "publish-this-product": "Are you sure you want to publish this {{product}}?",
213
- "yes-cancel": "Yes, cancel {{product}}",
213
+ "yes-cancel": "Cancel {{product}}",
214
214
  "cancel-this-product": "Are you sure you want to cancel this {{product}}?",
215
215
  "cancel-message": "Cancel message",
216
216
  "will-cancel-message": "Will cancel warning",
217
- "tac-label": "TAC:",
218
217
  "aviation-cancel-success": "{{warningType}} has succesfully been cancelled!",
219
218
  "aviation-discard-success": "{{warningType}} has been discarded!",
220
219
  "error-auth-login": "This feature is protected by authentication. Please log in to proceed",
221
220
  "cancel-warningType": "Cancel {{warningType}}",
222
221
  cancelling: "Cancelling",
222
+ loading: "Loading...",
223
223
  "maritime-new-warning": "New warning",
224
224
  "maritime-add-area": "Add",
225
225
  "maritime-no-area-selected": "(no area selected)",
@@ -269,7 +269,9 @@ var en = {
269
269
  "maritime-warning-post-success": "Warning published successfully",
270
270
  "maritime-loading-config": "Loading config...",
271
271
  "maritime-config-error": "Something went wrong with loading the configuration file",
272
- "maritime-warning-validuntil": "End time: "
272
+ "maritime-warning-validuntil": "End time: ",
273
+ "maritime-wind-change-warning": "The entered wind change exceeds 180°. Please check if veering / backing is correct.",
274
+ "maritime-wind-change-error": "A wind change less than 45° is not allowed."
273
275
  };
274
276
  var nl = {
275
277
  "drawing-tool-form-tools": "Gereedschap",
@@ -425,6 +427,7 @@ var nl = {
425
427
  "error-auth-login": "Deze functie wordt beschermd door authenticatie. Log in om verder te gaan",
426
428
  "cancel-warningType": "Annuleer {{warningType}}",
427
429
  cancelling: "Annuleren",
430
+ loading: "Laden...",
428
431
  "maritime-new-warning": "Nieuwe waarschuwing",
429
432
  "maritime-add-area": "Toevoegen",
430
433
  "maritime-no-area-selected": "(geen gebied geselecteerd)",
@@ -470,7 +473,9 @@ var nl = {
470
473
  "maritime-warning-post-success": "Waarschuwing succesvol gepubliceerd",
471
474
  "maritime-loading-config": "Laden van configuratie...",
472
475
  "maritime-config-error": "Er is iets misgegaan bij het laden van het configuratiebestand",
473
- "maritime-warning-validuntil": "Eind tijd: "
476
+ "maritime-warning-validuntil": "Eind tijd: ",
477
+ "maritime-wind-change-warning": "De ingevulde wind wijziging overschrijdt 180°. Controleer of ruimend / krimpend klopt.",
478
+ "maritime-wind-change-error": "Een wind wijziging van minder dan 45° is niet toegestaan."
474
479
  };
475
480
  var fi = {
476
481
  "drawing-tool-form-tools": "Työkalut",
@@ -626,6 +631,7 @@ var fi = {
626
631
  "error-auth-login": "Tämän toiminnallisuuden käyttäminen vaatii tunnistautumista. Kirjaudu sisään jatkaaksesi",
627
632
  "cancel-warningType": "Peruuta {{warningType}}",
628
633
  cancelling: "Peruuttaminen",
634
+ loading: "Ladataan...",
629
635
  "maritime-editor-off": "Et ole enää {{domain}} -merivaroitusten muokkaaja",
630
636
  "maritime-warning-post-success": "Varoitus julkaistu onnistuneesti"
631
637
  };
@@ -776,13 +782,14 @@ var no = {
776
782
  "aviation-save-success": "{{warningType}} has succesfully been saved!",
777
783
  "aviation-publish-success": "{{warningType}} has succesfully been published!",
778
784
  "publish-this-product": "Are you sure you want to publish this {{product}}?",
779
- "yes-cancel": "Yes, cancel {{product}}",
785
+ "yes-cancel": "Cancel {{product}}",
780
786
  "cancel-this-product": "Are you sure you want to cancel this {{product}}?",
781
787
  "aviation-cancel-success": "{{warningType}} has succesfully been cancelled!",
782
788
  "aviation-discard-success": "{{warningType}} has been discarded!",
783
789
  "error-auth-login": "Denne delen er passordbeskyttet. Vennligst logg inn.",
784
790
  "cancel-warningType": "Cancel {{warningType}}",
785
- cancelling: "Cancelling"
791
+ cancelling: "Cancelling",
792
+ loading: "Laster..."
786
793
  };
787
794
  var warningsTranslations = {
788
795
  en: en,
@@ -4152,6 +4159,10 @@ var DrawingToolFormConnect = function DrawingToolFormConnect() {
4152
4159
  var featureLayerGeoJSONProperties = useSelector(function (store) {
4153
4160
  return layerSelectors.getFeatureLayerGeoJSONProperties(store, drawTool == null ? void 0 : drawTool.geoJSONLayerId);
4154
4161
  });
4162
+ var isFormDirty = useSelector(function (store) {
4163
+ return getWarningFormDirty(store, drawingDialogType);
4164
+ });
4165
+ usePreventBrowserClose(isFormDirty || isLayerInEditMode);
4155
4166
  var onSubmitForm = React.useCallback(function (formValues) {
4156
4167
  saveOrUpdateDrawing({
4157
4168
  id: drawing == null ? void 0 : drawing.id,
@@ -4522,7 +4533,7 @@ var getSigmetConfig = function getSigmetConfig(auth) {
4522
4533
  return result.json();
4523
4534
  });
4524
4535
  };
4525
- var getAirmetTAC = function getAirmetTAC(auth, product) {
4536
+ var getAirmetTAC = function getAirmetTAC(product, auth) {
4526
4537
  return fetch(airmetBaseUrl + "/airmet2tac", {
4527
4538
  body: JSON.stringify(product),
4528
4539
  method: 'POST',
@@ -4557,7 +4568,7 @@ var getAirmetTAC = function getAirmetTAC(auth, product) {
4557
4568
  };
4558
4569
  }());
4559
4570
  };
4560
- var getSigmetTAC = function getSigmetTAC(auth, product) {
4571
+ var getSigmetTAC = function getSigmetTAC(product, auth) {
4561
4572
  return fetch(sigmetBaseUrl + "/sigmet2tac", {
4562
4573
  body: JSON.stringify(product),
4563
4574
  method: 'POST',
@@ -4593,7 +4604,7 @@ var getSigmetTAC = function getSigmetTAC(auth, product) {
4593
4604
  }());
4594
4605
  };
4595
4606
  // For cancel TAC (not normal TAC)
4596
- var getAirmetCancelTAC = function getAirmetCancelTAC(auth, product) {
4607
+ var getAirmetCancelTAC = function getAirmetCancelTAC(product, auth) {
4597
4608
  return fetch(airmetBaseUrl + "/airmet2cancel2tac", {
4598
4609
  body: JSON.stringify(product),
4599
4610
  method: 'POST',
@@ -4628,7 +4639,7 @@ var getAirmetCancelTAC = function getAirmetCancelTAC(auth, product) {
4628
4639
  };
4629
4640
  }());
4630
4641
  };
4631
- var getSigmetCancelTAC = function getSigmetCancelTAC(auth, product) {
4642
+ var getSigmetCancelTAC = function getSigmetCancelTAC(product, auth) {
4632
4643
  return fetch(sigmetBaseUrl + "/sigmet2cancel2tac", {
4633
4644
  body: JSON.stringify(product),
4634
4645
  method: 'POST',
@@ -4678,6 +4689,137 @@ var postAirmet = function postAirmet(auth, data) {
4678
4689
  }).then(handleResponse);
4679
4690
  };
4680
4691
 
4692
+ /* *
4693
+ * Licensed under the Apache License, Version 2.0 (the "License");
4694
+ * you may not use this file except in compliance with the License.
4695
+ * You may obtain a copy of the License at
4696
+ *
4697
+ * http://www.apache.org/licenses/LICENSE-2.0
4698
+ *
4699
+ * Unless required by applicable law or agreed to in writing, software
4700
+ * distributed under the License is distributed on an "AS IS" BASIS,
4701
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4702
+ * See the License for the specific language governing permissions and
4703
+ * limitations under the License.
4704
+ *
4705
+ * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4706
+ * Copyright 2025 - Finnish Meteorological Institute (FMI)
4707
+ * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
4708
+ * */
4709
+ var LIB_KEY = 'warnings';
4710
+ var API_KEY = 'aviation';
4711
+ var generateAviationQueryKeys = function generateAviationQueryKeys(queryKeys) {
4712
+ return [LIB_KEY, API_KEY].concat(queryKeys);
4713
+ };
4714
+ // 2) Unique keys per query
4715
+ var aviationQueryOptions = {
4716
+ getSigmetTAC: function getSigmetTAC$1(product, credentials) {
4717
+ var _product$uuid;
4718
+ return queryOptions({
4719
+ queryKey: generateAviationQueryKeys(['sigmet', 'tac', (_product$uuid = product.uuid) != null ? _product$uuid : product.firName]),
4720
+ queryFn: function queryFn() {
4721
+ return getSigmetTAC(product, credentials);
4722
+ }
4723
+ });
4724
+ },
4725
+ getAirmetTAC: function getAirmetTAC$1(product, credentials) {
4726
+ var _product$uuid2;
4727
+ return queryOptions({
4728
+ queryKey: generateAviationQueryKeys(['airmet', 'tac', (_product$uuid2 = product.uuid) != null ? _product$uuid2 : product.firName]),
4729
+ queryFn: function queryFn() {
4730
+ return getAirmetTAC(product, credentials);
4731
+ }
4732
+ });
4733
+ },
4734
+ getSigmetCancelTAC: function getSigmetCancelTAC$1(product, credentials) {
4735
+ var _product$uuid3;
4736
+ return queryOptions({
4737
+ queryKey: generateAviationQueryKeys(['sigmet', 'cancel', (_product$uuid3 = product.uuid) != null ? _product$uuid3 : product.firName]),
4738
+ queryFn: function queryFn() {
4739
+ return getSigmetCancelTAC(product, credentials);
4740
+ }
4741
+ });
4742
+ },
4743
+ getAirmetCancelTAC: function getAirmetCancelTAC$1(product, credentials) {
4744
+ var _product$uuid4;
4745
+ return queryOptions({
4746
+ queryKey: generateAviationQueryKeys(['airmet', 'cancel', (_product$uuid4 = product.uuid) != null ? _product$uuid4 : product.firName]),
4747
+ queryFn: function queryFn() {
4748
+ return getAirmetCancelTAC(product, credentials);
4749
+ }
4750
+ });
4751
+ }
4752
+ };
4753
+
4754
+ /* *
4755
+ * Licensed under the Apache License, Version 2.0 (the "License");
4756
+ * you may not use this file except in compliance with the License.
4757
+ * You may obtain a copy of the License at
4758
+ *
4759
+ * http://www.apache.org/licenses/LICENSE-2.0
4760
+ *
4761
+ * Unless required by applicable law or agreed to in writing, software
4762
+ * distributed under the License is distributed on an "AS IS" BASIS,
4763
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
4764
+ * See the License for the specific language governing permissions and
4765
+ * limitations under the License.
4766
+ *
4767
+ * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
4768
+ * Copyright 2025 - Finnish Meteorological Institute (FMI)
4769
+ * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
4770
+ * */
4771
+ var tryParse = function tryParse(st) {
4772
+ try {
4773
+ return JSON.parse(st);
4774
+ } catch (_unused) {
4775
+ return null;
4776
+ }
4777
+ };
4778
+ var joinLoc = function joinLoc(loc) {
4779
+ if (!Array.isArray(loc) || loc.length === 0) {
4780
+ return '';
4781
+ }
4782
+ var start = typeof loc[0] === 'string' && (loc[0] === 'body' || loc[0] === 'query') ? 1 : 0;
4783
+ return loc.slice(start).join('.');
4784
+ };
4785
+ function humanizeApiErrorMessage(err) {
4786
+ // 1) Best effort to extract a message we can parse
4787
+ var raw =
4788
+ // eslint-disable-next-line no-nested-ternary
4789
+ err instanceof Error ? typeof err.message === 'string' ? err.message : String(err.message) : typeof err === 'string' ? err : '';
4790
+ var parsed = raw && (raw.startsWith('{') || raw.startsWith('[')) ? tryParse(raw) : null;
4791
+ // 3) If array of validation errors
4792
+ if (Array.isArray(parsed)) {
4793
+ var lines = parsed.map(function (vi) {
4794
+ var _vi$msg, _vi$msg2;
4795
+ var path = joinLoc(vi.loc);
4796
+ return path ? path + ": " + ((_vi$msg = vi.msg) != null ? _vi$msg : 'Invalid') : (_vi$msg2 = vi.msg) != null ? _vi$msg2 : 'Invalid';
4797
+ });
4798
+ return lines.slice(0, 5).join('; ');
4799
+ }
4800
+ // 4) If parsed is an object with common fields
4801
+ if (parsed && typeof parsed === 'object') {
4802
+ var obj = parsed;
4803
+ if (typeof obj.detail === 'string' && typeof obj.title === 'string') {
4804
+ return obj.title + ": " + obj.detail;
4805
+ }
4806
+ if (typeof obj.message === 'string') {
4807
+ return obj.message;
4808
+ }
4809
+ if (Array.isArray(obj.errors)) {
4810
+ return obj.errors.map(function (e) {
4811
+ var _e$message;
4812
+ return typeof e === 'string' ? e : (_e$message = e == null ? void 0 : e.message) != null ? _e$message : JSON.stringify(e);
4813
+ }).join('; ');
4814
+ }
4815
+ }
4816
+ // 5) If message is [object Object]
4817
+ if (raw.includes('[object Object]')) {
4818
+ return 'Validation failed — check required fields.';
4819
+ }
4820
+ return raw || 'Unknown error occurred';
4821
+ }
4822
+
4681
4823
  var getAviationSnackbarKey = function getAviationSnackbarKey(status) {
4682
4824
  switch (status) {
4683
4825
  case 'PUBLISHED':
@@ -4707,7 +4849,7 @@ var useAviationWarnings = function useAviationWarnings() {
4707
4849
  airmets = _useAirmetList.data;
4708
4850
  var _useSigmetList = useSigmetList(),
4709
4851
  sigmets = _useSigmetList.data;
4710
- return (airmets || []).concat(sigmets || []);
4852
+ return (airmets != null ? airmets : []).concat(sigmets != null ? sigmets : []);
4711
4853
  };
4712
4854
  var useProductConfig = function useProductConfig(warningType, disabled) {
4713
4855
  if (disabled === void 0) {
@@ -4717,51 +4859,119 @@ var useProductConfig = function useProductConfig(warningType, disabled) {
4717
4859
  var sigmetQuery = useAuthQuery(['sigmet-config'], getSigmetConfig, disabled);
4718
4860
  return warningType === 'airmet' ? airmetQuery : sigmetQuery;
4719
4861
  };
4720
- var useTACApi = function useTACApi() {
4862
+ var useFetchSigmetTAC = function useFetchSigmetTAC(product, enabled) {
4863
+ if (enabled === void 0) {
4864
+ enabled = true;
4865
+ }
4721
4866
  var _useAuthenticationCon = useAuthenticationContext(),
4722
4867
  auth = _useAuthenticationCon.auth;
4723
- var queryClient = useQueryClient();
4724
- var fetchSigmetTAC = function fetchSigmetTAC(product) {
4725
- return queryClient.fetchQuery({
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
- };
4868
+ return useQuery(Object.assign({}, aviationQueryOptions.getSigmetTAC(product, auth), {
4869
+ enabled: enabled
4870
+ }));
4871
+ };
4872
+ var useFetchAirmetTAC = function useFetchAirmetTAC(product, enabled) {
4873
+ if (enabled === void 0) {
4874
+ enabled = true;
4875
+ }
4876
+ var _useAuthenticationCon2 = useAuthenticationContext(),
4877
+ auth = _useAuthenticationCon2.auth;
4878
+ return useQuery(Object.assign({}, aviationQueryOptions.getAirmetTAC(product, auth), {
4879
+ enabled: enabled
4880
+ }));
4881
+ };
4882
+ var useFetchSigmetCancelTAC = function useFetchSigmetCancelTAC(product, enabled) {
4883
+ if (enabled === void 0) {
4884
+ enabled = true;
4885
+ }
4886
+ var _useAuthenticationCon3 = useAuthenticationContext(),
4887
+ auth = _useAuthenticationCon3.auth;
4888
+ return useQuery(Object.assign({}, aviationQueryOptions.getSigmetCancelTAC(product, auth), {
4889
+ enabled: enabled
4890
+ }));
4891
+ };
4892
+ var useFetchAirmetCancelTAC = function useFetchAirmetCancelTAC(product, enabled) {
4893
+ if (enabled === void 0) {
4894
+ enabled = true;
4895
+ }
4896
+ var _useAuthenticationCon4 = useAuthenticationContext(),
4897
+ auth = _useAuthenticationCon4.auth;
4898
+ return useQuery(Object.assign({}, aviationQueryOptions.getAirmetCancelTAC(product, auth), {
4899
+ enabled: enabled
4900
+ }));
4901
+ };
4902
+ var useTACApi = function useTACApi() {
4903
+ var _useAuthenticationCon5 = useAuthenticationContext(),
4904
+ auth = _useAuthenticationCon5.auth;
4905
+ var queryClient = new QueryClient();
4760
4906
  return {
4761
- fetchSigmetTAC: fetchSigmetTAC,
4762
- fetchAirmetTAC: fetchAirmetTAC,
4763
- fetchSigmetCancelTAC: fetchSigmetCancelTAC,
4764
- fetchAirmetCancelTAC: fetchAirmetCancelTAC
4907
+ fetchSigmetTAC: function () {
4908
+ var _fetchSigmetTAC = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(product) {
4909
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
4910
+ while (1) switch (_context.prev = _context.next) {
4911
+ case 0:
4912
+ return _context.abrupt("return", queryClient.fetchQuery(aviationQueryOptions.getSigmetTAC(product, auth)));
4913
+ case 1:
4914
+ case "end":
4915
+ return _context.stop();
4916
+ }
4917
+ }, _callee);
4918
+ }));
4919
+ function fetchSigmetTAC(_x) {
4920
+ return _fetchSigmetTAC.apply(this, arguments);
4921
+ }
4922
+ return fetchSigmetTAC;
4923
+ }(),
4924
+ fetchAirmetTAC: function () {
4925
+ var _fetchAirmetTAC = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(product) {
4926
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
4927
+ while (1) switch (_context2.prev = _context2.next) {
4928
+ case 0:
4929
+ return _context2.abrupt("return", queryClient.fetchQuery(aviationQueryOptions.getAirmetTAC(product, auth)));
4930
+ case 1:
4931
+ case "end":
4932
+ return _context2.stop();
4933
+ }
4934
+ }, _callee2);
4935
+ }));
4936
+ function fetchAirmetTAC(_x2) {
4937
+ return _fetchAirmetTAC.apply(this, arguments);
4938
+ }
4939
+ return fetchAirmetTAC;
4940
+ }(),
4941
+ fetchSigmetCancelTAC: function () {
4942
+ var _fetchSigmetCancelTAC = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(product) {
4943
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
4944
+ while (1) switch (_context3.prev = _context3.next) {
4945
+ case 0:
4946
+ return _context3.abrupt("return", queryClient.fetchQuery(aviationQueryOptions.getSigmetCancelTAC(product, auth)));
4947
+ case 1:
4948
+ case "end":
4949
+ return _context3.stop();
4950
+ }
4951
+ }, _callee3);
4952
+ }));
4953
+ function fetchSigmetCancelTAC(_x3) {
4954
+ return _fetchSigmetCancelTAC.apply(this, arguments);
4955
+ }
4956
+ return fetchSigmetCancelTAC;
4957
+ }(),
4958
+ fetchAirmetCancelTAC: function () {
4959
+ var _fetchAirmetCancelTAC = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(product) {
4960
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
4961
+ while (1) switch (_context4.prev = _context4.next) {
4962
+ case 0:
4963
+ return _context4.abrupt("return", queryClient.fetchQuery(aviationQueryOptions.getAirmetCancelTAC(product, auth)));
4964
+ case 1:
4965
+ case "end":
4966
+ return _context4.stop();
4967
+ }
4968
+ }, _callee4);
4969
+ }));
4970
+ function fetchAirmetCancelTAC(_x4) {
4971
+ return _fetchAirmetCancelTAC.apply(this, arguments);
4972
+ }
4973
+ return fetchAirmetCancelTAC;
4974
+ }()
4765
4975
  };
4766
4976
  };
4767
4977
  /**
@@ -4772,53 +4982,69 @@ var useTACApi = function useTACApi() {
4772
4982
  * @returns A mutation result for posting a SIGMET.
4773
4983
  */
4774
4984
  var usePostSigmet = function usePostSigmet() {
4775
- var _useAuthenticationCon2 = useAuthenticationContext(),
4776
- auth = _useAuthenticationCon2.auth;
4985
+ var _useAuthenticationCon6 = useAuthenticationContext(),
4986
+ auth = _useAuthenticationCon6.auth;
4777
4987
  var dispatch = useDispatch();
4778
4988
  var queryClient = useQueryClient();
4779
4989
  var _useWarningsTranslati = useWarningsTranslation(),
4780
4990
  t = _useWarningsTranslati.t;
4781
4991
  return useMutation({
4782
- mutationFn: function mutationFn(formData) {
4783
- if (!auth) {
4784
- throw new Error('Authentication context not found');
4992
+ mutationFn: function () {
4993
+ var _mutationFn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(formData) {
4994
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
4995
+ while (1) switch (_context5.prev = _context5.next) {
4996
+ case 0:
4997
+ if (auth) {
4998
+ _context5.next = 2;
4999
+ break;
5000
+ }
5001
+ throw new Error('Authentication context not found');
5002
+ case 2:
5003
+ return _context5.abrupt("return", postSigmet(auth, formData));
5004
+ case 3:
5005
+ case "end":
5006
+ return _context5.stop();
5007
+ }
5008
+ }, _callee5);
5009
+ }));
5010
+ function mutationFn(_x5) {
5011
+ return _mutationFn.apply(this, arguments);
4785
5012
  }
4786
- return postSigmet(auth, formData);
4787
- },
5013
+ return mutationFn;
5014
+ }(),
4788
5015
  onError: function onError(error) {
4789
5016
  void queryClient.invalidateQueries({
4790
5017
  queryKey: ['sigmet']
4791
5018
  });
4792
- var errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
5019
+ var formattedError = humanizeApiErrorMessage(error);
4793
5020
  dispatch(publicWarningFormActions.setFormError({
4794
- message: "Failed to save SIGMET: " + errorMessage
5021
+ message: "Failed to save SIGMET: " + formattedError
4795
5022
  }));
4796
5023
  },
4797
5024
  onSuccess: function () {
4798
- var _onSuccess = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(data, variables) {
4799
- var snackbarKey, warningType;
4800
- return _regeneratorRuntime().wrap(function _callee$(_context) {
4801
- while (1) switch (_context.prev = _context.next) {
5025
+ var _onSuccess = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(data, variables) {
5026
+ var snackbarKey;
5027
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
5028
+ while (1) switch (_context6.prev = _context6.next) {
4802
5029
  case 0:
4803
5030
  snackbarKey = getAviationSnackbarKey(variables.changeStatusTo);
4804
- warningType = 'SIGMET';
4805
5031
  dispatch(snackbarActions.openSnackbar({
4806
5032
  type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
4807
5033
  key: t(snackbarKey, {
4808
- warningType: warningType
5034
+ warningType: 'SIGMET'
4809
5035
  })
4810
5036
  }));
4811
- _context.next = 5;
5037
+ _context6.next = 4;
4812
5038
  return queryClient.invalidateQueries({
4813
5039
  queryKey: ['sigmet-list']
4814
5040
  });
4815
- case 5:
5041
+ case 4:
4816
5042
  case "end":
4817
- return _context.stop();
5043
+ return _context6.stop();
4818
5044
  }
4819
- }, _callee);
5045
+ }, _callee6);
4820
5046
  }));
4821
- function onSuccess(_x, _x2) {
5047
+ function onSuccess(_x6, _x7) {
4822
5048
  return _onSuccess.apply(this, arguments);
4823
5049
  }
4824
5050
  return onSuccess;
@@ -4833,53 +5059,69 @@ var usePostSigmet = function usePostSigmet() {
4833
5059
  * @returns A mutation result for posting an AIRMET.
4834
5060
  */
4835
5061
  var usePostAirmet = function usePostAirmet() {
4836
- var _useAuthenticationCon3 = useAuthenticationContext(),
4837
- auth = _useAuthenticationCon3.auth;
5062
+ var _useAuthenticationCon7 = useAuthenticationContext(),
5063
+ auth = _useAuthenticationCon7.auth;
4838
5064
  var dispatch = useDispatch();
4839
5065
  var queryClient = useQueryClient();
4840
5066
  var _useWarningsTranslati2 = useWarningsTranslation(),
4841
5067
  t = _useWarningsTranslati2.t;
4842
5068
  return useMutation({
4843
- mutationFn: function mutationFn(formData) {
4844
- if (!auth) {
4845
- throw new Error('Authentication context not found');
5069
+ mutationFn: function () {
5070
+ var _mutationFn2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(formData) {
5071
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
5072
+ while (1) switch (_context7.prev = _context7.next) {
5073
+ case 0:
5074
+ if (auth) {
5075
+ _context7.next = 2;
5076
+ break;
5077
+ }
5078
+ throw new Error('Authentication context not found');
5079
+ case 2:
5080
+ return _context7.abrupt("return", postAirmet(auth, formData));
5081
+ case 3:
5082
+ case "end":
5083
+ return _context7.stop();
5084
+ }
5085
+ }, _callee7);
5086
+ }));
5087
+ function mutationFn(_x8) {
5088
+ return _mutationFn2.apply(this, arguments);
4846
5089
  }
4847
- return postAirmet(auth, formData);
4848
- },
5090
+ return mutationFn;
5091
+ }(),
4849
5092
  onError: function onError(error) {
4850
5093
  void queryClient.invalidateQueries({
4851
5094
  queryKey: ['airmet']
4852
5095
  });
4853
- var errorMessage = error instanceof Error ? error.message : 'Unknown error occurred';
5096
+ var formattedError = humanizeApiErrorMessage(error);
4854
5097
  dispatch(publicWarningFormActions.setFormError({
4855
- message: "Failed to save AIRMET: " + errorMessage
5098
+ message: "Failed to save AIRMET: " + formattedError
4856
5099
  }));
4857
5100
  },
4858
5101
  onSuccess: function () {
4859
- var _onSuccess2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data, variables) {
4860
- var snackbarKey, warningType;
4861
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
4862
- while (1) switch (_context2.prev = _context2.next) {
5102
+ var _onSuccess2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(data, variables) {
5103
+ var snackbarKey;
5104
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
5105
+ while (1) switch (_context8.prev = _context8.next) {
4863
5106
  case 0:
4864
5107
  snackbarKey = getAviationSnackbarKey(variables.changeStatusTo);
4865
- warningType = 'AIRMET';
4866
5108
  dispatch(snackbarActions.openSnackbar({
4867
5109
  type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
4868
5110
  key: t(snackbarKey, {
4869
- warningType: warningType
5111
+ warningType: 'AIRMET'
4870
5112
  })
4871
5113
  }));
4872
- _context2.next = 5;
5114
+ _context8.next = 4;
4873
5115
  return queryClient.invalidateQueries({
4874
5116
  queryKey: ['airmet-list']
4875
5117
  });
4876
- case 5:
5118
+ case 4:
4877
5119
  case "end":
4878
- return _context2.stop();
5120
+ return _context8.stop();
4879
5121
  }
4880
- }, _callee2);
5122
+ }, _callee8);
4881
5123
  }));
4882
- function onSuccess(_x3, _x4) {
5124
+ function onSuccess(_x9, _x0) {
4883
5125
  return _onSuccess2.apply(this, arguments);
4884
5126
  }
4885
5127
  return onSuccess;
@@ -6101,6 +6343,23 @@ var AddButton = function AddButton(_ref2) {
6101
6343
  });
6102
6344
  };
6103
6345
 
6346
+ var WarningListDragHandle = function WarningListDragHandle() {
6347
+ return jsx(CustomIconButton, {
6348
+ className: "handle",
6349
+ tabIndex: -1,
6350
+ disableTouchRipple: true,
6351
+ sx: {
6352
+ '&.handle:hover': function handleHover(theme) {
6353
+ return Object.assign({}, theme.palette.geowebColors.layerManager.dragHandleHover);
6354
+ },
6355
+ cursor: 'grab',
6356
+ marginTop: 0.5,
6357
+ paddingLeft: 0
6358
+ },
6359
+ children: jsx(DragHandle, {})
6360
+ });
6361
+ };
6362
+
6104
6363
  var WarningListSelect = /*#__PURE__*/React__default.memo(function (_ref) {
6105
6364
  var options = _ref.options,
6106
6365
  value = _ref.value,
@@ -6113,7 +6372,9 @@ var WarningListSelect = /*#__PURE__*/React__default.memo(function (_ref) {
6113
6372
  _ref$isReadOnly = _ref.isReadOnly,
6114
6373
  isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
6115
6374
  _ref$displayEmpty = _ref.displayEmpty,
6116
- displayEmpty = _ref$displayEmpty === void 0 ? false : _ref$displayEmpty;
6375
+ displayEmpty = _ref$displayEmpty === void 0 ? false : _ref$displayEmpty,
6376
+ _ref$validationResult = _ref.validationResult,
6377
+ validationResult = _ref$validationResult === void 0 ? true : _ref$validationResult;
6117
6378
  var currentIndex = options.findIndex(function (option) {
6118
6379
  return option.value === value;
6119
6380
  });
@@ -6146,6 +6407,8 @@ var WarningListSelect = /*#__PURE__*/React__default.memo(function (_ref) {
6146
6407
  WebkitTextFillColor: 'inherit'
6147
6408
  }
6148
6409
  }
6410
+ }, validationResult !== true && {
6411
+ backgroundColor: "geowebColors.functional." + validationResult + "Outline.fill"
6149
6412
  }, additionalStyling),
6150
6413
  currentIndex: currentIndex > -1 ? currentIndex : undefined,
6151
6414
  renderValue: renderValue,
@@ -6287,27 +6550,184 @@ var WindForceSelect = function WindForceSelect(_ref) {
6287
6550
  });
6288
6551
  };
6289
6552
 
6290
- var WarningListDragHandle = function WarningListDragHandle() {
6291
- return jsx(CustomIconButton, {
6292
- className: "handle",
6293
- tabIndex: -1,
6294
- disableTouchRipple: true,
6295
- sx: {
6296
- '&.handle:hover': function handleHover(theme) {
6297
- return Object.assign({}, theme.palette.geowebColors.layerManager.dragHandleHover);
6298
- },
6299
- cursor: 'grab',
6300
- marginTop: 0.5
6301
- },
6302
- children: jsx(DragHandle, {})
6303
- });
6304
- };
6305
-
6306
- var getWindDirectionsFromConfig = function getWindDirectionsFromConfig(directionConfig, t) {
6307
- return directionConfig.map(function (direction) {
6308
- return {
6309
- value: direction.value,
6310
- label: t("maritime-direction-" + direction.value) || direction.label
6553
+ /* *
6554
+ * Licensed under the Apache License, Version 2.0 (the "License");
6555
+ * you may not use this file except in compliance with the License.
6556
+ * You may obtain a copy of the License at
6557
+ *
6558
+ * http://www.apache.org/licenses/LICENSE-2.0
6559
+ *
6560
+ * Unless required by applicable law or agreed to in writing, software
6561
+ * distributed under the License is distributed on an "AS IS" BASIS,
6562
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6563
+ * See the License for the specific language governing permissions and
6564
+ * limitations under the License.
6565
+ *
6566
+ * Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
6567
+ * Copyright 2025 - Finnish Meteorological Institute (FMI)
6568
+ * Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
6569
+ * */
6570
+ var isWarningEmpty = function isWarningEmpty(item) {
6571
+ var windDirectionFrom = item.windDirectionFrom,
6572
+ windForce = item.windForce,
6573
+ changeType = item.changeType,
6574
+ windDirectionTo = item.windDirectionTo,
6575
+ assignedAreaIds = item.assignedAreaIds;
6576
+ if (assignedAreaIds.length) {
6577
+ return false;
6578
+ }
6579
+ return [windDirectionFrom, windForce, changeType, windDirectionTo].every(function (value) {
6580
+ return value === undefined || value.trim() === '';
6581
+ });
6582
+ };
6583
+ var isWarningValid = function isWarningValid(item, config) {
6584
+ var windDirectionFrom = item.windDirectionFrom,
6585
+ windForce = item.windForce,
6586
+ assignedAreaIds = item.assignedAreaIds,
6587
+ changeType = item.changeType,
6588
+ windDirectionTo = item.windDirectionTo;
6589
+ // Direction, windspeed and areas are required.
6590
+ if (!windDirectionFrom || !windForce || !assignedAreaIds.length) {
6591
+ return false;
6592
+ }
6593
+ // If there is a Change selected, Direction to is also required
6594
+ if (changeType && changeType !== 'NO_CHANGE' && !windDirectionTo) {
6595
+ return false;
6596
+ }
6597
+ if (windDirectionTo && changeType) {
6598
+ var result = validateWindDirectionChange(windDirectionFrom, windDirectionTo, changeType, config);
6599
+ return result !== 'error';
6600
+ }
6601
+ return true;
6602
+ };
6603
+ var isWarningsValid = function isWarningsValid(warnings, config) {
6604
+ // One single empty row is allowed, if not empty it should be valid
6605
+ if (warnings.length === 1) {
6606
+ return isWarningEmpty(warnings[0]) || isWarningValid(warnings[0], config);
6607
+ }
6608
+ return warnings.every(function (warning) {
6609
+ return !isWarningEmpty(warning) && isWarningValid(warning, config);
6610
+ });
6611
+ };
6612
+ var getLevelFromWindForce = function getLevelFromWindForce(maritimeConfig, windForce) {
6613
+ var _maritimeConfig$marit;
6614
+ var period = maritimeConfig.maritimeLevelDefinition.maritimeLevelsSummer ? 'maritimeLevelsSummer' : 'maritimeLevelsWinter';
6615
+ var levelInfo = (_maritimeConfig$marit = maritimeConfig.maritimeLevelDefinition) == null ? void 0 : _maritimeConfig$marit[period].find(function (level) {
6616
+ return (level == null ? void 0 : level.windForce) === windForce;
6617
+ });
6618
+ return (levelInfo == null ? void 0 : levelInfo.level) || 'extreme';
6619
+ };
6620
+ var getType = function getType(domain) {
6621
+ switch (domain) {
6622
+ case 'coastalWaters':
6623
+ return 'maritimeWarningCoastal';
6624
+ case 'northSeaDistricts':
6625
+ default:
6626
+ return 'maritimeWarningNorthSea';
6627
+ }
6628
+ };
6629
+ var mapItemsToMaritimeWarnings = function mapItemsToMaritimeWarnings(warnings, domain, maritimeConfig, editor) {
6630
+ var type = getType(domain);
6631
+ if (warnings.length === 1 && warnings[0].assignedAreaIds.length === 0) {
6632
+ // 1 warning without any areas means cancel/withdraw all warnings
6633
+ return [{
6634
+ type: type,
6635
+ editor: editor,
6636
+ status: PublicWarningStatus.PUBLISHED,
6637
+ warningDetail: {
6638
+ areas: [],
6639
+ domain: type
6640
+ }
6641
+ }];
6642
+ }
6643
+ return warnings.map(function (warning) {
6644
+ return {
6645
+ type: type,
6646
+ editor: editor,
6647
+ status: PublicWarningStatus.PUBLISHED,
6648
+ warningDetail: {
6649
+ phenomenon: 'wind',
6650
+ validFrom: new Date().toISOString(),
6651
+ validUntil: new Date(Date.now() + 24 * 60 * 60 * 1000).toISOString(),
6652
+ level: getLevelFromWindForce(maritimeConfig, warning.windForce || ''),
6653
+ probability: 100,
6654
+ areas: warning.assignedAreaIds.map(function (areaId) {
6655
+ var areaDetails = maritimeConfig.districtList[domain].find(function (district) {
6656
+ return district.districtName === areaId;
6657
+ });
6658
+ return {
6659
+ objectName: areaId,
6660
+ geoJSON: (areaDetails == null ? void 0 : areaDetails.geoJSON) || {
6661
+ type: 'FeatureCollection',
6662
+ features: []
6663
+ }
6664
+ };
6665
+ }),
6666
+ windDirectionFrom: warning.windDirectionFrom,
6667
+ windForce: warning.windForce,
6668
+ changeType: warning.changeType || 'NO_CHANGE',
6669
+ windDirectionTo: warning.windDirectionTo,
6670
+ descriptionOriginal: '',
6671
+ descriptionTranslation: '',
6672
+ domain: type
6673
+ }
6674
+ };
6675
+ });
6676
+ };
6677
+ var mapMaritimeWarningsToItems = function mapMaritimeWarningsToItems(warnings) {
6678
+ return warnings.map(function (warning) {
6679
+ var _warning$warningDetai;
6680
+ return {
6681
+ id: warning.id || '',
6682
+ assignedAreaIds: ((_warning$warningDetai = warning.warningDetail.areas) == null ? void 0 : _warning$warningDetai.map(function (area) {
6683
+ return area.objectName;
6684
+ })) || [],
6685
+ windDirectionFrom: warning.warningDetail.windDirectionFrom,
6686
+ windDirectionTo: warning.warningDetail.windDirectionTo,
6687
+ windForce: warning.warningDetail.windForce,
6688
+ changeType: warning.warningDetail.changeType,
6689
+ validFrom: warning.warningDetail.validFrom,
6690
+ validUntil: warning.warningDetail.validUntil
6691
+ };
6692
+ });
6693
+ };
6694
+ var getDegreesFromDirection = function getDegreesFromDirection(maritimeConfig, direction) {
6695
+ var _directionDefinition$;
6696
+ var directionDefinition = maritimeConfig.windDirectionDefinition.find(function (item) {
6697
+ return item.value === direction;
6698
+ });
6699
+ return (_directionDefinition$ = directionDefinition == null ? void 0 : directionDefinition.degrees) != null ? _directionDefinition$ : undefined;
6700
+ };
6701
+ var validateWindDirectionChange = function validateWindDirectionChange(directionFrom, directionTo, changeType, config) {
6702
+ if (!directionFrom || !directionTo || !changeType || !config || changeType === 'NO_CHANGE') {
6703
+ return true;
6704
+ }
6705
+ var directionFromDegrees = getDegreesFromDirection(config, directionFrom);
6706
+ var directionToDegrees = getDegreesFromDirection(config, directionTo);
6707
+ if (directionFromDegrees === undefined || directionToDegrees === undefined) {
6708
+ return true;
6709
+ }
6710
+ if (directionFromDegrees === directionToDegrees) {
6711
+ return 'error';
6712
+ }
6713
+ var max = config.validation.dirTo.max_wind_change;
6714
+ var min = config.validation.dirTo.min_wind_change;
6715
+ // Calculate the absolute angular difference (0-360)
6716
+ var diff = changeType === 'BACKING' ? (directionFromDegrees - directionToDegrees + 360) % 360 : (directionToDegrees - directionFromDegrees + 360) % 360;
6717
+ if (diff > max.value) {
6718
+ return max.level;
6719
+ }
6720
+ if (diff < min.value) {
6721
+ return min.level;
6722
+ }
6723
+ return true;
6724
+ };
6725
+
6726
+ var getWindDirectionsFromConfig = function getWindDirectionsFromConfig(directionConfig, t) {
6727
+ return directionConfig.map(function (direction) {
6728
+ return {
6729
+ value: direction.value,
6730
+ label: t("maritime-direction-" + direction.value) || direction.label
6311
6731
  };
6312
6732
  });
6313
6733
  };
@@ -6393,6 +6813,8 @@ var WarningListItem$1 = /*#__PURE__*/React__default.memo(function (_ref) {
6393
6813
  }, [warning.id, onAddClick]);
6394
6814
  var shouldDisableDirTo = warning.changeType === 'NO_CHANGE' || isReadOnly;
6395
6815
  var changeOptions = getChangeTypeFromConfig(maritimeConfig.changeType, t);
6816
+ var validationResult = validateWindDirectionChange(warning.windDirectionFrom, warning.windDirectionTo, warning.changeType, maritimeConfig);
6817
+ var showInfoIcon = validationResult !== true;
6396
6818
  return jsxs(StyledItem, {
6397
6819
  "data-testid": "maritime-warning",
6398
6820
  children: [!isReadOnly && jsx(WarningListDragHandle, {}), jsx(WarningListSelect, {
@@ -6440,7 +6862,8 @@ var WarningListItem$1 = /*#__PURE__*/React__default.memo(function (_ref) {
6440
6862
  });
6441
6863
  return typeof (option == null ? void 0 : option.label) === 'function' ? option.label(t) : option == null ? void 0 : option.label;
6442
6864
  },
6443
- displayEmpty: true
6865
+ displayEmpty: true,
6866
+ validationResult: validationResult
6444
6867
  }), jsx(WarningListSelect, {
6445
6868
  gridArea: "dirTo",
6446
6869
  label: t('maritime-header-direction-to'),
@@ -6448,7 +6871,24 @@ var WarningListItem$1 = /*#__PURE__*/React__default.memo(function (_ref) {
6448
6871
  onChange: handleChangeToDirection,
6449
6872
  value: warning.windDirectionTo,
6450
6873
  isReadOnly: shouldDisableDirTo
6451
- }), !isReadOnly && jsx(CustomIconButton, {
6874
+ }), showInfoIcon ? jsx(Box, {
6875
+ sx: {
6876
+ gridArea: 'info',
6877
+ justifySelf: 'left',
6878
+ height: '24px'
6879
+ },
6880
+ children: jsx(CustomTooltip, {
6881
+ title: t("maritime-wind-change-" + validationResult),
6882
+ children: jsx("span", {
6883
+ children: jsx(Info, {
6884
+ sx: {
6885
+ marginTop: 0.5,
6886
+ color: "geowebColors.functional." + validationResult
6887
+ }
6888
+ })
6889
+ })
6890
+ })
6891
+ }) : null, !isReadOnly && jsx(CustomIconButton, {
6452
6892
  sx: {
6453
6893
  gridArea: 'delete',
6454
6894
  justifySelf: 'end',
@@ -6480,10 +6920,10 @@ var StyledItem = styled('div')(function (_ref2) {
6480
6920
  gap: theme.spacing(0.5),
6481
6921
  paddingInline: theme.spacing(0.25),
6482
6922
  // styling for small windows
6483
- gridTemplateAreas: "\n \"drag dirFrom dirFrom windForce delete\"\n \". areas areas areas .\"\n \". changeType dirTo dirTo .\" \n ",
6484
- gridTemplateColumns: '20px minmax(87px, 1fr) 1fr minmax(60px, 1fr) 20px'
6923
+ gridTemplateAreas: "\n \"drag dirFrom dirFrom windForce windForce delete\"\n \". areas areas areas areas .\"\n \". changeType dirTo dirTo info .\" \n ",
6924
+ gridTemplateColumns: '16px minmax(82px, 1fr) 1fr minmax(60px, 1fr) 20px 20px'
6485
6925
  }, _ref3["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
6486
- gridTemplateAreas: "\n \"drag dirFrom windForce areas changeType dirTo delete\" \n ",
6926
+ gridTemplateAreas: "\n \"drag dirFrom windForce areas changeType dirTo info delete\" \n ",
6487
6927
  gridTemplateColumns: 'var(--grid-columns)'
6488
6928
  }, _ref3;
6489
6929
  });
@@ -6516,7 +6956,7 @@ var WarningList = function WarningList(_ref) {
6516
6956
  flexDirection: 'column',
6517
6957
  minHeight: 0,
6518
6958
  marginBottom: 1,
6519
- '--grid-columns': '30px 150px 60px 2fr 150px 150px 1fr'
6959
+ '--grid-columns': '16px 150px 60px 2fr 150px 150px 0.5fr 0.5fr'
6520
6960
  },
6521
6961
  children: [jsxs(Box, {
6522
6962
  sx: (_sx = {
@@ -6855,172 +7295,34 @@ function useConfirmDeleteDialog(_ref) {
6855
7295
  };
6856
7296
  }
6857
7297
 
6858
- /* *
6859
- * Licensed under the Apache License, Version 2.0 (the "License");
6860
- * you may not use this file except in compliance with the License.
6861
- * You may obtain a copy of the License at
6862
- *
6863
- * http://www.apache.org/licenses/LICENSE-2.0
6864
- *
6865
- * Unless required by applicable law or agreed to in writing, software
6866
- * distributed under the License is distributed on an "AS IS" BASIS,
6867
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
6868
- * See the License for the specific language governing permissions and
6869
- * limitations under the License.
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() === '';
6886
- });
6887
- };
6888
- var isWarningValid = function isWarningValid(item) {
6889
- var windDirectionFrom = item.windDirectionFrom,
6890
- windForce = item.windForce,
6891
- assignedAreaIds = item.assignedAreaIds,
6892
- changeType = item.changeType,
6893
- windDirectionTo = item.windDirectionTo;
6894
- // Direction, windspeed and areas are required.
6895
- if (!windDirectionFrom || !windForce || !assignedAreaIds.length) {
6896
- return false;
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);
7298
+ var MaritimeWarningAvatar = function MaritimeWarningAvatar(_ref) {
7299
+ var editor = _ref.editor,
7300
+ _ref$tooltipPlacement = _ref.tooltipPlacement,
7301
+ tooltipPlacement = _ref$tooltipPlacement === void 0 ? 'bottom' : _ref$tooltipPlacement;
7302
+ return jsx(CustomTooltip, {
7303
+ title: "Editor: " + editor,
7304
+ placement: tooltipPlacement,
7305
+ children: jsx("span", {
7306
+ children: jsx(Avatar, {
7307
+ size: "small",
7308
+ children: getInitials(editor)
7309
+ })
7310
+ })
6911
7311
  });
6912
7312
  };
6913
- var getLevelFromWindForce = function getLevelFromWindForce(maritimeConfig, windForce) {
6914
- var _maritimeConfig$marit;
6915
- var period = maritimeConfig.maritimeLevelDefinition.maritimeLevelsSummer ? 'maritimeLevelsSummer' : 'maritimeLevelsWinter';
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';
7313
+
7314
+ var spinnerSx$1 = {
7315
+ width: '16px!important',
7316
+ height: '16px!important',
7317
+ position: 'absolute',
7318
+ top: 0,
7319
+ bottom: 0,
7320
+ margin: 'auto',
7321
+ marginLeft: 1
6920
7322
  };
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 : '';
7323
+ var getWarningsValidity = function getWarningsValidity(t, warnings) {
7324
+ var validUntil = warnings.length > 0 && warnings[0].validUntil ? dateUtils.dateToString(dateUtils.createDate(warnings[0].validUntil), dateUtils.DATE_FORMAT_NAME_OF_DAY_MONTH) : '';
7325
+ return validUntil ? "" + t('maritime-warning-validuntil') + validUntil : '';
7024
7326
  };
7025
7327
  var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
7026
7328
  var _sx, _sx2, _sx3, _sx4;
@@ -7083,7 +7385,7 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
7083
7385
  }
7084
7386
  }, _callee);
7085
7387
  })), [onClear, t, showConfirmDialog]);
7086
- var isValid = isWarningsValid(warnings);
7388
+ var isValid = isWarningsValid(warnings, maritimeConfig);
7087
7389
  var onSwitchMode = /*#__PURE__*/function () {
7088
7390
  var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(event) {
7089
7391
  var checked, isReadOnly;
@@ -7614,173 +7916,6 @@ var MaritimeWarningsFormConnect = function MaritimeWarningsFormConnect(_ref) {
7614
7916
  });
7615
7917
  };
7616
7918
 
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
7919
  var _excluded$3 = ["IS_DRAFT", "object", "translation-select"];
7785
7920
  var useScrollTopOnError = function useScrollTopOnError(error) {
7786
7921
  var ref = React.useRef(null);
@@ -8044,11 +8179,8 @@ var Form = function Form(_ref5) {
8044
8179
  isPublishing = _React$useState[0],
8045
8180
  setIsPublishing = _React$useState[1];
8046
8181
  var _React$useState2 = React.useState(false),
8047
- isCancelling = _React$useState2[0],
8048
- setIsCancelling = _React$useState2[1];
8049
- var _React$useState3 = React.useState(false),
8050
- isSaving = _React$useState3[0],
8051
- setIsSaving = _React$useState3[1];
8182
+ isSaving = _React$useState2[0],
8183
+ setIsSaving = _React$useState2[1];
8052
8184
  var _useTACApi = useTACApi(),
8053
8185
  fetchSigmetTAC = _useTACApi.fetchSigmetTAC,
8054
8186
  fetchAirmetTAC = _useTACApi.fetchAirmetTAC;
@@ -8077,12 +8209,12 @@ var Form = function Form(_ref5) {
8077
8209
  };
8078
8210
  }, [endOfWarningValidity, formState, onCloseForm]);
8079
8211
  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$useState4 = React.useState(initialPublicWarningArea),
8081
- warningGeoJSONFeature = _React$useState4[0],
8082
- setWarningGeoJSONFeature = _React$useState4[1];
8083
- var _React$useState5 = React.useState(publicWarningDetails == null ? void 0 : publicWarningDetails.areas),
8084
- originalWarningAreas = _React$useState5[0],
8085
- setOriginalWarningAreas = _React$useState5[1];
8212
+ var _React$useState3 = React.useState(initialPublicWarningArea),
8213
+ warningGeoJSONFeature = _React$useState3[0],
8214
+ setWarningGeoJSONFeature = _React$useState3[1];
8215
+ var _React$useState4 = React.useState(publicWarningDetails == null ? void 0 : publicWarningDetails.areas),
8216
+ originalWarningAreas = _React$useState4[0],
8217
+ setOriginalWarningAreas = _React$useState4[1];
8086
8218
  var _useWarningsTranslati = useWarningsTranslation(),
8087
8219
  t = _useWarningsTranslati.t;
8088
8220
  var _useFormContext = useFormContext(),
@@ -8164,12 +8296,7 @@ var Form = function Form(_ref5) {
8164
8296
  confirmLabel: getConfirmationDialogButtonLabel(t, action, warningType || 'airmet'),
8165
8297
  cancelLabel: getConfirmationDialogCancelLabel(t, action),
8166
8298
  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, {
8299
+ content: isVAPhenomenon(selectedAviationProduct, action) && !isShortTest() ? jsx(FormProvider, Object.assign({}, formMethods, {
8173
8300
  children: jsx(CancelSigmetVolcanicMovements, {
8174
8301
  sigmet: selectedAviationProduct,
8175
8302
  productConfig: aviationConfig
@@ -8199,9 +8326,6 @@ var Form = function Form(_ref5) {
8199
8326
  };
8200
8327
  }();
8201
8328
  var getPublishButtonLabel = function getPublishButtonLabel() {
8202
- if (isCancelling) {
8203
- return t('cancelling');
8204
- }
8205
8329
  if (isPublishing) {
8206
8330
  return t('warning-button-publishing');
8207
8331
  }
@@ -8225,7 +8349,7 @@ var Form = function Form(_ref5) {
8225
8349
  return _context0.abrupt("return");
8226
8350
  case 2:
8227
8351
  _context0.t0 = action;
8228
- _context0.next = _context0.t0 === ProductAction.SAVE ? 5 : _context0.t0 === ProductAction.PUBLISH ? 14 : _context0.t0 === ProductAction.CANCEL ? 17 : _context0.t0 === ProductAction.AMEND ? 19 : _context0.t0 === ProductAction.RENEW ? 21 : _context0.t0 === ProductAction.DISCARD ? 21 : _context0.t0 === ProductAction.DUPLICATE ? 21 : _context0.t0 === ProductAction.CLOSE ? 21 : 22;
8352
+ _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
8353
  break;
8230
8354
  case 5:
8231
8355
  toggleIsDraft(true);
@@ -8244,7 +8368,7 @@ var Form = function Form(_ref5) {
8244
8368
  })["catch"](function () {});
8245
8369
  case 12:
8246
8370
  setIsSaving(false);
8247
- return _context0.abrupt("break", 23);
8371
+ return _context0.abrupt("break", 21);
8248
8372
  case 14:
8249
8373
  toggleIsDraft(false);
8250
8374
  void handleSubmit(/*#__PURE__*/function () {
@@ -8279,17 +8403,8 @@ var Form = function Form(_ref5) {
8279
8403
  return _ref11.apply(this, arguments);
8280
8404
  };
8281
8405
  }())();
8282
- return _context0.abrupt("break", 23);
8406
+ return _context0.abrupt("break", 21);
8283
8407
  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
8408
  void handleSubmit(/*#__PURE__*/function () {
8294
8409
  var _ref13 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(formValues) {
8295
8410
  return _regeneratorRuntime().wrap(function _callee9$(_context9) {
@@ -8322,12 +8437,12 @@ var Form = function Form(_ref5) {
8322
8437
  return _ref13.apply(this, arguments);
8323
8438
  };
8324
8439
  }())();
8325
- return _context0.abrupt("break", 23);
8326
- case 21:
8327
- return _context0.abrupt("break", 23);
8328
- case 22:
8440
+ return _context0.abrupt("break", 21);
8441
+ case 19:
8442
+ return _context0.abrupt("break", 21);
8443
+ case 20:
8329
8444
  console.warn("Unhandled product action: " + action);
8330
- case 23:
8445
+ case 21:
8331
8446
  case "end":
8332
8447
  return _context0.stop();
8333
8448
  }
@@ -8716,7 +8831,7 @@ var Form = function Form(_ref5) {
8716
8831
  sx: {
8717
8832
  width: '100%'
8718
8833
  },
8719
- disabled: isPublishing || isCancelling,
8834
+ disabled: isPublishing,
8720
8835
  onClick: function onClick() {
8721
8836
  void (selectedAviationProduct ? handleSubmitAviationProduct(ProductAction.CANCEL, warningType) : onPressPublish());
8722
8837
  },
@@ -8724,7 +8839,7 @@ var Form = function Form(_ref5) {
8724
8839
  style: {
8725
8840
  position: 'relative'
8726
8841
  },
8727
- children: [getPublishButtonLabel(), (isPublishing || isCancelling) && jsx(CircularProgress, {
8842
+ children: [getPublishButtonLabel(), isPublishing && jsx(CircularProgress, {
8728
8843
  "data-testid": "spinner",
8729
8844
  color: "inherit",
8730
8845
  sx: spinnerSx
@@ -9828,6 +9943,7 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
9828
9943
  var isFormDirty = useSelector(function (store) {
9829
9944
  return getSelectedPublicIsFormDirty(store);
9830
9945
  });
9946
+ usePreventBrowserClose(isFormDirty);
9831
9947
  var publicWarningState = useSelector(getPublicWarning);
9832
9948
  var _ref2 = publicWarningState || {},
9833
9949
  status = _ref2.status,
@@ -11412,34 +11528,109 @@ var PublicWarningList = function PublicWarningList(_ref) {
11412
11528
  });
11413
11529
  };
11414
11530
 
11415
- /* *
11416
- * Licensed under the Apache License, Version 2.0 (the "License");
11417
- * you may not use this file except in compliance with the License.
11418
- * You may obtain a copy of the License at
11419
- *
11420
- * http://www.apache.org/licenses/LICENSE-2.0
11421
- *
11422
- * Unless required by applicable law or agreed to in writing, software
11423
- * distributed under the License is distributed on an "AS IS" BASIS,
11424
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11425
- * See the License for the specific language governing permissions and
11426
- * limitations under the License.
11427
- *
11428
- * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
11429
- * Copyright 2023 - Finnish Meteorological Institute (FMI)
11430
- * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
11431
- * */
11432
- var getPublicWarningsStore = function getPublicWarningsStore(store) {
11433
- if (store && store.publicWarnings) {
11434
- return store.publicWarnings;
11435
- }
11436
- return null;
11437
- };
11438
- var _publicWarningsAdapte = publicWarningsAdapter.getSelectors(function (state) {
11439
- var _state$publicWarnings, _state$publicWarnings2;
11440
- return (_state$publicWarnings = state == null || (_state$publicWarnings2 = state.publicWarnings) == null ? void 0 : _state$publicWarnings2.warnings) != null ? _state$publicWarnings : {
11441
- entities: {},
11442
- ids: []
11531
+ var ConfirmDeleteWarningDialog = function ConfirmDeleteWarningDialog(_ref) {
11532
+ var _ref$onClose = _ref.onClose,
11533
+ onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
11534
+ title = _ref.title,
11535
+ description = _ref.description,
11536
+ request = _ref.request,
11537
+ confirmLabel = _ref.confirmLabel,
11538
+ callback = _ref.callback,
11539
+ isLocked = _ref.isLocked;
11540
+ var _useWarningsTranslati = useWarningsTranslation(),
11541
+ t = _useWarningsTranslati.t;
11542
+ var defaultError = isLocked ? t('warning-dialog-delete-islocked') : undefined;
11543
+ var _React$useState = React__default.useState(false),
11544
+ isLoading = _React$useState[0],
11545
+ setIsLoading = _React$useState[1];
11546
+ var _React$useState2 = React__default.useState(defaultError),
11547
+ error = _React$useState2[0],
11548
+ setError = _React$useState2[1];
11549
+ var onSubmit = /*#__PURE__*/function () {
11550
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
11551
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
11552
+ while (1) switch (_context.prev = _context.next) {
11553
+ case 0:
11554
+ setIsLoading(true);
11555
+ _context.prev = 1;
11556
+ _context.next = 4;
11557
+ return request();
11558
+ case 4:
11559
+ callback && callback();
11560
+ setIsLoading(false);
11561
+ _context.next = 12;
11562
+ break;
11563
+ case 8:
11564
+ _context.prev = 8;
11565
+ _context.t0 = _context["catch"](1);
11566
+ setError(getAxiosErrorMessage(_context.t0));
11567
+ setIsLoading(false);
11568
+ case 12:
11569
+ case "end":
11570
+ return _context.stop();
11571
+ }
11572
+ }, _callee, null, [[1, 8]]);
11573
+ }));
11574
+ return function onSubmit() {
11575
+ return _ref2.apply(this, arguments);
11576
+ };
11577
+ }();
11578
+ return jsx(ConfirmationDialog, Object.assign({
11579
+ title: title,
11580
+ open: true,
11581
+ confirmLabel: confirmLabel,
11582
+ cancelLabel: t('warning-dialog-cancel'),
11583
+ description: !error ? description : '',
11584
+ onClose: onClose,
11585
+ onSubmit: onSubmit,
11586
+ isLoading: isLoading
11587
+ }, error && {
11588
+ content: jsxs(Box, {
11589
+ sx: {
11590
+ marginBottom: 0
11591
+ },
11592
+ children: [jsx(AlertBanner, {
11593
+ title: error,
11594
+ severity: isLocked ? 'warning' : 'error'
11595
+ }), jsx(Typography, {
11596
+ variant: "body1",
11597
+ sx: {
11598
+ marginTop: 1
11599
+ },
11600
+ children: description
11601
+ })]
11602
+ })
11603
+ }));
11604
+ };
11605
+
11606
+ /* *
11607
+ * Licensed under the Apache License, Version 2.0 (the "License");
11608
+ * you may not use this file except in compliance with the License.
11609
+ * You may obtain a copy of the License at
11610
+ *
11611
+ * http://www.apache.org/licenses/LICENSE-2.0
11612
+ *
11613
+ * Unless required by applicable law or agreed to in writing, software
11614
+ * distributed under the License is distributed on an "AS IS" BASIS,
11615
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11616
+ * See the License for the specific language governing permissions and
11617
+ * limitations under the License.
11618
+ *
11619
+ * Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
11620
+ * Copyright 2023 - Finnish Meteorological Institute (FMI)
11621
+ * Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
11622
+ * */
11623
+ var getPublicWarningsStore = function getPublicWarningsStore(store) {
11624
+ if (store && store.publicWarnings) {
11625
+ return store.publicWarnings;
11626
+ }
11627
+ return null;
11628
+ };
11629
+ var _publicWarningsAdapte = publicWarningsAdapter.getSelectors(function (state) {
11630
+ var _state$publicWarnings, _state$publicWarnings2;
11631
+ return (_state$publicWarnings = state == null || (_state$publicWarnings2 = state.publicWarnings) == null ? void 0 : _state$publicWarnings2.warnings) != null ? _state$publicWarnings : {
11632
+ entities: {},
11633
+ ids: []
11443
11634
  };
11444
11635
  }),
11445
11636
  selectAllPublicWarnings = _publicWarningsAdapte.selectAll;
@@ -11668,79 +11859,232 @@ var useWarningFilters = function useWarningFilters(warnings, onUpdateFilters, sa
11668
11859
  };
11669
11860
  };
11670
11861
 
11671
- var ConfirmDeleteWarningDialog = function ConfirmDeleteWarningDialog(_ref) {
11672
- var _ref$onClose = _ref.onClose,
11673
- onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
11674
- title = _ref.title,
11675
- description = _ref.description,
11676
- request = _ref.request,
11677
- confirmLabel = _ref.confirmLabel,
11678
- callback = _ref.callback,
11679
- isLocked = _ref.isLocked;
11862
+ var CancelAviationDialogContent = function CancelAviationDialogContent(_ref) {
11863
+ var _cancelQuery$data$dat, _cancelQuery$data, _currentQuery$data$da, _currentQuery$data, _t;
11864
+ var product = _ref.product,
11865
+ warningType = _ref.warningType,
11866
+ errorMessage = _ref.errorMessage;
11680
11867
  var _useWarningsTranslati = useWarningsTranslation(),
11681
11868
  t = _useWarningsTranslati.t;
11682
- var defaultError = isLocked ? t('warning-dialog-delete-islocked') : undefined;
11683
- var _React$useState = React__default.useState(false),
11684
- isLoading = _React$useState[0],
11685
- setIsLoading = _React$useState[1];
11686
- var _React$useState2 = React__default.useState(defaultError),
11687
- error = _React$useState2[0],
11688
- setError = _React$useState2[1];
11689
- var onSubmit = /*#__PURE__*/function () {
11869
+ var isSigmet = warningType === 'sigmet';
11870
+ var enabled = !!(product != null && product.uuid);
11871
+ // Only run the two queries we actually need
11872
+ var sigCancel = useFetchSigmetCancelTAC(product, isSigmet && enabled);
11873
+ var airCancel = useFetchAirmetCancelTAC(product, !isSigmet && enabled);
11874
+ var sigCurrent = useFetchSigmetTAC(product, isSigmet && enabled);
11875
+ var airCurrent = useFetchAirmetTAC(product, !isSigmet && enabled);
11876
+ // Pick active queries per warning type
11877
+ var cancelQuery = isSigmet ? sigCancel : airCancel;
11878
+ var currentQuery = isSigmet ? sigCurrent : airCurrent;
11879
+ // Derived TAC strings
11880
+ var cancelTAC = (_cancelQuery$data$dat = (_cancelQuery$data = cancelQuery.data) == null ? void 0 : _cancelQuery$data.data) != null ? _cancelQuery$data$dat : null;
11881
+ var currentTAC = (_currentQuery$data$da = (_currentQuery$data = currentQuery.data) == null ? void 0 : _currentQuery$data.data) != null ? _currentQuery$data$da : null;
11882
+ // Per-section loading/error
11883
+ var isLoadingCancel = cancelQuery.isLoading || !enabled;
11884
+ var isLoadingCurrent = currentQuery.isLoading || !enabled;
11885
+ var isErrorCancel = !!cancelQuery.error;
11886
+ var isErrorCurrent = !!currentQuery.error;
11887
+ var loadingLabel = (_t = t('loading')) != null ? _t : 'Loading...';
11888
+ var noTacLabel = t('tac-missing-data');
11889
+ var COLLAPSED = 90; // px
11890
+ var tacBlockStyle = {
11891
+ whiteSpace: 'pre-wrap',
11892
+ wordBreak: 'break-word',
11893
+ overflowX: 'auto',
11894
+ overflowY: 'auto',
11895
+ maxWidth: '100%',
11896
+ fontFamily: 'monospace',
11897
+ fontSize: '0.9rem',
11898
+ lineHeight: 1.4
11899
+ };
11900
+ var renderPre = function renderPre(text) {
11901
+ return jsx(Box, {
11902
+ component: "pre",
11903
+ sx: tacBlockStyle,
11904
+ children: text
11905
+ });
11906
+ };
11907
+ var renderTacWithSequence = function renderTacWithSequence(tac, noTacKey, prod) {
11908
+ if (!tac) {
11909
+ return jsx(Box, {
11910
+ component: "pre",
11911
+ sx: tacBlockStyle,
11912
+ children: t(noTacKey)
11913
+ });
11914
+ }
11915
+ var noTac = t(noTacKey);
11916
+ var hasTac = tac.split('\n').length > 0 && tac !== noTac;
11917
+ var sequenceNumberInTac = findSequenceNumber(tac, noTac);
11918
+ var sequenceStyle = getSequenceStyling(prod, hasTac);
11919
+ var words = tac.split(' ');
11920
+ return jsx(Box, {
11921
+ component: "pre",
11922
+ sx: tacBlockStyle,
11923
+ children: words.map(function (word, i) {
11924
+ return jsx(Box, {
11925
+ component: "span",
11926
+ sx: hasTac && word === sequenceNumberInTac ? sequenceStyle : {},
11927
+ children: word + (i < words.length - 1 ? ' ' : '')
11928
+ }, word + "-" + i);
11929
+ })
11930
+ });
11931
+ };
11932
+ var cancelContent;
11933
+ if (isLoadingCancel) {
11934
+ cancelContent = renderPre(loadingLabel);
11935
+ } else if (isErrorCancel) {
11936
+ cancelContent = renderPre(noTacLabel);
11937
+ } else {
11938
+ cancelContent = renderTacWithSequence(cancelTAC, 'tac-missing-data');
11939
+ }
11940
+ var currentContent;
11941
+ if (isLoadingCurrent) {
11942
+ currentContent = renderPre(loadingLabel);
11943
+ } else if (isErrorCurrent) {
11944
+ currentContent = renderPre(noTacLabel);
11945
+ } else {
11946
+ currentContent = jsx(Box, {
11947
+ component: "pre",
11948
+ sx: tacBlockStyle,
11949
+ children: currentTAC != null ? currentTAC : noTacLabel
11950
+ });
11951
+ }
11952
+ return jsxs(Box, {
11953
+ sx: {
11954
+ width: 500,
11955
+ maxWidth: 600
11956
+ },
11957
+ children: [jsx(Typography, {
11958
+ fontWeight: "medium",
11959
+ variant: "inherit",
11960
+ children: t('cancel-message')
11961
+ }), jsx("div", {
11962
+ style: {
11963
+ display: 'flex',
11964
+ paddingLeft: 12
11965
+ },
11966
+ children: jsx(Collapse, {
11967
+ collapsedSize: COLLAPSED,
11968
+ easing: "ease",
11969
+ "in": true,
11970
+ timeout: 200,
11971
+ children: cancelContent
11972
+ })
11973
+ }), jsx(Typography, {
11974
+ fontWeight: "medium",
11975
+ variant: "inherit",
11976
+ children: t('will-cancel-message')
11977
+ }), jsx("div", {
11978
+ style: {
11979
+ display: 'flex',
11980
+ paddingLeft: 12
11981
+ },
11982
+ children: jsx(Collapse, {
11983
+ collapsedSize: COLLAPSED,
11984
+ easing: "ease",
11985
+ "in": true,
11986
+ timeout: 200,
11987
+ children: currentContent
11988
+ })
11989
+ }), errorMessage ? jsx(Box, {
11990
+ sx: {
11991
+ marginBottom: 2
11992
+ },
11993
+ children: jsx(AlertBanner, {
11994
+ title: errorMessage,
11995
+ shouldClose: true
11996
+ })
11997
+ }) : null]
11998
+ });
11999
+ };
12000
+
12001
+ var CancelAviationConfirmDialog = function CancelAviationConfirmDialog(_ref) {
12002
+ var open = _ref.open,
12003
+ type = _ref.type,
12004
+ product = _ref.product,
12005
+ showVA = _ref.showVA,
12006
+ aviationConfig = _ref.aviationConfig,
12007
+ sigmet = _ref.sigmet,
12008
+ confirmLabel = _ref.confirmLabel,
12009
+ title = _ref.title,
12010
+ onClose = _ref.onClose,
12011
+ cancelAviationProduct = _ref.cancelAviationProduct,
12012
+ onSuccess = _ref.onSuccess;
12013
+ var _React$useState = React__default.useState(null),
12014
+ errorMsg = _React$useState[0],
12015
+ setErrorMsg = _React$useState[1];
12016
+ var _React$useState2 = React__default.useState(false),
12017
+ isSubmitting = _React$useState2[0],
12018
+ setIsSubmitting = _React$useState2[1];
12019
+ var vaForm = useForm({
12020
+ mode: 'onChange',
12021
+ defaultValues: {}
12022
+ });
12023
+ var handleSubmit = /*#__PURE__*/function () {
11690
12024
  var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
11691
12025
  return _regeneratorRuntime().wrap(function _callee$(_context) {
11692
12026
  while (1) switch (_context.prev = _context.next) {
11693
12027
  case 0:
11694
- setIsLoading(true);
11695
- _context.prev = 1;
11696
- _context.next = 4;
11697
- return request();
11698
- case 4:
11699
- callback && callback();
11700
- setIsLoading(false);
11701
- _context.next = 12;
12028
+ setIsSubmitting(true);
12029
+ setErrorMsg(null);
12030
+ _context.prev = 2;
12031
+ _context.next = 5;
12032
+ return cancelAviationProduct(product, type);
12033
+ case 5:
12034
+ setIsSubmitting(false);
12035
+ onSuccess == null || onSuccess();
12036
+ onClose();
12037
+ _context.next = 14;
11702
12038
  break;
11703
- case 8:
11704
- _context.prev = 8;
11705
- _context.t0 = _context["catch"](1);
11706
- setError(getAxiosErrorMessage(_context.t0));
11707
- setIsLoading(false);
11708
- case 12:
12039
+ case 10:
12040
+ _context.prev = 10;
12041
+ _context.t0 = _context["catch"](2);
12042
+ setIsSubmitting(false);
12043
+ setErrorMsg("Failed to cancel " + type.toUpperCase() + ": " + humanizeApiErrorMessage(_context.t0));
12044
+ case 14:
11709
12045
  case "end":
11710
12046
  return _context.stop();
11711
12047
  }
11712
- }, _callee, null, [[1, 8]]);
12048
+ }, _callee, null, [[2, 10]]);
11713
12049
  }));
11714
- return function onSubmit() {
12050
+ return function handleSubmit() {
11715
12051
  return _ref2.apply(this, arguments);
11716
12052
  };
11717
12053
  }();
11718
- return jsx(ConfirmationDialog, Object.assign({
12054
+ return jsxs(CustomDialog, {
12055
+ "data-testid": "cancel-aviation-dialog",
11719
12056
  title: title,
11720
- open: true,
11721
- confirmLabel: confirmLabel,
11722
- cancelLabel: t('warning-dialog-cancel'),
11723
- description: !error ? description : '',
12057
+ description: "",
12058
+ open: open,
11724
12059
  onClose: onClose,
11725
- onSubmit: onSubmit,
11726
- isLoading: isLoading
11727
- }, error && {
11728
- content: jsxs(Box, {
11729
- sx: {
11730
- marginBottom: 0
11731
- },
11732
- children: [jsx(AlertBanner, {
11733
- title: error,
11734
- severity: isLocked ? 'warning' : 'error'
11735
- }), jsx(Typography, {
11736
- variant: "body1",
12060
+ isResizable: true,
12061
+ resizableDefaultSize: {
12062
+ width: 560,
12063
+ height: 'auto'
12064
+ },
12065
+ actions: jsx(ConfirmationButtons, {
12066
+ confirmLabel: confirmLabel,
12067
+ cancelLabel: "Close",
12068
+ isLoading: isSubmitting,
12069
+ onSubmit: handleSubmit,
12070
+ onClose: onClose
12071
+ }),
12072
+ children: [jsx(CancelAviationDialogContent, {
12073
+ product: product,
12074
+ warningType: type,
12075
+ errorMessage: errorMsg != null ? errorMsg : undefined
12076
+ }), showVA ? jsxs(FormProvider, Object.assign({}, vaForm, {
12077
+ children: [jsx(Box, {
12078
+ component: "hr",
11737
12079
  sx: {
11738
- marginTop: 1
11739
- },
11740
- children: description
12080
+ my: 1
12081
+ }
12082
+ }), jsx(CancelSigmetVolcanicMovements, {
12083
+ productConfig: aviationConfig,
12084
+ sigmet: sigmet
11741
12085
  })]
11742
- })
11743
- }));
12086
+ })) : null]
12087
+ });
11744
12088
  };
11745
12089
 
11746
12090
  var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
@@ -11868,14 +12212,28 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
11868
12212
  confirmLabel: t('warning-dialog-expire-confirm'),
11869
12213
  title: t('warning-dialog-expire-title'),
11870
12214
  description: t('warning-dialog-expire-description'),
11871
- request: function request() {
11872
- return saveWarning({
11873
- id: expiredWarning.id,
11874
- data: Object.assign({}, expiredWarning, {
11875
- type: 'public'
11876
- })
11877
- });
11878
- },
12215
+ request: function () {
12216
+ var _request = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
12217
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
12218
+ while (1) switch (_context3.prev = _context3.next) {
12219
+ case 0:
12220
+ return _context3.abrupt("return", saveWarning({
12221
+ id: expiredWarning.id,
12222
+ data: Object.assign({}, expiredWarning, {
12223
+ type: 'public'
12224
+ })
12225
+ }));
12226
+ case 1:
12227
+ case "end":
12228
+ return _context3.stop();
12229
+ }
12230
+ }, _callee3);
12231
+ }));
12232
+ function request() {
12233
+ return _request.apply(this, arguments);
12234
+ }
12235
+ return request;
12236
+ }(),
11879
12237
  callback: function callback() {
11880
12238
  return onRemoveSuccess(expiredWarning.id, t('warning-dialog-expire-succes'));
11881
12239
  }
@@ -11889,14 +12247,28 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
11889
12247
  confirmLabel: t('warning-dialog-withdraw-confirm'),
11890
12248
  title: t('warning-dialog-withdraw-title'),
11891
12249
  description: t('warning-dialog-withdraw-description'),
11892
- request: function request() {
11893
- return saveWarning({
11894
- id: withdrawnWarning.id,
11895
- data: Object.assign({}, withdrawnWarning, {
11896
- type: 'public'
11897
- })
11898
- });
11899
- },
12250
+ request: function () {
12251
+ var _request2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
12252
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
12253
+ while (1) switch (_context4.prev = _context4.next) {
12254
+ case 0:
12255
+ return _context4.abrupt("return", saveWarning({
12256
+ id: withdrawnWarning.id,
12257
+ data: Object.assign({}, withdrawnWarning, {
12258
+ type: 'public'
12259
+ })
12260
+ }));
12261
+ case 1:
12262
+ case "end":
12263
+ return _context4.stop();
12264
+ }
12265
+ }, _callee4);
12266
+ }));
12267
+ function request() {
12268
+ return _request2.apply(this, arguments);
12269
+ }
12270
+ return request;
12271
+ }(),
11900
12272
  callback: function callback() {
11901
12273
  return onRemoveSuccess(withdrawnWarning.id, t('warning-dialog-withdraw-succes'));
11902
12274
  }
@@ -11910,48 +12282,89 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
11910
12282
  postSigmet = _usePostSigmet.mutateAsync;
11911
12283
  var _usePostAirmet = usePostAirmet(),
11912
12284
  postAirmet = _usePostAirmet.mutateAsync;
11913
- var deleteAviationProduct = /*#__PURE__*/function () {
11914
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(productToPost, newStatus, warningType) {
11915
- var uuid, _postProductParam, postProductParam, errorMessage;
11916
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
11917
- while (1) switch (_context3.prev = _context3.next) {
12285
+ var aviationWarnings = useAviationWarnings();
12286
+ var selectedBackendProduct = React__default.useMemo(function () {
12287
+ return aviationWarnings.find(function (aviationProduct) {
12288
+ return aviationProduct.uuid === selectedWarningId;
12289
+ });
12290
+ }, [aviationWarnings, selectedWarningId]);
12291
+ var postAviationProduct = /*#__PURE__*/function () {
12292
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(productToPost, newStatus, type, opts) {
12293
+ var _productToPost$uuid, _opts$vaSigmetMoveToF;
12294
+ var uuid, body, _param, param;
12295
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
12296
+ while (1) switch (_context5.prev = _context5.next) {
11918
12297
  case 0:
11919
- _context3.prev = 0;
11920
- uuid = (productToPost == null ? void 0 : productToPost.sigmetAirmetDetails.uuid) || null;
11921
- if (!(warningType === 'sigmet')) {
11922
- _context3.next = 7;
12298
+ uuid = (_productToPost$uuid = productToPost == null ? void 0 : productToPost.uuid) != null ? _productToPost$uuid : null;
12299
+ body = newStatus === 'CANCELLED' && selectedBackendProduct ? getCancelSigmet(selectedBackendProduct, (_opts$vaSigmetMoveToF = opts == null ? void 0 : opts.vaSigmetMoveToFIR) != null ? _opts$vaSigmetMoveToF : 'UNKNOWN') : productToPost;
12300
+ if (!(type === 'sigmet')) {
12301
+ _context5.next = 5;
11923
12302
  break;
11924
12303
  }
11925
- _postProductParam = createSigmetPostParameter(productToPost.sigmetAirmetDetails, newStatus, uuid);
11926
- _context3.next = 6;
11927
- return postSigmet(_postProductParam);
11928
- case 6:
11929
- return _context3.abrupt("return", _context3.sent);
12304
+ _param = createSigmetPostParameter(body, newStatus, uuid);
12305
+ return _context5.abrupt("return", postSigmet(_param));
12306
+ case 5:
12307
+ param = createAirmetPostParameter(body, newStatus, uuid);
12308
+ return _context5.abrupt("return", postAirmet(param));
11930
12309
  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
12310
  case "end":
11947
- return _context3.stop();
12311
+ return _context5.stop();
11948
12312
  }
11949
- }, _callee3, null, [[0, 13]]);
12313
+ }, _callee5);
11950
12314
  }));
11951
- return function deleteAviationProduct(_x5, _x6, _x7) {
12315
+ return function postAviationProduct(_x5, _x6, _x7, _x8) {
11952
12316
  return _ref4.apply(this, arguments);
11953
12317
  };
11954
12318
  }();
12319
+ var getCancelSigmet = function getCancelSigmet(selectedProduct, vaSigmetMoveToFIR) {
12320
+ if ('sigmet' in selectedProduct) {
12321
+ return prepareCancelSigmet(selectedProduct.sigmet, vaSigmetMoveToFIR != null ? vaSigmetMoveToFIR : 'UNKNOWN');
12322
+ }
12323
+ return selectedProduct.airmet;
12324
+ };
12325
+ var _cancelAviationProduct = /*#__PURE__*/function () {
12326
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(warning, type) {
12327
+ var result;
12328
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
12329
+ while (1) switch (_context6.prev = _context6.next) {
12330
+ case 0:
12331
+ _context6.next = 2;
12332
+ return postAviationProduct(warning, 'CANCELLED', type);
12333
+ case 2:
12334
+ result = _context6.sent;
12335
+ return _context6.abrupt("return", result != null ? result : null);
12336
+ case 4:
12337
+ case "end":
12338
+ return _context6.stop();
12339
+ }
12340
+ }, _callee6);
12341
+ }));
12342
+ return function cancelAviationProduct(_x9, _x0) {
12343
+ return _ref5.apply(this, arguments);
12344
+ };
12345
+ }();
12346
+ var _React$useState2 = React__default.useState(false),
12347
+ cancelOpen = _React$useState2[0],
12348
+ setCancelOpen = _React$useState2[1];
12349
+ var _React$useState3 = React__default.useState(null),
12350
+ cancelCtx = _React$useState3[0],
12351
+ setCancelCtx = _React$useState3[1];
12352
+ var openCancelDialog = function openCancelDialog(warning) {
12353
+ var type = warning.warningDetail.level === 'SIG' ? 'sigmet' : 'airmet';
12354
+ var product = warning.sigmetAirmetDetails;
12355
+ var showVA = isVAPhenomenon(warning.sigmetAirmetDetails, ProductAction.CANCEL);
12356
+ setCancelCtx({
12357
+ type: type,
12358
+ product: product,
12359
+ showVA: showVA,
12360
+ sigmet: warning.sigmetAirmetDetails
12361
+ });
12362
+ setCancelOpen(true);
12363
+ };
12364
+ var closeCancelDialog = function closeCancelDialog() {
12365
+ setCancelOpen(false);
12366
+ setCancelCtx(null);
12367
+ };
11955
12368
  var handleAviationProductClick = function handleAviationProductClick(warning, actionType) {
11956
12369
  if (!warning) {
11957
12370
  return;
@@ -11970,19 +12383,38 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
11970
12383
  updatedWarning = duplicateAviationProduct(warning);
11971
12384
  void openPublicWarningDialog('edit', updatedWarning, type);
11972
12385
  break;
11973
- case 'CANCEL':
11974
- void openPublicWarningDialog('cancel', warning, type);
11975
- break;
12386
+ case ProductAction.CANCEL:
12387
+ {
12388
+ openCancelDialog(warning);
12389
+ break;
12390
+ }
11976
12391
  case 'DISCARD':
11977
12392
  {
11978
- var isLocked = warning.editor && warning.editor !== (auth == null ? void 0 : auth.username) || false;
12393
+ var _warning$editor, _auth$username;
12394
+ var editor = (_warning$editor = warning.editor) != null ? _warning$editor : '';
12395
+ var currentUser = (_auth$username = auth == null ? void 0 : auth.username) != null ? _auth$username : '';
12396
+ var isLocked = editor !== '' && editor !== currentUser;
11979
12397
  setConfirmDialogOptions({
11980
12398
  confirmLabel: t('warning-dialog-delete-confirm'),
11981
12399
  title: t('warning-dialog-delete-title'),
11982
12400
  description: t('warning-dialog-delete-description'),
11983
- request: function request() {
11984
- return deleteAviationProduct(warning, 'DISCARDED', type);
11985
- },
12401
+ request: function () {
12402
+ var _request3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
12403
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
12404
+ while (1) switch (_context7.prev = _context7.next) {
12405
+ case 0:
12406
+ return _context7.abrupt("return", postAviationProduct(warning.sigmetAirmetDetails, 'DISCARDED', type));
12407
+ case 1:
12408
+ case "end":
12409
+ return _context7.stop();
12410
+ }
12411
+ }, _callee7);
12412
+ }));
12413
+ function request() {
12414
+ return _request3.apply(this, arguments);
12415
+ }
12416
+ return request;
12417
+ }(),
11986
12418
  callback: function callback() {
11987
12419
  return onRemoveSuccess(warning.id);
11988
12420
  },
@@ -11993,38 +12425,38 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
11993
12425
  }
11994
12426
  };
11995
12427
  var editMaritimeWarning = /*#__PURE__*/function () {
11996
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(warning) {
11997
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
11998
- while (1) switch (_context4.prev = _context4.next) {
12428
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(warning) {
12429
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
12430
+ while (1) switch (_context8.prev = _context8.next) {
11999
12431
  case 0:
12000
12432
  if (!(warning && auth != null && auth.username && !warning.editor)) {
12001
- _context4.next = 9;
12433
+ _context8.next = 9;
12002
12434
  break;
12003
12435
  }
12004
- _context4.prev = 1;
12005
- _context4.next = 4;
12436
+ _context8.prev = 1;
12437
+ _context8.next = 4;
12006
12438
  return updateMaritimeWarningEditor({
12007
12439
  domain: warning.type,
12008
12440
  isEditor: true
12009
12441
  });
12010
12442
  case 4:
12011
- _context4.next = 8;
12443
+ _context8.next = 8;
12012
12444
  break;
12013
12445
  case 6:
12014
- _context4.prev = 6;
12015
- _context4.t0 = _context4["catch"](1);
12446
+ _context8.prev = 6;
12447
+ _context8.t0 = _context8["catch"](1);
12016
12448
  case 8:
12017
12449
  refetchWarnings();
12018
12450
  case 9:
12019
12451
  void openPublicWarningDialog('', undefined, warning.type);
12020
12452
  case 10:
12021
12453
  case "end":
12022
- return _context4.stop();
12454
+ return _context8.stop();
12023
12455
  }
12024
- }, _callee4, null, [[1, 6]]);
12456
+ }, _callee8, null, [[1, 6]]);
12025
12457
  }));
12026
- return function editMaritimeWarning(_x8) {
12027
- return _ref5.apply(this, arguments);
12458
+ return function editMaritimeWarning(_x1) {
12459
+ return _ref6.apply(this, arguments);
12028
12460
  };
12029
12461
  }();
12030
12462
  var handleMaritimeProductClick = function handleMaritimeProductClick(warning, actionType) {
@@ -12047,20 +12479,37 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
12047
12479
  }));
12048
12480
  };
12049
12481
  var deleteWarning = function deleteWarning(warningId, warningEditor) {
12050
- var isLocked = warningEditor && warningEditor !== (auth == null ? void 0 : auth.username) || false;
12482
+ var _auth$username2;
12483
+ var editor = warningEditor != null ? warningEditor : '';
12484
+ var currentUser = (_auth$username2 = auth == null ? void 0 : auth.username) != null ? _auth$username2 : '';
12485
+ var isLocked = editor !== '' && editor !== currentUser;
12051
12486
  setConfirmDialogOptions({
12052
12487
  confirmLabel: t('warning-dialog-delete-confirm'),
12053
12488
  title: t('warning-dialog-delete-title'),
12054
12489
  description: t('warning-dialog-delete-description'),
12055
- request: function request() {
12056
- return deletePublicWarning({
12057
- id: warningId
12058
- }, {
12059
- onSuccess: function onSuccess() {
12060
- return onRemoveSuccessHooks(warningId);
12061
- }
12062
- });
12063
- },
12490
+ request: function () {
12491
+ var _request4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
12492
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
12493
+ while (1) switch (_context9.prev = _context9.next) {
12494
+ case 0:
12495
+ return _context9.abrupt("return", deletePublicWarning({
12496
+ id: warningId
12497
+ }, {
12498
+ onSuccess: function onSuccess() {
12499
+ return onRemoveSuccessHooks(warningId);
12500
+ }
12501
+ }));
12502
+ case 1:
12503
+ case "end":
12504
+ return _context9.stop();
12505
+ }
12506
+ }, _callee9);
12507
+ }));
12508
+ function request() {
12509
+ return _request4.apply(this, arguments);
12510
+ }
12511
+ return request;
12512
+ }(),
12064
12513
  isLocked: isLocked
12065
12514
  });
12066
12515
  };
@@ -12072,14 +12521,28 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
12072
12521
  confirmLabel: t('warning-dialog-delete-confirm'),
12073
12522
  title: t('warning-dialog-delete-title'),
12074
12523
  description: t('warning-dialog-delete-description'),
12075
- request: function request() {
12076
- return saveWarning({
12077
- id: ignoredWarning.id,
12078
- data: Object.assign({}, ignoredWarning, {
12079
- type: 'public'
12080
- })
12081
- });
12082
- },
12524
+ request: function () {
12525
+ var _request5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee0() {
12526
+ return _regeneratorRuntime().wrap(function _callee0$(_context0) {
12527
+ while (1) switch (_context0.prev = _context0.next) {
12528
+ case 0:
12529
+ return _context0.abrupt("return", saveWarning({
12530
+ id: ignoredWarning.id,
12531
+ data: Object.assign({}, ignoredWarning, {
12532
+ type: 'public'
12533
+ })
12534
+ }));
12535
+ case 1:
12536
+ case "end":
12537
+ return _context0.stop();
12538
+ }
12539
+ }, _callee0);
12540
+ }));
12541
+ function request() {
12542
+ return _request5.apply(this, arguments);
12543
+ }
12544
+ return request;
12545
+ }(),
12083
12546
  callback: function callback() {
12084
12547
  return onRemoveSuccess(ignoredWarning.id, t('warning-dialog-delete-succes'));
12085
12548
  }
@@ -12126,17 +12589,18 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
12126
12589
  var filteredWarnings = React__default.useMemo(function () {
12127
12590
  return combinedWarnings.filter(filterHookState.byFilterState);
12128
12591
  }, [combinedWarnings, filterHookState.byFilterState]);
12129
- var _React$useState2 = React__default.useState({
12592
+ var _React$useState4 = React__default.useState({
12130
12593
  TODO: false,
12131
12594
  DRAFT: false,
12132
12595
  PUBLISHED: true,
12133
12596
  EXPIRED: false
12134
12597
  }),
12135
- expandedSections = _React$useState2[0],
12136
- setExpandedSections = _React$useState2[1];
12598
+ expandedSections = _React$useState4[0],
12599
+ setExpandedSections = _React$useState4[1];
12137
12600
  var filteredWarningsByExpandedSections = React__default.useMemo(function () {
12138
12601
  return filteredWarnings.filter(function (warning) {
12139
- return warning.status && expandedSections[warning.status] || warning.productStatus && expandedSections[warning.productStatus];
12602
+ var _ref7;
12603
+ return (_ref7 = warning.status && expandedSections[warning.status]) != null ? _ref7 : warning.productStatus && expandedSections[warning.productStatus];
12140
12604
  });
12141
12605
  }, [filteredWarnings, expandedSections]);
12142
12606
  var selectedAviationProductId = (_filteredWarnings$fin = filteredWarnings.find(function (warning) {
@@ -12144,19 +12608,27 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
12144
12608
  })) == null ? void 0 : _filteredWarnings$fin.id;
12145
12609
  var allFeatures = React__default.useMemo(function () {
12146
12610
  return filteredWarningsByExpandedSections.flatMap(function (warning) {
12147
- return (warning == null ? void 0 : warning.id) && warning.id !== selectedAviationProductId && (warning != null && warning.warningDetail && warning.warningDetail.areas ? warning.warningDetail.areas.filter(function (area) {
12148
- return area.geoJSON;
12611
+ var _warning$warningDetai, _warning$warningDetai2;
12612
+ var id = warning == null ? void 0 : warning.id;
12613
+ if (!id || id === selectedAviationProductId) {
12614
+ return [];
12615
+ }
12616
+ var areas = (_warning$warningDetai = warning == null || (_warning$warningDetai2 = warning.warningDetail) == null ? void 0 : _warning$warningDetai2.areas) != null ? _warning$warningDetai : [];
12617
+ return areas.filter(function (area) {
12618
+ return !!area.geoJSON;
12149
12619
  }).map(function (area) {
12620
+ var _warning$warningDetai3, _area$areaId;
12621
+ var level = warning == null || (_warning$warningDetai3 = warning.warningDetail) == null ? void 0 : _warning$warningDetai3.level;
12150
12622
  var isAviationWarning = warning.warningDetail.level === 'SIG' || warning.warningDetail.level === 'AIR';
12151
- var styledGeoJSON = warningLevelFeatureColors(warning.warningDetail.level, area.geoJSON, isAviationWarning);
12623
+ var styledGeoJSON = level ? warningLevelFeatureColors(level, area.geoJSON, isAviationWarning) : area.geoJSON;
12152
12624
  return {
12153
- id: warning.id + area.areaId,
12154
- originalId: warning.id,
12625
+ id: id + ((_area$areaId = area.areaId) != null ? _area$areaId : ''),
12626
+ originalId: id,
12155
12627
  geoJSON: styledGeoJSON
12156
12628
  };
12157
- }) : []) || [];
12629
+ });
12158
12630
  }).filter(function (feature) {
12159
- return feature.id;
12631
+ return !!feature.id;
12160
12632
  });
12161
12633
  }, [filteredWarningsByExpandedSections, selectedAviationProductId]);
12162
12634
  var _useUpdateSharedData = useUpdateSharedData({
@@ -12165,35 +12637,62 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
12165
12637
  hoveredFeatureId = _useUpdateSharedData.hoverId;
12166
12638
  return jsxs(Fragment, {
12167
12639
  children: [jsx(PublicWarningList, {
12168
- warnings: filteredWarnings,
12640
+ error: error != null ? error : undefined,
12169
12641
  expandedSections: expandedSections,
12170
- setExpandedSections: setExpandedSections,
12642
+ filterHookState: filterHookState,
12643
+ hoveredFeatureId: hoveredFeatureId,
12171
12644
  isLoading: isFetching,
12172
- error: error || undefined,
12173
- onSelectWarning: selectWarning,
12645
+ lastUpdatedTime: lastUpdateTime,
12646
+ onActionAviationWarning: handleAviationProductClick,
12647
+ onActionMaritimeWarning: handleMaritimeProductClick,
12174
12648
  onCreateWarning: createWarning,
12175
- onEditWarning: editWarning,
12176
- onDeleteWarning: deleteWarning,
12177
12649
  onDeleteReviewWarning: deleteReviewWarning,
12650
+ onDeleteWarning: deleteWarning,
12651
+ onEditWarning: editWarning,
12178
12652
  onExpireWarning: expireWarning,
12653
+ onRefetchWarnings: refetchWarnings,
12654
+ onSelectWarning: selectWarning,
12179
12655
  onWithdrawWarning: withdrawWarning,
12180
12656
  selectedWarningId: selectedWarningId,
12181
- lastUpdatedTime: lastUpdateTime,
12182
- onRefetchWarnings: refetchWarnings,
12183
- filterHookState: filterHookState,
12184
- hoveredFeatureId: hoveredFeatureId,
12185
- onActionAviationWarning: handleAviationProductClick,
12186
- onActionMaritimeWarning: handleMaritimeProductClick
12187
- }), confirmDialogOptions && jsx(ConfirmDeleteWarningDialog, {
12657
+ setExpandedSections: setExpandedSections,
12658
+ warnings: filteredWarnings
12659
+ }), confirmDialogOptions ? jsx(ConfirmDeleteWarningDialog, {
12660
+ callback: confirmDialogOptions.callback,
12661
+ confirmLabel: confirmDialogOptions.confirmLabel,
12662
+ description: confirmDialogOptions.description,
12663
+ isLocked: confirmDialogOptions.isLocked,
12188
12664
  onClose: function onClose() {
12189
12665
  return setConfirmDialogOptions(undefined);
12190
12666
  },
12191
- title: confirmDialogOptions.title,
12192
- description: confirmDialogOptions.description,
12193
12667
  request: confirmDialogOptions.request,
12194
- confirmLabel: confirmDialogOptions.confirmLabel,
12195
- callback: confirmDialogOptions.callback,
12196
- isLocked: confirmDialogOptions.isLocked
12668
+ title: confirmDialogOptions.title
12669
+ }) : null, cancelCtx && jsx(CancelAviationConfirmDialog, {
12670
+ open: cancelOpen,
12671
+ type: cancelCtx.type,
12672
+ product: cancelCtx.product,
12673
+ showVA: cancelCtx.showVA,
12674
+ aviationConfig: aviationConfig,
12675
+ sigmet: cancelCtx.sigmet,
12676
+ title: getConfirmationDialogTitle(t, ProductAction.CANCEL, cancelCtx.type),
12677
+ confirmLabel: getConfirmationDialogButtonLabel(t, ProductAction.CANCEL, cancelCtx.type),
12678
+ onClose: closeCancelDialog,
12679
+ cancelAviationProduct: function () {
12680
+ var _cancelAviationProduct2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee1(product, t) {
12681
+ return _regeneratorRuntime().wrap(function _callee1$(_context1) {
12682
+ while (1) switch (_context1.prev = _context1.next) {
12683
+ case 0:
12684
+ return _context1.abrupt("return", _cancelAviationProduct(product, t));
12685
+ case 1:
12686
+ case "end":
12687
+ return _context1.stop();
12688
+ }
12689
+ }, _callee1);
12690
+ }));
12691
+ function cancelAviationProduct(_x10, _x11) {
12692
+ return _cancelAviationProduct2.apply(this, arguments);
12693
+ }
12694
+ return cancelAviationProduct;
12695
+ }()
12197
12696
  })]
12198
12697
  });
12199
12698
  };