@opengeoweb/warnings 12.1.2 → 12.3.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 +445 -201
- package/package.json +16 -16
- package/src/lib/Warnings.stories.d.ts +1 -0
- package/src/lib/api/aviation-api/hooks.d.ts +2 -2
- package/src/lib/api/warning-api/api.d.ts +1 -0
- package/src/lib/api/warning-api/hooks.d.ts +3 -0
- package/src/lib/components/AreaObjectLoader/AreaObjectLoader.stories.d.ts +12 -36
- package/src/lib/components/AreaObjectLoader/AreaObjectLoaderConnect.stories.d.ts +1 -0
- package/src/lib/components/DrawingTool/DrawingTool.stories.d.ts +7 -30
- package/src/lib/components/FilterList/ExpandableFilterChip.stories.d.ts +13 -13
- package/src/lib/components/ObjectManager/ObjectManager.stories.d.ts +35 -42
- package/src/lib/components/ObjectManager/ObjectManagerConnect.stories.d.ts +6 -21
- package/src/lib/components/ObjectManager/ObjectManagerConnectErrors.stories.d.ts +1 -0
- package/src/lib/components/Providers/Providers.d.ts +10 -2
- package/src/lib/components/PublicWarningList/ConfirmWarningDialog.d.ts +2 -2
- package/src/lib/components/PublicWarningList/NewWarningButton/NewWarningButton.d.ts +1 -2
- package/src/lib/components/PublicWarningList/NewWarningButton/NewWarningButton.stories.d.ts +7 -8
- package/src/lib/components/PublicWarningList/PublicWarningList.stories.d.ts +1 -0
- package/src/lib/components/PublicWarningList/PublicWarningListConnect.stories.d.ts +10 -1
- package/src/lib/components/PublicWarningList/WarningListColumnContent.d.ts +2 -2
- package/src/lib/components/PublicWarningList/WarningListHeaderContent.d.ts +2 -2
- package/src/lib/components/PublicWarningsForm/AreaField/AreaField.stories.d.ts +21 -9
- package/src/lib/components/PublicWarningsForm/DescriptionField/DescriptionField.stories.d.ts +10 -21
- package/src/lib/components/PublicWarningsForm/PublicWarningsForm.d.ts +5 -1
- package/src/lib/components/PublicWarningsForm/PublicWarningsForm.stories.d.ts +3 -3
- package/src/lib/components/PublicWarningsForm/PublicWarningsFormConnect.stories.d.ts +1 -0
- package/src/lib/components/PublicWarningsForm/PublicWarningsFormConnectErrors.stories.d.ts +1 -0
- package/src/lib/components/PublicWarningsFormDialog/PublicWarningsFormDialog.stories.d.ts +14 -53
- package/src/lib/components/PublicWarningsFormDialog/PublicWarningsFormDialogConnect.stories.d.ts +1 -0
- package/src/lib/components/WarningsMapView/WarningsMapView.d.ts +1 -1
- package/src/lib/store/publicWarningForm/listener.d.ts +1 -1
- package/src/lib/store/publicWarningForm/reducer.d.ts +2 -2
- package/src/lib/store/publicWarningForm/selectors.d.ts +220 -44
- package/src/lib/store/publicWarnings/listener.d.ts +1 -1
- package/src/lib/store/publicWarnings/reducer.d.ts +1 -1
- package/src/lib/store/publicWarnings/selectors.d.ts +147 -19
- package/src/lib/store/publicWarnings/types.d.ts +1 -1
- package/src/lib/store/store.d.ts +9 -9
- package/src/lib/store/warningsDrawings/listener.d.ts +1 -1
- package/src/lib/store/warningsDrawings/reducer.d.ts +1 -1
- package/src/lib/store/warningsDrawings/selectors.d.ts +40 -4
- package/src/lib/store/warningsDrawings/types.d.ts +1 -1
- package/src/lib/storybookUtils/testUtils.d.ts +2 -0
- package/src/lib/utils/api.d.ts +0 -1
package/index.esm.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useDispatch, useSelector } from 'react-redux';
|
|
3
|
-
import { Polygons,
|
|
4
|
-
import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawingToolSelectors, layerSelectors, uiSelectors, drawingToolActions, layerActions, useSetupDialog, selectorMemoizationOptions, useUpdateSharedData, mapListener, layersListener, drawingToolListener, syncGroupsListener,
|
|
3
|
+
import { Polygons, ExitDomain, Share, Edit, Delete, DrawPolygon, Visibility, Add, CoastalEvent, TemperatureLow, TemperatureHigh, Rain, Snow, Lightning, Fog, Wind, Thunderstorm, VulcanicEruption, Haze, FreezingPrecipitation, ModerateAircraftIcing, SevereAircraftIcing, ModerateTurbulence, SevereTurbulence, SandStorm, RadioactiveMaterials, breakpoints, Options, Close, ChevronDown, ChevronUp, Copy, Update, Cancel, Success, Expire, Remove, ArrowUpCompact, ArrowDownCompact } from '@opengeoweb/theme';
|
|
4
|
+
import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawingToolSelectors, layerSelectors, uiSelectors, drawingToolActions, layerActions, useSetupDialog, genericSelectors, selectorMemoizationOptions, useUpdateSharedData, mapListener, layersListener, drawingToolListener, syncGroupsListener, openlayersListener, syncGroupsReducer, drawingToolReducer, uiReducer, layerReducer, mapReducer } 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,
|
|
6
|
+
import { SHARED_NAMESPACE, useConfirmationDialog, dateUtils, ToggleMenu, calculateStartSize, ToolContainerDraggable, AlertBanner, ConfirmationDialog, getAxiosErrorMessage, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, sessionStorageProvider, CustomToggleButton, Filter, FilterChip, FilterOption, StatusTag, LastUpdateTime, ErrorBoundary, isAxiosError } from '@opengeoweb/shared';
|
|
7
7
|
import { createEntityAdapter, createSlice, createSelector, current, createListenerMiddleware, combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
8
|
-
import '
|
|
9
|
-
import {
|
|
10
|
-
import '@opengeoweb/
|
|
11
|
-
import { FORM_FIELDS_NAMESPACE, ReactHookFormHiddenInput, isValidGeoJsonCoordinates, ReactHookFormSelect, ReactHookFormTextField, ReactHookFormProvider, defaultFormOptions, useDraftFormHelpers, errorMessages, isEmpty, ReactHookFormDateTime, isXHoursBefore, isXHoursAfter } from '@opengeoweb/form-fields';
|
|
8
|
+
import { defaultBbox } from '@opengeoweb/core';
|
|
9
|
+
import { FORM_FIELDS_NAMESPACE, ReactHookFormHiddenInput, isValidGeoJsonCoordinates, ReactHookFormSelect, ReactHookFormTextField, ReactHookFormProvider, defaultFormOptions, useDraftFormHelpers, errorMessages, isEmpty, ReactHookFormDateTime, isXHoursAfter, isXHoursBefore } from '@opengeoweb/form-fields';
|
|
10
|
+
import { SA_NAMESPACE, airmetConfig, sigmetConfig, isInstanceOfCancelSigmet, isInstanceOfCancelAirmet, getDefaultValidUntilValue, useShortTestHelpers, SigmetForm, AirmetForm, ProductAction, isVAPhenomenon, prepareCancelSigmet, getConfirmationDialogCancelLabel, getConfirmationDialogButtonLabel, getConfirmationDialogContent, getConfirmationDialogTitle, CancelSigmetVolcanicMovements, createAirmetPostParameter, createSigmetPostParameter, getProductFormMode } from '@opengeoweb/sigmet-airmet';
|
|
12
11
|
import { LayerType, generateMapId } from '@opengeoweb/webmap';
|
|
13
|
-
import {
|
|
12
|
+
import { t } from 'i18next';
|
|
13
|
+
import { useTranslation } from 'react-i18next';
|
|
14
14
|
import { snackbarActions, snackbarTypes, snackbarListener, snackbarReducer } from '@opengeoweb/snackbar';
|
|
15
15
|
import * as React from 'react';
|
|
16
16
|
import React__default, { useState, useEffect, useRef, useMemo, useCallback } from 'react';
|
|
17
|
-
import { styled, Box, Typography, ListItem,
|
|
17
|
+
import { styled, Box, Typography, ListItem, Paper, ListItemButton, Stack, Grid, LinearProgress, Button, FormHelperText, MenuItem, Card, CardContent, Tabs, Tab, CircularProgress, Menu, DialogTitle, DialogContent, Switch, ListItemText } from '@mui/material';
|
|
18
18
|
import { VariableSizeList } from 'react-window';
|
|
19
19
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
20
20
|
import { getApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider, getHeaders, handleResponse, useAuthQuery, useAuthenticationContext, ProductStatus, AirmetPhenomena, SigmetPhenomena, optimisticUpdate } from '@opengeoweb/api';
|
|
21
21
|
import { http, HttpResponse, passthrough, delay } from 'msw';
|
|
22
22
|
import { concat, isEqual, cloneDeep, clamp, groupBy, pick } from 'lodash';
|
|
23
|
-
import { useFormContext } from 'react-hook-form';
|
|
24
|
-
import {
|
|
23
|
+
import { useFormContext, useForm, FormProvider } from 'react-hook-form';
|
|
24
|
+
import { useAuthenticationContext as useAuthenticationContext$1 } from '@opengeoweb/authentication';
|
|
25
25
|
import { useQueryClient, useMutation } from '@tanstack/react-query';
|
|
26
26
|
|
|
27
27
|
var en = {
|
|
@@ -201,7 +201,12 @@ var en = {
|
|
|
201
201
|
"warning-dialog-withdraw-description": "Are you sure you want to withdraw this warning?",
|
|
202
202
|
"tac-missing-data": "Missing data: no TAC can be generated",
|
|
203
203
|
"warning-list-button-renew": "Renew",
|
|
204
|
-
"aviation-save-
|
|
204
|
+
"aviation-save-success": "{{warningType}} has succesfully been saved!",
|
|
205
|
+
"aviation-publish-success": "{{warningType}} has succesfully been published!",
|
|
206
|
+
"publish-this-product": "Are you sure you want to publish this {{product}}?",
|
|
207
|
+
"yes-cancel": "Yes, cancel {{product}}",
|
|
208
|
+
"cancel-this-product": "Are you sure you want to cancel this {{product}}?",
|
|
209
|
+
"aviation-cancel-success": "{{warningType}} has succesfully been cancelled!"
|
|
205
210
|
};
|
|
206
211
|
var nl = {
|
|
207
212
|
"drawing-tool-form-tools": "Gereedschap",
|
|
@@ -341,7 +346,12 @@ var nl = {
|
|
|
341
346
|
"error-title-retry": "Probeer opnieuw",
|
|
342
347
|
"tac-missing-data": "Ontbrekende gegevens: er kan geen TAC worden gegenereerd",
|
|
343
348
|
"warning-list-button-renew": "Hernieuwen",
|
|
344
|
-
"aviation-save-
|
|
349
|
+
"aviation-save-success": "{{warningType}} is succesvol opgeslagen!",
|
|
350
|
+
"aviation-publish-success": "niet vertaald",
|
|
351
|
+
"publish-this-product": "Weet je zeker dat je dit {{product}} wilt publiceren?",
|
|
352
|
+
"yes-cancel": "Ja, annuleer {{product}}",
|
|
353
|
+
"cancel-this-product": "Weet je zeker dat je dit {{product}} wilt annuleren?",
|
|
354
|
+
"aviation-cancel-success": "niet vertaald"
|
|
345
355
|
};
|
|
346
356
|
var fi = {
|
|
347
357
|
"drawing-tool-form-tools": "Työkalut",
|
|
@@ -481,7 +491,12 @@ var fi = {
|
|
|
481
491
|
"error-title-retry": "Yritä uudelleen",
|
|
482
492
|
"tac-missing-data": "Tarvittavia tietoja puuttuu, TAC:ia ei voida generoida",
|
|
483
493
|
"warning-list-button-renew": "Renew",
|
|
484
|
-
"aviation-save-
|
|
494
|
+
"aviation-save-success": "{{warningType}} tallannettu onnistuneesti",
|
|
495
|
+
"aviation-publish-success": "ei käännetty",
|
|
496
|
+
"publish-this-product": "Oletko varma, että haluat julkaista tämän {{product}}:n?",
|
|
497
|
+
"yes-cancel": "Kyllä, peruuta {{product}}",
|
|
498
|
+
"cancel-this-product": "Oletko varma, että haluat peruuttaa tämän {{product}}:n?",
|
|
499
|
+
"aviation-cancel-success": "ei käännetty"
|
|
485
500
|
};
|
|
486
501
|
var no = {
|
|
487
502
|
"drawing-tool-form-tools": "Verktøy",
|
|
@@ -621,7 +636,12 @@ var no = {
|
|
|
621
636
|
"error-title-retry": "Prøv igjen",
|
|
622
637
|
"tac-missing-data": "Mangler data: ingen TAC kan genereres",
|
|
623
638
|
"warning-list-button-renew": "Renew",
|
|
624
|
-
"aviation-save-
|
|
639
|
+
"aviation-save-success": "{{warningType}} er lagret!",
|
|
640
|
+
"aviation-publish-success": "{{warningType}} er lagret!",
|
|
641
|
+
"publish-this-product": "Er du sikker på at du vil publisere dette {{product}}?",
|
|
642
|
+
"yes-cancel": "Ja, kanseller {{product}}",
|
|
643
|
+
"cancel-this-product": "Er du sikker på at du vil avbryte dette {{product}}?",
|
|
644
|
+
"aviation-cancel-success": "{{warningType}} er kansellert!"
|
|
625
645
|
};
|
|
626
646
|
var warningsTranslations = {
|
|
627
647
|
en: en,
|
|
@@ -659,7 +679,7 @@ function _objectWithoutPropertiesLoose(r, e) {
|
|
|
659
679
|
if (null == r) return {};
|
|
660
680
|
var t = {};
|
|
661
681
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
662
|
-
if (e.indexOf(n)
|
|
682
|
+
if (-1 !== e.indexOf(n)) continue;
|
|
663
683
|
t[n] = r[n];
|
|
664
684
|
}
|
|
665
685
|
return t;
|
|
@@ -682,9 +702,9 @@ function _regeneratorRuntime() {
|
|
|
682
702
|
function define(t, e, r) {
|
|
683
703
|
return Object.defineProperty(t, e, {
|
|
684
704
|
value: r,
|
|
685
|
-
enumerable:
|
|
686
|
-
configurable:
|
|
687
|
-
writable:
|
|
705
|
+
enumerable: true,
|
|
706
|
+
configurable: true,
|
|
707
|
+
writable: true
|
|
688
708
|
}), t[e];
|
|
689
709
|
}
|
|
690
710
|
try {
|
|
@@ -777,7 +797,7 @@ function _regeneratorRuntime() {
|
|
|
777
797
|
if ("throw" === i) throw a;
|
|
778
798
|
return {
|
|
779
799
|
value: t,
|
|
780
|
-
done:
|
|
800
|
+
done: true
|
|
781
801
|
};
|
|
782
802
|
}
|
|
783
803
|
for (n.method = i, n.arg = a;;) {
|
|
@@ -828,7 +848,7 @@ function _regeneratorRuntime() {
|
|
|
828
848
|
function Context(t) {
|
|
829
849
|
this.tryEntries = [{
|
|
830
850
|
tryLoc: "root"
|
|
831
|
-
}], t.forEach(pushTryEntry, this), this.reset(
|
|
851
|
+
}], t.forEach(pushTryEntry, this), this.reset(true);
|
|
832
852
|
}
|
|
833
853
|
function values(e) {
|
|
834
854
|
if (e || "" === e) {
|
|
@@ -838,8 +858,8 @@ function _regeneratorRuntime() {
|
|
|
838
858
|
if (!isNaN(e.length)) {
|
|
839
859
|
var o = -1,
|
|
840
860
|
i = function next() {
|
|
841
|
-
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done =
|
|
842
|
-
return next.value = t, next.done =
|
|
861
|
+
for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = false, next;
|
|
862
|
+
return next.value = t, next.done = true, next;
|
|
843
863
|
};
|
|
844
864
|
return i.next = i;
|
|
845
865
|
}
|
|
@@ -848,10 +868,10 @@ function _regeneratorRuntime() {
|
|
|
848
868
|
}
|
|
849
869
|
return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", {
|
|
850
870
|
value: GeneratorFunctionPrototype,
|
|
851
|
-
configurable:
|
|
871
|
+
configurable: true
|
|
852
872
|
}), o(GeneratorFunctionPrototype, "constructor", {
|
|
853
873
|
value: GeneratorFunction,
|
|
854
|
-
configurable:
|
|
874
|
+
configurable: true
|
|
855
875
|
}), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) {
|
|
856
876
|
var e = "function" == typeof t && t.constructor;
|
|
857
877
|
return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name));
|
|
@@ -880,17 +900,17 @@ function _regeneratorRuntime() {
|
|
|
880
900
|
return r.reverse(), function next() {
|
|
881
901
|
for (; r.length;) {
|
|
882
902
|
var t = r.pop();
|
|
883
|
-
if (t in e) return next.value = t, next.done =
|
|
903
|
+
if (t in e) return next.value = t, next.done = false, next;
|
|
884
904
|
}
|
|
885
|
-
return next.done =
|
|
905
|
+
return next.done = true, next;
|
|
886
906
|
};
|
|
887
907
|
}, e.values = values, Context.prototype = {
|
|
888
908
|
constructor: Context,
|
|
889
909
|
reset: function (e) {
|
|
890
|
-
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done =
|
|
910
|
+
if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = false, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t);
|
|
891
911
|
},
|
|
892
912
|
stop: function () {
|
|
893
|
-
this.done =
|
|
913
|
+
this.done = true;
|
|
894
914
|
var t = this.tryEntries[0].completion;
|
|
895
915
|
if ("throw" === t.type) throw t.arg;
|
|
896
916
|
return this.rval;
|
|
@@ -909,10 +929,10 @@ function _regeneratorRuntime() {
|
|
|
909
929
|
var c = n.call(i, "catchLoc"),
|
|
910
930
|
u = n.call(i, "finallyLoc");
|
|
911
931
|
if (c && u) {
|
|
912
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc,
|
|
932
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
|
|
913
933
|
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
914
934
|
} else if (c) {
|
|
915
|
-
if (this.prev < i.catchLoc) return handle(i.catchLoc,
|
|
935
|
+
if (this.prev < i.catchLoc) return handle(i.catchLoc, true);
|
|
916
936
|
} else {
|
|
917
937
|
if (!u) throw Error("try statement without catch or finally");
|
|
918
938
|
if (this.prev < i.finallyLoc) return handle(i.finallyLoc);
|
|
@@ -1125,7 +1145,7 @@ var getWarningFormDirty = createSelector(selectDrawByInstanceId, function (drawi
|
|
|
1125
1145
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1126
1146
|
* */
|
|
1127
1147
|
var WARN_NAMESPACE = 'warn';
|
|
1128
|
-
var ns = [WARN_NAMESPACE, FORM_FIELDS_NAMESPACE, SHARED_NAMESPACE];
|
|
1148
|
+
var ns = [WARN_NAMESPACE, FORM_FIELDS_NAMESPACE, SHARED_NAMESPACE, SA_NAMESPACE];
|
|
1129
1149
|
var useWarningsTranslation = function useWarningsTranslation() {
|
|
1130
1150
|
return useTranslation(ns);
|
|
1131
1151
|
};
|
|
@@ -1674,10 +1694,10 @@ var Objects = function Objects(_ref2) {
|
|
|
1674
1694
|
children: jsx(ListItem, {
|
|
1675
1695
|
style: style,
|
|
1676
1696
|
disablePadding: true,
|
|
1677
|
-
secondaryAction: jsxs(
|
|
1697
|
+
secondaryAction: jsxs(Grid, {
|
|
1678
1698
|
container: true,
|
|
1679
1699
|
rowSpacing: 1,
|
|
1680
|
-
children: [jsx(
|
|
1700
|
+
children: [jsx(Grid, {
|
|
1681
1701
|
className: "objectActions",
|
|
1682
1702
|
children: jsx(ToggleMenu, {
|
|
1683
1703
|
buttonSx: (_buttonSx = {
|
|
@@ -1710,7 +1730,7 @@ var Objects = function Objects(_ref2) {
|
|
|
1710
1730
|
icon: jsx(ExitDomain, {})
|
|
1711
1731
|
}]
|
|
1712
1732
|
})
|
|
1713
|
-
}), object.scope === 'user' && jsx(
|
|
1733
|
+
}), object.scope === 'user' && jsx(Grid, {
|
|
1714
1734
|
className: "objectActions",
|
|
1715
1735
|
children: jsx(ToggleMenu, {
|
|
1716
1736
|
menuTitle: t('object-manager-options-menu'),
|
|
@@ -1968,9 +1988,6 @@ var getApiRoutes$1 = function getApiRoutes(axiosInstance) {
|
|
|
1968
1988
|
},
|
|
1969
1989
|
updateWarning: function updateWarning(warningId, data) {
|
|
1970
1990
|
return axiosInstance.post("/warnings/" + warningId + "/", data);
|
|
1971
|
-
},
|
|
1972
|
-
deleteWarning: function deleteWarning(warningId) {
|
|
1973
|
-
return axiosInstance.post("/warnings/" + warningId + "?delete=true");
|
|
1974
1991
|
}
|
|
1975
1992
|
};
|
|
1976
1993
|
};
|
|
@@ -2043,10 +2060,7 @@ var ConfirmDeleteDialog = function ConfirmDeleteDialog(_ref) {
|
|
|
2043
2060
|
description: !error ? description : '',
|
|
2044
2061
|
onClose: onClose,
|
|
2045
2062
|
onSubmit: onSubmit,
|
|
2046
|
-
isLoading: isLoading
|
|
2047
|
-
sx: {
|
|
2048
|
-
width: 330
|
|
2049
|
-
}
|
|
2063
|
+
isLoading: isLoading
|
|
2050
2064
|
}, error && {
|
|
2051
2065
|
content: jsxs(Box, {
|
|
2052
2066
|
sx: {
|
|
@@ -7565,12 +7579,6 @@ var getApiRoutes = function getApiRoutes(axiosInstance) {
|
|
|
7565
7579
|
},
|
|
7566
7580
|
updateWarning: function updateWarning(warningId, data) {
|
|
7567
7581
|
return axiosInstance.post("/warnings/" + warningId + "/", data);
|
|
7568
|
-
},
|
|
7569
|
-
deleteWarning: function deleteWarning(warningId) {
|
|
7570
|
-
warningList.splice(warningList.findIndex(function (warning) {
|
|
7571
|
-
return warning.id === warningId;
|
|
7572
|
-
}), 1);
|
|
7573
|
-
return axiosInstance.post("/warnings/" + warningId + "?delete=true");
|
|
7574
7582
|
}
|
|
7575
7583
|
};
|
|
7576
7584
|
};
|
|
@@ -7791,20 +7799,20 @@ var DrawingToolFormContentsNoMemo = function DrawingToolFormContentsNoMemo(_ref)
|
|
|
7791
7799
|
title: dialogError,
|
|
7792
7800
|
shouldClose: true
|
|
7793
7801
|
})
|
|
7794
|
-
}), jsxs(
|
|
7802
|
+
}), jsxs(Grid, {
|
|
7795
7803
|
"data-testid": "drawingToolForm",
|
|
7796
7804
|
container: true,
|
|
7797
7805
|
direction: "column",
|
|
7798
7806
|
spacing: 1,
|
|
7799
7807
|
padding: 2,
|
|
7800
|
-
children: [jsx(
|
|
7808
|
+
children: [jsx(Grid, {
|
|
7801
7809
|
children: jsx(Typography, {
|
|
7802
7810
|
variant: "body2",
|
|
7803
7811
|
children: t('drawing-tool-form-tools')
|
|
7804
7812
|
})
|
|
7805
|
-
}), jsx(
|
|
7813
|
+
}), jsx(Grid, {
|
|
7806
7814
|
container: true,
|
|
7807
|
-
children: jsxs(
|
|
7815
|
+
children: jsxs(Grid, {
|
|
7808
7816
|
children: [drawModes.map(function (mode) {
|
|
7809
7817
|
return jsx(CustomIconButton, {
|
|
7810
7818
|
variant: "tool",
|
|
@@ -7850,10 +7858,10 @@ var DrawingToolFormContentsNoMemo = function DrawingToolFormContentsNoMemo(_ref)
|
|
|
7850
7858
|
}
|
|
7851
7859
|
})]
|
|
7852
7860
|
})
|
|
7853
|
-
}), jsx(
|
|
7861
|
+
}), jsx(Grid, {
|
|
7854
7862
|
container: true,
|
|
7855
7863
|
size: "grow",
|
|
7856
|
-
children: jsx(
|
|
7864
|
+
children: jsx(Grid, {
|
|
7857
7865
|
size: {
|
|
7858
7866
|
xs: 12,
|
|
7859
7867
|
sm: 6
|
|
@@ -7876,7 +7884,7 @@ var DrawingToolFormContentsNoMemo = function DrawingToolFormContentsNoMemo(_ref)
|
|
|
7876
7884
|
})
|
|
7877
7885
|
})
|
|
7878
7886
|
})
|
|
7879
|
-
}), jsxs(
|
|
7887
|
+
}), jsxs(Grid, {
|
|
7880
7888
|
children: [jsx(ReactHookFormTextField, {
|
|
7881
7889
|
name: "objectName",
|
|
7882
7890
|
label: t('drawing-tool-form-object-name'),
|
|
@@ -8400,7 +8408,7 @@ var PublicWarningsFormDialog = function PublicWarningsFormDialog(_ref) {
|
|
|
8400
8408
|
}));
|
|
8401
8409
|
};
|
|
8402
8410
|
|
|
8403
|
-
var config$1 = getConfig();
|
|
8411
|
+
var config$1 = sessionStorageProvider.getConfig();
|
|
8404
8412
|
var airmetBaseUrl = config$1.GW_AIRMET_BASE_URL || '';
|
|
8405
8413
|
var sigmetBaseUrl = config$1.GW_SIGMET_BASE_URL || '';
|
|
8406
8414
|
// API
|
|
@@ -8513,6 +8521,16 @@ var postAirmet = function postAirmet(auth, data) {
|
|
|
8513
8521
|
}).then(handleResponse);
|
|
8514
8522
|
};
|
|
8515
8523
|
|
|
8524
|
+
var getAviationSnackbarKey = function getAviationSnackbarKey(status) {
|
|
8525
|
+
switch (status) {
|
|
8526
|
+
case 'PUBLISHED':
|
|
8527
|
+
return 'aviation-publish-success';
|
|
8528
|
+
case 'CANCELLED':
|
|
8529
|
+
return 'aviation-cancel-success';
|
|
8530
|
+
default:
|
|
8531
|
+
return 'aviation-save-success';
|
|
8532
|
+
}
|
|
8533
|
+
};
|
|
8516
8534
|
var useAirmetList = function useAirmetList(disabled) {
|
|
8517
8535
|
if (disabled === void 0) {
|
|
8518
8536
|
disabled = false;
|
|
@@ -8565,11 +8583,13 @@ var useTACApi = function useTACApi() {
|
|
|
8565
8583
|
* @param onDialogClose - Optional callback to close a dialog.
|
|
8566
8584
|
* @returns A mutation result for posting a SIGMET.
|
|
8567
8585
|
*/
|
|
8568
|
-
var usePostSigmet = function usePostSigmet(
|
|
8586
|
+
var usePostSigmet = function usePostSigmet() {
|
|
8569
8587
|
var _useAuthenticationCon2 = useAuthenticationContext(),
|
|
8570
8588
|
auth = _useAuthenticationCon2.auth;
|
|
8571
8589
|
var dispatch = useDispatch();
|
|
8572
8590
|
var queryClient = useQueryClient();
|
|
8591
|
+
var _useWarningsTranslati = useWarningsTranslation(),
|
|
8592
|
+
t = _useWarningsTranslati.t;
|
|
8573
8593
|
return useMutation({
|
|
8574
8594
|
mutationFn: function mutationFn(formData) {
|
|
8575
8595
|
if (!auth) {
|
|
@@ -8578,25 +8598,30 @@ var usePostSigmet = function usePostSigmet(snackBarMessage) {
|
|
|
8578
8598
|
return postSigmet(auth, formData);
|
|
8579
8599
|
},
|
|
8580
8600
|
onSuccess: function () {
|
|
8581
|
-
var _onSuccess = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
8601
|
+
var _onSuccess = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data, variables) {
|
|
8602
|
+
var snackbarKey, warningType;
|
|
8582
8603
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8583
8604
|
while (1) switch (_context.prev = _context.next) {
|
|
8584
8605
|
case 0:
|
|
8606
|
+
snackbarKey = getAviationSnackbarKey(variables.changeStatusTo);
|
|
8607
|
+
warningType = 'SIGMET';
|
|
8585
8608
|
dispatch(snackbarActions.openSnackbar({
|
|
8586
8609
|
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
8587
|
-
key:
|
|
8610
|
+
key: t(snackbarKey, {
|
|
8611
|
+
warningType: warningType
|
|
8612
|
+
})
|
|
8588
8613
|
}));
|
|
8589
|
-
_context.next =
|
|
8614
|
+
_context.next = 5;
|
|
8590
8615
|
return queryClient.invalidateQueries({
|
|
8591
8616
|
queryKey: ['sigmet-list']
|
|
8592
8617
|
});
|
|
8593
|
-
case
|
|
8618
|
+
case 5:
|
|
8594
8619
|
case "end":
|
|
8595
8620
|
return _context.stop();
|
|
8596
8621
|
}
|
|
8597
8622
|
}, _callee);
|
|
8598
8623
|
}));
|
|
8599
|
-
function onSuccess() {
|
|
8624
|
+
function onSuccess(_x, _x2) {
|
|
8600
8625
|
return _onSuccess.apply(this, arguments);
|
|
8601
8626
|
}
|
|
8602
8627
|
return onSuccess;
|
|
@@ -8610,11 +8635,13 @@ var usePostSigmet = function usePostSigmet(snackBarMessage) {
|
|
|
8610
8635
|
* @param onDialogClose - Optional callback to close a dialog.
|
|
8611
8636
|
* @returns A mutation result for posting an AIRMET.
|
|
8612
8637
|
*/
|
|
8613
|
-
var usePostAirmet = function usePostAirmet(
|
|
8638
|
+
var usePostAirmet = function usePostAirmet() {
|
|
8614
8639
|
var _useAuthenticationCon3 = useAuthenticationContext(),
|
|
8615
8640
|
auth = _useAuthenticationCon3.auth;
|
|
8616
8641
|
var dispatch = useDispatch();
|
|
8617
8642
|
var queryClient = useQueryClient();
|
|
8643
|
+
var _useWarningsTranslati2 = useWarningsTranslation(),
|
|
8644
|
+
t = _useWarningsTranslati2.t;
|
|
8618
8645
|
return useMutation({
|
|
8619
8646
|
mutationFn: function mutationFn(formData) {
|
|
8620
8647
|
if (!auth) {
|
|
@@ -8623,25 +8650,30 @@ var usePostAirmet = function usePostAirmet(snackBarMessage) {
|
|
|
8623
8650
|
return postAirmet(auth, formData);
|
|
8624
8651
|
},
|
|
8625
8652
|
onSuccess: function () {
|
|
8626
|
-
var _onSuccess2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
8653
|
+
var _onSuccess2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data, variables) {
|
|
8654
|
+
var snackbarKey, warningType;
|
|
8627
8655
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8628
8656
|
while (1) switch (_context2.prev = _context2.next) {
|
|
8629
8657
|
case 0:
|
|
8658
|
+
snackbarKey = getAviationSnackbarKey(variables.changeStatusTo);
|
|
8659
|
+
warningType = 'AIRMET';
|
|
8630
8660
|
dispatch(snackbarActions.openSnackbar({
|
|
8631
8661
|
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
8632
|
-
key:
|
|
8662
|
+
key: t(snackbarKey, {
|
|
8663
|
+
warningType: warningType
|
|
8664
|
+
})
|
|
8633
8665
|
}));
|
|
8634
|
-
_context2.next =
|
|
8666
|
+
_context2.next = 5;
|
|
8635
8667
|
return queryClient.invalidateQueries({
|
|
8636
8668
|
queryKey: ['airmet-list']
|
|
8637
8669
|
});
|
|
8638
|
-
case
|
|
8670
|
+
case 5:
|
|
8639
8671
|
case "end":
|
|
8640
8672
|
return _context2.stop();
|
|
8641
8673
|
}
|
|
8642
8674
|
}, _callee2);
|
|
8643
8675
|
}));
|
|
8644
|
-
function onSuccess() {
|
|
8676
|
+
function onSuccess(_x3, _x4) {
|
|
8645
8677
|
return _onSuccess2.apply(this, arguments);
|
|
8646
8678
|
}
|
|
8647
8679
|
return onSuccess;
|
|
@@ -8984,7 +9016,8 @@ var WarningsMapView = function WarningsMapView(_ref) {
|
|
|
8984
9016
|
defaultMapPreset = _ref.defaultMapPreset,
|
|
8985
9017
|
_ref$isSnapshot = _ref.isSnapshot,
|
|
8986
9018
|
isSnapshot = _ref$isSnapshot === void 0 ? false : _ref$isSnapshot;
|
|
8987
|
-
var
|
|
9019
|
+
var defaultMapPresetBbox = geojsonFeature != null && geojsonFeature.features.length ? undefined : defaultBbox;
|
|
9020
|
+
var defaultBbox$1 = (defaultMapPreset == null ? void 0 : defaultMapPreset.proj) || defaultMapPresetBbox;
|
|
8988
9021
|
var defaultBaseLayer = (defaultMapPreset == null || (_defaultMapPreset$lay = defaultMapPreset.layers) == null ? void 0 : _defaultMapPreset$lay.find(function (layer) {
|
|
8989
9022
|
return layer.layerType === LayerType.baseLayer;
|
|
8990
9023
|
})) || defaultLayers.baseLayerGrey;
|
|
@@ -8993,17 +9026,16 @@ var WarningsMapView = function WarningsMapView(_ref) {
|
|
|
8993
9026
|
})) || defaultLayers.overLayer;
|
|
8994
9027
|
var mapId = React.useRef("WarningsMapView_" + generateMapId()).current;
|
|
8995
9028
|
var warningLayer = {
|
|
8996
|
-
id: mapId + "geojsonfeature",
|
|
8997
9029
|
geojson: geojsonFeature,
|
|
8998
9030
|
layerType: LayerType.featureLayer
|
|
8999
9031
|
};
|
|
9000
9032
|
var viewRef = useRef(viewUtils.makeView());
|
|
9001
9033
|
React.useEffect(function () {
|
|
9002
|
-
if (viewRef.current.getProjection().getCode() !== (defaultBbox == null ? void 0 : defaultBbox.srs)) {
|
|
9003
|
-
viewRef.current = viewUtils.makeView(defaultBbox == null ? void 0 : defaultBbox.srs);
|
|
9034
|
+
if (viewRef.current.getProjection().getCode() !== (defaultBbox$1 == null ? void 0 : defaultBbox$1.srs)) {
|
|
9035
|
+
viewRef.current = viewUtils.makeView(defaultBbox$1 == null ? void 0 : defaultBbox$1.srs);
|
|
9004
9036
|
}
|
|
9005
|
-
defaultBbox && defaultBbox.bbox ? viewUtils.setViewFromExtent(viewRef.current, defaultBbox == null ? void 0 : defaultBbox.bbox) : viewUtils.setViewFromFeature(viewRef.current, geojsonFeature);
|
|
9006
|
-
}, [defaultBbox, geojsonFeature]);
|
|
9037
|
+
defaultBbox$1 && defaultBbox$1.bbox ? viewUtils.setViewFromExtent(viewRef.current, defaultBbox$1 == null ? void 0 : defaultBbox$1.bbox) : viewUtils.setViewFromFeature(viewRef.current, geojsonFeature);
|
|
9038
|
+
}, [defaultBbox$1, geojsonFeature]);
|
|
9007
9039
|
return jsx("div", {
|
|
9008
9040
|
style: {
|
|
9009
9041
|
height: '200px',
|
|
@@ -9012,6 +9044,7 @@ var WarningsMapView = function WarningsMapView(_ref) {
|
|
|
9012
9044
|
children: jsxs(OpenLayersMapView, {
|
|
9013
9045
|
view: viewRef.current,
|
|
9014
9046
|
holdShiftToScroll: true,
|
|
9047
|
+
mapId: mapId,
|
|
9015
9048
|
children: [jsx(MapControls, {
|
|
9016
9049
|
style: {
|
|
9017
9050
|
top: 0
|
|
@@ -9330,7 +9363,7 @@ var getLevelStyle = function getLevelStyle(levelColor) {
|
|
|
9330
9363
|
paddingLeft: levelColor ? '0.5em' : 0,
|
|
9331
9364
|
paddingRight: '0.5em',
|
|
9332
9365
|
paddingBottom: '1px',
|
|
9333
|
-
marginLeft:
|
|
9366
|
+
marginLeft: NaN,
|
|
9334
9367
|
border: levelColor ? "solid 1px " + levelColor.borderColor : 'none'
|
|
9335
9368
|
};
|
|
9336
9369
|
};
|
|
@@ -9801,12 +9834,12 @@ var Phenomenon = function Phenomenon(_ref) {
|
|
|
9801
9834
|
children: warningFormPhenomena.map(function (phenomenon) {
|
|
9802
9835
|
return jsx(MenuItem, {
|
|
9803
9836
|
value: phenomenon.key,
|
|
9804
|
-
children: jsxs(
|
|
9837
|
+
children: jsxs(Grid, {
|
|
9805
9838
|
container: true,
|
|
9806
9839
|
justifyContent: "space-between",
|
|
9807
|
-
children: [jsx(
|
|
9840
|
+
children: [jsx(Grid, {
|
|
9808
9841
|
children: t(phenomenon.translationKey)
|
|
9809
|
-
}), jsx(
|
|
9842
|
+
}), jsx(Grid, {
|
|
9810
9843
|
sx: {
|
|
9811
9844
|
minWidth: 56
|
|
9812
9845
|
},
|
|
@@ -10050,16 +10083,16 @@ var ContainerGrid = styled('div')(function (_ref3) {
|
|
|
10050
10083
|
var theme = _ref3.theme;
|
|
10051
10084
|
return _ref4 = {
|
|
10052
10085
|
backgroundColor: theme.palette.background.paper,
|
|
10053
|
-
'.
|
|
10086
|
+
'.MuiGrid-grid-sm-6, .MuiGrid-grid-sm-4': {
|
|
10054
10087
|
width: '100%',
|
|
10055
10088
|
minWidth: '100%'
|
|
10056
10089
|
}
|
|
10057
10090
|
}, _ref4[containerQueryBreakpoint] = {
|
|
10058
|
-
'.
|
|
10091
|
+
'.MuiGrid-grid-sm-6': {
|
|
10059
10092
|
width: sm6Width,
|
|
10060
10093
|
minWidth: sm6Width
|
|
10061
10094
|
},
|
|
10062
|
-
'.
|
|
10095
|
+
'.MuiGrid-grid-sm-4': {
|
|
10063
10096
|
width: sm4Width,
|
|
10064
10097
|
minWidth: sm4Width
|
|
10065
10098
|
}
|
|
@@ -10192,6 +10225,8 @@ var Form = function Form(_ref5) {
|
|
|
10192
10225
|
})) : _ref5$onPublishForm,
|
|
10193
10226
|
_ref5$onClearForm = _ref5.onClearForm,
|
|
10194
10227
|
onClearForm = _ref5$onClearForm === void 0 ? function () {} : _ref5$onClearForm,
|
|
10228
|
+
_ref5$onCloseForm = _ref5.onCloseForm,
|
|
10229
|
+
onCloseForm = _ref5$onCloseForm === void 0 ? function () {} : _ref5$onCloseForm,
|
|
10195
10230
|
_ref5$onSaveAviationF = _ref5.onSaveAviationForm,
|
|
10196
10231
|
onSaveAviationForm = _ref5$onSaveAviationF === void 0 ? /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
10197
10232
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
@@ -10223,8 +10258,11 @@ var Form = function Form(_ref5) {
|
|
|
10223
10258
|
_ref5$warningType = _ref5.warningType,
|
|
10224
10259
|
warningType = _ref5$warningType === void 0 ? 'public' : _ref5$warningType,
|
|
10225
10260
|
mode = _ref5.mode,
|
|
10261
|
+
formState = _ref5.formState,
|
|
10226
10262
|
_ref5$onSetViewModeRe = _ref5.onSetViewModeResetArea,
|
|
10227
|
-
onSetViewModeResetArea = _ref5$onSetViewModeRe === void 0 ? function () {} : _ref5$onSetViewModeRe
|
|
10263
|
+
onSetViewModeResetArea = _ref5$onSetViewModeRe === void 0 ? function () {} : _ref5$onSetViewModeRe,
|
|
10264
|
+
storedStartGeoJSON = _ref5.storedStartGeoJSON,
|
|
10265
|
+
storedEndGeoJSON = _ref5.storedEndGeoJSON;
|
|
10228
10266
|
var _React$useState = React.useState(false),
|
|
10229
10267
|
isPublishing = _React$useState[0],
|
|
10230
10268
|
setIsPublishing = _React$useState[1];
|
|
@@ -10234,6 +10272,12 @@ var Form = function Form(_ref5) {
|
|
|
10234
10272
|
var _useTACApi = useTACApi(),
|
|
10235
10273
|
fetchSigmetTAC = _useTACApi.fetchSigmetTAC,
|
|
10236
10274
|
fetchAirmetTAC = _useTACApi.fetchAirmetTAC;
|
|
10275
|
+
var _useShortTestHelpers = useShortTestHelpers(),
|
|
10276
|
+
isShortTest = _useShortTestHelpers.isShortTest;
|
|
10277
|
+
var confirmationDialog = useConfirmationDialog();
|
|
10278
|
+
var formMethods = useForm({
|
|
10279
|
+
defaultValues: {}
|
|
10280
|
+
});
|
|
10237
10281
|
var initialPublicWarningArea = (publicWarningDetails == null || (_publicWarningDetails = publicWarningDetails.areas) == null ? void 0 : _publicWarningDetails.length) && (publicWarningDetails == null || (_publicWarningDetails2 = publicWarningDetails.areas[0]) == null ? void 0 : _publicWarningDetails2.geoJSON);
|
|
10238
10282
|
var _React$useState3 = React.useState(initialPublicWarningArea),
|
|
10239
10283
|
warningGeoJSONFeature = _React$useState3[0],
|
|
@@ -10248,7 +10292,8 @@ var Form = function Form(_ref5) {
|
|
|
10248
10292
|
reset = _useFormContext.reset,
|
|
10249
10293
|
dirtyFields = _useFormContext.formState.dirtyFields,
|
|
10250
10294
|
getValues = _useFormContext.getValues,
|
|
10251
|
-
setValue = _useFormContext.setValue
|
|
10295
|
+
setValue = _useFormContext.setValue,
|
|
10296
|
+
watch = _useFormContext.watch;
|
|
10252
10297
|
var _useDraftFormHelpers = useDraftFormHelpers(),
|
|
10253
10298
|
toggleIsDraft = _useDraftFormHelpers.toggleIsDraft,
|
|
10254
10299
|
DraftFieldHelper = _useDraftFormHelpers.DraftFieldHelper;
|
|
@@ -10313,29 +10358,103 @@ var Form = function Form(_ref5) {
|
|
|
10313
10358
|
}())();
|
|
10314
10359
|
}
|
|
10315
10360
|
};
|
|
10316
|
-
var
|
|
10317
|
-
|
|
10318
|
-
|
|
10319
|
-
|
|
10320
|
-
|
|
10321
|
-
|
|
10322
|
-
|
|
10323
|
-
|
|
10324
|
-
|
|
10325
|
-
|
|
10326
|
-
|
|
10327
|
-
|
|
10328
|
-
|
|
10329
|
-
|
|
10330
|
-
|
|
10331
|
-
|
|
10332
|
-
|
|
10333
|
-
|
|
10334
|
-
|
|
10335
|
-
|
|
10336
|
-
|
|
10337
|
-
|
|
10338
|
-
|
|
10361
|
+
var showConfirmDialog = function showConfirmDialog(action) {
|
|
10362
|
+
return confirmationDialog({
|
|
10363
|
+
title: getConfirmationDialogTitle(t, action, warningType || 'airmet'),
|
|
10364
|
+
description: getConfirmationDialogContent(t, action, warningType || 'airmet'),
|
|
10365
|
+
confirmLabel: getConfirmationDialogButtonLabel(t, action, warningType || 'airmet'),
|
|
10366
|
+
cancelLabel: getConfirmationDialogCancelLabel(t, action),
|
|
10367
|
+
catchOnCancel: action === ProductAction.CLOSE,
|
|
10368
|
+
content: isVAPhenomenon(selectedAviationProduct, action) && !isShortTest() ? jsx(FormProvider, Object.assign({}, formMethods, {
|
|
10369
|
+
children: jsx(CancelSigmetVolcanicMovements, {
|
|
10370
|
+
sigmet: selectedAviationProduct,
|
|
10371
|
+
productConfig: aviationConfig
|
|
10372
|
+
})
|
|
10373
|
+
})) : null
|
|
10374
|
+
});
|
|
10375
|
+
};
|
|
10376
|
+
var handleSubmitAviationProduct = function handleSubmitAviationProduct(action, warningType) {
|
|
10377
|
+
if (isSaving) {
|
|
10378
|
+
return;
|
|
10379
|
+
}
|
|
10380
|
+
switch (action) {
|
|
10381
|
+
case ProductAction.SAVE:
|
|
10382
|
+
toggleIsDraft(true);
|
|
10383
|
+
void handleSubmit( /*#__PURE__*/function () {
|
|
10384
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(formValues) {
|
|
10385
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
10386
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
10387
|
+
case 0:
|
|
10388
|
+
setIsSaving(true);
|
|
10389
|
+
_context6.next = 3;
|
|
10390
|
+
return onSaveAviationForm(formValues, 'DRAFT', warningType)["catch"](function () {});
|
|
10391
|
+
case 3:
|
|
10392
|
+
setIsSaving(false);
|
|
10393
|
+
case 4:
|
|
10394
|
+
case "end":
|
|
10395
|
+
return _context6.stop();
|
|
10396
|
+
}
|
|
10397
|
+
}, _callee6);
|
|
10398
|
+
}));
|
|
10399
|
+
return function (_x3) {
|
|
10400
|
+
return _ref11.apply(this, arguments);
|
|
10401
|
+
};
|
|
10402
|
+
}())();
|
|
10403
|
+
break;
|
|
10404
|
+
case ProductAction.PUBLISH:
|
|
10405
|
+
void handleSubmit( /*#__PURE__*/function () {
|
|
10406
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(formValues) {
|
|
10407
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
10408
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
10409
|
+
case 0:
|
|
10410
|
+
_context8.next = 2;
|
|
10411
|
+
return showConfirmDialog(action).then( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
10412
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
10413
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
10414
|
+
case 0:
|
|
10415
|
+
setIsPublishing(true);
|
|
10416
|
+
_context7.next = 3;
|
|
10417
|
+
return onSaveAviationForm(formValues, 'PUBLISHED', warningType)["catch"](function () {});
|
|
10418
|
+
case 3:
|
|
10419
|
+
case "end":
|
|
10420
|
+
return _context7.stop();
|
|
10421
|
+
}
|
|
10422
|
+
}, _callee7);
|
|
10423
|
+
})));
|
|
10424
|
+
case 2:
|
|
10425
|
+
setIsPublishing(false);
|
|
10426
|
+
onCloseForm();
|
|
10427
|
+
case 4:
|
|
10428
|
+
case "end":
|
|
10429
|
+
return _context8.stop();
|
|
10430
|
+
}
|
|
10431
|
+
}, _callee8);
|
|
10432
|
+
}));
|
|
10433
|
+
return function (_x4) {
|
|
10434
|
+
return _ref12.apply(this, arguments);
|
|
10435
|
+
};
|
|
10436
|
+
}())();
|
|
10437
|
+
break;
|
|
10438
|
+
case ProductAction.CANCEL:
|
|
10439
|
+
void showConfirmDialog(action).then(function () {
|
|
10440
|
+
setIsPublishing(true);
|
|
10441
|
+
// if volcanic sigmet - add to which FIR it's moving
|
|
10442
|
+
if (isVAPhenomenon(selectedAviationProduct, action)) {
|
|
10443
|
+
void onSaveAviationForm(prepareCancelSigmet(selectedAviationProduct, watch('vaSigmetMoveToFIR')), 'CANCELLED', warningType);
|
|
10444
|
+
} else {
|
|
10445
|
+
void onSaveAviationForm(selectedAviationProduct, 'CANCELLED', warningType);
|
|
10446
|
+
}
|
|
10447
|
+
setIsPublishing(false);
|
|
10448
|
+
onCloseForm();
|
|
10449
|
+
});
|
|
10450
|
+
break;
|
|
10451
|
+
case ProductAction.RENEW:
|
|
10452
|
+
case ProductAction.DISCARD:
|
|
10453
|
+
case ProductAction.DUPLICATE:
|
|
10454
|
+
case ProductAction.CLOSE:
|
|
10455
|
+
break;
|
|
10456
|
+
default:
|
|
10457
|
+
console.warn("Unhandled product action: " + action);
|
|
10339
10458
|
}
|
|
10340
10459
|
};
|
|
10341
10460
|
var onPressClear = function onPressClear() {
|
|
@@ -10452,7 +10571,9 @@ var Form = function Form(_ref5) {
|
|
|
10452
10571
|
product: selectedAviationProduct,
|
|
10453
10572
|
getTAC: function getTAC(product) {
|
|
10454
10573
|
return fetchSigmetTAC(product);
|
|
10455
|
-
}
|
|
10574
|
+
},
|
|
10575
|
+
storedGeoJSON: storedStartGeoJSON,
|
|
10576
|
+
storedEndGeoJSON: storedEndGeoJSON
|
|
10456
10577
|
}) : jsx(AirmetForm, {
|
|
10457
10578
|
showMap: false,
|
|
10458
10579
|
mode: mode,
|
|
@@ -10463,17 +10584,18 @@ var Form = function Form(_ref5) {
|
|
|
10463
10584
|
product: selectedAviationProduct,
|
|
10464
10585
|
getTAC: function getTAC(product) {
|
|
10465
10586
|
return fetchAirmetTAC(product);
|
|
10466
|
-
}
|
|
10587
|
+
},
|
|
10588
|
+
storedGeoJSON: storedStartGeoJSON
|
|
10467
10589
|
})
|
|
10468
10590
|
}) : jsx(ContainerGrid, {
|
|
10469
|
-
children: jsxs(
|
|
10591
|
+
children: jsxs(Grid, {
|
|
10470
10592
|
size: {
|
|
10471
10593
|
xs: 12
|
|
10472
10594
|
},
|
|
10473
10595
|
container: true,
|
|
10474
10596
|
rowSpacing: 2,
|
|
10475
10597
|
columnSpacing: 2,
|
|
10476
|
-
children: [jsx(
|
|
10598
|
+
children: [jsx(Grid, {
|
|
10477
10599
|
size: {
|
|
10478
10600
|
xs: 12
|
|
10479
10601
|
},
|
|
@@ -10481,7 +10603,7 @@ var Form = function Form(_ref5) {
|
|
|
10481
10603
|
isDisabled: areFieldsDisabled,
|
|
10482
10604
|
isReadOnly: isReadOnly
|
|
10483
10605
|
})
|
|
10484
|
-
}), jsx(
|
|
10606
|
+
}), jsx(Grid, {
|
|
10485
10607
|
size: {
|
|
10486
10608
|
xs: 12
|
|
10487
10609
|
},
|
|
@@ -10492,7 +10614,7 @@ var Form = function Form(_ref5) {
|
|
|
10492
10614
|
onAddObject: onAddObject,
|
|
10493
10615
|
isDisabled: areFieldsDisabled || isReadOnly
|
|
10494
10616
|
})
|
|
10495
|
-
}), jsx(
|
|
10617
|
+
}), jsx(Grid, {
|
|
10496
10618
|
size: {
|
|
10497
10619
|
xs: 12
|
|
10498
10620
|
},
|
|
@@ -10501,7 +10623,7 @@ var Form = function Form(_ref5) {
|
|
|
10501
10623
|
defaultMapPreset: defaultMapPreset,
|
|
10502
10624
|
isSnapshot: isSnapshot
|
|
10503
10625
|
})
|
|
10504
|
-
}), jsx(
|
|
10626
|
+
}), jsx(Grid, {
|
|
10505
10627
|
size: {
|
|
10506
10628
|
xs: 12,
|
|
10507
10629
|
sm: 6
|
|
@@ -10510,7 +10632,7 @@ var Form = function Form(_ref5) {
|
|
|
10510
10632
|
isDisabled: areFieldsDisabled,
|
|
10511
10633
|
isReadOnly: isReadOnly
|
|
10512
10634
|
})
|
|
10513
|
-
}), jsx(
|
|
10635
|
+
}), jsx(Grid, {
|
|
10514
10636
|
size: {
|
|
10515
10637
|
xs: 12,
|
|
10516
10638
|
sm: 6
|
|
@@ -10519,13 +10641,13 @@ var Form = function Form(_ref5) {
|
|
|
10519
10641
|
isDisabled: areFieldsDisabled,
|
|
10520
10642
|
isReadOnly: isReadOnly
|
|
10521
10643
|
})
|
|
10522
|
-
}), jsxs(
|
|
10644
|
+
}), jsxs(Grid, {
|
|
10523
10645
|
size: {
|
|
10524
10646
|
xs: 12
|
|
10525
10647
|
},
|
|
10526
10648
|
container: true,
|
|
10527
10649
|
spacing: 2,
|
|
10528
|
-
children: [jsx(
|
|
10650
|
+
children: [jsx(Grid, {
|
|
10529
10651
|
size: {
|
|
10530
10652
|
xs: 12,
|
|
10531
10653
|
sm: 6
|
|
@@ -10534,7 +10656,7 @@ var Form = function Form(_ref5) {
|
|
|
10534
10656
|
isDisabled: areFieldsDisabled,
|
|
10535
10657
|
isReadOnly: isReadOnly
|
|
10536
10658
|
})
|
|
10537
|
-
}), jsx(
|
|
10659
|
+
}), jsx(Grid, {
|
|
10538
10660
|
size: {
|
|
10539
10661
|
xs: 12,
|
|
10540
10662
|
sm: 6
|
|
@@ -10544,13 +10666,13 @@ var Form = function Form(_ref5) {
|
|
|
10544
10666
|
isReadOnly: isReadOnly
|
|
10545
10667
|
})
|
|
10546
10668
|
})]
|
|
10547
|
-
}), jsx(
|
|
10669
|
+
}), jsx(Grid, {
|
|
10548
10670
|
size: {
|
|
10549
10671
|
xs: 12
|
|
10550
10672
|
},
|
|
10551
10673
|
container: true,
|
|
10552
10674
|
spacing: 2,
|
|
10553
|
-
children: jsx(
|
|
10675
|
+
children: jsx(Grid, {
|
|
10554
10676
|
size: {
|
|
10555
10677
|
xs: 12
|
|
10556
10678
|
},
|
|
@@ -10564,7 +10686,7 @@ var Form = function Form(_ref5) {
|
|
|
10564
10686
|
}), jsx(DraftFieldHelper, {}), jsx(ReactHookFormHiddenInput, {
|
|
10565
10687
|
name: "id"
|
|
10566
10688
|
})]
|
|
10567
|
-
}), !isReadOnly && jsx(Box, {
|
|
10689
|
+
}), formState !== 'cancel' && !isReadOnly && jsx(Box, {
|
|
10568
10690
|
sx: {
|
|
10569
10691
|
padding: '24px 10px 14px 10px',
|
|
10570
10692
|
position: 'absolute',
|
|
@@ -10577,10 +10699,10 @@ var Form = function Form(_ref5) {
|
|
|
10577
10699
|
border: 'none'
|
|
10578
10700
|
},
|
|
10579
10701
|
children: jsx(ContainerGrid, {
|
|
10580
|
-
children: jsxs(
|
|
10702
|
+
children: jsxs(Grid, {
|
|
10581
10703
|
container: true,
|
|
10582
10704
|
spacing: 2,
|
|
10583
|
-
children: [jsx(
|
|
10705
|
+
children: [jsx(Grid, {
|
|
10584
10706
|
size: {
|
|
10585
10707
|
xs: 12,
|
|
10586
10708
|
sm: 4
|
|
@@ -10595,7 +10717,7 @@ var Form = function Form(_ref5) {
|
|
|
10595
10717
|
onClick: onPressClear,
|
|
10596
10718
|
children: t('warning-button-clear')
|
|
10597
10719
|
})
|
|
10598
|
-
}), jsx(
|
|
10720
|
+
}), jsx(Grid, {
|
|
10599
10721
|
size: {
|
|
10600
10722
|
xs: 12,
|
|
10601
10723
|
sm: 4
|
|
@@ -10608,7 +10730,7 @@ var Form = function Form(_ref5) {
|
|
|
10608
10730
|
},
|
|
10609
10731
|
disabled: isPublishing,
|
|
10610
10732
|
onClick: function onClick() {
|
|
10611
|
-
return selectedAviationProduct ? handleSubmitAviationProduct(
|
|
10733
|
+
return selectedAviationProduct ? handleSubmitAviationProduct(ProductAction.SAVE, warningType) : onPressSave();
|
|
10612
10734
|
},
|
|
10613
10735
|
children: jsxs("span", {
|
|
10614
10736
|
style: {
|
|
@@ -10621,7 +10743,7 @@ var Form = function Form(_ref5) {
|
|
|
10621
10743
|
})]
|
|
10622
10744
|
})
|
|
10623
10745
|
})
|
|
10624
|
-
}), jsx(
|
|
10746
|
+
}), jsx(Grid, {
|
|
10625
10747
|
size: {
|
|
10626
10748
|
xs: 12,
|
|
10627
10749
|
sm: 4
|
|
@@ -10632,7 +10754,9 @@ var Form = function Form(_ref5) {
|
|
|
10632
10754
|
width: '100%'
|
|
10633
10755
|
},
|
|
10634
10756
|
disabled: isSaving,
|
|
10635
|
-
onClick:
|
|
10757
|
+
onClick: function onClick() {
|
|
10758
|
+
selectedAviationProduct ? handleSubmitAviationProduct(ProductAction.PUBLISH, warningType) : onPressPublish();
|
|
10759
|
+
},
|
|
10636
10760
|
children: jsxs("span", {
|
|
10637
10761
|
style: {
|
|
10638
10762
|
position: 'relative'
|
|
@@ -10647,6 +10771,51 @@ var Form = function Form(_ref5) {
|
|
|
10647
10771
|
})]
|
|
10648
10772
|
})
|
|
10649
10773
|
})
|
|
10774
|
+
}), formState === 'cancel' && jsx(Box, {
|
|
10775
|
+
sx: {
|
|
10776
|
+
padding: '24px 10px 14px 10px',
|
|
10777
|
+
position: 'absolute',
|
|
10778
|
+
bottom: 0,
|
|
10779
|
+
width: '100%',
|
|
10780
|
+
backgroundColor: 'geowebColors.background.surfaceApp',
|
|
10781
|
+
boxShadow: '0 2px 4px 0 rgba(0, 0, 0, 0.5)',
|
|
10782
|
+
zIndex: 1,
|
|
10783
|
+
overflowX: 'hidden',
|
|
10784
|
+
border: 'none'
|
|
10785
|
+
},
|
|
10786
|
+
children: jsx(ContainerGrid, {
|
|
10787
|
+
children: jsx(Grid, {
|
|
10788
|
+
container: true,
|
|
10789
|
+
spacing: 2,
|
|
10790
|
+
children: jsx(Grid, {
|
|
10791
|
+
size: {
|
|
10792
|
+
xs: 12,
|
|
10793
|
+
sm: 4,
|
|
10794
|
+
md: 4
|
|
10795
|
+
},
|
|
10796
|
+
children: jsx(Button, {
|
|
10797
|
+
variant: "primary",
|
|
10798
|
+
sx: {
|
|
10799
|
+
width: '100%'
|
|
10800
|
+
},
|
|
10801
|
+
disabled: isSaving,
|
|
10802
|
+
onClick: function onClick() {
|
|
10803
|
+
selectedAviationProduct ? handleSubmitAviationProduct(ProductAction.CANCEL, warningType) : onPressPublish();
|
|
10804
|
+
},
|
|
10805
|
+
children: jsxs("span", {
|
|
10806
|
+
style: {
|
|
10807
|
+
position: 'relative'
|
|
10808
|
+
},
|
|
10809
|
+
children: [isPublishing ? t('warning-button-publishing') : t('warning-button-publish'), isPublishing && jsx(CircularProgress, {
|
|
10810
|
+
"data-testid": "spinner",
|
|
10811
|
+
color: "inherit",
|
|
10812
|
+
sx: spinnerSx
|
|
10813
|
+
})]
|
|
10814
|
+
})
|
|
10815
|
+
})
|
|
10816
|
+
})
|
|
10817
|
+
})
|
|
10818
|
+
})
|
|
10650
10819
|
})]
|
|
10651
10820
|
});
|
|
10652
10821
|
};
|
|
@@ -10681,7 +10850,7 @@ var PublicWarningsForm = function PublicWarningsForm(props) {
|
|
|
10681
10850
|
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
10682
10851
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
10683
10852
|
* */
|
|
10684
|
-
var config = getConfig();
|
|
10853
|
+
var config = sessionStorageProvider.getConfig();
|
|
10685
10854
|
var publicWarningBaseUrl = config.GW_DRAWINGS_BASE_URL || '';
|
|
10686
10855
|
// API
|
|
10687
10856
|
var getPublicWarningList = function getPublicWarningList(auth) {
|
|
@@ -10715,6 +10884,12 @@ var postPublicWarning = function postPublicWarning(auth, data) {
|
|
|
10715
10884
|
body: JSON.stringify(data)
|
|
10716
10885
|
}).then(handleResponse);
|
|
10717
10886
|
};
|
|
10887
|
+
var deleteWarning = function deleteWarning(warningId, auth) {
|
|
10888
|
+
return fetch(publicWarningBaseUrl + "/warnings/" + warningId + "?delete=true", {
|
|
10889
|
+
headers: getHeaders(auth),
|
|
10890
|
+
method: 'POST'
|
|
10891
|
+
}).then(handleResponse);
|
|
10892
|
+
};
|
|
10718
10893
|
|
|
10719
10894
|
/**
|
|
10720
10895
|
* @param disabled - Disables fetching, but still returns cached values.
|
|
@@ -10876,6 +11051,49 @@ var useMutateWarning = function useMutateWarning(snackBarMessage) {
|
|
|
10876
11051
|
}()
|
|
10877
11052
|
}));
|
|
10878
11053
|
};
|
|
11054
|
+
var useMutateDeleteWarning = function useMutateDeleteWarning() {
|
|
11055
|
+
var queryClient = useQueryClient();
|
|
11056
|
+
var dispatch = useDispatch();
|
|
11057
|
+
var _useAuthenticationCon3 = useAuthenticationContext(),
|
|
11058
|
+
auth = _useAuthenticationCon3.auth;
|
|
11059
|
+
return useMutation({
|
|
11060
|
+
mutationFn: function mutationFn(_ref6) {
|
|
11061
|
+
var id = _ref6.id;
|
|
11062
|
+
if (!auth) {
|
|
11063
|
+
throw new Error('Authentication context not found');
|
|
11064
|
+
}
|
|
11065
|
+
return deleteWarning(id, auth);
|
|
11066
|
+
},
|
|
11067
|
+
onSuccess: function () {
|
|
11068
|
+
var _onSuccess3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_, variables) {
|
|
11069
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
11070
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
11071
|
+
case 0:
|
|
11072
|
+
void queryClient.cancelQueries({
|
|
11073
|
+
queryKey: ['public-warning-list']
|
|
11074
|
+
});
|
|
11075
|
+
queryClient.setQueryData(['public-warning-list'], function (old) {
|
|
11076
|
+
return old == null ? void 0 : old.filter(function (warning) {
|
|
11077
|
+
return warning.id !== variables.id;
|
|
11078
|
+
});
|
|
11079
|
+
});
|
|
11080
|
+
dispatch(snackbarActions.openSnackbar({
|
|
11081
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
11082
|
+
key: t('warning-dialog-delete-succes')
|
|
11083
|
+
}));
|
|
11084
|
+
case 3:
|
|
11085
|
+
case "end":
|
|
11086
|
+
return _context3.stop();
|
|
11087
|
+
}
|
|
11088
|
+
}, _callee3);
|
|
11089
|
+
}));
|
|
11090
|
+
function onSuccess(_x5, _x6) {
|
|
11091
|
+
return _onSuccess3.apply(this, arguments);
|
|
11092
|
+
}
|
|
11093
|
+
return onSuccess;
|
|
11094
|
+
}()
|
|
11095
|
+
});
|
|
11096
|
+
};
|
|
10879
11097
|
var usePublishWarning = function usePublishWarning() {
|
|
10880
11098
|
return useMutateWarning('warning-publish-succes');
|
|
10881
11099
|
};
|
|
@@ -10950,8 +11168,6 @@ var PublicWarningsFormConnect = function PublicWarningsFormConnect(_ref) {
|
|
|
10950
11168
|
_ref$warningType = _ref.warningType,
|
|
10951
11169
|
warningType = _ref$warningType === void 0 ? 'public' : _ref$warningType,
|
|
10952
11170
|
mode = _ref.mode;
|
|
10953
|
-
var _useWarningsTranslati = useWarningsTranslation(),
|
|
10954
|
-
t = _useWarningsTranslati.t;
|
|
10955
11171
|
var _useSelector = useSelector(selectPublicWarningState),
|
|
10956
11172
|
warning = _useSelector.warning,
|
|
10957
11173
|
object = _useSelector.object,
|
|
@@ -10962,13 +11178,9 @@ var PublicWarningsFormConnect = function PublicWarningsFormConnect(_ref) {
|
|
|
10962
11178
|
publishWarning = _usePublishWarning.mutateAsync;
|
|
10963
11179
|
var _useSaveWarning = useSaveWarning(),
|
|
10964
11180
|
saveWarning = _useSaveWarning.mutateAsync;
|
|
10965
|
-
var _usePostSigmet = usePostSigmet(
|
|
10966
|
-
warningType: 'sigmet'.toUpperCase()
|
|
10967
|
-
})),
|
|
11181
|
+
var _usePostSigmet = usePostSigmet(),
|
|
10968
11182
|
postSigmet = _usePostSigmet.mutateAsync;
|
|
10969
|
-
var _usePostAirmet = usePostAirmet(
|
|
10970
|
-
warningType: 'airmet'.toUpperCase()
|
|
10971
|
-
})),
|
|
11183
|
+
var _usePostAirmet = usePostAirmet(),
|
|
10972
11184
|
postAirmet = _usePostAirmet.mutateAsync;
|
|
10973
11185
|
var _useAuthenticationCon = useAuthenticationContext$1(),
|
|
10974
11186
|
auth = _useAuthenticationCon.auth;
|
|
@@ -11002,6 +11214,12 @@ var PublicWarningsFormConnect = function PublicWarningsFormConnect(_ref) {
|
|
|
11002
11214
|
var clearForm = function clearForm() {
|
|
11003
11215
|
dispatch(publicWarningFormActions.removeAllAreas());
|
|
11004
11216
|
};
|
|
11217
|
+
var closeForm = function closeForm() {
|
|
11218
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
11219
|
+
setOpen: false,
|
|
11220
|
+
type: publicWarningDialogType
|
|
11221
|
+
}));
|
|
11222
|
+
};
|
|
11005
11223
|
var saveAviationForm = /*#__PURE__*/function () {
|
|
11006
11224
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(productToPost, newStatus, warningType) {
|
|
11007
11225
|
var uuid, _postProductParam, postProductParam, errorMessage;
|
|
@@ -11092,6 +11310,9 @@ var PublicWarningsFormConnect = function PublicWarningsFormConnect(_ref) {
|
|
|
11092
11310
|
if ((selectedAviationProduct == null ? void 0 : selectedAviationProduct.status) === 'DRAFT') {
|
|
11093
11311
|
return false;
|
|
11094
11312
|
}
|
|
11313
|
+
if (formState === 'cancel') {
|
|
11314
|
+
return true;
|
|
11315
|
+
}
|
|
11095
11316
|
if (formState === 'edit') {
|
|
11096
11317
|
return false;
|
|
11097
11318
|
}
|
|
@@ -11113,12 +11334,26 @@ var PublicWarningsFormConnect = function PublicWarningsFormConnect(_ref) {
|
|
|
11113
11334
|
area: area[0]
|
|
11114
11335
|
}));
|
|
11115
11336
|
};
|
|
11337
|
+
var selectedMapIds = useSelector(function (state) {
|
|
11338
|
+
return genericSelectors.getLinkedMaps(state, panelId);
|
|
11339
|
+
});
|
|
11340
|
+
var storedStartGeoJSON = useSelector(function (state) {
|
|
11341
|
+
var _state$layers;
|
|
11342
|
+
var layer = (_state$layers = state.layers) == null ? void 0 : _state$layers.byId["drawLayer-sigmetStartGeometry-" + selectedMapIds];
|
|
11343
|
+
return layer ? layer.geojson : undefined;
|
|
11344
|
+
});
|
|
11345
|
+
var storedEndGeoJSON = useSelector(function (state) {
|
|
11346
|
+
var _state$layers2;
|
|
11347
|
+
var layer = (_state$layers2 = state.layers) == null ? void 0 : _state$layers2.byId["drawLayer-sigmetEndGeometry-" + selectedMapIds];
|
|
11348
|
+
return layer ? layer.geojson : undefined;
|
|
11349
|
+
});
|
|
11116
11350
|
return jsx(PublicWarningsForm, {
|
|
11117
11351
|
object: object,
|
|
11118
11352
|
publicWarningDetails: warning == null ? void 0 : warning.warningDetail,
|
|
11119
11353
|
onPublishForm: publishForm,
|
|
11120
11354
|
onSaveForm: saveForm,
|
|
11121
11355
|
onClearForm: clearForm,
|
|
11356
|
+
onCloseForm: closeForm,
|
|
11122
11357
|
onSaveAviationForm: saveAviationForm,
|
|
11123
11358
|
isReadOnly: isReadOnly,
|
|
11124
11359
|
error: error,
|
|
@@ -11128,7 +11363,10 @@ var PublicWarningsFormConnect = function PublicWarningsFormConnect(_ref) {
|
|
|
11128
11363
|
selectedAviationProduct: selectedAviationProduct,
|
|
11129
11364
|
warningType: warningType,
|
|
11130
11365
|
mode: formMode,
|
|
11131
|
-
|
|
11366
|
+
formState: formState,
|
|
11367
|
+
onSetViewModeResetArea: onSetViewModeResetArea,
|
|
11368
|
+
storedStartGeoJSON: storedStartGeoJSON,
|
|
11369
|
+
storedEndGeoJSON: storedEndGeoJSON
|
|
11132
11370
|
}, (warning == null ? void 0 : warning.id) || (selectedAviationProduct == null ? void 0 : selectedAviationProduct.uuid) || 'new');
|
|
11133
11371
|
};
|
|
11134
11372
|
|
|
@@ -12243,7 +12481,7 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
|
|
|
12243
12481
|
},
|
|
12244
12482
|
isDisabled: isDisabled,
|
|
12245
12483
|
size: "medium",
|
|
12246
|
-
actionIcon: jsxs(
|
|
12484
|
+
actionIcon: jsxs(Grid, {
|
|
12247
12485
|
container: true,
|
|
12248
12486
|
alignItems: "center",
|
|
12249
12487
|
style: {
|
|
@@ -12309,7 +12547,7 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
|
|
|
12309
12547
|
sx: {
|
|
12310
12548
|
padding: '0px 24px 16px 24px'
|
|
12311
12549
|
},
|
|
12312
|
-
children: [jsxs(
|
|
12550
|
+
children: [jsxs(Grid, {
|
|
12313
12551
|
container: true,
|
|
12314
12552
|
justifyContent: "space-between",
|
|
12315
12553
|
alignItems: "center",
|
|
@@ -12488,7 +12726,7 @@ var WarningListColumnContent = function WarningListColumnContent(_ref) {
|
|
|
12488
12726
|
_ref$width = _ref.width,
|
|
12489
12727
|
width = _ref$width === void 0 ? 76 : _ref$width,
|
|
12490
12728
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
12491
|
-
return jsxs(
|
|
12729
|
+
return jsxs(Grid, {
|
|
12492
12730
|
sx: Object.assign({}, props.sx, {
|
|
12493
12731
|
width: width
|
|
12494
12732
|
}),
|
|
@@ -12616,11 +12854,19 @@ var WarningListItemMenu = function WarningListItemMenu(_ref) {
|
|
|
12616
12854
|
text: t('warning-list-button-renew'),
|
|
12617
12855
|
action: function action() {
|
|
12618
12856
|
if (warning) {
|
|
12619
|
-
onActionAviationWarning(warning);
|
|
12857
|
+
onActionAviationWarning(warning, ProductAction.RENEW);
|
|
12620
12858
|
}
|
|
12621
12859
|
},
|
|
12622
12860
|
icon: jsx(Update, {})
|
|
12623
|
-
}, aviationDuplicate
|
|
12861
|
+
}, aviationDuplicate, {
|
|
12862
|
+
text: 'CNL',
|
|
12863
|
+
action: function action() {
|
|
12864
|
+
if (warning) {
|
|
12865
|
+
onActionAviationWarning(warning, ProductAction.CANCEL);
|
|
12866
|
+
}
|
|
12867
|
+
},
|
|
12868
|
+
icon: jsx(Cancel, {})
|
|
12869
|
+
}];
|
|
12624
12870
|
case ProductStatus.CANCELLED:
|
|
12625
12871
|
return [];
|
|
12626
12872
|
case ProductStatus.EXPIRED:
|
|
@@ -12816,7 +13062,7 @@ var WarningListItem = function WarningListItem(_ref) {
|
|
|
12816
13062
|
},
|
|
12817
13063
|
"aria-label": "warning item for " + warning.id,
|
|
12818
13064
|
selected: activeWarningId === warning.id,
|
|
12819
|
-
children: jsxs(
|
|
13065
|
+
children: jsxs(Grid, {
|
|
12820
13066
|
className: "warning-list",
|
|
12821
13067
|
container: true,
|
|
12822
13068
|
rowSpacing: 0,
|
|
@@ -13092,7 +13338,7 @@ var WarningListHeaderContent = function WarningListHeaderContent(_ref) {
|
|
|
13092
13338
|
sortDirection = _ref.sortDirection,
|
|
13093
13339
|
sortable = _ref.sortable,
|
|
13094
13340
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
13095
|
-
return jsx(
|
|
13341
|
+
return jsx(Grid, {
|
|
13096
13342
|
sx: Object.assign({}, props.sx, {
|
|
13097
13343
|
width: width,
|
|
13098
13344
|
cursor: _onClick ? 'pointer' : 'default'
|
|
@@ -13303,32 +13549,26 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
13303
13549
|
containerType: 'inline-size'
|
|
13304
13550
|
},
|
|
13305
13551
|
"data-testid": "publicWarningList",
|
|
13306
|
-
children: [jsxs(
|
|
13307
|
-
container: true,
|
|
13308
|
-
justifyItems: "flex-end",
|
|
13552
|
+
children: [jsxs(Box, {
|
|
13309
13553
|
ref: filterRef,
|
|
13310
|
-
sx: (_sx = {
|
|
13311
|
-
|
|
13312
|
-
|
|
13313
|
-
|
|
13314
|
-
|
|
13315
|
-
|
|
13316
|
-
|
|
13317
|
-
},
|
|
13554
|
+
sx: (_sx = {
|
|
13555
|
+
display: 'flex',
|
|
13556
|
+
flexWrap: 'wrap',
|
|
13557
|
+
alignItems: 'flex-end',
|
|
13558
|
+
flexDirection: 'column'
|
|
13559
|
+
}, _sx["@container publicWarningList (min-width: " + breakpoints.desktop + "px)"] = {
|
|
13560
|
+
flexDirection: 'row',
|
|
13318
13561
|
' .create-warning': {
|
|
13319
|
-
order:
|
|
13562
|
+
order: 2
|
|
13320
13563
|
}
|
|
13321
13564
|
}, _sx),
|
|
13322
|
-
children: [jsx(
|
|
13565
|
+
children: [jsx(Box, {
|
|
13323
13566
|
className: "warning-filter",
|
|
13324
|
-
|
|
13325
|
-
|
|
13326
|
-
|
|
13327
|
-
|
|
13328
|
-
|
|
13329
|
-
xs: 12,
|
|
13330
|
-
sm: 12,
|
|
13331
|
-
md: 8
|
|
13567
|
+
sx: {
|
|
13568
|
+
flex: 1,
|
|
13569
|
+
minWidth: 0,
|
|
13570
|
+
order: 2,
|
|
13571
|
+
alignSelf: 'flex-start'
|
|
13332
13572
|
},
|
|
13333
13573
|
children: jsx(FilterList, {
|
|
13334
13574
|
isAllSelected: allSelected,
|
|
@@ -13336,21 +13576,10 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
13336
13576
|
filterState: filterState,
|
|
13337
13577
|
updateFilter: updateFilter
|
|
13338
13578
|
})
|
|
13339
|
-
}), jsxs(
|
|
13579
|
+
}), jsxs(Box, {
|
|
13340
13580
|
className: "create-warning",
|
|
13341
|
-
order: {
|
|
13342
|
-
xs: 1,
|
|
13343
|
-
md: 2
|
|
13344
|
-
},
|
|
13345
13581
|
sx: {
|
|
13346
|
-
|
|
13347
|
-
},
|
|
13348
|
-
justifyContent: "flex-end",
|
|
13349
|
-
alignItems: "self-start",
|
|
13350
|
-
size: {
|
|
13351
|
-
xs: 12,
|
|
13352
|
-
sm: 12,
|
|
13353
|
-
md: 4
|
|
13582
|
+
order: 1
|
|
13354
13583
|
},
|
|
13355
13584
|
children: [lastUpdatedTime && jsx(Box, {
|
|
13356
13585
|
sx: {
|
|
@@ -13369,7 +13598,7 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
13369
13598
|
}), error && jsx(AlertBanner, {
|
|
13370
13599
|
title: error.message,
|
|
13371
13600
|
shouldClose: true
|
|
13372
|
-
}), !error && jsxs(
|
|
13601
|
+
}), !error && jsxs(Grid, {
|
|
13373
13602
|
container: true,
|
|
13374
13603
|
rowSpacing: 0,
|
|
13375
13604
|
columnSpacing: 0,
|
|
@@ -13849,7 +14078,7 @@ var ConfirmDeleteWarningDialog = function ConfirmDeleteWarningDialog(_ref) {
|
|
|
13849
14078
|
_context.next = 4;
|
|
13850
14079
|
return request();
|
|
13851
14080
|
case 4:
|
|
13852
|
-
callback();
|
|
14081
|
+
callback && callback();
|
|
13853
14082
|
setIsLoading(false);
|
|
13854
14083
|
_context.next = 12;
|
|
13855
14084
|
break;
|
|
@@ -13876,10 +14105,7 @@ var ConfirmDeleteWarningDialog = function ConfirmDeleteWarningDialog(_ref) {
|
|
|
13876
14105
|
description: !error ? description : '',
|
|
13877
14106
|
onClose: onClose,
|
|
13878
14107
|
onSubmit: onSubmit,
|
|
13879
|
-
isLoading: isLoading
|
|
13880
|
-
sx: {
|
|
13881
|
-
width: 330
|
|
13882
|
-
}
|
|
14108
|
+
isLoading: isLoading
|
|
13883
14109
|
}, error && {
|
|
13884
14110
|
content: jsxs(Box, {
|
|
13885
14111
|
sx: {
|
|
@@ -13900,9 +14126,12 @@ var ConfirmDeleteWarningDialog = function ConfirmDeleteWarningDialog(_ref) {
|
|
|
13900
14126
|
};
|
|
13901
14127
|
|
|
13902
14128
|
var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
14129
|
+
var _filteredWarnings$fin;
|
|
13903
14130
|
var panelId = _ref.panelId,
|
|
13904
14131
|
presetFilterState = _ref.presetFilterState;
|
|
13905
14132
|
var updatePublicWarningEditor = useMutatePublicWarningEditor();
|
|
14133
|
+
var _useMutateDeleteWarni = useMutateDeleteWarning(),
|
|
14134
|
+
deletePublicWarning = _useMutateDeleteWarni.mutateAsync;
|
|
13906
14135
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
13907
14136
|
t = _useWarningsTranslati.t;
|
|
13908
14137
|
var dispatch = useDispatch();
|
|
@@ -14077,12 +14306,16 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
14077
14306
|
switch (actionType) {
|
|
14078
14307
|
case 'RENEW':
|
|
14079
14308
|
updatedWarning = renewAviationProduct(warning, aviationConfig);
|
|
14309
|
+
void openPublicWarningDialog('edit', updatedWarning, type);
|
|
14080
14310
|
break;
|
|
14081
14311
|
case 'DUPLICATE':
|
|
14082
14312
|
updatedWarning = duplicateAviationProduct(warning);
|
|
14313
|
+
void openPublicWarningDialog('edit', updatedWarning, type);
|
|
14314
|
+
break;
|
|
14315
|
+
case 'CANCEL':
|
|
14316
|
+
void openPublicWarningDialog('cancel', warning, type);
|
|
14083
14317
|
break;
|
|
14084
14318
|
}
|
|
14085
|
-
void openPublicWarningDialog('edit', updatedWarning, type);
|
|
14086
14319
|
};
|
|
14087
14320
|
var openSnackbar = function openSnackbar(message) {
|
|
14088
14321
|
dispatch(snackbarActions.openSnackbar({
|
|
@@ -14097,10 +14330,13 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
14097
14330
|
title: t('warning-dialog-delete-title'),
|
|
14098
14331
|
description: t('warning-dialog-delete-description'),
|
|
14099
14332
|
request: function request() {
|
|
14100
|
-
return
|
|
14101
|
-
|
|
14102
|
-
|
|
14103
|
-
|
|
14333
|
+
return deletePublicWarning({
|
|
14334
|
+
id: warningId
|
|
14335
|
+
}, {
|
|
14336
|
+
onSuccess: function onSuccess() {
|
|
14337
|
+
return onRemoveSuccessHooks(warningId);
|
|
14338
|
+
}
|
|
14339
|
+
});
|
|
14104
14340
|
},
|
|
14105
14341
|
isLocked: isLocked
|
|
14106
14342
|
});
|
|
@@ -14121,6 +14357,17 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
14121
14357
|
}
|
|
14122
14358
|
});
|
|
14123
14359
|
};
|
|
14360
|
+
var onRemoveSuccessHooks = function onRemoveSuccessHooks(warningId) {
|
|
14361
|
+
setConfirmDialogOptions(undefined);
|
|
14362
|
+
// Close warning dialog if needed
|
|
14363
|
+
if (selectedWarningId === warningId) {
|
|
14364
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
14365
|
+
setOpen: false,
|
|
14366
|
+
type: publicWarningDialogType
|
|
14367
|
+
}));
|
|
14368
|
+
}
|
|
14369
|
+
};
|
|
14370
|
+
// TODO remove when all is moved to tanstack
|
|
14124
14371
|
var onRemoveSuccess = function onRemoveSuccess(warningId, snackbarMessage) {
|
|
14125
14372
|
// close confirm dialog
|
|
14126
14373
|
setConfirmDialogOptions(undefined);
|
|
@@ -14161,9 +14408,12 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
14161
14408
|
return warning.status && expandedSections[warning.status] || warning.productStatus && expandedSections[warning.productStatus];
|
|
14162
14409
|
});
|
|
14163
14410
|
}, [filteredWarnings, expandedSections]);
|
|
14411
|
+
var selectedAviationProductId = (_filteredWarnings$fin = filteredWarnings.find(function (warning) {
|
|
14412
|
+
return (warning.warningDetail.level === 'SIG' || warning.warningDetail.level === 'AIR') && warning.id === selectedWarningId;
|
|
14413
|
+
})) == null ? void 0 : _filteredWarnings$fin.id;
|
|
14164
14414
|
var allFeatures = React__default.useMemo(function () {
|
|
14165
14415
|
return filteredWarningsByExpandedSections.flatMap(function (warning) {
|
|
14166
|
-
return (warning == null ? void 0 : warning.id) && (warning != null && warning.warningDetail && warning.warningDetail.areas ? warning.warningDetail.areas.filter(function (area) {
|
|
14416
|
+
return (warning == null ? void 0 : warning.id) && warning.id !== selectedAviationProductId && (warning != null && warning.warningDetail && warning.warningDetail.areas ? warning.warningDetail.areas.filter(function (area) {
|
|
14167
14417
|
return area.geoJSON;
|
|
14168
14418
|
}).map(function (area) {
|
|
14169
14419
|
var isAviationWarning = warning.warningDetail.level === 'SIG' || warning.warningDetail.level === 'AIR';
|
|
@@ -14177,7 +14427,7 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
14177
14427
|
}).filter(function (feature) {
|
|
14178
14428
|
return feature.id;
|
|
14179
14429
|
});
|
|
14180
|
-
}, [filteredWarningsByExpandedSections]);
|
|
14430
|
+
}, [filteredWarningsByExpandedSections, selectedAviationProductId]);
|
|
14181
14431
|
var _useUpdateSharedData = useUpdateSharedData({
|
|
14182
14432
|
features: allFeatures
|
|
14183
14433
|
}, panelId),
|
|
@@ -14217,11 +14467,7 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
14217
14467
|
};
|
|
14218
14468
|
|
|
14219
14469
|
var warningListViewPreset = {
|
|
14220
|
-
|
|
14221
|
-
id: 'warninglist',
|
|
14222
|
-
componentType: 'WarningList',
|
|
14223
|
-
initialProps: {}
|
|
14224
|
-
};
|
|
14470
|
+
componentType: 'WarningList'};
|
|
14225
14471
|
var PublicWarningApiWrapper = function PublicWarningApiWrapper(_ref) {
|
|
14226
14472
|
var config = _ref.config,
|
|
14227
14473
|
auth = _ref.auth,
|
|
@@ -14460,18 +14706,16 @@ var warningsReducersMap = {
|
|
|
14460
14706
|
snackbar: snackbarReducer,
|
|
14461
14707
|
syncGroups: syncGroupsReducer
|
|
14462
14708
|
};
|
|
14463
|
-
var warningsMiddlewares = [mapListener.middleware, layersListener.middleware, drawingToolListener.middleware, warningsDrawingsListener.middleware, publicWarningsListener.middleware, publicWarningFormListener.middleware, snackbarListener.middleware, syncGroupsListener.middleware];
|
|
14709
|
+
var warningsMiddlewares = [mapListener.middleware, layersListener.middleware, drawingToolListener.middleware, warningsDrawingsListener.middleware, publicWarningsListener.middleware, publicWarningFormListener.middleware, snackbarListener.middleware, syncGroupsListener.middleware, openlayersListener.middleware];
|
|
14464
14710
|
var warningsRootReducer = combineReducers(warningsReducersMap);
|
|
14465
14711
|
var createMockStore = function createMockStore(mockState) {
|
|
14466
14712
|
return configureStore({
|
|
14467
14713
|
reducer: warningsRootReducer,
|
|
14468
14714
|
preloadedState: mockState,
|
|
14469
|
-
middleware:
|
|
14715
|
+
middleware: function middleware(getDefaultMiddleware) {
|
|
14716
|
+
return getDefaultMiddleware().concat(warningsMiddlewares);
|
|
14717
|
+
}
|
|
14470
14718
|
});
|
|
14471
14719
|
};
|
|
14472
|
-
/* _____ NOTE --> We should use the middlwares like this down below, but as it will be more strict, it exposes errors from the code itself, which won´t be fixed in this MR ______
|
|
14473
|
-
middleware: (getDefaultMiddleware) =>
|
|
14474
|
-
getDefaultMiddleware().concat(warningsMiddlewares),
|
|
14475
|
-
*/
|
|
14476
14720
|
|
|
14477
14721
|
export { DrawingToolConnect, Wrapper as DrawingToolForm, DrawingToolFormConnect, DrawingToolMapButtonConnect, ObjectManagerConnect, ObjectManagerMapButtonConnect, PublicWarningApiWrapper, PublicWarningsFormDialog, PublicWarningsFormDialogConnect, WARN_NAMESPACE, WarningsModuleProvider, componentsLookUp, createMockStore, isAlreadyEdited, publicWarningActions, publicWarningFormActions, publicWarningFormListener, publicWarningFormReducer, publicWarningsListener, publicWarningsReducer, selectors as publicWarningsSelectors, useObjectDrawDialogAction, warningFormConfirmationOptions, warningsDrawingsActions, warningsDrawingsListener, warningsDrawingsReducer, warningsMiddlewares, warningsReducersMap, warningsTranslations };
|