@opengeoweb/warnings 9.35.1-spike-oltanstack.0 → 9.37.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 +397 -890
- package/package.json +2 -2
- package/src/lib/aviation-api/api.d.ts +0 -1
- package/src/lib/aviation-api/fakeApi.d.ts +3 -0
- package/src/lib/components/FilterList/ExpandableFilterChip.d.ts +2 -2
- package/src/lib/components/FilterList/{FilterChipWithOptions.stories.d.ts → ExpandableFilterChip.stories.d.ts} +2 -2
- package/src/lib/components/FilterList/FilterList.d.ts +0 -2
- package/src/lib/components/FilterList/filter-hooks.d.ts +5 -1
- package/src/lib/components/FilterList/filter-utils.d.ts +4 -0
- package/src/lib/components/PublicWarningList/PublicWarningList.d.ts +1 -4
- package/src/lib/components/PublicWarningList/WarningListItem.d.ts +1 -0
- package/src/lib/components/PublicWarningList/WarningListItem.spec.d.ts +1 -0
- package/src/lib/components/PublicWarningsForm/PublicWarningsForm.d.ts +4 -0
- package/src/lib/components/PublicWarningsForm/PublicWarningsForm.stories.d.ts +6 -8
- package/src/lib/store/publicWarningForm/types.d.ts +1 -0
- package/src/lib/store/publicWarnings/reducer.d.ts +1 -9
- package/src/lib/store/publicWarnings/selectors.d.ts +2 -19
- package/src/lib/store/publicWarnings/types.d.ts +0 -22
- package/src/lib/utils/fakeApi/index.d.ts +2 -1
- package/src/lib/components/FilterList/FilterChipWithOptions.d.ts +0 -7
- package/src/lib/components/FilterList/FilterChipWithOptionsConnect.d.ts +0 -7
- package/src/lib/store/publicWarnings/utils.d.ts +0 -24
- /package/src/lib/components/FilterList/{FilterChipWithOptions.spec.d.ts → ExpandableFilterChip.spec.d.ts} +0 -0
- /package/src/lib/{store/publicWarnings/utils.spec.d.ts → components/FilterList/filter-utils.spec.d.ts} +0 -0
package/index.esm.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
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,
|
|
4
|
-
import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawtoolSelectors, layerSelectors, uiSelectors, drawtoolActions, mapStoreActions, layerActions, useSetupDialog,
|
|
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';
|
|
4
|
+
import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawtoolSelectors, layerSelectors, uiSelectors, drawtoolActions, mapStoreActions, layerActions, useSetupDialog, 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,
|
|
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, pollingIntervalTimeout, 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
14
|
import { snackbarActions, snackbarTypes } from '@opengeoweb/snackbar';
|
|
14
15
|
import * as React from 'react';
|
|
15
|
-
import React__default, { useState, useEffect, useRef, useCallback } from 'react';
|
|
16
|
+
import React__default, { useState, useEffect, useRef, useMemo, useCallback } from 'react';
|
|
16
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';
|
|
17
18
|
import { VariableSizeList } from 'react-window';
|
|
18
19
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
@@ -20,8 +21,6 @@ import { getApi, createApiInstance, createNonAuthApiInstance, createFakeApiInsta
|
|
|
20
21
|
import { useFormContext } from 'react-hook-form';
|
|
21
22
|
import { isEqual, cloneDeep, clamp, groupBy, pick } from 'lodash';
|
|
22
23
|
import { getConfig, useAuthenticationContext as useAuthenticationContext$1 } from '@opengeoweb/authentication';
|
|
23
|
-
import { SigmetForm, isInstanceOfCancelSigmet, AirmetForm, isInstanceOfCancelAirmet, getProductFormMode } from '@opengeoweb/sigmet-airmet';
|
|
24
|
-
import { produce } from 'immer';
|
|
25
24
|
import { useQueryClient } from '@tanstack/react-query';
|
|
26
25
|
import { isAxiosError } from 'axios';
|
|
27
26
|
|
|
@@ -2084,137 +2083,6 @@ var ConfirmDeleteDialog = function ConfirmDeleteDialog(_ref) {
|
|
|
2084
2083
|
* */
|
|
2085
2084
|
var publicWarningDialogType = uiTypes.DialogTypes.PublicWarnings;
|
|
2086
2085
|
|
|
2087
|
-
/* *
|
|
2088
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2089
|
-
* you may not use this file except in compliance with the License.
|
|
2090
|
-
* You may obtain a copy of the License at
|
|
2091
|
-
*
|
|
2092
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2093
|
-
*
|
|
2094
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2095
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2096
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2097
|
-
* See the License for the specific language governing permissions and
|
|
2098
|
-
* limitations under the License.
|
|
2099
|
-
*
|
|
2100
|
-
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2101
|
-
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
2102
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2103
|
-
* */
|
|
2104
|
-
var emptyFilter = {
|
|
2105
|
-
id: 'unspecified',
|
|
2106
|
-
name: '(not specified)',
|
|
2107
|
-
checked: true
|
|
2108
|
-
};
|
|
2109
|
-
var defaultFilters = [{
|
|
2110
|
-
key: 'incident',
|
|
2111
|
-
translationKey: 'filter-incident'
|
|
2112
|
-
}, {
|
|
2113
|
-
key: 'warningProposalSource',
|
|
2114
|
-
translationKey: 'filter-source'
|
|
2115
|
-
}];
|
|
2116
|
-
var getFiltersFromWarnings = function getFiltersFromWarnings(t, warnings) {
|
|
2117
|
-
if (!warnings || !warnings.length) {
|
|
2118
|
-
// return default list
|
|
2119
|
-
return defaultFilters.map(function (_ref) {
|
|
2120
|
-
var key = _ref.key,
|
|
2121
|
-
translationKey = _ref.translationKey;
|
|
2122
|
-
return {
|
|
2123
|
-
id: key,
|
|
2124
|
-
translationKey: translationKey,
|
|
2125
|
-
filterList: []
|
|
2126
|
-
};
|
|
2127
|
-
});
|
|
2128
|
-
}
|
|
2129
|
-
var filledFilters = defaultFilters.map(function (_ref2) {
|
|
2130
|
-
var key = _ref2.key,
|
|
2131
|
-
translationKey = _ref2.translationKey,
|
|
2132
|
-
translations = _ref2.translations;
|
|
2133
|
-
var filterOptions = [];
|
|
2134
|
-
warnings.forEach(function (warning) {
|
|
2135
|
-
var id = warning.warningDetail[key];
|
|
2136
|
-
if (id && filterOptions.findIndex(function (option) {
|
|
2137
|
-
return option.filter.id === id;
|
|
2138
|
-
}) === -1) {
|
|
2139
|
-
var _translationKey = translations && translations[id];
|
|
2140
|
-
var label = _translationKey ? t(_translationKey) : id;
|
|
2141
|
-
var filter = {
|
|
2142
|
-
id: id,
|
|
2143
|
-
name: label,
|
|
2144
|
-
checked: true
|
|
2145
|
-
};
|
|
2146
|
-
filterOptions.push({
|
|
2147
|
-
filter: filter
|
|
2148
|
-
});
|
|
2149
|
-
}
|
|
2150
|
-
});
|
|
2151
|
-
// add option for empty
|
|
2152
|
-
filterOptions.push({
|
|
2153
|
-
filter: emptyFilter
|
|
2154
|
-
});
|
|
2155
|
-
// sort alphabetically
|
|
2156
|
-
var filtersSorted = [].concat(filterOptions).sort(function (a, b) {
|
|
2157
|
-
return a.filter.name.localeCompare(b.filter.name);
|
|
2158
|
-
});
|
|
2159
|
-
return {
|
|
2160
|
-
id: key,
|
|
2161
|
-
translationKey: translationKey,
|
|
2162
|
-
filterList: filtersSorted
|
|
2163
|
-
};
|
|
2164
|
-
});
|
|
2165
|
-
return filledFilters;
|
|
2166
|
-
};
|
|
2167
|
-
var isWarningMatchingFilter = function isWarningMatchingFilter(filters, filterId, warningDetailValue) {
|
|
2168
|
-
return filters.some(function (filter) {
|
|
2169
|
-
return filter.filterId === filterId && filter.optionId === warningDetailValue;
|
|
2170
|
-
}) || !warningDetailValue && filters.some(function (filter) {
|
|
2171
|
-
return filter.filterId === filterId && filter.optionId === emptyFilter.id;
|
|
2172
|
-
});
|
|
2173
|
-
};
|
|
2174
|
-
var getUpdatedFilters = function getUpdatedFilters(filters, newFilters) {
|
|
2175
|
-
return filters.ids.reduce(function (list, id) {
|
|
2176
|
-
var _filters$entities$id;
|
|
2177
|
-
var existingFilterList = (_filters$entities$id = filters.entities[id]) == null ? void 0 : _filters$entities$id.filterList;
|
|
2178
|
-
var newFilter = newFilters.find(function (filter) {
|
|
2179
|
-
return filter.id === id;
|
|
2180
|
-
});
|
|
2181
|
-
if (newFilter && existingFilterList) {
|
|
2182
|
-
var updatedFilterList = getUpdatedFilterList(existingFilterList, newFilter.filterList);
|
|
2183
|
-
list.push({
|
|
2184
|
-
id: id,
|
|
2185
|
-
changes: Object.assign({}, newFilter, {
|
|
2186
|
-
filterList: updatedFilterList
|
|
2187
|
-
})
|
|
2188
|
-
});
|
|
2189
|
-
}
|
|
2190
|
-
return list;
|
|
2191
|
-
}, []);
|
|
2192
|
-
};
|
|
2193
|
-
var getUpdatedFilterList = function getUpdatedFilterList(oldList, newList) {
|
|
2194
|
-
var updatedList = [];
|
|
2195
|
-
// if the item existed already, keep its state
|
|
2196
|
-
oldList.forEach(function (oldListItem) {
|
|
2197
|
-
if (newList.some(function (newListItem) {
|
|
2198
|
-
return newListItem.filter.id === oldListItem.filter.id;
|
|
2199
|
-
})) {
|
|
2200
|
-
updatedList.push(oldListItem);
|
|
2201
|
-
}
|
|
2202
|
-
});
|
|
2203
|
-
// if the item did not exist yet, add it
|
|
2204
|
-
newList.forEach(function (newListItem) {
|
|
2205
|
-
if (oldList.every(function (oldListItem) {
|
|
2206
|
-
return oldListItem.filter.id !== newListItem.filter.id;
|
|
2207
|
-
})) {
|
|
2208
|
-
updatedList.push(newListItem);
|
|
2209
|
-
}
|
|
2210
|
-
});
|
|
2211
|
-
// sort alphabetically
|
|
2212
|
-
var sortedList = [].concat(updatedList).sort(function (a, b) {
|
|
2213
|
-
return a.filter.name.localeCompare(b.filter.name);
|
|
2214
|
-
});
|
|
2215
|
-
return sortedList;
|
|
2216
|
-
};
|
|
2217
|
-
|
|
2218
2086
|
/* *
|
|
2219
2087
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2220
2088
|
* you may not use this file except in compliance with the License.
|
|
@@ -2237,12 +2105,10 @@ var publicWarningsAdapter = createEntityAdapter({
|
|
|
2237
2105
|
return warning.id;
|
|
2238
2106
|
}
|
|
2239
2107
|
});
|
|
2240
|
-
var warningListFilterAdapter = createEntityAdapter();
|
|
2241
2108
|
var initialState$1 = {
|
|
2242
2109
|
warnings: publicWarningsAdapter.getInitialState(),
|
|
2243
2110
|
isLoading: true,
|
|
2244
|
-
lastUpdatedTime: ''
|
|
2245
|
-
filters: warningListFilterAdapter.getInitialState()
|
|
2111
|
+
lastUpdatedTime: ''
|
|
2246
2112
|
};
|
|
2247
2113
|
var slice$1 = createSlice({
|
|
2248
2114
|
initialState: initialState$1,
|
|
@@ -2264,63 +2130,6 @@ var slice$1 = createSlice({
|
|
|
2264
2130
|
var error = action.payload.error;
|
|
2265
2131
|
draft.isLoading = false;
|
|
2266
2132
|
draft.error = error;
|
|
2267
|
-
},
|
|
2268
|
-
setWarningListFilters: function setWarningListFilters(draft, action) {
|
|
2269
|
-
var newFilters = action.payload.newFilters;
|
|
2270
|
-
// Update existing filters
|
|
2271
|
-
var updates = getUpdatedFilters(draft.filters, newFilters);
|
|
2272
|
-
warningListFilterAdapter.updateMany(draft.filters, updates);
|
|
2273
|
-
// Add any new filters that didn't exist before
|
|
2274
|
-
var newFiltersToAdd = newFilters.filter(function (filter) {
|
|
2275
|
-
return !draft.filters.ids.includes(filter.id);
|
|
2276
|
-
});
|
|
2277
|
-
warningListFilterAdapter.upsertMany(draft.filters, newFiltersToAdd);
|
|
2278
|
-
},
|
|
2279
|
-
toggleFilter: function toggleFilter(draft, action) {
|
|
2280
|
-
var _action$payload2 = action.payload,
|
|
2281
|
-
filterId = _action$payload2.filterId,
|
|
2282
|
-
isChecked = _action$payload2.isChecked;
|
|
2283
|
-
if (!draft.filters.entities[filterId]) {
|
|
2284
|
-
return;
|
|
2285
|
-
}
|
|
2286
|
-
draft.filters.entities[filterId].filterList.forEach(function (_, index) {
|
|
2287
|
-
draft.filters.entities[filterId].filterList[index].filter.checked = !isChecked;
|
|
2288
|
-
});
|
|
2289
|
-
},
|
|
2290
|
-
toggleOption: function toggleOption(draft, action) {
|
|
2291
|
-
var _action$payload3 = action.payload,
|
|
2292
|
-
filterId = _action$payload3.filterId,
|
|
2293
|
-
optionId = _action$payload3.optionId;
|
|
2294
|
-
if (!draft.filters.entities[filterId]) {
|
|
2295
|
-
return;
|
|
2296
|
-
}
|
|
2297
|
-
var index = draft.filters.entities[filterId].filterList.findIndex(function (option) {
|
|
2298
|
-
return option.filter.id === optionId;
|
|
2299
|
-
});
|
|
2300
|
-
if (index === -1) {
|
|
2301
|
-
return;
|
|
2302
|
-
}
|
|
2303
|
-
draft.filters.entities[filterId].filterList[index].filter.checked = !draft.filters.entities[filterId].filterList[index].filter.checked;
|
|
2304
|
-
},
|
|
2305
|
-
enableOnlyOneFilterOption: function enableOnlyOneFilterOption(draft, action) {
|
|
2306
|
-
var _action$payload4 = action.payload,
|
|
2307
|
-
filterId = _action$payload4.filterId,
|
|
2308
|
-
optionId = _action$payload4.optionId;
|
|
2309
|
-
if (!draft.filters.entities[filterId]) {
|
|
2310
|
-
return;
|
|
2311
|
-
}
|
|
2312
|
-
draft.filters.entities[filterId].filterList.forEach(function (_, index) {
|
|
2313
|
-
var newStatus = draft.filters.entities[filterId].filterList[index].filter.id === optionId;
|
|
2314
|
-
draft.filters.entities[filterId].filterList[index].filter.checked = newStatus;
|
|
2315
|
-
});
|
|
2316
|
-
},
|
|
2317
|
-
toggleAllFilters: function toggleAllFilters(draft, action) {
|
|
2318
|
-
var isChecked = action.payload.isChecked;
|
|
2319
|
-
draft.filters.ids.forEach(function (id) {
|
|
2320
|
-
draft.filters.entities[id].filterList.forEach(function (_, index) {
|
|
2321
|
-
draft.filters.entities[id].filterList[index].filter.checked = !isChecked;
|
|
2322
|
-
});
|
|
2323
|
-
});
|
|
2324
2133
|
}
|
|
2325
2134
|
}
|
|
2326
2135
|
});
|
|
@@ -7122,204 +6931,6 @@ var warningListJSON = [
|
|
|
7122
6931
|
}
|
|
7123
6932
|
];
|
|
7124
6933
|
|
|
7125
|
-
var sigmetListJSON = [
|
|
7126
|
-
{
|
|
7127
|
-
id: "57eaf6c8-a247-11ef-ac05-12e0cc025418",
|
|
7128
|
-
lastUpdatedTime: "2024-11-14T05:14:37",
|
|
7129
|
-
productStatus: "DRAFT",
|
|
7130
|
-
warningDetail: {
|
|
7131
|
-
areas: [
|
|
7132
|
-
{
|
|
7133
|
-
geoJSON: {
|
|
7134
|
-
features: [
|
|
7135
|
-
{
|
|
7136
|
-
geometry: {
|
|
7137
|
-
type: "Polygon",
|
|
7138
|
-
coordinates: [
|
|
7139
|
-
[
|
|
7140
|
-
[
|
|
7141
|
-
10,
|
|
7142
|
-
20
|
|
7143
|
-
],
|
|
7144
|
-
[
|
|
7145
|
-
15,
|
|
7146
|
-
25
|
|
7147
|
-
],
|
|
7148
|
-
[
|
|
7149
|
-
20,
|
|
7150
|
-
20
|
|
7151
|
-
],
|
|
7152
|
-
[
|
|
7153
|
-
10,
|
|
7154
|
-
20
|
|
7155
|
-
]
|
|
7156
|
-
]
|
|
7157
|
-
]
|
|
7158
|
-
},
|
|
7159
|
-
properties: {
|
|
7160
|
-
selectionType: "fir",
|
|
7161
|
-
stroke: "#0075a9",
|
|
7162
|
-
"stroke-width": 1.5,
|
|
7163
|
-
"stroke-opacity": 1,
|
|
7164
|
-
fill: "#0075a9",
|
|
7165
|
-
"fill-opacity": 0.4
|
|
7166
|
-
},
|
|
7167
|
-
type: "Feature"
|
|
7168
|
-
}
|
|
7169
|
-
],
|
|
7170
|
-
type: "FeatureCollection"
|
|
7171
|
-
},
|
|
7172
|
-
objectName: "ENOB"
|
|
7173
|
-
}
|
|
7174
|
-
],
|
|
7175
|
-
descriptionOriginal: "",
|
|
7176
|
-
descriptionTranslation: "",
|
|
7177
|
-
firName: "BODOE OCEANIC FIR",
|
|
7178
|
-
incident: "-1",
|
|
7179
|
-
level: "SIG",
|
|
7180
|
-
phenomenon: "EMBD_TSGR",
|
|
7181
|
-
probability: "0",
|
|
7182
|
-
validFrom: "2024-11-14T05:30:14Z",
|
|
7183
|
-
validUntil: "2024-11-14T07:30:14Z"
|
|
7184
|
-
}
|
|
7185
|
-
},
|
|
7186
|
-
{
|
|
7187
|
-
id: "fc4c0002-8d32-11ef-888b-ee87a1644661",
|
|
7188
|
-
lastUpdatedTime: "2024-11-14T05:14:06",
|
|
7189
|
-
productStatus: "EXPIRED",
|
|
7190
|
-
warningDetail: {
|
|
7191
|
-
areas: [
|
|
7192
|
-
{
|
|
7193
|
-
geoJSON: null,
|
|
7194
|
-
objectName: "EFIN"
|
|
7195
|
-
}
|
|
7196
|
-
],
|
|
7197
|
-
descriptionOriginal: "",
|
|
7198
|
-
descriptionTranslation: "",
|
|
7199
|
-
firName: "HELSINKI FIR",
|
|
7200
|
-
incident: "T01",
|
|
7201
|
-
level: "SIG",
|
|
7202
|
-
phenomenon: "OBSC_TS",
|
|
7203
|
-
probability: "0",
|
|
7204
|
-
validFrom: "2024-11-13T05:30:14Z",
|
|
7205
|
-
validUntil: "2024-11-13T07:30:14Z"
|
|
7206
|
-
}
|
|
7207
|
-
},
|
|
7208
|
-
{
|
|
7209
|
-
id: "fe4a14bc-8a90-11ef-9090-6c08d8abf452",
|
|
7210
|
-
lastUpdatedTime: "2024-10-08T08:10:30",
|
|
7211
|
-
productStatus: "PUBLISHED",
|
|
7212
|
-
warningDetail: {
|
|
7213
|
-
areas: [
|
|
7214
|
-
{
|
|
7215
|
-
geoJSON: null,
|
|
7216
|
-
objectName: "EHAA"
|
|
7217
|
-
}
|
|
7218
|
-
],
|
|
7219
|
-
descriptionOriginal: "",
|
|
7220
|
-
descriptionTranslation: "",
|
|
7221
|
-
firName: "AMSTERDAM FIR",
|
|
7222
|
-
incident: "Z01",
|
|
7223
|
-
level: "SIG",
|
|
7224
|
-
phenomenon: "SEV_ICE",
|
|
7225
|
-
probability: "0",
|
|
7226
|
-
validFrom: "2024-10-08T05:30:14Z",
|
|
7227
|
-
validUntil: "2024-10-08T09:30:14Z"
|
|
7228
|
-
}
|
|
7229
|
-
}
|
|
7230
|
-
];
|
|
7231
|
-
|
|
7232
|
-
var airmetListJSON = [
|
|
7233
|
-
{
|
|
7234
|
-
id: "02d3727a-b190-11ef-ba31-067f7750936d",
|
|
7235
|
-
lastUpdatedTime: "2024-12-03T16:02:35",
|
|
7236
|
-
productStatus: "DRAFT",
|
|
7237
|
-
warningDetail: {
|
|
7238
|
-
areas: [
|
|
7239
|
-
{
|
|
7240
|
-
geoJSON: null,
|
|
7241
|
-
objectName: "EHAA"
|
|
7242
|
-
}
|
|
7243
|
-
],
|
|
7244
|
-
descriptionOriginal: "",
|
|
7245
|
-
descriptionTranslation: "",
|
|
7246
|
-
firName: "AMSTERDAM FIR",
|
|
7247
|
-
incident: "-1",
|
|
7248
|
-
level: "AIR",
|
|
7249
|
-
phenomenon: "SFC_WIND",
|
|
7250
|
-
probability: "0",
|
|
7251
|
-
validFrom: "2024-12-03T17:00:09Z",
|
|
7252
|
-
validUntil: "2024-12-03T21:00:09Z"
|
|
7253
|
-
}
|
|
7254
|
-
},
|
|
7255
|
-
{
|
|
7256
|
-
id: "1a868884-9076-11ef-8e82-5a063b90cdf6",
|
|
7257
|
-
lastUpdatedTime: "2024-10-22T13:03:56",
|
|
7258
|
-
productStatus: "DRAFT",
|
|
7259
|
-
warningDetail: {
|
|
7260
|
-
areas: [
|
|
7261
|
-
{
|
|
7262
|
-
geoJSON: null,
|
|
7263
|
-
objectName: "EHAA"
|
|
7264
|
-
}
|
|
7265
|
-
],
|
|
7266
|
-
descriptionOriginal: "",
|
|
7267
|
-
descriptionTranslation: "",
|
|
7268
|
-
firName: "AMSTERDAM FIR",
|
|
7269
|
-
incident: "-1",
|
|
7270
|
-
level: "AIR",
|
|
7271
|
-
phenomenon: "MOD_TURB",
|
|
7272
|
-
probability: "0",
|
|
7273
|
-
validFrom: "2024-10-22T15:00:09Z",
|
|
7274
|
-
validUntil: "2024-10-22T18:00:09Z"
|
|
7275
|
-
}
|
|
7276
|
-
},
|
|
7277
|
-
{
|
|
7278
|
-
id: "4ac7fc94-c670-11ee-8ace-92491e683685",
|
|
7279
|
-
lastUpdatedTime: "2024-02-08T12:26:31.803468",
|
|
7280
|
-
productStatus: "EXPIRED",
|
|
7281
|
-
warningDetail: {
|
|
7282
|
-
areas: [
|
|
7283
|
-
{
|
|
7284
|
-
geoJSON: null,
|
|
7285
|
-
objectName: "ENOR"
|
|
7286
|
-
}
|
|
7287
|
-
],
|
|
7288
|
-
descriptionOriginal: "",
|
|
7289
|
-
descriptionTranslation: "",
|
|
7290
|
-
firName: "POLARIS FIR",
|
|
7291
|
-
incident: "T01",
|
|
7292
|
-
level: "AIR",
|
|
7293
|
-
phenomenon: "OBSC_TS",
|
|
7294
|
-
probability: "0",
|
|
7295
|
-
validFrom: "2024-02-08T09:00:09Z",
|
|
7296
|
-
validUntil: "2024-02-08T11:00:09Z"
|
|
7297
|
-
}
|
|
7298
|
-
},
|
|
7299
|
-
{
|
|
7300
|
-
id: "9dbcd4c6-c4c0-11ee-a0e9-9e39e246af14",
|
|
7301
|
-
lastUpdatedTime: "2024-02-06T07:15:18.166785",
|
|
7302
|
-
productStatus: "PUBLISHED",
|
|
7303
|
-
warningDetail: {
|
|
7304
|
-
areas: [
|
|
7305
|
-
{
|
|
7306
|
-
geoJSON: null,
|
|
7307
|
-
objectName: "EHAA"
|
|
7308
|
-
}
|
|
7309
|
-
],
|
|
7310
|
-
descriptionOriginal: "",
|
|
7311
|
-
descriptionTranslation: "",
|
|
7312
|
-
firName: "AMSTERDAM FIR",
|
|
7313
|
-
incident: "Z01",
|
|
7314
|
-
level: "AIR",
|
|
7315
|
-
phenomenon: "SEV_ICE",
|
|
7316
|
-
probability: "0",
|
|
7317
|
-
validFrom: "2024-02-06T08:00:09Z",
|
|
7318
|
-
validUntil: "2024-02-06T12:00:09Z"
|
|
7319
|
-
}
|
|
7320
|
-
}
|
|
7321
|
-
];
|
|
7322
|
-
|
|
7323
6934
|
/* *
|
|
7324
6935
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7325
6936
|
* you may not use this file except in compliance with the License.
|
|
@@ -7340,8 +6951,9 @@ var airmetListJSON = [
|
|
|
7340
6951
|
var drawingList = drawingListJSON;
|
|
7341
6952
|
var drawingsListFullContent = drawingsListFullContentJSON;
|
|
7342
6953
|
var warningList = warningListJSON;
|
|
7343
|
-
|
|
7344
|
-
|
|
6954
|
+
warningList.filter(function (warning) {
|
|
6955
|
+
return warning.status !== 'EXPIRED' && warning.status !== 'WITHDRAWN';
|
|
6956
|
+
}).length;
|
|
7345
6957
|
var areaKeywordList = ['North Sea districts', 'Coastal Districts', 'KNMI Specific', 'Objects', 'Baltic areas', 'NL', 'FI', 'METNorway Specific', 'Provinces', 'FIR', 'Countries'];
|
|
7346
6958
|
|
|
7347
6959
|
/* *
|
|
@@ -7442,7 +7054,7 @@ var getApiRoutes = function getApiRoutes(axiosInstance) {
|
|
|
7442
7054
|
getWarnings: function getWarnings() {
|
|
7443
7055
|
return axiosInstance.get("/warnings/").then(function () {
|
|
7444
7056
|
return {
|
|
7445
|
-
data: warningList
|
|
7057
|
+
data: warningList
|
|
7446
7058
|
};
|
|
7447
7059
|
});
|
|
7448
7060
|
},
|
|
@@ -8572,6 +8184,109 @@ var AreaField = function AreaField(_ref) {
|
|
|
8572
8184
|
});
|
|
8573
8185
|
};
|
|
8574
8186
|
|
|
8187
|
+
var _defaultLevelFilter, _defaultEmptyFilter, _defaultPhenomenonFil;
|
|
8188
|
+
/* *
|
|
8189
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
8190
|
+
* you may not use this file except in compliance with the License.
|
|
8191
|
+
* You may obtain a copy of the License at
|
|
8192
|
+
*
|
|
8193
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
8194
|
+
*
|
|
8195
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
8196
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
8197
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8198
|
+
* See the License for the specific language governing permissions and
|
|
8199
|
+
* limitations under the License.
|
|
8200
|
+
*
|
|
8201
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
8202
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
8203
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
8204
|
+
* */
|
|
8205
|
+
var Domain;
|
|
8206
|
+
(function (Domain) {
|
|
8207
|
+
Domain["aviation"] = "aviation";
|
|
8208
|
+
Domain["maritime"] = "maritime";
|
|
8209
|
+
Domain["public"] = "public";
|
|
8210
|
+
})(Domain || (Domain = {}));
|
|
8211
|
+
var Level;
|
|
8212
|
+
(function (Level) {
|
|
8213
|
+
Level["extreme"] = "extreme";
|
|
8214
|
+
Level["moderate"] = "moderate";
|
|
8215
|
+
Level["severe"] = "severe";
|
|
8216
|
+
Level["airmet"] = "AIR";
|
|
8217
|
+
Level["sigmet"] = "SIG";
|
|
8218
|
+
})(Level || (Level = {}));
|
|
8219
|
+
var Phenomenon$1;
|
|
8220
|
+
(function (Phenomenon) {
|
|
8221
|
+
Phenomenon["wind"] = "wind";
|
|
8222
|
+
Phenomenon["fog"] = "fog";
|
|
8223
|
+
Phenomenon["thunderstorm"] = "thunderstorm";
|
|
8224
|
+
Phenomenon["snowIce"] = "snowIce";
|
|
8225
|
+
Phenomenon["rain"] = "rain";
|
|
8226
|
+
Phenomenon["highTemp"] = "highTemp";
|
|
8227
|
+
Phenomenon["lowTemp"] = "lowTemp";
|
|
8228
|
+
Phenomenon["coastalEvent"] = "coastalEvent";
|
|
8229
|
+
})(Phenomenon$1 || (Phenomenon$1 = {}));
|
|
8230
|
+
var emptyFilterId = 'unspecified';
|
|
8231
|
+
var defaultDomainFilter = {
|
|
8232
|
+
aviation: false,
|
|
8233
|
+
maritime: false,
|
|
8234
|
+
"public": true
|
|
8235
|
+
};
|
|
8236
|
+
var domainLevels = {
|
|
8237
|
+
aviation: [Level.airmet, Level.sigmet],
|
|
8238
|
+
maritime: [],
|
|
8239
|
+
"public": [Level.extreme, Level.moderate, Level.severe]
|
|
8240
|
+
};
|
|
8241
|
+
var defaultLevelFilter = (_defaultLevelFilter = {}, _defaultLevelFilter[emptyFilterId] = true, _defaultLevelFilter.extreme = true, _defaultLevelFilter.moderate = true, _defaultLevelFilter.severe = true, _defaultLevelFilter.AIR = true, _defaultLevelFilter.SIG = true, _defaultLevelFilter);
|
|
8242
|
+
(_defaultEmptyFilter = {}, _defaultEmptyFilter[emptyFilterId] = true, _defaultEmptyFilter);
|
|
8243
|
+
var defaultPhenomenonFilter = (_defaultPhenomenonFil = {}, _defaultPhenomenonFil[emptyFilterId] = true, _defaultPhenomenonFil.coastalEvent = true, _defaultPhenomenonFil.fog = true, _defaultPhenomenonFil.highTemp = true, _defaultPhenomenonFil.lowTemp = true, _defaultPhenomenonFil.rain = true, _defaultPhenomenonFil.snowIce = true, _defaultPhenomenonFil.thunderstorm = true, _defaultPhenomenonFil.wind = true, _defaultPhenomenonFil);
|
|
8244
|
+
var useSelectedOptions = function useSelectedOptions(options) {
|
|
8245
|
+
var selectedOptions = Object.keys(options).filter(function (k) {
|
|
8246
|
+
return options[k];
|
|
8247
|
+
});
|
|
8248
|
+
var allSelected = selectedOptions.length === Object.keys(options).length;
|
|
8249
|
+
return {
|
|
8250
|
+
noSelectedOptions: selectedOptions.length,
|
|
8251
|
+
allSelected: allSelected
|
|
8252
|
+
};
|
|
8253
|
+
};
|
|
8254
|
+
var updateState = function updateState(state, optionKey, value, only) {
|
|
8255
|
+
var _Object$assign3;
|
|
8256
|
+
if (only) {
|
|
8257
|
+
return Object.keys(state).reduce(function (acc, k) {
|
|
8258
|
+
var _Object$assign;
|
|
8259
|
+
return Object.assign({}, acc, (_Object$assign = {}, _Object$assign[k] = k === optionKey, _Object$assign));
|
|
8260
|
+
}, {});
|
|
8261
|
+
}
|
|
8262
|
+
return optionKey === 'ALL' ? Object.keys(state).reduce(function (acc, k) {
|
|
8263
|
+
var _Object$assign2;
|
|
8264
|
+
return Object.assign({}, acc, (_Object$assign2 = {}, _Object$assign2[k] = value, _Object$assign2));
|
|
8265
|
+
}, {}) : Object.assign({}, state, (_Object$assign3 = {}, _Object$assign3[optionKey] = value, _Object$assign3));
|
|
8266
|
+
};
|
|
8267
|
+
/** Make sure our value is in the filter */
|
|
8268
|
+
var getValue = function getValue(values, value) {
|
|
8269
|
+
return Object.values(values).find(function (v) {
|
|
8270
|
+
return v === value;
|
|
8271
|
+
}) || emptyFilterId;
|
|
8272
|
+
};
|
|
8273
|
+
var getFiltersFromWarnings = function getFiltersFromWarnings(warnings, filterKey) {
|
|
8274
|
+
var filterOptions = [emptyFilterId];
|
|
8275
|
+
if (!warnings || !warnings.length) {
|
|
8276
|
+
// return default list
|
|
8277
|
+
return filterOptions;
|
|
8278
|
+
}
|
|
8279
|
+
warnings.forEach(function (warning) {
|
|
8280
|
+
var id = warning.warningDetail[filterKey];
|
|
8281
|
+
if (id && filterOptions.findIndex(function (option) {
|
|
8282
|
+
return option === id;
|
|
8283
|
+
}) === -1) {
|
|
8284
|
+
filterOptions.push(id);
|
|
8285
|
+
}
|
|
8286
|
+
});
|
|
8287
|
+
return filterOptions;
|
|
8288
|
+
};
|
|
8289
|
+
|
|
8575
8290
|
var getWarningPhenomenaIcon = function getWarningPhenomenaIcon(key) {
|
|
8576
8291
|
switch (key) {
|
|
8577
8292
|
case 'wind':
|
|
@@ -8632,7 +8347,7 @@ var getAviationPhenomenaIcon = function getAviationPhenomenaIcon(key) {
|
|
|
8632
8347
|
};
|
|
8633
8348
|
var warningPhenomena = [{
|
|
8634
8349
|
translationKey: 'warning-unspecified',
|
|
8635
|
-
key:
|
|
8350
|
+
key: emptyFilterId,
|
|
8636
8351
|
isAviation: false
|
|
8637
8352
|
}, {
|
|
8638
8353
|
translationKey: 'warning-phenomenon-wind',
|
|
@@ -8807,7 +8522,7 @@ var allPhenomenaDict = warningPhenomena.reduce(function (list, item) {
|
|
|
8807
8522
|
var getPhenomenaIcon = function getPhenomenaIcon(key) {
|
|
8808
8523
|
return getWarningPhenomenaIcon(key) || getAviationPhenomenaIcon(key);
|
|
8809
8524
|
};
|
|
8810
|
-
var Phenomenon
|
|
8525
|
+
var Phenomenon = function Phenomenon(_ref) {
|
|
8811
8526
|
var isDisabled = _ref.isDisabled,
|
|
8812
8527
|
isReadOnly = _ref.isReadOnly;
|
|
8813
8528
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
@@ -8816,7 +8531,7 @@ var Phenomenon$1 = function Phenomenon(_ref) {
|
|
|
8816
8531
|
isRequired = _useDraftFormHelpers.isRequired;
|
|
8817
8532
|
// These phenomena are sent to Public Warning Form
|
|
8818
8533
|
var warningFormPhenomena = warningPhenomena.filter(function (phenomenon) {
|
|
8819
|
-
return !phenomenon.isAviation && phenomenon.key !==
|
|
8534
|
+
return !phenomenon.isAviation && phenomenon.key !== emptyFilterId;
|
|
8820
8535
|
});
|
|
8821
8536
|
return jsx(ReactHookFormSelect, {
|
|
8822
8537
|
name: "phenomenon",
|
|
@@ -9397,15 +9112,6 @@ var getEmptyPublicWarning = function getEmptyPublicWarning() {
|
|
|
9397
9112
|
areas: []
|
|
9398
9113
|
};
|
|
9399
9114
|
};
|
|
9400
|
-
var getDefaultFeatureProperties = function getDefaultFeatureProperties(level) {
|
|
9401
|
-
return {
|
|
9402
|
-
fill: LevelColors[level].color,
|
|
9403
|
-
stroke: LevelColors[level].color,
|
|
9404
|
-
'fill-opacity': 0.2,
|
|
9405
|
-
'stroke-width': 2,
|
|
9406
|
-
'stroke-opacity': 1
|
|
9407
|
-
};
|
|
9408
|
-
};
|
|
9409
9115
|
var getFormData = function getFormData(publicWarningsDetails, object) {
|
|
9410
9116
|
var data = Object.assign({
|
|
9411
9117
|
IS_DRAFT: '',
|
|
@@ -9513,21 +9219,57 @@ var getErrors = function getErrors(errors) {
|
|
|
9513
9219
|
errors: []
|
|
9514
9220
|
}) : null;
|
|
9515
9221
|
};
|
|
9516
|
-
|
|
9517
|
-
|
|
9518
|
-
|
|
9222
|
+
function warningLevelFeatureColors(level, geoJSON,
|
|
9223
|
+
// Allow undefined
|
|
9224
|
+
isAviationWarning) {
|
|
9225
|
+
if (isAviationWarning === void 0) {
|
|
9226
|
+
isAviationWarning = false;
|
|
9227
|
+
}
|
|
9228
|
+
if (!geoJSON || !geoJSON.features) {
|
|
9229
|
+
// Return an empty FeatureCollection if geoJSON is invalid
|
|
9230
|
+
return {
|
|
9231
|
+
type: 'FeatureCollection',
|
|
9232
|
+
features: []
|
|
9233
|
+
};
|
|
9519
9234
|
}
|
|
9520
|
-
return
|
|
9521
|
-
|
|
9522
|
-
|
|
9523
|
-
var
|
|
9524
|
-
if (
|
|
9525
|
-
|
|
9235
|
+
return Object.assign({}, geoJSON, {
|
|
9236
|
+
features: geoJSON.features.map(function (feature) {
|
|
9237
|
+
var _feature$properties2, _feature$properties3;
|
|
9238
|
+
var colors;
|
|
9239
|
+
if (isAviationWarning) {
|
|
9240
|
+
var _feature$properties$i, _feature$properties;
|
|
9241
|
+
var isStartGeometry = (_feature$properties$i = (_feature$properties = feature.properties) == null ? void 0 : _feature$properties.isStartGeometry) != null ? _feature$properties$i : false;
|
|
9242
|
+
colors = {
|
|
9243
|
+
color: isStartGeometry ? '#E27000' : '#800080',
|
|
9244
|
+
// Orange for start, purple for end
|
|
9245
|
+
borderColor: isStartGeometry ? '#FEAE02' : '#4B0082'
|
|
9246
|
+
};
|
|
9247
|
+
} else if (level) {
|
|
9248
|
+
// Public warning: use LevelColors if level is defined
|
|
9249
|
+
colors = LevelColors[level];
|
|
9250
|
+
} else {
|
|
9251
|
+
// Default to blue if level is undefined (public warning)
|
|
9252
|
+
colors = {
|
|
9253
|
+
color: '#0000FF',
|
|
9254
|
+
borderColor: '#0000A0'
|
|
9255
|
+
};
|
|
9526
9256
|
}
|
|
9527
|
-
|
|
9528
|
-
|
|
9257
|
+
var defaultProperties = {
|
|
9258
|
+
fill: colors.color,
|
|
9259
|
+
stroke: colors.color,
|
|
9260
|
+
'fill-opacity': 0.2,
|
|
9261
|
+
'stroke-width': 2,
|
|
9262
|
+
'stroke-opacity': 1
|
|
9263
|
+
};
|
|
9264
|
+
return Object.assign({}, feature, {
|
|
9265
|
+
properties: Object.assign({}, defaultProperties, feature.properties, {
|
|
9266
|
+
fill: colors.color || ((_feature$properties2 = feature.properties) == null ? void 0 : _feature$properties2.fill),
|
|
9267
|
+
stroke: colors.color || ((_feature$properties3 = feature.properties) == null ? void 0 : _feature$properties3.stroke)
|
|
9268
|
+
})
|
|
9269
|
+
});
|
|
9270
|
+
})
|
|
9529
9271
|
});
|
|
9530
|
-
}
|
|
9272
|
+
}
|
|
9531
9273
|
var Form = function Form(_ref5) {
|
|
9532
9274
|
var _publicWarningDetails;
|
|
9533
9275
|
var defaultMapPreset = _ref5.defaultMapPreset,
|
|
@@ -9671,8 +9413,8 @@ var Form = function Form(_ref5) {
|
|
|
9671
9413
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9672
9414
|
}, [aviationId, warningType]);
|
|
9673
9415
|
var errors = getErrors(error.message);
|
|
9674
|
-
var level =
|
|
9675
|
-
var geoJSONFeature =
|
|
9416
|
+
var level = publicWarningDetails != null && publicWarningDetails.level ? WarningLevel[publicWarningDetails.level] : undefined;
|
|
9417
|
+
var geoJSONFeature = warningLevelFeatureColors(level, warningGeoJSONFeature);
|
|
9676
9418
|
var ref = useScrollTopOnError(error);
|
|
9677
9419
|
var _useProductConfig = useProductConfig(warningType),
|
|
9678
9420
|
aviationConfig = _useProductConfig.data;
|
|
@@ -9703,6 +9445,7 @@ var Form = function Form(_ref5) {
|
|
|
9703
9445
|
showMap: false,
|
|
9704
9446
|
mode: mode,
|
|
9705
9447
|
initialSigmet: selectedAviationProduct !== undefined && !isInstanceOfCancelSigmet(selectedAviationProduct) ? selectedAviationProduct : null,
|
|
9448
|
+
isCancelSigmet: selectedAviationProduct !== undefined && isInstanceOfCancelSigmet(selectedAviationProduct),
|
|
9706
9449
|
initialCancelSigmet: selectedAviationProduct !== undefined && isInstanceOfCancelSigmet(selectedAviationProduct) ? selectedAviationProduct : null,
|
|
9707
9450
|
productConfig: aviationConfig,
|
|
9708
9451
|
product: selectedAviationProduct,
|
|
@@ -9733,7 +9476,7 @@ var Form = function Form(_ref5) {
|
|
|
9733
9476
|
size: {
|
|
9734
9477
|
xs: 12
|
|
9735
9478
|
},
|
|
9736
|
-
children: jsx(Phenomenon
|
|
9479
|
+
children: jsx(Phenomenon, {
|
|
9737
9480
|
isDisabled: areFieldsDisabled,
|
|
9738
9481
|
isReadOnly: isReadOnly
|
|
9739
9482
|
})
|
|
@@ -10736,6 +10479,21 @@ var AreaObjectLoaderConnect = function AreaObjectLoaderConnect(_ref) {
|
|
|
10736
10479
|
* */
|
|
10737
10480
|
var transformAirmetToWarningFormat = function transformAirmetToWarningFormat(apiAirmet) {
|
|
10738
10481
|
var airmet = apiAirmet.airmet;
|
|
10482
|
+
var areas = [];
|
|
10483
|
+
if (airmet.startGeometry) {
|
|
10484
|
+
areas.push({
|
|
10485
|
+
geoJSON: Object.assign({}, airmet.startGeometry, {
|
|
10486
|
+
features: airmet.startGeometry.features.map(function (feature) {
|
|
10487
|
+
return Object.assign({}, feature, {
|
|
10488
|
+
properties: Object.assign({}, feature.properties, {
|
|
10489
|
+
isStartGeometry: true
|
|
10490
|
+
})
|
|
10491
|
+
});
|
|
10492
|
+
})
|
|
10493
|
+
}),
|
|
10494
|
+
objectName: airmet.locationIndicatorATSR
|
|
10495
|
+
});
|
|
10496
|
+
}
|
|
10739
10497
|
return {
|
|
10740
10498
|
id: apiAirmet.uuid,
|
|
10741
10499
|
lastUpdatedTime: apiAirmet.lastUpdateDate,
|
|
@@ -10743,10 +10501,7 @@ var transformAirmetToWarningFormat = function transformAirmetToWarningFormat(api
|
|
|
10743
10501
|
warningDetail: {
|
|
10744
10502
|
descriptionOriginal: '',
|
|
10745
10503
|
descriptionTranslation: '',
|
|
10746
|
-
areas:
|
|
10747
|
-
geoJSON: airmet.startGeometry,
|
|
10748
|
-
objectName: airmet.locationIndicatorATSR
|
|
10749
|
-
}],
|
|
10504
|
+
areas: areas,
|
|
10750
10505
|
phenomenon: airmet.phenomenon,
|
|
10751
10506
|
validFrom: airmet.validDateStart,
|
|
10752
10507
|
validUntil: airmet.validDateEnd,
|
|
@@ -10759,6 +10514,37 @@ var transformAirmetToWarningFormat = function transformAirmetToWarningFormat(api
|
|
|
10759
10514
|
};
|
|
10760
10515
|
var transformSigmetToWarningFormat = function transformSigmetToWarningFormat(apiSigmet) {
|
|
10761
10516
|
var sigmet = apiSigmet.sigmet;
|
|
10517
|
+
var areas = [];
|
|
10518
|
+
if (sigmet.startGeometry) {
|
|
10519
|
+
areas.push({
|
|
10520
|
+
areaId: sigmet.uuid + "-start",
|
|
10521
|
+
geoJSON: Object.assign({}, sigmet.startGeometry, {
|
|
10522
|
+
features: sigmet.startGeometry.features.map(function (feature) {
|
|
10523
|
+
return Object.assign({}, feature, {
|
|
10524
|
+
properties: Object.assign({}, feature.properties, {
|
|
10525
|
+
isStartGeometry: true
|
|
10526
|
+
})
|
|
10527
|
+
});
|
|
10528
|
+
})
|
|
10529
|
+
}),
|
|
10530
|
+
objectName: sigmet.locationIndicatorATSR
|
|
10531
|
+
});
|
|
10532
|
+
}
|
|
10533
|
+
if (sigmet.endGeometry) {
|
|
10534
|
+
areas.push({
|
|
10535
|
+
areaId: sigmet.uuid + "-end",
|
|
10536
|
+
geoJSON: Object.assign({}, sigmet.endGeometry, {
|
|
10537
|
+
features: sigmet.endGeometry.features.map(function (feature) {
|
|
10538
|
+
return Object.assign({}, feature, {
|
|
10539
|
+
properties: Object.assign({}, feature.properties, {
|
|
10540
|
+
isStartGeometry: false
|
|
10541
|
+
})
|
|
10542
|
+
});
|
|
10543
|
+
})
|
|
10544
|
+
}),
|
|
10545
|
+
objectName: sigmet.locationIndicatorATSR
|
|
10546
|
+
});
|
|
10547
|
+
}
|
|
10762
10548
|
return {
|
|
10763
10549
|
id: apiSigmet.uuid,
|
|
10764
10550
|
lastUpdatedTime: apiSigmet.lastUpdateDate,
|
|
@@ -10766,10 +10552,7 @@ var transformSigmetToWarningFormat = function transformSigmetToWarningFormat(api
|
|
|
10766
10552
|
warningDetail: {
|
|
10767
10553
|
descriptionOriginal: '',
|
|
10768
10554
|
descriptionTranslation: '',
|
|
10769
|
-
areas:
|
|
10770
|
-
geoJSON: sigmet.startGeometry,
|
|
10771
|
-
objectName: sigmet.locationIndicatorATSR
|
|
10772
|
-
}],
|
|
10555
|
+
areas: areas,
|
|
10773
10556
|
phenomenon: sigmet.phenomenon,
|
|
10774
10557
|
validFrom: sigmet.validDateStart,
|
|
10775
10558
|
validUntil: sigmet.validDateEnd,
|
|
@@ -10888,10 +10671,10 @@ var transformAirmetToProductFormat = function transformAirmetToProductFormat(war
|
|
|
10888
10671
|
cloudLevel: airmet.cloudLevel,
|
|
10889
10672
|
cloudLowerLevel: airmet.cloudLowerLevel
|
|
10890
10673
|
}, isInstanceOfCancelAirmet(airmet) && {
|
|
10891
|
-
|
|
10892
|
-
},
|
|
10674
|
+
cancelsAirmetSequenceId: cancelAirmet.cancelsAirmetSequenceId
|
|
10675
|
+
}, isInstanceOfCancelAirmet(airmet) && {
|
|
10893
10676
|
validDateStartOfAirmetToCancel: cancelAirmet.validDateStartOfAirmetToCancel
|
|
10894
|
-
},
|
|
10677
|
+
}, isInstanceOfCancelAirmet(airmet) && {
|
|
10895
10678
|
validDateEndOfAirmetToCancel: cancelAirmet.validDateEndOfAirmetToCancel
|
|
10896
10679
|
});
|
|
10897
10680
|
};
|
|
@@ -11205,230 +10988,6 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
11205
10988
|
});
|
|
11206
10989
|
};
|
|
11207
10990
|
|
|
11208
|
-
var actionButton = function actionButton(amount) {
|
|
11209
|
-
return jsxs(Grid2, {
|
|
11210
|
-
container: true,
|
|
11211
|
-
alignItems: "center",
|
|
11212
|
-
style: {
|
|
11213
|
-
marginRight: '8px',
|
|
11214
|
-
minWidth: '36px'
|
|
11215
|
-
},
|
|
11216
|
-
children: [jsx(Options, {}), jsx(Typography, {
|
|
11217
|
-
variant: "body2",
|
|
11218
|
-
sx: {
|
|
11219
|
-
paddingLeft: 0.5
|
|
11220
|
-
},
|
|
11221
|
-
children: amount > 0 && amount
|
|
11222
|
-
})]
|
|
11223
|
-
});
|
|
11224
|
-
};
|
|
11225
|
-
var FilterChipWithOptions = function FilterChipWithOptions(_ref) {
|
|
11226
|
-
var id = _ref.id,
|
|
11227
|
-
translationKey = _ref.translationKey,
|
|
11228
|
-
handleClick = _ref.handleClick,
|
|
11229
|
-
_ref$filterList = _ref.filterList,
|
|
11230
|
-
filterList = _ref$filterList === void 0 ? [] : _ref$filterList;
|
|
11231
|
-
var _useWarningsTranslati = useWarningsTranslation(),
|
|
11232
|
-
t = _useWarningsTranslati.t;
|
|
11233
|
-
var _React$useState = React.useState(undefined),
|
|
11234
|
-
anchorEl = _React$useState[0],
|
|
11235
|
-
setAnchorEl = _React$useState[1];
|
|
11236
|
-
var _React$useState2 = React.useState(false),
|
|
11237
|
-
isOpen = _React$useState2[0],
|
|
11238
|
-
setIsOpen = _React$useState2[1];
|
|
11239
|
-
var _getPosition = getPosition('bottom'),
|
|
11240
|
-
anchorOrigin = _getPosition.anchorOrigin,
|
|
11241
|
-
transformOrigin = _getPosition.transformOrigin;
|
|
11242
|
-
var initialResult = {
|
|
11243
|
-
isAllSelected: true,
|
|
11244
|
-
selectedFiltersAmount: 0,
|
|
11245
|
-
isDisabled: false
|
|
11246
|
-
};
|
|
11247
|
-
var _filterList$reduce = filterList.reduce(function (accumulatedResult, filterItem) {
|
|
11248
|
-
var result = Object.assign({}, accumulatedResult);
|
|
11249
|
-
var isEmptyFilter = filterItem.filter.id === emptyFilter.id;
|
|
11250
|
-
var isOnlyFilter = filterList.length === 1 && isEmptyFilter;
|
|
11251
|
-
if (!filterItem.filter.checked) {
|
|
11252
|
-
result.isAllSelected = false;
|
|
11253
|
-
if (isOnlyFilter) {
|
|
11254
|
-
result.isDisabled = true;
|
|
11255
|
-
}
|
|
11256
|
-
} else if (isOnlyFilter) {
|
|
11257
|
-
result.isDisabled = true;
|
|
11258
|
-
} else {
|
|
11259
|
-
result.selectedFiltersAmount += 1;
|
|
11260
|
-
}
|
|
11261
|
-
return result;
|
|
11262
|
-
}, initialResult),
|
|
11263
|
-
isAllSelected = _filterList$reduce.isAllSelected,
|
|
11264
|
-
selectedFiltersAmount = _filterList$reduce.selectedFiltersAmount,
|
|
11265
|
-
isDisabled = _filterList$reduce.isDisabled;
|
|
11266
|
-
var isAnyFilterSelected = selectedFiltersAmount > 0;
|
|
11267
|
-
var showDisabled = filterList.length === 0 || isDisabled;
|
|
11268
|
-
var label = t(translationKey);
|
|
11269
|
-
var onClickOptions = function onClickOptions() {
|
|
11270
|
-
setIsOpen(!isOpen);
|
|
11271
|
-
};
|
|
11272
|
-
var onSelectAll = function onSelectAll() {
|
|
11273
|
-
handleClick && handleClick(id, isAllSelected);
|
|
11274
|
-
};
|
|
11275
|
-
var handleClose = function handleClose(event) {
|
|
11276
|
-
event.stopPropagation();
|
|
11277
|
-
setIsOpen(false);
|
|
11278
|
-
};
|
|
11279
|
-
React.useEffect(function () {
|
|
11280
|
-
setAnchorEl(document.getElementById(id));
|
|
11281
|
-
}, [id]);
|
|
11282
|
-
return jsxs(Fragment, {
|
|
11283
|
-
children: [jsx(CustomTooltip, {
|
|
11284
|
-
title: showDisabled ? t('filter-no-results') : t('filter-options'),
|
|
11285
|
-
placement: "bottom",
|
|
11286
|
-
children: jsx("span", {
|
|
11287
|
-
style: {
|
|
11288
|
-
margin: 0
|
|
11289
|
-
},
|
|
11290
|
-
children: jsx(FilterChip, {
|
|
11291
|
-
id: id,
|
|
11292
|
-
label: label,
|
|
11293
|
-
actionIcon: actionButton(selectedFiltersAmount),
|
|
11294
|
-
isSelected: isAnyFilterSelected,
|
|
11295
|
-
handleClick: onClickOptions,
|
|
11296
|
-
isDisabled: showDisabled,
|
|
11297
|
-
size: "medium"
|
|
11298
|
-
})
|
|
11299
|
-
})
|
|
11300
|
-
}), jsxs(Menu, {
|
|
11301
|
-
title: label,
|
|
11302
|
-
anchorEl: anchorEl,
|
|
11303
|
-
open: isOpen,
|
|
11304
|
-
onClose: handleClose,
|
|
11305
|
-
anchorOrigin: anchorOrigin,
|
|
11306
|
-
transformOrigin: transformOrigin,
|
|
11307
|
-
BackdropProps: {
|
|
11308
|
-
style: {
|
|
11309
|
-
opacity: 0,
|
|
11310
|
-
transition: 'none'
|
|
11311
|
-
}
|
|
11312
|
-
},
|
|
11313
|
-
sx: {
|
|
11314
|
-
padding: 3
|
|
11315
|
-
},
|
|
11316
|
-
children: [jsxs(DialogTitle, {
|
|
11317
|
-
id: "dialog-title",
|
|
11318
|
-
sx: {
|
|
11319
|
-
zIndex: 1,
|
|
11320
|
-
padding: '8px 18px 16px 24px',
|
|
11321
|
-
display: 'flex',
|
|
11322
|
-
justifyContent: 'space-between',
|
|
11323
|
-
alignItems: 'center'
|
|
11324
|
-
},
|
|
11325
|
-
children: [jsx(Typography, {
|
|
11326
|
-
sx: {
|
|
11327
|
-
fontSize: '20px',
|
|
11328
|
-
fontWeight: 500,
|
|
11329
|
-
paddingRight: 1
|
|
11330
|
-
},
|
|
11331
|
-
"data-testid": "customDialog-title",
|
|
11332
|
-
component: "span",
|
|
11333
|
-
children: label
|
|
11334
|
-
}), jsx(CustomIconButton, {
|
|
11335
|
-
"aria-label": t('close-dialog-confirm'),
|
|
11336
|
-
onClick: handleClose,
|
|
11337
|
-
sx: {
|
|
11338
|
-
'&.MuiIconButton-root': {
|
|
11339
|
-
color: 'geowebColors.greys.accessible'
|
|
11340
|
-
}
|
|
11341
|
-
},
|
|
11342
|
-
children: jsx(Close, {})
|
|
11343
|
-
})]
|
|
11344
|
-
}), jsxs(DialogContent, {
|
|
11345
|
-
sx: {
|
|
11346
|
-
padding: '0px 24px 16px 24px'
|
|
11347
|
-
},
|
|
11348
|
-
children: [jsxs(Grid2, {
|
|
11349
|
-
container: true,
|
|
11350
|
-
justifyContent: "space-between",
|
|
11351
|
-
alignItems: "center",
|
|
11352
|
-
children: [t('filter-select-all'), jsx(Switch, {
|
|
11353
|
-
inputProps: {
|
|
11354
|
-
'aria-label': t('filter-select-all')
|
|
11355
|
-
},
|
|
11356
|
-
checked: isAllSelected,
|
|
11357
|
-
onChange: onSelectAll,
|
|
11358
|
-
sx: {
|
|
11359
|
-
marginRight: '-12px'
|
|
11360
|
-
}
|
|
11361
|
-
})]
|
|
11362
|
-
}), jsx(Box, {
|
|
11363
|
-
sx: {
|
|
11364
|
-
marginLeft: '-12px'
|
|
11365
|
-
},
|
|
11366
|
-
children: filterList.map(function (filterItem) {
|
|
11367
|
-
switch (id) {
|
|
11368
|
-
case 'phenomenon':
|
|
11369
|
-
{
|
|
11370
|
-
var icon = getWarningPhenomenaIcon(filterItem.filter.id);
|
|
11371
|
-
return jsxs(FilterListItem, Object.assign({}, filterItem, {
|
|
11372
|
-
children: [icon && jsx(Box, {
|
|
11373
|
-
"data-testid": "icon-" + filterItem.filter.id,
|
|
11374
|
-
sx: {
|
|
11375
|
-
marginRight: 1
|
|
11376
|
-
},
|
|
11377
|
-
children: icon
|
|
11378
|
-
}), jsx(FilterLabel, {
|
|
11379
|
-
name: filterItem.filter.name
|
|
11380
|
-
})]
|
|
11381
|
-
}), filterItem.filter.id);
|
|
11382
|
-
}
|
|
11383
|
-
default:
|
|
11384
|
-
{
|
|
11385
|
-
return jsx(FilterListItem, Object.assign({}, filterItem), filterItem.filter.id);
|
|
11386
|
-
}
|
|
11387
|
-
}
|
|
11388
|
-
})
|
|
11389
|
-
})]
|
|
11390
|
-
})]
|
|
11391
|
-
})]
|
|
11392
|
-
});
|
|
11393
|
-
};
|
|
11394
|
-
|
|
11395
|
-
var FilterChipWithOptionsConnect = function FilterChipWithOptionsConnect(_ref) {
|
|
11396
|
-
var filter = _ref.filter;
|
|
11397
|
-
var dispatch = useDispatch();
|
|
11398
|
-
var toggleFilter = React.useCallback(function (filterId, isChecked) {
|
|
11399
|
-
dispatch(publicWarningActions.toggleFilter({
|
|
11400
|
-
filterId: filterId,
|
|
11401
|
-
isChecked: isChecked
|
|
11402
|
-
}));
|
|
11403
|
-
}, [dispatch]);
|
|
11404
|
-
var toggleOption = React.useCallback(function (filterId, optionId) {
|
|
11405
|
-
dispatch(publicWarningActions.toggleOption({
|
|
11406
|
-
filterId: filterId,
|
|
11407
|
-
optionId: optionId
|
|
11408
|
-
}));
|
|
11409
|
-
}, [dispatch]);
|
|
11410
|
-
var enableOnlyOneFilterOption = React.useCallback(function (filterId, optionId) {
|
|
11411
|
-
dispatch(publicWarningActions.enableOnlyOneFilterOption({
|
|
11412
|
-
filterId: filterId,
|
|
11413
|
-
optionId: optionId
|
|
11414
|
-
}));
|
|
11415
|
-
}, [dispatch]);
|
|
11416
|
-
var filterListWithActions = filter.filterList.map(function (option) {
|
|
11417
|
-
return Object.assign({}, option, {
|
|
11418
|
-
toggleFilter: function toggleFilter() {
|
|
11419
|
-
return toggleOption(filter.id, option.filter.id);
|
|
11420
|
-
},
|
|
11421
|
-
enableOnlyOneFilter: function enableOnlyOneFilter() {
|
|
11422
|
-
return enableOnlyOneFilterOption(filter.id, option.filter.id);
|
|
11423
|
-
}
|
|
11424
|
-
});
|
|
11425
|
-
});
|
|
11426
|
-
return jsx(FilterChipWithOptions, Object.assign({}, filter, {
|
|
11427
|
-
handleClick: toggleFilter,
|
|
11428
|
-
filterList: filterListWithActions
|
|
11429
|
-
}));
|
|
11430
|
-
};
|
|
11431
|
-
|
|
11432
10991
|
/* *
|
|
11433
10992
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11434
10993
|
* you may not use this file except in compliance with the License.
|
|
@@ -11523,113 +11082,18 @@ function useOverflowCheck(text) {
|
|
|
11523
11082
|
};
|
|
11524
11083
|
}
|
|
11525
11084
|
var getTranslationKey = function getTranslationKey(optionId, id) {
|
|
11085
|
+
if (id === 'source' || id === 'incident') {
|
|
11086
|
+
if (optionId === emptyFilterId) {
|
|
11087
|
+
return "warning-unspecified";
|
|
11088
|
+
}
|
|
11089
|
+
return optionId;
|
|
11090
|
+
}
|
|
11526
11091
|
var phenomena = warningPhenomena.find(function (phenomenon) {
|
|
11527
11092
|
return phenomenon.key === optionId;
|
|
11528
11093
|
});
|
|
11529
11094
|
return phenomena ? phenomena.translationKey : "warning-" + id + "-" + optionId;
|
|
11530
11095
|
};
|
|
11531
11096
|
|
|
11532
|
-
/* *
|
|
11533
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11534
|
-
* you may not use this file except in compliance with the License.
|
|
11535
|
-
* You may obtain a copy of the License at
|
|
11536
|
-
*
|
|
11537
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
11538
|
-
*
|
|
11539
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11540
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
11541
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11542
|
-
* See the License for the specific language governing permissions and
|
|
11543
|
-
* limitations under the License.
|
|
11544
|
-
*
|
|
11545
|
-
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
11546
|
-
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
11547
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
11548
|
-
* */
|
|
11549
|
-
var Domain;
|
|
11550
|
-
(function (Domain) {
|
|
11551
|
-
Domain["aviation"] = "aviation";
|
|
11552
|
-
Domain["maritime"] = "maritime";
|
|
11553
|
-
Domain["public"] = "public";
|
|
11554
|
-
})(Domain || (Domain = {}));
|
|
11555
|
-
var Level;
|
|
11556
|
-
(function (Level) {
|
|
11557
|
-
Level["extreme"] = "extreme";
|
|
11558
|
-
Level["moderate"] = "moderate";
|
|
11559
|
-
Level["severe"] = "severe";
|
|
11560
|
-
Level["airmet"] = "AIR";
|
|
11561
|
-
Level["sigmet"] = "SIG";
|
|
11562
|
-
})(Level || (Level = {}));
|
|
11563
|
-
var Phenomenon;
|
|
11564
|
-
(function (Phenomenon) {
|
|
11565
|
-
Phenomenon["wind"] = "wind";
|
|
11566
|
-
Phenomenon["fog"] = "fog";
|
|
11567
|
-
Phenomenon["thunderstorm"] = "thunderstorm";
|
|
11568
|
-
Phenomenon["snowIce"] = "snowIce";
|
|
11569
|
-
Phenomenon["rain"] = "rain";
|
|
11570
|
-
Phenomenon["highTemp"] = "highTemp";
|
|
11571
|
-
Phenomenon["lowTemp"] = "lowTemp";
|
|
11572
|
-
Phenomenon["coastalEvent"] = "coastalEvent";
|
|
11573
|
-
})(Phenomenon || (Phenomenon = {}));
|
|
11574
|
-
var defaultDomainFilter = {
|
|
11575
|
-
aviation: false,
|
|
11576
|
-
maritime: false,
|
|
11577
|
-
"public": true
|
|
11578
|
-
};
|
|
11579
|
-
var domainLevels = {
|
|
11580
|
-
aviation: [Level.airmet, Level.sigmet],
|
|
11581
|
-
maritime: [],
|
|
11582
|
-
"public": [Level.extreme, Level.moderate, Level.severe]
|
|
11583
|
-
};
|
|
11584
|
-
var defaultLevelFilter = {
|
|
11585
|
-
unspecified: true,
|
|
11586
|
-
extreme: true,
|
|
11587
|
-
moderate: true,
|
|
11588
|
-
severe: true,
|
|
11589
|
-
AIR: true,
|
|
11590
|
-
SIG: true
|
|
11591
|
-
};
|
|
11592
|
-
var defaultPhenomenonFilter = {
|
|
11593
|
-
unspecified: true,
|
|
11594
|
-
coastalEvent: true,
|
|
11595
|
-
fog: true,
|
|
11596
|
-
highTemp: true,
|
|
11597
|
-
lowTemp: true,
|
|
11598
|
-
rain: true,
|
|
11599
|
-
snowIce: true,
|
|
11600
|
-
thunderstorm: true,
|
|
11601
|
-
wind: true
|
|
11602
|
-
};
|
|
11603
|
-
var useSelectedOptions = function useSelectedOptions(options) {
|
|
11604
|
-
var selectedOptions = Object.keys(options).filter(function (k) {
|
|
11605
|
-
return options[k];
|
|
11606
|
-
});
|
|
11607
|
-
var allSelected = selectedOptions.length === Object.keys(options).length;
|
|
11608
|
-
return {
|
|
11609
|
-
noSelectedOptions: selectedOptions.length,
|
|
11610
|
-
allSelected: allSelected
|
|
11611
|
-
};
|
|
11612
|
-
};
|
|
11613
|
-
var updateState = function updateState(state, optionKey, value, only) {
|
|
11614
|
-
var _Object$assign3;
|
|
11615
|
-
if (only) {
|
|
11616
|
-
return Object.keys(state).reduce(function (acc, k) {
|
|
11617
|
-
var _Object$assign;
|
|
11618
|
-
return Object.assign({}, acc, (_Object$assign = {}, _Object$assign[k] = k === optionKey, _Object$assign));
|
|
11619
|
-
}, {});
|
|
11620
|
-
}
|
|
11621
|
-
return optionKey === 'ALL' ? Object.keys(state).reduce(function (acc, k) {
|
|
11622
|
-
var _Object$assign2;
|
|
11623
|
-
return Object.assign({}, acc, (_Object$assign2 = {}, _Object$assign2[k] = value, _Object$assign2));
|
|
11624
|
-
}, {}) : Object.assign({}, state, (_Object$assign3 = {}, _Object$assign3[optionKey] = value, _Object$assign3));
|
|
11625
|
-
};
|
|
11626
|
-
/** Make sure our value is in the filter */
|
|
11627
|
-
var getValue = function getValue(values, value) {
|
|
11628
|
-
return Object.values(values).find(function (v) {
|
|
11629
|
-
return v === value;
|
|
11630
|
-
}) || 'unspecified';
|
|
11631
|
-
};
|
|
11632
|
-
|
|
11633
11097
|
var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
|
|
11634
11098
|
var id = _ref.id,
|
|
11635
11099
|
options = _ref.options,
|
|
@@ -11642,9 +11106,10 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
|
|
|
11642
11106
|
var _useSelectedOptions = useSelectedOptions(options),
|
|
11643
11107
|
noSelectedOptions = _useSelectedOptions.noSelectedOptions,
|
|
11644
11108
|
allSelected = _useSelectedOptions.allSelected;
|
|
11109
|
+
var isDisabled = Object.keys(options).length < 2;
|
|
11645
11110
|
return jsxs(Fragment, {
|
|
11646
11111
|
children: [jsx(CustomTooltip, {
|
|
11647
|
-
title: t('filter-options'),
|
|
11112
|
+
title: isDisabled ? t('filter-no-results') : t('filter-options'),
|
|
11648
11113
|
placement: "bottom",
|
|
11649
11114
|
children: jsx("span", {
|
|
11650
11115
|
style: {
|
|
@@ -11653,11 +11118,11 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
|
|
|
11653
11118
|
children: jsx(FilterChip, {
|
|
11654
11119
|
id: id,
|
|
11655
11120
|
label: t("filter-" + id),
|
|
11656
|
-
isSelected: noSelectedOptions > 0,
|
|
11121
|
+
isSelected: !isDisabled && noSelectedOptions > 0,
|
|
11657
11122
|
onClick: function onClick(ref) {
|
|
11658
11123
|
return setAnchorEl(ref);
|
|
11659
11124
|
},
|
|
11660
|
-
isDisabled:
|
|
11125
|
+
isDisabled: isDisabled,
|
|
11661
11126
|
size: "medium",
|
|
11662
11127
|
actionIcon: jsxs(Grid2, {
|
|
11663
11128
|
container: true,
|
|
@@ -11671,7 +11136,7 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
|
|
|
11671
11136
|
sx: {
|
|
11672
11137
|
paddingLeft: 0.5
|
|
11673
11138
|
},
|
|
11674
|
-
children: noSelectedOptions > 0 && noSelectedOptions
|
|
11139
|
+
children: !isDisabled && noSelectedOptions > 0 && noSelectedOptions
|
|
11675
11140
|
})]
|
|
11676
11141
|
})
|
|
11677
11142
|
})
|
|
@@ -11743,8 +11208,27 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
|
|
|
11743
11208
|
marginTop: '-6px'
|
|
11744
11209
|
}
|
|
11745
11210
|
})]
|
|
11746
|
-
}),
|
|
11747
|
-
children:
|
|
11211
|
+
}), jsxs(Box, {
|
|
11212
|
+
children: [options[emptyFilterId] !== undefined && jsx(FilterOption, {
|
|
11213
|
+
optionId: emptyFilterId,
|
|
11214
|
+
checked: options[emptyFilterId],
|
|
11215
|
+
onClick: function onClick(checked, only) {
|
|
11216
|
+
return updateFilter(id, emptyFilterId, checked, only);
|
|
11217
|
+
},
|
|
11218
|
+
labelStyle: {
|
|
11219
|
+
width: 'fit-content',
|
|
11220
|
+
fontSize: '16px',
|
|
11221
|
+
display: 'flex',
|
|
11222
|
+
alignItems: 'center',
|
|
11223
|
+
gap: 1
|
|
11224
|
+
},
|
|
11225
|
+
label: jsx(Fragment, {
|
|
11226
|
+
children: t(getTranslationKey(emptyFilterId, id))
|
|
11227
|
+
})
|
|
11228
|
+
}, id + "-" + emptyFilterId), Object.keys(options).map(function (optionId) {
|
|
11229
|
+
if (optionId === emptyFilterId) {
|
|
11230
|
+
return null;
|
|
11231
|
+
}
|
|
11748
11232
|
var warningColor = warningColors[optionId];
|
|
11749
11233
|
return jsx(FilterOption, {
|
|
11750
11234
|
optionId: optionId,
|
|
@@ -11763,7 +11247,7 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
|
|
|
11763
11247
|
children: [getWarningPhenomenaIcon(optionId), ' ', t(getTranslationKey(optionId, id))]
|
|
11764
11248
|
})
|
|
11765
11249
|
}, id + "-" + optionId);
|
|
11766
|
-
})
|
|
11250
|
+
})]
|
|
11767
11251
|
})]
|
|
11768
11252
|
})]
|
|
11769
11253
|
})]
|
|
@@ -11771,9 +11255,7 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
|
|
|
11771
11255
|
};
|
|
11772
11256
|
|
|
11773
11257
|
var FilterList = function FilterList(_ref) {
|
|
11774
|
-
var _ref$
|
|
11775
|
-
filters = _ref$filters === void 0 ? [] : _ref$filters,
|
|
11776
|
-
_ref$onClickAll = _ref.onClickAll,
|
|
11258
|
+
var _ref$onClickAll = _ref.onClickAll,
|
|
11777
11259
|
onClickAll = _ref$onClickAll === void 0 ? function () {} : _ref$onClickAll,
|
|
11778
11260
|
_ref$isAllSelected = _ref.isAllSelected,
|
|
11779
11261
|
isAllSelected = _ref$isAllSelected === void 0 ? true : _ref$isAllSelected,
|
|
@@ -11809,10 +11291,6 @@ var FilterList = function FilterList(_ref) {
|
|
|
11809
11291
|
size: "medium"
|
|
11810
11292
|
})
|
|
11811
11293
|
})
|
|
11812
|
-
}), filters.map(function (filter) {
|
|
11813
|
-
return jsx(FilterChipWithOptionsConnect, {
|
|
11814
|
-
filter: filter
|
|
11815
|
-
}, filter.id);
|
|
11816
11294
|
}), Object.keys(filterState).map(function (filterId) {
|
|
11817
11295
|
return jsx(ExpandableFilterChip, {
|
|
11818
11296
|
id: filterId,
|
|
@@ -11992,7 +11470,7 @@ var WarningListItemMenu = function WarningListItemMenu(_ref) {
|
|
|
11992
11470
|
}
|
|
11993
11471
|
};
|
|
11994
11472
|
|
|
11995
|
-
var _excluded$2 = ["warning", "activeWarningId", "onSelectWarning", "onEditWarning", "onDeleteWarning", "onDeleteReviewWarning", "onExpireWarning", "onWithdrawWarning"];
|
|
11473
|
+
var _excluded$2 = ["warning", "activeWarningId", "highlightedItem", "onSelectWarning", "onEditWarning", "onDeleteWarning", "onDeleteReviewWarning", "onExpireWarning", "onWithdrawWarning"];
|
|
11996
11474
|
var renderLevelText = function renderLevelText(levelString) {
|
|
11997
11475
|
if (!levelString) {
|
|
11998
11476
|
return null;
|
|
@@ -12066,6 +11544,7 @@ var WarningListItem = function WarningListItem(_ref) {
|
|
|
12066
11544
|
var _warning$warningDetai, _sx, _sx2, _Object$assign;
|
|
12067
11545
|
var warning = _ref.warning,
|
|
12068
11546
|
activeWarningId = _ref.activeWarningId,
|
|
11547
|
+
highlightedItem = _ref.highlightedItem,
|
|
12069
11548
|
_ref$onSelectWarning = _ref.onSelectWarning,
|
|
12070
11549
|
onSelectWarning = _ref$onSelectWarning === void 0 ? function () {} : _ref$onSelectWarning,
|
|
12071
11550
|
_ref$onEditWarning = _ref.onEditWarning,
|
|
@@ -12099,12 +11578,21 @@ var WarningListItem = function WarningListItem(_ref) {
|
|
|
12099
11578
|
}
|
|
12100
11579
|
return t(levelTranslation);
|
|
12101
11580
|
}, [levelTranslation, t]);
|
|
11581
|
+
var backgroundColor = React__default.useMemo(function () {
|
|
11582
|
+
if (highlightedItem) {
|
|
11583
|
+
return 'geowebColors.cards.cardContainerMouseOver';
|
|
11584
|
+
}
|
|
11585
|
+
if (status === PublicWarningStatus.EXPIRED || status === PublicWarningStatus.WITHDRAWN) {
|
|
11586
|
+
return 'geowebColors.cards.cardContainerDisabled';
|
|
11587
|
+
}
|
|
11588
|
+
return 'geowebColors.cards.cardContainer';
|
|
11589
|
+
}, [highlightedItem, status]);
|
|
12102
11590
|
return jsx(ListItem, Object.assign({
|
|
12103
11591
|
sx: {
|
|
12104
11592
|
marginBottom: 0.25,
|
|
12105
11593
|
minHeight: '32px',
|
|
12106
11594
|
padding: '0 0',
|
|
12107
|
-
backgroundColor:
|
|
11595
|
+
backgroundColor: backgroundColor,
|
|
12108
11596
|
borderColor: status === PublicWarningStatus.EXPIRED || status === PublicWarningStatus.WITHDRAWN ? 'geowebColors.cards.cardContainerDisabledBorder' : 'geowebColors.cards.cardContainerBorder',
|
|
12109
11597
|
borderRadius: 1,
|
|
12110
11598
|
borderWidth: activeWarningId === warning.id ? '1px' : '1px',
|
|
@@ -12500,7 +11988,6 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
12500
11988
|
var _sx, _sx2, _sx3;
|
|
12501
11989
|
var _ref$warnings = _ref.warnings,
|
|
12502
11990
|
warnings = _ref$warnings === void 0 ? [] : _ref$warnings,
|
|
12503
|
-
filters = _ref.filters,
|
|
12504
11991
|
filterHookState = _ref.filterHookState,
|
|
12505
11992
|
_ref$isLoading = _ref.isLoading,
|
|
12506
11993
|
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
@@ -12524,10 +12011,7 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
12524
12011
|
onExpireWarning = _ref$onExpireWarning === void 0 ? function () {} : _ref$onExpireWarning,
|
|
12525
12012
|
_ref$onWithdrawWarnin = _ref.onWithdrawWarning,
|
|
12526
12013
|
onWithdrawWarning = _ref$onWithdrawWarnin === void 0 ? function () {} : _ref$onWithdrawWarnin,
|
|
12527
|
-
|
|
12528
|
-
onClickAllChip = _ref$onClickAllChip === void 0 ? function () {} : _ref$onClickAllChip,
|
|
12529
|
-
_ref$isAllChipSelecte = _ref.isAllChipSelected,
|
|
12530
|
-
isAllChipSelected = _ref$isAllChipSelecte === void 0 ? true : _ref$isAllChipSelecte,
|
|
12014
|
+
hoveredFeatureId = _ref.hoveredFeatureId,
|
|
12531
12015
|
expandedSections = _ref.expandedSections,
|
|
12532
12016
|
setExpandedSections = _ref.setExpandedSections;
|
|
12533
12017
|
var filterState = filterHookState.filterState,
|
|
@@ -12542,7 +12026,6 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
12542
12026
|
sortState = _React$useState[0],
|
|
12543
12027
|
setSortState = _React$useState[1];
|
|
12544
12028
|
var onClickAll = function onClickAll(isChecked) {
|
|
12545
|
-
onClickAllChip(isChecked);
|
|
12546
12029
|
updateFilter('ALL', 'ALL', !isChecked);
|
|
12547
12030
|
};
|
|
12548
12031
|
var sortedWarnings = React__default.useMemo(function () {
|
|
@@ -12561,19 +12044,21 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
12561
12044
|
setExpandedSections(Object.assign({}, expandedSections, (_Object$assign = {}, _Object$assign[status] = shouldToggle, _Object$assign)));
|
|
12562
12045
|
resetListIndex();
|
|
12563
12046
|
};
|
|
12564
|
-
var items =
|
|
12565
|
-
|
|
12566
|
-
|
|
12567
|
-
|
|
12568
|
-
|
|
12569
|
-
|
|
12570
|
-
|
|
12571
|
-
|
|
12572
|
-
|
|
12573
|
-
|
|
12574
|
-
|
|
12575
|
-
|
|
12576
|
-
|
|
12047
|
+
var items = React__default.useMemo(function () {
|
|
12048
|
+
return [{
|
|
12049
|
+
status: PublicWarningStatus.TODO,
|
|
12050
|
+
totalWarnings: sortedWarnings.todo.length
|
|
12051
|
+
}].concat(expandedSections.TODO ? sortedWarnings.todo : [], [{
|
|
12052
|
+
status: PublicWarningStatus.DRAFT,
|
|
12053
|
+
totalWarnings: sortedWarnings.draft.length
|
|
12054
|
+
}], expandedSections.DRAFT ? sortedWarnings.draft : [], [{
|
|
12055
|
+
status: PublicWarningStatus.PUBLISHED,
|
|
12056
|
+
totalWarnings: sortedWarnings.published.length
|
|
12057
|
+
}], expandedSections.PUBLISHED ? sortedWarnings.published : [], [{
|
|
12058
|
+
status: PublicWarningStatus.EXPIRED,
|
|
12059
|
+
totalWarnings: sortedWarnings.expired.length
|
|
12060
|
+
}], expandedSections.EXPIRED ? sortedWarnings.expired : []);
|
|
12061
|
+
}, [sortedWarnings, expandedSections]);
|
|
12577
12062
|
var getItemSize = function getItemSize(index, width) {
|
|
12578
12063
|
var item = items[index];
|
|
12579
12064
|
if (item.totalWarnings !== undefined) {
|
|
@@ -12606,6 +12091,15 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
12606
12091
|
}
|
|
12607
12092
|
}, [warnings]);
|
|
12608
12093
|
var filterHeight = useGetFilterHeight(filterRef);
|
|
12094
|
+
React__default.useEffect(function () {
|
|
12095
|
+
if (hoveredFeatureId) {
|
|
12096
|
+
var _listRef$current;
|
|
12097
|
+
var index = items.findIndex(function (item) {
|
|
12098
|
+
return item.id === hoveredFeatureId;
|
|
12099
|
+
});
|
|
12100
|
+
(_listRef$current = listRef.current) == null || _listRef$current.scrollToItem(index, 'smart');
|
|
12101
|
+
}
|
|
12102
|
+
}, [hoveredFeatureId, items]);
|
|
12609
12103
|
return jsxs(Fragment, {
|
|
12610
12104
|
children: [isLoading && jsx(LinearProgress, {
|
|
12611
12105
|
"data-testid": "loading-bar",
|
|
@@ -12652,8 +12146,7 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
12652
12146
|
md: 8
|
|
12653
12147
|
},
|
|
12654
12148
|
children: jsx(FilterList, {
|
|
12655
|
-
|
|
12656
|
-
isAllSelected: allSelected && isAllChipSelected,
|
|
12149
|
+
isAllSelected: allSelected,
|
|
12657
12150
|
onClickAll: onClickAll,
|
|
12658
12151
|
filterState: filterState,
|
|
12659
12152
|
updateFilter: updateFilter
|
|
@@ -12796,9 +12289,11 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
12796
12289
|
}, key);
|
|
12797
12290
|
}
|
|
12798
12291
|
var publicWarning = warning;
|
|
12292
|
+
var highlightedItem = hoveredFeatureId === publicWarning.id;
|
|
12799
12293
|
return jsx(WarningListItem, {
|
|
12800
12294
|
style: style,
|
|
12801
12295
|
warning: publicWarning,
|
|
12296
|
+
highlightedItem: highlightedItem,
|
|
12802
12297
|
onSelectWarning: onSelectWarning,
|
|
12803
12298
|
onEditWarning: onEditWarning,
|
|
12804
12299
|
onDeleteWarning: onDeleteWarning,
|
|
@@ -12856,49 +12351,6 @@ var getPublicWarningsError = createSelector(getPublicWarningsStore, function (st
|
|
|
12856
12351
|
var getPublicWarningsLastUpdatedTime = createSelector(getPublicWarningsStore, function (store) {
|
|
12857
12352
|
return store == null ? void 0 : store.lastUpdatedTime;
|
|
12858
12353
|
});
|
|
12859
|
-
var _warningListFilterAda = warningListFilterAdapter.getSelectors(function (state) {
|
|
12860
|
-
var _state$publicWarnings3, _state$publicWarnings4;
|
|
12861
|
-
return (_state$publicWarnings3 = state == null || (_state$publicWarnings4 = state.publicWarnings) == null ? void 0 : _state$publicWarnings4.filters) != null ? _state$publicWarnings3 : {
|
|
12862
|
-
entities: {},
|
|
12863
|
-
ids: []
|
|
12864
|
-
};
|
|
12865
|
-
}),
|
|
12866
|
-
selectAllFilters = _warningListFilterAda.selectAll,
|
|
12867
|
-
selectAllFilterIds = _warningListFilterAda.selectIds;
|
|
12868
|
-
var getIsAllSelected = createSelector(selectAllFilters, function (filters) {
|
|
12869
|
-
var result = filters.findIndex(function (filter) {
|
|
12870
|
-
return filter.filterList.findIndex(function (option) {
|
|
12871
|
-
return option.filter.checked === false;
|
|
12872
|
-
}) !== -1;
|
|
12873
|
-
}) === -1;
|
|
12874
|
-
return result;
|
|
12875
|
-
});
|
|
12876
|
-
var getSelectedFilterOptions = createSelector(selectAllFilters, function (filters) {
|
|
12877
|
-
var selectedOptions = [];
|
|
12878
|
-
filters.forEach(function (filter) {
|
|
12879
|
-
filter.filterList.forEach(function (option) {
|
|
12880
|
-
if (option.filter.checked === true) {
|
|
12881
|
-
selectedOptions.push({
|
|
12882
|
-
filterId: filter.id,
|
|
12883
|
-
optionId: option.filter.id
|
|
12884
|
-
});
|
|
12885
|
-
}
|
|
12886
|
-
});
|
|
12887
|
-
});
|
|
12888
|
-
return selectedOptions;
|
|
12889
|
-
}, selectorMemoizationOptions);
|
|
12890
|
-
var getFilteredWarnings = createSelector(selectAllPublicWarnings, getIsAllSelected, getSelectedFilterOptions, selectAllFilterIds, function (warnings, isAllSelected, filters, filterIds) {
|
|
12891
|
-
if (isAllSelected) {
|
|
12892
|
-
return warnings;
|
|
12893
|
-
}
|
|
12894
|
-
var result = warnings.filter(function (_ref) {
|
|
12895
|
-
var warningDetail = _ref.warningDetail;
|
|
12896
|
-
return filterIds.every(function (key) {
|
|
12897
|
-
return isWarningMatchingFilter(filters, key, warningDetail[key]);
|
|
12898
|
-
});
|
|
12899
|
-
});
|
|
12900
|
-
return result;
|
|
12901
|
-
}, selectorMemoizationOptions);
|
|
12902
12354
|
|
|
12903
12355
|
var ConfirmDeleteWarningDialog = function ConfirmDeleteWarningDialog(_ref) {
|
|
12904
12356
|
var _ref$onClose = _ref.onClose,
|
|
@@ -12999,7 +12451,7 @@ var useFilter = function useFilter(defaultFilter, pickedOptions) {
|
|
|
12999
12451
|
var _useState = useState(defaultFilter),
|
|
13000
12452
|
filter = _useState[0],
|
|
13001
12453
|
setFilter = _useState[1];
|
|
13002
|
-
var pickedFilterOptions = pick(filter, [
|
|
12454
|
+
var pickedFilterOptions = pick(filter, [emptyFilterId].concat(pickedOptions));
|
|
13003
12455
|
var _useSelectedOptions = useSelectedOptions(pickedFilterOptions),
|
|
13004
12456
|
allSelected = _useSelectedOptions.allSelected;
|
|
13005
12457
|
return [pickedFilterOptions, setFilter, allSelected];
|
|
@@ -13015,7 +12467,7 @@ var useWarningFilters = function useWarningFilters(warnings) {
|
|
|
13015
12467
|
pickedLevelFilter = _useFilter[0],
|
|
13016
12468
|
setLevelFilter = _useFilter[1],
|
|
13017
12469
|
allLevelsSelected = _useFilter[2];
|
|
13018
|
-
var existingPhenomenon = Object.values(Phenomenon).filter(function (p) {
|
|
12470
|
+
var existingPhenomenon = Object.values(Phenomenon$1).filter(function (p) {
|
|
13019
12471
|
return warnings.find(function (w) {
|
|
13020
12472
|
return w.warningDetail.phenomenon === p;
|
|
13021
12473
|
});
|
|
@@ -13024,9 +12476,53 @@ var useWarningFilters = function useWarningFilters(warnings) {
|
|
|
13024
12476
|
pickedPhenomenonFilter = _useFilter2[0],
|
|
13025
12477
|
setPhenomenonFilter = _useFilter2[1],
|
|
13026
12478
|
allPhenomenonSelected = _useFilter2[2];
|
|
12479
|
+
var relevantSources = useMemo(function () {
|
|
12480
|
+
return getFiltersFromWarnings(warnings, 'warningProposalSource');
|
|
12481
|
+
}, [warnings]);
|
|
12482
|
+
var defaultSourceFilter = useMemo(function () {
|
|
12483
|
+
return Object.fromEntries(relevantSources.map(function (key) {
|
|
12484
|
+
return [key, true];
|
|
12485
|
+
}));
|
|
12486
|
+
}, [relevantSources]);
|
|
12487
|
+
var _useFilter3 = useFilter(defaultSourceFilter, relevantSources),
|
|
12488
|
+
pickedSourceFilter = _useFilter3[0],
|
|
12489
|
+
setSourceFilter = _useFilter3[1],
|
|
12490
|
+
allSourcesSelected = _useFilter3[2];
|
|
12491
|
+
useEffect(function () {
|
|
12492
|
+
setSourceFilter(function (prevFilter) {
|
|
12493
|
+
var newSourceFilter = Object.assign({}, defaultSourceFilter, prevFilter);
|
|
12494
|
+
// Only update state if the new filter differs from the current one
|
|
12495
|
+
if (JSON.stringify(newSourceFilter) !== JSON.stringify(prevFilter)) {
|
|
12496
|
+
return newSourceFilter;
|
|
12497
|
+
}
|
|
12498
|
+
return prevFilter;
|
|
12499
|
+
});
|
|
12500
|
+
}, [defaultSourceFilter, setSourceFilter]);
|
|
12501
|
+
var relevantIncidents = useMemo(function () {
|
|
12502
|
+
return getFiltersFromWarnings(warnings, 'incident');
|
|
12503
|
+
}, [warnings]);
|
|
12504
|
+
var defaultIncidentFilter = useMemo(function () {
|
|
12505
|
+
return Object.fromEntries(relevantIncidents.map(function (key) {
|
|
12506
|
+
return [key, true];
|
|
12507
|
+
}));
|
|
12508
|
+
}, [relevantIncidents]);
|
|
12509
|
+
var _useFilter4 = useFilter(defaultIncidentFilter, relevantIncidents),
|
|
12510
|
+
pickedIncidentFilter = _useFilter4[0],
|
|
12511
|
+
setIncidentFilter = _useFilter4[1],
|
|
12512
|
+
allIncidentsSelected = _useFilter4[2];
|
|
12513
|
+
useEffect(function () {
|
|
12514
|
+
setIncidentFilter(function (prevFilter) {
|
|
12515
|
+
var newIncidentFilter = Object.assign({}, defaultIncidentFilter, prevFilter);
|
|
12516
|
+
// Only update state if the new filter differs from the current one
|
|
12517
|
+
if (JSON.stringify(newIncidentFilter) !== JSON.stringify(prevFilter)) {
|
|
12518
|
+
return newIncidentFilter;
|
|
12519
|
+
}
|
|
12520
|
+
return prevFilter;
|
|
12521
|
+
});
|
|
12522
|
+
}, [defaultIncidentFilter, setIncidentFilter]);
|
|
13027
12523
|
var _useSelectedOptions2 = useSelectedOptions(domainFilter),
|
|
13028
12524
|
allDomainSelected = _useSelectedOptions2.allSelected;
|
|
13029
|
-
var allSelected = allDomainSelected && allLevelsSelected && allPhenomenonSelected;
|
|
12525
|
+
var allSelected = allDomainSelected && allLevelsSelected && allPhenomenonSelected && allIncidentsSelected && allSourcesSelected;
|
|
13030
12526
|
/**
|
|
13031
12527
|
* @param filterKey - Name of the filter | "ALL" filters
|
|
13032
12528
|
* @param optionKey - Name of the option | "ALL" options
|
|
@@ -13044,6 +12540,12 @@ var useWarningFilters = function useWarningFilters(warnings) {
|
|
|
13044
12540
|
setPhenomenonFilter(function (state) {
|
|
13045
12541
|
return updateState(state, 'ALL', value);
|
|
13046
12542
|
});
|
|
12543
|
+
setSourceFilter(function (state) {
|
|
12544
|
+
return updateState(state, 'ALL', value);
|
|
12545
|
+
});
|
|
12546
|
+
setIncidentFilter(function (state) {
|
|
12547
|
+
return updateState(state, 'ALL', value);
|
|
12548
|
+
});
|
|
13047
12549
|
} else if (filterKey === 'domain') {
|
|
13048
12550
|
setDomainFilter(function (state) {
|
|
13049
12551
|
return updateState(state, optionKey, value, only);
|
|
@@ -13056,6 +12558,14 @@ var useWarningFilters = function useWarningFilters(warnings) {
|
|
|
13056
12558
|
setPhenomenonFilter(function (state) {
|
|
13057
12559
|
return updateState(state, optionKey, value, only);
|
|
13058
12560
|
});
|
|
12561
|
+
} else if (filterKey === 'source') {
|
|
12562
|
+
setSourceFilter(function (state) {
|
|
12563
|
+
return updateState(state, optionKey, value, only);
|
|
12564
|
+
});
|
|
12565
|
+
} else if (filterKey === 'incident') {
|
|
12566
|
+
setIncidentFilter(function (state) {
|
|
12567
|
+
return updateState(state, optionKey, value, only);
|
|
12568
|
+
});
|
|
13059
12569
|
}
|
|
13060
12570
|
};
|
|
13061
12571
|
var byFilterState = useCallback(function (warning) {
|
|
@@ -13069,14 +12579,28 @@ var useWarningFilters = function useWarningFilters(warnings) {
|
|
|
13069
12579
|
if (!pickedLevelFilter[level]) {
|
|
13070
12580
|
return false;
|
|
13071
12581
|
}
|
|
13072
|
-
var phenomenon = getValue(Phenomenon, warning.warningDetail.phenomenon);
|
|
12582
|
+
var phenomenon = getValue(Phenomenon$1, warning.warningDetail.phenomenon);
|
|
13073
12583
|
if (!pickedPhenomenonFilter[phenomenon]) {
|
|
13074
12584
|
return false;
|
|
13075
12585
|
}
|
|
12586
|
+
var source = relevantSources.find(function (source) {
|
|
12587
|
+
return source === warning.warningDetail.warningProposalSource;
|
|
12588
|
+
}) || emptyFilterId;
|
|
12589
|
+
if (!pickedSourceFilter[source]) {
|
|
12590
|
+
return false;
|
|
12591
|
+
}
|
|
12592
|
+
var incident = relevantIncidents.find(function (incident) {
|
|
12593
|
+
return incident === warning.warningDetail.incident;
|
|
12594
|
+
}) || emptyFilterId;
|
|
12595
|
+
if (!pickedIncidentFilter[incident]) {
|
|
12596
|
+
return false;
|
|
12597
|
+
}
|
|
13076
12598
|
return true;
|
|
13077
|
-
}, [domainFilter, pickedLevelFilter, pickedPhenomenonFilter]);
|
|
12599
|
+
}, [domainFilter, pickedLevelFilter, pickedPhenomenonFilter, relevantSources, pickedSourceFilter, relevantIncidents, pickedIncidentFilter]);
|
|
13078
12600
|
return {
|
|
13079
12601
|
filterState: {
|
|
12602
|
+
incident: pickedIncidentFilter,
|
|
12603
|
+
source: pickedSourceFilter,
|
|
13080
12604
|
domain: domainFilter,
|
|
13081
12605
|
phenomenon: pickedPhenomenonFilter,
|
|
13082
12606
|
level: pickedLevelFilter
|
|
@@ -13106,10 +12630,7 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
13106
12630
|
var _React$useState = React__default.useState(undefined),
|
|
13107
12631
|
confirmDialogOptions = _React$useState[0],
|
|
13108
12632
|
setConfirmDialogOptions = _React$useState[1];
|
|
13109
|
-
var
|
|
13110
|
-
var isAllChipSelected = useSelector(getIsAllSelected);
|
|
13111
|
-
var publicWarnings = useSelector(getFilteredWarnings);
|
|
13112
|
-
var warnings = useSelector(selectAllPublicWarnings);
|
|
12633
|
+
var publicWarnings = useSelector(selectAllPublicWarnings);
|
|
13113
12634
|
var selectedPublicWarningId = useSelector(getSelectedPublicWarningId);
|
|
13114
12635
|
var isLoading = useSelector(isPublicWarningsLoading || isFetchingAirmet || isFetchingSigmet);
|
|
13115
12636
|
var error = useSelector(getPublicWarningsError);
|
|
@@ -13168,26 +12689,24 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
13168
12689
|
while (1) switch (_context2.prev = _context2.next) {
|
|
13169
12690
|
case 0:
|
|
13170
12691
|
if (!(publicWarning.id && auth != null && auth.username && !publicWarning.editor)) {
|
|
13171
|
-
_context2.next =
|
|
12692
|
+
_context2.next = 6;
|
|
13172
12693
|
break;
|
|
13173
12694
|
}
|
|
13174
|
-
|
|
13175
|
-
return dispatch(publicWarningFormActions.toggleEditorWarning({
|
|
12695
|
+
dispatch(publicWarningFormActions.toggleEditorWarning({
|
|
13176
12696
|
warningId: publicWarning.id,
|
|
13177
12697
|
isEditor: true,
|
|
13178
12698
|
username: auth == null ? void 0 : auth.username
|
|
13179
12699
|
}));
|
|
13180
|
-
|
|
13181
|
-
_context2.next = 5;
|
|
12700
|
+
_context2.next = 4;
|
|
13182
12701
|
return openPublicWarningDialog('', Object.assign({}, publicWarning, {
|
|
13183
12702
|
editor: auth == null ? void 0 : auth.username
|
|
13184
12703
|
}));
|
|
13185
|
-
case
|
|
13186
|
-
_context2.next =
|
|
12704
|
+
case 4:
|
|
12705
|
+
_context2.next = 7;
|
|
13187
12706
|
break;
|
|
13188
|
-
case
|
|
12707
|
+
case 6:
|
|
13189
12708
|
void openPublicWarningDialog('', publicWarning);
|
|
13190
|
-
case
|
|
12709
|
+
case 7:
|
|
13191
12710
|
case "end":
|
|
13192
12711
|
return _context2.stop();
|
|
13193
12712
|
}
|
|
@@ -13312,23 +12831,10 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
13312
12831
|
void refetchSigmetList();
|
|
13313
12832
|
dispatch(publicWarningActions.fetchWarnings());
|
|
13314
12833
|
}, [dispatch, refetchAirmetList, refetchSigmetList]);
|
|
13315
|
-
var onClickAllChip = React__default.useCallback(function (isChecked) {
|
|
13316
|
-
dispatch(publicWarningActions.toggleAllFilters({
|
|
13317
|
-
isChecked: isChecked
|
|
13318
|
-
}));
|
|
13319
|
-
}, [dispatch]);
|
|
13320
12834
|
React__default.useEffect(function () {
|
|
13321
12835
|
// fetch warnings on mount
|
|
13322
12836
|
fetchWarnings();
|
|
13323
12837
|
}, [fetchWarnings]);
|
|
13324
|
-
// update filters when warnings change
|
|
13325
|
-
React__default.useEffect(function () {
|
|
13326
|
-
// Generate new filters based on the provided warnings
|
|
13327
|
-
var newFilters = getFiltersFromWarnings(t, warnings);
|
|
13328
|
-
dispatch(publicWarningActions.setWarningListFilters({
|
|
13329
|
-
newFilters: newFilters
|
|
13330
|
-
}));
|
|
13331
|
-
}, [dispatch, t, warnings]);
|
|
13332
12838
|
var combinedWarnings = React__default.useMemo(function () {
|
|
13333
12839
|
var transformedSigmets = (sigmetList == null ? void 0 : sigmetList.map(transformSigmetToWarningFormat)) || [];
|
|
13334
12840
|
var transformedAirmets = (airmetList == null ? void 0 : airmetList.map(transformAirmetToWarningFormat)) || [];
|
|
@@ -13352,25 +12858,27 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
13352
12858
|
});
|
|
13353
12859
|
}, [filteredWarnings, expandedSections]);
|
|
13354
12860
|
var allFeatures = React__default.useMemo(function () {
|
|
13355
|
-
return filteredWarningsByExpandedSections.
|
|
12861
|
+
return filteredWarningsByExpandedSections.flatMap(function (warning) {
|
|
13356
12862
|
var _warning$warningDetai;
|
|
13357
|
-
|
|
12863
|
+
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) {
|
|
12864
|
+
return area.geoJSON;
|
|
12865
|
+
}).map(function (area) {
|
|
12866
|
+
var isAviationWarning = warning.warningDetail.level === 'SIG' || warning.warningDetail.level === 'AIR';
|
|
12867
|
+
var styledGeoJSON = warningLevelFeatureColors(warning.warningDetail.level, area.geoJSON, isAviationWarning);
|
|
13358
12868
|
return {
|
|
13359
|
-
id: warning.id +
|
|
13360
|
-
|
|
12869
|
+
id: warning.id + area.areaId,
|
|
12870
|
+
originalId: warning.id,
|
|
12871
|
+
geoJSON: styledGeoJSON
|
|
13361
12872
|
};
|
|
13362
|
-
})
|
|
13363
|
-
|
|
13364
|
-
|
|
13365
|
-
|
|
13366
|
-
return [].concat(acc, features);
|
|
13367
|
-
}
|
|
13368
|
-
return acc;
|
|
13369
|
-
}, []);
|
|
12873
|
+
})) || [];
|
|
12874
|
+
}).filter(function (feature) {
|
|
12875
|
+
return feature.id;
|
|
12876
|
+
});
|
|
13370
12877
|
}, [filteredWarningsByExpandedSections]);
|
|
13371
|
-
useUpdateSharedData({
|
|
13372
|
-
|
|
13373
|
-
|
|
12878
|
+
var _useUpdateSharedData = useUpdateSharedData({
|
|
12879
|
+
features: allFeatures
|
|
12880
|
+
}, panelId),
|
|
12881
|
+
hoveredFeatureId = _useUpdateSharedData.hoverId;
|
|
13374
12882
|
return jsxs(Fragment, {
|
|
13375
12883
|
children: [jsx(PublicWarningList, {
|
|
13376
12884
|
warnings: filteredWarnings,
|
|
@@ -13388,10 +12896,8 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
13388
12896
|
selectedPublicWarningId: selectedPublicWarningId,
|
|
13389
12897
|
lastUpdatedTime: lastUpdatedTime,
|
|
13390
12898
|
onRefetchWarnings: fetchWarnings,
|
|
13391
|
-
filters: filters,
|
|
13392
12899
|
filterHookState: filterHookState,
|
|
13393
|
-
|
|
13394
|
-
onClickAllChip: onClickAllChip
|
|
12900
|
+
hoveredFeatureId: hoveredFeatureId
|
|
13395
12901
|
}), confirmDialogOptions && jsx(ConfirmDeleteWarningDialog, {
|
|
13396
12902
|
onClose: function onClose() {
|
|
13397
12903
|
return setConfirmDialogOptions(undefined);
|
|
@@ -13941,6 +13447,7 @@ drawingsListener.startListening({
|
|
|
13941
13447
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
13942
13448
|
* */
|
|
13943
13449
|
var drawingModuleConfig = {
|
|
13450
|
+
// TODO: remove id in https://gitlab.com/opengeoweb/opengeoweb/-/issues/5561
|
|
13944
13451
|
id: 'drawing-module',
|
|
13945
13452
|
reducersMap: {
|
|
13946
13453
|
drawings: reducer$2,
|