@opengeoweb/warnings 10.1.0 → 10.2.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 +1033 -613
- package/package.json +1 -1
- package/src/lib/api/api-utils.d.ts +10 -0
- package/src/lib/{aviation-api → api/aviation-api}/hooks.d.ts +1 -1
- package/src/lib/api/warning-api/api.d.ts +4 -0
- package/src/lib/api/warning-api/hooks.d.ts +15 -0
- package/src/lib/components/FilterList/filter-hooks.d.ts +3 -3
- package/src/lib/components/FilterList/filter-utils.d.ts +6 -4
- package/src/lib/components/Providers/Providers.d.ts +3 -0
- package/src/lib/components/PublicWarningList/PublicWarningList.d.ts +5 -4
- package/src/lib/components/PublicWarningList/PublicWarningListConnect.stories.d.ts +37 -4
- package/src/lib/components/PublicWarningList/WarningListItem.d.ts +3 -3
- package/src/lib/components/PublicWarningList/WarningListItemMenu.d.ts +8 -7
- package/src/lib/components/PublicWarningsForm/PublicWarningsFormConnect.d.ts +2 -0
- package/src/lib/store/config.d.ts +1 -1
- package/src/lib/store/publicWarningForm/reducer.d.ts +30 -34
- package/src/lib/store/publicWarningForm/selectors.d.ts +12 -17
- package/src/lib/store/publicWarningForm/types.d.ts +4 -4
- package/src/lib/store/publicWarnings/reducer.d.ts +3 -14
- package/src/lib/store/publicWarnings/selectors.d.ts +1 -1
- package/src/lib/store/publicWarnings/types.d.ts +2 -2
- package/src/lib/store/types.d.ts +2 -2
- package/src/lib/utils/api.d.ts +3 -7
- package/src/lib/utils/fakeApi/index.d.ts +8 -5
- package/src/lib/utils/sig-airmet-util.d.ts +11 -7
- package/src/lib/utils/sig-airmet-util.spec.d.ts +1 -0
- package/src/lib/utils/warningUtils.d.ts +4 -4
- /package/src/lib/{aviation-api → api/aviation-api}/api.d.ts +0 -0
- /package/src/lib/{aviation-api → api/aviation-api}/fakeApi.d.ts +0 -0
- /package/src/lib/{store/publicWarnings/reducer.spec.d.ts → components/PublicWarningList/WarningListItemMenu.spec.d.ts} +0 -0
package/index.esm.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useDispatch, useSelector } from 'react-redux';
|
|
3
|
-
import { Polygons, Share, ExitDomain, 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, Success, Expire, Remove, ArrowUpCompact, ArrowDownCompact } from '@opengeoweb/theme';
|
|
3
|
+
import { Polygons, Share, ExitDomain, 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, Success, Expire, Remove, ArrowUpCompact, ArrowDownCompact } from '@opengeoweb/theme';
|
|
4
4
|
import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawtoolSelectors, layerSelectors, uiSelectors, drawingToolActions, layerActions, useSetupDialog, selectorMemoizationOptions, useUpdateSharedData } from '@opengeoweb/store';
|
|
5
5
|
import { defaultPolygon, emptyGeoJSON, MapControlButton, getIcon, rewindGeometry, getGeoJSONPropertyValue, currentlySupportedDrawModes, defaultLayers, MapView, MapViewLayer, getFeatureExtent } from '@opengeoweb/webmap-react';
|
|
6
|
-
import { SHARED_NAMESPACE, useConfirmationDialog, ToggleMenu, dateUtils, calculateStartSize, ToolContainerDraggable, AlertBanner, ConfirmationDialog, getAxiosErrorMessage, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, CustomToggleButton, Filter, FilterChip, FilterOption, StatusTag, LastUpdateTime, ErrorBoundary,
|
|
6
|
+
import { SHARED_NAMESPACE, useConfirmationDialog, ToggleMenu, dateUtils, calculateStartSize, ToolContainerDraggable, AlertBanner, ConfirmationDialog, getAxiosErrorMessage, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, CustomToggleButton, Filter, FilterChip, FilterOption, StatusTag, LastUpdateTime, ErrorBoundary, isAxiosError as isAxiosError$1 } from '@opengeoweb/shared';
|
|
7
7
|
import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, isAnyOf } from '@reduxjs/toolkit';
|
|
8
8
|
import 'i18next';
|
|
9
9
|
import { useTranslation } from 'react-i18next';
|
|
10
10
|
import '@opengeoweb/core';
|
|
11
11
|
import { FORM_FIELDS_NAMESPACE, ReactHookFormHiddenInput, isValidGeoJsonCoordinates, ReactHookFormSelect, ReactHookFormTextField, ReactHookFormProvider, defaultFormOptions, useDraftFormHelpers, errorMessages, ReactHookFormDateTime, isXHoursBefore, isXHoursAfter, isEmpty } from '@opengeoweb/form-fields';
|
|
12
12
|
import { LayerType, generateMapId, getWMJSMapById, getGeoCoordFromLatLong, WMBBOX } from '@opengeoweb/webmap';
|
|
13
|
-
import { SigmetForm, isInstanceOfCancelSigmet, AirmetForm, isInstanceOfCancelAirmet, getProductFormMode } from '@opengeoweb/sigmet-airmet';
|
|
13
|
+
import { airmetConfig, sigmetConfig, SigmetForm, isInstanceOfCancelSigmet, AirmetForm, isInstanceOfCancelAirmet, getDefaultValidUntilValue, getProductFormMode } from '@opengeoweb/sigmet-airmet';
|
|
14
14
|
import { snackbarActions, snackbarTypes } from '@opengeoweb/snackbar';
|
|
15
15
|
import * as React from 'react';
|
|
16
16
|
import React__default, { useState, useEffect, useRef, useMemo, useCallback } from 'react';
|
|
17
17
|
import { styled, Box, Typography, ListItem, Grid2, Paper, ListItemButton, Stack, LinearProgress, Button, FormHelperText, MenuItem, Tabs, Tab, Card, CardContent, 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
|
-
import { getApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider, getHeaders, useAuthQuery, useAuthenticationContext, ProductStatus } from '@opengeoweb/api';
|
|
20
|
+
import { getApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider, AirmetPhenomena, SigmetPhenomena, getHeaders, handleResponse, useAuthQuery, useAuthenticationContext, ProductStatus, optimisticUpdate } from '@opengeoweb/api';
|
|
21
|
+
import { rest } from 'msw';
|
|
21
22
|
import { useFormContext } from 'react-hook-form';
|
|
22
|
-
import { isEqual, cloneDeep, clamp, groupBy,
|
|
23
|
+
import { isEqual, cloneDeep, clamp, groupBy, pick, assign } from 'lodash';
|
|
23
24
|
import { getConfig, useAuthenticationContext as useAuthenticationContext$1 } from '@opengeoweb/authentication';
|
|
24
|
-
import { useQueryClient } from '@tanstack/react-query';
|
|
25
|
+
import { useQueryClient, useMutation } from '@tanstack/react-query';
|
|
25
26
|
import { isAxiosError } from 'axios';
|
|
26
27
|
|
|
27
28
|
var en = {
|
|
@@ -199,7 +200,8 @@ var en = {
|
|
|
199
200
|
"warning-dialog-withdraw-title": "Withdraw warning",
|
|
200
201
|
"warning-dialog-withdraw-confirm": "Withdraw",
|
|
201
202
|
"warning-dialog-withdraw-description": "Are you sure you want to withdraw this warning?",
|
|
202
|
-
"tac-missing-data": "Missing data: no TAC can be generated"
|
|
203
|
+
"tac-missing-data": "Missing data: no TAC can be generated",
|
|
204
|
+
"warning-list-button-renew": "Renew"
|
|
203
205
|
};
|
|
204
206
|
var nl = {
|
|
205
207
|
"drawing-tool-form-tools": "Gereedschap",
|
|
@@ -337,7 +339,8 @@ var nl = {
|
|
|
337
339
|
"warning-domain-maritime": "Maritiem",
|
|
338
340
|
"warning-domain-public": "Publiek",
|
|
339
341
|
"error-title-retry": "Probeer opnieuw",
|
|
340
|
-
"tac-missing-data": "Ontbrekende gegevens: er kan geen TAC worden gegenereerd"
|
|
342
|
+
"tac-missing-data": "Ontbrekende gegevens: er kan geen TAC worden gegenereerd",
|
|
343
|
+
"warning-list-button-renew": "Hernieuwen"
|
|
341
344
|
};
|
|
342
345
|
var fi = {
|
|
343
346
|
"drawing-tool-form-tools": "Työkalut",
|
|
@@ -475,7 +478,8 @@ var fi = {
|
|
|
475
478
|
"warning-domain-maritime": "ei käännetty",
|
|
476
479
|
"warning-domain-public": "ei käännetty",
|
|
477
480
|
"error-title-retry": "Yritä uudelleen",
|
|
478
|
-
"tac-missing-data": "Tarvittavia tietoja puuttu, TAC:ia ei voida generoida"
|
|
481
|
+
"tac-missing-data": "Tarvittavia tietoja puuttu, TAC:ia ei voida generoida",
|
|
482
|
+
"warning-list-button-renew": "Renew"
|
|
479
483
|
};
|
|
480
484
|
var no = {
|
|
481
485
|
"drawing-tool-form-tools": "Verktøy",
|
|
@@ -613,7 +617,8 @@ var no = {
|
|
|
613
617
|
"warning-domain-maritime": "ikke oversatt",
|
|
614
618
|
"warning-domain-public": "ikke oversatt",
|
|
615
619
|
"error-title-retry": "Prøv igjen",
|
|
616
|
-
"tac-missing-data": "Mangler data: ingen TAC kan genereres"
|
|
620
|
+
"tac-missing-data": "Mangler data: ingen TAC kan genereres",
|
|
621
|
+
"warning-list-button-renew": "Renew"
|
|
617
622
|
};
|
|
618
623
|
var warningsTranslations = {
|
|
619
624
|
en: en,
|
|
@@ -1952,10 +1957,6 @@ var getApiRoutes$1 = function getApiRoutes(axiosInstance) {
|
|
|
1952
1957
|
getAreaKeywords: function getAreaKeywords() {
|
|
1953
1958
|
return axiosInstance.get("/area-keywords");
|
|
1954
1959
|
},
|
|
1955
|
-
// warnings
|
|
1956
|
-
getWarnings: function getWarnings() {
|
|
1957
|
-
return axiosInstance.get('/warnings');
|
|
1958
|
-
},
|
|
1959
1960
|
saveWarningAs: function saveWarningAs(data) {
|
|
1960
1961
|
return axiosInstance.post("/warnings/", data).then(function (response) {
|
|
1961
1962
|
var headerLocation = response == null ? void 0 : response.request.getResponseHeader('Location');
|
|
@@ -1967,9 +1968,6 @@ var getApiRoutes$1 = function getApiRoutes(axiosInstance) {
|
|
|
1967
1968
|
},
|
|
1968
1969
|
deleteWarning: function deleteWarning(warningId) {
|
|
1969
1970
|
return axiosInstance.post("/warnings/" + warningId + "?delete=true");
|
|
1970
|
-
},
|
|
1971
|
-
toggleEditorWarning: function toggleEditorWarning(warningId, isEditor) {
|
|
1972
|
-
return axiosInstance.post("/warnings/" + warningId + "?editor=" + (isEditor ? 'true' : 'false'));
|
|
1973
1971
|
}
|
|
1974
1972
|
};
|
|
1975
1973
|
};
|
|
@@ -2100,84 +2098,22 @@ var publicWarningDialogType = uiTypes.DialogTypes.PublicWarnings;
|
|
|
2100
2098
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2101
2099
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2102
2100
|
* */
|
|
2103
|
-
var
|
|
2104
|
-
|
|
2105
|
-
return warning.id;
|
|
2106
|
-
}
|
|
2107
|
-
});
|
|
2108
|
-
var initialState$1 = {
|
|
2109
|
-
warnings: publicWarningsAdapter.getInitialState(),
|
|
2110
|
-
isLoading: true,
|
|
2111
|
-
lastUpdatedTime: '',
|
|
2112
|
-
filterState: {}
|
|
2113
|
-
};
|
|
2101
|
+
var TAKEOVER_MESSAGE = 'You are no longer the editor of this warning';
|
|
2102
|
+
var initialState$1 = {};
|
|
2114
2103
|
var slice$1 = createSlice({
|
|
2115
2104
|
initialState: initialState$1,
|
|
2116
|
-
name: 'publicWarnings',
|
|
2117
|
-
reducers: {
|
|
2118
|
-
fetchWarnings: function fetchWarnings(draft) {
|
|
2119
|
-
draft.isLoading = true;
|
|
2120
|
-
delete draft.error;
|
|
2121
|
-
},
|
|
2122
|
-
fetchWarningsSuccess: function fetchWarningsSuccess(draft, action) {
|
|
2123
|
-
var _action$payload = action.payload,
|
|
2124
|
-
warnings = _action$payload.warnings,
|
|
2125
|
-
lastUpdatedTime = _action$payload.lastUpdatedTime;
|
|
2126
|
-
draft.isLoading = false;
|
|
2127
|
-
draft.lastUpdatedTime = lastUpdatedTime;
|
|
2128
|
-
publicWarningsAdapter.setAll(draft.warnings, warnings);
|
|
2129
|
-
},
|
|
2130
|
-
fetchWarningsError: function fetchWarningsError(draft, action) {
|
|
2131
|
-
var error = action.payload.error;
|
|
2132
|
-
draft.isLoading = false;
|
|
2133
|
-
draft.error = error;
|
|
2134
|
-
},
|
|
2135
|
-
setWarningFilters: function setWarningFilters(draft, action) {
|
|
2136
|
-
var _action$payload2 = action.payload,
|
|
2137
|
-
filterState = _action$payload2.filterState,
|
|
2138
|
-
panelId = _action$payload2.panelId;
|
|
2139
|
-
if (panelId) {
|
|
2140
|
-
draft.filterState[panelId] = filterState;
|
|
2141
|
-
}
|
|
2142
|
-
}
|
|
2143
|
-
}
|
|
2144
|
-
});
|
|
2145
|
-
var reducer$1 = slice$1.reducer;
|
|
2146
|
-
var publicWarningActions = slice$1.actions;
|
|
2147
|
-
|
|
2148
|
-
/* *
|
|
2149
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2150
|
-
* you may not use this file except in compliance with the License.
|
|
2151
|
-
* You may obtain a copy of the License at
|
|
2152
|
-
*
|
|
2153
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2154
|
-
*
|
|
2155
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2156
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2157
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2158
|
-
* See the License for the specific language governing permissions and
|
|
2159
|
-
* limitations under the License.
|
|
2160
|
-
*
|
|
2161
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2162
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
2163
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2164
|
-
* */
|
|
2165
|
-
var TAKEOVER_MESSAGE = 'You are no longer the editor of this warning';
|
|
2166
|
-
var initialState = {};
|
|
2167
|
-
var slice = createSlice({
|
|
2168
|
-
initialState: initialState,
|
|
2169
2105
|
name: 'publicWarningForm',
|
|
2170
2106
|
reducers: {
|
|
2171
2107
|
setFormValues: function setFormValues(draft, action) {
|
|
2172
2108
|
var _action$payload = action.payload,
|
|
2173
2109
|
object = _action$payload.object,
|
|
2174
|
-
|
|
2110
|
+
warning = _action$payload.warning,
|
|
2175
2111
|
formState = _action$payload.formState;
|
|
2176
2112
|
if (object) {
|
|
2177
2113
|
draft.object = object;
|
|
2178
2114
|
}
|
|
2179
|
-
if (
|
|
2180
|
-
draft.
|
|
2115
|
+
if (warning) {
|
|
2116
|
+
draft.warning = warning;
|
|
2181
2117
|
}
|
|
2182
2118
|
if (formState !== undefined) {
|
|
2183
2119
|
draft.formState = formState;
|
|
@@ -2186,62 +2122,49 @@ var slice = createSlice({
|
|
|
2186
2122
|
addArea: function addArea(draft, action) {
|
|
2187
2123
|
var area = action.payload.area;
|
|
2188
2124
|
// only support 1 area (for now)
|
|
2189
|
-
if (draft.
|
|
2190
|
-
var
|
|
2191
|
-
draft.
|
|
2125
|
+
if (draft.warning) {
|
|
2126
|
+
var _draft$warning$warnin;
|
|
2127
|
+
var areaWithPreservedUUID = Object.assign({}, (_draft$warning$warnin = draft.warning.warningDetail.areas) == null ? void 0 : _draft$warning$warnin.at(0), area);
|
|
2128
|
+
draft.warning.warningDetail.areas = [areaWithPreservedUUID];
|
|
2192
2129
|
} else {
|
|
2193
2130
|
var newWarning = {
|
|
2194
2131
|
warningDetail: {
|
|
2195
2132
|
areas: [area]
|
|
2196
2133
|
}
|
|
2197
2134
|
};
|
|
2198
|
-
draft.
|
|
2135
|
+
draft.warning = newWarning;
|
|
2199
2136
|
}
|
|
2200
2137
|
},
|
|
2201
2138
|
removeArea: function removeArea(draft, action) {
|
|
2202
2139
|
var area = action.payload.area;
|
|
2203
|
-
if (draft.
|
|
2204
|
-
var removeAreas = draft.
|
|
2140
|
+
if (draft.warning) {
|
|
2141
|
+
var removeAreas = draft.warning.warningDetail.areas.filter(function (existingArea) {
|
|
2205
2142
|
return existingArea.objectName !== area.objectName;
|
|
2206
2143
|
});
|
|
2207
|
-
draft.
|
|
2144
|
+
draft.warning.warningDetail.areas = removeAreas;
|
|
2208
2145
|
}
|
|
2209
2146
|
},
|
|
2210
2147
|
removeAllAreas: function removeAllAreas(draft) {
|
|
2211
|
-
if (draft.
|
|
2212
|
-
draft.
|
|
2148
|
+
if (draft.warning) {
|
|
2149
|
+
draft.warning.warningDetail.areas = [];
|
|
2213
2150
|
}
|
|
2214
2151
|
},
|
|
2215
2152
|
openPublicWarningFormDialog: function openPublicWarningFormDialog(draft, action) {
|
|
2216
2153
|
var _action$payload2 = action.payload,
|
|
2217
2154
|
object = _action$payload2.object,
|
|
2218
|
-
|
|
2155
|
+
warning = _action$payload2.warning,
|
|
2219
2156
|
_action$payload2$form = _action$payload2.formState,
|
|
2220
2157
|
formState = _action$payload2$form === void 0 ? '' : _action$payload2$form,
|
|
2221
2158
|
_action$payload2$warn = _action$payload2.warningType,
|
|
2222
2159
|
warningType = _action$payload2$warn === void 0 ? 'public' : _action$payload2$warn,
|
|
2223
2160
|
panelId = _action$payload2.panelId;
|
|
2224
2161
|
draft.object = object;
|
|
2225
|
-
draft.
|
|
2226
|
-
draft.
|
|
2162
|
+
draft.warning = warning;
|
|
2163
|
+
draft.selectedWarningId = warning == null ? void 0 : warning.id;
|
|
2227
2164
|
draft.formState = formState;
|
|
2228
2165
|
draft.warningType = warningType;
|
|
2229
2166
|
draft.panelId = panelId;
|
|
2230
2167
|
},
|
|
2231
|
-
toggleEditorWarning: function toggleEditorWarning(draft,
|
|
2232
|
-
// eslint-disable-next-line no-unused-vars
|
|
2233
|
-
action) {
|
|
2234
|
-
delete draft.error;
|
|
2235
|
-
},
|
|
2236
|
-
toggleEditorWarningSuccess: function toggleEditorWarningSuccess(draft, action) {
|
|
2237
|
-
var _action$payload3 = action.payload,
|
|
2238
|
-
isEditor = _action$payload3.isEditor,
|
|
2239
|
-
username = _action$payload3.username;
|
|
2240
|
-
if (draft.publicWarning) {
|
|
2241
|
-
draft.publicWarning.editor = isEditor ? username : '';
|
|
2242
|
-
}
|
|
2243
|
-
draft.formState = isEditor ? '' : 'readonly';
|
|
2244
|
-
},
|
|
2245
2168
|
// publish warning
|
|
2246
2169
|
publishWarning: function publishWarning(draft,
|
|
2247
2170
|
// eslint-disable-next-line no-unused-vars
|
|
@@ -2251,7 +2174,7 @@ var slice = createSlice({
|
|
|
2251
2174
|
},
|
|
2252
2175
|
publishWarningSuccess: function publishWarningSuccess(draft, action) {
|
|
2253
2176
|
var publicWarning = action.payload.publicWarning;
|
|
2254
|
-
draft.
|
|
2177
|
+
draft.warning = publicWarning;
|
|
2255
2178
|
// If form has been published, set form to readonly
|
|
2256
2179
|
draft.formState = 'readonly';
|
|
2257
2180
|
},
|
|
@@ -2261,70 +2184,60 @@ var slice = createSlice({
|
|
|
2261
2184
|
action) {
|
|
2262
2185
|
draft.formState = 'saving';
|
|
2263
2186
|
delete draft.error;
|
|
2264
|
-
draft.
|
|
2187
|
+
draft.warning = action.payload.publicWarning;
|
|
2265
2188
|
},
|
|
2266
2189
|
saveWarningSuccess: function saveWarningSuccess(draft, action) {
|
|
2267
2190
|
var _publicWarning$warnin;
|
|
2268
2191
|
var publicWarning = action.payload.publicWarning;
|
|
2269
|
-
draft.
|
|
2192
|
+
draft.warning = publicWarning;
|
|
2270
2193
|
if (publicWarning != null && (_publicWarning$warnin = publicWarning.warningDetail) != null && _publicWarning$warnin.id) {
|
|
2271
|
-
draft.
|
|
2194
|
+
draft.selectedWarningId = publicWarning.warningDetail.id;
|
|
2272
2195
|
}
|
|
2273
2196
|
draft.formState = '';
|
|
2274
2197
|
},
|
|
2275
2198
|
setFormError: function setFormError(draft, action) {
|
|
2276
|
-
var _action$
|
|
2277
|
-
message = _action$
|
|
2278
|
-
_action$
|
|
2279
|
-
severity = _action$
|
|
2199
|
+
var _action$payload3 = action.payload,
|
|
2200
|
+
message = _action$payload3.message,
|
|
2201
|
+
_action$payload3$seve = _action$payload3.severity,
|
|
2202
|
+
severity = _action$payload3$seve === void 0 ? 'error' : _action$payload3$seve;
|
|
2280
2203
|
draft.formState = '';
|
|
2281
2204
|
draft.error = {
|
|
2282
2205
|
severity: severity,
|
|
2283
2206
|
message: message
|
|
2284
2207
|
};
|
|
2285
2208
|
},
|
|
2209
|
+
removeFormError: function removeFormError(draft) {
|
|
2210
|
+
delete draft.error;
|
|
2211
|
+
},
|
|
2286
2212
|
setFormDirty: function setFormDirty(draft, action) {
|
|
2287
2213
|
var isFormDirty = action.payload.isFormDirty;
|
|
2288
2214
|
draft.isFormDirty = isFormDirty;
|
|
2215
|
+
},
|
|
2216
|
+
setEditMode: function setEditMode(draft, action) {
|
|
2217
|
+
var warningId = action.payload.warningId;
|
|
2218
|
+
draft.selectedWarningId = warningId;
|
|
2219
|
+
draft.formState = 'edit';
|
|
2289
2220
|
}
|
|
2290
2221
|
},
|
|
2291
2222
|
extraReducers: function extraReducers(builder) {
|
|
2292
2223
|
builder.addCase(uiActions.setToggleOpenDialog, function (draft, action) {
|
|
2293
|
-
var _action$
|
|
2294
|
-
type = _action$
|
|
2295
|
-
setOpen = _action$
|
|
2224
|
+
var _action$payload4 = action.payload,
|
|
2225
|
+
type = _action$payload4.type,
|
|
2226
|
+
setOpen = _action$payload4.setOpen;
|
|
2296
2227
|
if (type === publicWarningDialogType && setOpen === false) {
|
|
2297
2228
|
delete draft.object;
|
|
2298
|
-
delete draft.
|
|
2229
|
+
delete draft.warning;
|
|
2299
2230
|
delete draft.formState;
|
|
2300
2231
|
delete draft.error;
|
|
2301
|
-
delete draft.
|
|
2232
|
+
delete draft.selectedWarningId;
|
|
2302
2233
|
delete draft.isFormDirty;
|
|
2303
2234
|
delete draft.warningType;
|
|
2304
2235
|
}
|
|
2305
|
-
}).addCase(publicWarningActions.fetchWarningsSuccess, function (draft, action) {
|
|
2306
|
-
var warnings = action.payload.warnings;
|
|
2307
|
-
if (draft.selectedPublicWarningId) {
|
|
2308
|
-
var _draft$publicWarning;
|
|
2309
|
-
var currentWarning = warnings.find(function (warning) {
|
|
2310
|
-
return warning.id === draft.selectedPublicWarningId;
|
|
2311
|
-
});
|
|
2312
|
-
if (currentWarning && ((_draft$publicWarning = draft.publicWarning) == null ? void 0 : _draft$publicWarning.editor) !== currentWarning.editor) {
|
|
2313
|
-
draft.publicWarning.editor = currentWarning.editor;
|
|
2314
|
-
// if form is in edit mode show warning
|
|
2315
|
-
if (draft.formState === '') {
|
|
2316
|
-
draft.error = {
|
|
2317
|
-
severity: 'warning',
|
|
2318
|
-
message: TAKEOVER_MESSAGE
|
|
2319
|
-
};
|
|
2320
|
-
}
|
|
2321
|
-
}
|
|
2322
|
-
}
|
|
2323
2236
|
});
|
|
2324
2237
|
}
|
|
2325
2238
|
});
|
|
2326
|
-
var reducer = slice.reducer;
|
|
2327
|
-
var publicWarningFormActions = slice.actions;
|
|
2239
|
+
var reducer$1 = slice$1.reducer;
|
|
2240
|
+
var publicWarningFormActions = slice$1.actions;
|
|
2328
2241
|
|
|
2329
2242
|
var ObjectManagerConnect = function ObjectManagerConnect(_ref) {
|
|
2330
2243
|
var bounds = _ref.bounds,
|
|
@@ -2508,7 +2421,7 @@ var ObjectManagerConnect = function ObjectManagerConnect(_ref) {
|
|
|
2508
2421
|
var onShareObject = function onShareObject(object) {
|
|
2509
2422
|
dispatch(publicWarningFormActions.openPublicWarningFormDialog({
|
|
2510
2423
|
object: object,
|
|
2511
|
-
|
|
2424
|
+
warning: {
|
|
2512
2425
|
warningDetail: {
|
|
2513
2426
|
areas: [{
|
|
2514
2427
|
geoJSON: object.geoJSON,
|
|
@@ -6950,6 +6863,330 @@ var warningListJSON = [
|
|
|
6950
6863
|
}
|
|
6951
6864
|
];
|
|
6952
6865
|
|
|
6866
|
+
var airmetListJSON = [
|
|
6867
|
+
{
|
|
6868
|
+
uuid: "02d3727a-b190-11ef-ba31-067f7750936d",
|
|
6869
|
+
lastUpdateDate: "2024-12-03T16:02:35",
|
|
6870
|
+
creationDate: "2024-12-03T16:02:35",
|
|
6871
|
+
canbe: [
|
|
6872
|
+
"DRAFTED",
|
|
6873
|
+
"DISCARDED",
|
|
6874
|
+
"PUBLISHED"
|
|
6875
|
+
],
|
|
6876
|
+
airmet: {
|
|
6877
|
+
uuid: "02d3727a-b190-11ef-ba31-067f7750936d",
|
|
6878
|
+
phenomenon: "SFC_WIND",
|
|
6879
|
+
sequence: "-1",
|
|
6880
|
+
validDateStart: "2024-12-03T13:26:19Z",
|
|
6881
|
+
validDateEnd: "2024-12-03T15:26:19Z",
|
|
6882
|
+
firName: "AMSTERDAM FIR",
|
|
6883
|
+
locationIndicatorATSU: "EHAA",
|
|
6884
|
+
locationIndicatorATSR: "EHAA",
|
|
6885
|
+
locationIndicatorMWO: "EHDB",
|
|
6886
|
+
isObservationOrForecast: "OBS",
|
|
6887
|
+
observationOrForecastTime: "2024-12-03T11:26:19Z",
|
|
6888
|
+
movementType: "STATIONARY",
|
|
6889
|
+
change: "WKN",
|
|
6890
|
+
type: "NORMAL",
|
|
6891
|
+
status: "DRAFT",
|
|
6892
|
+
windDirection: 70,
|
|
6893
|
+
windSpeed: 35,
|
|
6894
|
+
windUnit: "KT",
|
|
6895
|
+
firGeometry: {
|
|
6896
|
+
},
|
|
6897
|
+
startGeometry: {
|
|
6898
|
+
type: "FeatureCollection",
|
|
6899
|
+
features: [
|
|
6900
|
+
{
|
|
6901
|
+
type: "Feature",
|
|
6902
|
+
geometry: {
|
|
6903
|
+
type: "Polygon",
|
|
6904
|
+
coordinates: [
|
|
6905
|
+
[
|
|
6906
|
+
[
|
|
6907
|
+
5,
|
|
6908
|
+
55
|
|
6909
|
+
],
|
|
6910
|
+
[
|
|
6911
|
+
4.331914,
|
|
6912
|
+
55.332644
|
|
6913
|
+
],
|
|
6914
|
+
[
|
|
6915
|
+
3.368817,
|
|
6916
|
+
55.764314
|
|
6917
|
+
],
|
|
6918
|
+
[
|
|
6919
|
+
2.761908,
|
|
6920
|
+
54.379261
|
|
6921
|
+
],
|
|
6922
|
+
[
|
|
6923
|
+
3.15576,
|
|
6924
|
+
52.913554
|
|
6925
|
+
],
|
|
6926
|
+
[
|
|
6927
|
+
2.000002,
|
|
6928
|
+
51.500002
|
|
6929
|
+
],
|
|
6930
|
+
[
|
|
6931
|
+
3.370001,
|
|
6932
|
+
51.369722
|
|
6933
|
+
],
|
|
6934
|
+
[
|
|
6935
|
+
3.370527,
|
|
6936
|
+
51.36867
|
|
6937
|
+
],
|
|
6938
|
+
[
|
|
6939
|
+
3.362223,
|
|
6940
|
+
51.320002
|
|
6941
|
+
],
|
|
6942
|
+
[
|
|
6943
|
+
3.36389,
|
|
6944
|
+
51.313608
|
|
6945
|
+
],
|
|
6946
|
+
[
|
|
6947
|
+
3.373613,
|
|
6948
|
+
51.309999
|
|
6949
|
+
],
|
|
6950
|
+
[
|
|
6951
|
+
3.952501,
|
|
6952
|
+
51.214441
|
|
6953
|
+
],
|
|
6954
|
+
[
|
|
6955
|
+
4.397501,
|
|
6956
|
+
51.452776
|
|
6957
|
+
],
|
|
6958
|
+
[
|
|
6959
|
+
5.078611,
|
|
6960
|
+
51.391665
|
|
6961
|
+
],
|
|
6962
|
+
[
|
|
6963
|
+
5.848333,
|
|
6964
|
+
51.139444
|
|
6965
|
+
],
|
|
6966
|
+
[
|
|
6967
|
+
5.651667,
|
|
6968
|
+
50.824717
|
|
6969
|
+
],
|
|
6970
|
+
[
|
|
6971
|
+
6.011797,
|
|
6972
|
+
50.757273
|
|
6973
|
+
],
|
|
6974
|
+
[
|
|
6975
|
+
5.934168,
|
|
6976
|
+
51.036386
|
|
6977
|
+
],
|
|
6978
|
+
[
|
|
6979
|
+
6.222223,
|
|
6980
|
+
51.361666
|
|
6981
|
+
],
|
|
6982
|
+
[
|
|
6983
|
+
5.94639,
|
|
6984
|
+
51.811663
|
|
6985
|
+
],
|
|
6986
|
+
[
|
|
6987
|
+
6.405001,
|
|
6988
|
+
51.830828
|
|
6989
|
+
],
|
|
6990
|
+
[
|
|
6991
|
+
7.053095,
|
|
6992
|
+
52.237764
|
|
6993
|
+
],
|
|
6994
|
+
[
|
|
6995
|
+
7.031389,
|
|
6996
|
+
52.268885
|
|
6997
|
+
],
|
|
6998
|
+
[
|
|
6999
|
+
7.063612,
|
|
7000
|
+
52.346109
|
|
7001
|
+
],
|
|
7002
|
+
[
|
|
7003
|
+
7.065557,
|
|
7004
|
+
52.385828
|
|
7005
|
+
],
|
|
7006
|
+
[
|
|
7007
|
+
7.133055,
|
|
7008
|
+
52.888887
|
|
7009
|
+
],
|
|
7010
|
+
[
|
|
7011
|
+
7.14218,
|
|
7012
|
+
52.898244
|
|
7013
|
+
],
|
|
7014
|
+
[
|
|
7015
|
+
7.191667,
|
|
7016
|
+
53.3
|
|
7017
|
+
],
|
|
7018
|
+
[
|
|
7019
|
+
6.5,
|
|
7020
|
+
53.666667
|
|
7021
|
+
],
|
|
7022
|
+
[
|
|
7023
|
+
6.500002,
|
|
7024
|
+
55.000002
|
|
7025
|
+
],
|
|
7026
|
+
[
|
|
7027
|
+
5,
|
|
7028
|
+
55
|
|
7029
|
+
]
|
|
7030
|
+
]
|
|
7031
|
+
]
|
|
7032
|
+
},
|
|
7033
|
+
properties: {
|
|
7034
|
+
selectionType: "fir"
|
|
7035
|
+
}
|
|
7036
|
+
}
|
|
7037
|
+
]
|
|
7038
|
+
}
|
|
7039
|
+
}
|
|
7040
|
+
}
|
|
7041
|
+
];
|
|
7042
|
+
|
|
7043
|
+
var sigmetListJSON = [
|
|
7044
|
+
{
|
|
7045
|
+
uuid: "someuniqueidprescibedbyBE2",
|
|
7046
|
+
lastUpdateDate: "2020-09-17T12:00:00Z",
|
|
7047
|
+
creationDate: "2020-09-17T12:00:00Z",
|
|
7048
|
+
canbe: [
|
|
7049
|
+
"CANCELLED"
|
|
7050
|
+
],
|
|
7051
|
+
sigmet: {
|
|
7052
|
+
uuid: "someuniqueidprescibedbyBE2",
|
|
7053
|
+
phenomenon: "VA_CLD",
|
|
7054
|
+
sequence: "A01V",
|
|
7055
|
+
issueDate: "2020-09-17T12:00:00Z",
|
|
7056
|
+
firName: "AMSTERDAM FIR",
|
|
7057
|
+
locationIndicatorATSU: "EHAA",
|
|
7058
|
+
locationIndicatorATSR: "EHAA",
|
|
7059
|
+
locationIndicatorMWO: "EHDB",
|
|
7060
|
+
isObservationOrForecast: "OBS",
|
|
7061
|
+
observationOrForecastTime: "",
|
|
7062
|
+
movementType: "STATIONARY",
|
|
7063
|
+
change: "WKN",
|
|
7064
|
+
type: "NORMAL",
|
|
7065
|
+
status: "PUBLISHED",
|
|
7066
|
+
levelInfoMode: "BETW",
|
|
7067
|
+
vaSigmetVolcanoName: "EYJAFJALLAJOKULL",
|
|
7068
|
+
vaSigmetVolcanoCoordinates: {
|
|
7069
|
+
latitude: 63.62,
|
|
7070
|
+
longitude: -19.61
|
|
7071
|
+
},
|
|
7072
|
+
level: {
|
|
7073
|
+
value: 2000,
|
|
7074
|
+
unit: "FT"
|
|
7075
|
+
},
|
|
7076
|
+
lowerLevel: {
|
|
7077
|
+
value: 1000,
|
|
7078
|
+
unit: "FT"
|
|
7079
|
+
},
|
|
7080
|
+
firGeometry: "",
|
|
7081
|
+
startGeometry: {
|
|
7082
|
+
type: "FeatureCollection",
|
|
7083
|
+
features: [
|
|
7084
|
+
{
|
|
7085
|
+
type: "Feature",
|
|
7086
|
+
properties: {
|
|
7087
|
+
selectionType: "poly"
|
|
7088
|
+
},
|
|
7089
|
+
geometry: {
|
|
7090
|
+
type: "Polygon",
|
|
7091
|
+
coordinates: [
|
|
7092
|
+
[
|
|
7093
|
+
[
|
|
7094
|
+
4.799062887514267,
|
|
7095
|
+
54.04327723979929
|
|
7096
|
+
],
|
|
7097
|
+
[
|
|
7098
|
+
6.006227982070749,
|
|
7099
|
+
53.64012115183787
|
|
7100
|
+
],
|
|
7101
|
+
[
|
|
7102
|
+
4.6168492883359304,
|
|
7103
|
+
53.32840097044425
|
|
7104
|
+
],
|
|
7105
|
+
[
|
|
7106
|
+
4.799062887514267,
|
|
7107
|
+
54.04327723979929
|
|
7108
|
+
]
|
|
7109
|
+
]
|
|
7110
|
+
]
|
|
7111
|
+
}
|
|
7112
|
+
}
|
|
7113
|
+
]
|
|
7114
|
+
},
|
|
7115
|
+
startGeometryIntersect: {
|
|
7116
|
+
type: "FeatureCollection",
|
|
7117
|
+
features: [
|
|
7118
|
+
{
|
|
7119
|
+
type: "Feature",
|
|
7120
|
+
properties: {
|
|
7121
|
+
selectionType: "poly"
|
|
7122
|
+
},
|
|
7123
|
+
geometry: {
|
|
7124
|
+
type: "Polygon",
|
|
7125
|
+
coordinates: [
|
|
7126
|
+
[
|
|
7127
|
+
[
|
|
7128
|
+
4.799062887514267,
|
|
7129
|
+
54.04327723979929
|
|
7130
|
+
],
|
|
7131
|
+
[
|
|
7132
|
+
6.006227982070749,
|
|
7133
|
+
53.64012115183787
|
|
7134
|
+
],
|
|
7135
|
+
[
|
|
7136
|
+
4.6168492883359304,
|
|
7137
|
+
53.32840097044425
|
|
7138
|
+
],
|
|
7139
|
+
[
|
|
7140
|
+
4.799062887514267,
|
|
7141
|
+
54.04327723979929
|
|
7142
|
+
]
|
|
7143
|
+
]
|
|
7144
|
+
]
|
|
7145
|
+
}
|
|
7146
|
+
}
|
|
7147
|
+
]
|
|
7148
|
+
}
|
|
7149
|
+
}
|
|
7150
|
+
}
|
|
7151
|
+
];
|
|
7152
|
+
|
|
7153
|
+
/* *
|
|
7154
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7155
|
+
* you may not use this file except in compliance with the License.
|
|
7156
|
+
* You may obtain a copy of the License at
|
|
7157
|
+
*
|
|
7158
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7159
|
+
*
|
|
7160
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7161
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7162
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
7163
|
+
* See the License for the specific language governing permissions and
|
|
7164
|
+
* limitations under the License.
|
|
7165
|
+
*
|
|
7166
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
7167
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
7168
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
7169
|
+
* */
|
|
7170
|
+
var airmetList = airmetListJSON;
|
|
7171
|
+
var sigmetList = sigmetListJSON;
|
|
7172
|
+
var fakeSigmetTAC = 'EHAA SIGMET 1 VALID 121249/121449 EHDB- EHAA AMSTERDAM FIR FRQ TS OBS ENTIRE FIR FL010 STNR WKN';
|
|
7173
|
+
var fakeAirmetTAC = 'EHAA AIRMET -1 VALID 310700/311100 EHDB- EHAA AMSTERDAM FIR ISOL CB OBS ENTIRE FIR FL020 STNR NC';
|
|
7174
|
+
[rest.get(/^.*\/airmetlist$/, function (_, res, ctx) {
|
|
7175
|
+
return res(ctx.status(200), ctx.json(airmetList));
|
|
7176
|
+
}), rest.get(/^.*\/sigmetlist$/, function (_, res, ctx) {
|
|
7177
|
+
return res(ctx.status(200), ctx.json(sigmetList));
|
|
7178
|
+
}), rest.get(/^.*\/airmet-config$/, function (_, res, ctx) {
|
|
7179
|
+
return res(ctx.status(200), ctx.json(airmetConfig));
|
|
7180
|
+
}), rest.get(/^.*\/sigmet-config$/, function (_, res, ctx) {
|
|
7181
|
+
return res(ctx.status(200), ctx.json(sigmetConfig));
|
|
7182
|
+
}), rest.post(/^.*\/airmet2tac$/, function (_, res, ctx) {
|
|
7183
|
+
return res(ctx.status(200), ctx.text(fakeAirmetTAC));
|
|
7184
|
+
}), rest.post(/^.*\/sigmet2tac$/, function (_, res, ctx) {
|
|
7185
|
+
return res(ctx.status(200), ctx.text(fakeSigmetTAC));
|
|
7186
|
+
}), rest.get(/^(?!.*(sigmet|airmet)).*$/, function (req) {
|
|
7187
|
+
return req.passthrough();
|
|
7188
|
+
})];
|
|
7189
|
+
|
|
6953
7190
|
/* *
|
|
6954
7191
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6955
7192
|
* you may not use this file except in compliance with the License.
|
|
@@ -6974,6 +7211,12 @@ warningList.filter(function (warning) {
|
|
|
6974
7211
|
return warning.status !== 'EXPIRED' && warning.status !== 'WITHDRAWN';
|
|
6975
7212
|
}).length;
|
|
6976
7213
|
var areaKeywordList = ['North Sea districts', 'Coastal Districts', 'KNMI Specific', 'Objects', 'Baltic areas', 'NL', 'FI', 'METNorway Specific', 'Provinces', 'FIR', 'Countries'];
|
|
7214
|
+
[rest.get(/^.*\/warnings$/, function (req, res, ctx) {
|
|
7215
|
+
// respond using a mocked JSON body
|
|
7216
|
+
return res(ctx.json(warningList));
|
|
7217
|
+
}), rest.post(/^.*\/warnings\/(.*)$/, function (req, res, ctx) {
|
|
7218
|
+
return res(ctx.json({}));
|
|
7219
|
+
})];
|
|
6977
7220
|
|
|
6978
7221
|
/* *
|
|
6979
7222
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -6993,7 +7236,6 @@ var areaKeywordList = ['North Sea districts', 'Coastal Districts', 'KNMI Specifi
|
|
|
6993
7236
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
6994
7237
|
* */
|
|
6995
7238
|
var ERROR_NOT_FOUND = 'Request failed with status code 400';
|
|
6996
|
-
var MOCK_USERNAME = 'user.name';
|
|
6997
7239
|
var extractDrawingDetailsFromJSON = function extractDrawingDetailsFromJSON(drawingId) {
|
|
6998
7240
|
return drawingsListFullContent.find(function (element) {
|
|
6999
7241
|
return element.id === drawingId;
|
|
@@ -7069,14 +7311,6 @@ var getApiRoutes = function getApiRoutes(axiosInstance) {
|
|
|
7069
7311
|
};
|
|
7070
7312
|
});
|
|
7071
7313
|
},
|
|
7072
|
-
// public warnings
|
|
7073
|
-
getWarnings: function getWarnings() {
|
|
7074
|
-
return axiosInstance.get("/warnings/").then(function () {
|
|
7075
|
-
return {
|
|
7076
|
-
data: warningList
|
|
7077
|
-
};
|
|
7078
|
-
});
|
|
7079
|
-
},
|
|
7080
7314
|
saveWarningAs: function saveWarningAs(data) {
|
|
7081
7315
|
// eslint-disable-next-line no-console
|
|
7082
7316
|
console.log('api: save warning as', data);
|
|
@@ -7096,17 +7330,6 @@ var getApiRoutes = function getApiRoutes(axiosInstance) {
|
|
|
7096
7330
|
return warning.id === warningId;
|
|
7097
7331
|
}), 1);
|
|
7098
7332
|
return axiosInstance.post("/warnings/" + warningId + "?delete=true");
|
|
7099
|
-
},
|
|
7100
|
-
toggleEditorWarning: function toggleEditorWarning(warningId, isEditor) {
|
|
7101
|
-
// eslint-disable-next-line no-console
|
|
7102
|
-
console.log('api: toggle editor warning', warningId, isEditor);
|
|
7103
|
-
var index = warningList.findIndex(function (warning) {
|
|
7104
|
-
return warning.id === warningId;
|
|
7105
|
-
});
|
|
7106
|
-
warningList.splice(index, 1, Object.assign({}, warningList[index], {
|
|
7107
|
-
editor: isEditor ? MOCK_USERNAME : null
|
|
7108
|
-
}));
|
|
7109
|
-
return axiosInstance.post("/warnings/" + warningId + "?editor=" + (isEditor ? 'true' : 'false'));
|
|
7110
7333
|
}
|
|
7111
7334
|
};
|
|
7112
7335
|
};
|
|
@@ -7457,7 +7680,7 @@ var DrawingToolFormContentsNoMemo = function DrawingToolFormContentsNoMemo(_ref)
|
|
|
7457
7680
|
};
|
|
7458
7681
|
var DrawingToolFormContents = /*#__PURE__*/React__default.memo(DrawingToolFormContentsNoMemo, isEqual);
|
|
7459
7682
|
|
|
7460
|
-
var _excluded$
|
|
7683
|
+
var _excluded$9 = ["opacity", "geoJSON"];
|
|
7461
7684
|
var getObjectName$1 = function getObjectName(objectName) {
|
|
7462
7685
|
return objectName || dateUtils.dateToString(new Date(), dateUtils.DATE_FORMAT_DATEPICKER, true) + " UTC";
|
|
7463
7686
|
};
|
|
@@ -7527,7 +7750,7 @@ var DrawingToolForm = function DrawingToolForm(_ref) {
|
|
|
7527
7750
|
// remove unneeded properties
|
|
7528
7751
|
formValues.opacity;
|
|
7529
7752
|
var geoJSON = formValues.geoJSON,
|
|
7530
|
-
allFormValues = _objectWithoutPropertiesLoose(formValues, _excluded$
|
|
7753
|
+
allFormValues = _objectWithoutPropertiesLoose(formValues, _excluded$9);
|
|
7531
7754
|
// rewind geometry
|
|
7532
7755
|
var rewindedGeometry = rewindGeometry(geoJSON);
|
|
7533
7756
|
onSubmitForm(Object.assign({}, allFormValues, {
|
|
@@ -7936,7 +8159,7 @@ var PublicWarningsFormDialog = function PublicWarningsFormDialog(_ref) {
|
|
|
7936
8159
|
}));
|
|
7937
8160
|
};
|
|
7938
8161
|
|
|
7939
|
-
var _excluded$
|
|
8162
|
+
var _excluded$8 = ["children", "value", "index"];
|
|
7940
8163
|
function a11yProps(index) {
|
|
7941
8164
|
return {
|
|
7942
8165
|
id: "tab-" + index,
|
|
@@ -7957,7 +8180,7 @@ var CustomTabPanel = function CustomTabPanel(props) {
|
|
|
7957
8180
|
var children = props.children,
|
|
7958
8181
|
value = props.value,
|
|
7959
8182
|
index = props.index,
|
|
7960
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$
|
|
8183
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$8);
|
|
7961
8184
|
return jsx("div", Object.assign({
|
|
7962
8185
|
role: "tabpanel",
|
|
7963
8186
|
hidden: value !== index,
|
|
@@ -8205,23 +8428,6 @@ var AreaField = function AreaField(_ref) {
|
|
|
8205
8428
|
};
|
|
8206
8429
|
|
|
8207
8430
|
var _defaultLevelFilter, _defaultEmptyFilter;
|
|
8208
|
-
/* *
|
|
8209
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8210
|
-
* you may not use this file except in compliance with the License.
|
|
8211
|
-
* You may obtain a copy of the License at
|
|
8212
|
-
*
|
|
8213
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8214
|
-
*
|
|
8215
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
8216
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
8217
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8218
|
-
* See the License for the specific language governing permissions and
|
|
8219
|
-
* limitations under the License.
|
|
8220
|
-
*
|
|
8221
|
-
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
8222
|
-
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
8223
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
8224
|
-
* */
|
|
8225
8431
|
var Domain;
|
|
8226
8432
|
(function (Domain) {
|
|
8227
8433
|
Domain["aviation"] = "aviation";
|
|
@@ -8267,7 +8473,16 @@ var makeFilterFromList = function makeFilterFromList(options) {
|
|
|
8267
8473
|
return p ? Object.assign({}, acc, (_Object$assign = {}, _Object$assign[p] = true, _Object$assign)) : acc;
|
|
8268
8474
|
}, (_options$reduce = {}, _options$reduce[emptyFilterId] = true, _options$reduce));
|
|
8269
8475
|
};
|
|
8270
|
-
var
|
|
8476
|
+
var AllPhenomena = Object.assign({}, AirmetPhenomena, SigmetPhenomena, Phenomenon$1);
|
|
8477
|
+
var AllPhenomenaKeys = Object.fromEntries(Object.keys(AllPhenomena).map(function (key) {
|
|
8478
|
+
return [key, key];
|
|
8479
|
+
}));
|
|
8480
|
+
var domainPhenomena = {
|
|
8481
|
+
aviation: [].concat(Object.keys(SigmetPhenomena), Object.keys(AirmetPhenomena)),
|
|
8482
|
+
maritime: [],
|
|
8483
|
+
"public": [].concat(Object.keys(Phenomenon$1))
|
|
8484
|
+
};
|
|
8485
|
+
var defaultPhenomenonFilter = makeFilterFromList(Object.keys(AllPhenomenaKeys));
|
|
8271
8486
|
var initialFilters = {
|
|
8272
8487
|
incident: defaultEmptyFilter,
|
|
8273
8488
|
source: defaultEmptyFilter,
|
|
@@ -8474,6 +8689,10 @@ var warningPhenomena = [{
|
|
|
8474
8689
|
translationKey: 'aviation-phenomenon-obscured-thunderstorm-with-hail',
|
|
8475
8690
|
key: 'OBSC_TSGR',
|
|
8476
8691
|
isAviation: true
|
|
8692
|
+
}, {
|
|
8693
|
+
translationKey: 'aviation-phenomenon-obscured-thunderstorm',
|
|
8694
|
+
key: 'OBSC_TS',
|
|
8695
|
+
isAviation: true
|
|
8477
8696
|
}, {
|
|
8478
8697
|
translationKey: 'aviation-phenomenon-squall-thunderstorm-with-hail',
|
|
8479
8698
|
key: 'SQL_TSGR',
|
|
@@ -8955,23 +9174,19 @@ var ProbabilityField = function ProbabilityField(_ref) {
|
|
|
8955
9174
|
});
|
|
8956
9175
|
};
|
|
8957
9176
|
|
|
8958
|
-
var config = getConfig();
|
|
8959
|
-
var airmetBaseUrl = config.GW_AIRMET_BASE_URL;
|
|
8960
|
-
var sigmetBaseUrl = config.GW_SIGMET_BASE_URL;
|
|
9177
|
+
var config$1 = getConfig();
|
|
9178
|
+
var airmetBaseUrl = config$1.GW_AIRMET_BASE_URL || '';
|
|
9179
|
+
var sigmetBaseUrl = config$1.GW_SIGMET_BASE_URL || '';
|
|
8961
9180
|
// API
|
|
8962
9181
|
var getAirmetList = function getAirmetList(auth) {
|
|
8963
9182
|
return fetch(airmetBaseUrl + "/airmetlist", {
|
|
8964
9183
|
headers: getHeaders(auth)
|
|
8965
|
-
}).then(
|
|
8966
|
-
return r.json();
|
|
8967
|
-
});
|
|
9184
|
+
}).then(handleResponse);
|
|
8968
9185
|
};
|
|
8969
9186
|
var getSigmetList = function getSigmetList(auth) {
|
|
8970
9187
|
return fetch(sigmetBaseUrl + "/sigmetlist", {
|
|
8971
9188
|
headers: getHeaders(auth)
|
|
8972
|
-
}).then(
|
|
8973
|
-
return r.json();
|
|
8974
|
-
});
|
|
9189
|
+
}).then(handleResponse);
|
|
8975
9190
|
};
|
|
8976
9191
|
var getAirmetConfig = function getAirmetConfig(auth) {
|
|
8977
9192
|
return fetch(airmetBaseUrl + "/airmet-config", {
|
|
@@ -9121,7 +9336,7 @@ var useTACApi = function useTACApi() {
|
|
|
9121
9336
|
};
|
|
9122
9337
|
};
|
|
9123
9338
|
|
|
9124
|
-
var _excluded$
|
|
9339
|
+
var _excluded$7 = ["IS_DRAFT", "object", "translation-select"];
|
|
9125
9340
|
var useScrollTopOnError = function useScrollTopOnError(error) {
|
|
9126
9341
|
var ref = React.useRef(null);
|
|
9127
9342
|
React.useEffect(function () {
|
|
@@ -9218,7 +9433,7 @@ var prepareFormValues = function prepareFormValues(data) {
|
|
|
9218
9433
|
data.IS_DRAFT;
|
|
9219
9434
|
data.object;
|
|
9220
9435
|
data['translation-select'];
|
|
9221
|
-
var productToPost = _objectWithoutPropertiesLoose(data, _excluded$
|
|
9436
|
+
var productToPost = _objectWithoutPropertiesLoose(data, _excluded$7);
|
|
9222
9437
|
// remove empty fields
|
|
9223
9438
|
return Object.keys(productToPost).reduce(function (warningDetail, fieldName) {
|
|
9224
9439
|
var key = fieldName;
|
|
@@ -9726,29 +9941,25 @@ var getPublicWarningStore = function getPublicWarningStore(store) {
|
|
|
9726
9941
|
if (store && store.publicWarningForm) {
|
|
9727
9942
|
return store.publicWarningForm;
|
|
9728
9943
|
}
|
|
9729
|
-
return
|
|
9944
|
+
return {};
|
|
9730
9945
|
};
|
|
9731
9946
|
var getPublicWarningObject = createSelector(getPublicWarningStore, function (publicWarningStore) {
|
|
9732
9947
|
return publicWarningStore.object;
|
|
9733
9948
|
});
|
|
9734
9949
|
var getPublicWarning = createSelector(getPublicWarningStore, function (publicWarningStore) {
|
|
9735
|
-
return publicWarningStore.
|
|
9950
|
+
return publicWarningStore == null ? void 0 : publicWarningStore.warning;
|
|
9736
9951
|
});
|
|
9737
9952
|
var getPublicWarningStatus = createSelector(getPublicWarningStore, function (publicWarningStore) {
|
|
9738
|
-
var _publicWarningStore$
|
|
9739
|
-
return publicWarningStore == null || (_publicWarningStore$
|
|
9740
|
-
});
|
|
9741
|
-
var getPublicWarningEditor = createSelector(getPublicWarningStore, function (publicWarningStore) {
|
|
9742
|
-
var _publicWarningStore$p2;
|
|
9743
|
-
return publicWarningStore == null || (_publicWarningStore$p2 = publicWarningStore.publicWarning) == null ? void 0 : _publicWarningStore$p2.editor;
|
|
9953
|
+
var _publicWarningStore$w;
|
|
9954
|
+
return publicWarningStore == null || (_publicWarningStore$w = publicWarningStore.warning) == null ? void 0 : _publicWarningStore$w.status;
|
|
9744
9955
|
});
|
|
9745
9956
|
var getPublicWarningId = createSelector(getPublicWarningStore, function (publicWarningStore) {
|
|
9746
|
-
var _publicWarningStore$
|
|
9747
|
-
return publicWarningStore == null || (_publicWarningStore$
|
|
9957
|
+
var _publicWarningStore$w2;
|
|
9958
|
+
return publicWarningStore == null || (_publicWarningStore$w2 = publicWarningStore.warning) == null ? void 0 : _publicWarningStore$w2.warningDetail.id;
|
|
9748
9959
|
});
|
|
9749
9960
|
var getPublicWarningAreas = createSelector(getPublicWarningStore, function (publicWarningStore) {
|
|
9750
|
-
var _publicWarningStore$
|
|
9751
|
-
return (publicWarningStore == null || (_publicWarningStore$
|
|
9961
|
+
var _publicWarningStore$w3;
|
|
9962
|
+
return (publicWarningStore == null || (_publicWarningStore$w3 = publicWarningStore.warning) == null ? void 0 : _publicWarningStore$w3.warningDetail.areas) || [];
|
|
9752
9963
|
});
|
|
9753
9964
|
var getPublicWarningFormState = createSelector(getPublicWarningStore, function (publicWarningStore) {
|
|
9754
9965
|
return (publicWarningStore == null ? void 0 : publicWarningStore.formState) || '';
|
|
@@ -9756,8 +9967,8 @@ var getPublicWarningFormState = createSelector(getPublicWarningStore, function (
|
|
|
9756
9967
|
var getPublicWarningFormError = createSelector(getPublicWarningStore, function (publicWarningStore) {
|
|
9757
9968
|
return publicWarningStore == null ? void 0 : publicWarningStore.error;
|
|
9758
9969
|
});
|
|
9759
|
-
var
|
|
9760
|
-
return (publicWarningStore == null ? void 0 : publicWarningStore.
|
|
9970
|
+
var getSelectedWarningId = createSelector(getPublicWarningStore, function (publicWarningStore) {
|
|
9971
|
+
return (publicWarningStore == null ? void 0 : publicWarningStore.selectedWarningId) || '';
|
|
9761
9972
|
});
|
|
9762
9973
|
var getSelectedPublicIsFormDirty = createSelector(getPublicWarningStore, function (publicWarningStore) {
|
|
9763
9974
|
return (publicWarningStore == null ? void 0 : publicWarningStore.isFormDirty) || false;
|
|
@@ -9795,11 +10006,13 @@ var PublicWarningStatus;
|
|
|
9795
10006
|
})(PublicWarningStatus || (PublicWarningStatus = {}));
|
|
9796
10007
|
|
|
9797
10008
|
var PublicWarningsFormConnect = function PublicWarningsFormConnect(_ref) {
|
|
9798
|
-
var
|
|
10009
|
+
var editor = _ref.editor,
|
|
10010
|
+
defaultMapPreset = _ref.defaultMapPreset,
|
|
9799
10011
|
selectedAviationProduct = _ref.selectedAviationProduct,
|
|
9800
10012
|
_ref$warningType = _ref.warningType,
|
|
9801
10013
|
warningType = _ref$warningType === void 0 ? 'public' : _ref$warningType,
|
|
9802
|
-
mode = _ref.mode
|
|
10014
|
+
mode = _ref.mode,
|
|
10015
|
+
onFormSubmit = _ref.onFormSubmit;
|
|
9803
10016
|
var publicWarning = useSelector(function (store) {
|
|
9804
10017
|
return getPublicWarning(store);
|
|
9805
10018
|
});
|
|
@@ -9812,19 +10025,17 @@ var PublicWarningsFormConnect = function PublicWarningsFormConnect(_ref) {
|
|
|
9812
10025
|
var publicWarningFormError = useSelector(function (store) {
|
|
9813
10026
|
return getPublicWarningFormError(store);
|
|
9814
10027
|
});
|
|
9815
|
-
var publicWarningEditor = useSelector(function (store) {
|
|
9816
|
-
return getPublicWarningEditor(store);
|
|
9817
|
-
});
|
|
9818
10028
|
var _useAuthenticationCon = useAuthenticationContext$1(),
|
|
9819
10029
|
auth = _useAuthenticationCon.auth;
|
|
9820
|
-
var isEditor =
|
|
10030
|
+
var isEditor = editor === (auth == null ? void 0 : auth.username) || false;
|
|
9821
10031
|
var dispatch = useDispatch();
|
|
9822
10032
|
var publishForm = function publishForm(newFormValues) {
|
|
9823
10033
|
dispatch(publicWarningFormActions.publishWarning({
|
|
9824
10034
|
publicWarning: {
|
|
9825
10035
|
warningDetail: newFormValues,
|
|
9826
10036
|
status: PublicWarningStatus.PUBLISHED
|
|
9827
|
-
}
|
|
10037
|
+
},
|
|
10038
|
+
refetchWarnings: onFormSubmit
|
|
9828
10039
|
}));
|
|
9829
10040
|
};
|
|
9830
10041
|
var clearForm = function clearForm() {
|
|
@@ -9837,7 +10048,8 @@ var PublicWarningsFormConnect = function PublicWarningsFormConnect(_ref) {
|
|
|
9837
10048
|
warningDetail: newFormValues,
|
|
9838
10049
|
status: status,
|
|
9839
10050
|
editor: auth == null ? void 0 : auth.username
|
|
9840
|
-
}
|
|
10051
|
+
},
|
|
10052
|
+
refetchWarnings: onFormSubmit
|
|
9841
10053
|
}));
|
|
9842
10054
|
};
|
|
9843
10055
|
var onFormDirty = function onFormDirty(isFormDirty) {
|
|
@@ -9861,12 +10073,16 @@ var PublicWarningsFormConnect = function PublicWarningsFormConnect(_ref) {
|
|
|
9861
10073
|
if ((selectedAviationProduct == null ? void 0 : selectedAviationProduct.status) === 'DRAFT') {
|
|
9862
10074
|
return false;
|
|
9863
10075
|
}
|
|
10076
|
+
if (publicWarningFormAction === 'edit') {
|
|
10077
|
+
return false;
|
|
10078
|
+
}
|
|
9864
10079
|
if (mode === 'new') {
|
|
9865
10080
|
return false;
|
|
9866
10081
|
}
|
|
9867
10082
|
return true;
|
|
9868
10083
|
};
|
|
9869
10084
|
var isReadOnly = getIsReadOnly();
|
|
10085
|
+
var formMode = publicWarningFormAction === 'edit' ? 'edit' : mode;
|
|
9870
10086
|
var onAddObject = function onAddObject() {
|
|
9871
10087
|
dispatch(uiActions.setToggleOpenDialog({
|
|
9872
10088
|
type: uiTypes.DialogTypes.AreaObjectLoader,
|
|
@@ -9887,7 +10103,7 @@ var PublicWarningsFormConnect = function PublicWarningsFormConnect(_ref) {
|
|
|
9887
10103
|
onAddObject: onAddObject,
|
|
9888
10104
|
selectedAviationProduct: selectedAviationProduct,
|
|
9889
10105
|
warningType: warningType,
|
|
9890
|
-
mode:
|
|
10106
|
+
mode: formMode
|
|
9891
10107
|
});
|
|
9892
10108
|
};
|
|
9893
10109
|
|
|
@@ -10511,26 +10727,25 @@ var AreaObjectLoaderConnect = function AreaObjectLoaderConnect(_ref) {
|
|
|
10511
10727
|
});
|
|
10512
10728
|
};
|
|
10513
10729
|
|
|
10514
|
-
|
|
10515
|
-
|
|
10516
|
-
|
|
10517
|
-
|
|
10518
|
-
|
|
10519
|
-
|
|
10520
|
-
|
|
10521
|
-
|
|
10522
|
-
|
|
10523
|
-
|
|
10524
|
-
|
|
10525
|
-
|
|
10526
|
-
|
|
10527
|
-
|
|
10528
|
-
|
|
10529
|
-
|
|
10530
|
-
|
|
10730
|
+
var _excluded$6 = ["sigmetAirmetDetail"];
|
|
10731
|
+
function isCancelAirmet(warningDetail) {
|
|
10732
|
+
return warningDetail.cancelsAirmetSequenceId !== undefined;
|
|
10733
|
+
}
|
|
10734
|
+
function isCancelSigmet(warningDetail) {
|
|
10735
|
+
return warningDetail.cancelsSigmetSequenceId !== undefined;
|
|
10736
|
+
}
|
|
10737
|
+
var flattenPublicWarning = function flattenPublicWarning(publicWarning) {
|
|
10738
|
+
if (!publicWarning) {
|
|
10739
|
+
return {};
|
|
10740
|
+
}
|
|
10741
|
+
var sigmetAirmetDetail = publicWarning.sigmetAirmetDetail,
|
|
10742
|
+
rest = _objectWithoutPropertiesLoose(publicWarning, _excluded$6);
|
|
10743
|
+
return Object.assign({}, rest, sigmetAirmetDetail || {}, {
|
|
10744
|
+
status: sigmetAirmetDetail == null ? void 0 : sigmetAirmetDetail.status
|
|
10745
|
+
});
|
|
10746
|
+
};
|
|
10531
10747
|
var transformAirmetToWarningFormat = function transformAirmetToWarningFormat(apiAirmet) {
|
|
10532
10748
|
var airmet = apiAirmet.airmet;
|
|
10533
|
-
var cancelAirmet = apiAirmet == null ? void 0 : apiAirmet.airmet;
|
|
10534
10749
|
var areas = [];
|
|
10535
10750
|
if (airmet.startGeometry) {
|
|
10536
10751
|
areas.push({
|
|
@@ -10551,23 +10766,22 @@ var transformAirmetToWarningFormat = function transformAirmetToWarningFormat(api
|
|
|
10551
10766
|
lastUpdatedTime: apiAirmet.lastUpdateDate,
|
|
10552
10767
|
productStatus: airmet.status,
|
|
10553
10768
|
warningDetail: {
|
|
10554
|
-
|
|
10555
|
-
descriptionTranslation: '',
|
|
10556
|
-
areas: areas,
|
|
10769
|
+
id: airmet.uuid,
|
|
10557
10770
|
phenomenon: airmet.phenomenon,
|
|
10771
|
+
areas: areas,
|
|
10558
10772
|
validFrom: airmet.validDateStart,
|
|
10559
10773
|
validUntil: airmet.validDateEnd,
|
|
10774
|
+
incident: airmet.sequence,
|
|
10560
10775
|
level: 'AIR',
|
|
10561
10776
|
probability: 0,
|
|
10562
|
-
|
|
10563
|
-
|
|
10564
|
-
|
|
10565
|
-
}
|
|
10777
|
+
descriptionOriginal: '',
|
|
10778
|
+
descriptionTranslation: ''
|
|
10779
|
+
},
|
|
10780
|
+
sigmetAirmetDetail: Object.assign({}, airmet)
|
|
10566
10781
|
};
|
|
10567
10782
|
};
|
|
10568
10783
|
var transformSigmetToWarningFormat = function transformSigmetToWarningFormat(apiSigmet) {
|
|
10569
10784
|
var sigmet = apiSigmet.sigmet;
|
|
10570
|
-
var cancelSigmet = apiSigmet == null ? void 0 : apiSigmet.sigmet;
|
|
10571
10785
|
var areas = [];
|
|
10572
10786
|
if (sigmet.startGeometry) {
|
|
10573
10787
|
areas.push({
|
|
@@ -10604,18 +10818,18 @@ var transformSigmetToWarningFormat = function transformSigmetToWarningFormat(api
|
|
|
10604
10818
|
lastUpdatedTime: apiSigmet.lastUpdateDate,
|
|
10605
10819
|
productStatus: sigmet.status,
|
|
10606
10820
|
warningDetail: {
|
|
10607
|
-
|
|
10608
|
-
descriptionTranslation: '',
|
|
10609
|
-
areas: areas,
|
|
10821
|
+
id: sigmet.uuid,
|
|
10610
10822
|
phenomenon: sigmet.phenomenon,
|
|
10823
|
+
areas: areas,
|
|
10611
10824
|
validFrom: sigmet.validDateStart,
|
|
10612
10825
|
validUntil: sigmet.validDateEnd,
|
|
10826
|
+
incident: sigmet.sequence,
|
|
10613
10827
|
level: 'SIG',
|
|
10614
10828
|
probability: 0,
|
|
10615
|
-
|
|
10616
|
-
|
|
10617
|
-
|
|
10618
|
-
}
|
|
10829
|
+
descriptionOriginal: '',
|
|
10830
|
+
descriptionTranslation: ''
|
|
10831
|
+
},
|
|
10832
|
+
sigmetAirmetDetail: Object.assign({}, sigmet)
|
|
10619
10833
|
};
|
|
10620
10834
|
};
|
|
10621
10835
|
var mapProductStatusToWarningStatus = function mapProductStatusToWarningStatus(productStatus) {
|
|
@@ -10631,15 +10845,9 @@ var mapProductStatusToWarningStatus = function mapProductStatusToWarningStatus(p
|
|
|
10631
10845
|
return PublicWarningStatus.EXPIRED;
|
|
10632
10846
|
}
|
|
10633
10847
|
};
|
|
10634
|
-
var transformSigmetToProductFormat = function transformSigmetToProductFormat(warning
|
|
10635
|
-
var _warning$sigmet;
|
|
10636
|
-
var fir = (warning == null || (_warning$sigmet = warning.sigmet) == null ? void 0 : _warning$sigmet.locationIndicatorATSR) || config.active_firs[0];
|
|
10637
|
-
var firConfig = config.fir_areas[fir];
|
|
10848
|
+
var transformSigmetToProductFormat = function transformSigmetToProductFormat(warning) {
|
|
10638
10849
|
var sigmet = warning == null ? void 0 : warning.sigmet;
|
|
10639
10850
|
var cancelSigmet = warning == null ? void 0 : warning.sigmet;
|
|
10640
|
-
if (!firConfig) {
|
|
10641
|
-
throw new Error("FIR " + fir + " not found in configuration");
|
|
10642
|
-
}
|
|
10643
10851
|
return Object.assign({
|
|
10644
10852
|
uuid: (sigmet == null ? void 0 : sigmet.uuid) || 'default',
|
|
10645
10853
|
// Use a fallback UUID or handle undefined
|
|
@@ -10680,15 +10888,9 @@ var transformSigmetToProductFormat = function transformSigmetToProductFormat(war
|
|
|
10680
10888
|
validDateEndOfSigmetToCancel: cancelSigmet.validDateEndOfSigmetToCancel
|
|
10681
10889
|
});
|
|
10682
10890
|
};
|
|
10683
|
-
var transformAirmetToProductFormat = function transformAirmetToProductFormat(warning
|
|
10684
|
-
var _warning$airmet;
|
|
10685
|
-
var fir = (warning == null || (_warning$airmet = warning.airmet) == null ? void 0 : _warning$airmet.locationIndicatorATSR) || config.active_firs[0];
|
|
10686
|
-
var firConfig = config.fir_areas[fir];
|
|
10891
|
+
var transformAirmetToProductFormat = function transformAirmetToProductFormat(warning) {
|
|
10687
10892
|
var airmet = warning == null ? void 0 : warning.airmet;
|
|
10688
10893
|
var cancelAirmet = warning == null ? void 0 : warning.airmet;
|
|
10689
|
-
if (!firConfig) {
|
|
10690
|
-
throw new Error("FIR " + fir + " not found in configuration");
|
|
10691
|
-
}
|
|
10692
10894
|
return Object.assign({
|
|
10693
10895
|
uuid: (airmet == null ? void 0 : airmet.uuid) || 'default',
|
|
10694
10896
|
// Use a fallback UUID or handle undefined
|
|
@@ -10801,6 +11003,172 @@ var getEmptyAirmetWarning = function getEmptyAirmetWarning() {
|
|
|
10801
11003
|
}
|
|
10802
11004
|
};
|
|
10803
11005
|
};
|
|
11006
|
+
var renewWarning = function renewWarning(warning, productConfig) {
|
|
11007
|
+
if (!warning.sigmetAirmetDetail) {
|
|
11008
|
+
return warning;
|
|
11009
|
+
}
|
|
11010
|
+
return renewAviationProduct(warning, productConfig);
|
|
11011
|
+
};
|
|
11012
|
+
var renewAviationProduct = function renewAviationProduct(oldWarning, productConfig) {
|
|
11013
|
+
var warningDetail = oldWarning.sigmetAirmetDetail;
|
|
11014
|
+
if (!warningDetail) {
|
|
11015
|
+
return oldWarning;
|
|
11016
|
+
}
|
|
11017
|
+
var newValidUntil = 'phenomenon' in warningDetail ? getDefaultValidUntilValue(productConfig, warningDetail.phenomenon, warningDetail.locationIndicatorATSR, warningDetail.validDateEnd) : warningDetail.validDateEnd;
|
|
11018
|
+
var renewedWarningDetail = Object.assign({}, warningDetail, {
|
|
11019
|
+
validDateStart: warningDetail.validDateEnd,
|
|
11020
|
+
validDateEnd: newValidUntil,
|
|
11021
|
+
status: ProductStatus.DRAFT,
|
|
11022
|
+
uuid: undefined,
|
|
11023
|
+
sequence: '-1'
|
|
11024
|
+
});
|
|
11025
|
+
return Object.assign({}, oldWarning, {
|
|
11026
|
+
sigmetAirmetDetail: renewedWarningDetail
|
|
11027
|
+
});
|
|
11028
|
+
};
|
|
11029
|
+
|
|
11030
|
+
/* *
|
|
11031
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11032
|
+
* you may not use this file except in compliance with the License.
|
|
11033
|
+
* You may obtain a copy of the License at
|
|
11034
|
+
*
|
|
11035
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11036
|
+
*
|
|
11037
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11038
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11039
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11040
|
+
* See the License for the specific language governing permissions and
|
|
11041
|
+
* limitations under the License.
|
|
11042
|
+
*
|
|
11043
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
11044
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
11045
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
11046
|
+
* */
|
|
11047
|
+
var config = getConfig();
|
|
11048
|
+
var publicWarningBaseUrl = config.GW_DRAWINGS_BASE_URL || '';
|
|
11049
|
+
// API
|
|
11050
|
+
var getPublicWarningList = function getPublicWarningList(auth) {
|
|
11051
|
+
return fetch(publicWarningBaseUrl + "/warnings", {
|
|
11052
|
+
headers: getHeaders(auth)
|
|
11053
|
+
}).then(handleResponse);
|
|
11054
|
+
};
|
|
11055
|
+
var updatePublicWarningEditor = function updatePublicWarningEditor(warningId, isEditor, auth) {
|
|
11056
|
+
return fetch(publicWarningBaseUrl + "/warnings/" + warningId + "?editor=" + (isEditor ? 'true' : 'false'), {
|
|
11057
|
+
headers: getHeaders(auth),
|
|
11058
|
+
method: 'POST'
|
|
11059
|
+
}).then(handleResponse);
|
|
11060
|
+
};
|
|
11061
|
+
|
|
11062
|
+
/**
|
|
11063
|
+
* @param disabled - Disables fetching, but still returns cached values.
|
|
11064
|
+
* https://tanstack.com/query/v4/docs/framework/react/guides/disabling-queries
|
|
11065
|
+
*/
|
|
11066
|
+
var usePublicWarnings = function usePublicWarnings(disabled) {
|
|
11067
|
+
if (disabled === void 0) {
|
|
11068
|
+
disabled = false;
|
|
11069
|
+
}
|
|
11070
|
+
return useAuthQuery(['public-warning-list'], getPublicWarningList, disabled, 1000 * 60 * 5);
|
|
11071
|
+
};
|
|
11072
|
+
var useMutatePublicWarningEditor = function useMutatePublicWarningEditor() {
|
|
11073
|
+
var queryClient = useQueryClient();
|
|
11074
|
+
var _useAuthenticationCon = useAuthenticationContext(),
|
|
11075
|
+
auth = _useAuthenticationCon.auth;
|
|
11076
|
+
var dispatch = useDispatch();
|
|
11077
|
+
return useMutation(Object.assign({
|
|
11078
|
+
mutationFn: function mutationFn(_ref) {
|
|
11079
|
+
var id = _ref.id,
|
|
11080
|
+
isEditor = _ref.isEditor;
|
|
11081
|
+
if (!auth) {
|
|
11082
|
+
throw new Error('Authentication context not found');
|
|
11083
|
+
}
|
|
11084
|
+
return updatePublicWarningEditor(id, isEditor, auth);
|
|
11085
|
+
}
|
|
11086
|
+
}, optimisticUpdate(['public-warning-list'], queryClient, function (w, _ref2) {
|
|
11087
|
+
var isEditor = _ref2.isEditor;
|
|
11088
|
+
return Object.assign({}, w, {
|
|
11089
|
+
editor: isEditor ? auth.username : undefined
|
|
11090
|
+
});
|
|
11091
|
+
}, function (error) {
|
|
11092
|
+
dispatch(publicWarningFormActions.setFormError({
|
|
11093
|
+
message: error.message
|
|
11094
|
+
}));
|
|
11095
|
+
}), {
|
|
11096
|
+
onSettled: function () {
|
|
11097
|
+
var _onSettled = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data, e, _ref3) {
|
|
11098
|
+
var isEditor;
|
|
11099
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
11100
|
+
while (1) switch (_context.prev = _context.next) {
|
|
11101
|
+
case 0:
|
|
11102
|
+
isEditor = _ref3.isEditor;
|
|
11103
|
+
dispatch(snackbarActions.openSnackbar({
|
|
11104
|
+
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
11105
|
+
key: isEditor ? 'warning-editor-add-editor' : 'warning-editor-remove-editor'
|
|
11106
|
+
}));
|
|
11107
|
+
case 2:
|
|
11108
|
+
case "end":
|
|
11109
|
+
return _context.stop();
|
|
11110
|
+
}
|
|
11111
|
+
}, _callee);
|
|
11112
|
+
}));
|
|
11113
|
+
function onSettled(_x, _x2, _x3) {
|
|
11114
|
+
return _onSettled.apply(this, arguments);
|
|
11115
|
+
}
|
|
11116
|
+
return onSettled;
|
|
11117
|
+
}()
|
|
11118
|
+
}));
|
|
11119
|
+
};
|
|
11120
|
+
|
|
11121
|
+
/* *
|
|
11122
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11123
|
+
* you may not use this file except in compliance with the License.
|
|
11124
|
+
* You may obtain a copy of the License at
|
|
11125
|
+
*
|
|
11126
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11127
|
+
*
|
|
11128
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11129
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11130
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11131
|
+
* See the License for the specific language governing permissions and
|
|
11132
|
+
* limitations under the License.
|
|
11133
|
+
*
|
|
11134
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
11135
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
11136
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
11137
|
+
* */
|
|
11138
|
+
var useWarnings = function useWarnings(disabled) {
|
|
11139
|
+
var _usePublicWarnings = usePublicWarnings(disabled),
|
|
11140
|
+
publicWarnings = _usePublicWarnings.data,
|
|
11141
|
+
refetchPublicWarnings = _usePublicWarnings.refetch,
|
|
11142
|
+
isFetchingPublicWarnings = _usePublicWarnings.isFetching,
|
|
11143
|
+
publicWarningsError = _usePublicWarnings.error,
|
|
11144
|
+
dataUpdatedAt = _usePublicWarnings.dataUpdatedAt;
|
|
11145
|
+
var _useAirmetList = useAirmetList(disabled),
|
|
11146
|
+
airmetWarnings = _useAirmetList.data,
|
|
11147
|
+
refetchAirmet = _useAirmetList.refetch,
|
|
11148
|
+
isFetchingAirmet = _useAirmetList.isFetching;
|
|
11149
|
+
var _useSigmetList = useSigmetList(disabled),
|
|
11150
|
+
sigmetWarnings = _useSigmetList.data,
|
|
11151
|
+
refetchSigmet = _useSigmetList.refetch,
|
|
11152
|
+
isFetchingSigmet = _useSigmetList.isFetching;
|
|
11153
|
+
var combinedWarnings = useMemo(function () {
|
|
11154
|
+
var transformedSigmets = (sigmetWarnings == null ? void 0 : sigmetWarnings.map(transformSigmetToWarningFormat)) || [];
|
|
11155
|
+
var transformedAirmets = (airmetWarnings == null ? void 0 : airmetWarnings.map(transformAirmetToWarningFormat)) || [];
|
|
11156
|
+
return (publicWarnings || []).concat(transformedSigmets).concat(transformedAirmets);
|
|
11157
|
+
}, [publicWarnings, sigmetWarnings, airmetWarnings]);
|
|
11158
|
+
var refetchWarnings = function refetchWarnings() {
|
|
11159
|
+
void refetchPublicWarnings();
|
|
11160
|
+
void refetchAirmet();
|
|
11161
|
+
void refetchSigmet();
|
|
11162
|
+
};
|
|
11163
|
+
var isFetching = isFetchingPublicWarnings || isFetchingAirmet || isFetchingSigmet;
|
|
11164
|
+
return {
|
|
11165
|
+
combinedWarnings: combinedWarnings,
|
|
11166
|
+
refetchWarnings: refetchWarnings,
|
|
11167
|
+
isFetching: isFetching,
|
|
11168
|
+
error: publicWarningsError || undefined,
|
|
11169
|
+
dataUpdatedAt: dataUpdatedAt
|
|
11170
|
+
};
|
|
11171
|
+
};
|
|
10804
11172
|
|
|
10805
11173
|
var warningFormConfirmationOptions = function warningFormConfirmationOptions(t) {
|
|
10806
11174
|
return {
|
|
@@ -10820,7 +11188,6 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
10820
11188
|
source = _ref$source === void 0 ? 'app' : _ref$source,
|
|
10821
11189
|
startPosition = _ref.startPosition,
|
|
10822
11190
|
defaultMapPreset = _ref.defaultMapPreset;
|
|
10823
|
-
var warningsApi = getWarningsApi();
|
|
10824
11191
|
var _useSetupDialog = useSetupDialog(publicWarningDialogType, source),
|
|
10825
11192
|
dialogOrder = _useSetupDialog.dialogOrder,
|
|
10826
11193
|
setDialogOrder = _useSetupDialog.setDialogOrder,
|
|
@@ -10838,66 +11205,100 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
10838
11205
|
var isFormDirty = useSelector(function (store) {
|
|
10839
11206
|
return getSelectedPublicIsFormDirty(store);
|
|
10840
11207
|
});
|
|
10841
|
-
var
|
|
10842
|
-
|
|
10843
|
-
|
|
11208
|
+
var publicWarningState = useSelector(getPublicWarning);
|
|
11209
|
+
var _ref2 = publicWarningState || {},
|
|
11210
|
+
status = _ref2.status,
|
|
11211
|
+
editor = _ref2.editor;
|
|
11212
|
+
var _useWarnings = useWarnings(true),
|
|
11213
|
+
combinedWarnings = _useWarnings.combinedWarnings,
|
|
11214
|
+
refetchWarnings = _useWarnings.refetchWarnings,
|
|
11215
|
+
isFetching = _useWarnings.isFetching;
|
|
11216
|
+
var _React$useState = React__default.useState(isFetching),
|
|
11217
|
+
hasFetched = _React$useState[0],
|
|
11218
|
+
setHasFetched = _React$useState[1];
|
|
11219
|
+
React__default.useEffect(function () {
|
|
11220
|
+
if (isFetching) {
|
|
11221
|
+
setHasFetched(true);
|
|
11222
|
+
}
|
|
11223
|
+
}, [isFetching]);
|
|
10844
11224
|
var selectedWarningId = useSelector(function (store) {
|
|
10845
|
-
return
|
|
10846
|
-
});
|
|
10847
|
-
var publicWarningEditor = useSelector(function (store) {
|
|
10848
|
-
return getPublicWarningEditor(store);
|
|
11225
|
+
return getSelectedWarningId(store);
|
|
10849
11226
|
});
|
|
11227
|
+
var selectedWarningObject = useSelector(getPublicWarning);
|
|
10850
11228
|
var warningType = useSelector(getWarningType);
|
|
11229
|
+
var selectedWarning = combinedWarnings == null ? void 0 : combinedWarnings.find(function (w) {
|
|
11230
|
+
return w.id === selectedWarningId;
|
|
11231
|
+
});
|
|
10851
11232
|
var _useAuthenticationCon = useAuthenticationContext$1(),
|
|
10852
11233
|
auth = _useAuthenticationCon.auth;
|
|
10853
|
-
var isEditor =
|
|
10854
|
-
var
|
|
10855
|
-
var
|
|
10856
|
-
|
|
11234
|
+
var isEditor = (selectedWarning == null ? void 0 : selectedWarning.editor) === (auth == null ? void 0 : auth.username) || false;
|
|
11235
|
+
var shouldGiveEditorWarning = React__default.useCallback(function (newEditor, oldEditor) {
|
|
11236
|
+
var oldEditorIsYou = oldEditor && oldEditor === (auth == null ? void 0 : auth.username);
|
|
11237
|
+
if (oldEditorIsYou && newEditor !== oldEditor) {
|
|
11238
|
+
dispatch(publicWarningFormActions.setFormError({
|
|
11239
|
+
severity: 'warning',
|
|
11240
|
+
message: TAKEOVER_MESSAGE
|
|
11241
|
+
}));
|
|
11242
|
+
}
|
|
11243
|
+
}, [dispatch, auth == null ? void 0 : auth.username]);
|
|
11244
|
+
var previousSelectedWarning = usePrevious(selectedWarning);
|
|
11245
|
+
var refetchCurrentEditor = /*#__PURE__*/function () {
|
|
11246
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
11247
|
+
var newWarnings, newSelectedWarning;
|
|
10857
11248
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10858
11249
|
while (1) switch (_context.prev = _context.next) {
|
|
10859
11250
|
case 0:
|
|
10860
11251
|
_context.next = 2;
|
|
10861
|
-
return
|
|
11252
|
+
return getPublicWarningList(auth);
|
|
10862
11253
|
case 2:
|
|
10863
|
-
|
|
10864
|
-
|
|
10865
|
-
return
|
|
11254
|
+
newWarnings = _context.sent;
|
|
11255
|
+
newSelectedWarning = newWarnings == null ? void 0 : newWarnings.find(function (w) {
|
|
11256
|
+
return w.id === selectedWarningId;
|
|
10866
11257
|
});
|
|
10867
|
-
return _context.abrupt("return", (
|
|
11258
|
+
return _context.abrupt("return", (newSelectedWarning == null ? void 0 : newSelectedWarning.editor) || '');
|
|
10868
11259
|
case 5:
|
|
10869
11260
|
case "end":
|
|
10870
11261
|
return _context.stop();
|
|
10871
11262
|
}
|
|
10872
11263
|
}, _callee);
|
|
10873
11264
|
}));
|
|
10874
|
-
return function
|
|
10875
|
-
return
|
|
11265
|
+
return function refetchCurrentEditor() {
|
|
11266
|
+
return _ref3.apply(this, arguments);
|
|
10876
11267
|
};
|
|
10877
11268
|
}();
|
|
11269
|
+
React__default.useEffect(function () {
|
|
11270
|
+
if (editor !== (selectedWarning == null ? void 0 : selectedWarning.editor) && status !== 'TODO') {
|
|
11271
|
+
void setIsEditor(editor !== (auth == null ? void 0 : auth.username));
|
|
11272
|
+
}
|
|
11273
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11274
|
+
}, [editor]);
|
|
11275
|
+
React__default.useEffect(function () {
|
|
11276
|
+
if ((selectedWarning == null ? void 0 : selectedWarning.id) !== (previousSelectedWarning == null ? void 0 : previousSelectedWarning.id)) {
|
|
11277
|
+
dispatch(publicWarningFormActions.removeFormError());
|
|
11278
|
+
}
|
|
11279
|
+
}, [selectedWarning == null ? void 0 : selectedWarning.id, previousSelectedWarning == null ? void 0 : previousSelectedWarning.id, dispatch]);
|
|
11280
|
+
React__default.useEffect(function () {
|
|
11281
|
+
// Only give editor warning when the change in selectedWarning is from a refetch
|
|
11282
|
+
if (hasFetched) {
|
|
11283
|
+
setHasFetched(false);
|
|
11284
|
+
shouldGiveEditorWarning(selectedWarning == null ? void 0 : selectedWarning.editor, previousSelectedWarning == null ? void 0 : previousSelectedWarning.editor);
|
|
11285
|
+
}
|
|
11286
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
11287
|
+
}, [selectedWarning == null ? void 0 : selectedWarning.editor]);
|
|
11288
|
+
var updatePublicWarningEditor = useMutatePublicWarningEditor();
|
|
10878
11289
|
var setIsEditor = /*#__PURE__*/function () {
|
|
10879
|
-
var
|
|
11290
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(isReadOnly) {
|
|
10880
11291
|
var username, latestEditor;
|
|
10881
11292
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
10882
11293
|
while (1) switch (_context2.prev = _context2.next) {
|
|
10883
11294
|
case 0:
|
|
10884
11295
|
username = (auth == null ? void 0 : auth.username) || ''; // make sure to get the latest changes if you are editing an existing warning
|
|
10885
|
-
|
|
10886
|
-
|
|
10887
|
-
|
|
10888
|
-
|
|
10889
|
-
_context2.next = 4;
|
|
10890
|
-
return getLatestEditor();
|
|
10891
|
-
case 4:
|
|
10892
|
-
_context2.t0 = _context2.sent;
|
|
10893
|
-
_context2.next = 8;
|
|
10894
|
-
break;
|
|
10895
|
-
case 7:
|
|
10896
|
-
_context2.t0 = '';
|
|
10897
|
-
case 8:
|
|
10898
|
-
latestEditor = _context2.t0;
|
|
11296
|
+
_context2.next = 3;
|
|
11297
|
+
return refetchCurrentEditor();
|
|
11298
|
+
case 3:
|
|
11299
|
+
latestEditor = _context2.sent;
|
|
10899
11300
|
if (!(!selectedWarningId || !isReadOnly && username === latestEditor || isReadOnly && latestEditor !== username)) {
|
|
10900
|
-
_context2.next =
|
|
11301
|
+
_context2.next = 8;
|
|
10901
11302
|
break;
|
|
10902
11303
|
}
|
|
10903
11304
|
// currently editing a new warning or
|
|
@@ -10907,34 +11308,40 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
10907
11308
|
dispatch(publicWarningFormActions.setFormValues({
|
|
10908
11309
|
formState: isReadOnly ? 'readonly' : ''
|
|
10909
11310
|
}));
|
|
11311
|
+
// If the editor was changed in a different window, refetch the warnings
|
|
11312
|
+
if (latestEditor !== (selectedWarning == null ? void 0 : selectedWarning.editor)) {
|
|
11313
|
+
void refetchWarnings();
|
|
11314
|
+
}
|
|
10910
11315
|
return _context2.abrupt("return", true);
|
|
10911
|
-
case
|
|
11316
|
+
case 8:
|
|
10912
11317
|
if (!(!isReadOnly && isAlreadyEdited(latestEditor, username))) {
|
|
10913
|
-
_context2.next =
|
|
11318
|
+
_context2.next = 11;
|
|
10914
11319
|
break;
|
|
10915
11320
|
}
|
|
10916
|
-
_context2.next =
|
|
11321
|
+
_context2.next = 11;
|
|
10917
11322
|
return confirmDialog({
|
|
10918
11323
|
title: t('warning-edit-mode-title'),
|
|
10919
11324
|
description: t('warning-edit-mode-description'),
|
|
10920
11325
|
confirmLabel: t('warning-edit-mode-confirm'),
|
|
10921
11326
|
cancelLabel: t('warning-dialog-cancel')
|
|
10922
11327
|
});
|
|
10923
|
-
case
|
|
10924
|
-
dispatch(publicWarningFormActions.
|
|
10925
|
-
|
|
10926
|
-
isEditor: !isReadOnly,
|
|
10927
|
-
username: username
|
|
11328
|
+
case 11:
|
|
11329
|
+
dispatch(publicWarningFormActions.setFormValues({
|
|
11330
|
+
formState: isReadOnly ? 'readonly' : ''
|
|
10928
11331
|
}));
|
|
11332
|
+
updatePublicWarningEditor.mutate({
|
|
11333
|
+
id: selectedWarningId,
|
|
11334
|
+
isEditor: !isReadOnly
|
|
11335
|
+
});
|
|
10929
11336
|
return _context2.abrupt("return", true);
|
|
10930
|
-
case
|
|
11337
|
+
case 14:
|
|
10931
11338
|
case "end":
|
|
10932
11339
|
return _context2.stop();
|
|
10933
11340
|
}
|
|
10934
11341
|
}, _callee2);
|
|
10935
11342
|
}));
|
|
10936
11343
|
return function setIsEditor(_x) {
|
|
10937
|
-
return
|
|
11344
|
+
return _ref4.apply(this, arguments);
|
|
10938
11345
|
};
|
|
10939
11346
|
}();
|
|
10940
11347
|
var onChangeFormMode = function onChangeFormMode(isReadOnly) {
|
|
@@ -10961,7 +11368,7 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
10961
11368
|
}
|
|
10962
11369
|
};
|
|
10963
11370
|
var closeDialog = /*#__PURE__*/function () {
|
|
10964
|
-
var
|
|
11371
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
10965
11372
|
var mayProceed;
|
|
10966
11373
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
10967
11374
|
while (1) switch (_context4.prev = _context4.next) {
|
|
@@ -10992,7 +11399,7 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
10992
11399
|
}, _callee4);
|
|
10993
11400
|
}));
|
|
10994
11401
|
return function closeDialog() {
|
|
10995
|
-
return
|
|
11402
|
+
return _ref6.apply(this, arguments);
|
|
10996
11403
|
};
|
|
10997
11404
|
}();
|
|
10998
11405
|
var _useAirmetList = useAirmetList(true),
|
|
@@ -11008,15 +11415,26 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
11008
11415
|
var updatedWarningType = selectedSigmet ? 'sigmet' : selectedAirmet && 'airmet' || warningType;
|
|
11009
11416
|
var _useProductConfig = useProductConfig(updatedWarningType, !isDialogOpen),
|
|
11010
11417
|
aviationConfig = _useProductConfig.data;
|
|
11011
|
-
var selectedSigmetProduct = selectedSigmet && aviationConfig ? transformSigmetToProductFormat(selectedSigmet
|
|
11012
|
-
var selectedAirmetProduct = selectedAirmet && aviationConfig ? transformAirmetToProductFormat(selectedAirmet
|
|
11013
|
-
var selectedAviationProduct =
|
|
11418
|
+
var selectedSigmetProduct = selectedSigmet && aviationConfig ? transformSigmetToProductFormat(selectedSigmet) : getEmptySigmetWarning();
|
|
11419
|
+
var selectedAirmetProduct = selectedAirmet && aviationConfig ? transformAirmetToProductFormat(selectedAirmet) : getEmptyAirmetWarning();
|
|
11420
|
+
var selectedAviationProduct = React__default.useMemo(function () {
|
|
11421
|
+
if (selectedWarningObject && selectedWarningObject.sigmetAirmetDetail && aviationConfig) {
|
|
11422
|
+
return flattenPublicWarning(selectedWarningObject);
|
|
11423
|
+
}
|
|
11424
|
+
if (updatedWarningType === 'sigmet') {
|
|
11425
|
+
return selectedSigmetProduct;
|
|
11426
|
+
}
|
|
11427
|
+
if (updatedWarningType === 'airmet') {
|
|
11428
|
+
return selectedAirmetProduct;
|
|
11429
|
+
}
|
|
11430
|
+
return undefined;
|
|
11431
|
+
}, [selectedWarningObject, updatedWarningType, selectedSigmetProduct, selectedAirmetProduct, aviationConfig]);
|
|
11014
11432
|
var productCanBe = updatedWarningType === 'public' ? ['DRAFTED', 'DISCARDED', 'PUBLISHED'] : (selectedSigmet == null ? void 0 : selectedSigmet.canbe) || (selectedAirmet == null ? void 0 : selectedAirmet.canbe);
|
|
11015
11433
|
var mode = getProductFormMode(productCanBe, !selectedWarningId ? null : selectedAviationProduct);
|
|
11016
11434
|
// Readonly also in case you are not creating a new warning and you are not set as the editor
|
|
11017
|
-
var isReadOnly = formAction === 'readonly' || !isEditor &&
|
|
11435
|
+
var isReadOnly = formAction === 'readonly' || !isEditor && status !== undefined;
|
|
11018
11436
|
// Only show toggle if in draft status
|
|
11019
|
-
var shouldHideFormToggleMode =
|
|
11437
|
+
var shouldHideFormToggleMode = status !== 'DRAFT' && status !== 'DRAFT_PUBLISHED';
|
|
11020
11438
|
return jsxs(Fragment, {
|
|
11021
11439
|
children: [jsx(PublicWarningsFormDialog, {
|
|
11022
11440
|
isOpen: isDialogOpen,
|
|
@@ -11030,14 +11448,18 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
11030
11448
|
isReadOnly: isReadOnly,
|
|
11031
11449
|
onChangeFormMode: onChangeFormMode,
|
|
11032
11450
|
shouldHideFormMode: shouldHideFormToggleMode,
|
|
11033
|
-
publicWarningEditor:
|
|
11451
|
+
publicWarningEditor: (selectedWarning == null ? void 0 : selectedWarning.editor) || undefined,
|
|
11034
11452
|
selectedAviationProduct: selectedAviationProduct,
|
|
11035
11453
|
warningType: updatedWarningType,
|
|
11036
11454
|
children: jsx(PublicWarningsFormConnect, {
|
|
11455
|
+
editor: (selectedWarning == null ? void 0 : selectedWarning.editor) || undefined,
|
|
11037
11456
|
defaultMapPreset: defaultMapPreset,
|
|
11038
11457
|
selectedAviationProduct: selectedAviationProduct,
|
|
11039
11458
|
warningType: updatedWarningType,
|
|
11040
|
-
mode: mode
|
|
11459
|
+
mode: mode,
|
|
11460
|
+
onFormSubmit: function onFormSubmit() {
|
|
11461
|
+
return refetchWarnings();
|
|
11462
|
+
}
|
|
11041
11463
|
})
|
|
11042
11464
|
}), jsx(AreaObjectLoaderConnect, {})]
|
|
11043
11465
|
});
|
|
@@ -11081,6 +11503,7 @@ var getSortedStatus = function getSortedStatus(status) {
|
|
|
11081
11503
|
}
|
|
11082
11504
|
};
|
|
11083
11505
|
var getWarningWithoutIdStatusEditor = function getWarningWithoutIdStatusEditor(warning) {
|
|
11506
|
+
var _warningDetail$areas;
|
|
11084
11507
|
warning.id;
|
|
11085
11508
|
var warningDetail = warning.warningDetail;
|
|
11086
11509
|
warning.status;
|
|
@@ -11091,7 +11514,7 @@ var getWarningWithoutIdStatusEditor = function getWarningWithoutIdStatusEditor(w
|
|
|
11091
11514
|
warningDetail.proposal_id;
|
|
11092
11515
|
warningDetail.warning_handle_uuid;
|
|
11093
11516
|
var cleanWarningDetail = _objectWithoutPropertiesLoose(warningDetail, _excluded2);
|
|
11094
|
-
var areas = warningDetail.areas.map(function (_ref) {
|
|
11517
|
+
var areas = (_warningDetail$areas = warningDetail.areas) == null ? void 0 : _warningDetail$areas.map(function (_ref) {
|
|
11095
11518
|
_ref.published_warning_uuid;
|
|
11096
11519
|
var area = _objectWithoutPropertiesLoose(_ref, _excluded3);
|
|
11097
11520
|
return area;
|
|
@@ -11205,7 +11628,6 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
|
|
|
11205
11628
|
})
|
|
11206
11629
|
})
|
|
11207
11630
|
}), jsxs(Menu, {
|
|
11208
|
-
title: t("filter-" + id),
|
|
11209
11631
|
open: Boolean(anchorEl),
|
|
11210
11632
|
onClose: function onClose() {
|
|
11211
11633
|
return setAnchorEl(null);
|
|
@@ -11279,17 +11701,12 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
|
|
|
11279
11701
|
return updateFilter(id, emptyFilterId, checked, only);
|
|
11280
11702
|
},
|
|
11281
11703
|
labelStyle: {
|
|
11282
|
-
|
|
11283
|
-
fontSize: '16px',
|
|
11284
|
-
display: 'flex',
|
|
11285
|
-
alignItems: 'center',
|
|
11286
|
-
gap: 1
|
|
11704
|
+
fontSize: '16px'
|
|
11287
11705
|
},
|
|
11288
11706
|
label: jsx(Fragment, {
|
|
11289
11707
|
children: t(getTranslationKey(emptyFilterId, id))
|
|
11290
11708
|
})
|
|
11291
|
-
}, id + "-" + emptyFilterId), Object.keys(options).map(function (
|
|
11292
|
-
var optionId = _optionId;
|
|
11709
|
+
}, id + "-" + emptyFilterId), Object.keys(options).map(function (optionId) {
|
|
11293
11710
|
if (optionId === emptyFilterId) {
|
|
11294
11711
|
return null;
|
|
11295
11712
|
}
|
|
@@ -11301,14 +11718,29 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
|
|
|
11301
11718
|
return updateFilter(id, optionId, checked, only);
|
|
11302
11719
|
},
|
|
11303
11720
|
labelStyle: Object.assign({}, getLevelStyle(warningColor), {
|
|
11304
|
-
width: 'fit-content',
|
|
11305
|
-
fontSize: '16px'
|
|
11306
|
-
display: 'flex',
|
|
11307
|
-
alignItems: 'center',
|
|
11308
|
-
gap: 1
|
|
11721
|
+
width: LevelColors[optionId] ? 'fit-content' : '100%',
|
|
11722
|
+
fontSize: '16px'
|
|
11309
11723
|
}),
|
|
11310
|
-
label:
|
|
11311
|
-
|
|
11724
|
+
label: jsx(CustomTooltip, {
|
|
11725
|
+
title: t(getTranslationKey(optionId, id)),
|
|
11726
|
+
placement: "bottom",
|
|
11727
|
+
children: jsxs(Box, {
|
|
11728
|
+
"data-testid": "wrapper-" + optionId,
|
|
11729
|
+
sx: {
|
|
11730
|
+
display: 'flex',
|
|
11731
|
+
alignItems: 'center',
|
|
11732
|
+
gap: 1,
|
|
11733
|
+
maxWidth: 200
|
|
11734
|
+
},
|
|
11735
|
+
children: [getPhenomenaIcon(optionId), jsx(Typography, {
|
|
11736
|
+
noWrap: true,
|
|
11737
|
+
variant: "body2",
|
|
11738
|
+
sx: {
|
|
11739
|
+
fontSize: '16px'
|
|
11740
|
+
},
|
|
11741
|
+
children: t(getTranslationKey(optionId, id))
|
|
11742
|
+
})]
|
|
11743
|
+
})
|
|
11312
11744
|
})
|
|
11313
11745
|
}, id + "-" + optionId);
|
|
11314
11746
|
})]
|
|
@@ -11465,6 +11897,8 @@ var WarningListItemMenu = function WarningListItemMenu(_ref) {
|
|
|
11465
11897
|
onExpireWarning = _ref$onExpireWarning === void 0 ? function () {} : _ref$onExpireWarning,
|
|
11466
11898
|
_ref$onWithdrawWarnin = _ref.onWithdrawWarning,
|
|
11467
11899
|
onWithdrawWarning = _ref$onWithdrawWarnin === void 0 ? function () {} : _ref$onWithdrawWarnin,
|
|
11900
|
+
_ref$onRenewWarning = _ref.onRenewWarning,
|
|
11901
|
+
onRenewWarning = _ref$onRenewWarning === void 0 ? function () {} : _ref$onRenewWarning,
|
|
11468
11902
|
t = _ref.t;
|
|
11469
11903
|
var duplicate = {
|
|
11470
11904
|
text: t('warning-list-button-duplicate'),
|
|
@@ -11531,11 +11965,42 @@ var WarningListItemMenu = function WarningListItemMenu(_ref) {
|
|
|
11531
11965
|
icon: jsx(Delete, {})
|
|
11532
11966
|
}];
|
|
11533
11967
|
default:
|
|
11534
|
-
|
|
11968
|
+
switch (warning.productStatus) {
|
|
11969
|
+
case ProductStatus.PUBLISHED:
|
|
11970
|
+
if (warning.sigmetAirmetDetail && (isInstanceOfCancelSigmet(warning.sigmetAirmetDetail) || isInstanceOfCancelAirmet(warning.sigmetAirmetDetail))) {
|
|
11971
|
+
return [];
|
|
11972
|
+
}
|
|
11973
|
+
return [{
|
|
11974
|
+
text: t('warning-list-button-renew'),
|
|
11975
|
+
action: function action() {
|
|
11976
|
+
if (warning) {
|
|
11977
|
+
onRenewWarning(warning);
|
|
11978
|
+
}
|
|
11979
|
+
},
|
|
11980
|
+
icon: jsx(Update, {})
|
|
11981
|
+
}];
|
|
11982
|
+
case ProductStatus.CANCELLED:
|
|
11983
|
+
return [];
|
|
11984
|
+
case ProductStatus.EXPIRED:
|
|
11985
|
+
if (warning.sigmetAirmetDetail && (isInstanceOfCancelSigmet(warning.sigmetAirmetDetail) || isInstanceOfCancelAirmet(warning.sigmetAirmetDetail))) {
|
|
11986
|
+
return [];
|
|
11987
|
+
}
|
|
11988
|
+
return [{
|
|
11989
|
+
text: t('warning-list-button-renew'),
|
|
11990
|
+
action: function action() {
|
|
11991
|
+
if (warning) {
|
|
11992
|
+
onRenewWarning(warning);
|
|
11993
|
+
}
|
|
11994
|
+
},
|
|
11995
|
+
icon: jsx(Update, {})
|
|
11996
|
+
}];
|
|
11997
|
+
default:
|
|
11998
|
+
return [];
|
|
11999
|
+
}
|
|
11535
12000
|
}
|
|
11536
12001
|
};
|
|
11537
12002
|
|
|
11538
|
-
var _excluded$2 = ["warning", "activeWarningId", "highlightedItem", "onSelectWarning", "onEditWarning", "onDeleteWarning", "onDeleteReviewWarning", "onExpireWarning", "onWithdrawWarning"];
|
|
12003
|
+
var _excluded$2 = ["warning", "activeWarningId", "highlightedItem", "onSelectWarning", "onEditWarning", "onDeleteWarning", "onDeleteReviewWarning", "onExpireWarning", "onWithdrawWarning", "onRenewWarning"];
|
|
11539
12004
|
var renderLevelText = function renderLevelText(levelString) {
|
|
11540
12005
|
if (!levelString) {
|
|
11541
12006
|
return null;
|
|
@@ -11572,10 +12037,10 @@ var renderStatusIcon = function renderStatusIcon(warning, status) {
|
|
|
11572
12037
|
icon: icon
|
|
11573
12038
|
});
|
|
11574
12039
|
};
|
|
11575
|
-
if (warning.productStatus === ProductStatus.PUBLISHED && warning.
|
|
11576
|
-
return getStatusTag("Cnls " + warning.
|
|
12040
|
+
if (warning.productStatus === ProductStatus.PUBLISHED && warning.sigmetAirmetDetail && (isCancelAirmet(warning.sigmetAirmetDetail) || isCancelSigmet(warning.sigmetAirmetDetail))) {
|
|
12041
|
+
return getStatusTag("Cnls " + (isCancelAirmet(warning.sigmetAirmetDetail) ? warning.sigmetAirmetDetail.cancelsAirmetSequenceId : warning.sigmetAirmetDetail.cancelsSigmetSequenceId), 'red');
|
|
11577
12042
|
}
|
|
11578
|
-
if (warning.productStatus === ProductStatus.CANCELLED && warning.
|
|
12043
|
+
if (warning.productStatus === ProductStatus.CANCELLED && warning.sigmetAirmetDetail) {
|
|
11579
12044
|
return getStatusTag('Cnld', 'red');
|
|
11580
12045
|
}
|
|
11581
12046
|
switch (status) {
|
|
@@ -11614,7 +12079,7 @@ var renderStatusIcon = function renderStatusIcon(warning, status) {
|
|
|
11614
12079
|
}
|
|
11615
12080
|
};
|
|
11616
12081
|
var WarningListItem = function WarningListItem(_ref) {
|
|
11617
|
-
var _warning$warningDetai, _sx, _sx2, _Object$assign;
|
|
12082
|
+
var _warning$warningDetai, _warning$sigmetAirmet, _sx, _sx2, _Object$assign;
|
|
11618
12083
|
var warning = _ref.warning,
|
|
11619
12084
|
activeWarningId = _ref.activeWarningId,
|
|
11620
12085
|
highlightedItem = _ref.highlightedItem,
|
|
@@ -11630,12 +12095,14 @@ var WarningListItem = function WarningListItem(_ref) {
|
|
|
11630
12095
|
onExpireWarning = _ref$onExpireWarning === void 0 ? function () {} : _ref$onExpireWarning,
|
|
11631
12096
|
_ref$onWithdrawWarnin = _ref.onWithdrawWarning,
|
|
11632
12097
|
onWithdrawWarning = _ref$onWithdrawWarnin === void 0 ? function () {} : _ref$onWithdrawWarnin,
|
|
12098
|
+
_ref$onRenewWarning = _ref.onRenewWarning,
|
|
12099
|
+
onRenewWarning = _ref$onRenewWarning === void 0 ? function () {} : _ref$onRenewWarning,
|
|
11633
12100
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
11634
12101
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
11635
12102
|
t = _useWarningsTranslati.t;
|
|
11636
12103
|
var phenomenonDetails = allPhenomenaDict[warning.warningDetail.phenomenon];
|
|
11637
12104
|
var objectNameText = ((_warning$warningDetai = warning.warningDetail.areas) == null || (_warning$warningDetai = _warning$warningDetai[0]) == null ? void 0 : _warning$warningDetai.objectName) || '-';
|
|
11638
|
-
var objectHoverText = warning.
|
|
12105
|
+
var objectHoverText = (_warning$sigmetAirmet = warning.sigmetAirmetDetail) != null && _warning$sigmetAirmet.firName ? warning.sigmetAirmetDetail.firName : objectNameText;
|
|
11639
12106
|
var _useOverflowCheck = useOverflowCheck(objectNameText),
|
|
11640
12107
|
objectNameRef = _useOverflowCheck.ref;
|
|
11641
12108
|
var phenomenonText = phenomenonDetails != null && phenomenonDetails.translationKey ? t(phenomenonDetails.translationKey) : '-';
|
|
@@ -11683,7 +12150,8 @@ var WarningListItem = function WarningListItem(_ref) {
|
|
|
11683
12150
|
onDeleteReviewWarning: onDeleteReviewWarning,
|
|
11684
12151
|
onDeleteWarning: onDeleteWarning,
|
|
11685
12152
|
onExpireWarning: onExpireWarning,
|
|
11686
|
-
onWithdrawWarning: onWithdrawWarning
|
|
12153
|
+
onWithdrawWarning: onWithdrawWarning,
|
|
12154
|
+
onRenewWarning: onRenewWarning
|
|
11687
12155
|
}),
|
|
11688
12156
|
buttonIcon: jsx(Options, {})
|
|
11689
12157
|
}),
|
|
@@ -12065,8 +12533,8 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
12065
12533
|
_ref$isLoading = _ref.isLoading,
|
|
12066
12534
|
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
12067
12535
|
error = _ref.error,
|
|
12068
|
-
_ref$
|
|
12069
|
-
|
|
12536
|
+
_ref$selectedWarningI = _ref.selectedWarningId,
|
|
12537
|
+
selectedWarningId = _ref$selectedWarningI === void 0 ? '' : _ref$selectedWarningI,
|
|
12070
12538
|
lastUpdatedTime = _ref.lastUpdatedTime,
|
|
12071
12539
|
_ref$onSelectWarning = _ref.onSelectWarning,
|
|
12072
12540
|
onSelectWarning = _ref$onSelectWarning === void 0 ? function () {} : _ref$onSelectWarning,
|
|
@@ -12084,11 +12552,14 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
12084
12552
|
onExpireWarning = _ref$onExpireWarning === void 0 ? function () {} : _ref$onExpireWarning,
|
|
12085
12553
|
_ref$onWithdrawWarnin = _ref.onWithdrawWarning,
|
|
12086
12554
|
onWithdrawWarning = _ref$onWithdrawWarnin === void 0 ? function () {} : _ref$onWithdrawWarnin,
|
|
12555
|
+
_ref$onRenewWarning = _ref.onRenewWarning,
|
|
12556
|
+
onRenewWarning = _ref$onRenewWarning === void 0 ? function () {} : _ref$onRenewWarning,
|
|
12087
12557
|
hoveredFeatureId = _ref.hoveredFeatureId,
|
|
12088
12558
|
expandedSections = _ref.expandedSections,
|
|
12089
12559
|
setExpandedSections = _ref.setExpandedSections;
|
|
12090
12560
|
var updateFilter = filterHookState.updateFilter,
|
|
12091
|
-
allSelected = filterHookState.allSelected
|
|
12561
|
+
allSelected = filterHookState.allSelected,
|
|
12562
|
+
filterState = filterHookState.filterState;
|
|
12092
12563
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
12093
12564
|
t = _useWarningsTranslati.t;
|
|
12094
12565
|
var _React$useState = React__default.useState({
|
|
@@ -12220,7 +12691,7 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
12220
12691
|
children: jsx(FilterList, {
|
|
12221
12692
|
isAllSelected: allSelected,
|
|
12222
12693
|
onClickAll: onClickAll,
|
|
12223
|
-
filterState:
|
|
12694
|
+
filterState: filterState,
|
|
12224
12695
|
updateFilter: updateFilter
|
|
12225
12696
|
})
|
|
12226
12697
|
}), jsxs(Grid2, {
|
|
@@ -12370,9 +12841,10 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
12370
12841
|
onEditWarning: onEditWarning,
|
|
12371
12842
|
onDeleteWarning: onDeleteWarning,
|
|
12372
12843
|
onDeleteReviewWarning: onDeleteReviewWarning,
|
|
12373
|
-
activeWarningId:
|
|
12844
|
+
activeWarningId: selectedWarningId,
|
|
12374
12845
|
onExpireWarning: onExpireWarning,
|
|
12375
|
-
onWithdrawWarning: onWithdrawWarning
|
|
12846
|
+
onWithdrawWarning: onWithdrawWarning,
|
|
12847
|
+
onRenewWarning: onRenewWarning
|
|
12376
12848
|
}, key);
|
|
12377
12849
|
}
|
|
12378
12850
|
});
|
|
@@ -12383,6 +12855,51 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
12383
12855
|
});
|
|
12384
12856
|
};
|
|
12385
12857
|
|
|
12858
|
+
/* *
|
|
12859
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12860
|
+
* you may not use this file except in compliance with the License.
|
|
12861
|
+
* You may obtain a copy of the License at
|
|
12862
|
+
*
|
|
12863
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
12864
|
+
*
|
|
12865
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12866
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12867
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12868
|
+
* See the License for the specific language governing permissions and
|
|
12869
|
+
* limitations under the License.
|
|
12870
|
+
*
|
|
12871
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
12872
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
12873
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
12874
|
+
* */
|
|
12875
|
+
var publicWarningsAdapter = createEntityAdapter({
|
|
12876
|
+
selectId: function selectId(warning) {
|
|
12877
|
+
return warning.id;
|
|
12878
|
+
}
|
|
12879
|
+
});
|
|
12880
|
+
var initialState = {
|
|
12881
|
+
warnings: publicWarningsAdapter.getInitialState(),
|
|
12882
|
+
isLoading: true,
|
|
12883
|
+
lastUpdatedTime: '',
|
|
12884
|
+
filterState: {}
|
|
12885
|
+
};
|
|
12886
|
+
var slice = createSlice({
|
|
12887
|
+
initialState: initialState,
|
|
12888
|
+
name: 'publicWarnings',
|
|
12889
|
+
reducers: {
|
|
12890
|
+
setWarningFilters: function setWarningFilters(draft, action) {
|
|
12891
|
+
var _action$payload = action.payload,
|
|
12892
|
+
filterState = _action$payload.filterState,
|
|
12893
|
+
panelId = _action$payload.panelId;
|
|
12894
|
+
if (panelId) {
|
|
12895
|
+
draft.filterState[panelId] = filterState;
|
|
12896
|
+
}
|
|
12897
|
+
}
|
|
12898
|
+
}
|
|
12899
|
+
});
|
|
12900
|
+
var reducer = slice.reducer;
|
|
12901
|
+
var publicWarningActions = slice.actions;
|
|
12902
|
+
|
|
12386
12903
|
/* *
|
|
12387
12904
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
12388
12905
|
* you may not use this file except in compliance with the License.
|
|
@@ -12555,6 +13072,11 @@ var getLevelsForDomainFilter = function getLevelsForDomainFilter(domainFilter) {
|
|
|
12555
13072
|
return domainFilter[domain] ? domainLevels[domain] : [];
|
|
12556
13073
|
});
|
|
12557
13074
|
};
|
|
13075
|
+
var getPhenomenaForDomainFilter = function getPhenomenaForDomainFilter(domainFilter) {
|
|
13076
|
+
return Object.keys(domainFilter).flatMap(function (domain) {
|
|
13077
|
+
return domainFilter[domain] ? domainPhenomena[domain] : [];
|
|
13078
|
+
});
|
|
13079
|
+
};
|
|
12558
13080
|
var getFilterOptions = function getFilterOptions(defaultFilter, allOptions, savedFilter) {
|
|
12559
13081
|
var pickedFilterOptions = pick(defaultFilter, [emptyFilterId].concat(allOptions));
|
|
12560
13082
|
// keep options state from savedFilter if it still exists
|
|
@@ -12577,20 +13099,18 @@ var useWarningFilters = function useWarningFilters(warnings, onUpdateFilters, sa
|
|
|
12577
13099
|
updatedPickedLevels = _getFilterOptions[0],
|
|
12578
13100
|
allLevelsSelected = _getFilterOptions[1];
|
|
12579
13101
|
// phenomenon
|
|
13102
|
+
var domainPhenomena = useMemo(function () {
|
|
13103
|
+
return getPhenomenaForDomainFilter(pickedDomainFilter);
|
|
13104
|
+
}, [pickedDomainFilter]);
|
|
12580
13105
|
var warningsPhenomena = useMemo(function () {
|
|
12581
13106
|
return getFiltersFromWarnings(warnings, 'phenomenon');
|
|
12582
13107
|
}, [warnings]);
|
|
12583
|
-
|
|
12584
|
-
|
|
12585
|
-
|
|
12586
|
-
|
|
12587
|
-
});
|
|
13108
|
+
var relevantPhenomena = useMemo(function () {
|
|
13109
|
+
return domainPhenomena.filter(function (phenomenon) {
|
|
13110
|
+
return warningsPhenomena.includes(phenomenon);
|
|
13111
|
+
});
|
|
13112
|
+
}, [warningsPhenomena, domainPhenomena]);
|
|
12588
13113
|
relevantPhenomena.push(emptyFilterId);
|
|
12589
|
-
var defaultPhenomenonFilter = useMemo(function () {
|
|
12590
|
-
return Object.fromEntries(relevantPhenomena.map(function (key) {
|
|
12591
|
-
return [key, true];
|
|
12592
|
-
}));
|
|
12593
|
-
}, [relevantPhenomena]);
|
|
12594
13114
|
var _getFilterOptions2 = getFilterOptions(defaultPhenomenonFilter, relevantPhenomena, pickedPhenomenonFilter),
|
|
12595
13115
|
updatedPickedPhenomena = _getFilterOptions2[0],
|
|
12596
13116
|
allPhenomenaSelected = _getFilterOptions2[1];
|
|
@@ -12621,7 +13141,14 @@ var useWarningFilters = function useWarningFilters(warnings, onUpdateFilters, sa
|
|
|
12621
13141
|
useEffect(function () {
|
|
12622
13142
|
// when the preset changes, update the filters
|
|
12623
13143
|
if (presetFilterState) {
|
|
12624
|
-
|
|
13144
|
+
var initialFiltersWithPresets = {
|
|
13145
|
+
incident: Object.assign({}, makeFilterFromList(relevantIncidents), presetFilterState.incident),
|
|
13146
|
+
source: Object.assign({}, makeFilterFromList(relevantSources), presetFilterState.source),
|
|
13147
|
+
domain: Object.assign({}, initialFilters.domain, presetFilterState.domain),
|
|
13148
|
+
phenomenon: Object.assign({}, initialFilters.phenomenon, presetFilterState.phenomenon),
|
|
13149
|
+
level: Object.assign({}, initialFilters.level, presetFilterState.level)
|
|
13150
|
+
};
|
|
13151
|
+
onUpdateFilters(initialFiltersWithPresets, 'system');
|
|
12625
13152
|
} else {
|
|
12626
13153
|
// for a preset without filters saved use the initial filters
|
|
12627
13154
|
onUpdateFilters(Object.assign({}, initialFilters, {
|
|
@@ -12688,7 +13215,7 @@ var useWarningFilters = function useWarningFilters(warnings, onUpdateFilters, sa
|
|
|
12688
13215
|
if (!pickedLevelFilter[level]) {
|
|
12689
13216
|
return false;
|
|
12690
13217
|
}
|
|
12691
|
-
var phenomenon = getValue(
|
|
13218
|
+
var phenomenon = getValue(AllPhenomenaKeys, warning.warningDetail.phenomenon);
|
|
12692
13219
|
if (!pickedPhenomenonFilter[phenomenon]) {
|
|
12693
13220
|
return false;
|
|
12694
13221
|
}
|
|
@@ -12723,35 +13250,31 @@ var useWarningFilters = function useWarningFilters(warnings, onUpdateFilters, sa
|
|
|
12723
13250
|
var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
12724
13251
|
var panelId = _ref.panelId,
|
|
12725
13252
|
presetFilterState = _ref.presetFilterState;
|
|
13253
|
+
var updatePublicWarningEditor = useMutatePublicWarningEditor();
|
|
12726
13254
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
12727
13255
|
t = _useWarningsTranslati.t;
|
|
12728
13256
|
var dispatch = useDispatch();
|
|
12729
13257
|
var confirmDialog = useConfirmationDialog();
|
|
12730
13258
|
var _useAuthenticationCon = useAuthenticationContext$1(),
|
|
12731
13259
|
auth = _useAuthenticationCon.auth;
|
|
12732
|
-
var
|
|
12733
|
-
|
|
12734
|
-
|
|
12735
|
-
|
|
12736
|
-
|
|
12737
|
-
|
|
12738
|
-
|
|
12739
|
-
isFetchingSigmet = _useSigmetList.isFetching;
|
|
13260
|
+
var _useWarnings = useWarnings(),
|
|
13261
|
+
combinedWarnings = _useWarnings.combinedWarnings,
|
|
13262
|
+
refetchWarnings = _useWarnings.refetchWarnings,
|
|
13263
|
+
isFetching = _useWarnings.isFetching,
|
|
13264
|
+
error = _useWarnings.error,
|
|
13265
|
+
dataUpdatedAt = _useWarnings.dataUpdatedAt;
|
|
13266
|
+
var lastUpdateTime = dateUtils.dateToString(new Date(dataUpdatedAt), dateUtils.DATE_FORMAT_HOURS);
|
|
12740
13267
|
var _React$useState = React__default.useState(undefined),
|
|
12741
13268
|
confirmDialogOptions = _React$useState[0],
|
|
12742
13269
|
setConfirmDialogOptions = _React$useState[1];
|
|
12743
|
-
var
|
|
12744
|
-
var selectedPublicWarningId = useSelector(getSelectedPublicWarningId);
|
|
12745
|
-
var isLoading = useSelector(isPublicWarningsLoading) || isFetchingAirmet || isFetchingSigmet;
|
|
12746
|
-
var error = useSelector(getPublicWarningsError);
|
|
12747
|
-
var isFormDirty = useSelector(getSelectedPublicIsFormDirty);
|
|
12748
|
-
var lastUpdatedTime = useSelector(getPublicWarningsLastUpdatedTime);
|
|
13270
|
+
var selectedWarningId = useSelector(getSelectedWarningId);
|
|
12749
13271
|
var savedFilterState = useSelector(function (store) {
|
|
12750
13272
|
return getWarningsFilterById(store, panelId);
|
|
12751
13273
|
});
|
|
13274
|
+
var isFormDirty = useSelector(getSelectedPublicIsFormDirty);
|
|
12752
13275
|
var warningsApi = getWarningsApi();
|
|
12753
13276
|
var openPublicWarningDialog = /*#__PURE__*/function () {
|
|
12754
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(formAction,
|
|
13277
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(formAction, warning, warningType) {
|
|
12755
13278
|
var mayProceed;
|
|
12756
13279
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
12757
13280
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -12774,8 +13297,8 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
12774
13297
|
}
|
|
12775
13298
|
return _context.abrupt("return");
|
|
12776
13299
|
case 6:
|
|
12777
|
-
dispatch(publicWarningFormActions.openPublicWarningFormDialog(Object.assign({},
|
|
12778
|
-
|
|
13300
|
+
dispatch(publicWarningFormActions.openPublicWarningFormDialog(Object.assign({}, warning && {
|
|
13301
|
+
warning: warning
|
|
12779
13302
|
}, {
|
|
12780
13303
|
formState: formAction,
|
|
12781
13304
|
warningType: warningType,
|
|
@@ -12803,24 +13326,24 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
12803
13326
|
while (1) switch (_context2.prev = _context2.next) {
|
|
12804
13327
|
case 0:
|
|
12805
13328
|
if (!(publicWarning.id && auth != null && auth.username && !publicWarning.editor)) {
|
|
12806
|
-
_context2.next =
|
|
13329
|
+
_context2.next = 7;
|
|
12807
13330
|
break;
|
|
12808
13331
|
}
|
|
12809
|
-
|
|
12810
|
-
|
|
12811
|
-
|
|
12812
|
-
|
|
12813
|
-
})
|
|
12814
|
-
_context2.next =
|
|
13332
|
+
refetchWarnings();
|
|
13333
|
+
updatePublicWarningEditor.mutate({
|
|
13334
|
+
id: publicWarning.id,
|
|
13335
|
+
isEditor: true
|
|
13336
|
+
});
|
|
13337
|
+
_context2.next = 5;
|
|
12815
13338
|
return openPublicWarningDialog('', Object.assign({}, publicWarning, {
|
|
12816
13339
|
editor: auth == null ? void 0 : auth.username
|
|
12817
13340
|
}));
|
|
12818
|
-
case
|
|
12819
|
-
_context2.next =
|
|
13341
|
+
case 5:
|
|
13342
|
+
_context2.next = 8;
|
|
12820
13343
|
break;
|
|
12821
|
-
case 6:
|
|
12822
|
-
void openPublicWarningDialog('', publicWarning);
|
|
12823
13344
|
case 7:
|
|
13345
|
+
void openPublicWarningDialog('', publicWarning);
|
|
13346
|
+
case 8:
|
|
12824
13347
|
case "end":
|
|
12825
13348
|
return _context2.stop();
|
|
12826
13349
|
}
|
|
@@ -12890,6 +13413,17 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
12890
13413
|
return _ref5.apply(this, arguments);
|
|
12891
13414
|
};
|
|
12892
13415
|
}();
|
|
13416
|
+
var warningType = useSelector(getWarningType);
|
|
13417
|
+
var _useProductConfig = useProductConfig(warningType, false),
|
|
13418
|
+
aviationConfig = _useProductConfig.data;
|
|
13419
|
+
var handleRenewProductClick = function handleRenewProductClick(warning, warningType) {
|
|
13420
|
+
if (!warning) {
|
|
13421
|
+
return;
|
|
13422
|
+
}
|
|
13423
|
+
var type = warningType || (warning.warningDetail.level === 'SIG' ? 'sigmet' : 'airmet');
|
|
13424
|
+
var renewedWarning = renewWarning(warning, aviationConfig);
|
|
13425
|
+
void openPublicWarningDialog('edit', renewedWarning, type);
|
|
13426
|
+
};
|
|
12893
13427
|
var openSnackbar = function openSnackbar(message) {
|
|
12894
13428
|
dispatch(snackbarActions.openSnackbar({
|
|
12895
13429
|
type: snackbarTypes.SnackbarMessageType.VERBATIM_MESSAGE,
|
|
@@ -12931,29 +13465,15 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
12931
13465
|
// close confirm dialog
|
|
12932
13466
|
setConfirmDialogOptions(undefined);
|
|
12933
13467
|
// Close warning dialog if needed
|
|
12934
|
-
if (
|
|
13468
|
+
if (selectedWarningId === warningId) {
|
|
12935
13469
|
dispatch(uiActions.setToggleOpenDialog({
|
|
12936
13470
|
setOpen: false,
|
|
12937
13471
|
type: publicWarningDialogType
|
|
12938
13472
|
}));
|
|
12939
13473
|
}
|
|
12940
13474
|
openSnackbar(snackbarMessage);
|
|
12941
|
-
|
|
13475
|
+
refetchWarnings();
|
|
12942
13476
|
};
|
|
12943
|
-
var fetchWarnings = React__default.useCallback(function () {
|
|
12944
|
-
void refetchAirmetList();
|
|
12945
|
-
void refetchSigmetList();
|
|
12946
|
-
dispatch(publicWarningActions.fetchWarnings());
|
|
12947
|
-
}, [dispatch, refetchAirmetList, refetchSigmetList]);
|
|
12948
|
-
React__default.useEffect(function () {
|
|
12949
|
-
// fetch warnings on mount
|
|
12950
|
-
fetchWarnings();
|
|
12951
|
-
}, [fetchWarnings]);
|
|
12952
|
-
var combinedWarnings = React__default.useMemo(function () {
|
|
12953
|
-
var transformedSigmets = (sigmetList == null ? void 0 : sigmetList.map(transformSigmetToWarningFormat)) || [];
|
|
12954
|
-
var transformedAirmets = (airmetList == null ? void 0 : airmetList.map(transformAirmetToWarningFormat)) || [];
|
|
12955
|
-
return publicWarnings.concat(transformedSigmets).concat(transformedAirmets);
|
|
12956
|
-
}, [publicWarnings, sigmetList, airmetList]);
|
|
12957
13477
|
var onUpdateFilters = React__default.useCallback(function (filterState, origin) {
|
|
12958
13478
|
dispatch(publicWarningActions.setWarningFilters({
|
|
12959
13479
|
filterState: filterState,
|
|
@@ -12980,8 +13500,7 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
12980
13500
|
}, [filteredWarnings, expandedSections]);
|
|
12981
13501
|
var allFeatures = React__default.useMemo(function () {
|
|
12982
13502
|
return filteredWarningsByExpandedSections.flatMap(function (warning) {
|
|
12983
|
-
|
|
12984
|
-
return (warning == null ? void 0 : warning.id) && (warning == null || (_warning$warningDetai = warning.warningDetail) == null || (_warning$warningDetai = _warning$warningDetai.areas) == null ? void 0 : _warning$warningDetai.filter(function (area) {
|
|
13503
|
+
return (warning == null ? void 0 : warning.id) && (warning != null && warning.warningDetail && 'areas' in warning.warningDetail ? warning.warningDetail.areas.filter(function (area) {
|
|
12985
13504
|
return area.geoJSON;
|
|
12986
13505
|
}).map(function (area) {
|
|
12987
13506
|
var isAviationWarning = warning.warningDetail.level === 'SIG' || warning.warningDetail.level === 'AIR';
|
|
@@ -12991,7 +13510,7 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
12991
13510
|
originalId: warning.id,
|
|
12992
13511
|
geoJSON: styledGeoJSON
|
|
12993
13512
|
};
|
|
12994
|
-
})) || [];
|
|
13513
|
+
}) : []) || [];
|
|
12995
13514
|
}).filter(function (feature) {
|
|
12996
13515
|
return feature.id;
|
|
12997
13516
|
});
|
|
@@ -13005,8 +13524,8 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
13005
13524
|
warnings: filteredWarnings,
|
|
13006
13525
|
expandedSections: expandedSections,
|
|
13007
13526
|
setExpandedSections: setExpandedSections,
|
|
13008
|
-
isLoading:
|
|
13009
|
-
error: error,
|
|
13527
|
+
isLoading: isFetching,
|
|
13528
|
+
error: error || undefined,
|
|
13010
13529
|
onSelectWarning: selectWarning,
|
|
13011
13530
|
onCreateWarning: createWarning,
|
|
13012
13531
|
onEditWarning: editWarning,
|
|
@@ -13014,11 +13533,12 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
13014
13533
|
onDeleteReviewWarning: deleteReviewWarning,
|
|
13015
13534
|
onExpireWarning: expireWarning,
|
|
13016
13535
|
onWithdrawWarning: withdrawWarning,
|
|
13017
|
-
|
|
13018
|
-
lastUpdatedTime:
|
|
13019
|
-
onRefetchWarnings:
|
|
13536
|
+
selectedWarningId: selectedWarningId,
|
|
13537
|
+
lastUpdatedTime: lastUpdateTime,
|
|
13538
|
+
onRefetchWarnings: refetchWarnings,
|
|
13020
13539
|
filterHookState: filterHookState,
|
|
13021
|
-
hoveredFeatureId: hoveredFeatureId
|
|
13540
|
+
hoveredFeatureId: hoveredFeatureId,
|
|
13541
|
+
onRenewWarning: handleRenewProductClick
|
|
13022
13542
|
}), confirmDialogOptions && jsx(ConfirmDeleteWarningDialog, {
|
|
13023
13543
|
onClose: function onClose() {
|
|
13024
13544
|
return setConfirmDialogOptions(undefined);
|
|
@@ -13089,48 +13609,49 @@ var componentsLookUp = function componentsLookUp(payload, apiProps) {
|
|
|
13089
13609
|
var getErrorMessage = function getErrorMessage(error) {
|
|
13090
13610
|
return isAxiosError(error) ? getAxiosErrorMessage(error) : error.message;
|
|
13091
13611
|
};
|
|
13092
|
-
var getToggleEditorSuccessMessage = function getToggleEditorSuccessMessage(isEditor) {
|
|
13093
|
-
return isEditor ? 'warning-editor-add-editor' : 'warning-editor-remove-editor';
|
|
13094
|
-
};
|
|
13095
13612
|
var publicWarningFormListener = createListenerMiddleware();
|
|
13096
13613
|
publicWarningFormListener.startListening({
|
|
13097
|
-
actionCreator: publicWarningFormActions.
|
|
13614
|
+
actionCreator: publicWarningFormActions.publishWarning,
|
|
13098
13615
|
effect: function () {
|
|
13099
13616
|
var _effect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref, listenerApi) {
|
|
13100
|
-
var payload,
|
|
13617
|
+
var payload, publicWarning, refetchWarnings, publishedWarning, isDialogOpen;
|
|
13101
13618
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
13102
13619
|
while (1) switch (_context.prev = _context.next) {
|
|
13103
13620
|
case 0:
|
|
13104
13621
|
payload = _ref.payload;
|
|
13105
13622
|
listenerApi.cancelActiveListeners();
|
|
13106
13623
|
_context.prev = 2;
|
|
13107
|
-
|
|
13108
|
-
|
|
13109
|
-
|
|
13110
|
-
|
|
13111
|
-
|
|
13112
|
-
|
|
13113
|
-
|
|
13114
|
-
|
|
13115
|
-
|
|
13116
|
-
|
|
13624
|
+
publicWarning = payload.publicWarning, refetchWarnings = payload.refetchWarnings;
|
|
13625
|
+
_context.next = 6;
|
|
13626
|
+
return saveOrUpdateWarning(publicWarning);
|
|
13627
|
+
case 6:
|
|
13628
|
+
publishedWarning = _context.sent;
|
|
13629
|
+
if (refetchWarnings) {
|
|
13630
|
+
refetchWarnings();
|
|
13631
|
+
}
|
|
13632
|
+
listenerApi.dispatch(publicWarningFormActions.publishWarningSuccess({
|
|
13633
|
+
publicWarning: publishedWarning,
|
|
13117
13634
|
message: {
|
|
13118
13635
|
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
13119
|
-
key:
|
|
13636
|
+
key: 'warning-publish-succes'
|
|
13120
13637
|
}
|
|
13121
13638
|
}));
|
|
13122
|
-
|
|
13639
|
+
listenerApi.dispatch(uiActions.setToggleOpenDialog({
|
|
13640
|
+
type: publicWarningDialogType,
|
|
13641
|
+
setOpen: false
|
|
13642
|
+
}));
|
|
13643
|
+
_context.next = 16;
|
|
13123
13644
|
break;
|
|
13124
|
-
case
|
|
13125
|
-
_context.prev =
|
|
13645
|
+
case 12:
|
|
13646
|
+
_context.prev = 12;
|
|
13126
13647
|
_context.t0 = _context["catch"](2);
|
|
13127
13648
|
isDialogOpen = uiSelectors.getisDialogOpen(listenerApi.getState(), publicWarningDialogType);
|
|
13128
13649
|
errorEffect(listenerApi.dispatch, getErrorMessage(_context.t0), isDialogOpen);
|
|
13129
|
-
case
|
|
13650
|
+
case 16:
|
|
13130
13651
|
case "end":
|
|
13131
13652
|
return _context.stop();
|
|
13132
13653
|
}
|
|
13133
|
-
}, _callee, null, [[2,
|
|
13654
|
+
}, _callee, null, [[2, 12]]);
|
|
13134
13655
|
}));
|
|
13135
13656
|
function effect(_x, _x2) {
|
|
13136
13657
|
return _effect.apply(this, arguments);
|
|
@@ -13139,32 +13660,31 @@ publicWarningFormListener.startListening({
|
|
|
13139
13660
|
}()
|
|
13140
13661
|
});
|
|
13141
13662
|
publicWarningFormListener.startListening({
|
|
13142
|
-
actionCreator: publicWarningFormActions.
|
|
13663
|
+
actionCreator: publicWarningFormActions.saveWarning,
|
|
13143
13664
|
effect: function () {
|
|
13144
13665
|
var _effect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2, listenerApi) {
|
|
13145
|
-
var payload, publicWarning,
|
|
13666
|
+
var payload, publicWarning, refetchWarnings, savedWarning, isDialogOpen;
|
|
13146
13667
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
13147
13668
|
while (1) switch (_context2.prev = _context2.next) {
|
|
13148
13669
|
case 0:
|
|
13149
13670
|
payload = _ref2.payload;
|
|
13150
13671
|
listenerApi.cancelActiveListeners();
|
|
13151
13672
|
_context2.prev = 2;
|
|
13152
|
-
publicWarning = payload.publicWarning;
|
|
13673
|
+
publicWarning = payload.publicWarning, refetchWarnings = payload.refetchWarnings;
|
|
13153
13674
|
_context2.next = 6;
|
|
13154
13675
|
return saveOrUpdateWarning(publicWarning);
|
|
13155
13676
|
case 6:
|
|
13156
|
-
|
|
13157
|
-
|
|
13158
|
-
|
|
13677
|
+
savedWarning = _context2.sent;
|
|
13678
|
+
if (refetchWarnings) {
|
|
13679
|
+
refetchWarnings();
|
|
13680
|
+
}
|
|
13681
|
+
listenerApi.dispatch(publicWarningFormActions.saveWarningSuccess({
|
|
13682
|
+
publicWarning: savedWarning,
|
|
13159
13683
|
message: {
|
|
13160
13684
|
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
13161
|
-
key: 'warning-
|
|
13685
|
+
key: 'warning-save-succes'
|
|
13162
13686
|
}
|
|
13163
13687
|
}));
|
|
13164
|
-
listenerApi.dispatch(uiActions.setToggleOpenDialog({
|
|
13165
|
-
type: publicWarningDialogType,
|
|
13166
|
-
setOpen: false
|
|
13167
|
-
}));
|
|
13168
13688
|
_context2.next = 15;
|
|
13169
13689
|
break;
|
|
13170
13690
|
case 11:
|
|
@@ -13184,41 +13704,26 @@ publicWarningFormListener.startListening({
|
|
|
13184
13704
|
return effect;
|
|
13185
13705
|
}()
|
|
13186
13706
|
});
|
|
13707
|
+
// Side effects/snackbar listeners
|
|
13187
13708
|
publicWarningFormListener.startListening({
|
|
13188
|
-
|
|
13709
|
+
matcher: isAnyOf(publicWarningFormActions.publishWarningSuccess, publicWarningFormActions.saveWarningSuccess),
|
|
13189
13710
|
effect: function () {
|
|
13190
13711
|
var _effect3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref3, listenerApi) {
|
|
13191
|
-
var payload,
|
|
13712
|
+
var payload, message, isDialogOpen;
|
|
13192
13713
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
13193
13714
|
while (1) switch (_context3.prev = _context3.next) {
|
|
13194
13715
|
case 0:
|
|
13195
13716
|
payload = _ref3.payload;
|
|
13196
13717
|
listenerApi.cancelActiveListeners();
|
|
13197
|
-
|
|
13198
|
-
|
|
13199
|
-
_context3.next = 6;
|
|
13200
|
-
return saveOrUpdateWarning(publicWarning);
|
|
13201
|
-
case 6:
|
|
13202
|
-
savedWarning = _context3.sent;
|
|
13203
|
-
listenerApi.dispatch(publicWarningFormActions.saveWarningSuccess({
|
|
13204
|
-
publicWarning: savedWarning,
|
|
13205
|
-
message: {
|
|
13206
|
-
type: snackbarTypes.SnackbarMessageType.TRANSLATABLE_MESSAGE,
|
|
13207
|
-
key: 'warning-save-succes'
|
|
13208
|
-
}
|
|
13209
|
-
}));
|
|
13210
|
-
_context3.next = 14;
|
|
13211
|
-
break;
|
|
13212
|
-
case 10:
|
|
13213
|
-
_context3.prev = 10;
|
|
13214
|
-
_context3.t0 = _context3["catch"](2);
|
|
13718
|
+
message = payload.message;
|
|
13719
|
+
listenerApi.dispatch(snackbarActions.openSnackbar(message));
|
|
13215
13720
|
isDialogOpen = uiSelectors.getisDialogOpen(listenerApi.getState(), publicWarningDialogType);
|
|
13216
|
-
|
|
13217
|
-
case
|
|
13721
|
+
toggleDialogLoadingEffect(listenerApi.dispatch, isDialogOpen, false);
|
|
13722
|
+
case 6:
|
|
13218
13723
|
case "end":
|
|
13219
13724
|
return _context3.stop();
|
|
13220
13725
|
}
|
|
13221
|
-
}, _callee3
|
|
13726
|
+
}, _callee3);
|
|
13222
13727
|
}));
|
|
13223
13728
|
function effect(_x5, _x6) {
|
|
13224
13729
|
return _effect3.apply(this, arguments);
|
|
@@ -13226,22 +13731,18 @@ publicWarningFormListener.startListening({
|
|
|
13226
13731
|
return effect;
|
|
13227
13732
|
}()
|
|
13228
13733
|
});
|
|
13229
|
-
// Side effects/snackbar listeners
|
|
13230
13734
|
publicWarningFormListener.startListening({
|
|
13231
|
-
matcher: isAnyOf(publicWarningFormActions.
|
|
13735
|
+
matcher: isAnyOf(publicWarningFormActions.publishWarning, publicWarningFormActions.saveWarning),
|
|
13232
13736
|
effect: function () {
|
|
13233
|
-
var _effect4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(
|
|
13234
|
-
var
|
|
13737
|
+
var _effect4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_, listenerApi) {
|
|
13738
|
+
var isDialogOpen;
|
|
13235
13739
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
13236
13740
|
while (1) switch (_context4.prev = _context4.next) {
|
|
13237
13741
|
case 0:
|
|
13238
|
-
payload = _ref4.payload;
|
|
13239
13742
|
listenerApi.cancelActiveListeners();
|
|
13240
|
-
message = payload.message;
|
|
13241
|
-
listenerApi.dispatch(snackbarActions.openSnackbar(message));
|
|
13242
13743
|
isDialogOpen = uiSelectors.getisDialogOpen(listenerApi.getState(), publicWarningDialogType);
|
|
13243
|
-
toggleDialogLoadingEffect(listenerApi.dispatch, isDialogOpen,
|
|
13244
|
-
case
|
|
13744
|
+
toggleDialogLoadingEffect(listenerApi.dispatch, isDialogOpen, true);
|
|
13745
|
+
case 3:
|
|
13245
13746
|
case "end":
|
|
13246
13747
|
return _context4.stop();
|
|
13247
13748
|
}
|
|
@@ -13253,38 +13754,15 @@ publicWarningFormListener.startListening({
|
|
|
13253
13754
|
return effect;
|
|
13254
13755
|
}()
|
|
13255
13756
|
});
|
|
13256
|
-
publicWarningFormListener.startListening({
|
|
13257
|
-
matcher: isAnyOf(publicWarningFormActions.publishWarning, publicWarningFormActions.saveWarning),
|
|
13258
|
-
effect: function () {
|
|
13259
|
-
var _effect5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_, listenerApi) {
|
|
13260
|
-
var isDialogOpen;
|
|
13261
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
13262
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
13263
|
-
case 0:
|
|
13264
|
-
listenerApi.cancelActiveListeners();
|
|
13265
|
-
isDialogOpen = uiSelectors.getisDialogOpen(listenerApi.getState(), publicWarningDialogType);
|
|
13266
|
-
toggleDialogLoadingEffect(listenerApi.dispatch, isDialogOpen, true);
|
|
13267
|
-
case 3:
|
|
13268
|
-
case "end":
|
|
13269
|
-
return _context5.stop();
|
|
13270
|
-
}
|
|
13271
|
-
}, _callee5);
|
|
13272
|
-
}));
|
|
13273
|
-
function effect(_x9, _x10) {
|
|
13274
|
-
return _effect5.apply(this, arguments);
|
|
13275
|
-
}
|
|
13276
|
-
return effect;
|
|
13277
|
-
}()
|
|
13278
|
-
});
|
|
13279
13757
|
publicWarningFormListener.startListening({
|
|
13280
13758
|
actionCreator: publicWarningFormActions.openPublicWarningFormDialog,
|
|
13281
13759
|
effect: function () {
|
|
13282
|
-
var
|
|
13760
|
+
var _effect5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref4, listenerApi) {
|
|
13283
13761
|
var payload, panelId;
|
|
13284
|
-
return _regeneratorRuntime().wrap(function
|
|
13285
|
-
while (1) switch (
|
|
13762
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
13763
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
13286
13764
|
case 0:
|
|
13287
|
-
payload =
|
|
13765
|
+
payload = _ref4.payload;
|
|
13288
13766
|
listenerApi.cancelActiveListeners();
|
|
13289
13767
|
panelId = payload.panelId;
|
|
13290
13768
|
listenerApi.dispatch(uiActions.setToggleOpenDialog({
|
|
@@ -13294,35 +13772,35 @@ publicWarningFormListener.startListening({
|
|
|
13294
13772
|
}));
|
|
13295
13773
|
case 4:
|
|
13296
13774
|
case "end":
|
|
13297
|
-
return
|
|
13775
|
+
return _context5.stop();
|
|
13298
13776
|
}
|
|
13299
|
-
},
|
|
13777
|
+
}, _callee5);
|
|
13300
13778
|
}));
|
|
13301
|
-
function effect(
|
|
13302
|
-
return
|
|
13779
|
+
function effect(_x9, _x10) {
|
|
13780
|
+
return _effect5.apply(this, arguments);
|
|
13303
13781
|
}
|
|
13304
13782
|
return effect;
|
|
13305
13783
|
}()
|
|
13306
13784
|
});
|
|
13307
13785
|
var saveOrUpdateWarning = /*#__PURE__*/function () {
|
|
13308
|
-
var
|
|
13786
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(publicWarning) {
|
|
13309
13787
|
var warningsApi, warningDetail, status, warning, newWarningId;
|
|
13310
|
-
return _regeneratorRuntime().wrap(function
|
|
13311
|
-
while (1) switch (
|
|
13788
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
13789
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
13312
13790
|
case 0:
|
|
13313
13791
|
warningsApi = getWarningsApi();
|
|
13314
13792
|
warningDetail = publicWarning.warningDetail, status = publicWarning.status;
|
|
13315
13793
|
if (!warningDetail.id) {
|
|
13316
|
-
|
|
13794
|
+
_context6.next = 6;
|
|
13317
13795
|
break;
|
|
13318
13796
|
}
|
|
13319
|
-
|
|
13797
|
+
_context6.next = 5;
|
|
13320
13798
|
return warningsApi.updateWarning(warningDetail.id, publicWarning);
|
|
13321
13799
|
case 5:
|
|
13322
|
-
return
|
|
13800
|
+
return _context6.abrupt("return", publicWarning);
|
|
13323
13801
|
case 6:
|
|
13324
13802
|
if (!(status === 'PUBLISHED' && warningDetail.linked_to_id)) {
|
|
13325
|
-
|
|
13803
|
+
_context6.next = 11;
|
|
13326
13804
|
break;
|
|
13327
13805
|
}
|
|
13328
13806
|
warning = Object.assign({}, publicWarning, {
|
|
@@ -13330,28 +13808,28 @@ var saveOrUpdateWarning = /*#__PURE__*/function () {
|
|
|
13330
13808
|
id: warningDetail.linked_to_id
|
|
13331
13809
|
})
|
|
13332
13810
|
});
|
|
13333
|
-
|
|
13811
|
+
_context6.next = 10;
|
|
13334
13812
|
return warningsApi.updateWarning(warningDetail.linked_to_id, warning);
|
|
13335
13813
|
case 10:
|
|
13336
|
-
return
|
|
13814
|
+
return _context6.abrupt("return", warning);
|
|
13337
13815
|
case 11:
|
|
13338
|
-
|
|
13816
|
+
_context6.next = 13;
|
|
13339
13817
|
return warningsApi.saveWarningAs(publicWarning);
|
|
13340
13818
|
case 13:
|
|
13341
|
-
newWarningId =
|
|
13342
|
-
return
|
|
13819
|
+
newWarningId = _context6.sent;
|
|
13820
|
+
return _context6.abrupt("return", Object.assign({}, publicWarning, {
|
|
13343
13821
|
warningDetail: Object.assign({}, warningDetail, {
|
|
13344
13822
|
id: newWarningId
|
|
13345
13823
|
})
|
|
13346
13824
|
}));
|
|
13347
13825
|
case 15:
|
|
13348
13826
|
case "end":
|
|
13349
|
-
return
|
|
13827
|
+
return _context6.stop();
|
|
13350
13828
|
}
|
|
13351
|
-
},
|
|
13829
|
+
}, _callee6);
|
|
13352
13830
|
}));
|
|
13353
|
-
return function saveOrUpdateWarning(
|
|
13354
|
-
return
|
|
13831
|
+
return function saveOrUpdateWarning(_x11) {
|
|
13832
|
+
return _ref5.apply(this, arguments);
|
|
13355
13833
|
};
|
|
13356
13834
|
}();
|
|
13357
13835
|
var toggleDialogLoadingEffect = function toggleDialogLoadingEffect(dispatch, isDialogOpen, isLoading) {
|
|
@@ -13371,12 +13849,12 @@ var errorEffect = function errorEffect(dispatch, message, isDialogOpen) {
|
|
|
13371
13849
|
publicWarningFormListener.startListening({
|
|
13372
13850
|
actionCreator: uiActions.setToggleOpenDialog,
|
|
13373
13851
|
effect: function () {
|
|
13374
|
-
var
|
|
13852
|
+
var _effect6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref6, listenerApi) {
|
|
13375
13853
|
var payload;
|
|
13376
|
-
return _regeneratorRuntime().wrap(function
|
|
13377
|
-
while (1) switch (
|
|
13854
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
13855
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
13378
13856
|
case 0:
|
|
13379
|
-
payload =
|
|
13857
|
+
payload = _ref6.payload;
|
|
13380
13858
|
if (!payload.setOpen && payload.type === publicWarningDialogType) {
|
|
13381
13859
|
listenerApi.dispatch(uiActions.setToggleOpenDialog({
|
|
13382
13860
|
setOpen: false,
|
|
@@ -13385,93 +13863,35 @@ publicWarningFormListener.startListening({
|
|
|
13385
13863
|
}
|
|
13386
13864
|
case 2:
|
|
13387
13865
|
case "end":
|
|
13388
|
-
return
|
|
13866
|
+
return _context7.stop();
|
|
13389
13867
|
}
|
|
13390
|
-
},
|
|
13868
|
+
}, _callee7);
|
|
13391
13869
|
}));
|
|
13392
|
-
function effect(
|
|
13393
|
-
return
|
|
13870
|
+
function effect(_x12, _x13) {
|
|
13871
|
+
return _effect6.apply(this, arguments);
|
|
13394
13872
|
}
|
|
13395
13873
|
return effect;
|
|
13396
13874
|
}()
|
|
13397
13875
|
});
|
|
13398
13876
|
|
|
13399
|
-
|
|
13400
|
-
|
|
13401
|
-
|
|
13877
|
+
/* *
|
|
13878
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
13879
|
+
* you may not use this file except in compliance with the License.
|
|
13880
|
+
* You may obtain a copy of the License at
|
|
13881
|
+
*
|
|
13882
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13883
|
+
*
|
|
13884
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
13885
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13886
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13887
|
+
* See the License for the specific language governing permissions and
|
|
13888
|
+
* limitations under the License.
|
|
13889
|
+
*
|
|
13890
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
13891
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
13892
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
13893
|
+
* */
|
|
13402
13894
|
var publicWarningsListener = createListenerMiddleware();
|
|
13403
|
-
publicWarningsListener.startListening({
|
|
13404
|
-
actionCreator: publicWarningActions.fetchWarnings,
|
|
13405
|
-
effect: function () {
|
|
13406
|
-
var _effect = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_, listenerApi) {
|
|
13407
|
-
var warningsApi, _yield$warningsApi$ge, warnings, lastUpdatedTime, taskError;
|
|
13408
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
13409
|
-
while (1) switch (_context.prev = _context.next) {
|
|
13410
|
-
case 0:
|
|
13411
|
-
listenerApi.cancelActiveListeners();
|
|
13412
|
-
_context.prev = 1;
|
|
13413
|
-
warningsApi = getWarningsApi();
|
|
13414
|
-
_context.next = 5;
|
|
13415
|
-
return warningsApi.getWarnings();
|
|
13416
|
-
case 5:
|
|
13417
|
-
_yield$warningsApi$ge = _context.sent;
|
|
13418
|
-
warnings = _yield$warningsApi$ge.data;
|
|
13419
|
-
lastUpdatedTime = getLastUpdatedTimeFormatted();
|
|
13420
|
-
listenerApi.dispatch(publicWarningActions.fetchWarningsSuccess({
|
|
13421
|
-
warnings: warnings,
|
|
13422
|
-
lastUpdatedTime: lastUpdatedTime
|
|
13423
|
-
}));
|
|
13424
|
-
_context.next = 11;
|
|
13425
|
-
return listenerApi.delay(pollingIntervalTimeout);
|
|
13426
|
-
case 11:
|
|
13427
|
-
listenerApi.dispatch(publicWarningActions.fetchWarnings());
|
|
13428
|
-
_context.next = 18;
|
|
13429
|
-
break;
|
|
13430
|
-
case 14:
|
|
13431
|
-
_context.prev = 14;
|
|
13432
|
-
_context.t0 = _context["catch"](1);
|
|
13433
|
-
taskError = _context.t0; // Don't set an error if the cancelActiveListeners was invoked (which throws a TaskAbortError)
|
|
13434
|
-
if ((taskError == null ? void 0 : taskError.code) !== 'listener-cancelled') {
|
|
13435
|
-
listenerApi.dispatch(publicWarningActions.fetchWarningsError({
|
|
13436
|
-
error: {
|
|
13437
|
-
name: taskError.name,
|
|
13438
|
-
message: taskError.message
|
|
13439
|
-
}
|
|
13440
|
-
}));
|
|
13441
|
-
}
|
|
13442
|
-
case 18:
|
|
13443
|
-
case "end":
|
|
13444
|
-
return _context.stop();
|
|
13445
|
-
}
|
|
13446
|
-
}, _callee, null, [[1, 14]]);
|
|
13447
|
-
}));
|
|
13448
|
-
function effect(_x, _x2) {
|
|
13449
|
-
return _effect.apply(this, arguments);
|
|
13450
|
-
}
|
|
13451
|
-
return effect;
|
|
13452
|
-
}()
|
|
13453
|
-
});
|
|
13454
|
-
publicWarningsListener.startListening({
|
|
13455
|
-
matcher: isAnyOf(publicWarningFormActions.publishWarningSuccess, publicWarningFormActions.saveWarningSuccess),
|
|
13456
|
-
effect: function () {
|
|
13457
|
-
var _effect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_, listenerApi) {
|
|
13458
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
13459
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
13460
|
-
case 0:
|
|
13461
|
-
listenerApi.cancelActiveListeners();
|
|
13462
|
-
listenerApi.dispatch(publicWarningActions.fetchWarnings());
|
|
13463
|
-
case 2:
|
|
13464
|
-
case "end":
|
|
13465
|
-
return _context2.stop();
|
|
13466
|
-
}
|
|
13467
|
-
}, _callee2);
|
|
13468
|
-
}));
|
|
13469
|
-
function effect(_x3, _x4) {
|
|
13470
|
-
return _effect2.apply(this, arguments);
|
|
13471
|
-
}
|
|
13472
|
-
return effect;
|
|
13473
|
-
}()
|
|
13474
|
-
});
|
|
13475
13895
|
|
|
13476
13896
|
var _excluded = ["id"];
|
|
13477
13897
|
var getSnackbarMessage = function getSnackbarMessage(objectName, id) {
|
|
@@ -13580,10 +14000,10 @@ drawingsListener.startListening({
|
|
|
13580
14000
|
var drawingModuleConfig = {
|
|
13581
14001
|
reducersMap: {
|
|
13582
14002
|
drawings: reducer$2,
|
|
13583
|
-
publicWarningForm: reducer,
|
|
13584
|
-
publicWarnings: reducer
|
|
14003
|
+
publicWarningForm: reducer$1,
|
|
14004
|
+
publicWarnings: reducer
|
|
13585
14005
|
},
|
|
13586
14006
|
middlewares: [drawingsListener.middleware, publicWarningsListener.middleware, publicWarningFormListener.middleware]
|
|
13587
14007
|
};
|
|
13588
14008
|
|
|
13589
|
-
export { DrawingToolConnect, Wrapper as DrawingToolForm, DrawingToolFormConnect, DrawingToolMapButtonConnect, ObjectManagerConnect, ObjectManagerMapButtonConnect, PublicWarningApiWrapper, PublicWarningsFormDialog, PublicWarningsFormDialogConnect, WARN_NAMESPACE, WarningsModuleProvider, componentsLookUp, drawingModuleConfig, initialState
|
|
14009
|
+
export { DrawingToolConnect, Wrapper as DrawingToolForm, DrawingToolFormConnect, DrawingToolMapButtonConnect, ObjectManagerConnect, ObjectManagerMapButtonConnect, PublicWarningApiWrapper, PublicWarningsFormDialog, PublicWarningsFormDialogConnect, WARN_NAMESPACE, WarningsModuleProvider, componentsLookUp, drawingModuleConfig, initialState, isAlreadyEdited, publicWarningActions, publicWarningFormListener, reducer$1 as publicWarningFormReducer, publicWarningsAdapter, publicWarningsListener, reducer as publicWarningsReducer, selectors as publicWarningsSelectors, reducer, useObjectDrawDialogAction, warningFormConfirmationOptions, drawingsListener as warningsDrawingsListener, reducer$2 as warningsDrawingsReducer, warningsTranslations };
|