@opengeoweb/warnings 9.32.1 → 9.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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, CoastalEvent, TemperatureLow, TemperatureHigh, Rain, Snow, Lightning, Fog, Wind, Thunderstorm, VulcanicEruption, Haze, FreezingPrecipitation, ModerateAircraftIcing, SevereAircraftIcing, ModerateTurbulence, SevereTurbulence, SandStorm, RadioactiveMaterials,
|
|
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, Close, Options, ChevronDown, ChevronUp, Copy, Success, Expire, Remove } from '@opengeoweb/theme';
|
|
4
4
|
import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawtoolSelectors, layerSelectors, uiSelectors, mapStoreActions, drawtoolActions, layerActions, useSetupDialog } from '@opengeoweb/store';
|
|
5
5
|
import { defaultPolygon, emptyGeoJSON, MapControlButton, getIcon, rewindGeometry, getGeoJSONPropertyValue, currentlySupportedDrawModes, defaultLayers, MapView, MapViewLayer, getFeatureExtent } from '@opengeoweb/webmap-react';
|
|
6
6
|
import { SHARED_NAMESPACE, useConfirmationDialog, ToggleMenu, dateUtils, calculateStartSize, ToolContainerDraggable, AlertBanner, ConfirmationDialog, getAxiosErrorMessage, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, CustomToggleButton, Filter, getPosition, FilterChip, FilterListItem, FilterLabel, FilterOption, StatusTag, LastUpdateTime, ErrorBoundary, pollingIntervalTimeout, isAxiosError as isAxiosError$1 } from '@opengeoweb/shared';
|
|
@@ -8,17 +8,17 @@ import { createEntityAdapter, createSlice, createSelector, createListenerMiddlew
|
|
|
8
8
|
import 'i18next';
|
|
9
9
|
import { useTranslation } from 'react-i18next';
|
|
10
10
|
import '@opengeoweb/core';
|
|
11
|
-
import { FORM_FIELDS_NAMESPACE,
|
|
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
13
|
import { snackbarActions, snackbarTypes } from '@opengeoweb/snackbar';
|
|
14
14
|
import * as React from 'react';
|
|
15
15
|
import React__default, { useState, useEffect, useRef } from 'react';
|
|
16
|
-
import { styled, Box, Typography, ListItem, Grid2, Paper, ListItemButton, Stack, LinearProgress, Button,
|
|
16
|
+
import { styled, Box, Typography, ListItem, Grid2, Paper, ListItemButton, Stack, LinearProgress, Button, FormHelperText, MenuItem, Tabs, Tab, Card, CardContent, CircularProgress, Menu, DialogTitle, DialogContent, Switch } from '@mui/material';
|
|
17
17
|
import { VariableSizeList } from 'react-window';
|
|
18
18
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
19
19
|
import { getApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider, getHeaders, useAuthQuery, ProductStatus } from '@opengeoweb/api';
|
|
20
20
|
import { useFormContext } from 'react-hook-form';
|
|
21
|
-
import { isEqual, cloneDeep, clamp } from 'lodash';
|
|
21
|
+
import { isEqual, cloneDeep, clamp, uniq, pick } from 'lodash';
|
|
22
22
|
import { getConfig, useAuthenticationContext } from '@opengeoweb/authentication';
|
|
23
23
|
import { SigmetForm, isInstanceOfCancelSigmet, AirmetForm, isInstanceOfCancelAirmet, getProductFormMode } from '@opengeoweb/sigmet-airmet';
|
|
24
24
|
import { produce } from 'immer';
|
|
@@ -74,11 +74,11 @@ var en = {
|
|
|
74
74
|
"warning-button-add-object": "Add Areas & Objects",
|
|
75
75
|
"warning-description-original": "Description original",
|
|
76
76
|
"warning-description-translation": "Description translation",
|
|
77
|
+
"warning-unspecified": "(not specified)",
|
|
77
78
|
"warning-level": "Level",
|
|
78
79
|
"warning-level-moderate": "Moderate",
|
|
79
80
|
"warning-level-severe": "Severe",
|
|
80
81
|
"warning-level-extreme": "Extreme",
|
|
81
|
-
"warning-level-unspecified": "(not specified)",
|
|
82
82
|
"warning-phenomenon": "Phenomenon",
|
|
83
83
|
"warning-phenomenon-wind": "Wind",
|
|
84
84
|
"warning-phenomenon-fog": "Fog",
|
|
@@ -4817,294 +4817,31 @@ $$6({ target: 'Array', proto: true, forced: FORCED$2 }, {
|
|
|
4817
4817
|
}
|
|
4818
4818
|
});
|
|
4819
4819
|
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4837
|
-
return jsx(CoastalEvent, {});
|
|
4838
|
-
default:
|
|
4839
|
-
return undefined;
|
|
4840
|
-
}
|
|
4841
|
-
};
|
|
4842
|
-
const getAviationPhenomenaIcon = key => {
|
|
4843
|
-
switch (key) {
|
|
4844
|
-
case 'RDOACT_CLD':
|
|
4845
|
-
return jsx(RadioactiveMaterials, {});
|
|
4846
|
-
case 'HVY_SS':
|
|
4847
|
-
return jsx(SandStorm, {});
|
|
4848
|
-
case 'SEV_TURB':
|
|
4849
|
-
return jsx(SevereTurbulence, {});
|
|
4850
|
-
case 'MOD_TURB':
|
|
4851
|
-
return jsx(ModerateTurbulence, {});
|
|
4852
|
-
case 'SEV_ICE':
|
|
4853
|
-
return jsx(SevereAircraftIcing, {});
|
|
4854
|
-
case 'MOD_ICE':
|
|
4855
|
-
return jsx(ModerateAircraftIcing, {});
|
|
4856
|
-
case 'SEV_ICE_FRZ_RN':
|
|
4857
|
-
return jsx(FreezingPrecipitation, {});
|
|
4858
|
-
case 'HVY_DS':
|
|
4859
|
-
return jsx(Haze, {});
|
|
4860
|
-
case 'VA_CLD':
|
|
4861
|
-
return jsx(VulcanicEruption, {});
|
|
4862
|
-
case 'EMBD_TS':
|
|
4863
|
-
case 'EMBD_TSGR':
|
|
4864
|
-
case 'FRQ_TS':
|
|
4865
|
-
case 'FRQ_TSGR':
|
|
4866
|
-
case 'OBSC_TS':
|
|
4867
|
-
case 'OBSC_TSGR':
|
|
4868
|
-
case 'SQL_TSGR':
|
|
4869
|
-
case 'ISOL_TS':
|
|
4870
|
-
case 'ISOL_TSGR':
|
|
4871
|
-
case 'OCNL_TS':
|
|
4872
|
-
case 'OCNL_TSGR':
|
|
4873
|
-
return jsx(Thunderstorm, {});
|
|
4874
|
-
default:
|
|
4875
|
-
return undefined;
|
|
4876
|
-
}
|
|
4877
|
-
};
|
|
4878
|
-
const warningPhenomena = [{
|
|
4879
|
-
translationKey: 'warning-phenomenon-wind',
|
|
4880
|
-
key: 'wind',
|
|
4881
|
-
isAviation: false
|
|
4882
|
-
}, {
|
|
4883
|
-
translationKey: 'warning-phenomenon-fog',
|
|
4884
|
-
key: 'fog',
|
|
4885
|
-
isAviation: false
|
|
4886
|
-
}, {
|
|
4887
|
-
translationKey: 'warning-phenomenon-thunderstorm',
|
|
4888
|
-
key: 'thunderstorm',
|
|
4889
|
-
isAviation: false
|
|
4890
|
-
}, {
|
|
4891
|
-
translationKey: 'warning-phenomenon-snow-ice',
|
|
4892
|
-
key: 'snowIce',
|
|
4893
|
-
isAviation: false
|
|
4894
|
-
}, {
|
|
4895
|
-
translationKey: 'warning-phenomenon-rain',
|
|
4896
|
-
key: 'rain',
|
|
4897
|
-
isAviation: false
|
|
4898
|
-
}, {
|
|
4899
|
-
translationKey: 'warning-phenomenon-high-temp',
|
|
4900
|
-
key: 'highTemp',
|
|
4901
|
-
isAviation: false
|
|
4902
|
-
},
|
|
4903
|
-
// {
|
|
4904
|
-
// title: 'warning-phenomenon-funnel-cloud',
|
|
4905
|
-
// key: 'funnelCloud',
|
|
4906
|
-
// },
|
|
4907
|
-
{
|
|
4908
|
-
translationKey: 'warning-phenomenon-low-temp',
|
|
4909
|
-
key: 'lowTemp',
|
|
4910
|
-
isAviation: false
|
|
4911
|
-
}, {
|
|
4912
|
-
translationKey: 'warning-phenomenon-coastal-event',
|
|
4913
|
-
key: 'coastalEvent',
|
|
4914
|
-
isAviation: false
|
|
4915
|
-
}, {
|
|
4916
|
-
translationKey: 'aviation-phenomenon-radioactive-cloud',
|
|
4917
|
-
key: 'RDOACT_CLD',
|
|
4918
|
-
isAviation: true
|
|
4919
|
-
}, {
|
|
4920
|
-
translationKey: 'aviation-phenomenon-heavy-sandstorm',
|
|
4921
|
-
key: 'HVY_SS',
|
|
4922
|
-
isAviation: true
|
|
4923
|
-
}, {
|
|
4924
|
-
translationKey: 'aviation-phenomenon-severe-turbulence',
|
|
4925
|
-
key: 'SEV_TURB',
|
|
4926
|
-
isAviation: true
|
|
4927
|
-
}, {
|
|
4928
|
-
translationKey: 'aviation-phenomenon-moderate-turbulence',
|
|
4929
|
-
key: 'MOD_TURB',
|
|
4930
|
-
isAviation: true
|
|
4931
|
-
}, {
|
|
4932
|
-
translationKey: 'aviation-phenomenon-severe-ice',
|
|
4933
|
-
key: 'SEV_ICE',
|
|
4934
|
-
isAviation: true
|
|
4935
|
-
}, {
|
|
4936
|
-
translationKey: 'aviation-phenomenon-moderate-ice',
|
|
4937
|
-
key: 'MOD_ICE',
|
|
4938
|
-
isAviation: true
|
|
4939
|
-
}, {
|
|
4940
|
-
translationKey: 'aviation-phenomenon-severe-ice-freezing-rain',
|
|
4941
|
-
key: 'SEV_ICE_FRZ_RN',
|
|
4942
|
-
isAviation: true
|
|
4943
|
-
}, {
|
|
4944
|
-
translationKey: 'aviation-phenomenon-heavy-dust-storm',
|
|
4945
|
-
key: 'HVY_DS',
|
|
4946
|
-
isAviation: true
|
|
4947
|
-
}, {
|
|
4948
|
-
translationKey: 'aviation-phenomenon-volcanic-cloud',
|
|
4949
|
-
key: 'VA_CLD',
|
|
4950
|
-
isAviation: true
|
|
4951
|
-
}, {
|
|
4952
|
-
translationKey: 'aviation-phenomenon-embedded-thunderstorm',
|
|
4953
|
-
key: 'EMBD_TS',
|
|
4954
|
-
isAviation: true
|
|
4955
|
-
}, {
|
|
4956
|
-
translationKey: 'aviation-phenomenon-embedded-thunderstorm-with-hail',
|
|
4957
|
-
key: 'EMBD_TSGR',
|
|
4958
|
-
isAviation: true
|
|
4959
|
-
}, {
|
|
4960
|
-
translationKey: 'aviation-phenomenon-obscured-thunderstorm-with-hail',
|
|
4961
|
-
key: 'OBSC_TSGR',
|
|
4962
|
-
isAviation: true
|
|
4963
|
-
}, {
|
|
4964
|
-
translationKey: 'aviation-phenomenon-squall-thunderstorm-with-hail',
|
|
4965
|
-
key: 'SQL_TSGR',
|
|
4966
|
-
isAviation: true
|
|
4967
|
-
}, {
|
|
4968
|
-
translationKey: 'aviation-phenomenon-isolated-thunderstorm',
|
|
4969
|
-
key: 'ISOL_TS',
|
|
4970
|
-
isAviation: true
|
|
4971
|
-
}, {
|
|
4972
|
-
translationKey: 'aviation-phenomenon-isolated-thunderstorm-with-hail',
|
|
4973
|
-
key: 'ISOL_TSGR',
|
|
4974
|
-
isAviation: true
|
|
4975
|
-
}, {
|
|
4976
|
-
translationKey: 'aviation-phenomenon-occasional-thunderstorm',
|
|
4977
|
-
key: 'OCNL_TS',
|
|
4978
|
-
isAviation: true
|
|
4979
|
-
}, {
|
|
4980
|
-
translationKey: 'aviation-phenomenon-occasional-thunderstorm-with-hail',
|
|
4981
|
-
key: 'OCNL_TSGR',
|
|
4982
|
-
isAviation: true
|
|
4983
|
-
}, {
|
|
4984
|
-
translationKey: 'aviation-phenomenon-frequent-thunderstorm',
|
|
4985
|
-
key: 'FRQ_TS',
|
|
4986
|
-
isAviation: true
|
|
4987
|
-
}, {
|
|
4988
|
-
translationKey: 'aviation-phenomenon-frequent-thunderstorm-with-hail',
|
|
4989
|
-
key: 'FRQ_TSGR',
|
|
4990
|
-
isAviation: true
|
|
4991
|
-
}, {
|
|
4992
|
-
translationKey: 'aviation-phenomenon-severe-mountain-waves',
|
|
4993
|
-
key: 'SEV_MTW',
|
|
4994
|
-
isAviation: true
|
|
4995
|
-
}, {
|
|
4996
|
-
translationKey: 'aviation-phenomenon-surface-visibility',
|
|
4997
|
-
key: 'SFC_VIS',
|
|
4998
|
-
isAviation: true
|
|
4999
|
-
}, {
|
|
5000
|
-
translationKey: 'aviation-phenomenon-surface-wind',
|
|
5001
|
-
key: 'SFC_WIND',
|
|
5002
|
-
isAviation: true
|
|
5003
|
-
}, {
|
|
5004
|
-
translationKey: 'aviation-phenomenon-overcast-cloud',
|
|
5005
|
-
key: 'OVC_CLD',
|
|
5006
|
-
isAviation: true
|
|
5007
|
-
}, {
|
|
5008
|
-
translationKey: 'aviation-phenomenon-broken-cloud',
|
|
5009
|
-
key: 'BKN_CLD',
|
|
5010
|
-
isAviation: true
|
|
5011
|
-
}, {
|
|
5012
|
-
translationKey: 'aviation-phenomenon-isolated-cumulonimbus-cloud',
|
|
5013
|
-
key: 'ISOL_CB',
|
|
5014
|
-
isAviation: true
|
|
5015
|
-
}, {
|
|
5016
|
-
translationKey: 'aviation-phenomenon-occasional-cumulonimbus-cloud',
|
|
5017
|
-
key: 'OCNL_CB',
|
|
5018
|
-
isAviation: true
|
|
5019
|
-
}, {
|
|
5020
|
-
translationKey: 'aviation-phenomenon-frequent-cumulonimbus-cloud',
|
|
5021
|
-
key: 'FRQ_CB',
|
|
5022
|
-
isAviation: true
|
|
5023
|
-
}, {
|
|
5024
|
-
translationKey: 'aviation-phenomenon-isolated-towering-cumulus-cloud',
|
|
5025
|
-
key: 'ISOL_TCU',
|
|
5026
|
-
isAviation: true
|
|
5027
|
-
}, {
|
|
5028
|
-
translationKey: 'aviation-phenomenon-occasional-towering-cumulus-cloud',
|
|
5029
|
-
key: 'OCNL_TCU',
|
|
5030
|
-
isAviation: true
|
|
5031
|
-
}, {
|
|
5032
|
-
translationKey: 'aviation-phenomenon-frequent-towering-cumulus-cloud',
|
|
5033
|
-
key: 'FRQ_TCU',
|
|
5034
|
-
isAviation: true
|
|
5035
|
-
}, {
|
|
5036
|
-
translationKey: 'aviation-phenomenon-moderate-mountain-wave',
|
|
5037
|
-
key: 'MOD_MTW',
|
|
5038
|
-
isAviation: true
|
|
5039
|
-
}, {
|
|
5040
|
-
translationKey: 'aviation-phenomenon-mountains-obscured',
|
|
5041
|
-
key: 'MT_OBSC',
|
|
5042
|
-
isAviation: true
|
|
5043
|
-
}];
|
|
5044
|
-
const allPhenomenaDict = warningPhenomena.reduce((list, item) => Object.assign({}, list, {
|
|
5045
|
-
[item.key]: item
|
|
5046
|
-
}), {});
|
|
5047
|
-
const getPhenomenaIcon = key => {
|
|
5048
|
-
return getWarningPhenomenaIcon(key) || getAviationPhenomenaIcon(key);
|
|
5049
|
-
};
|
|
5050
|
-
const Phenomenon = ({
|
|
5051
|
-
isDisabled,
|
|
5052
|
-
isReadOnly
|
|
5053
|
-
}) => {
|
|
5054
|
-
const {
|
|
5055
|
-
t
|
|
5056
|
-
} = useWarningsTranslation();
|
|
5057
|
-
const {
|
|
5058
|
-
isRequired
|
|
5059
|
-
} = useDraftFormHelpers();
|
|
5060
|
-
// These phenomena are sent to Public Warning Form
|
|
5061
|
-
const warningFormPhenomena = warningPhenomena.filter(phenomenon => !phenomenon.isAviation);
|
|
5062
|
-
return jsx(ReactHookFormSelect, {
|
|
5063
|
-
name: "phenomenon",
|
|
5064
|
-
label: t('warning-phenomenon'),
|
|
5065
|
-
rules: {
|
|
5066
|
-
validate: {
|
|
5067
|
-
isRequired
|
|
5068
|
-
}
|
|
5069
|
-
},
|
|
5070
|
-
disabled: isDisabled || isReadOnly,
|
|
5071
|
-
isReadOnly: isReadOnly,
|
|
5072
|
-
children: warningFormPhenomena.map(phenomenon => jsx(MenuItem, {
|
|
5073
|
-
value: phenomenon.key,
|
|
5074
|
-
children: jsxs(Grid2, {
|
|
5075
|
-
container: true,
|
|
5076
|
-
justifyContent: "space-between",
|
|
5077
|
-
children: [jsx(Grid2, {
|
|
5078
|
-
children: t(phenomenon.translationKey)
|
|
5079
|
-
}), jsx(Grid2, {
|
|
5080
|
-
sx: {
|
|
5081
|
-
minWidth: 56
|
|
5082
|
-
},
|
|
5083
|
-
children: getPhenomenaIcon(phenomenon.key)
|
|
5084
|
-
})]
|
|
5085
|
-
})
|
|
5086
|
-
}, phenomenon.key))
|
|
5087
|
-
});
|
|
5088
|
-
};
|
|
5089
|
-
|
|
4820
|
+
/* *
|
|
4821
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4822
|
+
* you may not use this file except in compliance with the License.
|
|
4823
|
+
* You may obtain a copy of the License at
|
|
4824
|
+
*
|
|
4825
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4826
|
+
*
|
|
4827
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4828
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4829
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4830
|
+
* See the License for the specific language governing permissions and
|
|
4831
|
+
* limitations under the License.
|
|
4832
|
+
*
|
|
4833
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4834
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
4835
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
4836
|
+
* */
|
|
5090
4837
|
const emptyFilter = {
|
|
5091
|
-
id: '
|
|
4838
|
+
id: 'unspecified',
|
|
5092
4839
|
name: '(not specified)',
|
|
5093
4840
|
checked: true
|
|
5094
4841
|
};
|
|
5095
|
-
const getFilterlistWithTranslationKeys = filterList => filterList.reduce((fiterList, {
|
|
5096
|
-
key,
|
|
5097
|
-
translationKey
|
|
5098
|
-
}) => Object.assign({}, fiterList, {
|
|
5099
|
-
[key]: translationKey
|
|
5100
|
-
}), {});
|
|
5101
4842
|
const defaultFilters = [{
|
|
5102
4843
|
key: 'incident',
|
|
5103
4844
|
translationKey: 'filter-incident'
|
|
5104
|
-
}, {
|
|
5105
|
-
key: 'phenomenon',
|
|
5106
|
-
translationKey: 'filter-phenomenon',
|
|
5107
|
-
translations: getFilterlistWithTranslationKeys(warningPhenomena)
|
|
5108
4845
|
}, {
|
|
5109
4846
|
key: 'warningProposalSource',
|
|
5110
4847
|
translationKey: 'filter-source'
|
|
@@ -11903,127 +11640,401 @@ const DescriptionField = ({
|
|
|
11903
11640
|
});
|
|
11904
11641
|
};
|
|
11905
11642
|
|
|
11906
|
-
const formatDate = lastUpdatedTime => dateUtils.dateToString(dateUtils.isoStringToDate(lastUpdatedTime, false), `${dateUtils.DATE_FORMAT_DATEPICKER} 'UTC'`);
|
|
11907
|
-
const getObjectName = (geoJSON, objectName, t) => {
|
|
11908
|
-
if (geoJSON) {
|
|
11909
|
-
return objectName || t('object-manager-object-selected');
|
|
11643
|
+
const formatDate = lastUpdatedTime => dateUtils.dateToString(dateUtils.isoStringToDate(lastUpdatedTime, false), `${dateUtils.DATE_FORMAT_DATEPICKER} 'UTC'`);
|
|
11644
|
+
const getObjectName = (geoJSON, objectName, t) => {
|
|
11645
|
+
if (geoJSON) {
|
|
11646
|
+
return objectName || t('object-manager-object-selected');
|
|
11647
|
+
}
|
|
11648
|
+
return t('object-manager-no-object-selected');
|
|
11649
|
+
};
|
|
11650
|
+
const AreaField = ({
|
|
11651
|
+
onEditObject: _onEditObject = () => {},
|
|
11652
|
+
onViewObject: _onViewObject = () => {},
|
|
11653
|
+
onDeleteObject: _onDeleteObject = () => {},
|
|
11654
|
+
onAddObject: _onAddObject = () => {},
|
|
11655
|
+
isDisabled: _isDisabled = false
|
|
11656
|
+
}) => {
|
|
11657
|
+
const {
|
|
11658
|
+
t
|
|
11659
|
+
} = useWarningsTranslation();
|
|
11660
|
+
const {
|
|
11661
|
+
getValues,
|
|
11662
|
+
formState: {
|
|
11663
|
+
errors
|
|
11664
|
+
}
|
|
11665
|
+
} = useFormContext();
|
|
11666
|
+
const {
|
|
11667
|
+
isRequired
|
|
11668
|
+
} = useDraftFormHelpers();
|
|
11669
|
+
const lastUpdatedTime = getValues('object.lastUpdatedTime');
|
|
11670
|
+
const geoJSON = getValues('areas[0].geoJSON');
|
|
11671
|
+
const objectName = getObjectName(geoJSON, getValues('areas[0].objectName'), t);
|
|
11672
|
+
const hasErrors = (errors == null ? void 0 : errors.areas) !== undefined;
|
|
11673
|
+
return jsxs(Fragment, {
|
|
11674
|
+
children: [jsx(Typography, Object.assign({
|
|
11675
|
+
variant: "h3",
|
|
11676
|
+
color: "text.secondary",
|
|
11677
|
+
sx: Object.assign({
|
|
11678
|
+
fontSize: '0.75rem',
|
|
11679
|
+
fontWeight: 'normal',
|
|
11680
|
+
lineHeight: 1.83,
|
|
11681
|
+
paddingLeft: 1.5
|
|
11682
|
+
}, hasErrors && {
|
|
11683
|
+
color: 'geowebColors.captions.captionError.color'
|
|
11684
|
+
})
|
|
11685
|
+
}, hasErrors && {
|
|
11686
|
+
'aria-errormessage': errorMessages.required
|
|
11687
|
+
}, {
|
|
11688
|
+
children: t('warning-area')
|
|
11689
|
+
})), jsx(Card, {
|
|
11690
|
+
elevation: 0,
|
|
11691
|
+
sx: Object.assign({}, !geoJSON && {
|
|
11692
|
+
background: 'none'
|
|
11693
|
+
}),
|
|
11694
|
+
children: jsxs(CardContent, {
|
|
11695
|
+
sx: {
|
|
11696
|
+
position: 'relative',
|
|
11697
|
+
padding: 1,
|
|
11698
|
+
'&:last-child': {
|
|
11699
|
+
paddingBottom: 1
|
|
11700
|
+
}
|
|
11701
|
+
},
|
|
11702
|
+
children: [jsx(Typography, {
|
|
11703
|
+
variant: "h4",
|
|
11704
|
+
sx: {
|
|
11705
|
+
color: 'text.primary',
|
|
11706
|
+
fontSize: '0.75rem',
|
|
11707
|
+
fontWeight: 'normal',
|
|
11708
|
+
lineHeight: 1.83
|
|
11709
|
+
},
|
|
11710
|
+
role: "heading",
|
|
11711
|
+
children: objectName
|
|
11712
|
+
}), jsx(Typography, {
|
|
11713
|
+
variant: "body2",
|
|
11714
|
+
sx: {
|
|
11715
|
+
color: 'text.secondary'
|
|
11716
|
+
},
|
|
11717
|
+
children: lastUpdatedTime ? formatDate(lastUpdatedTime) : ''
|
|
11718
|
+
}), geoJSON ? jsx(ToggleMenu, {
|
|
11719
|
+
menuTitle: t('object-manager-options-menu'),
|
|
11720
|
+
tooltipTitle: t('object-manager-options-menu'),
|
|
11721
|
+
buttonSx: {
|
|
11722
|
+
position: 'absolute',
|
|
11723
|
+
right: 0,
|
|
11724
|
+
margin: 'auto',
|
|
11725
|
+
top: 0,
|
|
11726
|
+
bottom: 0,
|
|
11727
|
+
marginRight: '8px'
|
|
11728
|
+
},
|
|
11729
|
+
menuPosition: "bottom",
|
|
11730
|
+
isDisabled: true,
|
|
11731
|
+
menuItems: [{
|
|
11732
|
+
text: t('object-manager-button-edit'),
|
|
11733
|
+
action: _onEditObject,
|
|
11734
|
+
icon: jsx(Edit, {})
|
|
11735
|
+
}, {
|
|
11736
|
+
text: t('object-manager-button-view'),
|
|
11737
|
+
action: _onViewObject,
|
|
11738
|
+
icon: jsx(Visibility, {})
|
|
11739
|
+
}, {
|
|
11740
|
+
text: t('object-manager-button-delete'),
|
|
11741
|
+
action: _onDeleteObject,
|
|
11742
|
+
icon: jsx(Delete, {})
|
|
11743
|
+
}]
|
|
11744
|
+
}) : null]
|
|
11745
|
+
})
|
|
11746
|
+
}), jsx(ReactHookFormHiddenInput, {
|
|
11747
|
+
rules: {
|
|
11748
|
+
validate: {
|
|
11749
|
+
isRequired
|
|
11750
|
+
}
|
|
11751
|
+
},
|
|
11752
|
+
name: "areas[0].geoJSON"
|
|
11753
|
+
}), jsx(Button, {
|
|
11754
|
+
sx: {
|
|
11755
|
+
marginTop: 1
|
|
11756
|
+
},
|
|
11757
|
+
variant: "tertiary",
|
|
11758
|
+
startIcon: jsx(Add, {}),
|
|
11759
|
+
size: "small",
|
|
11760
|
+
onClick: _onAddObject,
|
|
11761
|
+
disabled: _isDisabled,
|
|
11762
|
+
children: t('warning-button-add-object')
|
|
11763
|
+
})]
|
|
11764
|
+
});
|
|
11765
|
+
};
|
|
11766
|
+
|
|
11767
|
+
const getWarningPhenomenaIcon = key => {
|
|
11768
|
+
switch (key) {
|
|
11769
|
+
case 'wind':
|
|
11770
|
+
return jsx(Wind, {});
|
|
11771
|
+
case 'fog':
|
|
11772
|
+
return jsx(Fog, {});
|
|
11773
|
+
case 'thunderstorm':
|
|
11774
|
+
return jsx(Lightning, {});
|
|
11775
|
+
case 'snowIce':
|
|
11776
|
+
return jsx(Snow, {});
|
|
11777
|
+
case 'rain':
|
|
11778
|
+
return jsx(Rain, {});
|
|
11779
|
+
case 'highTemp':
|
|
11780
|
+
return jsx(TemperatureHigh, {});
|
|
11781
|
+
case 'lowTemp':
|
|
11782
|
+
return jsx(TemperatureLow, {});
|
|
11783
|
+
case 'coastalEvent':
|
|
11784
|
+
return jsx(CoastalEvent, {});
|
|
11785
|
+
default:
|
|
11786
|
+
return undefined;
|
|
11910
11787
|
}
|
|
11911
|
-
return t('object-manager-no-object-selected');
|
|
11912
11788
|
};
|
|
11913
|
-
const
|
|
11914
|
-
|
|
11915
|
-
|
|
11916
|
-
|
|
11917
|
-
|
|
11918
|
-
|
|
11789
|
+
const getAviationPhenomenaIcon = key => {
|
|
11790
|
+
switch (key) {
|
|
11791
|
+
case 'RDOACT_CLD':
|
|
11792
|
+
return jsx(RadioactiveMaterials, {});
|
|
11793
|
+
case 'HVY_SS':
|
|
11794
|
+
return jsx(SandStorm, {});
|
|
11795
|
+
case 'SEV_TURB':
|
|
11796
|
+
return jsx(SevereTurbulence, {});
|
|
11797
|
+
case 'MOD_TURB':
|
|
11798
|
+
return jsx(ModerateTurbulence, {});
|
|
11799
|
+
case 'SEV_ICE':
|
|
11800
|
+
return jsx(SevereAircraftIcing, {});
|
|
11801
|
+
case 'MOD_ICE':
|
|
11802
|
+
return jsx(ModerateAircraftIcing, {});
|
|
11803
|
+
case 'SEV_ICE_FRZ_RN':
|
|
11804
|
+
return jsx(FreezingPrecipitation, {});
|
|
11805
|
+
case 'HVY_DS':
|
|
11806
|
+
return jsx(Haze, {});
|
|
11807
|
+
case 'VA_CLD':
|
|
11808
|
+
return jsx(VulcanicEruption, {});
|
|
11809
|
+
case 'EMBD_TS':
|
|
11810
|
+
case 'EMBD_TSGR':
|
|
11811
|
+
case 'FRQ_TS':
|
|
11812
|
+
case 'FRQ_TSGR':
|
|
11813
|
+
case 'OBSC_TS':
|
|
11814
|
+
case 'OBSC_TSGR':
|
|
11815
|
+
case 'SQL_TSGR':
|
|
11816
|
+
case 'ISOL_TS':
|
|
11817
|
+
case 'ISOL_TSGR':
|
|
11818
|
+
case 'OCNL_TS':
|
|
11819
|
+
case 'OCNL_TSGR':
|
|
11820
|
+
return jsx(Thunderstorm, {});
|
|
11821
|
+
default:
|
|
11822
|
+
return undefined;
|
|
11823
|
+
}
|
|
11824
|
+
};
|
|
11825
|
+
const warningPhenomena = [{
|
|
11826
|
+
translationKey: 'warning-unspecified',
|
|
11827
|
+
key: 'unspecified',
|
|
11828
|
+
isAviation: false
|
|
11829
|
+
}, {
|
|
11830
|
+
translationKey: 'warning-phenomenon-wind',
|
|
11831
|
+
key: 'wind',
|
|
11832
|
+
isAviation: false
|
|
11833
|
+
}, {
|
|
11834
|
+
translationKey: 'warning-phenomenon-fog',
|
|
11835
|
+
key: 'fog',
|
|
11836
|
+
isAviation: false
|
|
11837
|
+
}, {
|
|
11838
|
+
translationKey: 'warning-phenomenon-thunderstorm',
|
|
11839
|
+
key: 'thunderstorm',
|
|
11840
|
+
isAviation: false
|
|
11841
|
+
}, {
|
|
11842
|
+
translationKey: 'warning-phenomenon-snow-ice',
|
|
11843
|
+
key: 'snowIce',
|
|
11844
|
+
isAviation: false
|
|
11845
|
+
}, {
|
|
11846
|
+
translationKey: 'warning-phenomenon-rain',
|
|
11847
|
+
key: 'rain',
|
|
11848
|
+
isAviation: false
|
|
11849
|
+
}, {
|
|
11850
|
+
translationKey: 'warning-phenomenon-high-temp',
|
|
11851
|
+
key: 'highTemp',
|
|
11852
|
+
isAviation: false
|
|
11853
|
+
},
|
|
11854
|
+
// {
|
|
11855
|
+
// title: 'warning-phenomenon-funnel-cloud',
|
|
11856
|
+
// key: 'funnelCloud',
|
|
11857
|
+
// },
|
|
11858
|
+
{
|
|
11859
|
+
translationKey: 'warning-phenomenon-low-temp',
|
|
11860
|
+
key: 'lowTemp',
|
|
11861
|
+
isAviation: false
|
|
11862
|
+
}, {
|
|
11863
|
+
translationKey: 'warning-phenomenon-coastal-event',
|
|
11864
|
+
key: 'coastalEvent',
|
|
11865
|
+
isAviation: false
|
|
11866
|
+
}, {
|
|
11867
|
+
translationKey: 'aviation-phenomenon-radioactive-cloud',
|
|
11868
|
+
key: 'RDOACT_CLD',
|
|
11869
|
+
isAviation: true
|
|
11870
|
+
}, {
|
|
11871
|
+
translationKey: 'aviation-phenomenon-heavy-sandstorm',
|
|
11872
|
+
key: 'HVY_SS',
|
|
11873
|
+
isAviation: true
|
|
11874
|
+
}, {
|
|
11875
|
+
translationKey: 'aviation-phenomenon-severe-turbulence',
|
|
11876
|
+
key: 'SEV_TURB',
|
|
11877
|
+
isAviation: true
|
|
11878
|
+
}, {
|
|
11879
|
+
translationKey: 'aviation-phenomenon-moderate-turbulence',
|
|
11880
|
+
key: 'MOD_TURB',
|
|
11881
|
+
isAviation: true
|
|
11882
|
+
}, {
|
|
11883
|
+
translationKey: 'aviation-phenomenon-severe-ice',
|
|
11884
|
+
key: 'SEV_ICE',
|
|
11885
|
+
isAviation: true
|
|
11886
|
+
}, {
|
|
11887
|
+
translationKey: 'aviation-phenomenon-moderate-ice',
|
|
11888
|
+
key: 'MOD_ICE',
|
|
11889
|
+
isAviation: true
|
|
11890
|
+
}, {
|
|
11891
|
+
translationKey: 'aviation-phenomenon-severe-ice-freezing-rain',
|
|
11892
|
+
key: 'SEV_ICE_FRZ_RN',
|
|
11893
|
+
isAviation: true
|
|
11894
|
+
}, {
|
|
11895
|
+
translationKey: 'aviation-phenomenon-heavy-dust-storm',
|
|
11896
|
+
key: 'HVY_DS',
|
|
11897
|
+
isAviation: true
|
|
11898
|
+
}, {
|
|
11899
|
+
translationKey: 'aviation-phenomenon-volcanic-cloud',
|
|
11900
|
+
key: 'VA_CLD',
|
|
11901
|
+
isAviation: true
|
|
11902
|
+
}, {
|
|
11903
|
+
translationKey: 'aviation-phenomenon-embedded-thunderstorm',
|
|
11904
|
+
key: 'EMBD_TS',
|
|
11905
|
+
isAviation: true
|
|
11906
|
+
}, {
|
|
11907
|
+
translationKey: 'aviation-phenomenon-embedded-thunderstorm-with-hail',
|
|
11908
|
+
key: 'EMBD_TSGR',
|
|
11909
|
+
isAviation: true
|
|
11910
|
+
}, {
|
|
11911
|
+
translationKey: 'aviation-phenomenon-obscured-thunderstorm-with-hail',
|
|
11912
|
+
key: 'OBSC_TSGR',
|
|
11913
|
+
isAviation: true
|
|
11914
|
+
}, {
|
|
11915
|
+
translationKey: 'aviation-phenomenon-squall-thunderstorm-with-hail',
|
|
11916
|
+
key: 'SQL_TSGR',
|
|
11917
|
+
isAviation: true
|
|
11918
|
+
}, {
|
|
11919
|
+
translationKey: 'aviation-phenomenon-isolated-thunderstorm',
|
|
11920
|
+
key: 'ISOL_TS',
|
|
11921
|
+
isAviation: true
|
|
11922
|
+
}, {
|
|
11923
|
+
translationKey: 'aviation-phenomenon-isolated-thunderstorm-with-hail',
|
|
11924
|
+
key: 'ISOL_TSGR',
|
|
11925
|
+
isAviation: true
|
|
11926
|
+
}, {
|
|
11927
|
+
translationKey: 'aviation-phenomenon-occasional-thunderstorm',
|
|
11928
|
+
key: 'OCNL_TS',
|
|
11929
|
+
isAviation: true
|
|
11930
|
+
}, {
|
|
11931
|
+
translationKey: 'aviation-phenomenon-occasional-thunderstorm-with-hail',
|
|
11932
|
+
key: 'OCNL_TSGR',
|
|
11933
|
+
isAviation: true
|
|
11934
|
+
}, {
|
|
11935
|
+
translationKey: 'aviation-phenomenon-frequent-thunderstorm',
|
|
11936
|
+
key: 'FRQ_TS',
|
|
11937
|
+
isAviation: true
|
|
11938
|
+
}, {
|
|
11939
|
+
translationKey: 'aviation-phenomenon-frequent-thunderstorm-with-hail',
|
|
11940
|
+
key: 'FRQ_TSGR',
|
|
11941
|
+
isAviation: true
|
|
11942
|
+
}, {
|
|
11943
|
+
translationKey: 'aviation-phenomenon-severe-mountain-waves',
|
|
11944
|
+
key: 'SEV_MTW',
|
|
11945
|
+
isAviation: true
|
|
11946
|
+
}, {
|
|
11947
|
+
translationKey: 'aviation-phenomenon-surface-visibility',
|
|
11948
|
+
key: 'SFC_VIS',
|
|
11949
|
+
isAviation: true
|
|
11950
|
+
}, {
|
|
11951
|
+
translationKey: 'aviation-phenomenon-surface-wind',
|
|
11952
|
+
key: 'SFC_WIND',
|
|
11953
|
+
isAviation: true
|
|
11954
|
+
}, {
|
|
11955
|
+
translationKey: 'aviation-phenomenon-overcast-cloud',
|
|
11956
|
+
key: 'OVC_CLD',
|
|
11957
|
+
isAviation: true
|
|
11958
|
+
}, {
|
|
11959
|
+
translationKey: 'aviation-phenomenon-broken-cloud',
|
|
11960
|
+
key: 'BKN_CLD',
|
|
11961
|
+
isAviation: true
|
|
11962
|
+
}, {
|
|
11963
|
+
translationKey: 'aviation-phenomenon-isolated-cumulonimbus-cloud',
|
|
11964
|
+
key: 'ISOL_CB',
|
|
11965
|
+
isAviation: true
|
|
11966
|
+
}, {
|
|
11967
|
+
translationKey: 'aviation-phenomenon-occasional-cumulonimbus-cloud',
|
|
11968
|
+
key: 'OCNL_CB',
|
|
11969
|
+
isAviation: true
|
|
11970
|
+
}, {
|
|
11971
|
+
translationKey: 'aviation-phenomenon-frequent-cumulonimbus-cloud',
|
|
11972
|
+
key: 'FRQ_CB',
|
|
11973
|
+
isAviation: true
|
|
11974
|
+
}, {
|
|
11975
|
+
translationKey: 'aviation-phenomenon-isolated-towering-cumulus-cloud',
|
|
11976
|
+
key: 'ISOL_TCU',
|
|
11977
|
+
isAviation: true
|
|
11978
|
+
}, {
|
|
11979
|
+
translationKey: 'aviation-phenomenon-occasional-towering-cumulus-cloud',
|
|
11980
|
+
key: 'OCNL_TCU',
|
|
11981
|
+
isAviation: true
|
|
11982
|
+
}, {
|
|
11983
|
+
translationKey: 'aviation-phenomenon-frequent-towering-cumulus-cloud',
|
|
11984
|
+
key: 'FRQ_TCU',
|
|
11985
|
+
isAviation: true
|
|
11986
|
+
}, {
|
|
11987
|
+
translationKey: 'aviation-phenomenon-moderate-mountain-wave',
|
|
11988
|
+
key: 'MOD_MTW',
|
|
11989
|
+
isAviation: true
|
|
11990
|
+
}, {
|
|
11991
|
+
translationKey: 'aviation-phenomenon-mountains-obscured',
|
|
11992
|
+
key: 'MT_OBSC',
|
|
11993
|
+
isAviation: true
|
|
11994
|
+
}];
|
|
11995
|
+
const allPhenomenaDict = warningPhenomena.reduce((list, item) => Object.assign({}, list, {
|
|
11996
|
+
[item.key]: item
|
|
11997
|
+
}), {});
|
|
11998
|
+
const getPhenomenaIcon = key => {
|
|
11999
|
+
return getWarningPhenomenaIcon(key) || getAviationPhenomenaIcon(key);
|
|
12000
|
+
};
|
|
12001
|
+
const Phenomenon$1 = ({
|
|
12002
|
+
isDisabled,
|
|
12003
|
+
isReadOnly
|
|
11919
12004
|
}) => {
|
|
11920
12005
|
const {
|
|
11921
12006
|
t
|
|
11922
12007
|
} = useWarningsTranslation();
|
|
11923
|
-
const {
|
|
11924
|
-
getValues,
|
|
11925
|
-
formState: {
|
|
11926
|
-
errors
|
|
11927
|
-
}
|
|
11928
|
-
} = useFormContext();
|
|
11929
12008
|
const {
|
|
11930
12009
|
isRequired
|
|
11931
12010
|
} = useDraftFormHelpers();
|
|
11932
|
-
|
|
11933
|
-
const
|
|
11934
|
-
|
|
11935
|
-
|
|
11936
|
-
|
|
11937
|
-
|
|
11938
|
-
|
|
11939
|
-
|
|
11940
|
-
|
|
11941
|
-
|
|
11942
|
-
|
|
11943
|
-
|
|
11944
|
-
|
|
11945
|
-
|
|
11946
|
-
|
|
11947
|
-
|
|
11948
|
-
|
|
11949
|
-
|
|
11950
|
-
|
|
11951
|
-
|
|
11952
|
-
})), jsx(Card, {
|
|
11953
|
-
elevation: 0,
|
|
11954
|
-
sx: Object.assign({}, !geoJSON && {
|
|
11955
|
-
background: 'none'
|
|
11956
|
-
}),
|
|
11957
|
-
children: jsxs(CardContent, {
|
|
11958
|
-
sx: {
|
|
11959
|
-
position: 'relative',
|
|
11960
|
-
padding: 1,
|
|
11961
|
-
'&:last-child': {
|
|
11962
|
-
paddingBottom: 1
|
|
11963
|
-
}
|
|
11964
|
-
},
|
|
11965
|
-
children: [jsx(Typography, {
|
|
11966
|
-
variant: "h4",
|
|
11967
|
-
sx: {
|
|
11968
|
-
color: 'text.primary',
|
|
11969
|
-
fontSize: '0.75rem',
|
|
11970
|
-
fontWeight: 'normal',
|
|
11971
|
-
lineHeight: 1.83
|
|
11972
|
-
},
|
|
11973
|
-
role: "heading",
|
|
11974
|
-
children: objectName
|
|
11975
|
-
}), jsx(Typography, {
|
|
11976
|
-
variant: "body2",
|
|
12011
|
+
// These phenomena are sent to Public Warning Form
|
|
12012
|
+
const warningFormPhenomena = warningPhenomena.filter(phenomenon => !phenomenon.isAviation);
|
|
12013
|
+
return jsx(ReactHookFormSelect, {
|
|
12014
|
+
name: "phenomenon",
|
|
12015
|
+
label: t('warning-phenomenon'),
|
|
12016
|
+
rules: {
|
|
12017
|
+
validate: {
|
|
12018
|
+
isRequired
|
|
12019
|
+
}
|
|
12020
|
+
},
|
|
12021
|
+
disabled: isDisabled || isReadOnly,
|
|
12022
|
+
isReadOnly: isReadOnly,
|
|
12023
|
+
children: warningFormPhenomena.map(phenomenon => jsx(MenuItem, {
|
|
12024
|
+
value: phenomenon.key,
|
|
12025
|
+
children: jsxs(Grid2, {
|
|
12026
|
+
container: true,
|
|
12027
|
+
justifyContent: "space-between",
|
|
12028
|
+
children: [jsx(Grid2, {
|
|
12029
|
+
children: t(phenomenon.translationKey)
|
|
12030
|
+
}), jsx(Grid2, {
|
|
11977
12031
|
sx: {
|
|
11978
|
-
|
|
11979
|
-
},
|
|
11980
|
-
children: lastUpdatedTime ? formatDate(lastUpdatedTime) : ''
|
|
11981
|
-
}), geoJSON ? jsx(ToggleMenu, {
|
|
11982
|
-
menuTitle: t('object-manager-options-menu'),
|
|
11983
|
-
tooltipTitle: t('object-manager-options-menu'),
|
|
11984
|
-
buttonSx: {
|
|
11985
|
-
position: 'absolute',
|
|
11986
|
-
right: 0,
|
|
11987
|
-
margin: 'auto',
|
|
11988
|
-
top: 0,
|
|
11989
|
-
bottom: 0,
|
|
11990
|
-
marginRight: '8px'
|
|
12032
|
+
minWidth: 56
|
|
11991
12033
|
},
|
|
11992
|
-
|
|
11993
|
-
|
|
11994
|
-
menuItems: [{
|
|
11995
|
-
text: t('object-manager-button-edit'),
|
|
11996
|
-
action: _onEditObject,
|
|
11997
|
-
icon: jsx(Edit, {})
|
|
11998
|
-
}, {
|
|
11999
|
-
text: t('object-manager-button-view'),
|
|
12000
|
-
action: _onViewObject,
|
|
12001
|
-
icon: jsx(Visibility, {})
|
|
12002
|
-
}, {
|
|
12003
|
-
text: t('object-manager-button-delete'),
|
|
12004
|
-
action: _onDeleteObject,
|
|
12005
|
-
icon: jsx(Delete, {})
|
|
12006
|
-
}]
|
|
12007
|
-
}) : null]
|
|
12034
|
+
children: getPhenomenaIcon(phenomenon.key)
|
|
12035
|
+
})]
|
|
12008
12036
|
})
|
|
12009
|
-
}
|
|
12010
|
-
rules: {
|
|
12011
|
-
validate: {
|
|
12012
|
-
isRequired
|
|
12013
|
-
}
|
|
12014
|
-
},
|
|
12015
|
-
name: "areas[0].geoJSON"
|
|
12016
|
-
}), jsx(Button, {
|
|
12017
|
-
sx: {
|
|
12018
|
-
marginTop: 1
|
|
12019
|
-
},
|
|
12020
|
-
variant: "tertiary",
|
|
12021
|
-
startIcon: jsx(Add, {}),
|
|
12022
|
-
size: "small",
|
|
12023
|
-
onClick: _onAddObject,
|
|
12024
|
-
disabled: _isDisabled,
|
|
12025
|
-
children: t('warning-button-add-object')
|
|
12026
|
-
})]
|
|
12037
|
+
}, phenomenon.key))
|
|
12027
12038
|
});
|
|
12028
12039
|
};
|
|
12029
12040
|
|
|
@@ -12717,7 +12728,7 @@ const Form = ({
|
|
|
12717
12728
|
size: {
|
|
12718
12729
|
xs: 12
|
|
12719
12730
|
},
|
|
12720
|
-
children: jsx(Phenomenon, {
|
|
12731
|
+
children: jsx(Phenomenon$1, {
|
|
12721
12732
|
isDisabled: areFieldsDisabled,
|
|
12722
12733
|
isReadOnly: _isReadOnly2
|
|
12723
12734
|
})
|
|
@@ -14144,41 +14155,134 @@ const FilterChipWithOptions = ({
|
|
|
14144
14155
|
})]
|
|
14145
14156
|
});
|
|
14146
14157
|
};
|
|
14147
|
-
|
|
14148
|
-
const FilterChipWithOptionsConnect = ({
|
|
14149
|
-
filter
|
|
14150
|
-
}) => {
|
|
14151
|
-
const dispatch = useDispatch();
|
|
14152
|
-
const toggleFilter = React.useCallback((filterId, isChecked) => {
|
|
14153
|
-
dispatch(publicWarningActions.toggleFilter({
|
|
14154
|
-
filterId,
|
|
14155
|
-
isChecked
|
|
14156
|
-
}));
|
|
14157
|
-
}, [dispatch]);
|
|
14158
|
-
const toggleOption = React.useCallback((filterId, optionId) => {
|
|
14159
|
-
dispatch(publicWarningActions.toggleOption({
|
|
14160
|
-
filterId,
|
|
14161
|
-
optionId
|
|
14162
|
-
}));
|
|
14163
|
-
}, [dispatch]);
|
|
14164
|
-
const enableOnlyOneFilterOption = React.useCallback((filterId, optionId) => {
|
|
14165
|
-
dispatch(publicWarningActions.enableOnlyOneFilterOption({
|
|
14166
|
-
filterId,
|
|
14167
|
-
optionId
|
|
14168
|
-
}));
|
|
14169
|
-
}, [dispatch]);
|
|
14170
|
-
const filterListWithActions = filter.filterList.map(option => {
|
|
14171
|
-
return Object.assign({}, option, {
|
|
14172
|
-
toggleFilter: () => toggleOption(filter.id, option.filter.id),
|
|
14173
|
-
enableOnlyOneFilter: () => enableOnlyOneFilterOption(filter.id, option.filter.id)
|
|
14174
|
-
});
|
|
14175
|
-
});
|
|
14176
|
-
return jsx(FilterChipWithOptions, Object.assign({}, filter, {
|
|
14177
|
-
handleClick: toggleFilter,
|
|
14178
|
-
filterList: filterListWithActions
|
|
14179
|
-
}));
|
|
14158
|
+
|
|
14159
|
+
const FilterChipWithOptionsConnect = ({
|
|
14160
|
+
filter
|
|
14161
|
+
}) => {
|
|
14162
|
+
const dispatch = useDispatch();
|
|
14163
|
+
const toggleFilter = React.useCallback((filterId, isChecked) => {
|
|
14164
|
+
dispatch(publicWarningActions.toggleFilter({
|
|
14165
|
+
filterId,
|
|
14166
|
+
isChecked
|
|
14167
|
+
}));
|
|
14168
|
+
}, [dispatch]);
|
|
14169
|
+
const toggleOption = React.useCallback((filterId, optionId) => {
|
|
14170
|
+
dispatch(publicWarningActions.toggleOption({
|
|
14171
|
+
filterId,
|
|
14172
|
+
optionId
|
|
14173
|
+
}));
|
|
14174
|
+
}, [dispatch]);
|
|
14175
|
+
const enableOnlyOneFilterOption = React.useCallback((filterId, optionId) => {
|
|
14176
|
+
dispatch(publicWarningActions.enableOnlyOneFilterOption({
|
|
14177
|
+
filterId,
|
|
14178
|
+
optionId
|
|
14179
|
+
}));
|
|
14180
|
+
}, [dispatch]);
|
|
14181
|
+
const filterListWithActions = filter.filterList.map(option => {
|
|
14182
|
+
return Object.assign({}, option, {
|
|
14183
|
+
toggleFilter: () => toggleOption(filter.id, option.filter.id),
|
|
14184
|
+
enableOnlyOneFilter: () => enableOnlyOneFilterOption(filter.id, option.filter.id)
|
|
14185
|
+
});
|
|
14186
|
+
});
|
|
14187
|
+
return jsx(FilterChipWithOptions, Object.assign({}, filter, {
|
|
14188
|
+
handleClick: toggleFilter,
|
|
14189
|
+
filterList: filterListWithActions
|
|
14190
|
+
}));
|
|
14191
|
+
};
|
|
14192
|
+
|
|
14193
|
+
const warningColors = Object.assign({}, LevelColors);
|
|
14194
|
+
|
|
14195
|
+
const _excluded$5 = ["id", "warningDetail", "status", "editor"],
|
|
14196
|
+
_excluded2 = ["id", "linked_to_id", "proposal_id", "warning_handle_uuid"],
|
|
14197
|
+
_excluded3 = ["id"],
|
|
14198
|
+
_excluded4 = ["id", "warningDetail"],
|
|
14199
|
+
_excluded5 = ["id"];
|
|
14200
|
+
const getSortedStatus = status => {
|
|
14201
|
+
switch (status) {
|
|
14202
|
+
case 'DRAFT_PUBLISHED':
|
|
14203
|
+
{
|
|
14204
|
+
return PublicWarningStatus.DRAFT;
|
|
14205
|
+
}
|
|
14206
|
+
default:
|
|
14207
|
+
{
|
|
14208
|
+
return status;
|
|
14209
|
+
}
|
|
14210
|
+
}
|
|
14211
|
+
};
|
|
14212
|
+
const getWarningWithoutIdStatusEditor = warning => {
|
|
14213
|
+
const {
|
|
14214
|
+
warningDetail
|
|
14215
|
+
} = warning,
|
|
14216
|
+
fullWarning = _objectWithoutPropertiesLoose(warning, _excluded$5);
|
|
14217
|
+
const cleanWarningDetail = _objectWithoutPropertiesLoose(warningDetail, _excluded2);
|
|
14218
|
+
return Object.assign({}, fullWarning, {
|
|
14219
|
+
warningDetail: cleanWarningDetail
|
|
14220
|
+
});
|
|
14221
|
+
};
|
|
14222
|
+
const getWarningWithLinkedToId = warning => {
|
|
14223
|
+
const {
|
|
14224
|
+
id,
|
|
14225
|
+
warningDetail
|
|
14226
|
+
} = warning;
|
|
14227
|
+
const cleanWarningDetail = _objectWithoutPropertiesLoose(warningDetail, _excluded3);
|
|
14228
|
+
return Object.assign({}, warning, {
|
|
14229
|
+
warningDetail: Object.assign({}, cleanWarningDetail, {
|
|
14230
|
+
linked_to_id: id
|
|
14231
|
+
}),
|
|
14232
|
+
status: PublicWarningStatus.DRAFT_PUBLISHED
|
|
14233
|
+
});
|
|
14234
|
+
};
|
|
14235
|
+
const getWarningWithProposalId = warning => {
|
|
14236
|
+
const {
|
|
14237
|
+
id,
|
|
14238
|
+
warningDetail
|
|
14239
|
+
} = warning,
|
|
14240
|
+
fullWarning = _objectWithoutPropertiesLoose(warning, _excluded4);
|
|
14241
|
+
const cleanWarningDetail = _objectWithoutPropertiesLoose(warningDetail, _excluded5);
|
|
14242
|
+
return Object.assign({}, fullWarning, {
|
|
14243
|
+
warningDetail: Object.assign({}, cleanWarningDetail, {
|
|
14244
|
+
proposal_id: id
|
|
14245
|
+
})
|
|
14246
|
+
});
|
|
14247
|
+
};
|
|
14248
|
+
function useOverflowCheck(text) {
|
|
14249
|
+
const ref = React__default.useRef(null);
|
|
14250
|
+
const [isOverflowing, setIsOverflowing] = React__default.useState(false);
|
|
14251
|
+
React__default.useEffect(() => {
|
|
14252
|
+
const checkOverflow = () => {
|
|
14253
|
+
if (ref.current) {
|
|
14254
|
+
setIsOverflowing(ref.current.scrollWidth > ref.current.clientWidth);
|
|
14255
|
+
}
|
|
14256
|
+
};
|
|
14257
|
+
checkOverflow();
|
|
14258
|
+
}, [text]);
|
|
14259
|
+
return {
|
|
14260
|
+
ref,
|
|
14261
|
+
isOverflowing
|
|
14262
|
+
};
|
|
14263
|
+
}
|
|
14264
|
+
const getTranslationKey = (optionId, id) => {
|
|
14265
|
+
const phenomena = warningPhenomena.find(phenomenon => phenomenon.key === optionId);
|
|
14266
|
+
return phenomena ? phenomena.translationKey : `warning-${id}-${optionId}`;
|
|
14180
14267
|
};
|
|
14181
14268
|
|
|
14269
|
+
/* *
|
|
14270
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
14271
|
+
* you may not use this file except in compliance with the License.
|
|
14272
|
+
* You may obtain a copy of the License at
|
|
14273
|
+
*
|
|
14274
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
14275
|
+
*
|
|
14276
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14277
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
14278
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14279
|
+
* See the License for the specific language governing permissions and
|
|
14280
|
+
* limitations under the License.
|
|
14281
|
+
*
|
|
14282
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
14283
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
14284
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
14285
|
+
* */
|
|
14182
14286
|
var Domain;
|
|
14183
14287
|
(function (Domain) {
|
|
14184
14288
|
Domain["aviation"] = "aviation";
|
|
@@ -14187,11 +14291,21 @@ var Domain;
|
|
|
14187
14291
|
})(Domain || (Domain = {}));
|
|
14188
14292
|
var Level;
|
|
14189
14293
|
(function (Level) {
|
|
14190
|
-
Level["unspecified"] = "unspecified";
|
|
14191
14294
|
Level["extreme"] = "extreme";
|
|
14192
14295
|
Level["moderate"] = "moderate";
|
|
14193
14296
|
Level["severe"] = "severe";
|
|
14194
14297
|
})(Level || (Level = {}));
|
|
14298
|
+
var Phenomenon;
|
|
14299
|
+
(function (Phenomenon) {
|
|
14300
|
+
Phenomenon["wind"] = "wind";
|
|
14301
|
+
Phenomenon["fog"] = "fog";
|
|
14302
|
+
Phenomenon["thunderstorm"] = "thunderstorm";
|
|
14303
|
+
Phenomenon["snowIce"] = "snowIce";
|
|
14304
|
+
Phenomenon["rain"] = "rain";
|
|
14305
|
+
Phenomenon["highTemp"] = "highTemp";
|
|
14306
|
+
Phenomenon["lowTemp"] = "lowTemp";
|
|
14307
|
+
Phenomenon["coastalEvent"] = "coastalEvent";
|
|
14308
|
+
})(Phenomenon || (Phenomenon = {}));
|
|
14195
14309
|
const defaultDomainFilter = {
|
|
14196
14310
|
aviation: false,
|
|
14197
14311
|
maritime: false,
|
|
@@ -14203,64 +14317,16 @@ const defaultLevelFilter = {
|
|
|
14203
14317
|
moderate: true,
|
|
14204
14318
|
severe: true
|
|
14205
14319
|
};
|
|
14206
|
-
const
|
|
14207
|
-
|
|
14208
|
-
|
|
14209
|
-
|
|
14210
|
-
|
|
14211
|
-
|
|
14212
|
-
|
|
14213
|
-
|
|
14214
|
-
|
|
14215
|
-
|
|
14216
|
-
const updateState = (state, optionKey, value, only) => {
|
|
14217
|
-
if (only) {
|
|
14218
|
-
return Object.keys(state).reduce((acc, k) => Object.assign({}, acc, {
|
|
14219
|
-
[k]: k === optionKey
|
|
14220
|
-
}), {});
|
|
14221
|
-
}
|
|
14222
|
-
return optionKey === 'ALL' ? Object.keys(state).reduce((acc, k) => Object.assign({}, acc, {
|
|
14223
|
-
[k]: value
|
|
14224
|
-
}), {}) : Object.assign({}, state, {
|
|
14225
|
-
[optionKey]: value
|
|
14226
|
-
});
|
|
14227
|
-
};
|
|
14228
|
-
/**
|
|
14229
|
-
* @param filterKey - Name of the filter | "ALL" filters
|
|
14230
|
-
* @param optionKey - Name of the option | "ALL" options
|
|
14231
|
-
* @param value - The new value
|
|
14232
|
-
* @param only - Flag that decides if all other options should be disabled
|
|
14233
|
-
*/
|
|
14234
|
-
const updateFilter = (filterKey, optionKey, value, only) => {
|
|
14235
|
-
if (filterKey === 'ALL') {
|
|
14236
|
-
setDomainFilter(state => updateState(state, 'ALL', value));
|
|
14237
|
-
setLevelsFilter(state => updateState(state, 'ALL', value));
|
|
14238
|
-
} else if (filterKey === 'domain') {
|
|
14239
|
-
setDomainFilter(state => updateState(state, optionKey, value, only));
|
|
14240
|
-
} else if (filterKey === 'level') {
|
|
14241
|
-
setLevelsFilter(state => updateState(state, optionKey, value, only));
|
|
14242
|
-
}
|
|
14243
|
-
};
|
|
14244
|
-
const byFilterState = warning => {
|
|
14245
|
-
const levelDomain = ['SIG', 'AIR'].find(d => d === warning.warningDetail.level) ? Domain.aviation : Domain.public;
|
|
14246
|
-
if (!domainFilter[levelDomain]) {
|
|
14247
|
-
return false;
|
|
14248
|
-
}
|
|
14249
|
-
const level = Object.values(Level).find(level => level === warning.warningDetail.level) || Level.unspecified;
|
|
14250
|
-
if (!levelFilter[level]) {
|
|
14251
|
-
return false;
|
|
14252
|
-
}
|
|
14253
|
-
return true;
|
|
14254
|
-
};
|
|
14255
|
-
return {
|
|
14256
|
-
filterState: {
|
|
14257
|
-
domain: domainFilter,
|
|
14258
|
-
level: levelFilter
|
|
14259
|
-
},
|
|
14260
|
-
allSelected,
|
|
14261
|
-
updateFilter,
|
|
14262
|
-
byFilterState
|
|
14263
|
-
};
|
|
14320
|
+
const defaultPhenomenonFilter = {
|
|
14321
|
+
unspecified: true,
|
|
14322
|
+
coastalEvent: true,
|
|
14323
|
+
fog: true,
|
|
14324
|
+
highTemp: true,
|
|
14325
|
+
lowTemp: true,
|
|
14326
|
+
rain: true,
|
|
14327
|
+
snowIce: true,
|
|
14328
|
+
thunderstorm: true,
|
|
14329
|
+
wind: true
|
|
14264
14330
|
};
|
|
14265
14331
|
const useSelectedOptions = options => {
|
|
14266
14332
|
const selectedOptions = Object.keys(options).filter(k => options[k]);
|
|
@@ -14271,8 +14337,6 @@ const useSelectedOptions = options => {
|
|
|
14271
14337
|
};
|
|
14272
14338
|
};
|
|
14273
14339
|
|
|
14274
|
-
const warningColors = Object.assign({}, LevelColors);
|
|
14275
|
-
|
|
14276
14340
|
const ExpandableFilterChip = ({
|
|
14277
14341
|
id,
|
|
14278
14342
|
options,
|
|
@@ -14388,9 +14452,14 @@ const ExpandableFilterChip = ({
|
|
|
14388
14452
|
onClick: (checked, only) => updateFilter(id, optionId, checked, only),
|
|
14389
14453
|
labelStyle: Object.assign({}, getLevelStyle(warningColor), {
|
|
14390
14454
|
width: 'fit-content',
|
|
14391
|
-
fontSize: '16px'
|
|
14455
|
+
fontSize: '16px',
|
|
14456
|
+
display: 'flex',
|
|
14457
|
+
alignItems: 'center',
|
|
14458
|
+
gap: 1
|
|
14392
14459
|
}),
|
|
14393
|
-
label:
|
|
14460
|
+
label: jsxs(Fragment, {
|
|
14461
|
+
children: [getWarningPhenomenaIcon(optionId), ' ', t(getTranslationKey(optionId, id))]
|
|
14462
|
+
})
|
|
14394
14463
|
}, `${id}-${optionId}`);
|
|
14395
14464
|
})
|
|
14396
14465
|
})]
|
|
@@ -14439,15 +14508,17 @@ const FilterList = ({
|
|
|
14439
14508
|
return jsx(FilterChipWithOptionsConnect, {
|
|
14440
14509
|
filter: filter
|
|
14441
14510
|
}, filter.id);
|
|
14442
|
-
}),
|
|
14443
|
-
|
|
14444
|
-
|
|
14445
|
-
|
|
14446
|
-
|
|
14511
|
+
}), Object.keys(filterState).map(filterId => {
|
|
14512
|
+
return jsx(ExpandableFilterChip, {
|
|
14513
|
+
id: filterId,
|
|
14514
|
+
options: filterState[filterId],
|
|
14515
|
+
updateFilter: updateFilter
|
|
14516
|
+
}, filterId);
|
|
14517
|
+
})]
|
|
14447
14518
|
});
|
|
14448
14519
|
};
|
|
14449
14520
|
|
|
14450
|
-
const _excluded$
|
|
14521
|
+
const _excluded$4 = ["totalWarnings", "status", "isExpanded", "onClick"];
|
|
14451
14522
|
const HEADER_SIZE = 32;
|
|
14452
14523
|
const WarningListItemSeperator = _ref => {
|
|
14453
14524
|
let {
|
|
@@ -14456,7 +14527,7 @@ const WarningListItemSeperator = _ref => {
|
|
|
14456
14527
|
isExpanded,
|
|
14457
14528
|
onClick
|
|
14458
14529
|
} = _ref,
|
|
14459
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
14530
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$4);
|
|
14460
14531
|
const {
|
|
14461
14532
|
t
|
|
14462
14533
|
} = useWarningsTranslation();
|
|
@@ -14497,76 +14568,6 @@ const WarningListItemSeperator = _ref => {
|
|
|
14497
14568
|
}));
|
|
14498
14569
|
};
|
|
14499
14570
|
|
|
14500
|
-
const _excluded$4 = ["id", "warningDetail", "status", "editor"],
|
|
14501
|
-
_excluded2 = ["id", "linked_to_id", "proposal_id", "warning_handle_uuid"],
|
|
14502
|
-
_excluded3 = ["id"],
|
|
14503
|
-
_excluded4 = ["id", "warningDetail"],
|
|
14504
|
-
_excluded5 = ["id"];
|
|
14505
|
-
const getSortedStatus = status => {
|
|
14506
|
-
switch (status) {
|
|
14507
|
-
case 'DRAFT_PUBLISHED':
|
|
14508
|
-
{
|
|
14509
|
-
return PublicWarningStatus.DRAFT;
|
|
14510
|
-
}
|
|
14511
|
-
default:
|
|
14512
|
-
{
|
|
14513
|
-
return status;
|
|
14514
|
-
}
|
|
14515
|
-
}
|
|
14516
|
-
};
|
|
14517
|
-
const getWarningWithoutIdStatusEditor = warning => {
|
|
14518
|
-
const {
|
|
14519
|
-
warningDetail
|
|
14520
|
-
} = warning,
|
|
14521
|
-
fullWarning = _objectWithoutPropertiesLoose(warning, _excluded$4);
|
|
14522
|
-
const cleanWarningDetail = _objectWithoutPropertiesLoose(warningDetail, _excluded2);
|
|
14523
|
-
return Object.assign({}, fullWarning, {
|
|
14524
|
-
warningDetail: cleanWarningDetail
|
|
14525
|
-
});
|
|
14526
|
-
};
|
|
14527
|
-
const getWarningWithLinkedToId = warning => {
|
|
14528
|
-
const {
|
|
14529
|
-
id,
|
|
14530
|
-
warningDetail
|
|
14531
|
-
} = warning;
|
|
14532
|
-
const cleanWarningDetail = _objectWithoutPropertiesLoose(warningDetail, _excluded3);
|
|
14533
|
-
return Object.assign({}, warning, {
|
|
14534
|
-
warningDetail: Object.assign({}, cleanWarningDetail, {
|
|
14535
|
-
linked_to_id: id
|
|
14536
|
-
}),
|
|
14537
|
-
status: PublicWarningStatus.DRAFT_PUBLISHED
|
|
14538
|
-
});
|
|
14539
|
-
};
|
|
14540
|
-
const getWarningWithProposalId = warning => {
|
|
14541
|
-
const {
|
|
14542
|
-
id,
|
|
14543
|
-
warningDetail
|
|
14544
|
-
} = warning,
|
|
14545
|
-
fullWarning = _objectWithoutPropertiesLoose(warning, _excluded4);
|
|
14546
|
-
const cleanWarningDetail = _objectWithoutPropertiesLoose(warningDetail, _excluded5);
|
|
14547
|
-
return Object.assign({}, fullWarning, {
|
|
14548
|
-
warningDetail: Object.assign({}, cleanWarningDetail, {
|
|
14549
|
-
proposal_id: id
|
|
14550
|
-
})
|
|
14551
|
-
});
|
|
14552
|
-
};
|
|
14553
|
-
function useOverflowCheck(text) {
|
|
14554
|
-
const ref = React__default.useRef(null);
|
|
14555
|
-
const [isOverflowing, setIsOverflowing] = React__default.useState(false);
|
|
14556
|
-
React__default.useEffect(() => {
|
|
14557
|
-
const checkOverflow = () => {
|
|
14558
|
-
if (ref.current) {
|
|
14559
|
-
setIsOverflowing(ref.current.scrollWidth > ref.current.clientWidth);
|
|
14560
|
-
}
|
|
14561
|
-
};
|
|
14562
|
-
checkOverflow();
|
|
14563
|
-
}, [text]);
|
|
14564
|
-
return {
|
|
14565
|
-
ref,
|
|
14566
|
-
isOverflowing
|
|
14567
|
-
};
|
|
14568
|
-
}
|
|
14569
|
-
|
|
14570
14571
|
const _excluded$3 = ["title", "status", "children", "width"];
|
|
14571
14572
|
const WarningListColumnContent = _ref => {
|
|
14572
14573
|
let {
|
|
@@ -14973,6 +14974,80 @@ const WarningListItem = _ref => {
|
|
|
14973
14974
|
}), warning.id);
|
|
14974
14975
|
};
|
|
14975
14976
|
|
|
14977
|
+
const useWarningFilters = warnings => {
|
|
14978
|
+
const [domainFilter, setDomainFilter] = useState(defaultDomainFilter);
|
|
14979
|
+
const [levelFilter, setLevelsFilter] = useState(defaultLevelFilter);
|
|
14980
|
+
const [phenomenonFilter, setPhenomenonFilter] = useState(defaultPhenomenonFilter);
|
|
14981
|
+
const existingPhenomenon = uniq(warnings.map(w => w.warningDetail.phenomenon).filter(w => w)).sort();
|
|
14982
|
+
const pickedPhenomenonFilter = pick(phenomenonFilter, ['unspecified', ...existingPhenomenon]);
|
|
14983
|
+
const {
|
|
14984
|
+
allSelected: allDomainSelected
|
|
14985
|
+
} = useSelectedOptions(domainFilter);
|
|
14986
|
+
const {
|
|
14987
|
+
allSelected: allLevelSelected
|
|
14988
|
+
} = useSelectedOptions(levelFilter);
|
|
14989
|
+
const {
|
|
14990
|
+
allSelected: allPhenomenonSelected
|
|
14991
|
+
} = useSelectedOptions(phenomenonFilter);
|
|
14992
|
+
const allSelected = allDomainSelected && allLevelSelected && allPhenomenonSelected;
|
|
14993
|
+
const updateState = (state, optionKey, value, only) => {
|
|
14994
|
+
if (only) {
|
|
14995
|
+
return Object.keys(state).reduce((acc, k) => Object.assign({}, acc, {
|
|
14996
|
+
[k]: k === optionKey
|
|
14997
|
+
}), {});
|
|
14998
|
+
}
|
|
14999
|
+
return optionKey === 'ALL' ? Object.keys(state).reduce((acc, k) => Object.assign({}, acc, {
|
|
15000
|
+
[k]: value
|
|
15001
|
+
}), {}) : Object.assign({}, state, {
|
|
15002
|
+
[optionKey]: value
|
|
15003
|
+
});
|
|
15004
|
+
};
|
|
15005
|
+
/**
|
|
15006
|
+
* @param filterKey - Name of the filter | "ALL" filters
|
|
15007
|
+
* @param optionKey - Name of the option | "ALL" options
|
|
15008
|
+
* @param value - The new value
|
|
15009
|
+
* @param only - Flag that decides if all other options should be disabled
|
|
15010
|
+
*/
|
|
15011
|
+
const updateFilter = (filterKey, optionKey, value, only) => {
|
|
15012
|
+
if (filterKey === 'ALL') {
|
|
15013
|
+
setDomainFilter(state => updateState(state, 'ALL', value));
|
|
15014
|
+
setLevelsFilter(state => updateState(state, 'ALL', value));
|
|
15015
|
+
setPhenomenonFilter(state => updateState(state, 'ALL', value));
|
|
15016
|
+
} else if (filterKey === 'domain') {
|
|
15017
|
+
setDomainFilter(state => updateState(state, optionKey, value, only));
|
|
15018
|
+
} else if (filterKey === 'level') {
|
|
15019
|
+
setLevelsFilter(state => updateState(state, optionKey, value, only));
|
|
15020
|
+
} else if (filterKey === 'phenomenon') {
|
|
15021
|
+
setPhenomenonFilter(state => updateState(state, optionKey, value, only));
|
|
15022
|
+
}
|
|
15023
|
+
};
|
|
15024
|
+
const byFilterState = warning => {
|
|
15025
|
+
const levelDomain = ['SIG', 'AIR'].find(d => d === warning.warningDetail.level) ? Domain.aviation : Domain.public;
|
|
15026
|
+
if (!domainFilter[levelDomain]) {
|
|
15027
|
+
return false;
|
|
15028
|
+
}
|
|
15029
|
+
const level = Object.values(Level).find(level => level === warning.warningDetail.level) || 'unspecified';
|
|
15030
|
+
if (!levelFilter[level]) {
|
|
15031
|
+
return false;
|
|
15032
|
+
}
|
|
15033
|
+
const phenomenon = Object.values(Phenomenon).find(p => p === warning.warningDetail.phenomenon) || 'unspecified';
|
|
15034
|
+
if (!phenomenonFilter[phenomenon]) {
|
|
15035
|
+
return false;
|
|
15036
|
+
}
|
|
15037
|
+
return true;
|
|
15038
|
+
};
|
|
15039
|
+
return {
|
|
15040
|
+
filterState: {
|
|
15041
|
+
domain: domainFilter,
|
|
15042
|
+
phenomenon: pickedPhenomenonFilter,
|
|
15043
|
+
level: levelFilter
|
|
15044
|
+
},
|
|
15045
|
+
allSelected,
|
|
15046
|
+
updateFilter,
|
|
15047
|
+
byFilterState
|
|
15048
|
+
};
|
|
15049
|
+
};
|
|
15050
|
+
|
|
14976
15051
|
const _excluded$1 = ["title", "width"];
|
|
14977
15052
|
const sortWarningsOnStatus = warnings => {
|
|
14978
15053
|
return warnings.reduce((allWarnings, warning) => {
|
|
@@ -15055,7 +15130,7 @@ const PublicWarningList = ({
|
|
|
15055
15130
|
allSelected,
|
|
15056
15131
|
updateFilter,
|
|
15057
15132
|
byFilterState
|
|
15058
|
-
} = useWarningFilters();
|
|
15133
|
+
} = useWarningFilters(_warnings);
|
|
15059
15134
|
const onClickAll = isChecked => {
|
|
15060
15135
|
_onClickAllChip(isChecked);
|
|
15061
15136
|
updateFilter('ALL', 'ALL', !isChecked);
|