@opengeoweb/warnings 12.9.1 → 12.10.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/README.md +6 -0
- package/index.esm.js +1451 -282
- package/package.json +14 -13
- package/src/lib/components/ComponentsLookUp/ComponentsLookUp.d.ts +9 -2
- package/src/lib/components/MaritimeWarningsForm/AreaList/AreaList.d.ts +9 -0
- package/src/lib/components/MaritimeWarningsForm/AreaList/AreaList.spec.d.ts +1 -0
- package/src/lib/components/MaritimeWarningsForm/AreaList/index.d.ts +1 -0
- package/src/lib/components/MaritimeWarningsForm/AssignedAreas/AssignedAreas.d.ts +11 -0
- package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsForm.d.ts +19 -0
- package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsForm.stories.d.ts +9 -0
- package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsFormConnect.d.ts +6 -0
- package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsFormConnect.spec.d.ts +1 -0
- package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsFormConnect.stories.d.ts +11 -0
- package/src/lib/components/MaritimeWarningsForm/MartitimeWarningsForm.spec.d.ts +2 -0
- package/src/lib/components/MaritimeWarningsForm/WarningList/WarningList.d.ts +15 -0
- package/src/lib/components/MaritimeWarningsForm/WarningList/WarningListDragHandle.d.ts +2 -0
- package/src/lib/components/MaritimeWarningsForm/WarningList/WarningListItem.d.ts +14 -0
- package/src/lib/components/MaritimeWarningsForm/WarningList/WarningListSelect.d.ts +19 -0
- package/src/lib/components/MaritimeWarningsForm/WarningList/WindForceSelect.d.ts +22 -0
- package/src/lib/components/MaritimeWarningsForm/areas.d.ts +2 -0
- package/src/lib/components/MaritimeWarningsForm/index.d.ts +1 -0
- package/src/lib/components/MaritimeWarningsForm/options.d.ts +5 -0
- package/src/lib/components/MaritimeWarningsForm/types.d.ts +15 -0
- package/src/lib/components/MaritimeWarningsForm/useMaritimeWarningsFormState.d.ts +52 -0
- package/src/lib/components/MaritimeWarningsForm/useMaritimeWarningsFormState.spec.d.ts +1 -0
- package/src/lib/store/publicWarningForm/types.d.ts +1 -1
package/index.esm.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { useDispatch, useSelector } from 'react-redux';
|
|
3
|
-
import { Polygons, ExitDomain, Share, Edit, Delete, CoastalEvent, TemperatureLow, TemperatureHigh, Rain, Snow, Lightning, Fog, Wind, Thunderstorm, VulcanicEruption, Haze, FreezingPrecipitation, ModerateAircraftIcing, SevereAircraftIcing, ModerateTurbulence, SevereTurbulence, SandStorm, RadioactiveMaterials, DrawPolygon, Visibility, Add, breakpoints, Options, Close, ChevronDown, ChevronUp, Copy, Update, Cancel, Success, Expire, Remove
|
|
3
|
+
import { Polygons, ExitDomain, Share, Edit, Delete, CoastalEvent, TemperatureLow, TemperatureHigh, Rain, Snow, Lightning, Fog, Wind, Thunderstorm, VulcanicEruption, Haze, FreezingPrecipitation, ModerateAircraftIcing, SevereAircraftIcing, ModerateTurbulence, SevereTurbulence, SandStorm, RadioactiveMaterials, DrawPolygon, Visibility, Add, ArrowUpCompact, ArrowDownCompact, breakpoints, DragHandle, Options, Close, ChevronDown, ChevronUp, Copy, Update, Cancel, Success, Expire, Remove } from '@opengeoweb/theme';
|
|
4
4
|
import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawingToolSelectors, layerSelectors, uiSelectors, drawingToolActions, layerActions, mapListener, layersListener, drawingToolListener, syncGroupsListener, openlayersListener, syncGroupsReducer, drawingToolReducer, uiReducer, layerReducer, mapReducer, useSetupDialog, genericSelectors, useUpdateSharedData, genericActions, selectorMemoizationOptions } from '@opengeoweb/store';
|
|
5
5
|
import { defaultPolygon, emptyGeoJSON, MapControlButton, getIcon, rewindGeometry, getGeoJSONPropertyValue, currentlySupportedDrawModes, defaultLayers, viewUtils, OpenLayersMapView, MapControls, OpenLayersZoomControl, OpenLayersLayer, OpenLayersFeatureLayer, genericOpenLayersFeatureStyle } from '@opengeoweb/webmap-react';
|
|
6
|
-
import { SHARED_NAMESPACE, useConfirmationDialog, dateUtils, ToggleMenu, calculateStartSize, ToolContainerDraggable, AlertBanner, sessionStorageProvider, ConfirmationDialog, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, CustomToggleButton, Filter,
|
|
6
|
+
import { SHARED_NAMESPACE, useConfirmationDialog, dateUtils, ToggleMenu, calculateStartSize, ToolContainerDraggable, AlertBanner, sessionStorageProvider, ConfirmationDialog, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, FilterChip, TooltipSelect, CustomToggleButton, Filter, FilterOption, StatusTag, LastUpdateTime, getAxiosErrorMessage, ErrorBoundary } from '@opengeoweb/shared';
|
|
7
7
|
import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, current, combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
8
8
|
import { defaultBbox } from '@opengeoweb/core';
|
|
9
9
|
import { FORM_FIELDS_NAMESPACE, useDraftFormHelpers, ReactHookFormSelect, ReactHookFormHiddenInput, isValidGeoJsonCoordinates, ReactHookFormTextField, ReactHookFormProvider, defaultFormOptions, errorMessages, isEmpty, ReactHookFormDateTime, isXHoursAfter, isXHoursBefore } from '@opengeoweb/form-fields';
|
|
10
|
-
import { SA_NAMESPACE, isInstanceOfCancelSigmet, getDefaultValidFromValue, isInstanceOfCancelAirmet, getTacGeometry, getMaxPolygonPoints, getDefaultValidUntilValue, useShortTestHelpers, SigmetForm, AirmetForm,
|
|
10
|
+
import { SA_NAMESPACE, isInstanceOfCancelSigmet, getDefaultValidFromValue, isInstanceOfCancelAirmet, getTacGeometry, getMaxPolygonPoints, getDefaultValidUntilValue, useShortTestHelpers, ProductAction, SigmetForm, AirmetForm, getConfirmationDialogCancelLabel, getConfirmationDialogButtonLabel, getConfirmationDialogContent, getConfirmationDialogTitle, isVAPhenomenon, CancelSigmetVolcanicMovements, createAirmetPostParameter, createSigmetPostParameter, prepareCancelSigmet, getProductFormMode } from '@opengeoweb/sigmet-airmet';
|
|
11
11
|
import { LayerType, generateMapId } from '@opengeoweb/webmap';
|
|
12
12
|
import { t } from 'i18next';
|
|
13
13
|
import { useTranslation } from 'react-i18next';
|
|
14
14
|
import * as React from 'react';
|
|
15
15
|
import React__default, { useState, useEffect, useRef, useMemo, useCallback } from 'react';
|
|
16
16
|
import { useAuthenticationContext as useAuthenticationContext$1 } from '@opengeoweb/authentication';
|
|
17
|
-
import { styled, Box, Typography, ListItem, Paper, ListItemButton, Stack, Grid, LinearProgress, Button, MenuItem, FormHelperText, Card, CardContent, Tabs, Tab, CircularProgress, Menu, DialogTitle, DialogContent, Switch, ListItemText } from '@mui/material';
|
|
17
|
+
import { styled, Box, Typography, ListItem, Paper, ListItemButton, Stack, Grid, LinearProgress, Button, MenuItem, FormHelperText, Card, CardContent, Tabs, Tab, useTheme, FormControl, IconButton, CircularProgress, Menu, DialogTitle, DialogContent, Switch, ListItemText } from '@mui/material';
|
|
18
18
|
import { VariableSizeList } from 'react-window';
|
|
19
19
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
20
20
|
import { getHeaders, handleResponse, AirmetPhenomena, SigmetPhenomena, useAuthQuery, useAuthenticationContext, optimisticUpdate, ProductStatus } from '@opengeoweb/api';
|
|
@@ -22,6 +22,7 @@ import { useQueryClient, useMutation } from '@tanstack/react-query';
|
|
|
22
22
|
import { snackbarListener, snackbarReducer, snackbarActions, snackbarTypes } from '@opengeoweb/snackbar';
|
|
23
23
|
import { useFormContext, useForm, FormProvider } from 'react-hook-form';
|
|
24
24
|
import { isEqual, cloneDeep, clamp, concat, groupBy, pick } from 'lodash';
|
|
25
|
+
import { ReactSortable } from 'react-sortablejs';
|
|
25
26
|
|
|
26
27
|
var en = {
|
|
27
28
|
"drawing-tool-form-tools": "Tools",
|
|
@@ -55,6 +56,8 @@ var en = {
|
|
|
55
56
|
"object-manager-object-selected": "object selected",
|
|
56
57
|
"object-manager-share-menu": "Share object to",
|
|
57
58
|
"public-warning-title": "Public Warning",
|
|
59
|
+
"maritime-warning-coastal-title": "Coastal Waters",
|
|
60
|
+
"maritime-warning-northsea-title": "North Sea Districts",
|
|
58
61
|
"close-warning-dialog-title": "Close warning",
|
|
59
62
|
"warning-edit-mode-title": "Switch to edit mode",
|
|
60
63
|
"warning-edit-mode-description": "This warning is already in edit mode by another user and important information could get lost in the switching process.",
|
|
@@ -210,7 +213,39 @@ var en = {
|
|
|
210
213
|
"aviation-discard-success": "{{warningType}} has been discarded!",
|
|
211
214
|
"error-auth-login": "This feature is protected by authentication. Please log in to proceed",
|
|
212
215
|
"cancel-warningType": "Cancel {{warningType}}",
|
|
213
|
-
cancelling: "Cancelling"
|
|
216
|
+
cancelling: "Cancelling",
|
|
217
|
+
"maritime-new-warning": "New warning",
|
|
218
|
+
"maritime-add-area": "Add",
|
|
219
|
+
"maritime-no-area-selected": "(no area selected)",
|
|
220
|
+
"maritime-no-district-selected": "(no district selected)",
|
|
221
|
+
"maritime-backing": "Backing",
|
|
222
|
+
"maritime-veering": "Veering",
|
|
223
|
+
"maritime-no-change": "No change",
|
|
224
|
+
"maritime-windforce": "{{value}} Bft",
|
|
225
|
+
"maritime-header-direction": "Direction",
|
|
226
|
+
"maritime-header-direction-from": "Direction from",
|
|
227
|
+
"maritime-header-direction-to": "Direction to",
|
|
228
|
+
"maritime-header-windforce": "Bft",
|
|
229
|
+
"maritime-header-areas": "Areas",
|
|
230
|
+
"maritime-header-districts": "Districts",
|
|
231
|
+
"maritime-header-change": "Change",
|
|
232
|
+
"maritime-direction-n": "North",
|
|
233
|
+
"maritime-direction-nne": "North to Northeast",
|
|
234
|
+
"maritime-direction-ne": "Northeast",
|
|
235
|
+
"maritime-direction-nen": "Northeast to North",
|
|
236
|
+
"maritime-direction-e": "East",
|
|
237
|
+
"maritime-direction-ese": "East to Southeast",
|
|
238
|
+
"maritime-direction-se": "Southeast",
|
|
239
|
+
"maritime-direction-ses": "Southeast to South",
|
|
240
|
+
"maritime-direction-s": "South",
|
|
241
|
+
"maritime-direction-ssw": "South to Southwest",
|
|
242
|
+
"maritime-direction-sw": "Southwest",
|
|
243
|
+
"maritime-direction-sww": "Southwest to West",
|
|
244
|
+
"maritime-direction-w": "West",
|
|
245
|
+
"maritime-direction-wnw": "West to Northwest",
|
|
246
|
+
"maritime-direction-nw": "Northwest",
|
|
247
|
+
"maritime-direction-nwn": "Northwest to North",
|
|
248
|
+
"maritime-delete-button": "Delete"
|
|
214
249
|
};
|
|
215
250
|
var nl = {
|
|
216
251
|
"drawing-tool-form-tools": "Gereedschap",
|
|
@@ -244,6 +279,8 @@ var nl = {
|
|
|
244
279
|
"object-manager-object-selected": "object geselecteerd",
|
|
245
280
|
"object-manager-share-menu": "Object delen naar",
|
|
246
281
|
"public-warning-title": "Publieke Waarschuwing",
|
|
282
|
+
"maritime-warning-coastal-title": "Kust Wateren",
|
|
283
|
+
"maritime-warning-northsea-title": "Noordzee Districten",
|
|
247
284
|
"close-warning-dialog-title": "Waarschuwing sluiten",
|
|
248
285
|
"warning-edit-mode-title": "Wissel naar bewerken",
|
|
249
286
|
"warning-edit-mode-description": "Deze waarschuwing wordt al bewerkt door een andere gebruiker en belangrijke informatie kan verloren gaan.",
|
|
@@ -360,7 +397,39 @@ var nl = {
|
|
|
360
397
|
"aviation-discard-success": "niet vertaald",
|
|
361
398
|
"error-auth-login": "Deze functie wordt beschermd door authenticatie. Log in om verder te gaan",
|
|
362
399
|
"cancel-warningType": "Annuleer {{warningType}}",
|
|
363
|
-
cancelling: "Annuleren"
|
|
400
|
+
cancelling: "Annuleren",
|
|
401
|
+
"maritime-new-warning": "Nieuwe waarschuwing",
|
|
402
|
+
"maritime-add-area": "Toevoegen",
|
|
403
|
+
"maritime-no-area-selected": "(geen gebied geselecteerd)",
|
|
404
|
+
"maritime-no-district-selected": "(geen district geselecteerd)",
|
|
405
|
+
"maritime-backing": "Krimpend",
|
|
406
|
+
"maritime-veering": "Ruimend",
|
|
407
|
+
"maritime-no-change": "Geen wijziging",
|
|
408
|
+
"maritime-windforce": "{{value}} Bft",
|
|
409
|
+
"maritime-header-direction": "Richting",
|
|
410
|
+
"maritime-header-direction-from": "Richting van",
|
|
411
|
+
"maritime-header-direction-to": "Richting naar",
|
|
412
|
+
"maritime-header-windforce": "Bft",
|
|
413
|
+
"maritime-header-areas": "Gebieden",
|
|
414
|
+
"maritime-header-districts": "Districten",
|
|
415
|
+
"maritime-header-change": "Wijziging",
|
|
416
|
+
"maritime-direction-n": "Noord",
|
|
417
|
+
"maritime-direction-nne": "Noord tot noordoost",
|
|
418
|
+
"maritime-direction-ne": "Noordoost",
|
|
419
|
+
"maritime-direction-nen": "Noordoost tot noord",
|
|
420
|
+
"maritime-direction-e": "Oost",
|
|
421
|
+
"maritime-direction-ese": "Oost tot zuidoost",
|
|
422
|
+
"maritime-direction-se": "Zuidoost",
|
|
423
|
+
"maritime-direction-ses": "Zuidoost tot zuid",
|
|
424
|
+
"maritime-direction-s": "Zuid",
|
|
425
|
+
"maritime-direction-ssw": "Zuid tot zuidwest",
|
|
426
|
+
"maritime-direction-sw": "Zuidwest",
|
|
427
|
+
"maritime-direction-sww": "Zuidwest tot west",
|
|
428
|
+
"maritime-direction-w": "West",
|
|
429
|
+
"maritime-direction-wnw": "West tot noordwest",
|
|
430
|
+
"maritime-direction-nw": "Noordwest",
|
|
431
|
+
"maritime-direction-nwn": "Noordwest tot noord",
|
|
432
|
+
"maritime-delete-button": "Verwijderen"
|
|
364
433
|
};
|
|
365
434
|
var fi = {
|
|
366
435
|
"drawing-tool-form-tools": "Työkalut",
|
|
@@ -394,6 +463,8 @@ var fi = {
|
|
|
394
463
|
"object-manager-object-selected": "objekti valittuna",
|
|
395
464
|
"object-manager-share-menu": "Jaa objekti",
|
|
396
465
|
"public-warning-title": "Julkiset varoitukset",
|
|
466
|
+
"maritime-warning-coastal-title": "ei käännetty",
|
|
467
|
+
"maritime-warning-northsea-title": "ei käännetty",
|
|
397
468
|
"close-warning-dialog-title": "Sulje varoitukset",
|
|
398
469
|
"warning-edit-mode-title": "Vaihda editointitilaan",
|
|
399
470
|
"warning-edit-mode-description": "Tämä varoitus on jo editointitilassa toisen käyttäjän toimesta. Tärkeää tietoa saatetaan menettää, jos editointitilaa vaihdetaan.",
|
|
@@ -544,6 +615,8 @@ var no = {
|
|
|
544
615
|
"object-manager-object-selected": "objekt er valgt",
|
|
545
616
|
"object-manager-share-menu": "Del objekt med",
|
|
546
617
|
"public-warning-title": "Farevarsel",
|
|
618
|
+
"maritime-warning-coastal-title": "ikke oversatt",
|
|
619
|
+
"maritime-warning-northsea-title": "ikke oversatt",
|
|
547
620
|
"close-warning-dialog-title": "Lukk farevarsel",
|
|
548
621
|
"warning-edit-mode-title": "Bytt til editeringsmodus",
|
|
549
622
|
"warning-edit-mode-description": "Dette varselet er allerede under endring av en annen bruker. Viktig informasjon kan gå tapt ved å bytte",
|
|
@@ -1048,9 +1121,9 @@ var drawAdapter = createEntityAdapter({
|
|
|
1048
1121
|
return draw.drawingInstanceId;
|
|
1049
1122
|
}
|
|
1050
1123
|
});
|
|
1051
|
-
var initialState$
|
|
1124
|
+
var initialState$3 = drawAdapter.getInitialState();
|
|
1052
1125
|
var slice$2 = createSlice({
|
|
1053
|
-
initialState: initialState$
|
|
1126
|
+
initialState: initialState$3,
|
|
1054
1127
|
name: 'drawingForm',
|
|
1055
1128
|
reducers: {
|
|
1056
1129
|
setDrawValues: function setDrawValues(draft, action) {
|
|
@@ -2134,9 +2207,9 @@ var publicWarningDialogType = uiTypes.DialogTypes.PublicWarnings;
|
|
|
2134
2207
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2135
2208
|
* */
|
|
2136
2209
|
var TAKEOVER_MESSAGE = 'You are no longer the editor of this warning';
|
|
2137
|
-
var initialState$
|
|
2210
|
+
var initialState$2 = {};
|
|
2138
2211
|
var slice$1 = createSlice({
|
|
2139
|
-
initialState: initialState$
|
|
2212
|
+
initialState: initialState$2,
|
|
2140
2213
|
name: 'publicWarningForm',
|
|
2141
2214
|
reducers: {
|
|
2142
2215
|
setFormValues: function setFormValues(draft, action) {
|
|
@@ -2452,14 +2525,14 @@ var publicWarningsAdapter = createEntityAdapter({
|
|
|
2452
2525
|
return warning.id;
|
|
2453
2526
|
}
|
|
2454
2527
|
});
|
|
2455
|
-
var initialState = {
|
|
2528
|
+
var initialState$1 = {
|
|
2456
2529
|
warnings: publicWarningsAdapter.getInitialState(),
|
|
2457
2530
|
isLoading: true,
|
|
2458
2531
|
lastUpdatedTime: '',
|
|
2459
2532
|
filterState: {}
|
|
2460
2533
|
};
|
|
2461
2534
|
var slice = createSlice({
|
|
2462
|
-
initialState: initialState,
|
|
2535
|
+
initialState: initialState$1,
|
|
2463
2536
|
name: 'publicWarnings',
|
|
2464
2537
|
reducers: {
|
|
2465
2538
|
setWarningFilters: function setWarningFilters(draft, action) {
|
|
@@ -5569,124 +5642,1212 @@ var ValidUntil = function ValidUntil(_ref) {
|
|
|
5569
5642
|
});
|
|
5570
5643
|
};
|
|
5571
5644
|
|
|
5572
|
-
var
|
|
5573
|
-
var
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5645
|
+
var AreaList = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
5646
|
+
var areas = _ref.areas,
|
|
5647
|
+
selected = _ref.selected,
|
|
5648
|
+
disabled = _ref.disabled,
|
|
5649
|
+
onClickItem = _ref.onClickItem;
|
|
5650
|
+
return jsx(Stack, {
|
|
5651
|
+
"data-testid": "arealist",
|
|
5652
|
+
direction: "row",
|
|
5653
|
+
spacing: 1,
|
|
5654
|
+
sx: {
|
|
5655
|
+
display: 'block',
|
|
5656
|
+
'.MuiChip-root': {
|
|
5657
|
+
margin: 0,
|
|
5658
|
+
marginRight: 1,
|
|
5659
|
+
marginBottom: 1
|
|
5660
|
+
}
|
|
5661
|
+
},
|
|
5662
|
+
children: areas.map(function (area) {
|
|
5663
|
+
var isDisabled = disabled.includes(area.id);
|
|
5664
|
+
var isSelected = !isDisabled && selected.includes(area.id);
|
|
5665
|
+
return jsx(FilterChip, {
|
|
5666
|
+
id: area.id,
|
|
5667
|
+
label: area.label,
|
|
5668
|
+
isSelected: isSelected,
|
|
5669
|
+
isDisabled: isDisabled,
|
|
5670
|
+
onClick: function onClick() {
|
|
5671
|
+
return onClickItem == null ? void 0 : onClickItem(area.id);
|
|
5672
|
+
},
|
|
5673
|
+
size: "medium"
|
|
5674
|
+
}, area.id);
|
|
5675
|
+
})
|
|
5586
5676
|
});
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5677
|
+
});
|
|
5678
|
+
|
|
5679
|
+
var _excluded$4 = ["title", "width", "onClick", "isSorted", "sortDirection", "sortable"];
|
|
5680
|
+
var sharedArrowIconStyles = {
|
|
5681
|
+
fontSize: '0.9rem'
|
|
5682
|
+
};
|
|
5683
|
+
var WarningListHeaderContent = function WarningListHeaderContent(_ref) {
|
|
5684
|
+
var title = _ref.title,
|
|
5685
|
+
_ref$width = _ref.width,
|
|
5686
|
+
width = _ref$width === void 0 ? 76 : _ref$width,
|
|
5687
|
+
_onClick = _ref.onClick,
|
|
5688
|
+
isSorted = _ref.isSorted,
|
|
5689
|
+
sortDirection = _ref.sortDirection,
|
|
5690
|
+
sortable = _ref.sortable,
|
|
5691
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
5692
|
+
return jsx(Grid, {
|
|
5693
|
+
sx: Object.assign({}, props.sx, {
|
|
5694
|
+
width: width,
|
|
5695
|
+
cursor: _onClick ? 'pointer' : 'default'
|
|
5696
|
+
}),
|
|
5697
|
+
onClick: function onClick(e) {
|
|
5698
|
+
e.stopPropagation(); // Ensure click only affects this column
|
|
5699
|
+
_onClick == null || _onClick();
|
|
5700
|
+
},
|
|
5701
|
+
children: jsxs(Box, {
|
|
5702
|
+
sx: {
|
|
5703
|
+
display: 'flex',
|
|
5704
|
+
alignItems: 'center',
|
|
5705
|
+
overflow: 'hidden',
|
|
5706
|
+
fontWeight: 'normal',
|
|
5707
|
+
textOverflow: 'ellipsis',
|
|
5708
|
+
fontSize: 12,
|
|
5709
|
+
lineHeight: 1.33,
|
|
5710
|
+
height: 16,
|
|
5711
|
+
color: 'geowebColors.captions.captionStatus.rgba'
|
|
5712
|
+
},
|
|
5713
|
+
children: [title, sortable && jsx(Box, {
|
|
5714
|
+
sx: {
|
|
5715
|
+
display: 'flex',
|
|
5716
|
+
alignItems: 'center',
|
|
5717
|
+
marginLeft: '4px',
|
|
5718
|
+
color: isSorted ? '#186DFF' : 'inherit'
|
|
5719
|
+
},
|
|
5720
|
+
children: isSorted && sortDirection === 'asc' ? jsx(ArrowUpCompact, {
|
|
5721
|
+
sx: Object.assign({}, sharedArrowIconStyles),
|
|
5722
|
+
"data-testid": "ArrowUpIcon"
|
|
5723
|
+
}) : jsx(ArrowDownCompact, {
|
|
5724
|
+
sx: Object.assign({}, sharedArrowIconStyles),
|
|
5725
|
+
"data-testid": "ArrowDownIcon"
|
|
5726
|
+
})
|
|
5727
|
+
})]
|
|
5728
|
+
})
|
|
5590
5729
|
});
|
|
5591
|
-
return {
|
|
5592
|
-
id: '',
|
|
5593
|
-
phenomenon: '',
|
|
5594
|
-
validFrom: dateUtils.dateToString(validFromTime),
|
|
5595
|
-
validUntil: dateUtils.dateToString(validUntilTime),
|
|
5596
|
-
level: '',
|
|
5597
|
-
probability: 30,
|
|
5598
|
-
descriptionOriginal: '',
|
|
5599
|
-
descriptionTranslation: '',
|
|
5600
|
-
areas: []
|
|
5601
|
-
};
|
|
5602
5730
|
};
|
|
5603
|
-
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
|
|
5607
|
-
|
|
5608
|
-
|
|
5731
|
+
|
|
5732
|
+
var AssignedAreas = function AssignedAreas(_ref) {
|
|
5733
|
+
var _sx;
|
|
5734
|
+
var assignedAreas = _ref.assignedAreas,
|
|
5735
|
+
selectedAreaIds = _ref.selectedAreaIds,
|
|
5736
|
+
onAddClick = _ref.onAddClick,
|
|
5737
|
+
onDeleteClick = _ref.onDeleteClick,
|
|
5738
|
+
onToggleSelectArea = _ref.onToggleSelectArea,
|
|
5739
|
+
_ref$shouldShowDistri = _ref.shouldShowDistricts,
|
|
5740
|
+
shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri;
|
|
5741
|
+
var _useWarningsTranslati = useWarningsTranslation(),
|
|
5742
|
+
t = _useWarningsTranslati.t;
|
|
5743
|
+
var assignedAreaIds = React__default.useMemo(function () {
|
|
5744
|
+
return new Set(assignedAreas.map(function (area) {
|
|
5745
|
+
return area.id;
|
|
5746
|
+
}));
|
|
5747
|
+
}, [assignedAreas]);
|
|
5748
|
+
// can add the selected areas when they don't appear in the assigned area list
|
|
5749
|
+
var canAddSelectedAreas = React__default.useMemo(function () {
|
|
5750
|
+
return selectedAreaIds.length > 0 && selectedAreaIds.every(function (id) {
|
|
5751
|
+
return !assignedAreaIds.has(id);
|
|
5752
|
+
});
|
|
5753
|
+
}, [selectedAreaIds, assignedAreaIds]);
|
|
5754
|
+
var theme = useTheme();
|
|
5755
|
+
return jsxs(Box, {
|
|
5756
|
+
sx: {
|
|
5757
|
+
display: 'flex',
|
|
5758
|
+
gridArea: 'areas',
|
|
5759
|
+
gap: 1,
|
|
5760
|
+
minHeight: 32,
|
|
5761
|
+
marginLeft: 1,
|
|
5762
|
+
paddingInline: 0.5,
|
|
5763
|
+
borderRadius: 1
|
|
5764
|
+
},
|
|
5765
|
+
style: {
|
|
5766
|
+
backgroundColor: canAddSelectedAreas ? theme.palette.geowebColors.cards.cardContainerMouseOver : undefined
|
|
5767
|
+
},
|
|
5768
|
+
children: [assignedAreas.length === 0 && jsx(Typography, {
|
|
5769
|
+
variant: "caption",
|
|
5770
|
+
color: "textSecondary",
|
|
5771
|
+
sx: {
|
|
5772
|
+
alignSelf: 'center'
|
|
5773
|
+
},
|
|
5774
|
+
children: shouldShowDistricts ? t('maritime-no-district-selected') : t('maritime-no-area-selected')
|
|
5775
|
+
}), jsx(Box, {
|
|
5776
|
+
sx: (_sx = {
|
|
5777
|
+
flexGrow: 1,
|
|
5778
|
+
display: 'flex',
|
|
5779
|
+
flexDirection: 'column',
|
|
5780
|
+
gap: 0.5,
|
|
5781
|
+
paddingBlock: 0.5,
|
|
5782
|
+
alignItems: 'flex-start'
|
|
5783
|
+
}, _sx["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
5784
|
+
flexWrap: 'wrap',
|
|
5785
|
+
flexDirection: 'row'
|
|
5786
|
+
}, _sx),
|
|
5787
|
+
children: assignedAreas.map(function (area) {
|
|
5788
|
+
var isSelected = selectedAreaIds.includes(area.id);
|
|
5789
|
+
return jsx(FilterChip, {
|
|
5790
|
+
size: "small",
|
|
5791
|
+
id: area.id,
|
|
5792
|
+
label: area.label,
|
|
5793
|
+
isSelected: isSelected,
|
|
5794
|
+
onClick: function onClick() {
|
|
5795
|
+
return onToggleSelectArea(area.id);
|
|
5796
|
+
},
|
|
5797
|
+
onClickIcon: isSelected ? function () {
|
|
5798
|
+
return onDeleteClick(area.id);
|
|
5799
|
+
} : undefined
|
|
5800
|
+
}, area.id);
|
|
5801
|
+
})
|
|
5802
|
+
}), jsx(AddButton, {
|
|
5803
|
+
show: canAddSelectedAreas,
|
|
5804
|
+
onClick: onAddClick
|
|
5805
|
+
})]
|
|
5609
5806
|
});
|
|
5610
|
-
return data;
|
|
5611
5807
|
};
|
|
5612
|
-
|
|
5613
|
-
var
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5808
|
+
var AddButton = function AddButton(_ref2) {
|
|
5809
|
+
var onClick = _ref2.onClick,
|
|
5810
|
+
show = _ref2.show;
|
|
5811
|
+
var _useWarningsTranslati2 = useWarningsTranslation(),
|
|
5812
|
+
t = _useWarningsTranslati2.t;
|
|
5813
|
+
return jsx(Button, {
|
|
5814
|
+
onClick: onClick,
|
|
5815
|
+
variant: "primary",
|
|
5816
|
+
style: {
|
|
5817
|
+
visibility: show ? 'visible' : 'hidden'
|
|
5818
|
+
},
|
|
5819
|
+
sx: function sx(theme) {
|
|
5820
|
+
return Object.assign({
|
|
5821
|
+
alignSelf: 'flex-start',
|
|
5822
|
+
height: 16,
|
|
5823
|
+
minWidth: 0,
|
|
5824
|
+
flexShrink: 0,
|
|
5825
|
+
marginTop: 0.5
|
|
5826
|
+
}, theme.typography.caption);
|
|
5827
|
+
},
|
|
5828
|
+
children: t('maritime-add-area')
|
|
5829
|
+
});
|
|
5622
5830
|
};
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
}, _ref2;
|
|
5641
|
-
});
|
|
5642
|
-
var sm6Width = 'calc(100% * 6 / var(--Grid-columns) - (var(--Grid-columns) - 6) * (var(--Grid-columnSpacing) / var(--Grid-columns)))';
|
|
5643
|
-
var sm4Width = 'calc(100% * 4 / var(--Grid-columns) - (var(--Grid-columns) - 4) * (var(--Grid-columnSpacing) / var(--Grid-columns)))';
|
|
5644
|
-
var ContainerGrid = styled('div')(function (_ref3) {
|
|
5645
|
-
var _ref4;
|
|
5646
|
-
var theme = _ref3.theme;
|
|
5647
|
-
return _ref4 = {
|
|
5648
|
-
backgroundColor: theme.palette.background.paper,
|
|
5649
|
-
'.MuiGrid-grid-sm-6, .MuiGrid-grid-sm-4': {
|
|
5831
|
+
|
|
5832
|
+
var WarningListSelect = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
5833
|
+
var options = _ref.options,
|
|
5834
|
+
value = _ref.value,
|
|
5835
|
+
label = _ref.label,
|
|
5836
|
+
_onChange = _ref.onChange,
|
|
5837
|
+
renderOption = _ref.renderOption,
|
|
5838
|
+
renderValue = _ref.renderValue,
|
|
5839
|
+
gridArea = _ref.gridArea,
|
|
5840
|
+
additionalStyling = _ref.additionalStyling,
|
|
5841
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
5842
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
|
|
5843
|
+
var currentIndex = options.findIndex(function (option) {
|
|
5844
|
+
return option.value === value;
|
|
5845
|
+
});
|
|
5846
|
+
return jsx(FormControl, {
|
|
5847
|
+
style: {
|
|
5650
5848
|
width: '100%',
|
|
5651
|
-
|
|
5652
|
-
}
|
|
5653
|
-
}, _ref4[containerQueryBreakpoint] = {
|
|
5654
|
-
'.MuiGrid-grid-sm-6': {
|
|
5655
|
-
width: sm6Width,
|
|
5656
|
-
minWidth: sm6Width
|
|
5849
|
+
gridArea: gridArea
|
|
5657
5850
|
},
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5851
|
+
children: jsxs(TooltipSelect, {
|
|
5852
|
+
disableUnderline: true,
|
|
5853
|
+
tooltip: "",
|
|
5854
|
+
style: {
|
|
5855
|
+
maxWidth: '100%'
|
|
5856
|
+
},
|
|
5857
|
+
isEnabled: !isDisabled,
|
|
5858
|
+
disabled: isDisabled,
|
|
5859
|
+
value: value != null ? value : '',
|
|
5860
|
+
SelectDisplayProps: {
|
|
5861
|
+
'aria-label': label
|
|
5862
|
+
},
|
|
5863
|
+
list: options,
|
|
5864
|
+
additionalStyling: additionalStyling,
|
|
5865
|
+
currentIndex: currentIndex > -1 ? currentIndex : undefined,
|
|
5866
|
+
renderValue: renderValue,
|
|
5867
|
+
onChange: function onChange(event) {
|
|
5868
|
+
_onChange(event.target.value);
|
|
5869
|
+
},
|
|
5870
|
+
onChangeMouseWheel: function onChangeMouseWheel(event) {
|
|
5871
|
+
_onChange(event.value);
|
|
5872
|
+
},
|
|
5873
|
+
children: [jsx(MenuItem, {
|
|
5874
|
+
disabled: true,
|
|
5875
|
+
sx: {
|
|
5876
|
+
display: 'none'
|
|
5877
|
+
}
|
|
5878
|
+
}), options.map(function (option, index) {
|
|
5879
|
+
if (renderOption) {
|
|
5880
|
+
return renderOption(option, index);
|
|
5881
|
+
}
|
|
5882
|
+
return jsx(MenuItem, {
|
|
5883
|
+
value: option.value,
|
|
5884
|
+
sx: function sx(theme) {
|
|
5885
|
+
return {
|
|
5886
|
+
'&.MuiMenuItem-root': Object.assign({}, theme.typography.caption)
|
|
5887
|
+
};
|
|
5888
|
+
},
|
|
5889
|
+
children: typeof option.label === 'function' ? option.label(t) : option.label
|
|
5890
|
+
}, option.value);
|
|
5891
|
+
})]
|
|
5892
|
+
})
|
|
5893
|
+
});
|
|
5663
5894
|
});
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5895
|
+
|
|
5896
|
+
var WindForceLevel;
|
|
5897
|
+
(function (WindForceLevel) {
|
|
5898
|
+
WindForceLevel["moderate"] = "moderate";
|
|
5899
|
+
WindForceLevel["severe"] = "severe";
|
|
5900
|
+
WindForceLevel["extreme"] = "extreme";
|
|
5901
|
+
})(WindForceLevel || (WindForceLevel = {}));
|
|
5902
|
+
var windForceStyles = {
|
|
5903
|
+
moderate: {
|
|
5904
|
+
color: '#FAE21E',
|
|
5905
|
+
textColor: '#051039',
|
|
5906
|
+
borderColor: '#FBFE02'
|
|
5907
|
+
},
|
|
5908
|
+
severe: {
|
|
5909
|
+
color: '#E27000',
|
|
5910
|
+
textColor: '#051039',
|
|
5911
|
+
borderColor: '#FEAE02'
|
|
5912
|
+
},
|
|
5913
|
+
extreme: {
|
|
5914
|
+
color: '#D62A20',
|
|
5915
|
+
textColor: '#ffffff',
|
|
5916
|
+
borderColor: '#FF0000'
|
|
5917
|
+
}
|
|
5918
|
+
};
|
|
5919
|
+
var WindForceSelect = function WindForceSelect(_ref) {
|
|
5920
|
+
var onChange = _ref.onChange,
|
|
5921
|
+
value = _ref.value,
|
|
5922
|
+
gridArea = _ref.gridArea,
|
|
5923
|
+
options = _ref.options;
|
|
5924
|
+
var warningListOptions = React__default.useMemo(function () {
|
|
5925
|
+
return options.map(function (option) {
|
|
5926
|
+
return {
|
|
5927
|
+
value: option.value,
|
|
5928
|
+
label: option.value
|
|
5929
|
+
};
|
|
5930
|
+
});
|
|
5931
|
+
}, [options]);
|
|
5932
|
+
var _useWarningsTranslati = useWarningsTranslation(),
|
|
5933
|
+
t = _useWarningsTranslati.t;
|
|
5934
|
+
var renderValue = React__default.useCallback(function (optionValue) {
|
|
5935
|
+
var option = options.find(function (option) {
|
|
5936
|
+
return option.value === optionValue;
|
|
5937
|
+
});
|
|
5938
|
+
var level = option.level;
|
|
5939
|
+
var colors = windForceStyles[level];
|
|
5940
|
+
return jsx(Box, {
|
|
5941
|
+
sx: {
|
|
5942
|
+
background: colors.color,
|
|
5943
|
+
color: colors.textColor,
|
|
5944
|
+
width: 'calc(100% + 24px)',
|
|
5945
|
+
padding: [1.5, 1],
|
|
5946
|
+
marginLeft: -1
|
|
5947
|
+
},
|
|
5948
|
+
children: optionValue
|
|
5949
|
+
});
|
|
5950
|
+
}, [options]);
|
|
5951
|
+
var renderOption = React__default.useCallback(function (option, index) {
|
|
5952
|
+
var level = options[index].level;
|
|
5953
|
+
var colors = windForceStyles[level];
|
|
5954
|
+
return jsx(MenuItem, {
|
|
5955
|
+
value: option.value,
|
|
5956
|
+
sx: function sx(theme) {
|
|
5957
|
+
return {
|
|
5958
|
+
'&.MuiMenuItem-root': Object.assign({
|
|
5959
|
+
padding: 1
|
|
5960
|
+
}, theme.typography.caption),
|
|
5961
|
+
'.MuiSelect-select & ': {
|
|
5962
|
+
marginLeft: '-8px'
|
|
5963
|
+
}
|
|
5964
|
+
};
|
|
5965
|
+
},
|
|
5966
|
+
children: jsx(Box, {
|
|
5967
|
+
sx: {
|
|
5968
|
+
background: colors.color,
|
|
5969
|
+
color: colors.textColor,
|
|
5970
|
+
width: '100%',
|
|
5971
|
+
padding: [1.5, 1]
|
|
5972
|
+
},
|
|
5973
|
+
children: t('maritime-windforce', {
|
|
5974
|
+
value: option.value
|
|
5975
|
+
})
|
|
5976
|
+
})
|
|
5977
|
+
}, option.value);
|
|
5978
|
+
}, [t, options]);
|
|
5979
|
+
// change the arrow color for the select when the selected option has the level "extreme"
|
|
5980
|
+
var option = options.find(function (option) {
|
|
5981
|
+
return option.value === value;
|
|
5982
|
+
});
|
|
5983
|
+
var arrowColor = (option == null ? void 0 : option.level) === WindForceLevel.extreme ? '#fff' : undefined;
|
|
5984
|
+
return jsx(WarningListSelect, {
|
|
5985
|
+
label: t('maritime-header-windforce'),
|
|
5986
|
+
gridArea: gridArea,
|
|
5987
|
+
options: warningListOptions,
|
|
5988
|
+
value: value,
|
|
5989
|
+
onChange: onChange,
|
|
5990
|
+
renderOption: renderOption,
|
|
5991
|
+
renderValue: renderValue,
|
|
5992
|
+
additionalStyling: {
|
|
5993
|
+
'& .MuiSvgIcon-root': {
|
|
5994
|
+
fill: arrowColor
|
|
5677
5995
|
}
|
|
5678
5996
|
}
|
|
5679
|
-
|
|
5680
|
-
var _Object$assign;
|
|
5681
|
-
return Object.assign({}, warningDetail, (_Object$assign = {}, _Object$assign[key] = fieldValue, _Object$assign));
|
|
5682
|
-
}
|
|
5683
|
-
return warningDetail;
|
|
5684
|
-
}, {});
|
|
5997
|
+
});
|
|
5685
5998
|
};
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5999
|
+
|
|
6000
|
+
var windDirections = [{
|
|
6001
|
+
value: 'NORTH',
|
|
6002
|
+
label: function label(t) {
|
|
6003
|
+
return t('maritime-direction-n');
|
|
6004
|
+
}
|
|
6005
|
+
}, {
|
|
6006
|
+
value: 'NORTH_TO_NORTHEAST',
|
|
6007
|
+
label: function label(t) {
|
|
6008
|
+
return t('maritime-direction-nne');
|
|
6009
|
+
}
|
|
6010
|
+
}, {
|
|
6011
|
+
value: 'NORTHEAST',
|
|
6012
|
+
label: function label(t) {
|
|
6013
|
+
return t('maritime-direction-ne');
|
|
6014
|
+
}
|
|
6015
|
+
}, {
|
|
6016
|
+
value: 'NORTHEAST_TO_NORTH',
|
|
6017
|
+
label: function label(t) {
|
|
6018
|
+
return t('maritime-direction-nen');
|
|
6019
|
+
}
|
|
6020
|
+
}, {
|
|
6021
|
+
value: 'EAST',
|
|
6022
|
+
label: function label(t) {
|
|
6023
|
+
return t('maritime-direction-e');
|
|
6024
|
+
}
|
|
6025
|
+
}, {
|
|
6026
|
+
value: 'EAST_TO_SOUTHEAST',
|
|
6027
|
+
label: function label(t) {
|
|
6028
|
+
return t('maritime-direction-ese');
|
|
6029
|
+
}
|
|
6030
|
+
}, {
|
|
6031
|
+
value: 'SOUTHEAST',
|
|
6032
|
+
label: function label(t) {
|
|
6033
|
+
return t('maritime-direction-se');
|
|
6034
|
+
}
|
|
6035
|
+
}, {
|
|
6036
|
+
value: 'SOUTHEAST_TO_SOUTH',
|
|
6037
|
+
label: function label(t) {
|
|
6038
|
+
return t('maritime-direction-ses');
|
|
6039
|
+
}
|
|
6040
|
+
}, {
|
|
6041
|
+
value: 'SOUTH',
|
|
6042
|
+
label: function label(t) {
|
|
6043
|
+
return t('maritime-direction-s');
|
|
6044
|
+
}
|
|
6045
|
+
}, {
|
|
6046
|
+
value: 'SOUTH_TO_SOUTHWEST',
|
|
6047
|
+
label: function label(t) {
|
|
6048
|
+
return t('maritime-direction-ssw');
|
|
6049
|
+
}
|
|
6050
|
+
}, {
|
|
6051
|
+
value: 'SOUTHWEST',
|
|
6052
|
+
label: function label(t) {
|
|
6053
|
+
return t('maritime-direction-sw');
|
|
6054
|
+
}
|
|
6055
|
+
}, {
|
|
6056
|
+
value: 'SOUTHWEST_TO_WEST',
|
|
6057
|
+
label: function label(t) {
|
|
6058
|
+
return t('maritime-direction-sww');
|
|
6059
|
+
}
|
|
6060
|
+
}, {
|
|
6061
|
+
value: 'WEST',
|
|
6062
|
+
label: function label(t) {
|
|
6063
|
+
return t('maritime-direction-w');
|
|
6064
|
+
}
|
|
6065
|
+
}, {
|
|
6066
|
+
value: 'WEST_TO_NORTHWEST',
|
|
6067
|
+
label: function label(t) {
|
|
6068
|
+
return t('maritime-direction-wnw');
|
|
6069
|
+
}
|
|
6070
|
+
}, {
|
|
6071
|
+
value: 'NORTHWEST',
|
|
6072
|
+
label: function label(t) {
|
|
6073
|
+
return t('maritime-direction-nw');
|
|
6074
|
+
}
|
|
6075
|
+
}, {
|
|
6076
|
+
value: 'NORTHWEST_TO_NORTH',
|
|
6077
|
+
label: function label(t) {
|
|
6078
|
+
return t('maritime-direction-nwn');
|
|
6079
|
+
}
|
|
6080
|
+
}];
|
|
6081
|
+
var change = [{
|
|
6082
|
+
value: 'NO_CHANGE',
|
|
6083
|
+
label: function label(t) {
|
|
6084
|
+
return t('maritime-no-change');
|
|
6085
|
+
}
|
|
6086
|
+
}, {
|
|
6087
|
+
value: 'BACKING',
|
|
6088
|
+
label: function label(t) {
|
|
6089
|
+
return t('maritime-backing');
|
|
6090
|
+
}
|
|
6091
|
+
}, {
|
|
6092
|
+
value: 'VEERING',
|
|
6093
|
+
label: function label(t) {
|
|
6094
|
+
return t('maritime-veering');
|
|
6095
|
+
}
|
|
6096
|
+
}];
|
|
6097
|
+
var windForce = [{
|
|
6098
|
+
level: WindForceLevel.extreme,
|
|
6099
|
+
value: '12'
|
|
6100
|
+
}, {
|
|
6101
|
+
level: WindForceLevel.extreme,
|
|
6102
|
+
value: '11'
|
|
6103
|
+
}, {
|
|
6104
|
+
level: WindForceLevel.extreme,
|
|
6105
|
+
value: '10'
|
|
6106
|
+
}, {
|
|
6107
|
+
level: WindForceLevel.severe,
|
|
6108
|
+
value: '9'
|
|
6109
|
+
}, {
|
|
6110
|
+
level: WindForceLevel.severe,
|
|
6111
|
+
value: '8'
|
|
6112
|
+
}, {
|
|
6113
|
+
level: WindForceLevel.moderate,
|
|
6114
|
+
value: '7'
|
|
6115
|
+
}, {
|
|
6116
|
+
level: WindForceLevel.moderate,
|
|
6117
|
+
value: '6'
|
|
6118
|
+
}];
|
|
6119
|
+
|
|
6120
|
+
var WarningListDragHandle = function WarningListDragHandle() {
|
|
6121
|
+
return jsx(CustomIconButton, {
|
|
6122
|
+
className: "handle",
|
|
6123
|
+
tabIndex: -1,
|
|
6124
|
+
disableTouchRipple: true,
|
|
6125
|
+
sx: {
|
|
6126
|
+
'&.handle:hover': function handleHover(theme) {
|
|
6127
|
+
return Object.assign({}, theme.palette.geowebColors.layerManager.dragHandleHover);
|
|
6128
|
+
},
|
|
6129
|
+
cursor: 'grab',
|
|
6130
|
+
marginTop: 0.5
|
|
6131
|
+
},
|
|
6132
|
+
children: jsx(DragHandle, {})
|
|
6133
|
+
});
|
|
6134
|
+
};
|
|
6135
|
+
|
|
6136
|
+
var WarningListItem$1 = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
6137
|
+
var warning = _ref.warning,
|
|
6138
|
+
areas = _ref.areas,
|
|
6139
|
+
selectedAreaIds = _ref.selectedAreaIds,
|
|
6140
|
+
onAddClick = _ref.onAddClick,
|
|
6141
|
+
onRemove = _ref.onRemove,
|
|
6142
|
+
onChange = _ref.onChange,
|
|
6143
|
+
onToggleSelectArea = _ref.onToggleSelectArea,
|
|
6144
|
+
onRemoveArea = _ref.onRemoveArea,
|
|
6145
|
+
_ref$shouldShowDistri = _ref.shouldShowDistricts,
|
|
6146
|
+
shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri;
|
|
6147
|
+
var areasById = React__default.useMemo(function () {
|
|
6148
|
+
return new Map(areas.map(function (area) {
|
|
6149
|
+
return [area.id, area];
|
|
6150
|
+
}));
|
|
6151
|
+
}, [areas]);
|
|
6152
|
+
var assignedAreas = React__default.useMemo(function () {
|
|
6153
|
+
return warning.assignedAreaIds.map(function (areaId) {
|
|
6154
|
+
return areasById.get(areaId);
|
|
6155
|
+
});
|
|
6156
|
+
}, [warning.assignedAreaIds, areasById]);
|
|
6157
|
+
var _useWarningsTranslati = useWarningsTranslation(),
|
|
6158
|
+
t = _useWarningsTranslati.t;
|
|
6159
|
+
var handleChangeFromDirection = React__default.useCallback(function (value) {
|
|
6160
|
+
onChange(warning.id, {
|
|
6161
|
+
windDirectionFrom: value
|
|
6162
|
+
});
|
|
6163
|
+
}, [onChange, warning.id]);
|
|
6164
|
+
var handleChangeWindForce = React__default.useCallback(function (value) {
|
|
6165
|
+
onChange(warning.id, {
|
|
6166
|
+
windForce: value
|
|
6167
|
+
});
|
|
6168
|
+
}, [onChange, warning]);
|
|
6169
|
+
var handleChangeWindChangeType = React__default.useCallback(function (value) {
|
|
6170
|
+
onChange(warning.id, {
|
|
6171
|
+
changeType: value
|
|
6172
|
+
});
|
|
6173
|
+
if (value === 'NO_CHANGE') {
|
|
6174
|
+
onChange(warning.id, {
|
|
6175
|
+
windDirectionTo: ''
|
|
6176
|
+
});
|
|
6177
|
+
}
|
|
6178
|
+
}, [onChange, warning]);
|
|
6179
|
+
var handleChangeToDirection = React__default.useCallback(function (value) {
|
|
6180
|
+
onChange(warning.id, {
|
|
6181
|
+
windDirectionTo: value
|
|
6182
|
+
});
|
|
6183
|
+
}, [onChange, warning]);
|
|
6184
|
+
var handleAddClick = React__default.useCallback(function () {
|
|
6185
|
+
onAddClick(warning.id);
|
|
6186
|
+
}, [warning.id, onAddClick]);
|
|
6187
|
+
var shouldDisableDirTo = warning.changeType === 'NO_CHANGE';
|
|
6188
|
+
return jsxs(StyledItem, {
|
|
6189
|
+
"data-testid": "maritime-warning",
|
|
6190
|
+
children: [jsx(WarningListDragHandle, {}), jsx(WarningListSelect, {
|
|
6191
|
+
gridArea: "dirFrom",
|
|
6192
|
+
label: t('maritime-header-direction-from'),
|
|
6193
|
+
options: windDirections,
|
|
6194
|
+
onChange: handleChangeFromDirection,
|
|
6195
|
+
value: warning.windDirectionFrom
|
|
6196
|
+
}), jsx(WindForceSelect, {
|
|
6197
|
+
gridArea: "windForce",
|
|
6198
|
+
value: warning.windForce,
|
|
6199
|
+
options: windForce,
|
|
6200
|
+
onChange: handleChangeWindForce
|
|
6201
|
+
}), jsx(AssignedAreas, {
|
|
6202
|
+
assignedAreas: assignedAreas,
|
|
6203
|
+
selectedAreaIds: selectedAreaIds,
|
|
6204
|
+
onAddClick: handleAddClick,
|
|
6205
|
+
onToggleSelectArea: onToggleSelectArea,
|
|
6206
|
+
onDeleteClick: onRemoveArea,
|
|
6207
|
+
shouldShowDistricts: shouldShowDistricts
|
|
6208
|
+
}), jsx(WarningListSelect, {
|
|
6209
|
+
gridArea: "changeType",
|
|
6210
|
+
label: t('maritime-header-change'),
|
|
6211
|
+
options: change,
|
|
6212
|
+
onChange: handleChangeWindChangeType,
|
|
6213
|
+
value: warning.changeType
|
|
6214
|
+
}), jsx(WarningListSelect, {
|
|
6215
|
+
gridArea: "dirTo",
|
|
6216
|
+
label: t('maritime-header-direction-to'),
|
|
6217
|
+
options: windDirections,
|
|
6218
|
+
onChange: handleChangeToDirection,
|
|
6219
|
+
value: warning.windDirectionTo,
|
|
6220
|
+
isDisabled: shouldDisableDirTo
|
|
6221
|
+
}), jsx(IconButton, {
|
|
6222
|
+
sx: {
|
|
6223
|
+
gridArea: 'delete',
|
|
6224
|
+
justifySelf: 'end',
|
|
6225
|
+
padding: 0,
|
|
6226
|
+
marginTop: 0.5
|
|
6227
|
+
},
|
|
6228
|
+
size: "small",
|
|
6229
|
+
onClick: function onClick() {
|
|
6230
|
+
return onRemove(warning.id);
|
|
6231
|
+
},
|
|
6232
|
+
"aria-label": t('maritime-delete-button'),
|
|
6233
|
+
children: jsx(Delete, {})
|
|
6234
|
+
})]
|
|
6235
|
+
});
|
|
6236
|
+
});
|
|
6237
|
+
var StyledItem = styled('div')(function (_ref2) {
|
|
6238
|
+
var _ref3;
|
|
6239
|
+
var theme = _ref2.theme;
|
|
6240
|
+
return _ref3 = {
|
|
6241
|
+
marginBottom: theme.spacing(0.25),
|
|
6242
|
+
backgroundColor: theme.palette.geowebColors.cards.cardContainer,
|
|
6243
|
+
borderColor: theme.palette.geowebColors.cards.cardContainerBorder,
|
|
6244
|
+
borderRadius: theme.shape.borderRadius,
|
|
6245
|
+
borderWidth: '1px',
|
|
6246
|
+
borderStyle: 'solid',
|
|
6247
|
+
display: 'grid',
|
|
6248
|
+
alignItems: 'start',
|
|
6249
|
+
gap: theme.spacing(0.5),
|
|
6250
|
+
paddingInline: theme.spacing(0.25),
|
|
6251
|
+
// styling for small windows
|
|
6252
|
+
gridTemplateAreas: "\n \"drag dirFrom dirFrom windForce delete\"\n \". areas areas areas .\"\n \". changeType dirTo dirTo .\" \n ",
|
|
6253
|
+
gridTemplateColumns: '24px minmax(87px, 1fr) 1fr minmax(60px, 1fr) 24px'
|
|
6254
|
+
}, _ref3["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
6255
|
+
gridTemplateAreas: "\n \"drag dirFrom windForce areas changeType dirTo delete\" \n ",
|
|
6256
|
+
gridTemplateColumns: 'var(--grid-columns)'
|
|
6257
|
+
}, _ref3;
|
|
6258
|
+
});
|
|
6259
|
+
|
|
6260
|
+
var WarningList = function WarningList(_ref) {
|
|
6261
|
+
var _sx;
|
|
6262
|
+
var warnings = _ref.warnings,
|
|
6263
|
+
areas = _ref.areas,
|
|
6264
|
+
selectedAreaIds = _ref.selectedAreaIds,
|
|
6265
|
+
onAddSelectedAreas = _ref.onAddSelectedAreas,
|
|
6266
|
+
onRemoveWarning = _ref.onRemoveWarning,
|
|
6267
|
+
onRemoveArea = _ref.onRemoveArea,
|
|
6268
|
+
onChangeWarning = _ref.onChangeWarning,
|
|
6269
|
+
onToggleSelectArea = _ref.onToggleSelectArea,
|
|
6270
|
+
onMoveWarning = _ref.onMoveWarning,
|
|
6271
|
+
_ref$shouldShowDistri = _ref.shouldShowDistricts,
|
|
6272
|
+
shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri;
|
|
6273
|
+
var _useWarningsTranslati = useWarningsTranslation(),
|
|
6274
|
+
t = _useWarningsTranslati.t;
|
|
6275
|
+
var onSort = React__default.useCallback(function (event) {
|
|
6276
|
+
onMoveWarning(event.oldIndex, event.newIndex);
|
|
6277
|
+
}, [onMoveWarning]);
|
|
6278
|
+
return jsxs(Box, {
|
|
6279
|
+
"data-testid": "warninglist",
|
|
6280
|
+
sx: {
|
|
6281
|
+
display: 'flex',
|
|
6282
|
+
flexDirection: 'column',
|
|
6283
|
+
minHeight: 0,
|
|
6284
|
+
'--grid-columns': '30px 150px 60px 2fr 100px 100px 1fr' // FIXME modify this using breakpoints
|
|
6285
|
+
},
|
|
6286
|
+
children: [jsxs(Box, {
|
|
6287
|
+
sx: (_sx = {
|
|
6288
|
+
display: 'none'
|
|
6289
|
+
}, _sx["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
6290
|
+
display: 'grid'
|
|
6291
|
+
}, _sx.gridTemplateColumns = 'var(--grid-columns)', _sx.gap = 0.5, _sx.paddingBlockEnd = 1, _sx.justifyItems = 'center', _sx['& > *'] = {
|
|
6292
|
+
width: 'auto !important'
|
|
6293
|
+
}, _sx),
|
|
6294
|
+
children: [jsx(WarningListHeaderContent, {
|
|
6295
|
+
title: t('maritime-header-direction'),
|
|
6296
|
+
sx: {
|
|
6297
|
+
gridColumnStart: 2
|
|
6298
|
+
}
|
|
6299
|
+
}), jsx(WarningListHeaderContent, {
|
|
6300
|
+
title: t('maritime-header-windforce')
|
|
6301
|
+
}), jsx(WarningListHeaderContent, {
|
|
6302
|
+
title: shouldShowDistricts ? t('maritime-header-districts') : t('maritime-header-areas')
|
|
6303
|
+
}), jsx(WarningListHeaderContent, {
|
|
6304
|
+
title: t('maritime-header-change')
|
|
6305
|
+
}), jsx(WarningListHeaderContent, {
|
|
6306
|
+
title: t('maritime-header-direction')
|
|
6307
|
+
})]
|
|
6308
|
+
}), jsx(ReactSortable, {
|
|
6309
|
+
tag: "div",
|
|
6310
|
+
list: warnings,
|
|
6311
|
+
onSort: onSort,
|
|
6312
|
+
setList: function setList() {},
|
|
6313
|
+
animation: 200,
|
|
6314
|
+
handle: ".handle",
|
|
6315
|
+
direction: "vertical",
|
|
6316
|
+
style: {
|
|
6317
|
+
minHeight: 0,
|
|
6318
|
+
overflow: 'auto'
|
|
6319
|
+
},
|
|
6320
|
+
children: warnings.map(function (warning) {
|
|
6321
|
+
return jsx(WarningListItem$1, {
|
|
6322
|
+
warning: warning,
|
|
6323
|
+
areas: areas,
|
|
6324
|
+
selectedAreaIds: selectedAreaIds,
|
|
6325
|
+
onToggleSelectArea: onToggleSelectArea,
|
|
6326
|
+
onAddClick: onAddSelectedAreas,
|
|
6327
|
+
onRemove: onRemoveWarning,
|
|
6328
|
+
onChange: onChangeWarning,
|
|
6329
|
+
onRemoveArea: onRemoveArea,
|
|
6330
|
+
shouldShowDistricts: shouldShowDistricts
|
|
6331
|
+
}, warning.id);
|
|
6332
|
+
})
|
|
6333
|
+
})]
|
|
6334
|
+
});
|
|
6335
|
+
};
|
|
6336
|
+
|
|
6337
|
+
var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
6338
|
+
var _sx, _sx2, _sx3;
|
|
6339
|
+
var areas = _ref.areas,
|
|
6340
|
+
selectedAreaIds = _ref.selectedAreaIds,
|
|
6341
|
+
modified = _ref.modified,
|
|
6342
|
+
warnings = _ref.warnings,
|
|
6343
|
+
onToggleSelectArea = _ref.onToggleSelectArea,
|
|
6344
|
+
onAddSelectedAreas = _ref.onAddSelectedAreas,
|
|
6345
|
+
onRemoveWarning = _ref.onRemoveWarning,
|
|
6346
|
+
onRemoveArea = _ref.onRemoveArea,
|
|
6347
|
+
onAddWarning = _ref.onAddWarning,
|
|
6348
|
+
onChangeWarning = _ref.onChangeWarning,
|
|
6349
|
+
onSubmit = _ref.onSubmit,
|
|
6350
|
+
onClear = _ref.onClear,
|
|
6351
|
+
onMoveWarning = _ref.onMoveWarning,
|
|
6352
|
+
_ref$shouldShowDistri = _ref.shouldShowDistricts,
|
|
6353
|
+
shouldShowDistricts = _ref$shouldShowDistri === void 0 ? false : _ref$shouldShowDistri;
|
|
6354
|
+
var _useWarningsTranslati = useWarningsTranslation(),
|
|
6355
|
+
t = _useWarningsTranslati.t;
|
|
6356
|
+
var disabledAreaIds = warnings.flatMap(function (warning) {
|
|
6357
|
+
return warning.assignedAreaIds;
|
|
6358
|
+
});
|
|
6359
|
+
return jsxs(Stack, {
|
|
6360
|
+
direction: "column",
|
|
6361
|
+
spacing: 3,
|
|
6362
|
+
sx: (_sx = {
|
|
6363
|
+
height: '100%',
|
|
6364
|
+
containerName: 'maritime',
|
|
6365
|
+
containerType: 'inline-size',
|
|
6366
|
+
padding: 2
|
|
6367
|
+
}, _sx["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
6368
|
+
padding: 3
|
|
6369
|
+
}, _sx),
|
|
6370
|
+
children: [jsx(AreaList, {
|
|
6371
|
+
areas: areas,
|
|
6372
|
+
selected: selectedAreaIds,
|
|
6373
|
+
disabled: disabledAreaIds,
|
|
6374
|
+
onClickItem: onToggleSelectArea
|
|
6375
|
+
}), jsx(WarningList, {
|
|
6376
|
+
warnings: warnings,
|
|
6377
|
+
areas: areas,
|
|
6378
|
+
selectedAreaIds: selectedAreaIds,
|
|
6379
|
+
onAddSelectedAreas: onAddSelectedAreas,
|
|
6380
|
+
onRemoveWarning: onRemoveWarning,
|
|
6381
|
+
onChangeWarning: onChangeWarning,
|
|
6382
|
+
onToggleSelectArea: onToggleSelectArea,
|
|
6383
|
+
onRemoveArea: onRemoveArea,
|
|
6384
|
+
onMoveWarning: onMoveWarning,
|
|
6385
|
+
shouldShowDistricts: shouldShowDistricts
|
|
6386
|
+
}), jsxs(Button, {
|
|
6387
|
+
onClick: onAddWarning,
|
|
6388
|
+
variant: "tertiary",
|
|
6389
|
+
size: "small",
|
|
6390
|
+
sx: {
|
|
6391
|
+
alignSelf: 'flex-start',
|
|
6392
|
+
paddingInline: 2
|
|
6393
|
+
},
|
|
6394
|
+
children: [jsx(Add, {}), t('maritime-new-warning')]
|
|
6395
|
+
}), jsxs(Stack, {
|
|
6396
|
+
spacing: 2,
|
|
6397
|
+
direction: "row",
|
|
6398
|
+
sx: (_sx2 = {}, _sx2["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
6399
|
+
position: 'absolute',
|
|
6400
|
+
bottom: 0,
|
|
6401
|
+
right: 0,
|
|
6402
|
+
padding: 3
|
|
6403
|
+
}, _sx2),
|
|
6404
|
+
children: [jsx(Button, {
|
|
6405
|
+
onClick: onClear,
|
|
6406
|
+
variant: "tertiary",
|
|
6407
|
+
size: "small",
|
|
6408
|
+
sx: {
|
|
6409
|
+
width: '134px'
|
|
6410
|
+
},
|
|
6411
|
+
children: t('warning-button-clear')
|
|
6412
|
+
}), jsx(Button, {
|
|
6413
|
+
variant: "primary",
|
|
6414
|
+
size: "small",
|
|
6415
|
+
sx: (_sx3 = {
|
|
6416
|
+
width: '134px'
|
|
6417
|
+
}, _sx3["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
6418
|
+
marginLeft: '24px!important'
|
|
6419
|
+
}, _sx3),
|
|
6420
|
+
disabled: !modified,
|
|
6421
|
+
onClick: onSubmit,
|
|
6422
|
+
children: t('warning-button-publish')
|
|
6423
|
+
})]
|
|
6424
|
+
})]
|
|
6425
|
+
});
|
|
6426
|
+
};
|
|
6427
|
+
|
|
6428
|
+
/* *
|
|
6429
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6430
|
+
* you may not use this file except in compliance with the License.
|
|
6431
|
+
* You may obtain a copy of the License at
|
|
6432
|
+
*
|
|
6433
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6434
|
+
*
|
|
6435
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6436
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6437
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6438
|
+
* See the License for the specific language governing permissions and
|
|
6439
|
+
* limitations under the License.
|
|
6440
|
+
*
|
|
6441
|
+
* Copyright 2025 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
6442
|
+
* Copyright 2025 - Finnish Meteorological Institute (FMI)
|
|
6443
|
+
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
6444
|
+
* */
|
|
6445
|
+
var localWarningId = 0;
|
|
6446
|
+
function createWarning() {
|
|
6447
|
+
localWarningId += 1;
|
|
6448
|
+
return {
|
|
6449
|
+
assignedAreaIds: [],
|
|
6450
|
+
id: "local-warning-" + localWarningId
|
|
6451
|
+
};
|
|
6452
|
+
}
|
|
6453
|
+
var initialState = {
|
|
6454
|
+
selectedAreaIds: [],
|
|
6455
|
+
warnings: [createWarning()],
|
|
6456
|
+
modified: false
|
|
6457
|
+
};
|
|
6458
|
+
function reducer(state, action) {
|
|
6459
|
+
switch (action.type) {
|
|
6460
|
+
case 'changeWarning':
|
|
6461
|
+
{
|
|
6462
|
+
return Object.assign({}, state, {
|
|
6463
|
+
warnings: state.warnings.map(function (warning) {
|
|
6464
|
+
if (warning.id !== action.id) {
|
|
6465
|
+
return warning;
|
|
6466
|
+
}
|
|
6467
|
+
return Object.assign({}, warning, action.newValues);
|
|
6468
|
+
}),
|
|
6469
|
+
modified: true
|
|
6470
|
+
});
|
|
6471
|
+
}
|
|
6472
|
+
case 'toggleSelectArea':
|
|
6473
|
+
{
|
|
6474
|
+
if (state.selectedAreaIds.includes(action.id)) {
|
|
6475
|
+
return Object.assign({}, state, {
|
|
6476
|
+
selectedAreaIds: state.selectedAreaIds.filter(function (areaId) {
|
|
6477
|
+
return areaId !== action.id;
|
|
6478
|
+
})
|
|
6479
|
+
});
|
|
6480
|
+
}
|
|
6481
|
+
return Object.assign({}, state, {
|
|
6482
|
+
selectedAreaIds: [].concat(state.selectedAreaIds, [action.id])
|
|
6483
|
+
});
|
|
6484
|
+
}
|
|
6485
|
+
case 'removeArea':
|
|
6486
|
+
{
|
|
6487
|
+
return Object.assign({}, state, {
|
|
6488
|
+
selectedAreaIds: state.selectedAreaIds.filter(function (areaId) {
|
|
6489
|
+
return areaId !== action.areaId;
|
|
6490
|
+
}),
|
|
6491
|
+
warnings: state.warnings.map(function (warning) {
|
|
6492
|
+
var warningHasASelectedArea = warning.assignedAreaIds.some(function (areaId) {
|
|
6493
|
+
return areaId === action.areaId;
|
|
6494
|
+
});
|
|
6495
|
+
if (warningHasASelectedArea) {
|
|
6496
|
+
return Object.assign({}, warning, {
|
|
6497
|
+
assignedAreaIds: warning.assignedAreaIds.filter(function (areaId) {
|
|
6498
|
+
return areaId !== action.areaId;
|
|
6499
|
+
})
|
|
6500
|
+
});
|
|
6501
|
+
}
|
|
6502
|
+
return warning;
|
|
6503
|
+
}),
|
|
6504
|
+
modified: true
|
|
6505
|
+
});
|
|
6506
|
+
}
|
|
6507
|
+
case 'newWarning':
|
|
6508
|
+
{
|
|
6509
|
+
return Object.assign({}, state, {
|
|
6510
|
+
warnings: [].concat(state.warnings, [createWarning()])
|
|
6511
|
+
});
|
|
6512
|
+
}
|
|
6513
|
+
case 'addSelectedAreasToWarning':
|
|
6514
|
+
{
|
|
6515
|
+
var selectedAreaIdsSet = new Set(state.selectedAreaIds);
|
|
6516
|
+
return Object.assign({}, state, {
|
|
6517
|
+
warnings: state.warnings.map(function (warning) {
|
|
6518
|
+
// remove the selected areas from other warnings
|
|
6519
|
+
if (warning.id !== action.id) {
|
|
6520
|
+
var warningHasASelectedArea = warning.assignedAreaIds.some(function (areaId) {
|
|
6521
|
+
return selectedAreaIdsSet.has(areaId);
|
|
6522
|
+
});
|
|
6523
|
+
// don't modify the warning if it does not have a selected area
|
|
6524
|
+
if (!warningHasASelectedArea) {
|
|
6525
|
+
return warning;
|
|
6526
|
+
}
|
|
6527
|
+
return Object.assign({}, warning, {
|
|
6528
|
+
assignedAreaIds: warning.assignedAreaIds.filter(function (areaId) {
|
|
6529
|
+
return !selectedAreaIdsSet.has(areaId);
|
|
6530
|
+
})
|
|
6531
|
+
});
|
|
6532
|
+
}
|
|
6533
|
+
// add the area to the given warning
|
|
6534
|
+
var newAreaIds = new Set([].concat(warning.assignedAreaIds, state.selectedAreaIds));
|
|
6535
|
+
return Object.assign({}, warning, {
|
|
6536
|
+
assignedAreaIds: Array.from(newAreaIds)
|
|
6537
|
+
});
|
|
6538
|
+
}),
|
|
6539
|
+
selectedAreaIds: [],
|
|
6540
|
+
modified: true
|
|
6541
|
+
});
|
|
6542
|
+
}
|
|
6543
|
+
case 'removeWarning':
|
|
6544
|
+
{
|
|
6545
|
+
var newWarnings = state.warnings.filter(function (warning) {
|
|
6546
|
+
return warning.id !== action.id;
|
|
6547
|
+
});
|
|
6548
|
+
return Object.assign({}, state, {
|
|
6549
|
+
warnings: newWarnings.length > 0 ? newWarnings : initialState.warnings,
|
|
6550
|
+
modified: true
|
|
6551
|
+
});
|
|
6552
|
+
}
|
|
6553
|
+
case 'clearWarnings':
|
|
6554
|
+
{
|
|
6555
|
+
return Object.assign({}, initialState, {
|
|
6556
|
+
modified: true
|
|
6557
|
+
});
|
|
6558
|
+
}
|
|
6559
|
+
case 'moveWarning':
|
|
6560
|
+
{
|
|
6561
|
+
var oldWarning = state.warnings[action.oldIndex];
|
|
6562
|
+
var _newWarnings = [].concat(state.warnings);
|
|
6563
|
+
_newWarnings.splice(action.oldIndex, 1);
|
|
6564
|
+
_newWarnings.splice(action.newIndex, 0, oldWarning);
|
|
6565
|
+
return Object.assign({}, state, {
|
|
6566
|
+
warnings: _newWarnings,
|
|
6567
|
+
modified: true
|
|
6568
|
+
});
|
|
6569
|
+
}
|
|
6570
|
+
case 'initialize':
|
|
6571
|
+
{
|
|
6572
|
+
if (action.warnings.length === 0) {
|
|
6573
|
+
return initialState;
|
|
6574
|
+
}
|
|
6575
|
+
return Object.assign({}, state, {
|
|
6576
|
+
warnings: action.warnings,
|
|
6577
|
+
selectedAreaIds: []
|
|
6578
|
+
});
|
|
6579
|
+
}
|
|
6580
|
+
default:
|
|
6581
|
+
{
|
|
6582
|
+
return state;
|
|
6583
|
+
}
|
|
6584
|
+
}
|
|
6585
|
+
}
|
|
6586
|
+
function useMaritimeWarningsFormState() {
|
|
6587
|
+
return React__default.useReducer(reducer, initialState);
|
|
6588
|
+
}
|
|
6589
|
+
|
|
6590
|
+
var areasByDomain = {
|
|
6591
|
+
northSeaDistricts: [{
|
|
6592
|
+
id: 'DOGGER',
|
|
6593
|
+
label: 'Dogger'
|
|
6594
|
+
}, {
|
|
6595
|
+
id: 'DOVER',
|
|
6596
|
+
label: 'Dover'
|
|
6597
|
+
}, {
|
|
6598
|
+
id: 'HUMBER',
|
|
6599
|
+
label: 'Humber'
|
|
6600
|
+
}, {
|
|
6601
|
+
id: 'THAMES',
|
|
6602
|
+
label: 'Thames'
|
|
6603
|
+
}],
|
|
6604
|
+
coastalWaters: [{
|
|
6605
|
+
id: 'VLISSINGEN',
|
|
6606
|
+
label: 'Vlissingen'
|
|
6607
|
+
}, {
|
|
6608
|
+
id: 'ZIERIKZEE',
|
|
6609
|
+
label: 'Zierikzee'
|
|
6610
|
+
}, {
|
|
6611
|
+
id: 'HOEK_VAN_HOLLAND',
|
|
6612
|
+
label: 'Hoek van Holland'
|
|
6613
|
+
}, {
|
|
6614
|
+
id: 'IJMUIDEN',
|
|
6615
|
+
label: 'Ijmuiden'
|
|
6616
|
+
}, {
|
|
6617
|
+
id: 'TEXEL',
|
|
6618
|
+
label: 'Texel'
|
|
6619
|
+
}]
|
|
6620
|
+
};
|
|
6621
|
+
|
|
6622
|
+
var MaritimeWarningsFormConnect = function MaritimeWarningsFormConnect(_ref) {
|
|
6623
|
+
var domain = _ref.domain;
|
|
6624
|
+
var areas = areasByDomain[domain];
|
|
6625
|
+
var shouldShowDistricts = domain === 'northSeaDistricts';
|
|
6626
|
+
var _useMaritimeWarningsF = useMaritimeWarningsFormState(),
|
|
6627
|
+
state = _useMaritimeWarningsF[0],
|
|
6628
|
+
dispatch = _useMaritimeWarningsF[1];
|
|
6629
|
+
React__default.useEffect(function () {
|
|
6630
|
+
// FIXME: replace this by warnings from api
|
|
6631
|
+
dispatch({
|
|
6632
|
+
type: 'initialize',
|
|
6633
|
+
warnings: Array.from({
|
|
6634
|
+
length: 1
|
|
6635
|
+
}).map(function (_, index) {
|
|
6636
|
+
return {
|
|
6637
|
+
assignedAreaIds: [],
|
|
6638
|
+
id: (index + 1).toString(),
|
|
6639
|
+
windDirectionFrom: '',
|
|
6640
|
+
windDirectionTo: '',
|
|
6641
|
+
changeType: 'NO_CHANGE'
|
|
6642
|
+
};
|
|
6643
|
+
})
|
|
6644
|
+
});
|
|
6645
|
+
}, [dispatch]);
|
|
6646
|
+
var onToggleSelectArea = React__default.useCallback(function (id) {
|
|
6647
|
+
React__default.startTransition(function () {
|
|
6648
|
+
dispatch({
|
|
6649
|
+
type: 'toggleSelectArea',
|
|
6650
|
+
id: id
|
|
6651
|
+
});
|
|
6652
|
+
});
|
|
6653
|
+
}, [dispatch]);
|
|
6654
|
+
var onAddSelectedAreas = React__default.useCallback(function (id) {
|
|
6655
|
+
React__default.startTransition(function () {
|
|
6656
|
+
dispatch({
|
|
6657
|
+
type: 'addSelectedAreasToWarning',
|
|
6658
|
+
id: id
|
|
6659
|
+
});
|
|
6660
|
+
});
|
|
6661
|
+
}, [dispatch]);
|
|
6662
|
+
var onRemoveWarning = React__default.useCallback(function (id) {
|
|
6663
|
+
React__default.startTransition(function () {
|
|
6664
|
+
dispatch({
|
|
6665
|
+
type: 'removeWarning',
|
|
6666
|
+
id: id
|
|
6667
|
+
});
|
|
6668
|
+
});
|
|
6669
|
+
}, [dispatch]);
|
|
6670
|
+
var onAddWarning = React__default.useCallback(function () {
|
|
6671
|
+
React__default.startTransition(function () {
|
|
6672
|
+
dispatch({
|
|
6673
|
+
type: 'newWarning'
|
|
6674
|
+
});
|
|
6675
|
+
});
|
|
6676
|
+
}, [dispatch]);
|
|
6677
|
+
var onChangeWarning = React__default.useCallback(function (id, newValues) {
|
|
6678
|
+
React__default.startTransition(function () {
|
|
6679
|
+
dispatch({
|
|
6680
|
+
type: 'changeWarning',
|
|
6681
|
+
id: id,
|
|
6682
|
+
newValues: newValues
|
|
6683
|
+
});
|
|
6684
|
+
});
|
|
6685
|
+
}, [dispatch]);
|
|
6686
|
+
var onRemoveArea = React__default.useCallback(function (areaId) {
|
|
6687
|
+
React__default.startTransition(function () {
|
|
6688
|
+
dispatch({
|
|
6689
|
+
type: 'removeArea',
|
|
6690
|
+
areaId: areaId
|
|
6691
|
+
});
|
|
6692
|
+
});
|
|
6693
|
+
}, [dispatch]);
|
|
6694
|
+
var onClear = React__default.useCallback(function () {
|
|
6695
|
+
React__default.startTransition(function () {
|
|
6696
|
+
dispatch({
|
|
6697
|
+
type: 'clearWarnings'
|
|
6698
|
+
});
|
|
6699
|
+
});
|
|
6700
|
+
}, [dispatch]);
|
|
6701
|
+
var onMoveWarning = React__default.useCallback(function (oldIndex, newIndex) {
|
|
6702
|
+
dispatch({
|
|
6703
|
+
type: 'moveWarning',
|
|
6704
|
+
oldIndex: oldIndex,
|
|
6705
|
+
newIndex: newIndex
|
|
6706
|
+
});
|
|
6707
|
+
}, [dispatch]);
|
|
6708
|
+
var onSubmit = React__default.useCallback(function () {
|
|
6709
|
+
// eslint-disable-next-line no-console
|
|
6710
|
+
console.log(state.warnings);
|
|
6711
|
+
// FIXME: add logic for submission
|
|
6712
|
+
}, [state]);
|
|
6713
|
+
return jsx(MaritimeWarningsForm, {
|
|
6714
|
+
areas: areas,
|
|
6715
|
+
selectedAreaIds: state.selectedAreaIds,
|
|
6716
|
+
warnings: state.warnings,
|
|
6717
|
+
modified: state.modified,
|
|
6718
|
+
onToggleSelectArea: onToggleSelectArea,
|
|
6719
|
+
onAddSelectedAreas: onAddSelectedAreas,
|
|
6720
|
+
onRemoveWarning: onRemoveWarning,
|
|
6721
|
+
onRemoveArea: onRemoveArea,
|
|
6722
|
+
onAddWarning: onAddWarning,
|
|
6723
|
+
onChangeWarning: onChangeWarning,
|
|
6724
|
+
onMoveWarning: onMoveWarning,
|
|
6725
|
+
onClear: onClear,
|
|
6726
|
+
onSubmit: onSubmit,
|
|
6727
|
+
shouldShowDistricts: shouldShowDistricts
|
|
6728
|
+
});
|
|
6729
|
+
};
|
|
6730
|
+
|
|
6731
|
+
var _excluded$3 = ["IS_DRAFT", "object", "translation-select"];
|
|
6732
|
+
var useScrollTopOnError = function useScrollTopOnError(error) {
|
|
6733
|
+
var ref = React.useRef(null);
|
|
6734
|
+
React.useEffect(function () {
|
|
6735
|
+
if (error != null && error.message && ref.current) {
|
|
6736
|
+
ref.current.scrollTop = 0;
|
|
6737
|
+
}
|
|
6738
|
+
}, [error]);
|
|
6739
|
+
return ref;
|
|
6740
|
+
};
|
|
6741
|
+
var getEmptyPublicWarning = function getEmptyPublicWarning() {
|
|
6742
|
+
var currentTime = new Date();
|
|
6743
|
+
var validFromTime = dateUtils.add(currentTime, {
|
|
6744
|
+
minutes: 15
|
|
6745
|
+
});
|
|
6746
|
+
var validUntilTime = dateUtils.add(currentTime, {
|
|
6747
|
+
hours: 6,
|
|
6748
|
+
minutes: 15
|
|
6749
|
+
});
|
|
6750
|
+
return {
|
|
6751
|
+
id: '',
|
|
6752
|
+
phenomenon: '',
|
|
6753
|
+
validFrom: dateUtils.dateToString(validFromTime),
|
|
6754
|
+
validUntil: dateUtils.dateToString(validUntilTime),
|
|
6755
|
+
level: '',
|
|
6756
|
+
probability: 30,
|
|
6757
|
+
descriptionOriginal: '',
|
|
6758
|
+
descriptionTranslation: '',
|
|
6759
|
+
areas: []
|
|
6760
|
+
};
|
|
6761
|
+
};
|
|
6762
|
+
var getFormData = function getFormData(publicWarningsDetails, object) {
|
|
6763
|
+
var data = Object.assign({
|
|
6764
|
+
IS_DRAFT: '',
|
|
6765
|
+
'translation-select': ''
|
|
6766
|
+
}, publicWarningsDetails ? Object.assign({}, getEmptyPublicWarning(), publicWarningsDetails) : getEmptyPublicWarning(), {
|
|
6767
|
+
object: object
|
|
6768
|
+
});
|
|
6769
|
+
return data;
|
|
6770
|
+
};
|
|
6771
|
+
// tablet breakpoint - 2 padding * 2 for both sides
|
|
6772
|
+
var containerQueryBreakpoint = "@container (min-width: " + (breakpoints.tablet - 32) + "px)";
|
|
6773
|
+
var spinnerSx = {
|
|
6774
|
+
width: '16px!important',
|
|
6775
|
+
height: '16px!important',
|
|
6776
|
+
position: 'absolute',
|
|
6777
|
+
top: 0,
|
|
6778
|
+
bottom: 0,
|
|
6779
|
+
margin: 'auto',
|
|
6780
|
+
marginLeft: 1
|
|
6781
|
+
};
|
|
6782
|
+
var ContainerWrapper = styled('div')(function () {
|
|
6783
|
+
return {
|
|
6784
|
+
containerType: 'size',
|
|
6785
|
+
height: '100%'
|
|
6786
|
+
};
|
|
6787
|
+
});
|
|
6788
|
+
var ContainerFormWrapper = styled('div')(function (_ref) {
|
|
6789
|
+
var _ref2;
|
|
6790
|
+
var _ref$isReadOnly = _ref.isReadOnly,
|
|
6791
|
+
isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
|
|
6792
|
+
_ref$addPadding = _ref.addPadding,
|
|
6793
|
+
addPadding = _ref$addPadding === void 0 ? true : _ref$addPadding,
|
|
6794
|
+
theme = _ref.theme;
|
|
6795
|
+
return _ref2 = {
|
|
6796
|
+
padding: addPadding ? theme.spacing(2) : 0,
|
|
6797
|
+
height: isReadOnly ? '100%' : "calc(100% - 206px)",
|
|
6798
|
+
overflowY: 'auto'
|
|
6799
|
+
}, _ref2[containerQueryBreakpoint] = {
|
|
6800
|
+
height: isReadOnly ? '100%' : 'calc(100% - 88px)'
|
|
6801
|
+
}, _ref2;
|
|
6802
|
+
});
|
|
6803
|
+
var sm6Width = 'calc(100% * 6 / var(--Grid-columns) - (var(--Grid-columns) - 6) * (var(--Grid-columnSpacing) / var(--Grid-columns)))';
|
|
6804
|
+
var sm4Width = 'calc(100% * 4 / var(--Grid-columns) - (var(--Grid-columns) - 4) * (var(--Grid-columnSpacing) / var(--Grid-columns)))';
|
|
6805
|
+
var ContainerGrid = styled('div')(function (_ref3) {
|
|
6806
|
+
var _ref4;
|
|
6807
|
+
var theme = _ref3.theme;
|
|
6808
|
+
return _ref4 = {
|
|
6809
|
+
backgroundColor: theme.palette.background.paper,
|
|
6810
|
+
'.MuiGrid-grid-sm-6, .MuiGrid-grid-sm-4': {
|
|
6811
|
+
width: '100%',
|
|
6812
|
+
minWidth: '100%'
|
|
6813
|
+
}
|
|
6814
|
+
}, _ref4[containerQueryBreakpoint] = {
|
|
6815
|
+
'.MuiGrid-grid-sm-6': {
|
|
6816
|
+
width: sm6Width,
|
|
6817
|
+
minWidth: sm6Width
|
|
6818
|
+
},
|
|
6819
|
+
'.MuiGrid-grid-sm-4': {
|
|
6820
|
+
width: sm4Width,
|
|
6821
|
+
minWidth: sm4Width
|
|
6822
|
+
}
|
|
6823
|
+
}, _ref4;
|
|
6824
|
+
});
|
|
6825
|
+
var prepareFormValues = function prepareFormValues(data) {
|
|
6826
|
+
// remove unneeded fields
|
|
6827
|
+
data.IS_DRAFT;
|
|
6828
|
+
data.object;
|
|
6829
|
+
data['translation-select'];
|
|
6830
|
+
var productToPost = _objectWithoutPropertiesLoose(data, _excluded$3);
|
|
6831
|
+
// remove empty fields
|
|
6832
|
+
return Object.keys(productToPost).reduce(function (warningDetail, fieldName) {
|
|
6833
|
+
var key = fieldName;
|
|
6834
|
+
var fieldValue = productToPost[key];
|
|
6835
|
+
if (Array.isArray(fieldValue)) {
|
|
6836
|
+
if (!fieldValue.length || fieldValue[0].geoJSON === null) {
|
|
6837
|
+
return warningDetail;
|
|
6838
|
+
}
|
|
6839
|
+
}
|
|
6840
|
+
if (fieldValue) {
|
|
6841
|
+
var _Object$assign;
|
|
6842
|
+
return Object.assign({}, warningDetail, (_Object$assign = {}, _Object$assign[key] = fieldValue, _Object$assign));
|
|
6843
|
+
}
|
|
6844
|
+
return warningDetail;
|
|
6845
|
+
}, {});
|
|
6846
|
+
};
|
|
6847
|
+
var getErrors = function getErrors(errors) {
|
|
6848
|
+
return errors ? errors == null ? void 0 : errors.split(/\r?\n/).reduce(function (allErrors, error, index) {
|
|
6849
|
+
if (index === 0) {
|
|
6850
|
+
return Object.assign({}, allErrors, {
|
|
5690
6851
|
title: error
|
|
5691
6852
|
});
|
|
5692
6853
|
}
|
|
@@ -6166,22 +7327,36 @@ var Form = function Form(_ref5) {
|
|
|
6166
7327
|
var ref = useScrollTopOnError(error);
|
|
6167
7328
|
var _useProductConfig = useProductConfig(warningType),
|
|
6168
7329
|
aviationConfig = _useProductConfig.data;
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
|
|
6183
|
-
|
|
6184
|
-
|
|
7330
|
+
var isMaritimeWarning = warningType === 'maritimeWarningCoastal' || warningType === 'maritimeWarningNorthSea';
|
|
7331
|
+
var getFormContent = function getFormContent() {
|
|
7332
|
+
// Aviation forms
|
|
7333
|
+
if (selectedAviationProduct) {
|
|
7334
|
+
if (warningType === 'sigmet') {
|
|
7335
|
+
return jsx(Box, {
|
|
7336
|
+
sx: {
|
|
7337
|
+
maxWidth: {
|
|
7338
|
+
xs: '550px',
|
|
7339
|
+
sm: '750px'
|
|
7340
|
+
},
|
|
7341
|
+
marginLeft: '-80px'
|
|
7342
|
+
},
|
|
7343
|
+
children: jsx(SigmetForm, {
|
|
7344
|
+
showMap: false,
|
|
7345
|
+
mode: mode,
|
|
7346
|
+
initialSigmet: selectedAviationProduct !== undefined && !isInstanceOfCancelSigmet(selectedAviationProduct) ? selectedAviationProduct : null,
|
|
7347
|
+
isCancelSigmet: selectedAviationProduct !== undefined && isInstanceOfCancelSigmet(selectedAviationProduct),
|
|
7348
|
+
initialCancelSigmet: selectedAviationProduct !== undefined && isInstanceOfCancelSigmet(selectedAviationProduct) ? selectedAviationProduct : null,
|
|
7349
|
+
productConfig: aviationConfig,
|
|
7350
|
+
product: selectedAviationProduct,
|
|
7351
|
+
getTAC: function getTAC(product) {
|
|
7352
|
+
return fetchSigmetTAC(product);
|
|
7353
|
+
},
|
|
7354
|
+
storedGeoJSON: storedStartGeoJSON,
|
|
7355
|
+
storedEndGeoJSON: storedEndGeoJSON
|
|
7356
|
+
})
|
|
7357
|
+
});
|
|
7358
|
+
}
|
|
7359
|
+
return jsx(Box, {
|
|
6185
7360
|
sx: {
|
|
6186
7361
|
maxWidth: {
|
|
6187
7362
|
xs: '550px',
|
|
@@ -6189,20 +7364,7 @@ var Form = function Form(_ref5) {
|
|
|
6189
7364
|
},
|
|
6190
7365
|
marginLeft: '-80px'
|
|
6191
7366
|
},
|
|
6192
|
-
children:
|
|
6193
|
-
showMap: false,
|
|
6194
|
-
mode: mode,
|
|
6195
|
-
initialSigmet: selectedAviationProduct !== undefined && !isInstanceOfCancelSigmet(selectedAviationProduct) ? selectedAviationProduct : null,
|
|
6196
|
-
isCancelSigmet: selectedAviationProduct !== undefined && isInstanceOfCancelSigmet(selectedAviationProduct),
|
|
6197
|
-
initialCancelSigmet: selectedAviationProduct !== undefined && isInstanceOfCancelSigmet(selectedAviationProduct) ? selectedAviationProduct : null,
|
|
6198
|
-
productConfig: aviationConfig,
|
|
6199
|
-
product: selectedAviationProduct,
|
|
6200
|
-
getTAC: function getTAC(product) {
|
|
6201
|
-
return fetchSigmetTAC(product);
|
|
6202
|
-
},
|
|
6203
|
-
storedGeoJSON: storedStartGeoJSON,
|
|
6204
|
-
storedEndGeoJSON: storedEndGeoJSON
|
|
6205
|
-
}) : jsx(AirmetForm, {
|
|
7367
|
+
children: jsx(AirmetForm, {
|
|
6206
7368
|
showMap: false,
|
|
6207
7369
|
mode: mode,
|
|
6208
7370
|
isCancelAirmet: selectedAviationProduct !== undefined && isInstanceOfCancelAirmet(selectedAviationProduct),
|
|
@@ -6215,48 +7377,85 @@ var Form = function Form(_ref5) {
|
|
|
6215
7377
|
},
|
|
6216
7378
|
storedGeoJSON: storedStartGeoJSON
|
|
6217
7379
|
})
|
|
6218
|
-
})
|
|
6219
|
-
|
|
7380
|
+
});
|
|
7381
|
+
}
|
|
7382
|
+
if (warningType === 'maritimeWarningCoastal') {
|
|
7383
|
+
return jsx(MaritimeWarningsFormConnect, {
|
|
7384
|
+
domain: "coastalWaters"
|
|
7385
|
+
});
|
|
7386
|
+
}
|
|
7387
|
+
if (warningType === 'maritimeWarningNorthSea') {
|
|
7388
|
+
return jsx(MaritimeWarningsFormConnect, {
|
|
7389
|
+
domain: "northSeaDistricts"
|
|
7390
|
+
});
|
|
7391
|
+
}
|
|
7392
|
+
// Public warnings form
|
|
7393
|
+
return jsx(ContainerGrid, {
|
|
7394
|
+
children: jsxs(Grid, {
|
|
7395
|
+
size: {
|
|
7396
|
+
xs: 12
|
|
7397
|
+
},
|
|
7398
|
+
container: true,
|
|
7399
|
+
rowSpacing: 2,
|
|
7400
|
+
columnSpacing: 2,
|
|
7401
|
+
children: [jsx(Grid, {
|
|
7402
|
+
size: {
|
|
7403
|
+
xs: 12
|
|
7404
|
+
},
|
|
7405
|
+
children: jsx(Phenomenon, {
|
|
7406
|
+
isDisabled: areFieldsDisabled,
|
|
7407
|
+
isReadOnly: isReadOnly
|
|
7408
|
+
})
|
|
7409
|
+
}), jsx(Grid, {
|
|
7410
|
+
size: {
|
|
7411
|
+
xs: 12
|
|
7412
|
+
},
|
|
7413
|
+
children: jsx(AreaField, {
|
|
7414
|
+
onEditObject: function onEditObject() {},
|
|
7415
|
+
onViewObject: function onViewObject() {},
|
|
7416
|
+
onDeleteObject: function onDeleteObject() {},
|
|
7417
|
+
onAddObject: onAddObject,
|
|
7418
|
+
isDisabled: areFieldsDisabled || isReadOnly
|
|
7419
|
+
})
|
|
7420
|
+
}), jsx(Grid, {
|
|
7421
|
+
size: {
|
|
7422
|
+
xs: 12
|
|
7423
|
+
},
|
|
7424
|
+
children: jsx(WarningsMapView, {
|
|
7425
|
+
geojsonFeature: geoJSONFeature,
|
|
7426
|
+
defaultMapPreset: defaultMapPreset,
|
|
7427
|
+
isSnapshot: isSnapshot
|
|
7428
|
+
})
|
|
7429
|
+
}), jsx(Grid, {
|
|
7430
|
+
size: {
|
|
7431
|
+
xs: 12,
|
|
7432
|
+
sm: 6
|
|
7433
|
+
},
|
|
7434
|
+
children: jsx(ValidFrom, {
|
|
7435
|
+
isDisabled: areFieldsDisabled,
|
|
7436
|
+
isReadOnly: isReadOnly
|
|
7437
|
+
})
|
|
7438
|
+
}), jsx(Grid, {
|
|
7439
|
+
size: {
|
|
7440
|
+
xs: 12,
|
|
7441
|
+
sm: 6
|
|
7442
|
+
},
|
|
7443
|
+
children: jsx(ValidUntil, {
|
|
7444
|
+
isDisabled: areFieldsDisabled,
|
|
7445
|
+
isReadOnly: isReadOnly
|
|
7446
|
+
})
|
|
7447
|
+
}), jsxs(Grid, {
|
|
6220
7448
|
size: {
|
|
6221
7449
|
xs: 12
|
|
6222
7450
|
},
|
|
6223
7451
|
container: true,
|
|
6224
|
-
|
|
6225
|
-
columnSpacing: 2,
|
|
7452
|
+
spacing: 2,
|
|
6226
7453
|
children: [jsx(Grid, {
|
|
6227
|
-
size: {
|
|
6228
|
-
xs: 12
|
|
6229
|
-
},
|
|
6230
|
-
children: jsx(Phenomenon, {
|
|
6231
|
-
isDisabled: areFieldsDisabled,
|
|
6232
|
-
isReadOnly: isReadOnly
|
|
6233
|
-
})
|
|
6234
|
-
}), jsx(Grid, {
|
|
6235
|
-
size: {
|
|
6236
|
-
xs: 12
|
|
6237
|
-
},
|
|
6238
|
-
children: jsx(AreaField, {
|
|
6239
|
-
onEditObject: function onEditObject() {},
|
|
6240
|
-
onViewObject: function onViewObject() {},
|
|
6241
|
-
onDeleteObject: function onDeleteObject() {},
|
|
6242
|
-
onAddObject: onAddObject,
|
|
6243
|
-
isDisabled: areFieldsDisabled || isReadOnly
|
|
6244
|
-
})
|
|
6245
|
-
}), jsx(Grid, {
|
|
6246
|
-
size: {
|
|
6247
|
-
xs: 12
|
|
6248
|
-
},
|
|
6249
|
-
children: jsx(WarningsMapView, {
|
|
6250
|
-
geojsonFeature: geoJSONFeature,
|
|
6251
|
-
defaultMapPreset: defaultMapPreset,
|
|
6252
|
-
isSnapshot: isSnapshot
|
|
6253
|
-
})
|
|
6254
|
-
}), jsx(Grid, {
|
|
6255
7454
|
size: {
|
|
6256
7455
|
xs: 12,
|
|
6257
7456
|
sm: 6
|
|
6258
7457
|
},
|
|
6259
|
-
children: jsx(
|
|
7458
|
+
children: jsx(LevelField, {
|
|
6260
7459
|
isDisabled: areFieldsDisabled,
|
|
6261
7460
|
isReadOnly: isReadOnly
|
|
6262
7461
|
})
|
|
@@ -6265,56 +7464,50 @@ var Form = function Form(_ref5) {
|
|
|
6265
7464
|
xs: 12,
|
|
6266
7465
|
sm: 6
|
|
6267
7466
|
},
|
|
6268
|
-
children: jsx(
|
|
7467
|
+
children: jsx(ProbabilityField, {
|
|
6269
7468
|
isDisabled: areFieldsDisabled,
|
|
6270
7469
|
isReadOnly: isReadOnly
|
|
6271
7470
|
})
|
|
6272
|
-
})
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
xs: 12,
|
|
6281
|
-
sm: 6
|
|
6282
|
-
},
|
|
6283
|
-
children: jsx(LevelField, {
|
|
6284
|
-
isDisabled: areFieldsDisabled,
|
|
6285
|
-
isReadOnly: isReadOnly
|
|
6286
|
-
})
|
|
6287
|
-
}), jsx(Grid, {
|
|
6288
|
-
size: {
|
|
6289
|
-
xs: 12,
|
|
6290
|
-
sm: 6
|
|
6291
|
-
},
|
|
6292
|
-
children: jsx(ProbabilityField, {
|
|
6293
|
-
isDisabled: areFieldsDisabled,
|
|
6294
|
-
isReadOnly: isReadOnly
|
|
6295
|
-
})
|
|
6296
|
-
})]
|
|
6297
|
-
}), jsx(Grid, {
|
|
7471
|
+
})]
|
|
7472
|
+
}), jsx(Grid, {
|
|
7473
|
+
size: {
|
|
7474
|
+
xs: 12
|
|
7475
|
+
},
|
|
7476
|
+
container: true,
|
|
7477
|
+
spacing: 2,
|
|
7478
|
+
children: jsx(Grid, {
|
|
6298
7479
|
size: {
|
|
6299
7480
|
xs: 12
|
|
6300
7481
|
},
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
size: {
|
|
6305
|
-
xs: 12
|
|
6306
|
-
},
|
|
6307
|
-
children: jsx(DescriptionField, {
|
|
6308
|
-
isDisabled: areFieldsDisabled,
|
|
6309
|
-
isReadOnly: isReadOnly
|
|
6310
|
-
})
|
|
7482
|
+
children: jsx(DescriptionField, {
|
|
7483
|
+
isDisabled: areFieldsDisabled,
|
|
7484
|
+
isReadOnly: isReadOnly
|
|
6311
7485
|
})
|
|
6312
|
-
})
|
|
7486
|
+
})
|
|
7487
|
+
})]
|
|
7488
|
+
})
|
|
7489
|
+
});
|
|
7490
|
+
};
|
|
7491
|
+
return jsxs(ContainerWrapper, {
|
|
7492
|
+
children: [jsxs(ContainerFormWrapper, {
|
|
7493
|
+
isReadOnly: isReadOnly,
|
|
7494
|
+
ref: ref,
|
|
7495
|
+
"data-testid": "scroll-container",
|
|
7496
|
+
addPadding: !isMaritimeWarning,
|
|
7497
|
+
children: [errors && jsx(Box, {
|
|
7498
|
+
sx: {
|
|
7499
|
+
marginBottom: 2
|
|
7500
|
+
},
|
|
7501
|
+
children: jsx(AlertBanner, {
|
|
7502
|
+
title: errors.title,
|
|
7503
|
+
info: errors.errors,
|
|
7504
|
+
shouldClose: true,
|
|
7505
|
+
severity: error == null ? void 0 : error.severity
|
|
6313
7506
|
})
|
|
6314
|
-
}), jsx(DraftFieldHelper, {}), jsx(ReactHookFormHiddenInput, {
|
|
7507
|
+
}), getFormContent(), jsx(DraftFieldHelper, {}), jsx(ReactHookFormHiddenInput, {
|
|
6315
7508
|
name: "id"
|
|
6316
7509
|
})]
|
|
6317
|
-
}), formState !== 'cancel' && !isReadOnly && jsx(Box, {
|
|
7510
|
+
}), warningType !== 'maritimeWarningCoastal' && warningType !== 'maritimeWarningNorthSea' && formState !== 'cancel' && !isReadOnly && jsx(Box, {
|
|
6318
7511
|
sx: {
|
|
6319
7512
|
padding: '24px 10px 14px 10px',
|
|
6320
7513
|
position: 'absolute',
|
|
@@ -6399,7 +7592,7 @@ var Form = function Form(_ref5) {
|
|
|
6399
7592
|
})]
|
|
6400
7593
|
})
|
|
6401
7594
|
})
|
|
6402
|
-
}), formState === 'cancel' && jsx(Box, {
|
|
7595
|
+
}), warningType !== 'maritimeWarningCoastal' && warningType !== 'maritimeWarningNorthSea' && formState === 'cancel' && jsx(Box, {
|
|
6403
7596
|
sx: {
|
|
6404
7597
|
padding: '24px 10px 14px 10px',
|
|
6405
7598
|
position: 'absolute',
|
|
@@ -7810,6 +9003,9 @@ var ExpandableFilterChip = function ExpandableFilterChip(_ref) {
|
|
|
7810
9003
|
onClick: function onClick(ref) {
|
|
7811
9004
|
return setAnchorEl(ref);
|
|
7812
9005
|
},
|
|
9006
|
+
onClickIcon: function onClickIcon(ref) {
|
|
9007
|
+
return setAnchorEl(ref);
|
|
9008
|
+
},
|
|
7813
9009
|
isDisabled: isDisabled,
|
|
7814
9010
|
size: "medium",
|
|
7815
9011
|
actionIcon: jsxs(Grid, {
|
|
@@ -8000,14 +9196,14 @@ var FilterList = function FilterList(_ref) {
|
|
|
8000
9196
|
});
|
|
8001
9197
|
};
|
|
8002
9198
|
|
|
8003
|
-
var _excluded$
|
|
9199
|
+
var _excluded$2 = ["totalWarnings", "status", "isExpanded", "onClick"];
|
|
8004
9200
|
var HEADER_SIZE = 32;
|
|
8005
9201
|
var WarningListItemSeperator = function WarningListItemSeperator(_ref) {
|
|
8006
9202
|
var totalWarnings = _ref.totalWarnings,
|
|
8007
9203
|
status = _ref.status,
|
|
8008
9204
|
isExpanded = _ref.isExpanded,
|
|
8009
9205
|
onClick = _ref.onClick,
|
|
8010
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
9206
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$2);
|
|
8011
9207
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
8012
9208
|
t = _useWarningsTranslati.t;
|
|
8013
9209
|
var getStatus = function getStatus(status) {
|
|
@@ -8048,7 +9244,7 @@ var WarningListItemSeperator = function WarningListItemSeperator(_ref) {
|
|
|
8048
9244
|
}));
|
|
8049
9245
|
};
|
|
8050
9246
|
|
|
8051
|
-
var _excluded$
|
|
9247
|
+
var _excluded$1 = ["title", "status", "children", "width"];
|
|
8052
9248
|
var WarningListColumnContent = function WarningListColumnContent(_ref) {
|
|
8053
9249
|
var _sx;
|
|
8054
9250
|
var title = _ref.title,
|
|
@@ -8056,7 +9252,7 @@ var WarningListColumnContent = function WarningListColumnContent(_ref) {
|
|
|
8056
9252
|
children = _ref.children,
|
|
8057
9253
|
_ref$width = _ref.width,
|
|
8058
9254
|
width = _ref$width === void 0 ? 76 : _ref$width,
|
|
8059
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
9255
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
|
|
8060
9256
|
return jsxs(Grid, {
|
|
8061
9257
|
sx: Object.assign({}, props.sx, {
|
|
8062
9258
|
width: width
|
|
@@ -8233,7 +9429,7 @@ var WarningListItemMenu = function WarningListItemMenu(_ref) {
|
|
|
8233
9429
|
}
|
|
8234
9430
|
};
|
|
8235
9431
|
|
|
8236
|
-
var _excluded
|
|
9432
|
+
var _excluded = ["warning", "activeWarningId", "highlightedItem", "onSelectWarning", "onEditWarning", "onDeleteWarning", "onDeleteReviewWarning", "onExpireWarning", "onWithdrawWarning", "onActionAviationWarning"];
|
|
8237
9433
|
var renderLevelText = function renderLevelText(levelString) {
|
|
8238
9434
|
if (!levelString) {
|
|
8239
9435
|
return null;
|
|
@@ -8330,7 +9526,7 @@ var WarningListItem = function WarningListItem(_ref) {
|
|
|
8330
9526
|
onWithdrawWarning = _ref$onWithdrawWarnin === void 0 ? function () {} : _ref$onWithdrawWarnin,
|
|
8331
9527
|
_ref$onActionAviation = _ref.onActionAviationWarning,
|
|
8332
9528
|
onActionAviationWarning = _ref$onActionAviation === void 0 ? function () {} : _ref$onActionAviation,
|
|
8333
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded
|
|
9529
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
8334
9530
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
8335
9531
|
t = _useWarningsTranslati.t;
|
|
8336
9532
|
var phenomenonDetails = allPhenomenaDict[warning.warningDetail.phenomenon];
|
|
@@ -8571,6 +9767,8 @@ var NewWarningButton = function NewWarningButton(_ref) {
|
|
|
8571
9767
|
isDefaultOpen = _ref$isDefaultOpen === void 0 ? false : _ref$isDefaultOpen;
|
|
8572
9768
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
8573
9769
|
t = _useWarningsTranslati.t;
|
|
9770
|
+
var config = sessionStorageProvider.getConfig();
|
|
9771
|
+
var showMartimeWarningOption = !!config.GW_WARNINGS_MARITIME_WARNINGS;
|
|
8574
9772
|
var _React$useState = React__default.useState(null),
|
|
8575
9773
|
anchorEl = _React$useState[0],
|
|
8576
9774
|
setAnchorEl = _React$useState[1];
|
|
@@ -8666,64 +9864,27 @@ var NewWarningButton = function NewWarningButton(_ref) {
|
|
|
8666
9864
|
children: jsx(ListItemText, {
|
|
8667
9865
|
children: BUTTON_SIGMET
|
|
8668
9866
|
})
|
|
8669
|
-
}, "Sigmet")
|
|
9867
|
+
}, "Sigmet"), showMartimeWarningOption ? jsxs(Fragment, {
|
|
9868
|
+
children: [jsx(MenuItem, {
|
|
9869
|
+
onClick: function onClick(event) {
|
|
9870
|
+
onCreateNewWarning('maritimeWarningCoastal', event);
|
|
9871
|
+
},
|
|
9872
|
+
children: jsx(ListItemText, {
|
|
9873
|
+
children: t('maritime-warning-coastal-title').toUpperCase()
|
|
9874
|
+
})
|
|
9875
|
+
}, "MaritimeWarningCoastal"), jsx(MenuItem, {
|
|
9876
|
+
onClick: function onClick(event) {
|
|
9877
|
+
onCreateNewWarning('maritimeWarningNorthSea', event);
|
|
9878
|
+
},
|
|
9879
|
+
children: jsx(ListItemText, {
|
|
9880
|
+
children: t('maritime-warning-northsea-title').toUpperCase()
|
|
9881
|
+
})
|
|
9882
|
+
}, "MaritimeWarningNorthSea")]
|
|
9883
|
+
}) : null]
|
|
8670
9884
|
})]
|
|
8671
9885
|
});
|
|
8672
9886
|
};
|
|
8673
9887
|
|
|
8674
|
-
var _excluded = ["title", "width", "onClick", "isSorted", "sortDirection", "sortable"];
|
|
8675
|
-
var sharedArrowIconStyles = {
|
|
8676
|
-
fontSize: '0.9rem'
|
|
8677
|
-
};
|
|
8678
|
-
var WarningListHeaderContent = function WarningListHeaderContent(_ref) {
|
|
8679
|
-
var title = _ref.title,
|
|
8680
|
-
_ref$width = _ref.width,
|
|
8681
|
-
width = _ref$width === void 0 ? 76 : _ref$width,
|
|
8682
|
-
_onClick = _ref.onClick,
|
|
8683
|
-
isSorted = _ref.isSorted,
|
|
8684
|
-
sortDirection = _ref.sortDirection,
|
|
8685
|
-
sortable = _ref.sortable,
|
|
8686
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
8687
|
-
return jsx(Grid, {
|
|
8688
|
-
sx: Object.assign({}, props.sx, {
|
|
8689
|
-
width: width,
|
|
8690
|
-
cursor: _onClick ? 'pointer' : 'default'
|
|
8691
|
-
}),
|
|
8692
|
-
onClick: function onClick(e) {
|
|
8693
|
-
e.stopPropagation(); // Ensure click only affects this column
|
|
8694
|
-
_onClick == null || _onClick();
|
|
8695
|
-
},
|
|
8696
|
-
children: jsxs(Box, {
|
|
8697
|
-
sx: {
|
|
8698
|
-
display: 'flex',
|
|
8699
|
-
alignItems: 'center',
|
|
8700
|
-
overflow: 'hidden',
|
|
8701
|
-
fontWeight: 'normal',
|
|
8702
|
-
textOverflow: 'ellipsis',
|
|
8703
|
-
fontSize: 12,
|
|
8704
|
-
lineHeight: 1.33,
|
|
8705
|
-
height: 16,
|
|
8706
|
-
color: 'geowebColors.captions.captionStatus.rgba'
|
|
8707
|
-
},
|
|
8708
|
-
children: [title, sortable && jsx(Box, {
|
|
8709
|
-
sx: {
|
|
8710
|
-
display: 'flex',
|
|
8711
|
-
alignItems: 'center',
|
|
8712
|
-
marginLeft: '4px',
|
|
8713
|
-
color: isSorted ? '#186DFF' : 'inherit'
|
|
8714
|
-
},
|
|
8715
|
-
children: isSorted && sortDirection === 'asc' ? jsx(ArrowUpCompact, {
|
|
8716
|
-
sx: Object.assign({}, sharedArrowIconStyles),
|
|
8717
|
-
"data-testid": "ArrowUpIcon"
|
|
8718
|
-
}) : jsx(ArrowDownCompact, {
|
|
8719
|
-
sx: Object.assign({}, sharedArrowIconStyles),
|
|
8720
|
-
"data-testid": "ArrowDownIcon"
|
|
8721
|
-
})
|
|
8722
|
-
})]
|
|
8723
|
-
})
|
|
8724
|
-
});
|
|
8725
|
-
};
|
|
8726
|
-
|
|
8727
9888
|
var groupWarningsOnStatus = function groupWarningsOnStatus(warnings, sortState) {
|
|
8728
9889
|
var key = sortState.key,
|
|
8729
9890
|
direction = sortState.direction;
|
|
@@ -9825,6 +10986,8 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
9825
10986
|
|
|
9826
10987
|
var warningListViewPreset = {
|
|
9827
10988
|
componentType: 'WarningList'};
|
|
10989
|
+
var maritimeWarningsViewPreset = {
|
|
10990
|
+
componentType: 'MaritimeWarnings'};
|
|
9828
10991
|
var componentsLookUp = function componentsLookUp(payload) {
|
|
9829
10992
|
var id = payload.id,
|
|
9830
10993
|
componentType = payload.componentType,
|
|
@@ -9838,6 +11001,12 @@ var componentsLookUp = function componentsLookUp(payload) {
|
|
|
9838
11001
|
presetFilterState: initialProps.filterState
|
|
9839
11002
|
})
|
|
9840
11003
|
});
|
|
11004
|
+
case maritimeWarningsViewPreset.componentType:
|
|
11005
|
+
return jsx(ErrorBoundary, {
|
|
11006
|
+
children: jsx(MaritimeWarningsFormConnect, {
|
|
11007
|
+
domain: initialProps.domain || 'northSeaDistricts'
|
|
11008
|
+
})
|
|
11009
|
+
});
|
|
9841
11010
|
default:
|
|
9842
11011
|
return null;
|
|
9843
11012
|
}
|