@opengeoweb/warnings 14.2.2 → 14.4.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 +398 -155
- package/package.json +12 -12
- package/src/lib/api/warning-api/api.d.ts +1 -1
- package/src/lib/api/warning-api/hooks.d.ts +2 -1
- package/src/lib/components/AreaObjectLoader/AreaObjectLoaderConnect.d.ts +1 -1
- package/src/lib/components/DrawingToolForm/DrawingToolFormContents.d.ts +1 -0
- package/src/lib/components/MaritimeWarningsForm/MaritimeWarningsForm.d.ts +1 -1
- package/src/lib/components/MaritimeWarningsForm/WarningList/WarningListItem.spec.d.ts +1 -0
- package/src/lib/components/MaritimeWarningsForm/WarningList/WarningListSelect.d.ts +2 -2
- package/src/lib/components/MaritimeWarningsForm/WarningList/WarningListSelect.spec.d.ts +1 -0
- package/src/lib/components/MaritimeWarningsForm/WarningList/WindForceSelect.spec.d.ts +1 -0
- package/src/lib/components/MaritimeWarningsForm/utils.d.ts +2 -2
- package/src/lib/components/PublicWarningList/PublicWarningList.d.ts +2 -0
- package/src/lib/components/PublicWarningList/PublicWarningList.stories.d.ts +4 -0
- package/src/lib/components/PublicWarningList/PublicWarningListConnect.d.ts +0 -1
- package/src/lib/components/PublicWarningsForm/LevelField/LevelField.d.ts +1 -1
- package/src/lib/components/PublicWarningsForm/PublicWarningsForm.d.ts +1 -0
- package/src/lib/store/publicWarningForm/reducer.d.ts +2 -0
package/index.esm.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useDispatch, useSelector } from 'react-redux';
|
|
3
3
|
import { Polygons, ExitDomain, Share, Edit, Delete, CoastalEvent, TemperatureLow, TemperatureHigh, Rain, Snow, Lightning, Fog, Wind, Thunderstorm, SevereMountainWaves, VulcanicEruption, Haze, FreezingPrecipitation, ModerateAircraftIcing, SevereAircraftIcing, ModerateTurbulence, SevereTurbulence, SandStorm, RadioactiveMaterials, DrawPolygon, Visibility, Add, ArrowUpCompact, ArrowDownCompact, breakpoints, DragHandle, Info, Copy, Update, Cancel, Success, Expire, Remove, Options, ChevronDown, ChevronUp, Close, Clock } 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
|
-
import { defaultPolygon, emptyGeoJSON, MapControlButton, getIcon, rewindGeometry, getGeoJSONPropertyValue,
|
|
5
|
+
import { WEBMAP_REACT_NAMESPACE, defaultPolygon, getDrawModeIdFromSelectionType, currentlySupportedDrawModes, emptyGeoJSON, MapControlButton, defaultSmoothLine, defaultLineString, defaultFreehandLine, defaultOval, defaultCircle, defaultBox, defaultSquare, defaultLocation, defaultPoint, defaultDelete, getIcon, rewindGeometry, getGeoJSONPropertyValue, defaultLayers, viewUtils, OpenLayersMapView, MapControls, OpenLayersZoomControl, OpenLayersLayer, OpenLayersFeatureLayer, genericOpenLayersFeatureStyle, FEATURE_DRAW_FILL_COLOR, FEATURE_DRAW_SECONDARY_FILL_COLOR, FEATURE_DRAW_STROKE_COLOR } from '@opengeoweb/webmap-react';
|
|
6
6
|
import { SHARED_NAMESPACE, useConfirmationDialog, dateUtils, ToggleMenu, calculateStartSize, ToolContainerDraggable, AlertBanner, sessionStorageProvider, ConfirmationDialog, usePrevious, CustomIconButton, usePreventBrowserClose, CustomTooltip, Avatar, getInitials, SwitchButton, FilterChip, TooltipSelect, LastUpdateTime, CustomToggleButton, Filter, StatusTag, FilterOption, getAxiosErrorMessage, CustomDialog, ConfirmationButtons, ErrorBoundary } from '@opengeoweb/shared';
|
|
7
7
|
import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, current, combineReducers, configureStore } from '@reduxjs/toolkit';
|
|
8
8
|
import { defaultBbox } from '@opengeoweb/core';
|
|
@@ -220,6 +220,8 @@ var en = {
|
|
|
220
220
|
"tac-missing-data": "Missing data: no TAC can be generated",
|
|
221
221
|
"warning-list-button-renew": "Renew",
|
|
222
222
|
"warning-list-button-amend": "Amend",
|
|
223
|
+
"warning-list-too-many-title": "Too many warnings requested",
|
|
224
|
+
"warning-list-too-many-info": "There are {{count}} warnings in the selected timespan. In order to list the warnings, narrow down the search.",
|
|
223
225
|
"aviation-save-success": "{{warningType}} has succesfully been saved!",
|
|
224
226
|
"aviation-publish-success": "{{warningType}} has succesfully been published!",
|
|
225
227
|
"publish-this-product": "Are you sure you want to publish this {{product}}?",
|
|
@@ -284,7 +286,9 @@ var en = {
|
|
|
284
286
|
"maritime-config-error": "Something went wrong with loading the configuration file",
|
|
285
287
|
"maritime-warning-validuntil": "End time: ",
|
|
286
288
|
"maritime-wind-change-warning": "The entered wind change exceeds 180°. Please check if veering / backing is correct.",
|
|
287
|
-
"maritime-wind-change-error": "A wind change less than 45° is not allowed."
|
|
289
|
+
"maritime-wind-change-error": "A wind change less than 45° is not allowed.",
|
|
290
|
+
"maritime-button-extend": "Extend +24h",
|
|
291
|
+
"maritime-button-extending": "Extending"
|
|
288
292
|
};
|
|
289
293
|
var nl = {
|
|
290
294
|
"drawing-tool-form-tools": "Gereedschap",
|
|
@@ -398,6 +402,10 @@ var nl = {
|
|
|
398
402
|
"warning-list-header-levels": "Niveaus",
|
|
399
403
|
"warning-list-header-status": "Status",
|
|
400
404
|
"warning-list-header-draft": "CONCEPT",
|
|
405
|
+
"warning-list-too-many-title": "niet vertaald",
|
|
406
|
+
"warning-list-too-many-info": "niet vertaald",
|
|
407
|
+
"warning-list-show-anyway": "niet vertaald",
|
|
408
|
+
"warning-list-adjust-filter": "niet vertaald",
|
|
401
409
|
"area-object-loader-title": "Gebieden & Objecten",
|
|
402
410
|
"add-button": "Toevoegen",
|
|
403
411
|
"replace-button": "Vervangen",
|
|
@@ -498,7 +506,9 @@ var nl = {
|
|
|
498
506
|
"maritime-config-error": "Er is iets misgegaan bij het laden van het configuratiebestand",
|
|
499
507
|
"maritime-warning-validuntil": "Eind tijd: ",
|
|
500
508
|
"maritime-wind-change-warning": "De ingevulde wind wijziging overschrijdt 180°. Controleer of ruimend / krimpend klopt.",
|
|
501
|
-
"maritime-wind-change-error": "Een wind wijziging van minder dan 45° is niet toegestaan."
|
|
509
|
+
"maritime-wind-change-error": "Een wind wijziging van minder dan 45° is niet toegestaan.",
|
|
510
|
+
"maritime-button-extend": "Verlengen +24h",
|
|
511
|
+
"maritime-button-extending": "Verlengen"
|
|
502
512
|
};
|
|
503
513
|
var fi = {
|
|
504
514
|
"drawing-tool-form-tools": "Työkalut",
|
|
@@ -612,6 +622,10 @@ var fi = {
|
|
|
612
622
|
"warning-list-header-levels": "Tasot",
|
|
613
623
|
"warning-list-header-status": "Tila",
|
|
614
624
|
"warning-list-header-draft": "LUONNOS",
|
|
625
|
+
"warning-list-too-many-title": "ei käännetty",
|
|
626
|
+
"warning-list-too-many-info": "ei käännetty",
|
|
627
|
+
"warning-list-show-anyway": "ei käännetty",
|
|
628
|
+
"warning-list-adjust-filter": "ei käännetty",
|
|
615
629
|
"area-object-loader-title": "ei käännetty",
|
|
616
630
|
"add-button": "ei käännetty",
|
|
617
631
|
"replace-button": "ei käännetty",
|
|
@@ -762,6 +776,10 @@ var no = {
|
|
|
762
776
|
"warning-list-button-expire": "Sett som utgått",
|
|
763
777
|
"warning-list-button-withdraw": "Ta ut",
|
|
764
778
|
"warning-list-button-amend": "Amend",
|
|
779
|
+
"warning-list-too-many-title": "For mange varsler",
|
|
780
|
+
"warning-list-too-many-info": "Det er {{count}} varsler i den valgte tidsperioden. Vennligst juster filteret for å redusere antallet varsler som vises.",
|
|
781
|
+
"warning-list-show-anyway": "Vis likevel",
|
|
782
|
+
"warning-list-adjust-filter": "Juster filter",
|
|
765
783
|
"warning-list-status-draft": "Utkast",
|
|
766
784
|
"warning-list-status-published": "Publisert",
|
|
767
785
|
"warning-list-status-todo": "Til sjekk",
|
|
@@ -1278,7 +1296,7 @@ var getWarningFormDirty = createSelector(selectDrawByInstanceId, function (drawi
|
|
|
1278
1296
|
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
1279
1297
|
* */
|
|
1280
1298
|
var WARN_NAMESPACE = 'warn';
|
|
1281
|
-
var ns = [WARN_NAMESPACE, FORM_FIELDS_NAMESPACE, SHARED_NAMESPACE, SA_NAMESPACE];
|
|
1299
|
+
var ns = [WARN_NAMESPACE, FORM_FIELDS_NAMESPACE, SHARED_NAMESPACE, SA_NAMESPACE, WEBMAP_REACT_NAMESPACE];
|
|
1282
1300
|
var useWarningsTranslation = function useWarningsTranslation() {
|
|
1283
1301
|
return useTranslation(ns);
|
|
1284
1302
|
};
|
|
@@ -1565,7 +1583,7 @@ var useObjectDrawDialogAction = function useObjectDrawDialogAction(_ref5) {
|
|
|
1565
1583
|
geoJSONLayerId: currentDrawLayerId
|
|
1566
1584
|
}));
|
|
1567
1585
|
// activate default draw mode
|
|
1568
|
-
if (!drawDialogActiveDrawModeId && !isDrawDialogOpen) {
|
|
1586
|
+
if (!drawDialogActiveDrawModeId && !isDrawDialogOpen && !newGeoJSON) {
|
|
1569
1587
|
dispatch(drawingToolActions.changeDrawToolMode({
|
|
1570
1588
|
drawToolId: drawingDialogType,
|
|
1571
1589
|
drawModeId: defaultPolygon.drawModeId
|
|
@@ -1596,10 +1614,18 @@ var useObjectDrawDialogAction = function useObjectDrawDialogAction(_ref5) {
|
|
|
1596
1614
|
}));
|
|
1597
1615
|
}
|
|
1598
1616
|
if (newGeoJSON) {
|
|
1617
|
+
var _newGeoJSON$features$;
|
|
1599
1618
|
dispatch(layerActions.layerChangeGeojson({
|
|
1600
1619
|
layerId: currentDrawLayerId,
|
|
1601
1620
|
geojson: newGeoJSON
|
|
1602
1621
|
}));
|
|
1622
|
+
// select correct drawTool for selected object
|
|
1623
|
+
var type = (_newGeoJSON$features$ = newGeoJSON.features[0].properties) == null ? void 0 : _newGeoJSON$features$.selectionType;
|
|
1624
|
+
var drawModeId = getDrawModeIdFromSelectionType(type, currentlySupportedDrawModes);
|
|
1625
|
+
dispatch(drawingToolActions.changeDrawToolMode({
|
|
1626
|
+
drawToolId: drawingDialogType,
|
|
1627
|
+
drawModeId: drawModeId
|
|
1628
|
+
}));
|
|
1603
1629
|
}
|
|
1604
1630
|
};
|
|
1605
1631
|
var _useCloseDrawDialog = useCloseDrawDialog({
|
|
@@ -2068,8 +2094,13 @@ var ObjectManager = function ObjectManager(_ref) {
|
|
|
2068
2094
|
var config$1 = sessionStorageProvider.getConfig();
|
|
2069
2095
|
var publicWarningBaseUrl = config$1.GW_DRAWINGS_BASE_URL || '';
|
|
2070
2096
|
// API
|
|
2071
|
-
var getPublicWarningList = function getPublicWarningList(auth) {
|
|
2072
|
-
|
|
2097
|
+
var getPublicWarningList = function getPublicWarningList(auth, apiParams) {
|
|
2098
|
+
if (apiParams === void 0) {
|
|
2099
|
+
apiParams = {};
|
|
2100
|
+
}
|
|
2101
|
+
var params = new URLSearchParams(apiParams);
|
|
2102
|
+
var url = publicWarningBaseUrl + "/warnings" + (params.toString() ? "?" + params : '');
|
|
2103
|
+
return fetch(url, {
|
|
2073
2104
|
headers: getHeaders(auth)
|
|
2074
2105
|
}).then(handleResponse).then(function (warnings) {
|
|
2075
2106
|
return warnings.map(function (warning) {
|
|
@@ -2369,6 +2400,12 @@ var slice$1 = createSlice({
|
|
|
2369
2400
|
},
|
|
2370
2401
|
setSelectedWarningId: function setSelectedWarningId(draft, action) {
|
|
2371
2402
|
draft.selectedWarningId = action.payload;
|
|
2403
|
+
},
|
|
2404
|
+
setWarningLevel: function setWarningLevel(draft, action) {
|
|
2405
|
+
var level = action.payload;
|
|
2406
|
+
if (draft.warning) {
|
|
2407
|
+
draft.warning.warningDetail.level = level;
|
|
2408
|
+
}
|
|
2372
2409
|
}
|
|
2373
2410
|
},
|
|
2374
2411
|
extraReducers: function extraReducers(builder) {
|
|
@@ -3142,11 +3179,16 @@ var getSnackbarMessage = function getSnackbarMessage(objectName, wasUpdate) {
|
|
|
3142
3179
|
* @param disabled - Disables fetching, but still returns cached values.
|
|
3143
3180
|
* https://tanstack.com/query/v4/docs/framework/react/guides/disabling-queries
|
|
3144
3181
|
*/
|
|
3145
|
-
var usePublicWarnings = function usePublicWarnings(disabled) {
|
|
3182
|
+
var usePublicWarnings = function usePublicWarnings(disabled, timeFilter) {
|
|
3146
3183
|
if (disabled === void 0) {
|
|
3147
3184
|
disabled = false;
|
|
3148
3185
|
}
|
|
3149
|
-
|
|
3186
|
+
var shouldFilter = timeFilter && timeFilter.mode !== TimeFilterMode.all;
|
|
3187
|
+
var apiParams = shouldFilter ? getApiParams(timeFilter) : {};
|
|
3188
|
+
var queryKey = apiParams ? ['public-warning-list', JSON.stringify(apiParams)] : ['public-warning-list'];
|
|
3189
|
+
return useAuthQuery(queryKey, function (auth) {
|
|
3190
|
+
return getPublicWarningList(auth, apiParams);
|
|
3191
|
+
}, disabled, 1000 * 60);
|
|
3150
3192
|
};
|
|
3151
3193
|
var useMutatePublicWarningEditor = function useMutatePublicWarningEditor() {
|
|
3152
3194
|
var queryClient = useQueryClient();
|
|
@@ -3220,7 +3262,8 @@ var useMutateWarning = function useMutateWarning(snackBarMessage) {
|
|
|
3220
3262
|
},
|
|
3221
3263
|
onError: function onError(error) {
|
|
3222
3264
|
void queryClient.invalidateQueries({
|
|
3223
|
-
queryKey: ['public-warning-list']
|
|
3265
|
+
queryKey: ['public-warning-list'],
|
|
3266
|
+
exact: false
|
|
3224
3267
|
});
|
|
3225
3268
|
dispatch(publicWarningFormActions.setFormError({
|
|
3226
3269
|
message: error.message
|
|
@@ -3234,7 +3277,8 @@ var useMutateWarning = function useMutateWarning(snackBarMessage) {
|
|
|
3234
3277
|
case 0:
|
|
3235
3278
|
_context2.next = 2;
|
|
3236
3279
|
return queryClient.invalidateQueries({
|
|
3237
|
-
queryKey: ['public-warning-list']
|
|
3280
|
+
queryKey: ['public-warning-list'],
|
|
3281
|
+
exact: false
|
|
3238
3282
|
});
|
|
3239
3283
|
case 2:
|
|
3240
3284
|
location = data == null ? void 0 : data.get('location');
|
|
@@ -3300,7 +3344,9 @@ var useMutateDeleteWarning = function useMutateDeleteWarning() {
|
|
|
3300
3344
|
void queryClient.cancelQueries({
|
|
3301
3345
|
queryKey: ['public-warning-list']
|
|
3302
3346
|
});
|
|
3303
|
-
queryClient.
|
|
3347
|
+
queryClient.setQueriesData({
|
|
3348
|
+
queryKey: ['public-warning-list']
|
|
3349
|
+
}, function (old) {
|
|
3304
3350
|
return old == null ? void 0 : old.filter(function (warning) {
|
|
3305
3351
|
return warning.id !== variables.id;
|
|
3306
3352
|
});
|
|
@@ -3839,7 +3885,7 @@ var DEFAULT_DRAW_TOOL_POSITION = {
|
|
|
3839
3885
|
left: 50
|
|
3840
3886
|
};
|
|
3841
3887
|
var DEFAULT_DRAW_TOOL_MIN_SIZE = {
|
|
3842
|
-
width:
|
|
3888
|
+
width: 312,
|
|
3843
3889
|
height: 300
|
|
3844
3890
|
};
|
|
3845
3891
|
var DrawingTool = function DrawingTool(_ref) {
|
|
@@ -3960,7 +4006,41 @@ var useFormDirty = function useFormDirty(_ref) {
|
|
|
3960
4006
|
};
|
|
3961
4007
|
|
|
3962
4008
|
var opacityOptions = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0];
|
|
4009
|
+
var drawToolConfig = [{
|
|
4010
|
+
primaryMode: defaultPolygon
|
|
4011
|
+
}, {
|
|
4012
|
+
primaryMode: defaultLineString,
|
|
4013
|
+
secondaryMode: defaultSmoothLine
|
|
4014
|
+
}, {
|
|
4015
|
+
primaryMode: defaultFreehandLine
|
|
4016
|
+
}, {
|
|
4017
|
+
primaryMode: defaultCircle,
|
|
4018
|
+
secondaryMode: defaultOval
|
|
4019
|
+
}, {
|
|
4020
|
+
primaryMode: defaultSquare,
|
|
4021
|
+
secondaryMode: defaultBox
|
|
4022
|
+
}, {
|
|
4023
|
+
primaryMode: defaultPoint,
|
|
4024
|
+
secondaryMode: defaultLocation
|
|
4025
|
+
}, {
|
|
4026
|
+
primaryMode: defaultDelete
|
|
4027
|
+
}];
|
|
4028
|
+
/**
|
|
4029
|
+
* Utility to determine if the secondary draw mode button should be shown
|
|
4030
|
+
* @param mode DrawMode of the primary button
|
|
4031
|
+
* @param secondaryMode DrawMode of the secondary button
|
|
4032
|
+
* @param activeDrawModeId Currently active DrawMode id
|
|
4033
|
+
* @param geoJSONDrawMode DrawMode id derived from the GeoJSON selection type
|
|
4034
|
+
* @returns
|
|
4035
|
+
*/
|
|
4036
|
+
var shouldDisplayButton = function shouldDisplayButton(mode, secondaryMode, activeDrawModeId, geoJSONDrawMode) {
|
|
4037
|
+
if (activeDrawModeId === mode.drawModeId || activeDrawModeId === secondaryMode.drawModeId || geoJSONDrawMode === secondaryMode.drawModeId) {
|
|
4038
|
+
return true;
|
|
4039
|
+
}
|
|
4040
|
+
return false;
|
|
4041
|
+
};
|
|
3963
4042
|
var DrawingToolFormContentsNoMemo = function DrawingToolFormContentsNoMemo(_ref) {
|
|
4043
|
+
var _geoJSON$features;
|
|
3964
4044
|
var isLoading = _ref.isLoading,
|
|
3965
4045
|
dialogError = _ref.dialogError,
|
|
3966
4046
|
id = _ref.id,
|
|
@@ -3973,10 +4053,18 @@ var DrawingToolFormContentsNoMemo = function DrawingToolFormContentsNoMemo(_ref)
|
|
|
3973
4053
|
onChangeOpacity = _ref.onChangeOpacity,
|
|
3974
4054
|
onBlurName = _ref.onBlurName,
|
|
3975
4055
|
opacity = _ref.opacity,
|
|
3976
|
-
onSubmit = _ref.onSubmit
|
|
4056
|
+
onSubmit = _ref.onSubmit,
|
|
4057
|
+
geoJSON = _ref.geoJSON;
|
|
3977
4058
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
3978
4059
|
t = _useWarningsTranslati.t;
|
|
3979
4060
|
var hasErrors = Object.keys(errors).length > 0;
|
|
4061
|
+
// Only show the draw modes that are available in the current context
|
|
4062
|
+
var filteredDrawModes = drawToolConfig.filter(function (configItem) {
|
|
4063
|
+
return drawModes.find(function (mode) {
|
|
4064
|
+
return mode.drawModeId === configItem.primaryMode.drawModeId;
|
|
4065
|
+
});
|
|
4066
|
+
});
|
|
4067
|
+
var geoJSONDrawMode = getDrawModeIdFromSelectionType(geoJSON == null || (_geoJSON$features = geoJSON.features) == null || (_geoJSON$features = _geoJSON$features[0]) == null || (_geoJSON$features = _geoJSON$features.properties) == null ? void 0 : _geoJSON$features.selectionType, drawModes);
|
|
3980
4068
|
return jsxs(Fragment, {
|
|
3981
4069
|
children: [jsxs(Box, {
|
|
3982
4070
|
sx: {
|
|
@@ -4002,54 +4090,75 @@ var DrawingToolFormContentsNoMemo = function DrawingToolFormContentsNoMemo(_ref)
|
|
|
4002
4090
|
variant: "body2",
|
|
4003
4091
|
children: t('drawing-tool-form-tools')
|
|
4004
4092
|
})
|
|
4005
|
-
}),
|
|
4093
|
+
}), jsxs(Grid, {
|
|
4006
4094
|
container: true,
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4095
|
+
marginBottom: 1,
|
|
4096
|
+
children: [filteredDrawModes.map(function (_ref2) {
|
|
4097
|
+
var primaryMode = _ref2.primaryMode,
|
|
4098
|
+
secondaryMode = _ref2.secondaryMode;
|
|
4099
|
+
var showSecondaryButton = secondaryMode && drawModes.find(function (mode) {
|
|
4100
|
+
return mode.drawModeId === secondaryMode.drawModeId;
|
|
4101
|
+
}) && shouldDisplayButton(primaryMode, secondaryMode, activeDrawModeId, geoJSONDrawMode);
|
|
4102
|
+
return jsxs(Box, {
|
|
4103
|
+
sx: {
|
|
4104
|
+
display: 'inline-flex',
|
|
4105
|
+
flexDirection: 'column'
|
|
4106
|
+
},
|
|
4107
|
+
children: [jsx(CustomIconButton, {
|
|
4010
4108
|
variant: "tool",
|
|
4011
|
-
tooltipTitle:
|
|
4012
|
-
isSelected:
|
|
4109
|
+
tooltipTitle: t("" + primaryMode.title),
|
|
4110
|
+
isSelected: primaryMode.isSelectable && activeDrawModeId === primaryMode.drawModeId,
|
|
4013
4111
|
onClick: function onClick() {
|
|
4014
|
-
return onChangeDrawMode(
|
|
4112
|
+
return onChangeDrawMode(primaryMode);
|
|
4113
|
+
},
|
|
4114
|
+
"data-testid": primaryMode.drawModeId,
|
|
4115
|
+
disabled: isLoading,
|
|
4116
|
+
size: "medium",
|
|
4117
|
+
shouldShowExtraOptionsIndicator: !!secondaryMode,
|
|
4118
|
+
children: getIcon(primaryMode.selectionType)
|
|
4119
|
+
}), showSecondaryButton ? jsx(CustomIconButton, {
|
|
4120
|
+
variant: "tool",
|
|
4121
|
+
tooltipTitle: t("" + secondaryMode.title),
|
|
4122
|
+
isSelected: secondaryMode.isSelectable && activeDrawModeId === secondaryMode.drawModeId,
|
|
4123
|
+
onClick: function onClick() {
|
|
4124
|
+
return onChangeDrawMode(secondaryMode);
|
|
4015
4125
|
},
|
|
4016
4126
|
sx: {
|
|
4017
|
-
|
|
4018
|
-
marginBottom: 1
|
|
4127
|
+
marginTop: 1
|
|
4019
4128
|
},
|
|
4020
|
-
"data-testid":
|
|
4129
|
+
"data-testid": secondaryMode.drawModeId,
|
|
4021
4130
|
disabled: isLoading,
|
|
4022
4131
|
size: "medium",
|
|
4023
|
-
children: getIcon(
|
|
4024
|
-
}
|
|
4025
|
-
}
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4132
|
+
children: getIcon(secondaryMode.selectionType)
|
|
4133
|
+
}) : null]
|
|
4134
|
+
}, primaryMode.drawModeId);
|
|
4135
|
+
}), isInEditMode && jsx(Typography, {
|
|
4136
|
+
component: "span",
|
|
4137
|
+
sx: {
|
|
4138
|
+
display: 'inline-block',
|
|
4139
|
+
marginLeft: 2,
|
|
4140
|
+
top: -1,
|
|
4141
|
+
position: 'relative',
|
|
4142
|
+
fontSize: 14
|
|
4143
|
+
},
|
|
4144
|
+
children: t('drawing-tool-form-exit-draw-mode')
|
|
4145
|
+
}), !!errors.geoJSON && isDirty && jsx(FormHelperText, {
|
|
4146
|
+
error: true,
|
|
4147
|
+
variant: "filled",
|
|
4148
|
+
sx: {
|
|
4149
|
+
marginLeft: 0
|
|
4150
|
+
},
|
|
4151
|
+
children: errors.geoJSON.message
|
|
4152
|
+
}), jsx(ReactHookFormHiddenInput, {
|
|
4153
|
+
name: "geoJSON",
|
|
4154
|
+
rules: {
|
|
4155
|
+
validate: {
|
|
4156
|
+
coordinatesNotEmpty: function coordinatesNotEmpty(value) {
|
|
4157
|
+
return isValidGeoJsonCoordinates(value) || t('drawing-tool-form-drawing-required');
|
|
4049
4158
|
}
|
|
4050
4159
|
}
|
|
4051
|
-
}
|
|
4052
|
-
})
|
|
4160
|
+
}
|
|
4161
|
+
})]
|
|
4053
4162
|
}), jsx(Grid, {
|
|
4054
4163
|
container: true,
|
|
4055
4164
|
size: "grow",
|
|
@@ -4230,7 +4339,8 @@ var DrawingToolForm = function DrawingToolForm(_ref) {
|
|
|
4230
4339
|
onChangeOpacity: onChangeOpacity,
|
|
4231
4340
|
onBlurName: onBlurName,
|
|
4232
4341
|
opacity: opacity,
|
|
4233
|
-
onSubmit: handleSubmit(onSubmit)
|
|
4342
|
+
onSubmit: handleSubmit(onSubmit),
|
|
4343
|
+
geoJSON: geoJSON
|
|
4234
4344
|
});
|
|
4235
4345
|
};
|
|
4236
4346
|
var Wrapper = function Wrapper(props) {
|
|
@@ -5009,7 +5119,7 @@ var useAirmetList = function useAirmetList(disabled, timeFilter) {
|
|
|
5009
5119
|
var apiParams = timeFilter ? getApiParams(timeFilter) : {};
|
|
5010
5120
|
return useAuthQuery(['airmet-list', JSON.stringify(apiParams)], function (auth) {
|
|
5011
5121
|
return getAirmetList(auth, apiParams);
|
|
5012
|
-
}, disabled);
|
|
5122
|
+
}, disabled, 1000 * 60);
|
|
5013
5123
|
};
|
|
5014
5124
|
var useSigmetList = function useSigmetList(disabled, timeFilter) {
|
|
5015
5125
|
if (disabled === void 0) {
|
|
@@ -5018,7 +5128,7 @@ var useSigmetList = function useSigmetList(disabled, timeFilter) {
|
|
|
5018
5128
|
var apiParams = timeFilter ? getApiParams(timeFilter) : {};
|
|
5019
5129
|
return useAuthQuery(['sigmet-list', JSON.stringify(apiParams)], function (auth) {
|
|
5020
5130
|
return getSigmetList(auth, apiParams);
|
|
5021
|
-
}, disabled);
|
|
5131
|
+
}, disabled, 1000 * 60);
|
|
5022
5132
|
};
|
|
5023
5133
|
var useAviationWarnings = function useAviationWarnings() {
|
|
5024
5134
|
var _useAirmetList = useAirmetList(),
|
|
@@ -6547,24 +6657,24 @@ var WarningListSelect = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
6547
6657
|
label = _ref.label,
|
|
6548
6658
|
_onChange = _ref.onChange,
|
|
6549
6659
|
renderOption = _ref.renderOption,
|
|
6550
|
-
|
|
6660
|
+
_renderValue = _ref.renderValue,
|
|
6551
6661
|
gridArea = _ref.gridArea,
|
|
6552
6662
|
additionalStyling = _ref.additionalStyling,
|
|
6553
6663
|
_ref$isReadOnly = _ref.isReadOnly,
|
|
6554
6664
|
isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
|
|
6555
|
-
|
|
6556
|
-
displayEmpty = _ref$displayEmpty === void 0 ? false : _ref$displayEmpty,
|
|
6665
|
+
emptyMessage = _ref.emptyMessage,
|
|
6557
6666
|
_ref$validationResult = _ref.validationResult,
|
|
6558
6667
|
validationResult = _ref$validationResult === void 0 ? true : _ref$validationResult;
|
|
6559
6668
|
var currentIndex = options.findIndex(function (option) {
|
|
6560
6669
|
return option.value === value;
|
|
6561
6670
|
});
|
|
6671
|
+
var hasEmptyMessage = emptyMessage !== undefined && emptyMessage.length > 0;
|
|
6562
6672
|
return jsx(FormControl, {
|
|
6563
6673
|
style: {
|
|
6564
6674
|
width: '100%',
|
|
6565
6675
|
gridArea: gridArea
|
|
6566
6676
|
},
|
|
6567
|
-
children: jsxs(TooltipSelect, {
|
|
6677
|
+
children: jsxs(TooltipSelect, Object.assign({
|
|
6568
6678
|
disableUnderline: true,
|
|
6569
6679
|
tooltip: "",
|
|
6570
6680
|
style: {
|
|
@@ -6573,7 +6683,7 @@ var WarningListSelect = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
6573
6683
|
isEnabled: !isReadOnly,
|
|
6574
6684
|
disabled: isReadOnly,
|
|
6575
6685
|
value: value != null ? value : '',
|
|
6576
|
-
displayEmpty:
|
|
6686
|
+
displayEmpty: hasEmptyMessage,
|
|
6577
6687
|
SelectDisplayProps: {
|
|
6578
6688
|
'aria-label': label
|
|
6579
6689
|
},
|
|
@@ -6592,7 +6702,28 @@ var WarningListSelect = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
6592
6702
|
backgroundColor: "geowebColors.functional." + validationResult + "Outline.fill"
|
|
6593
6703
|
}, additionalStyling),
|
|
6594
6704
|
currentIndex: currentIndex > -1 ? currentIndex : undefined,
|
|
6595
|
-
renderValue:
|
|
6705
|
+
renderValue: _renderValue
|
|
6706
|
+
}, hasEmptyMessage && {
|
|
6707
|
+
renderValue: function renderValue(value) {
|
|
6708
|
+
if (value === '' && hasEmptyMessage) {
|
|
6709
|
+
return jsx(Typography, {
|
|
6710
|
+
variant: "caption",
|
|
6711
|
+
color: "textSecondary",
|
|
6712
|
+
sx: {
|
|
6713
|
+
alignSelf: 'center'
|
|
6714
|
+
},
|
|
6715
|
+
children: emptyMessage
|
|
6716
|
+
});
|
|
6717
|
+
}
|
|
6718
|
+
if (_renderValue) {
|
|
6719
|
+
return _renderValue(value);
|
|
6720
|
+
}
|
|
6721
|
+
var option = options.find(function (item) {
|
|
6722
|
+
return item.value === value;
|
|
6723
|
+
});
|
|
6724
|
+
return typeof (option == null ? void 0 : option.label) === 'function' ? option.label(t) : option == null ? void 0 : option.label;
|
|
6725
|
+
}
|
|
6726
|
+
}, {
|
|
6596
6727
|
onChange: function onChange(event) {
|
|
6597
6728
|
_onChange(event.target.value);
|
|
6598
6729
|
},
|
|
@@ -6618,7 +6749,7 @@ var WarningListSelect = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
6618
6749
|
children: typeof option.label === 'function' ? option.label(t) : option.label
|
|
6619
6750
|
}, option.value);
|
|
6620
6751
|
})]
|
|
6621
|
-
})
|
|
6752
|
+
}))
|
|
6622
6753
|
});
|
|
6623
6754
|
});
|
|
6624
6755
|
|
|
@@ -6727,7 +6858,8 @@ var WindForceSelect = function WindForceSelect(_ref) {
|
|
|
6727
6858
|
'& .MuiSelect-standard': {
|
|
6728
6859
|
paddingBlock: 0
|
|
6729
6860
|
}
|
|
6730
|
-
}
|
|
6861
|
+
},
|
|
6862
|
+
emptyMessage: "(" + t('maritime-header-windforce') + ")"
|
|
6731
6863
|
});
|
|
6732
6864
|
};
|
|
6733
6865
|
|
|
@@ -6781,9 +6913,12 @@ var isWarningValid = function isWarningValid(item, config) {
|
|
|
6781
6913
|
}
|
|
6782
6914
|
return true;
|
|
6783
6915
|
};
|
|
6784
|
-
var isWarningsValid = function isWarningsValid(warnings, config) {
|
|
6916
|
+
var isWarningsValid = function isWarningsValid(warnings, config, allowEmpty) {
|
|
6917
|
+
if (allowEmpty === void 0) {
|
|
6918
|
+
allowEmpty = true;
|
|
6919
|
+
}
|
|
6785
6920
|
// One single empty row is allowed, if not empty it should be valid
|
|
6786
|
-
if (warnings.length === 1) {
|
|
6921
|
+
if (allowEmpty && warnings.length === 1) {
|
|
6787
6922
|
return isWarningEmpty(warnings[0]) || isWarningValid(warnings[0], config);
|
|
6788
6923
|
}
|
|
6789
6924
|
return warnings.every(function (warning) {
|
|
@@ -6807,8 +6942,12 @@ var getType = function getType(domain) {
|
|
|
6807
6942
|
return 'maritimeWarningNorthSea';
|
|
6808
6943
|
}
|
|
6809
6944
|
};
|
|
6810
|
-
var mapItemsToMaritimeWarnings = function mapItemsToMaritimeWarnings(warnings, domain, maritimeConfig, editor) {
|
|
6945
|
+
var mapItemsToMaritimeWarnings = function mapItemsToMaritimeWarnings(warnings, domain, maritimeConfig, editor, shouldExtend) {
|
|
6946
|
+
if (shouldExtend === void 0) {
|
|
6947
|
+
shouldExtend = false;
|
|
6948
|
+
}
|
|
6811
6949
|
var type = getType(domain);
|
|
6950
|
+
var now = Date.now();
|
|
6812
6951
|
if (warnings.length === 1 && warnings[0].assignedAreaIds.length === 0) {
|
|
6813
6952
|
// 1 warning without any areas means cancel/withdraw all warnings
|
|
6814
6953
|
return [{
|
|
@@ -6828,8 +6967,9 @@ var mapItemsToMaritimeWarnings = function mapItemsToMaritimeWarnings(warnings, d
|
|
|
6828
6967
|
status: PublicWarningStatus.PUBLISHED,
|
|
6829
6968
|
warningDetail: {
|
|
6830
6969
|
phenomenon: 'wind',
|
|
6831
|
-
validFrom:
|
|
6832
|
-
|
|
6970
|
+
validFrom: shouldExtend && warning.validFrom ? warning.validFrom // keep original validFrom when extending
|
|
6971
|
+
: new Date(now).toISOString(),
|
|
6972
|
+
validUntil: new Date(now + 24 * 60 * 60 * 1000).toISOString(),
|
|
6833
6973
|
level: getLevelFromWindForce(maritimeConfig, warning.windForce || ''),
|
|
6834
6974
|
probability: 100,
|
|
6835
6975
|
areas: warning.assignedAreaIds.map(function (areaId) {
|
|
@@ -7004,7 +7144,8 @@ var WarningListItem$1 = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
7004
7144
|
options: getWindDirectionsFromConfig(maritimeConfig.windDirectionDefinition, t),
|
|
7005
7145
|
onChange: handleChangeFromDirection,
|
|
7006
7146
|
value: warning.windDirectionFrom,
|
|
7007
|
-
isReadOnly: isReadOnly
|
|
7147
|
+
isReadOnly: isReadOnly,
|
|
7148
|
+
emptyMessage: "(" + t('maritime-header-direction') + ")"
|
|
7008
7149
|
}), jsx(WindForceSelect, {
|
|
7009
7150
|
gridArea: "windForce",
|
|
7010
7151
|
value: warning.windForce,
|
|
@@ -7027,32 +7168,18 @@ var WarningListItem$1 = /*#__PURE__*/React__default.memo(function (_ref) {
|
|
|
7027
7168
|
onChange: handleChangeWindChangeType,
|
|
7028
7169
|
value: warning.changeType,
|
|
7029
7170
|
isReadOnly: isReadOnly,
|
|
7030
|
-
|
|
7031
|
-
if (value === '') {
|
|
7032
|
-
return jsx(Typography, {
|
|
7033
|
-
variant: "caption",
|
|
7034
|
-
color: "textSecondary",
|
|
7035
|
-
sx: {
|
|
7036
|
-
alignSelf: 'center'
|
|
7037
|
-
},
|
|
7038
|
-
children: t('maritime-no-change-selected')
|
|
7039
|
-
});
|
|
7040
|
-
}
|
|
7041
|
-
var option = changeOptions.find(function (item) {
|
|
7042
|
-
return item.value === value;
|
|
7043
|
-
});
|
|
7044
|
-
return typeof (option == null ? void 0 : option.label) === 'function' ? option.label(t) : option == null ? void 0 : option.label;
|
|
7045
|
-
},
|
|
7046
|
-
displayEmpty: true,
|
|
7171
|
+
emptyMessage: t('maritime-no-change-selected'),
|
|
7047
7172
|
validationResult: validationResult
|
|
7048
|
-
}), jsx(WarningListSelect, {
|
|
7173
|
+
}), jsx(WarningListSelect, Object.assign({
|
|
7049
7174
|
gridArea: "dirTo",
|
|
7050
7175
|
label: t('maritime-header-direction-to'),
|
|
7051
7176
|
options: getWindDirectionsFromConfig(maritimeConfig.windDirectionDefinition, t),
|
|
7052
7177
|
onChange: handleChangeToDirection,
|
|
7053
7178
|
value: warning.windDirectionTo,
|
|
7054
7179
|
isReadOnly: shouldDisableDirTo
|
|
7055
|
-
}
|
|
7180
|
+
}, warning.changeType !== 'NO_CHANGE' && {
|
|
7181
|
+
emptyMessage: "(" + t('maritime-header-direction') + ")"
|
|
7182
|
+
})), showInfoIcon ? jsx(Box, {
|
|
7056
7183
|
sx: {
|
|
7057
7184
|
gridArea: 'info',
|
|
7058
7185
|
justifySelf: 'left',
|
|
@@ -7506,7 +7633,7 @@ var getWarningsValidity = function getWarningsValidity(t, warnings) {
|
|
|
7506
7633
|
return validUntil ? "" + t('maritime-warning-validuntil') + validUntil : '';
|
|
7507
7634
|
};
|
|
7508
7635
|
var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
7509
|
-
var _sx, _sx2, _sx3, _sx4;
|
|
7636
|
+
var _sx, _sx2, _sx3, _sx4, _sx5;
|
|
7510
7637
|
var areas = _ref.areas,
|
|
7511
7638
|
selectedAreaIds = _ref.selectedAreaIds,
|
|
7512
7639
|
modified = _ref.modified,
|
|
@@ -7534,6 +7661,9 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
|
7534
7661
|
var _React$useState = React__default.useState(false),
|
|
7535
7662
|
isPublishing = _React$useState[0],
|
|
7536
7663
|
setIsPublishing = _React$useState[1];
|
|
7664
|
+
var _React$useState2 = React__default.useState(false),
|
|
7665
|
+
isExtending = _React$useState2[0],
|
|
7666
|
+
setIsExtending = _React$useState2[1];
|
|
7537
7667
|
var _useWarningsTranslati = useWarningsTranslation(),
|
|
7538
7668
|
t = _useWarningsTranslati.t;
|
|
7539
7669
|
var showConfirmDialog = useConfirmationDialog();
|
|
@@ -7566,7 +7696,8 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
|
7566
7696
|
}
|
|
7567
7697
|
}, _callee);
|
|
7568
7698
|
})), [onClear, t, showConfirmDialog]);
|
|
7569
|
-
var
|
|
7699
|
+
var isValidForPublish = isWarningsValid(warnings, maritimeConfig);
|
|
7700
|
+
var isValidForExtend = isWarningsValid(warnings, maritimeConfig, false);
|
|
7570
7701
|
var onSwitchMode = /*#__PURE__*/function () {
|
|
7571
7702
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(event) {
|
|
7572
7703
|
var checked, isReadOnly;
|
|
@@ -7632,6 +7763,39 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
|
7632
7763
|
return _ref4.apply(this, arguments);
|
|
7633
7764
|
};
|
|
7634
7765
|
}();
|
|
7766
|
+
var onPressExtend = /*#__PURE__*/function () {
|
|
7767
|
+
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
7768
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
7769
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
7770
|
+
case 0:
|
|
7771
|
+
if (isExtending) {
|
|
7772
|
+
_context4.next = 12;
|
|
7773
|
+
break;
|
|
7774
|
+
}
|
|
7775
|
+
setIsExtending(true);
|
|
7776
|
+
_context4.prev = 2;
|
|
7777
|
+
_context4.next = 5;
|
|
7778
|
+
return onSubmit(true);
|
|
7779
|
+
case 5:
|
|
7780
|
+
_context4.next = 9;
|
|
7781
|
+
break;
|
|
7782
|
+
case 7:
|
|
7783
|
+
_context4.prev = 7;
|
|
7784
|
+
_context4.t0 = _context4["catch"](2);
|
|
7785
|
+
case 9:
|
|
7786
|
+
_context4.prev = 9;
|
|
7787
|
+
setIsExtending(false);
|
|
7788
|
+
return _context4.finish(9);
|
|
7789
|
+
case 12:
|
|
7790
|
+
case "end":
|
|
7791
|
+
return _context4.stop();
|
|
7792
|
+
}
|
|
7793
|
+
}, _callee4, null, [[2, 7, 9, 12]]);
|
|
7794
|
+
}));
|
|
7795
|
+
return function onPressExtend() {
|
|
7796
|
+
return _ref5.apply(this, arguments);
|
|
7797
|
+
};
|
|
7798
|
+
}();
|
|
7635
7799
|
return jsxs(Box, {
|
|
7636
7800
|
sx: (_sx = {
|
|
7637
7801
|
display: 'flex',
|
|
@@ -7738,7 +7902,10 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
|
7738
7902
|
}), !isReadOnly && jsxs(Stack, {
|
|
7739
7903
|
spacing: 2,
|
|
7740
7904
|
direction: "row",
|
|
7741
|
-
|
|
7905
|
+
useFlexGap: true,
|
|
7906
|
+
sx: (_sx3 = {
|
|
7907
|
+
flexWrap: 'wrap'
|
|
7908
|
+
}, _sx3["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
7742
7909
|
position: 'absolute',
|
|
7743
7910
|
bottom: 0,
|
|
7744
7911
|
right: 0,
|
|
@@ -7750,22 +7917,42 @@ var MaritimeWarningsForm = function MaritimeWarningsForm(_ref) {
|
|
|
7750
7917
|
}
|
|
7751
7918
|
}, _sx3),
|
|
7752
7919
|
children: [jsx(Button, {
|
|
7753
|
-
|
|
7754
|
-
variant: "tertiary",
|
|
7920
|
+
variant: "primary",
|
|
7755
7921
|
size: "small",
|
|
7756
7922
|
sx: {
|
|
7757
7923
|
width: '134px'
|
|
7758
7924
|
},
|
|
7759
|
-
|
|
7925
|
+
disabled: modified || !isValidForExtend || isExtending || isPublishing,
|
|
7926
|
+
onClick: onPressExtend,
|
|
7927
|
+
children: jsxs("span", {
|
|
7928
|
+
style: {
|
|
7929
|
+
position: 'relative'
|
|
7930
|
+
},
|
|
7931
|
+
children: [isExtending ? t('maritime-button-extending') : t('maritime-button-extend'), isExtending && jsx(CircularProgress, {
|
|
7932
|
+
"data-testid": "spinner",
|
|
7933
|
+
color: "inherit",
|
|
7934
|
+
sx: spinnerSx$1
|
|
7935
|
+
})]
|
|
7936
|
+
})
|
|
7760
7937
|
}), jsx(Button, {
|
|
7761
|
-
|
|
7938
|
+
onClick: onClearWithConfirmation,
|
|
7939
|
+
variant: "tertiary",
|
|
7762
7940
|
size: "small",
|
|
7763
7941
|
sx: (_sx4 = {
|
|
7764
7942
|
width: '134px'
|
|
7765
7943
|
}, _sx4["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
7766
|
-
marginLeft: '
|
|
7944
|
+
marginLeft: '8px'
|
|
7767
7945
|
}, _sx4),
|
|
7768
|
-
|
|
7946
|
+
children: t('warning-button-clear')
|
|
7947
|
+
}), jsx(Button, {
|
|
7948
|
+
variant: "primary",
|
|
7949
|
+
size: "small",
|
|
7950
|
+
sx: (_sx5 = {
|
|
7951
|
+
width: '134px'
|
|
7952
|
+
}, _sx5["@container maritime (min-width: " + breakpoints.tablet + "px)"] = {
|
|
7953
|
+
marginLeft: '8px'
|
|
7954
|
+
}, _sx5),
|
|
7955
|
+
disabled: !modified || !isValidForPublish || isPublishing || isExtending,
|
|
7769
7956
|
onClick: onPressPublish,
|
|
7770
7957
|
children: jsxs("span", {
|
|
7771
7958
|
style: {
|
|
@@ -7929,32 +8116,40 @@ var MaritimeWarningsFormConnect = function MaritimeWarningsFormConnect(_ref) {
|
|
|
7929
8116
|
newIndex: newIndex
|
|
7930
8117
|
});
|
|
7931
8118
|
}, [dispatch]);
|
|
7932
|
-
var onSubmit = React__default.useCallback(/*#__PURE__*/
|
|
7933
|
-
var
|
|
7934
|
-
|
|
7935
|
-
|
|
7936
|
-
|
|
7937
|
-
|
|
7938
|
-
|
|
7939
|
-
|
|
7940
|
-
nextState = reducer(state, {
|
|
7941
|
-
type: 'mergeWarnings'
|
|
7942
|
-
});
|
|
7943
|
-
maritimeWarnings = mapItemsToMaritimeWarnings(nextState.warnings, domain, maritimeConfig, auth == null ? void 0 : auth.username);
|
|
7944
|
-
_context.next = 5;
|
|
7945
|
-
return postWarnings(maritimeWarnings, {
|
|
7946
|
-
onSuccess: function onSuccess() {
|
|
7947
|
-
dispatch({
|
|
7948
|
-
type: 'submitWarnings'
|
|
7949
|
-
});
|
|
8119
|
+
var onSubmit = React__default.useCallback(/*#__PURE__*/function () {
|
|
8120
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(shouldExtend) {
|
|
8121
|
+
var nextState, maritimeWarnings;
|
|
8122
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8123
|
+
while (1) switch (_context.prev = _context.next) {
|
|
8124
|
+
case 0:
|
|
8125
|
+
if (shouldExtend === void 0) {
|
|
8126
|
+
shouldExtend = false;
|
|
7950
8127
|
}
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
8128
|
+
dispatch({
|
|
8129
|
+
type: 'mergeWarnings'
|
|
8130
|
+
});
|
|
8131
|
+
nextState = reducer(state, {
|
|
8132
|
+
type: 'mergeWarnings'
|
|
8133
|
+
});
|
|
8134
|
+
maritimeWarnings = mapItemsToMaritimeWarnings(nextState.warnings, domain, maritimeConfig, auth == null ? void 0 : auth.username, shouldExtend);
|
|
8135
|
+
_context.next = 6;
|
|
8136
|
+
return postWarnings(maritimeWarnings, {
|
|
8137
|
+
onSuccess: function onSuccess() {
|
|
8138
|
+
dispatch({
|
|
8139
|
+
type: 'submitWarnings'
|
|
8140
|
+
});
|
|
8141
|
+
}
|
|
8142
|
+
});
|
|
8143
|
+
case 6:
|
|
8144
|
+
case "end":
|
|
8145
|
+
return _context.stop();
|
|
8146
|
+
}
|
|
8147
|
+
}, _callee);
|
|
8148
|
+
}));
|
|
8149
|
+
return function (_x) {
|
|
8150
|
+
return _ref2.apply(this, arguments);
|
|
8151
|
+
};
|
|
8152
|
+
}(), [dispatch, state, domain, maritimeConfig, auth == null ? void 0 : auth.username, postWarnings]);
|
|
7958
8153
|
var onToggleReadOnly = React__default.useCallback(function (isReadOnly) {
|
|
7959
8154
|
var message = isReadOnly ? t('maritime-editor-off', {
|
|
7960
8155
|
domain: domainLabel
|
|
@@ -8259,18 +8454,18 @@ isAviationWarning) {
|
|
|
8259
8454
|
var _feature$properties$i, _feature$properties;
|
|
8260
8455
|
var isStartGeometry = (_feature$properties$i = (_feature$properties = feature.properties) == null ? void 0 : _feature$properties.isStartGeometry) != null ? _feature$properties$i : false;
|
|
8261
8456
|
colors = {
|
|
8262
|
-
color: isStartGeometry ?
|
|
8457
|
+
color: isStartGeometry ? FEATURE_DRAW_FILL_COLOR : FEATURE_DRAW_SECONDARY_FILL_COLOR,
|
|
8263
8458
|
// Orange for start, purple for end
|
|
8264
|
-
borderColor: isStartGeometry ?
|
|
8459
|
+
borderColor: isStartGeometry ? FEATURE_DRAW_FILL_COLOR : FEATURE_DRAW_SECONDARY_FILL_COLOR
|
|
8265
8460
|
};
|
|
8266
|
-
} else if (level) {
|
|
8461
|
+
} else if (level && level in LevelColors) {
|
|
8267
8462
|
// Public warning: use LevelColors if level is defined
|
|
8268
8463
|
colors = LevelColors[level];
|
|
8269
8464
|
} else {
|
|
8270
|
-
//
|
|
8465
|
+
// Public warning: default to blue if level is undefined=
|
|
8271
8466
|
colors = {
|
|
8272
|
-
color:
|
|
8273
|
-
borderColor:
|
|
8467
|
+
color: FEATURE_DRAW_FILL_COLOR,
|
|
8468
|
+
borderColor: FEATURE_DRAW_STROKE_COLOR
|
|
8274
8469
|
};
|
|
8275
8470
|
}
|
|
8276
8471
|
var defaultProperties = {
|
|
@@ -8355,7 +8550,9 @@ var Form = function Form(_ref5) {
|
|
|
8355
8550
|
_ref5$onSetViewModeRe = _ref5.onSetViewModeResetArea,
|
|
8356
8551
|
onSetViewModeResetArea = _ref5$onSetViewModeRe === void 0 ? function () {} : _ref5$onSetViewModeRe,
|
|
8357
8552
|
storedStartGeoJSON = _ref5.storedStartGeoJSON,
|
|
8358
|
-
storedEndGeoJSON = _ref5.storedEndGeoJSON
|
|
8553
|
+
storedEndGeoJSON = _ref5.storedEndGeoJSON,
|
|
8554
|
+
_ref5$setWarningLevel = _ref5.setWarningLevel,
|
|
8555
|
+
setWarningLevel = _ref5$setWarningLevel === void 0 ? function () {} : _ref5$setWarningLevel;
|
|
8359
8556
|
var _React$useState = React.useState(false),
|
|
8360
8557
|
isPublishing = _React$useState[0],
|
|
8361
8558
|
setIsPublishing = _React$useState[1];
|
|
@@ -8389,7 +8586,7 @@ var Form = function Form(_ref5) {
|
|
|
8389
8586
|
return clearTimeout(timer);
|
|
8390
8587
|
};
|
|
8391
8588
|
}, [endOfWarningValidity, formState, onCloseForm]);
|
|
8392
|
-
var initialPublicWarningArea =
|
|
8589
|
+
var initialPublicWarningArea = publicWarningDetails != null && (_publicWarningDetails = publicWarningDetails.areas) != null && _publicWarningDetails.length ? publicWarningDetails == null || (_publicWarningDetails2 = publicWarningDetails.areas[0]) == null ? void 0 : _publicWarningDetails2.geoJSON : undefined;
|
|
8393
8590
|
var _React$useState3 = React.useState(initialPublicWarningArea),
|
|
8394
8591
|
warningGeoJSONFeature = _React$useState3[0],
|
|
8395
8592
|
setWarningGeoJSONFeature = _React$useState3[1];
|
|
@@ -8645,6 +8842,7 @@ var Form = function Form(_ref5) {
|
|
|
8645
8842
|
default:
|
|
8646
8843
|
reset(getEmptyPublicWarning());
|
|
8647
8844
|
setWarningGeoJSONFeature(undefined);
|
|
8845
|
+
setWarningLevel('');
|
|
8648
8846
|
break;
|
|
8649
8847
|
}
|
|
8650
8848
|
onClearForm();
|
|
@@ -8691,14 +8889,20 @@ var Form = function Form(_ref5) {
|
|
|
8691
8889
|
}
|
|
8692
8890
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8693
8891
|
}, [areas, setValue]);
|
|
8892
|
+
var level = watch('level');
|
|
8694
8893
|
React.useEffect(function () {
|
|
8695
8894
|
if (selectedAviationProduct) {
|
|
8696
8895
|
return;
|
|
8697
8896
|
}
|
|
8698
|
-
// sync drawing on map with selected warning
|
|
8699
|
-
|
|
8897
|
+
// sync drawing on map with selected warning including selected level color
|
|
8898
|
+
var geoJSONFeature = warningLevelFeatureColors(level, initialPublicWarningArea);
|
|
8899
|
+
setWarningGeoJSONFeature(geoJSONFeature);
|
|
8700
8900
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8701
|
-
}, [initialPublicWarningArea]);
|
|
8901
|
+
}, [initialPublicWarningArea, level]);
|
|
8902
|
+
React.useEffect(function () {
|
|
8903
|
+
// update level in redux so linked map updates feature color accordingly
|
|
8904
|
+
setWarningLevel(level || '');
|
|
8905
|
+
}, [level, setWarningLevel]);
|
|
8702
8906
|
var aviationId = selectedAviationProduct == null ? void 0 : selectedAviationProduct.uuid;
|
|
8703
8907
|
var publishedStart = publicWarningDetails == null ? void 0 : publicWarningDetails.validFrom;
|
|
8704
8908
|
var nowIso = dateUtils.getCurrentTimeAsString();
|
|
@@ -8712,8 +8916,6 @@ var Form = function Form(_ref5) {
|
|
|
8712
8916
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8713
8917
|
}, [aviationId, warningType]);
|
|
8714
8918
|
var errors = getErrors(error.message);
|
|
8715
|
-
var level = publicWarningDetails != null && publicWarningDetails.level ? WarningLevel[publicWarningDetails.level] : undefined;
|
|
8716
|
-
var geoJSONFeature = warningLevelFeatureColors(level, warningGeoJSONFeature);
|
|
8717
8919
|
var ref = useScrollTopOnError(error);
|
|
8718
8920
|
var _useProductConfig = useProductConfig(warningType),
|
|
8719
8921
|
aviationConfig = _useProductConfig.data;
|
|
@@ -8816,7 +9018,7 @@ var Form = function Form(_ref5) {
|
|
|
8816
9018
|
xs: 12
|
|
8817
9019
|
},
|
|
8818
9020
|
children: jsx(WarningsMapView, {
|
|
8819
|
-
geojsonFeature:
|
|
9021
|
+
geojsonFeature: warningGeoJSONFeature,
|
|
8820
9022
|
defaultMapPreset: defaultMapPreset,
|
|
8821
9023
|
isSnapshot: isSnapshot
|
|
8822
9024
|
})
|
|
@@ -9296,6 +9498,9 @@ var PublicWarningsFormConnect = function PublicWarningsFormConnect(_ref) {
|
|
|
9296
9498
|
area: area[0]
|
|
9297
9499
|
}));
|
|
9298
9500
|
};
|
|
9501
|
+
var setWarningLevel = function setWarningLevel(level) {
|
|
9502
|
+
dispatch(publicWarningFormActions.setWarningLevel(level));
|
|
9503
|
+
};
|
|
9299
9504
|
var selectedMapIds = useSelector(function (state) {
|
|
9300
9505
|
return genericSelectors.getLinkedMaps(state, panelId);
|
|
9301
9506
|
});
|
|
@@ -9328,7 +9533,8 @@ var PublicWarningsFormConnect = function PublicWarningsFormConnect(_ref) {
|
|
|
9328
9533
|
formState: formState,
|
|
9329
9534
|
onSetViewModeResetArea: onSetViewModeResetArea,
|
|
9330
9535
|
storedStartGeoJSON: storedStartGeoJSON,
|
|
9331
|
-
storedEndGeoJSON: storedEndGeoJSON
|
|
9536
|
+
storedEndGeoJSON: storedEndGeoJSON,
|
|
9537
|
+
setWarningLevel: setWarningLevel
|
|
9332
9538
|
}, (warning == null ? void 0 : warning.id) || (selectedAviationProduct == null ? void 0 : selectedAviationProduct.uuid) || 'new');
|
|
9333
9539
|
};
|
|
9334
9540
|
|
|
@@ -9788,14 +9994,14 @@ var getFilterParams = function getFilterParams(areas, searchQuery) {
|
|
|
9788
9994
|
search: searchQuery
|
|
9789
9995
|
});
|
|
9790
9996
|
};
|
|
9791
|
-
var useAreaRequest = function useAreaRequest() {
|
|
9997
|
+
var useAreaRequest = function useAreaRequest(isDialogOpen) {
|
|
9792
9998
|
var _useState = useState([]),
|
|
9793
9999
|
areas = _useState[0],
|
|
9794
10000
|
setAreas = _useState[1];
|
|
9795
10001
|
var _useState2 = useState(undefined),
|
|
9796
10002
|
fetchAreaError = _useState2[0],
|
|
9797
10003
|
setFetchAreaError = _useState2[1];
|
|
9798
|
-
var _useAreaKeywords = useAreaKeywords(),
|
|
10004
|
+
var _useAreaKeywords = useAreaKeywords(isDialogOpen),
|
|
9799
10005
|
areaKeywords = _useAreaKeywords.data,
|
|
9800
10006
|
isAreasLoading = _useAreaKeywords.isLoading,
|
|
9801
10007
|
error = _useAreaKeywords.error,
|
|
@@ -9854,7 +10060,7 @@ var AreaObjectLoaderConnect = function AreaObjectLoaderConnect(_ref) {
|
|
|
9854
10060
|
var _useState5 = useState(''),
|
|
9855
10061
|
searchQuery = _useState5[0],
|
|
9856
10062
|
setSearchQuery = _useState5[1];
|
|
9857
|
-
var _useAreaRequest = useAreaRequest(),
|
|
10063
|
+
var _useAreaRequest = useAreaRequest(isDialogOpen),
|
|
9858
10064
|
areas = _useAreaRequest.areas,
|
|
9859
10065
|
fetchAreaKeywords = _useAreaRequest.fetchAreaKeywords,
|
|
9860
10066
|
fetchAreaError = _useAreaRequest.fetchAreaError,
|
|
@@ -9875,7 +10081,7 @@ var AreaObjectLoaderConnect = function AreaObjectLoaderConnect(_ref) {
|
|
|
9875
10081
|
var isAviationWarning = (selectedWarning == null ? void 0 : selectedWarning.warningDetail.level) === 'SIG' || (selectedWarning == null ? void 0 : selectedWarning.warningDetail.level) === 'AIR';
|
|
9876
10082
|
var styledGeoJSON = warningLevelFeatureColors(selectedWarning == null || (_selectedWarning$warn = selectedWarning.warningDetail) == null ? void 0 : _selectedWarning$warn.level, selectedWarning == null || (_selectedWarning$warn2 = selectedWarning.warningDetail) == null || (_selectedWarning$warn2 = _selectedWarning$warn2.areas) == null || (_selectedWarning$warn2 = _selectedWarning$warn2[0]) == null ? void 0 : _selectedWarning$warn2.geoJSON, isAviationWarning);
|
|
9877
10083
|
// Inject warning level into feature properties to be read in OlMapViewConnect
|
|
9878
|
-
if (styledGeoJSON && (_styledGeoJSON$featur = styledGeoJSON.features) != null && _styledGeoJSON$featur.length) {
|
|
10084
|
+
if (styledGeoJSON != null && (_styledGeoJSON$featur = styledGeoJSON.features) != null && _styledGeoJSON$featur.length) {
|
|
9879
10085
|
styledGeoJSON.features.forEach(function (feature) {
|
|
9880
10086
|
// eslint-disable-next-line no-param-reassign
|
|
9881
10087
|
feature.properties = Object.assign({}, feature.properties, {
|
|
@@ -9885,10 +10091,10 @@ var AreaObjectLoaderConnect = function AreaObjectLoaderConnect(_ref) {
|
|
|
9885
10091
|
});
|
|
9886
10092
|
}
|
|
9887
10093
|
var sharedData = React__default.useMemo(function () {
|
|
9888
|
-
var _selectedWarning$warn3;
|
|
10094
|
+
var _selectedWarning$warn3, _selectedWarning$warn4;
|
|
9889
10095
|
return {
|
|
9890
10096
|
features: [{
|
|
9891
|
-
id: (selectedWarning == null || (_selectedWarning$
|
|
10097
|
+
id: (_selectedWarning$warn3 = selectedWarning == null || (_selectedWarning$warn4 = selectedWarning.warningDetail.areas) == null || (_selectedWarning$warn4 = _selectedWarning$warn4[0]) == null ? void 0 : _selectedWarning$warn4.areaId) != null ? _selectedWarning$warn3 : '',
|
|
9892
10098
|
geoJSON: styledGeoJSON
|
|
9893
10099
|
}]
|
|
9894
10100
|
};
|
|
@@ -9995,8 +10201,8 @@ var AreaObjectLoaderConnect = function AreaObjectLoaderConnect(_ref) {
|
|
|
9995
10201
|
left: 50
|
|
9996
10202
|
},
|
|
9997
10203
|
drawingListItems: items,
|
|
9998
|
-
error: drawingError
|
|
9999
|
-
isLoading: loading
|
|
10204
|
+
error: drawingError != null ? drawingError : fetchAreaError,
|
|
10205
|
+
isLoading: loading != null ? loading : isAreasLoading,
|
|
10000
10206
|
onClickFilterChip: onClickFilterChip,
|
|
10001
10207
|
searchQuery: searchQuery,
|
|
10002
10208
|
onSearch: onSearch,
|
|
@@ -10028,7 +10234,7 @@ var AreaObjectLoaderConnect = function AreaObjectLoaderConnect(_ref) {
|
|
|
10028
10234
|
* Copyright 2025 - The Norwegian Meteorological Institute (MET Norway)
|
|
10029
10235
|
* */
|
|
10030
10236
|
var useWarnings = function useWarnings(disabled, timeFilter) {
|
|
10031
|
-
var _usePublicWarnings = usePublicWarnings(disabled),
|
|
10237
|
+
var _usePublicWarnings = usePublicWarnings(disabled, timeFilter),
|
|
10032
10238
|
publicWarnings = _usePublicWarnings.data,
|
|
10033
10239
|
refetchPublicWarnings = _usePublicWarnings.refetch,
|
|
10034
10240
|
isFetchingPublicWarnings = _usePublicWarnings.isFetching,
|
|
@@ -10121,6 +10327,7 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
10121
10327
|
t = _useWarningsTranslati.t;
|
|
10122
10328
|
var dispatch = useDispatch();
|
|
10123
10329
|
var confirmDialog = useConfirmationDialog();
|
|
10330
|
+
var queryClient = useQueryClient();
|
|
10124
10331
|
var formAction = useSelector(function (store) {
|
|
10125
10332
|
return getPublicWarningFormState(store);
|
|
10126
10333
|
});
|
|
@@ -10233,6 +10440,19 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
10233
10440
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
10234
10441
|
while (1) switch (_context.prev = _context.next) {
|
|
10235
10442
|
case 0:
|
|
10443
|
+
queryClient.setQueriesData({
|
|
10444
|
+
queryKey: ['public-warning-list'],
|
|
10445
|
+
exact: false
|
|
10446
|
+
}, function (old) {
|
|
10447
|
+
if (!old) {
|
|
10448
|
+
return old;
|
|
10449
|
+
}
|
|
10450
|
+
return old.map(function (warning) {
|
|
10451
|
+
return warning.id === selectedWarningId ? Object.assign({}, warning, {
|
|
10452
|
+
editor: isReadOnly ? undefined : auth == null ? void 0 : auth.username
|
|
10453
|
+
}) : warning;
|
|
10454
|
+
});
|
|
10455
|
+
});
|
|
10236
10456
|
dispatch(publicWarningFormActions.setFormValues({
|
|
10237
10457
|
formState: isReadOnly ? 'readonly' : ''
|
|
10238
10458
|
}));
|
|
@@ -10240,7 +10460,7 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
10240
10460
|
type: uiTypes.DialogTypes.AreaObjectLoader,
|
|
10241
10461
|
setOpen: false
|
|
10242
10462
|
}));
|
|
10243
|
-
case
|
|
10463
|
+
case 3:
|
|
10244
10464
|
case "end":
|
|
10245
10465
|
return _context.stop();
|
|
10246
10466
|
}
|
|
@@ -11746,7 +11966,9 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
11746
11966
|
onActionMaritimeWarning = _ref$onActionMaritime === void 0 ? function () {} : _ref$onActionMaritime,
|
|
11747
11967
|
hoveredFeatureId = _ref.hoveredFeatureId,
|
|
11748
11968
|
expandedSections = _ref.expandedSections,
|
|
11749
|
-
setExpandedSections = _ref.setExpandedSections
|
|
11969
|
+
setExpandedSections = _ref.setExpandedSections,
|
|
11970
|
+
limitAlertCount = _ref.limitAlertCount,
|
|
11971
|
+
showLimitAlert = _ref.showLimitAlert;
|
|
11750
11972
|
var updateFilter = filterHookState.updateFilter,
|
|
11751
11973
|
allSelected = filterHookState.allSelected,
|
|
11752
11974
|
filterState = filterHookState.filterState,
|
|
@@ -11885,7 +12107,19 @@ var PublicWarningList = function PublicWarningList(_ref) {
|
|
|
11885
12107
|
}), error ? jsx(AlertBanner, {
|
|
11886
12108
|
title: error.message,
|
|
11887
12109
|
shouldClose: true
|
|
11888
|
-
}) : null,
|
|
12110
|
+
}) : null, showLimitAlert && jsx(Box, {
|
|
12111
|
+
sx: {
|
|
12112
|
+
mb: 2
|
|
12113
|
+
},
|
|
12114
|
+
children: jsx(AlertBanner, {
|
|
12115
|
+
severity: "warning",
|
|
12116
|
+
title: t('warning-list-too-many-title'),
|
|
12117
|
+
dataTestId: "warning-list-over-limit",
|
|
12118
|
+
info: t('warning-list-too-many-info', {
|
|
12119
|
+
count: limitAlertCount
|
|
12120
|
+
})
|
|
12121
|
+
})
|
|
12122
|
+
}), !error && jsxs(Grid, {
|
|
11889
12123
|
container: true,
|
|
11890
12124
|
rowSpacing: 0,
|
|
11891
12125
|
columnSpacing: 0,
|
|
@@ -12589,8 +12823,9 @@ var CancelAviationConfirmDialog = function CancelAviationConfirmDialog(_ref) {
|
|
|
12589
12823
|
});
|
|
12590
12824
|
};
|
|
12591
12825
|
|
|
12826
|
+
var MAX_WARNINGS_DISPLAY = 200;
|
|
12592
12827
|
var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
12593
|
-
var
|
|
12828
|
+
var _displayedWarnings$fi;
|
|
12594
12829
|
var panelId = _ref.panelId,
|
|
12595
12830
|
presetFilterState = _ref.presetFilterState;
|
|
12596
12831
|
var updatePublicWarningEditor = useMutatePublicWarningEditor();
|
|
@@ -13092,6 +13327,12 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
13092
13327
|
var filteredWarnings = React__default.useMemo(function () {
|
|
13093
13328
|
return combinedWarnings.filter(filterHookState.byFilterState);
|
|
13094
13329
|
}, [combinedWarnings, filterHookState.byFilterState]);
|
|
13330
|
+
var isOverLimit = filteredWarnings.length > MAX_WARNINGS_DISPLAY;
|
|
13331
|
+
var hasCustomTimeFilter = savedFilterState.time.mode === TimeFilterMode.custom;
|
|
13332
|
+
var shouldShowAlertBanner = hasCustomTimeFilter && isOverLimit;
|
|
13333
|
+
var displayedWarnings = React__default.useMemo(function () {
|
|
13334
|
+
return shouldShowAlertBanner ? [] : filteredWarnings;
|
|
13335
|
+
}, [shouldShowAlertBanner, filteredWarnings]);
|
|
13095
13336
|
var _React$useState4 = React__default.useState({
|
|
13096
13337
|
TODO: false,
|
|
13097
13338
|
DRAFT: false,
|
|
@@ -13101,14 +13342,14 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
13101
13342
|
expandedSections = _React$useState4[0],
|
|
13102
13343
|
setExpandedSections = _React$useState4[1];
|
|
13103
13344
|
var filteredWarningsByExpandedSections = React__default.useMemo(function () {
|
|
13104
|
-
return
|
|
13345
|
+
return displayedWarnings.filter(function (warning) {
|
|
13105
13346
|
var _ref7;
|
|
13106
13347
|
return (_ref7 = warning.status && expandedSections[warning.status]) != null ? _ref7 : warning.productStatus && expandedSections[warning.productStatus];
|
|
13107
13348
|
});
|
|
13108
|
-
}, [
|
|
13109
|
-
var selectedAviationProductId = (
|
|
13349
|
+
}, [displayedWarnings, expandedSections]);
|
|
13350
|
+
var selectedAviationProductId = (_displayedWarnings$fi = displayedWarnings.find(function (warning) {
|
|
13110
13351
|
return (warning.warningDetail.level === 'SIG' || warning.warningDetail.level === 'AIR') && warning.id === selectedWarningId;
|
|
13111
|
-
})) == null ? void 0 :
|
|
13352
|
+
})) == null ? void 0 : _displayedWarnings$fi.id;
|
|
13112
13353
|
var allFeatures = React__default.useMemo(function () {
|
|
13113
13354
|
return filteredWarningsByExpandedSections.flatMap(function (warning) {
|
|
13114
13355
|
var _warning$warningDetai, _warning$warningDetai2;
|
|
@@ -13158,7 +13399,9 @@ var PublicWarningListConnect = function PublicWarningListConnect(_ref) {
|
|
|
13158
13399
|
onWithdrawWarning: withdrawWarning,
|
|
13159
13400
|
selectedWarningId: selectedWarningId,
|
|
13160
13401
|
setExpandedSections: setExpandedSections,
|
|
13161
|
-
warnings:
|
|
13402
|
+
warnings: displayedWarnings,
|
|
13403
|
+
limitAlertCount: filteredWarnings.length,
|
|
13404
|
+
showLimitAlert: shouldShowAlertBanner
|
|
13162
13405
|
}), confirmDialogOptions ? jsx(ConfirmDeleteWarningDialog, {
|
|
13163
13406
|
callback: confirmDialogOptions.callback,
|
|
13164
13407
|
confirmLabel: confirmDialogOptions.confirmLabel,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeoweb/warnings",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.4.0",
|
|
4
4
|
"description": "GeoWeb warinings library for the opengeoweb project",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -8,25 +8,25 @@
|
|
|
8
8
|
"url": "git@gitlab.com:opengeoweb/opengeoweb.git"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@opengeoweb/api": "14.
|
|
12
|
-
"@opengeoweb/shared": "14.
|
|
13
|
-
"@opengeoweb/store": "14.
|
|
14
|
-
"@opengeoweb/webmap-react": "14.
|
|
11
|
+
"@opengeoweb/api": "14.4.0",
|
|
12
|
+
"@opengeoweb/shared": "14.4.0",
|
|
13
|
+
"@opengeoweb/store": "14.4.0",
|
|
14
|
+
"@opengeoweb/webmap-react": "14.4.0",
|
|
15
15
|
"@tanstack/react-query": "^5.85.5",
|
|
16
16
|
"react-redux": "^9.2.0",
|
|
17
|
-
"@opengeoweb/theme": "14.
|
|
18
|
-
"@opengeoweb/form-fields": "14.
|
|
17
|
+
"@opengeoweb/theme": "14.4.0",
|
|
18
|
+
"@opengeoweb/form-fields": "14.4.0",
|
|
19
19
|
"react-hook-form": "^7.50.1",
|
|
20
20
|
"lodash": "^4.17.21",
|
|
21
21
|
"@reduxjs/toolkit": "^2.6.1",
|
|
22
|
-
"@opengeoweb/snackbar": "14.
|
|
22
|
+
"@opengeoweb/snackbar": "14.4.0",
|
|
23
23
|
"react-window": "^1.8.10",
|
|
24
24
|
"react-virtualized-auto-sizer": "^1.0.20",
|
|
25
25
|
"axios": "^1.7.7",
|
|
26
|
-
"@opengeoweb/core": "14.
|
|
27
|
-
"@opengeoweb/webmap": "14.
|
|
28
|
-
"@opengeoweb/authentication": "14.
|
|
29
|
-
"@opengeoweb/sigmet-airmet": "14.
|
|
26
|
+
"@opengeoweb/core": "14.4.0",
|
|
27
|
+
"@opengeoweb/webmap": "14.4.0",
|
|
28
|
+
"@opengeoweb/authentication": "14.4.0",
|
|
29
|
+
"@opengeoweb/sigmet-airmet": "14.4.0",
|
|
30
30
|
"react-i18next": "^15.1.1",
|
|
31
31
|
"i18next": "^25.0.1",
|
|
32
32
|
"@mui/material": "^7.0.1",
|
|
@@ -2,7 +2,7 @@ import { Credentials } from '@opengeoweb/authentication';
|
|
|
2
2
|
import { MaritimeWarning, MaritimeWarningsType, PublicWarning } from '../../store/publicWarningForm/types';
|
|
3
3
|
import { DrawingFromBE, DrawingFromFE, DrawingListItem, FetchDrawingParams } from '../../store/warningsDrawings/types';
|
|
4
4
|
import { MaritimeWarningsConfig } from '../../components/MaritimeWarningsForm/types';
|
|
5
|
-
export declare const getPublicWarningList: (auth: Credentials) => Promise<PublicWarning[]>;
|
|
5
|
+
export declare const getPublicWarningList: (auth: Credentials, apiParams?: Record<string, string>) => Promise<PublicWarning[]>;
|
|
6
6
|
export declare const updatePublicWarningEditor: (warningId: string, isEditor: boolean, auth: Credentials, force?: boolean) => Promise<Headers | null>;
|
|
7
7
|
export declare const updatePublicWarning: (warningId: string, auth: Credentials, data: PublicWarning) => Promise<Headers | null>;
|
|
8
8
|
export declare const postPublicWarning: (auth: Credentials, data: PublicWarning) => Promise<Headers | null>;
|
|
@@ -2,11 +2,12 @@ import { UseMutationResult, UseQueryResult } from '@tanstack/react-query';
|
|
|
2
2
|
import { MaritimeWarning, MaritimeWarningsType, PublicWarning } from '../../store/publicWarningForm/types';
|
|
3
3
|
import { DrawingFromBE, DrawingFromFE, DrawingListItem, FetchDrawingParams } from '../../store/warningsDrawings/types';
|
|
4
4
|
import { MaritimeWarningsConfig } from '../../components/MaritimeWarningsForm/types';
|
|
5
|
+
import { TimeFilter } from '../../components/FilterList/filter-utils';
|
|
5
6
|
/**
|
|
6
7
|
* @param disabled - Disables fetching, but still returns cached values.
|
|
7
8
|
* https://tanstack.com/query/v4/docs/framework/react/guides/disabling-queries
|
|
8
9
|
*/
|
|
9
|
-
export declare const usePublicWarnings: (disabled?: boolean) => UseQueryResult<(PublicWarning | MaritimeWarning)[]>;
|
|
10
|
+
export declare const usePublicWarnings: (disabled?: boolean, timeFilter?: TimeFilter) => UseQueryResult<(PublicWarning | MaritimeWarning)[]>;
|
|
10
11
|
type MutationReturnType<T> = UseMutationResult<Headers | null, Error, T, {
|
|
11
12
|
oldData: PublicWarning[] | undefined;
|
|
12
13
|
}>;
|
|
@@ -22,6 +22,7 @@ export interface DrawingToolFormContentsProps {
|
|
|
22
22
|
onChangeOpacity: (event: SelectChangeEvent<unknown>) => void;
|
|
23
23
|
onBlurName: (event: React.FocusEvent<HTMLInputElement>) => void;
|
|
24
24
|
onSubmit: () => void;
|
|
25
|
+
geoJSON?: GeoJSON.FeatureCollection;
|
|
25
26
|
}
|
|
26
27
|
export declare const DrawingToolFormContentsNoMemo: React.FC<DrawingToolFormContentsProps>;
|
|
27
28
|
export declare const DrawingToolFormContents: React.NamedExoticComponent<DrawingToolFormContentsProps>;
|
|
@@ -16,7 +16,7 @@ export interface MaritimeWarningsFormProps {
|
|
|
16
16
|
onAddWarning: () => void;
|
|
17
17
|
onChangeWarning: (id: string, newValues: Partial<MaritimeWarningItemAttributes>) => void;
|
|
18
18
|
onMoveWarning: (oldIndex: number, newIndex: number) => void;
|
|
19
|
-
onSubmit: () => Promise<void>;
|
|
19
|
+
onSubmit: (shouldExtend?: boolean) => Promise<void>;
|
|
20
20
|
onClear: () => void;
|
|
21
21
|
onToggleReadOnly: (isReadOnly: boolean) => void;
|
|
22
22
|
isReadOnly: boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -15,7 +15,7 @@ export interface WarningListSelectProps {
|
|
|
15
15
|
gridArea: string;
|
|
16
16
|
additionalStyling?: SxProps;
|
|
17
17
|
isReadOnly?: boolean;
|
|
18
|
-
|
|
18
|
+
emptyMessage?: string;
|
|
19
19
|
validationResult?: true | 'error' | 'warning';
|
|
20
20
|
}
|
|
21
|
-
export declare const WarningListSelect: React.MemoExoticComponent<({ options, value, label, onChange, renderOption, renderValue, gridArea, additionalStyling, isReadOnly,
|
|
21
|
+
export declare const WarningListSelect: React.MemoExoticComponent<({ options, value, label, onChange, renderOption, renderValue, gridArea, additionalStyling, isReadOnly, emptyMessage, validationResult, }: WarningListSelectProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MaritimeWarning, MaritimeWarningsType } from '../../store/publicWarningForm/types';
|
|
2
2
|
import { MaritimeWarningItem, MaritimeWarningsConfig, MaritimeWarningsDomain } from './types';
|
|
3
|
-
export declare const isWarningsValid: (warnings: MaritimeWarningItem[], config: MaritimeWarningsConfig) => boolean;
|
|
3
|
+
export declare const isWarningsValid: (warnings: MaritimeWarningItem[], config: MaritimeWarningsConfig, allowEmpty?: boolean) => boolean;
|
|
4
4
|
export declare const getType: (domain: MaritimeWarningsDomain) => MaritimeWarningsType;
|
|
5
|
-
export declare const mapItemsToMaritimeWarnings: (warnings: MaritimeWarningItem[], domain: MaritimeWarningsDomain, maritimeConfig: MaritimeWarningsConfig, editor?: string) => MaritimeWarning[];
|
|
5
|
+
export declare const mapItemsToMaritimeWarnings: (warnings: MaritimeWarningItem[], domain: MaritimeWarningsDomain, maritimeConfig: MaritimeWarningsConfig, editor?: string, shouldExtend?: boolean) => MaritimeWarning[];
|
|
6
6
|
export declare const mapMaritimeWarningsToItems: (warnings: MaritimeWarning[]) => MaritimeWarningItem[];
|
|
7
7
|
export declare const validateWindDirectionChange: (directionFrom: string | undefined, directionTo: string | undefined, changeType: string | undefined, config?: MaritimeWarningsConfig) => true | "warning" | "error";
|
|
@@ -16,6 +16,8 @@ export interface PublicWarningListProps extends WarningListItemActions {
|
|
|
16
16
|
expandedSections: Record<string, boolean>;
|
|
17
17
|
setExpandedSections: (expandedSections: Record<string, boolean>) => void;
|
|
18
18
|
onActionAviationWarning?: () => void;
|
|
19
|
+
limitAlertCount?: number;
|
|
20
|
+
showLimitAlert?: boolean;
|
|
19
21
|
}
|
|
20
22
|
export declare const PublicWarningList: React.FC<PublicWarningListProps>;
|
|
21
23
|
export default PublicWarningList;
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { FilterTranslation } from '../../../store/publicWarnings/types';
|
|
3
3
|
export interface ColorDefinition {
|
|
4
4
|
color: string;
|
|
5
|
-
textColor
|
|
5
|
+
textColor?: string;
|
|
6
6
|
borderColor: string;
|
|
7
7
|
}
|
|
8
8
|
export interface LevelDetails extends FilterTranslation, ColorDefinition {
|
|
@@ -37,6 +37,7 @@ export interface FormProps {
|
|
|
37
37
|
onSetViewModeResetArea?: (area: Area[]) => void;
|
|
38
38
|
storedStartGeoJSON?: FeatureCollection<Geometry, GeoJsonProperties>;
|
|
39
39
|
storedEndGeoJSON?: FeatureCollection<Geometry, GeoJsonProperties>;
|
|
40
|
+
setWarningLevel?: (level: WarningLevel | '') => void;
|
|
40
41
|
}
|
|
41
42
|
export declare function warningLevelFeatureColors(level: WarningLevel | undefined, geoJSON: FeatureCollection<Geometry, GeoJsonProperties> | undefined, // Allow undefined
|
|
42
43
|
isAviationWarning?: boolean): FeatureCollection<Geometry, GeoJsonProperties>;
|
|
@@ -2,6 +2,7 @@ import { AlertColor } from '@mui/material';
|
|
|
2
2
|
import { Draft, PayloadAction } from '@reduxjs/toolkit';
|
|
3
3
|
import { DrawingListItem } from '../warningsDrawings/types';
|
|
4
4
|
import { Area, Warning, WarningType } from './types';
|
|
5
|
+
import { WarningLevel } from '../../components/PublicWarningsForm/LevelField';
|
|
5
6
|
export type FormAction = '' | 'saving' | 'publishing' | 'readonly' | 'edit' | 'amending' | 'cancel';
|
|
6
7
|
export interface FormError {
|
|
7
8
|
severity?: AlertColor;
|
|
@@ -48,4 +49,5 @@ export declare const publicWarningFormReducer: import("redux").Reducer<WarningFo
|
|
|
48
49
|
warningId: string;
|
|
49
50
|
}>) => void;
|
|
50
51
|
setSelectedWarningId: (draft: Draft<WarningFormState>, action: PayloadAction<string>) => void;
|
|
52
|
+
setWarningLevel: (draft: Draft<WarningFormState>, action: PayloadAction<WarningLevel | "">) => void;
|
|
51
53
|
}, "publicWarningForm">;
|