@opengeoweb/warnings 9.2.0 → 9.3.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 +306 -70
- package/package.json +1 -1
- package/src/lib/components/PublicWarningList/PublicWarningList.d.ts +2 -1
- package/src/lib/components/PublicWarningsForm/LevelField/LevelField.d.ts +3 -1
- package/src/lib/components/PublicWarningsForm/PublicWarningsForm.d.ts +1 -1
- package/src/lib/components/PublicWarningsForm/PublicWarningsForm.stories.d.ts +2 -0
- package/src/lib/components/PublicWarningsFormDialog/PublicWarningsFormDialog.d.ts +3 -0
- package/src/lib/components/PublicWarningsFormDialog/PublicWarningsFormDialog.stories.d.ts +8 -0
- package/src/lib/store/config.d.ts +3 -0
- package/src/lib/store/publicWarningForm/reducer.d.ts +7 -3
- package/src/lib/store/publicWarningForm/selectors.d.ts +6 -1
- package/src/lib/store/publicWarnings/reducer.d.ts +18 -0
- package/src/lib/store/publicWarnings/reducer.spec.d.ts +1 -0
- package/src/lib/store/publicWarnings/sagas.d.ts +5 -0
- package/src/lib/store/publicWarnings/sagas.spec.d.ts +1 -0
- package/src/lib/store/publicWarnings/selectors.d.ts +14 -0
- package/src/lib/store/publicWarnings/selectors.spec.d.ts +1 -0
- package/src/lib/store/publicWarnings/types.d.ts +11 -0
- /package/src/lib/components/{PublicWarningList/PublicWarningListConnect.spec.d.ts → PublicWarningsForm/LevelField/LevelField.spec.d.ts} +0 -0
package/index.esm.js
CHANGED
|
@@ -7,7 +7,7 @@ import { emptyGeoJSON, MapControlButton, getGeoJSONPropertyValue, getIcon, rewin
|
|
|
7
7
|
import { useConfirmationDialog, dateUtils, ToggleMenu, calculateStartSize, ToolContainerDraggable, AlertBanner, ConfirmationDialog, getAxiosErrorMessage, CustomIconButton, usePrevious, SwitchButton, StatusTag, ErrorBoundary, isAxiosError } from '@opengeoweb/shared';
|
|
8
8
|
import { snackbarActions } from '@opengeoweb/snackbar';
|
|
9
9
|
import { styled, Box, Typography, ListItem, Grid, Paper, ListItemButton, Stack, LinearProgress, Button, FormHelperText, MenuItem, Tabs, Tab, FormControl, Card, CardContent, ListItemIcon, CircularProgress, List } from '@mui/material';
|
|
10
|
-
import { getApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider
|
|
10
|
+
import { getApi, createApiInstance, createNonAuthApiInstance, createFakeApiInstance, ApiProvider } from '@opengeoweb/api';
|
|
11
11
|
import { ReactHookFormProvider, defaultFormOptions, ReactHookFormHiddenInput, isValidGeoJsonCoordinates, ReactHookFormSelect, ReactHookFormTextField, useDraftFormHelpers, errorMessages, ReactHookFormDateTime, isValidDate, isXHoursBefore, isXHoursAfter, isEmpty } from '@opengeoweb/form-fields';
|
|
12
12
|
import { isAxiosError as isAxiosError$1 } from 'axios';
|
|
13
13
|
|
|
@@ -2921,9 +2921,9 @@ var drawAdapter = createEntityAdapter({
|
|
|
2921
2921
|
return draw.drawingInstanceId;
|
|
2922
2922
|
}
|
|
2923
2923
|
});
|
|
2924
|
-
var initialState$
|
|
2925
|
-
var slice$
|
|
2926
|
-
initialState: initialState$
|
|
2924
|
+
var initialState$2 = drawAdapter.getInitialState();
|
|
2925
|
+
var slice$2 = createSlice({
|
|
2926
|
+
initialState: initialState$2,
|
|
2927
2927
|
name: 'drawingForm',
|
|
2928
2928
|
reducers: {
|
|
2929
2929
|
setDrawValues: function setDrawValues(draft, action) {
|
|
@@ -2987,8 +2987,8 @@ var slice$1 = createSlice({
|
|
|
2987
2987
|
});
|
|
2988
2988
|
}
|
|
2989
2989
|
});
|
|
2990
|
-
var reducer$
|
|
2991
|
-
var drawActions = slice$
|
|
2990
|
+
var reducer$2 = slice$2.reducer;
|
|
2991
|
+
var drawActions = slice$2.actions;
|
|
2992
2992
|
|
|
2993
2993
|
/* *
|
|
2994
2994
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -5247,57 +5247,69 @@ var publicWarningDialogType = uiTypes.DialogTypes.PublicWarnings;
|
|
|
5247
5247
|
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5248
5248
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
5249
5249
|
* */
|
|
5250
|
-
var initialState = {};
|
|
5251
|
-
var slice = createSlice({
|
|
5252
|
-
initialState: initialState,
|
|
5250
|
+
var initialState$1 = {};
|
|
5251
|
+
var slice$1 = createSlice({
|
|
5252
|
+
initialState: initialState$1,
|
|
5253
5253
|
name: 'publicWarningForm',
|
|
5254
5254
|
reducers: {
|
|
5255
5255
|
setFormValues: function setFormValues(draft, action) {
|
|
5256
5256
|
var _action$payload = action.payload,
|
|
5257
5257
|
object = _action$payload.object,
|
|
5258
|
-
publicWarningDetail = _action$payload.publicWarningDetail
|
|
5258
|
+
publicWarningDetail = _action$payload.publicWarningDetail,
|
|
5259
|
+
formState = _action$payload.formState;
|
|
5259
5260
|
if (object) {
|
|
5260
5261
|
draft.object = object;
|
|
5261
5262
|
}
|
|
5262
5263
|
if (publicWarningDetail) {
|
|
5263
5264
|
draft.publicWarningDetail = publicWarningDetail;
|
|
5264
5265
|
}
|
|
5266
|
+
if (formState !== undefined) {
|
|
5267
|
+
draft.formState = formState;
|
|
5268
|
+
}
|
|
5265
5269
|
},
|
|
5266
5270
|
openPublicWarningFormDialog: function openPublicWarningFormDialog(draft, action) {
|
|
5267
5271
|
var _action$payload2 = action.payload,
|
|
5268
5272
|
object = _action$payload2.object,
|
|
5269
|
-
publicWarningDetail = _action$payload2.publicWarningDetail
|
|
5273
|
+
publicWarningDetail = _action$payload2.publicWarningDetail,
|
|
5274
|
+
_action$payload2$form = _action$payload2.formState,
|
|
5275
|
+
formState = _action$payload2$form === void 0 ? '' : _action$payload2$form,
|
|
5276
|
+
status = _action$payload2.status;
|
|
5270
5277
|
draft.object = object;
|
|
5271
5278
|
draft.publicWarningDetail = publicWarningDetail;
|
|
5272
5279
|
draft.selectedPublicWarningId = publicWarningDetail === null || publicWarningDetail === void 0 ? void 0 : publicWarningDetail.id;
|
|
5280
|
+
draft.formState = formState;
|
|
5281
|
+
draft.status = status;
|
|
5273
5282
|
},
|
|
5274
5283
|
// publish warning
|
|
5275
5284
|
publishWarning: function publishWarning(draft,
|
|
5276
5285
|
// eslint-disable-next-line no-unused-vars
|
|
5277
5286
|
action) {
|
|
5278
|
-
draft.
|
|
5287
|
+
draft.formState = 'publishing';
|
|
5279
5288
|
draft.error = '';
|
|
5280
5289
|
},
|
|
5281
5290
|
publishWarningSuccess: function publishWarningSuccess(draft, action) {
|
|
5282
5291
|
var publicWarning = action.payload.publicWarning;
|
|
5283
5292
|
draft.publicWarningDetail = publicWarning.warningDetail;
|
|
5284
|
-
|
|
5293
|
+
// If form has been published, set form to readonly
|
|
5294
|
+
draft.formState = 'readonly';
|
|
5295
|
+
draft.status = publicWarning.status;
|
|
5285
5296
|
},
|
|
5286
5297
|
// save warning
|
|
5287
5298
|
saveWarning: function saveWarning(draft,
|
|
5288
5299
|
// eslint-disable-next-line no-unused-vars
|
|
5289
5300
|
action) {
|
|
5290
|
-
draft.
|
|
5301
|
+
draft.formState = 'saving';
|
|
5291
5302
|
draft.error = '';
|
|
5303
|
+
draft.status = action.payload.publicWarning.status;
|
|
5292
5304
|
},
|
|
5293
5305
|
saveWarningSuccess: function saveWarningSuccess(draft, action) {
|
|
5294
5306
|
var publicWarning = action.payload.publicWarning;
|
|
5295
5307
|
draft.publicWarningDetail = publicWarning.warningDetail;
|
|
5296
|
-
draft.
|
|
5308
|
+
draft.formState = '';
|
|
5297
5309
|
},
|
|
5298
5310
|
setFormError: function setFormError(draft, action) {
|
|
5299
5311
|
var error = action.payload.error;
|
|
5300
|
-
draft.
|
|
5312
|
+
draft.formState = '';
|
|
5301
5313
|
draft.error = error;
|
|
5302
5314
|
}
|
|
5303
5315
|
},
|
|
@@ -5309,15 +5321,16 @@ var slice = createSlice({
|
|
|
5309
5321
|
if (type === publicWarningDialogType && setOpen === false) {
|
|
5310
5322
|
delete draft.object;
|
|
5311
5323
|
delete draft.publicWarningDetail;
|
|
5312
|
-
delete draft.
|
|
5324
|
+
delete draft.formState;
|
|
5313
5325
|
delete draft.error;
|
|
5314
5326
|
delete draft.selectedPublicWarningId;
|
|
5327
|
+
delete draft.status;
|
|
5315
5328
|
}
|
|
5316
5329
|
});
|
|
5317
5330
|
}
|
|
5318
5331
|
});
|
|
5319
|
-
var reducer = slice.reducer;
|
|
5320
|
-
var publicWarningFormActions = slice.actions;
|
|
5332
|
+
var reducer$1 = slice$1.reducer;
|
|
5333
|
+
var publicWarningFormActions = slice$1.actions;
|
|
5321
5334
|
|
|
5322
5335
|
var getDeleteSucces = function getDeleteSucces(objectName) {
|
|
5323
5336
|
return "".concat(objectName, " has been deleted");
|
|
@@ -25472,14 +25485,23 @@ var PublicWarningsFormDialog = function PublicWarningsFormDialog(_ref) {
|
|
|
25472
25485
|
headerSize = _ref$headerSize === void 0 ? 'xs' : _ref$headerSize,
|
|
25473
25486
|
children = _ref.children,
|
|
25474
25487
|
_ref$isLoading = _ref.isLoading,
|
|
25475
|
-
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading
|
|
25488
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
25489
|
+
_ref$isReadOnly = _ref.isReadOnly,
|
|
25490
|
+
isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
|
|
25491
|
+
_ref$onChangeFormMode = _ref.onChangeFormMode,
|
|
25492
|
+
onChangeFormMode = _ref$onChangeFormMode === void 0 ? function () {} : _ref$onChangeFormMode,
|
|
25493
|
+
_ref$shouldHideFormMo = _ref.shouldHideFormMode,
|
|
25494
|
+
shouldHideFormMode = _ref$shouldHideFormMo === void 0 ? false : _ref$shouldHideFormMo;
|
|
25476
25495
|
var minSize = DEFAULT_WARNING_DIALOG_MIN_SIZE;
|
|
25477
25496
|
var startSizeCalc = calculateStartSize(minSize, size, startPosition);
|
|
25478
25497
|
var _React$useState = React.useState(startSizeCalc),
|
|
25479
25498
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
25480
25499
|
sizeInState = _React$useState2[0],
|
|
25481
25500
|
setSizeInState = _React$useState2[1];
|
|
25482
|
-
|
|
25501
|
+
var onChangeMode = function onChangeMode() {
|
|
25502
|
+
onChangeFormMode(!isReadOnly);
|
|
25503
|
+
};
|
|
25504
|
+
return /*#__PURE__*/React.createElement(ToolContainerDraggable, Object.assign({
|
|
25483
25505
|
title: title,
|
|
25484
25506
|
startSize: sizeInState,
|
|
25485
25507
|
minWidth: minSize.width,
|
|
@@ -25511,7 +25533,8 @@ var PublicWarningsFormDialog = function PublicWarningsFormDialog(_ref) {
|
|
|
25511
25533
|
setSizeInState(dragSize);
|
|
25512
25534
|
}
|
|
25513
25535
|
},
|
|
25514
|
-
leftHeaderComponent: /*#__PURE__*/React.createElement("div", null)
|
|
25536
|
+
leftHeaderComponent: /*#__PURE__*/React.createElement("div", null)
|
|
25537
|
+
}, !shouldHideFormMode && {
|
|
25515
25538
|
rightHeaderComponent: /*#__PURE__*/React.createElement(Box, {
|
|
25516
25539
|
sx: {
|
|
25517
25540
|
flex: 1,
|
|
@@ -25529,14 +25552,18 @@ var PublicWarningsFormDialog = function PublicWarningsFormDialog(_ref) {
|
|
|
25529
25552
|
position: 'relative',
|
|
25530
25553
|
top: -7
|
|
25531
25554
|
}
|
|
25532
|
-
}, /*#__PURE__*/React.createElement(SwitchButton,
|
|
25555
|
+
}, /*#__PURE__*/React.createElement(SwitchButton, {
|
|
25556
|
+
checked: !isReadOnly,
|
|
25557
|
+
onChange: onChangeMode
|
|
25558
|
+
})))
|
|
25559
|
+
}, {
|
|
25533
25560
|
sx: {
|
|
25534
25561
|
footer: {
|
|
25535
25562
|
backgroundColor: 'inherit',
|
|
25536
25563
|
boxShadow: 'none'
|
|
25537
25564
|
}
|
|
25538
25565
|
}
|
|
25539
|
-
}, isLoading && /*#__PURE__*/React.createElement(LinearProgress, {
|
|
25566
|
+
}), isLoading && /*#__PURE__*/React.createElement(LinearProgress, {
|
|
25540
25567
|
"data-testid": "loading-bar",
|
|
25541
25568
|
color: "secondary",
|
|
25542
25569
|
sx: {
|
|
@@ -25912,7 +25939,9 @@ var levelOptions = [{
|
|
|
25912
25939
|
color: '#D62A20',
|
|
25913
25940
|
textColor: '#ffffff'
|
|
25914
25941
|
}];
|
|
25915
|
-
var LevelField = function LevelField() {
|
|
25942
|
+
var LevelField = function LevelField(_ref) {
|
|
25943
|
+
var _ref$isDisabled = _ref.isDisabled,
|
|
25944
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
|
|
25916
25945
|
var _useDraftFormHelpers = useDraftFormHelpers(),
|
|
25917
25946
|
isRequired = _useDraftFormHelpers.isRequired;
|
|
25918
25947
|
var _useFormContext = useFormContext(),
|
|
@@ -25935,7 +25964,8 @@ var LevelField = function LevelField() {
|
|
|
25935
25964
|
backgroundColor: (levelDetails === null || levelDetails === void 0 ? void 0 : levelDetails.color) || 'none',
|
|
25936
25965
|
backgroundClip: 'content-box'
|
|
25937
25966
|
}
|
|
25938
|
-
}
|
|
25967
|
+
},
|
|
25968
|
+
disabled: isDisabled
|
|
25939
25969
|
}, levelOptions.map(function (level) {
|
|
25940
25970
|
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
25941
25971
|
value: level.key,
|
|
@@ -26138,10 +26168,12 @@ var ContainerWrapper = styled('div')(function () {
|
|
|
26138
26168
|
};
|
|
26139
26169
|
});
|
|
26140
26170
|
var ContainerFormWrapper = styled('div')(function (_ref) {
|
|
26141
|
-
var
|
|
26171
|
+
var _ref$isReadOnly = _ref.isReadOnly,
|
|
26172
|
+
isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
|
|
26173
|
+
theme = _ref.theme;
|
|
26142
26174
|
return _defineProperty({
|
|
26143
26175
|
padding: theme.spacing(2),
|
|
26144
|
-
height: 'calc(100% - 206px)
|
|
26176
|
+
height: isReadOnly ? '100%' : "calc(100% - 206px)",
|
|
26145
26177
|
overflowY: 'auto'
|
|
26146
26178
|
}, containerQueryBreakpoint, {
|
|
26147
26179
|
height: 'calc(100% - 88px)'
|
|
@@ -26224,7 +26256,8 @@ var Form = function Form(_ref5) {
|
|
|
26224
26256
|
DraftFieldHelper = _useDraftFormHelpers.DraftFieldHelper;
|
|
26225
26257
|
var isPublishing = formAction === 'publishing';
|
|
26226
26258
|
var isSaving = formAction === 'saving';
|
|
26227
|
-
var
|
|
26259
|
+
var isReadOnly = formAction === 'readonly';
|
|
26260
|
+
var areFieldsDisabled = isPublishing || isSaving || isReadOnly;
|
|
26228
26261
|
var onPressPublish = function onPressPublish() {
|
|
26229
26262
|
if (!isPublishing) {
|
|
26230
26263
|
toggleIsDraft(false);
|
|
@@ -26269,7 +26302,9 @@ var Form = function Form(_ref5) {
|
|
|
26269
26302
|
reset(getFormData(publicWarningDetails, object));
|
|
26270
26303
|
}, [object, reset, publicWarningDetails]);
|
|
26271
26304
|
var errors = getErrors(error);
|
|
26272
|
-
return /*#__PURE__*/React.createElement(ContainerWrapper, null, /*#__PURE__*/React.createElement(ContainerFormWrapper,
|
|
26305
|
+
return /*#__PURE__*/React.createElement(ContainerWrapper, null, /*#__PURE__*/React.createElement(ContainerFormWrapper, {
|
|
26306
|
+
isReadOnly: isReadOnly
|
|
26307
|
+
}, /*#__PURE__*/React.createElement(ContainerGrid, null, errors && /*#__PURE__*/React.createElement(Box, {
|
|
26273
26308
|
sx: {
|
|
26274
26309
|
marginBottom: 2
|
|
26275
26310
|
}
|
|
@@ -26323,7 +26358,9 @@ var Form = function Form(_ref5) {
|
|
|
26323
26358
|
item: true,
|
|
26324
26359
|
xs: 12,
|
|
26325
26360
|
sm: 6
|
|
26326
|
-
}, /*#__PURE__*/React.createElement(LevelField,
|
|
26361
|
+
}, /*#__PURE__*/React.createElement(LevelField, {
|
|
26362
|
+
isDisabled: areFieldsDisabled
|
|
26363
|
+
})), /*#__PURE__*/React.createElement(Grid, {
|
|
26327
26364
|
item: true,
|
|
26328
26365
|
xs: 12,
|
|
26329
26366
|
sm: 6
|
|
@@ -26349,7 +26386,7 @@ var Form = function Form(_ref5) {
|
|
|
26349
26386
|
isDisabled: areFieldsDisabled
|
|
26350
26387
|
}))))), /*#__PURE__*/React.createElement(DraftFieldHelper, null), /*#__PURE__*/React.createElement(ReactHookFormHiddenInput, {
|
|
26351
26388
|
name: "id"
|
|
26352
|
-
})), /*#__PURE__*/React.createElement(Box, {
|
|
26389
|
+
})), !isReadOnly && /*#__PURE__*/React.createElement(Box, {
|
|
26353
26390
|
sx: {
|
|
26354
26391
|
padding: '24px 10px 14px 10px',
|
|
26355
26392
|
position: 'absolute',
|
|
@@ -26454,8 +26491,11 @@ var getPublicWarningObject = createSelector(getPublicWarningStore, function (pub
|
|
|
26454
26491
|
var getPublicWarning = createSelector(getPublicWarningStore, function (publicWarningStore) {
|
|
26455
26492
|
return publicWarningStore.publicWarningDetail;
|
|
26456
26493
|
});
|
|
26457
|
-
var
|
|
26458
|
-
return
|
|
26494
|
+
var getPublicWarningStatus = createSelector(getPublicWarningStore, function (publicWarningStore) {
|
|
26495
|
+
return publicWarningStore === null || publicWarningStore === void 0 ? void 0 : publicWarningStore.status;
|
|
26496
|
+
});
|
|
26497
|
+
var getPublicWarningFormState = createSelector(getPublicWarningStore, function (publicWarningStore) {
|
|
26498
|
+
return (publicWarningStore === null || publicWarningStore === void 0 ? void 0 : publicWarningStore.formState) || '';
|
|
26459
26499
|
});
|
|
26460
26500
|
var getPublicWarningFormError = createSelector(getPublicWarningStore, function (publicWarningStore) {
|
|
26461
26501
|
return (publicWarningStore === null || publicWarningStore === void 0 ? void 0 : publicWarningStore.error) || '';
|
|
@@ -26488,7 +26528,7 @@ var PublicWarningsFormConnect = function PublicWarningsFormConnect() {
|
|
|
26488
26528
|
return getPublicWarningObject(store);
|
|
26489
26529
|
});
|
|
26490
26530
|
var publicWarningFormAction = useSelector(function (store) {
|
|
26491
|
-
return
|
|
26531
|
+
return getPublicWarningFormState(store);
|
|
26492
26532
|
});
|
|
26493
26533
|
var publicWarningFormError = useSelector(function (store) {
|
|
26494
26534
|
return getPublicWarningFormError(store);
|
|
@@ -26548,9 +26588,23 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
26548
26588
|
uiSource = _useSetupDialog.uiSource,
|
|
26549
26589
|
onCloseDialog = _useSetupDialog.onCloseDialog,
|
|
26550
26590
|
uiIsLoading = _useSetupDialog.uiIsLoading;
|
|
26591
|
+
var dispatch = useDispatch();
|
|
26592
|
+
var onChangeFormMode = function onChangeFormMode(isChecked) {
|
|
26593
|
+
dispatch(publicWarningFormActions.setFormValues({
|
|
26594
|
+
formState: !isChecked ? '' : 'readonly'
|
|
26595
|
+
}));
|
|
26596
|
+
};
|
|
26597
|
+
var formAction = useSelector(function (store) {
|
|
26598
|
+
return getPublicWarningFormState(store);
|
|
26599
|
+
});
|
|
26600
|
+
var publicWarningStatus = useSelector(function (store) {
|
|
26601
|
+
return getPublicWarningStatus(store);
|
|
26602
|
+
});
|
|
26551
26603
|
if (!isDialogOpen) {
|
|
26552
26604
|
return null;
|
|
26553
26605
|
}
|
|
26606
|
+
var isReadOnly = formAction === 'readonly';
|
|
26607
|
+
var shouldHideFormToggleMode = publicWarningStatus !== undefined && publicWarningStatus !== 'DRAFT';
|
|
26554
26608
|
return /*#__PURE__*/React__default.createElement(PublicWarningsFormDialog, {
|
|
26555
26609
|
isOpen: isDialogOpen,
|
|
26556
26610
|
onClose: onCloseDialog,
|
|
@@ -26559,7 +26613,10 @@ var PublicWarningsFormDialogConnect = function PublicWarningsFormDialogConnect(_
|
|
|
26559
26613
|
source: uiSource,
|
|
26560
26614
|
bounds: bounds,
|
|
26561
26615
|
startPosition: startPosition,
|
|
26562
|
-
isLoading: uiIsLoading
|
|
26616
|
+
isLoading: uiIsLoading,
|
|
26617
|
+
isReadOnly: isReadOnly,
|
|
26618
|
+
onChangeFormMode: onChangeFormMode,
|
|
26619
|
+
shouldHideFormMode: shouldHideFormToggleMode
|
|
26563
26620
|
}, /*#__PURE__*/React__default.createElement(PublicWarningsFormConnect, null));
|
|
26564
26621
|
};
|
|
26565
26622
|
|
|
@@ -26637,7 +26694,7 @@ var WarningListColumnContent = function WarningListColumnContent(_a) {
|
|
|
26637
26694
|
sx: Object.assign(Object.assign({}, props.sx), {
|
|
26638
26695
|
width: width
|
|
26639
26696
|
})
|
|
26640
|
-
}), /*#__PURE__*/React__default.createElement(Box, {
|
|
26697
|
+
}), title && /*#__PURE__*/React__default.createElement(Box, {
|
|
26641
26698
|
sx: {
|
|
26642
26699
|
overflow: 'hidden',
|
|
26643
26700
|
fontWeight: 'normal',
|
|
@@ -26660,16 +26717,17 @@ var WarningsOnStatus = function WarningsOnStatus(_ref) {
|
|
|
26660
26717
|
var warnings = _ref.warnings,
|
|
26661
26718
|
status = _ref.status,
|
|
26662
26719
|
activeWarningId = _ref.activeWarningId,
|
|
26663
|
-
onSelectWarning = _ref.onSelectWarning
|
|
26720
|
+
onSelectWarning = _ref.onSelectWarning,
|
|
26721
|
+
onEditWarning = _ref.onEditWarning;
|
|
26664
26722
|
var headerText = "".concat(warnings.length, " ").concat(getStatus(status));
|
|
26665
26723
|
var onClickWarning = function onClickWarning(warning) {
|
|
26666
26724
|
return function () {
|
|
26667
26725
|
return onSelectWarning(warning);
|
|
26668
26726
|
};
|
|
26669
26727
|
};
|
|
26670
|
-
var
|
|
26728
|
+
var onClickEditWarning = function onClickEditWarning(warning) {
|
|
26671
26729
|
return function () {
|
|
26672
|
-
return
|
|
26730
|
+
return onEditWarning(warning);
|
|
26673
26731
|
};
|
|
26674
26732
|
};
|
|
26675
26733
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
@@ -26710,7 +26768,7 @@ var WarningsOnStatus = function WarningsOnStatus(_ref) {
|
|
|
26710
26768
|
"aria-label": BUTTON_OPTIONS,
|
|
26711
26769
|
menuItems: status === 'DRAFT' ? [{
|
|
26712
26770
|
text: BUTTON_EDIT,
|
|
26713
|
-
action:
|
|
26771
|
+
action: onClickEditWarning(warning),
|
|
26714
26772
|
icon: /*#__PURE__*/React__default.createElement(Edit, null)
|
|
26715
26773
|
}] : [],
|
|
26716
26774
|
buttonIcon: /*#__PURE__*/React__default.createElement(Options, null)
|
|
@@ -26735,7 +26793,7 @@ var WarningsOnStatus = function WarningsOnStatus(_ref) {
|
|
|
26735
26793
|
}, /*#__PURE__*/React__default.createElement(WarningListColumnContent, {
|
|
26736
26794
|
title: "Incident",
|
|
26737
26795
|
status: status,
|
|
26738
|
-
width:
|
|
26796
|
+
width: 142
|
|
26739
26797
|
}), /*#__PURE__*/React__default.createElement(WarningListColumnContent, {
|
|
26740
26798
|
title: "Last update",
|
|
26741
26799
|
status: status,
|
|
@@ -26777,7 +26835,9 @@ var WarningsOnStatus = function WarningsOnStatus(_ref) {
|
|
|
26777
26835
|
paddingBottom: '1px',
|
|
26778
26836
|
marginLeft: -0.5
|
|
26779
26837
|
}
|
|
26780
|
-
}, ((_a = warning.warningDetail) === null || _a === void 0 ? void 0 : _a.level) && (levelDetails === null || levelDetails === void 0 ? void 0 : levelDetails.title) || '-')),
|
|
26838
|
+
}, ((_a = warning.warningDetail) === null || _a === void 0 ? void 0 : _a.level) && (levelDetails === null || levelDetails === void 0 ? void 0 : levelDetails.title) || '-')), /*#__PURE__*/React__default.createElement(WarningListColumnContent, {
|
|
26839
|
+
status: status
|
|
26840
|
+
}, status === 'DRAFT' ? /*#__PURE__*/React__default.createElement(Button, {
|
|
26781
26841
|
sx: {
|
|
26782
26842
|
height: '30px',
|
|
26783
26843
|
padding: '0px',
|
|
@@ -26791,11 +26851,9 @@ var WarningsOnStatus = function WarningsOnStatus(_ref) {
|
|
|
26791
26851
|
content: status.toLowerCase(),
|
|
26792
26852
|
color: status === 'EXPIRED' ? 'grey' : 'green',
|
|
26793
26853
|
sx: {
|
|
26794
|
-
width: 66
|
|
26795
|
-
marginLeft: 0.5,
|
|
26796
|
-
marginRight: 0.5
|
|
26854
|
+
width: 66
|
|
26797
26855
|
}
|
|
26798
|
-
}))));
|
|
26856
|
+
})))));
|
|
26799
26857
|
})));
|
|
26800
26858
|
};
|
|
26801
26859
|
var PublicWarningList = function PublicWarningList(_ref2) {
|
|
@@ -26805,6 +26863,8 @@ var PublicWarningList = function PublicWarningList(_ref2) {
|
|
|
26805
26863
|
error = _ref2.error,
|
|
26806
26864
|
_ref2$onSelectWarning = _ref2.onSelectWarning,
|
|
26807
26865
|
onSelectWarning = _ref2$onSelectWarning === void 0 ? function () {} : _ref2$onSelectWarning,
|
|
26866
|
+
_ref2$onEditWarning = _ref2.onEditWarning,
|
|
26867
|
+
onEditWarning = _ref2$onEditWarning === void 0 ? function () {} : _ref2$onEditWarning,
|
|
26808
26868
|
_ref2$onCreateWarning = _ref2.onCreateWarning,
|
|
26809
26869
|
onCreateWarning = _ref2$onCreateWarning === void 0 ? function () {} : _ref2$onCreateWarning,
|
|
26810
26870
|
_ref2$selectedPublicW = _ref2.selectedPublicWarningId,
|
|
@@ -26835,29 +26895,118 @@ var PublicWarningList = function PublicWarningList(_ref2) {
|
|
|
26835
26895
|
}), isLoading && /*#__PURE__*/React__default.createElement(LinearProgress, {
|
|
26836
26896
|
"data-testid": "loading-bar",
|
|
26837
26897
|
color: "secondary"
|
|
26838
|
-
}), sortedWarnings && !error &&
|
|
26898
|
+
}), sortedWarnings && !error && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(WarningsOnStatus, {
|
|
26839
26899
|
status: "TODO",
|
|
26840
26900
|
warnings: sortedWarnings.todo,
|
|
26841
26901
|
onSelectWarning: onSelectWarning,
|
|
26902
|
+
onEditWarning: onEditWarning,
|
|
26842
26903
|
activeWarningId: selectedPublicWarningId
|
|
26843
26904
|
}), /*#__PURE__*/React__default.createElement(WarningsOnStatus, {
|
|
26844
26905
|
status: "DRAFT",
|
|
26845
26906
|
warnings: sortedWarnings.draft,
|
|
26846
26907
|
onSelectWarning: onSelectWarning,
|
|
26908
|
+
onEditWarning: onEditWarning,
|
|
26847
26909
|
activeWarningId: selectedPublicWarningId
|
|
26848
26910
|
}), /*#__PURE__*/React__default.createElement(WarningsOnStatus, {
|
|
26849
26911
|
status: "PUBLISHED",
|
|
26850
26912
|
warnings: sortedWarnings.published,
|
|
26851
26913
|
onSelectWarning: onSelectWarning,
|
|
26914
|
+
onEditWarning: onEditWarning,
|
|
26852
26915
|
activeWarningId: selectedPublicWarningId
|
|
26853
26916
|
}), /*#__PURE__*/React__default.createElement(WarningsOnStatus, {
|
|
26854
26917
|
status: "EXPIRED",
|
|
26855
26918
|
warnings: sortedWarnings.expired,
|
|
26856
26919
|
onSelectWarning: onSelectWarning,
|
|
26920
|
+
onEditWarning: onEditWarning,
|
|
26857
26921
|
activeWarningId: selectedPublicWarningId
|
|
26858
26922
|
})));
|
|
26859
26923
|
};
|
|
26860
26924
|
|
|
26925
|
+
/* *
|
|
26926
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
26927
|
+
* you may not use this file except in compliance with the License.
|
|
26928
|
+
* You may obtain a copy of the License at
|
|
26929
|
+
*
|
|
26930
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
26931
|
+
*
|
|
26932
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
26933
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
26934
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26935
|
+
* See the License for the specific language governing permissions and
|
|
26936
|
+
* limitations under the License.
|
|
26937
|
+
*
|
|
26938
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
26939
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
26940
|
+
* */
|
|
26941
|
+
var publicWarningsAdapter = createEntityAdapter({
|
|
26942
|
+
selectId: function selectId(warning) {
|
|
26943
|
+
return warning.id;
|
|
26944
|
+
}
|
|
26945
|
+
});
|
|
26946
|
+
var initialState = {
|
|
26947
|
+
warnings: publicWarningsAdapter.getInitialState(),
|
|
26948
|
+
isLoading: true
|
|
26949
|
+
};
|
|
26950
|
+
var slice = createSlice({
|
|
26951
|
+
initialState: initialState,
|
|
26952
|
+
name: 'publicWarnings',
|
|
26953
|
+
reducers: {
|
|
26954
|
+
fetchWarnings: function fetchWarnings(draft) {
|
|
26955
|
+
draft.isLoading = true;
|
|
26956
|
+
delete draft.error;
|
|
26957
|
+
},
|
|
26958
|
+
fetchWarningsSuccess: function fetchWarningsSuccess(draft, action) {
|
|
26959
|
+
var warnings = action.payload.warnings;
|
|
26960
|
+
draft.isLoading = false;
|
|
26961
|
+
publicWarningsAdapter.setAll(draft.warnings, warnings);
|
|
26962
|
+
},
|
|
26963
|
+
fetchWarningsError: function fetchWarningsError(draft, action) {
|
|
26964
|
+
var error = action.payload.error;
|
|
26965
|
+
draft.isLoading = false;
|
|
26966
|
+
draft.error = error;
|
|
26967
|
+
}
|
|
26968
|
+
}
|
|
26969
|
+
});
|
|
26970
|
+
var reducer = slice.reducer;
|
|
26971
|
+
var publicWarningActions = slice.actions;
|
|
26972
|
+
|
|
26973
|
+
/* *
|
|
26974
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
26975
|
+
* you may not use this file except in compliance with the License.
|
|
26976
|
+
* You may obtain a copy of the License at
|
|
26977
|
+
*
|
|
26978
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
26979
|
+
*
|
|
26980
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
26981
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
26982
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
26983
|
+
* See the License for the specific language governing permissions and
|
|
26984
|
+
* limitations under the License.
|
|
26985
|
+
*
|
|
26986
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
26987
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
26988
|
+
* */
|
|
26989
|
+
var getPublicWarningsStore = function getPublicWarningsStore(store) {
|
|
26990
|
+
if (store && store.publicWarnings) {
|
|
26991
|
+
return store.publicWarnings;
|
|
26992
|
+
}
|
|
26993
|
+
return null;
|
|
26994
|
+
};
|
|
26995
|
+
var _publicWarningsAdapte = publicWarningsAdapter.getSelectors(function (state) {
|
|
26996
|
+
var _a, _b;
|
|
26997
|
+
return (_b = (_a = state === null || state === void 0 ? void 0 : state.publicWarnings) === null || _a === void 0 ? void 0 : _a.warnings) !== null && _b !== void 0 ? _b : {
|
|
26998
|
+
entities: {},
|
|
26999
|
+
ids: []
|
|
27000
|
+
};
|
|
27001
|
+
}),
|
|
27002
|
+
selectAllPublicWarnings = _publicWarningsAdapte.selectAll;
|
|
27003
|
+
var isPublicWarningsLoading = createSelector(getPublicWarningsStore, function (store) {
|
|
27004
|
+
return (store === null || store === void 0 ? void 0 : store.isLoading) || false;
|
|
27005
|
+
});
|
|
27006
|
+
var getPublicWarningsError = createSelector(getPublicWarningsStore, function (store) {
|
|
27007
|
+
return store === null || store === void 0 ? void 0 : store.error;
|
|
27008
|
+
});
|
|
27009
|
+
|
|
26861
27010
|
/* *
|
|
26862
27011
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
26863
27012
|
* you may not use this file except in compliance with the License.
|
|
@@ -26876,31 +27025,48 @@ var PublicWarningList = function PublicWarningList(_ref2) {
|
|
|
26876
27025
|
* */
|
|
26877
27026
|
var PublicWarningListConnect = function PublicWarningListConnect() {
|
|
26878
27027
|
var dispatch = useDispatch();
|
|
26879
|
-
var
|
|
26880
|
-
|
|
26881
|
-
|
|
26882
|
-
warnings = _useApi.result,
|
|
26883
|
-
isLoading = _useApi.isLoading,
|
|
26884
|
-
error = _useApi.error;
|
|
27028
|
+
var warnings = useSelector(function (store) {
|
|
27029
|
+
return selectAllPublicWarnings(store);
|
|
27030
|
+
});
|
|
26885
27031
|
var selectedPublicWarningId = useSelector(function (store) {
|
|
26886
27032
|
return getSelectedPublicWarningId(store);
|
|
26887
27033
|
});
|
|
26888
|
-
var
|
|
26889
|
-
|
|
27034
|
+
var isLoading = useSelector(function (store) {
|
|
27035
|
+
return isPublicWarningsLoading(store);
|
|
27036
|
+
});
|
|
27037
|
+
var error = useSelector(function (store) {
|
|
27038
|
+
return getPublicWarningsError(store);
|
|
27039
|
+
});
|
|
27040
|
+
var openPublicWarningDialog = function openPublicWarningDialog(formAction, publicWarning) {
|
|
27041
|
+
dispatch(publicWarningFormActions.openPublicWarningFormDialog(Object.assign(Object.assign({}, publicWarning && {
|
|
26890
27042
|
publicWarningDetail: Object.assign(Object.assign({}, publicWarning.warningDetail), {
|
|
26891
27043
|
id: publicWarning.id
|
|
26892
|
-
})
|
|
27044
|
+
}),
|
|
27045
|
+
status: publicWarning.status
|
|
27046
|
+
}), {
|
|
27047
|
+
formState: formAction
|
|
26893
27048
|
})));
|
|
26894
27049
|
};
|
|
27050
|
+
var selectWarning = function selectWarning(publicWarning) {
|
|
27051
|
+
openPublicWarningDialog('readonly', publicWarning);
|
|
27052
|
+
};
|
|
26895
27053
|
var createWarning = function createWarning() {
|
|
26896
|
-
|
|
27054
|
+
openPublicWarningDialog('');
|
|
27055
|
+
};
|
|
27056
|
+
var editWarning = function editWarning(publicWarning) {
|
|
27057
|
+
openPublicWarningDialog('', publicWarning);
|
|
26897
27058
|
};
|
|
27059
|
+
React__default.useEffect(function () {
|
|
27060
|
+
// fetch warnings on mount
|
|
27061
|
+
dispatch(publicWarningActions.fetchWarnings());
|
|
27062
|
+
}, [dispatch]);
|
|
26898
27063
|
return /*#__PURE__*/React__default.createElement(PublicWarningList, {
|
|
26899
27064
|
warnings: warnings,
|
|
26900
27065
|
isLoading: isLoading,
|
|
26901
27066
|
error: error,
|
|
26902
27067
|
onSelectWarning: selectWarning,
|
|
26903
27068
|
onCreateWarning: createWarning,
|
|
27069
|
+
onEditWarning: editWarning,
|
|
26904
27070
|
selectedPublicWarningId: selectedPublicWarningId
|
|
26905
27071
|
});
|
|
26906
27072
|
};
|
|
@@ -27433,7 +27599,7 @@ function takeLatest$1(patternOrChannel, worker) {
|
|
|
27433
27599
|
return fork.apply(void 0, [takeLatest, patternOrChannel, worker].concat(args));
|
|
27434
27600
|
}
|
|
27435
27601
|
|
|
27436
|
-
var _marked$
|
|
27602
|
+
var _marked$2 = /*#__PURE__*/_regeneratorRuntime().mark(drawingSaga);
|
|
27437
27603
|
var getSnackbarMessage = function getSnackbarMessage(objectName, id) {
|
|
27438
27604
|
return "Object ".concat(objectName, " has been ").concat(id ? 'updated' : 'saved', "!");
|
|
27439
27605
|
};
|
|
@@ -27528,12 +27694,12 @@ function drawingSaga() {
|
|
|
27528
27694
|
case "end":
|
|
27529
27695
|
return _context2.stop();
|
|
27530
27696
|
}
|
|
27531
|
-
}, _marked$
|
|
27697
|
+
}, _marked$2);
|
|
27532
27698
|
}
|
|
27533
27699
|
|
|
27534
|
-
var _marked = /*#__PURE__*/_regeneratorRuntime().mark(saveOrUpdateWarning),
|
|
27535
|
-
_marked2 = /*#__PURE__*/_regeneratorRuntime().mark(errorSaga),
|
|
27536
|
-
_marked3 = /*#__PURE__*/_regeneratorRuntime().mark(toggleDialogLoadingSaga),
|
|
27700
|
+
var _marked$1 = /*#__PURE__*/_regeneratorRuntime().mark(saveOrUpdateWarning),
|
|
27701
|
+
_marked2$1 = /*#__PURE__*/_regeneratorRuntime().mark(errorSaga),
|
|
27702
|
+
_marked3$1 = /*#__PURE__*/_regeneratorRuntime().mark(toggleDialogLoadingSaga),
|
|
27537
27703
|
_marked4 = /*#__PURE__*/_regeneratorRuntime().mark(openDialogSaga),
|
|
27538
27704
|
_marked5 = /*#__PURE__*/_regeneratorRuntime().mark(publicWarningRootSaga);
|
|
27539
27705
|
var PUBLISH_SUCCES = 'Public warning has succesfully been published!';
|
|
@@ -27572,7 +27738,7 @@ function saveOrUpdateWarning(publicWarning) {
|
|
|
27572
27738
|
case "end":
|
|
27573
27739
|
return _context.stop();
|
|
27574
27740
|
}
|
|
27575
|
-
}, _marked);
|
|
27741
|
+
}, _marked$1);
|
|
27576
27742
|
}
|
|
27577
27743
|
function publishWarningSaga(_ref) {
|
|
27578
27744
|
var payload = _ref.payload;
|
|
@@ -27621,7 +27787,7 @@ function saveWarningSaga(_ref2) {
|
|
|
27621
27787
|
case 4:
|
|
27622
27788
|
savedWarning = _context3.sent;
|
|
27623
27789
|
_context3.next = 7;
|
|
27624
|
-
return put(publicWarningFormActions.
|
|
27790
|
+
return put(publicWarningFormActions.saveWarningSuccess({
|
|
27625
27791
|
publicWarning: savedWarning,
|
|
27626
27792
|
message: SAVE_SUCCES
|
|
27627
27793
|
}));
|
|
@@ -27677,7 +27843,7 @@ function errorSaga(message) {
|
|
|
27677
27843
|
case "end":
|
|
27678
27844
|
return _context5.stop();
|
|
27679
27845
|
}
|
|
27680
|
-
}, _marked2);
|
|
27846
|
+
}, _marked2$1);
|
|
27681
27847
|
}
|
|
27682
27848
|
function toggleDialogLoadingSaga(isLoading) {
|
|
27683
27849
|
var isDialogOpen;
|
|
@@ -27701,7 +27867,7 @@ function toggleDialogLoadingSaga(isLoading) {
|
|
|
27701
27867
|
case "end":
|
|
27702
27868
|
return _context6.stop();
|
|
27703
27869
|
}
|
|
27704
|
-
}, _marked3);
|
|
27870
|
+
}, _marked3$1);
|
|
27705
27871
|
}
|
|
27706
27872
|
function openDialogSaga() {
|
|
27707
27873
|
return _regeneratorRuntime().wrap(function openDialogSaga$(_context7) {
|
|
@@ -27743,6 +27909,75 @@ function publicWarningRootSaga() {
|
|
|
27743
27909
|
}, _marked5);
|
|
27744
27910
|
}
|
|
27745
27911
|
|
|
27912
|
+
var _marked = /*#__PURE__*/_regeneratorRuntime().mark(fetchWarningsSaga),
|
|
27913
|
+
_marked2 = /*#__PURE__*/_regeneratorRuntime().mark(refetchWarnings),
|
|
27914
|
+
_marked3 = /*#__PURE__*/_regeneratorRuntime().mark(publicWarnings);
|
|
27915
|
+
function fetchWarningsSaga() {
|
|
27916
|
+
var warningsApi, _yield$call, warnings;
|
|
27917
|
+
return _regeneratorRuntime().wrap(function fetchWarningsSaga$(_context) {
|
|
27918
|
+
while (1) switch (_context.prev = _context.next) {
|
|
27919
|
+
case 0:
|
|
27920
|
+
_context.prev = 0;
|
|
27921
|
+
_context.next = 3;
|
|
27922
|
+
return call(getWarningsApi);
|
|
27923
|
+
case 3:
|
|
27924
|
+
warningsApi = _context.sent;
|
|
27925
|
+
_context.next = 6;
|
|
27926
|
+
return call(warningsApi.getWarnings);
|
|
27927
|
+
case 6:
|
|
27928
|
+
_yield$call = _context.sent;
|
|
27929
|
+
warnings = _yield$call.data;
|
|
27930
|
+
_context.next = 10;
|
|
27931
|
+
return put(publicWarningActions.fetchWarningsSuccess({
|
|
27932
|
+
warnings: warnings
|
|
27933
|
+
}));
|
|
27934
|
+
case 10:
|
|
27935
|
+
_context.next = 16;
|
|
27936
|
+
break;
|
|
27937
|
+
case 12:
|
|
27938
|
+
_context.prev = 12;
|
|
27939
|
+
_context.t0 = _context["catch"](0);
|
|
27940
|
+
_context.next = 16;
|
|
27941
|
+
return put(publicWarningActions.fetchWarningsError({
|
|
27942
|
+
error: {
|
|
27943
|
+
name: _context.t0.name,
|
|
27944
|
+
message: _context.t0.message
|
|
27945
|
+
}
|
|
27946
|
+
}));
|
|
27947
|
+
case 16:
|
|
27948
|
+
case "end":
|
|
27949
|
+
return _context.stop();
|
|
27950
|
+
}
|
|
27951
|
+
}, _marked, null, [[0, 12]]);
|
|
27952
|
+
}
|
|
27953
|
+
function refetchWarnings() {
|
|
27954
|
+
return _regeneratorRuntime().wrap(function refetchWarnings$(_context2) {
|
|
27955
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
27956
|
+
case 0:
|
|
27957
|
+
_context2.next = 2;
|
|
27958
|
+
return put(publicWarningActions.fetchWarnings());
|
|
27959
|
+
case 2:
|
|
27960
|
+
case "end":
|
|
27961
|
+
return _context2.stop();
|
|
27962
|
+
}
|
|
27963
|
+
}, _marked2);
|
|
27964
|
+
}
|
|
27965
|
+
function publicWarnings() {
|
|
27966
|
+
return _regeneratorRuntime().wrap(function publicWarnings$(_context3) {
|
|
27967
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
27968
|
+
case 0:
|
|
27969
|
+
_context3.next = 2;
|
|
27970
|
+
return takeLatest$1(publicWarningActions.fetchWarnings, fetchWarningsSaga);
|
|
27971
|
+
case 2:
|
|
27972
|
+
_context3.next = 4;
|
|
27973
|
+
return takeLatest$1([publicWarningFormActions.publishWarningSuccess, publicWarningFormActions.saveWarningSuccess], refetchWarnings);
|
|
27974
|
+
case 4:
|
|
27975
|
+
case "end":
|
|
27976
|
+
return _context3.stop();
|
|
27977
|
+
}
|
|
27978
|
+
}, _marked3);
|
|
27979
|
+
}
|
|
27980
|
+
|
|
27746
27981
|
/* *
|
|
27747
27982
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
27748
27983
|
* you may not use this file except in compliance with the License.
|
|
@@ -27762,10 +27997,11 @@ function publicWarningRootSaga() {
|
|
|
27762
27997
|
var drawingModuleConfig = {
|
|
27763
27998
|
id: 'drawing-module',
|
|
27764
27999
|
reducersMap: {
|
|
27765
|
-
drawings: reducer$
|
|
27766
|
-
publicWarningForm: reducer
|
|
28000
|
+
drawings: reducer$2,
|
|
28001
|
+
publicWarningForm: reducer$1,
|
|
28002
|
+
publicWarnings: reducer
|
|
27767
28003
|
},
|
|
27768
|
-
sagas: [drawingSaga, publicWarningRootSaga]
|
|
28004
|
+
sagas: [drawingSaga, publicWarningRootSaga, publicWarnings]
|
|
27769
28005
|
};
|
|
27770
28006
|
|
|
27771
28007
|
export { DIALOG_TITLE, DrawingToolConnect, Wrapper as DrawingToolForm, DrawingToolFormConnect, DrawingToolMapButtonConnect, ObjectManagerConnect, ObjectManagerMapButtonConnect, PublicWarningApiWrapper, PublicWarningsFormDialog, PublicWarningsFormDialogConnect, WarningsModuleProvider, componentsLookUp, drawingModuleConfig, useObjectDrawDialogAction };
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ export declare const CREATE_WARNING = "Create a warning";
|
|
|
5
5
|
export declare const BUTTON_EDIT = "Edit";
|
|
6
6
|
export declare const BUTTON_OPTIONS = "Options";
|
|
7
7
|
export declare const WarningListColumnContent: React.FC<GridProps & {
|
|
8
|
-
title
|
|
8
|
+
title?: string;
|
|
9
9
|
status: PublicWarningStatus;
|
|
10
10
|
children?: React.ReactNode;
|
|
11
11
|
width?: number;
|
|
@@ -15,6 +15,7 @@ export declare const PublicWarningList: React.FC<{
|
|
|
15
15
|
isLoading?: boolean;
|
|
16
16
|
error?: Error;
|
|
17
17
|
onSelectWarning?: (warning: PublicWarning) => void;
|
|
18
|
+
onEditWarning?: (warning: PublicWarning) => void;
|
|
18
19
|
onCreateWarning?: () => void;
|
|
19
20
|
selectedPublicWarningId?: string;
|
|
20
21
|
}>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { PublicWarningDetail } from '../../store/publicWarningForm/types';
|
|
3
3
|
import { BaseDrawingListItem, DrawingListItem } from '../../store/drawings/types';
|
|
4
|
+
import { FormAction } from '../../store/publicWarningForm/reducer';
|
|
4
5
|
export declare const getEmptyPublicWarning: () => PublicWarningDetail;
|
|
5
6
|
export declare const getFormData: (publicWarningsDetails: PublicWarningDetail | undefined, object?: DrawingListItem) => PublicWarningDetail;
|
|
6
7
|
export declare const LABEL_PROBABILITY = "Probability";
|
|
@@ -15,7 +16,6 @@ interface FormData extends PublicWarningDetail {
|
|
|
15
16
|
'translation-select'?: string;
|
|
16
17
|
}
|
|
17
18
|
export declare const prepareFormValues: (data: FormData) => PublicWarningDetail;
|
|
18
|
-
export type FormAction = '' | 'saving' | 'publishing';
|
|
19
19
|
interface FormProps {
|
|
20
20
|
formAction?: FormAction;
|
|
21
21
|
onSaveForm?: (formValues: PublicWarningDetail) => void;
|
|
@@ -23,3 +23,5 @@ export declare const PublicWarningsSavingFormDemo: () => React.ReactElement;
|
|
|
23
23
|
export declare const PublicWarningsSavingFormDemoDark: () => React.ReactElement;
|
|
24
24
|
export declare const PublicWarningsErrorFormDemo: () => React.ReactElement;
|
|
25
25
|
export declare const PublicWarningsErrorFormDemoDark: () => React.ReactElement;
|
|
26
|
+
export declare const PublicWarningsReadOnlyFormDemo: () => React.ReactElement;
|
|
27
|
+
export declare const PublicWarningsReadOnlyFormDemoDark: () => React.ReactElement;
|
|
@@ -39,3 +39,11 @@ export declare const PublicWarningsFormDialogDarkBigError: {
|
|
|
39
39
|
(): React.ReactElement;
|
|
40
40
|
storyName: string;
|
|
41
41
|
};
|
|
42
|
+
export declare const PublicWarningsFormDialogLightReadOnly: {
|
|
43
|
+
(): React.ReactElement;
|
|
44
|
+
storyName: string;
|
|
45
|
+
};
|
|
46
|
+
export declare const PublicWarningsFormDialogDarkReadOnly: {
|
|
47
|
+
(): React.ReactElement;
|
|
48
|
+
storyName: string;
|
|
49
|
+
};
|
|
@@ -2,15 +2,18 @@ import { CoreAppStore } from '@opengeoweb/store';
|
|
|
2
2
|
import drawingSagas from './drawings/sagas';
|
|
3
3
|
import { DrawState } from './drawings/types';
|
|
4
4
|
import { PublicWarningFormState } from './publicWarningForm/reducer';
|
|
5
|
+
import { PublicWarningsState } from './publicWarnings/types';
|
|
5
6
|
export interface WarningModuleStore extends CoreAppStore {
|
|
6
7
|
drawings?: DrawState;
|
|
7
8
|
publicWarningForm?: PublicWarningFormState;
|
|
9
|
+
publicWarnings?: PublicWarningsState;
|
|
8
10
|
}
|
|
9
11
|
export declare const drawingModuleConfig: {
|
|
10
12
|
id: string;
|
|
11
13
|
reducersMap: {
|
|
12
14
|
drawings: import("redux").Reducer<DrawState, import("redux").AnyAction>;
|
|
13
15
|
publicWarningForm: import("redux").Reducer<PublicWarningFormState, import("redux").AnyAction>;
|
|
16
|
+
publicWarnings: import("redux").Reducer<PublicWarningsState, import("redux").AnyAction>;
|
|
14
17
|
};
|
|
15
18
|
sagas: (typeof drawingSagas)[];
|
|
16
19
|
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { PayloadAction, Draft } from '@reduxjs/toolkit';
|
|
2
2
|
import { DrawingListItem } from '../drawings/types';
|
|
3
|
-
import { PublicWarning, PublicWarningDetail } from './types';
|
|
4
|
-
export type FormAction = '' | 'saving' | 'publishing';
|
|
3
|
+
import { PublicWarning, PublicWarningDetail, PublicWarningStatus } from './types';
|
|
4
|
+
export type FormAction = '' | 'saving' | 'publishing' | 'readonly';
|
|
5
5
|
export interface PublicWarningFormState {
|
|
6
6
|
object?: DrawingListItem;
|
|
7
7
|
publicWarningDetail?: PublicWarningDetail;
|
|
8
|
-
|
|
8
|
+
status?: PublicWarningStatus;
|
|
9
|
+
formState?: FormAction;
|
|
9
10
|
error?: string;
|
|
10
11
|
selectedPublicWarningId?: string;
|
|
11
12
|
}
|
|
@@ -15,10 +16,13 @@ export declare const publicWarningFormActions: import("@reduxjs/toolkit").CaseRe
|
|
|
15
16
|
setFormValues: (draft: Draft<PublicWarningFormState>, action: PayloadAction<{
|
|
16
17
|
object?: DrawingListItem;
|
|
17
18
|
publicWarningDetail?: PublicWarningDetail;
|
|
19
|
+
formState?: FormAction;
|
|
18
20
|
}>) => void;
|
|
19
21
|
openPublicWarningFormDialog: (draft: Draft<PublicWarningFormState>, action: PayloadAction<{
|
|
20
22
|
object?: DrawingListItem;
|
|
21
23
|
publicWarningDetail?: PublicWarningDetail;
|
|
24
|
+
formState?: FormAction;
|
|
25
|
+
status?: PublicWarningStatus;
|
|
22
26
|
}>) => void;
|
|
23
27
|
publishWarning: (draft: Draft<PublicWarningFormState>, action: PayloadAction<{
|
|
24
28
|
publicWarning: PublicWarning;
|
|
@@ -11,7 +11,12 @@ export declare const getPublicWarning: ((state: WarningModuleStore) => import(".
|
|
|
11
11
|
}> & {
|
|
12
12
|
clearCache: () => void;
|
|
13
13
|
};
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const getPublicWarningStatus: ((state: WarningModuleStore) => import("./types").PublicWarningStatus | undefined) & import("reselect").OutputSelectorFields<(args_0: PublicWarningFormState) => import("./types").PublicWarningStatus | undefined, {
|
|
15
|
+
clearCache: () => void;
|
|
16
|
+
}> & {
|
|
17
|
+
clearCache: () => void;
|
|
18
|
+
};
|
|
19
|
+
export declare const getPublicWarningFormState: ((state: WarningModuleStore) => "" | "saving" | "publishing" | "readonly") & import("reselect").OutputSelectorFields<(args_0: PublicWarningFormState) => "" | "saving" | "publishing" | "readonly", {
|
|
15
20
|
clearCache: () => void;
|
|
16
21
|
}> & {
|
|
17
22
|
clearCache: () => void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PayloadAction, Draft } from '@reduxjs/toolkit';
|
|
2
|
+
import { PublicWarningsState } from './types';
|
|
3
|
+
import { PublicWarning } from '../publicWarningForm/types';
|
|
4
|
+
export declare const publicWarningsAdapter: import("@reduxjs/toolkit").EntityAdapter<PublicWarning>;
|
|
5
|
+
export declare const initialState: PublicWarningsState;
|
|
6
|
+
export declare const reducer: import("redux").Reducer<PublicWarningsState, import("redux").AnyAction>;
|
|
7
|
+
export declare const publicWarningActions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
8
|
+
fetchWarnings: (draft: Draft<PublicWarningsState>) => void;
|
|
9
|
+
fetchWarningsSuccess: (draft: Draft<PublicWarningsState>, action: PayloadAction<{
|
|
10
|
+
warnings: PublicWarning[];
|
|
11
|
+
}>) => void;
|
|
12
|
+
fetchWarningsError: (draft: Draft<PublicWarningsState>, action: PayloadAction<{
|
|
13
|
+
error: {
|
|
14
|
+
name: string;
|
|
15
|
+
message: string;
|
|
16
|
+
};
|
|
17
|
+
}>) => void;
|
|
18
|
+
}, "publicWarnings">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { PublicWarningsState } from './types';
|
|
2
|
+
import { WarningModuleStore } from '../config';
|
|
3
|
+
export declare const getPublicWarningsStore: (store: WarningModuleStore) => PublicWarningsState;
|
|
4
|
+
export declare const selectAllPublicWarnings: (state: WarningModuleStore) => import("../publicWarningForm/types").PublicWarning[];
|
|
5
|
+
export declare const isPublicWarningsLoading: ((state: WarningModuleStore) => boolean) & import("reselect").OutputSelectorFields<(args_0: PublicWarningsState) => boolean, {
|
|
6
|
+
clearCache: () => void;
|
|
7
|
+
}> & {
|
|
8
|
+
clearCache: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare const getPublicWarningsError: ((state: WarningModuleStore) => import("./types").PublicWarningError | undefined) & import("reselect").OutputSelectorFields<(args_0: PublicWarningsState) => import("./types").PublicWarningError | undefined, {
|
|
11
|
+
clearCache: () => void;
|
|
12
|
+
}> & {
|
|
13
|
+
clearCache: () => void;
|
|
14
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { EntityState } from '@reduxjs/toolkit';
|
|
2
|
+
import { PublicWarning } from '../publicWarningForm/types';
|
|
3
|
+
export type PublicWarningError = {
|
|
4
|
+
name: string;
|
|
5
|
+
message: string;
|
|
6
|
+
};
|
|
7
|
+
export type PublicWarningsState = {
|
|
8
|
+
warnings: EntityState<PublicWarning>;
|
|
9
|
+
isLoading: boolean;
|
|
10
|
+
error?: PublicWarningError;
|
|
11
|
+
};
|