@opengeoweb/warnings 9.6.0 → 9.8.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 +127 -86
- package/package.json +1 -1
- package/src/lib/components/PublicWarningList/PublicWarningListConnect.stories.d.ts +1 -0
- package/src/lib/components/PublicWarningsForm/PublicWarningsForm.d.ts +2 -2
- package/src/lib/components/PublicWarningsFormDialog/PublicWarningsFormDialog.stories.d.ts +8 -0
- package/src/lib/store/publicWarningForm/reducer.d.ts +8 -4
- package/src/lib/store/publicWarningForm/selectors.d.ts +1 -1
package/index.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ import { useDispatch, useSelector } from 'react-redux';
|
|
|
4
4
|
import { Polygons, Share, ExitDomain, Edit, Delete, DrawPolygon, Visibility, Add, Wind, Fog, Lightning, Snow, Rain, TemperatureHigh, FunnelCloud, TemperatureLow, CoastalEvent, breakpoints, Options } from '@opengeoweb/theme';
|
|
5
5
|
import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawtoolSelectors, layerSelectors, uiSelectors, drawtoolActions, mapStoreActions, layerActions, useSetupDialog } from '@opengeoweb/store';
|
|
6
6
|
import { emptyGeoJSON, MapControlButton, getGeoJSONPropertyValue, getIcon, rewindGeometry, currentlySupportedDrawModes } from '@opengeoweb/webmap-react';
|
|
7
|
-
import { useConfirmationDialog, ToggleMenu, dateUtils, calculateStartSize, ToolContainerDraggable, AlertBanner, ConfirmationDialog, getAxiosErrorMessage, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, LastUpdateTime, StatusTag, ErrorBoundary, isAxiosError } from '@opengeoweb/shared';
|
|
7
|
+
import { useConfirmationDialog, ToggleMenu, dateUtils, calculateStartSize, ToolContainerDraggable, AlertBanner, ConfirmationDialog, getAxiosErrorMessage, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, LastUpdateTime, StatusTag, ErrorBoundary, isAxiosError, pollingIntervalTimeout } from '@opengeoweb/shared';
|
|
8
8
|
import { createEntityAdapter, createSlice, createSelector } from '@reduxjs/toolkit';
|
|
9
9
|
import { snackbarActions } from '@opengeoweb/snackbar';
|
|
10
10
|
import { styled, Box, Typography, ListItem, Grid, Paper, ListItemButton, Stack, LinearProgress, Button, FormHelperText, MenuItem, Tabs, Tab, FormControl, Card, CardContent, ListItemIcon, CircularProgress, List } from '@mui/material';
|
|
@@ -15,7 +15,7 @@ import { ReactHookFormProvider, defaultFormOptions, ReactHookFormHiddenInput, is
|
|
|
15
15
|
import { useFormContext } from 'react-hook-form';
|
|
16
16
|
import { clamp } from 'lodash';
|
|
17
17
|
import { useAuthenticationContext } from '@opengeoweb/authentication';
|
|
18
|
-
import { takeLatest, put, call, select } from 'redux-saga/effects';
|
|
18
|
+
import { takeLatest, put, call, select, delay } from 'redux-saga/effects';
|
|
19
19
|
import { isAxiosError as isAxiosError$1 } from 'axios';
|
|
20
20
|
|
|
21
21
|
function _iterableToArrayLimit(r, l) {
|
|
@@ -1528,9 +1528,62 @@ var publicWarningDialogType = uiTypes.DialogTypes.PublicWarnings;
|
|
|
1528
1528
|
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1529
1529
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
1530
1530
|
* */
|
|
1531
|
-
var
|
|
1531
|
+
var publicWarningsAdapter = createEntityAdapter({
|
|
1532
|
+
selectId: function selectId(warning) {
|
|
1533
|
+
return warning.id;
|
|
1534
|
+
}
|
|
1535
|
+
});
|
|
1536
|
+
var initialState$1 = {
|
|
1537
|
+
warnings: publicWarningsAdapter.getInitialState(),
|
|
1538
|
+
isLoading: true,
|
|
1539
|
+
lastUpdatedTime: ''
|
|
1540
|
+
};
|
|
1532
1541
|
var slice$1 = createSlice({
|
|
1533
1542
|
initialState: initialState$1,
|
|
1543
|
+
name: 'publicWarnings',
|
|
1544
|
+
reducers: {
|
|
1545
|
+
fetchWarnings: function fetchWarnings(draft) {
|
|
1546
|
+
draft.isLoading = true;
|
|
1547
|
+
delete draft.error;
|
|
1548
|
+
},
|
|
1549
|
+
fetchWarningsSuccess: function fetchWarningsSuccess(draft, action) {
|
|
1550
|
+
var _action$payload = action.payload,
|
|
1551
|
+
warnings = _action$payload.warnings,
|
|
1552
|
+
lastUpdatedTime = _action$payload.lastUpdatedTime;
|
|
1553
|
+
draft.isLoading = false;
|
|
1554
|
+
draft.lastUpdatedTime = lastUpdatedTime;
|
|
1555
|
+
publicWarningsAdapter.setAll(draft.warnings, warnings);
|
|
1556
|
+
},
|
|
1557
|
+
fetchWarningsError: function fetchWarningsError(draft, action) {
|
|
1558
|
+
var error = action.payload.error;
|
|
1559
|
+
draft.isLoading = false;
|
|
1560
|
+
draft.error = error;
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
});
|
|
1564
|
+
var reducer$1 = slice$1.reducer;
|
|
1565
|
+
var publicWarningActions = slice$1.actions;
|
|
1566
|
+
|
|
1567
|
+
/* *
|
|
1568
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1569
|
+
* you may not use this file except in compliance with the License.
|
|
1570
|
+
* You may obtain a copy of the License at
|
|
1571
|
+
*
|
|
1572
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1573
|
+
*
|
|
1574
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1575
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1576
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1577
|
+
* See the License for the specific language governing permissions and
|
|
1578
|
+
* limitations under the License.
|
|
1579
|
+
*
|
|
1580
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1581
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
1582
|
+
* */
|
|
1583
|
+
var TAKEOVER_MESSAGE = 'You are no longer the editor of this warning';
|
|
1584
|
+
var initialState = {};
|
|
1585
|
+
var slice = createSlice({
|
|
1586
|
+
initialState: initialState,
|
|
1534
1587
|
name: 'publicWarningForm',
|
|
1535
1588
|
reducers: {
|
|
1536
1589
|
setFormValues: function setFormValues(draft, action) {
|
|
@@ -1562,7 +1615,7 @@ var slice$1 = createSlice({
|
|
|
1562
1615
|
toggleEditorWarning: function toggleEditorWarning(draft,
|
|
1563
1616
|
// eslint-disable-next-line no-unused-vars
|
|
1564
1617
|
action) {
|
|
1565
|
-
draft.error
|
|
1618
|
+
delete draft.error;
|
|
1566
1619
|
},
|
|
1567
1620
|
toggleEditorWarningSuccess: function toggleEditorWarningSuccess(draft, action) {
|
|
1568
1621
|
var _action$payload3 = action.payload,
|
|
@@ -1578,7 +1631,7 @@ var slice$1 = createSlice({
|
|
|
1578
1631
|
// eslint-disable-next-line no-unused-vars
|
|
1579
1632
|
action) {
|
|
1580
1633
|
draft.formState = 'publishing';
|
|
1581
|
-
draft.error
|
|
1634
|
+
delete draft.error;
|
|
1582
1635
|
},
|
|
1583
1636
|
publishWarningSuccess: function publishWarningSuccess(draft, action) {
|
|
1584
1637
|
var publicWarning = action.payload.publicWarning;
|
|
@@ -1591,7 +1644,7 @@ var slice$1 = createSlice({
|
|
|
1591
1644
|
// eslint-disable-next-line no-unused-vars
|
|
1592
1645
|
action) {
|
|
1593
1646
|
draft.formState = 'saving';
|
|
1594
|
-
draft.error
|
|
1647
|
+
delete draft.error;
|
|
1595
1648
|
draft.publicWarning = action.payload.publicWarning;
|
|
1596
1649
|
},
|
|
1597
1650
|
saveWarningSuccess: function saveWarningSuccess(draft, action) {
|
|
@@ -1604,9 +1657,15 @@ var slice$1 = createSlice({
|
|
|
1604
1657
|
draft.formState = '';
|
|
1605
1658
|
},
|
|
1606
1659
|
setFormError: function setFormError(draft, action) {
|
|
1607
|
-
var
|
|
1660
|
+
var _action$payload4 = action.payload,
|
|
1661
|
+
message = _action$payload4.message,
|
|
1662
|
+
_action$payload4$seve = _action$payload4.severity,
|
|
1663
|
+
severity = _action$payload4$seve === void 0 ? 'error' : _action$payload4$seve;
|
|
1608
1664
|
draft.formState = '';
|
|
1609
|
-
draft.error =
|
|
1665
|
+
draft.error = {
|
|
1666
|
+
severity: severity,
|
|
1667
|
+
message: message
|
|
1668
|
+
};
|
|
1610
1669
|
},
|
|
1611
1670
|
setFormDirty: function setFormDirty(draft, action) {
|
|
1612
1671
|
var isFormDirty = action.payload.isFormDirty;
|
|
@@ -1615,9 +1674,9 @@ var slice$1 = createSlice({
|
|
|
1615
1674
|
},
|
|
1616
1675
|
extraReducers: function extraReducers(builder) {
|
|
1617
1676
|
builder.addCase(uiActions.setToggleOpenDialog, function (draft, action) {
|
|
1618
|
-
var _action$
|
|
1619
|
-
type = _action$
|
|
1620
|
-
setOpen = _action$
|
|
1677
|
+
var _action$payload5 = action.payload,
|
|
1678
|
+
type = _action$payload5.type,
|
|
1679
|
+
setOpen = _action$payload5.setOpen;
|
|
1621
1680
|
if (type === publicWarningDialogType && setOpen === false) {
|
|
1622
1681
|
delete draft.object;
|
|
1623
1682
|
delete draft.publicWarning;
|
|
@@ -1626,11 +1685,29 @@ var slice$1 = createSlice({
|
|
|
1626
1685
|
delete draft.selectedPublicWarningId;
|
|
1627
1686
|
delete draft.isFormDirty;
|
|
1628
1687
|
}
|
|
1688
|
+
}).addCase(publicWarningActions.fetchWarningsSuccess, function (draft, action) {
|
|
1689
|
+
var _a;
|
|
1690
|
+
var warnings = action.payload.warnings;
|
|
1691
|
+
if (draft.selectedPublicWarningId) {
|
|
1692
|
+
var currentWarning = warnings.find(function (warning) {
|
|
1693
|
+
return warning.id === draft.selectedPublicWarningId;
|
|
1694
|
+
});
|
|
1695
|
+
if (((_a = draft.publicWarning) === null || _a === void 0 ? void 0 : _a.editor) !== (currentWarning === null || currentWarning === void 0 ? void 0 : currentWarning.editor)) {
|
|
1696
|
+
draft.publicWarning.editor = currentWarning === null || currentWarning === void 0 ? void 0 : currentWarning.editor;
|
|
1697
|
+
// if form is in edit mode show warning
|
|
1698
|
+
if (draft.formState === '') {
|
|
1699
|
+
draft.error = {
|
|
1700
|
+
severity: 'warning',
|
|
1701
|
+
message: TAKEOVER_MESSAGE
|
|
1702
|
+
};
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1629
1706
|
});
|
|
1630
1707
|
}
|
|
1631
1708
|
});
|
|
1632
|
-
var reducer
|
|
1633
|
-
var publicWarningFormActions = slice
|
|
1709
|
+
var reducer = slice.reducer;
|
|
1710
|
+
var publicWarningFormActions = slice.actions;
|
|
1634
1711
|
|
|
1635
1712
|
var getDeleteSucces = function getDeleteSucces(objectName) {
|
|
1636
1713
|
return "".concat(objectName, " has been deleted");
|
|
@@ -5394,7 +5471,10 @@ var Form = function Form(_ref5) {
|
|
|
5394
5471
|
formAction = _ref5$formAction === void 0 ? '' : _ref5$formAction,
|
|
5395
5472
|
publicWarningDetails = _ref5.publicWarningDetails,
|
|
5396
5473
|
_ref5$error = _ref5.error,
|
|
5397
|
-
error = _ref5$error === void 0 ?
|
|
5474
|
+
error = _ref5$error === void 0 ? {
|
|
5475
|
+
severity: 'error',
|
|
5476
|
+
message: ''
|
|
5477
|
+
} : _ref5$error,
|
|
5398
5478
|
_ref5$isReadOnly = _ref5.isReadOnly,
|
|
5399
5479
|
isReadOnly = _ref5$isReadOnly === void 0 ? false : _ref5$isReadOnly,
|
|
5400
5480
|
_ref5$onFormDirty = _ref5.onFormDirty,
|
|
@@ -5412,7 +5492,7 @@ var Form = function Form(_ref5) {
|
|
|
5412
5492
|
useFormDirty({
|
|
5413
5493
|
isDirty: isDirty,
|
|
5414
5494
|
isLoading: isPublishing || isSaving,
|
|
5415
|
-
error: error,
|
|
5495
|
+
error: error === null || error === void 0 ? void 0 : error.message,
|
|
5416
5496
|
onFormDirty: onFormDirty,
|
|
5417
5497
|
onSuccess: function onSuccess() {
|
|
5418
5498
|
// reset form dirty after successfull saving
|
|
@@ -5464,7 +5544,7 @@ var Form = function Form(_ref5) {
|
|
|
5464
5544
|
// sync redux with react-hook-form
|
|
5465
5545
|
reset(getFormData(publicWarningDetails, object));
|
|
5466
5546
|
}, [object, reset, publicWarningDetails]);
|
|
5467
|
-
var errors = getErrors(error);
|
|
5547
|
+
var errors = getErrors(error.message);
|
|
5468
5548
|
return /*#__PURE__*/React.createElement(ContainerWrapper, null, /*#__PURE__*/React.createElement(ContainerFormWrapper, {
|
|
5469
5549
|
isReadOnly: isReadOnly
|
|
5470
5550
|
}, /*#__PURE__*/React.createElement(ContainerGrid, null, errors && ( /*#__PURE__*/React.createElement(Box, {
|
|
@@ -5474,7 +5554,8 @@ var Form = function Form(_ref5) {
|
|
|
5474
5554
|
}, /*#__PURE__*/React.createElement(AlertBanner, {
|
|
5475
5555
|
title: errors.title,
|
|
5476
5556
|
info: errors.errors,
|
|
5477
|
-
shouldClose: true
|
|
5557
|
+
shouldClose: true,
|
|
5558
|
+
severity: error === null || error === void 0 ? void 0 : error.severity
|
|
5478
5559
|
}))), /*#__PURE__*/React.createElement(Grid, {
|
|
5479
5560
|
container: true,
|
|
5480
5561
|
rowSpacing: 2
|
|
@@ -5672,7 +5753,7 @@ var getPublicWarningFormState = createSelector(getPublicWarningStore, function (
|
|
|
5672
5753
|
return (publicWarningStore === null || publicWarningStore === void 0 ? void 0 : publicWarningStore.formState) || '';
|
|
5673
5754
|
});
|
|
5674
5755
|
var getPublicWarningFormError = createSelector(getPublicWarningStore, function (publicWarningStore) {
|
|
5675
|
-
return
|
|
5756
|
+
return publicWarningStore === null || publicWarningStore === void 0 ? void 0 : publicWarningStore.error;
|
|
5676
5757
|
});
|
|
5677
5758
|
var getSelectedPublicWarningId = createSelector(getPublicWarningStore, function (publicWarningStore) {
|
|
5678
5759
|
return (publicWarningStore === null || publicWarningStore === void 0 ? void 0 : publicWarningStore.selectedPublicWarningId) || '';
|
|
@@ -6299,58 +6380,6 @@ var PublicWarningList = function PublicWarningList(_ref2) {
|
|
|
6299
6380
|
}))));
|
|
6300
6381
|
};
|
|
6301
6382
|
|
|
6302
|
-
/* *
|
|
6303
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6304
|
-
* you may not use this file except in compliance with the License.
|
|
6305
|
-
* You may obtain a copy of the License at
|
|
6306
|
-
*
|
|
6307
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6308
|
-
*
|
|
6309
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
6310
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6311
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6312
|
-
* See the License for the specific language governing permissions and
|
|
6313
|
-
* limitations under the License.
|
|
6314
|
-
*
|
|
6315
|
-
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
6316
|
-
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
6317
|
-
* */
|
|
6318
|
-
var publicWarningsAdapter = createEntityAdapter({
|
|
6319
|
-
selectId: function selectId(warning) {
|
|
6320
|
-
return warning.id;
|
|
6321
|
-
}
|
|
6322
|
-
});
|
|
6323
|
-
var initialState = {
|
|
6324
|
-
warnings: publicWarningsAdapter.getInitialState(),
|
|
6325
|
-
isLoading: true,
|
|
6326
|
-
lastUpdatedTime: ''
|
|
6327
|
-
};
|
|
6328
|
-
var slice = createSlice({
|
|
6329
|
-
initialState: initialState,
|
|
6330
|
-
name: 'publicWarnings',
|
|
6331
|
-
reducers: {
|
|
6332
|
-
fetchWarnings: function fetchWarnings(draft) {
|
|
6333
|
-
draft.isLoading = true;
|
|
6334
|
-
delete draft.error;
|
|
6335
|
-
},
|
|
6336
|
-
fetchWarningsSuccess: function fetchWarningsSuccess(draft, action) {
|
|
6337
|
-
var _action$payload = action.payload,
|
|
6338
|
-
warnings = _action$payload.warnings,
|
|
6339
|
-
lastUpdatedTime = _action$payload.lastUpdatedTime;
|
|
6340
|
-
draft.isLoading = false;
|
|
6341
|
-
draft.lastUpdatedTime = lastUpdatedTime;
|
|
6342
|
-
publicWarningsAdapter.setAll(draft.warnings, warnings);
|
|
6343
|
-
},
|
|
6344
|
-
fetchWarningsError: function fetchWarningsError(draft, action) {
|
|
6345
|
-
var error = action.payload.error;
|
|
6346
|
-
draft.isLoading = false;
|
|
6347
|
-
draft.error = error;
|
|
6348
|
-
}
|
|
6349
|
-
}
|
|
6350
|
-
});
|
|
6351
|
-
var reducer = slice.reducer;
|
|
6352
|
-
var publicWarningActions = slice.actions;
|
|
6353
|
-
|
|
6354
6383
|
/* *
|
|
6355
6384
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6356
6385
|
* you may not use this file except in compliance with the License.
|
|
@@ -6802,7 +6831,7 @@ function toggleEditorWarningSaga(_ref) {
|
|
|
6802
6831
|
return call(warningsApi.toggleEditorWarning, warningId, isEditor);
|
|
6803
6832
|
case 7:
|
|
6804
6833
|
_context2.next = 9;
|
|
6805
|
-
return put(publicWarningActions.fetchWarnings);
|
|
6834
|
+
return put(publicWarningActions.fetchWarnings());
|
|
6806
6835
|
case 9:
|
|
6807
6836
|
_context2.next = 11;
|
|
6808
6837
|
return put(publicWarningFormActions.toggleEditorWarningSuccess({
|
|
@@ -6844,18 +6873,24 @@ function publishWarningSaga(_ref2) {
|
|
|
6844
6873
|
message: PUBLISH_SUCCES
|
|
6845
6874
|
}));
|
|
6846
6875
|
case 7:
|
|
6847
|
-
_context3.next =
|
|
6848
|
-
|
|
6876
|
+
_context3.next = 9;
|
|
6877
|
+
return put(uiActions.setToggleOpenDialog({
|
|
6878
|
+
type: publicWarningDialogType,
|
|
6879
|
+
setOpen: false
|
|
6880
|
+
}));
|
|
6849
6881
|
case 9:
|
|
6850
|
-
_context3.
|
|
6882
|
+
_context3.next = 15;
|
|
6883
|
+
break;
|
|
6884
|
+
case 11:
|
|
6885
|
+
_context3.prev = 11;
|
|
6851
6886
|
_context3.t0 = _context3["catch"](0);
|
|
6852
|
-
_context3.next =
|
|
6887
|
+
_context3.next = 15;
|
|
6853
6888
|
return call(errorSaga, getErrorMessage(_context3.t0));
|
|
6854
|
-
case
|
|
6889
|
+
case 15:
|
|
6855
6890
|
case "end":
|
|
6856
6891
|
return _context3.stop();
|
|
6857
6892
|
}
|
|
6858
|
-
}, _callee2, null, [[0,
|
|
6893
|
+
}, _callee2, null, [[0, 11]]);
|
|
6859
6894
|
})();
|
|
6860
6895
|
}
|
|
6861
6896
|
function saveWarningSaga(_ref3) {
|
|
@@ -6919,7 +6954,7 @@ function errorSaga(message) {
|
|
|
6919
6954
|
case 0:
|
|
6920
6955
|
_context6.next = 2;
|
|
6921
6956
|
return put(publicWarningFormActions.setFormError({
|
|
6922
|
-
|
|
6957
|
+
message: message
|
|
6923
6958
|
}));
|
|
6924
6959
|
case 2:
|
|
6925
6960
|
_context6.next = 4;
|
|
@@ -7025,23 +7060,29 @@ function fetchWarningsSaga() {
|
|
|
7025
7060
|
lastUpdatedTime: lastUpdatedTime
|
|
7026
7061
|
}));
|
|
7027
7062
|
case 11:
|
|
7028
|
-
_context.next =
|
|
7029
|
-
|
|
7063
|
+
_context.next = 13;
|
|
7064
|
+
return delay(pollingIntervalTimeout);
|
|
7030
7065
|
case 13:
|
|
7031
|
-
_context.
|
|
7066
|
+
_context.next = 15;
|
|
7067
|
+
return put(publicWarningActions.fetchWarnings());
|
|
7068
|
+
case 15:
|
|
7069
|
+
_context.next = 21;
|
|
7070
|
+
break;
|
|
7071
|
+
case 17:
|
|
7072
|
+
_context.prev = 17;
|
|
7032
7073
|
_context.t0 = _context["catch"](0);
|
|
7033
|
-
_context.next =
|
|
7074
|
+
_context.next = 21;
|
|
7034
7075
|
return put(publicWarningActions.fetchWarningsError({
|
|
7035
7076
|
error: {
|
|
7036
7077
|
name: _context.t0.name,
|
|
7037
7078
|
message: _context.t0.message
|
|
7038
7079
|
}
|
|
7039
7080
|
}));
|
|
7040
|
-
case
|
|
7081
|
+
case 21:
|
|
7041
7082
|
case "end":
|
|
7042
7083
|
return _context.stop();
|
|
7043
7084
|
}
|
|
7044
|
-
}, _marked, null, [[0,
|
|
7085
|
+
}, _marked, null, [[0, 17]]);
|
|
7045
7086
|
}
|
|
7046
7087
|
function refetchWarnings() {
|
|
7047
7088
|
return _regeneratorRuntime().wrap(function refetchWarnings$(_context2) {
|
|
@@ -7091,8 +7132,8 @@ var drawingModuleConfig = {
|
|
|
7091
7132
|
id: 'drawing-module',
|
|
7092
7133
|
reducersMap: {
|
|
7093
7134
|
drawings: reducer$2,
|
|
7094
|
-
publicWarningForm: reducer
|
|
7095
|
-
publicWarnings: reducer
|
|
7135
|
+
publicWarningForm: reducer,
|
|
7136
|
+
publicWarnings: reducer$1
|
|
7096
7137
|
},
|
|
7097
7138
|
sagas: [drawingSaga, publicWarningRootSaga, publicWarnings]
|
|
7098
7139
|
};
|
package/package.json
CHANGED
|
@@ -7,3 +7,4 @@ export declare const PublicWarningListLight: () => React.ReactElement;
|
|
|
7
7
|
export declare const PublicWarningListDark: () => React.ReactElement;
|
|
8
8
|
export declare const PublicWarningListError: () => React.ReactElement;
|
|
9
9
|
export declare const PublicWarningListErrorDeleteWarning: () => React.ReactElement;
|
|
10
|
+
export declare const PublicWarningListDifferentEditors: () => React.ReactElement;
|
|
@@ -1,7 +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
|
+
import { FormAction, FormError } from '../../store/publicWarningForm/reducer';
|
|
5
5
|
export declare const getEmptyPublicWarning: () => PublicWarningDetail;
|
|
6
6
|
export declare const getFormData: (publicWarningsDetails: PublicWarningDetail | undefined, object?: DrawingListItem) => PublicWarningDetail;
|
|
7
7
|
export declare const LABEL_PROBABILITY = "Probability";
|
|
@@ -22,7 +22,7 @@ interface FormProps {
|
|
|
22
22
|
onPublishForm?: (formValues: PublicWarningDetail) => void;
|
|
23
23
|
object?: DrawingListItem;
|
|
24
24
|
publicWarningDetails?: PublicWarningDetail;
|
|
25
|
-
error?:
|
|
25
|
+
error?: FormError;
|
|
26
26
|
isReadOnly?: boolean;
|
|
27
27
|
onFormDirty?: (isFormDirty: boolean) => void;
|
|
28
28
|
}
|
|
@@ -47,3 +47,11 @@ export declare const PublicWarningsFormDialogDarkReadOnly: {
|
|
|
47
47
|
(): React.ReactElement;
|
|
48
48
|
storyName: string;
|
|
49
49
|
};
|
|
50
|
+
export declare const PublicWarningsFormDialogLightTakeoverWarning: {
|
|
51
|
+
(): React.ReactElement;
|
|
52
|
+
storyName: string;
|
|
53
|
+
};
|
|
54
|
+
export declare const PublicWarningsFormDialogDarkTakeoverWarning: {
|
|
55
|
+
(): React.ReactElement;
|
|
56
|
+
storyName: string;
|
|
57
|
+
};
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { PayloadAction, Draft } from '@reduxjs/toolkit';
|
|
2
|
+
import { AlertColor } from '@mui/material';
|
|
2
3
|
import { DrawingListItem } from '../drawings/types';
|
|
3
4
|
import { PublicWarning } from './types';
|
|
4
5
|
export type FormAction = '' | 'saving' | 'publishing' | 'readonly';
|
|
6
|
+
export type FormError = {
|
|
7
|
+
severity?: AlertColor;
|
|
8
|
+
message: string;
|
|
9
|
+
};
|
|
5
10
|
export interface PublicWarningFormState {
|
|
6
11
|
object?: DrawingListItem;
|
|
7
12
|
publicWarning?: PublicWarning;
|
|
8
13
|
formState?: FormAction;
|
|
9
|
-
error?:
|
|
14
|
+
error?: FormError;
|
|
10
15
|
selectedPublicWarningId?: string;
|
|
11
16
|
isFormDirty?: boolean;
|
|
12
17
|
}
|
|
18
|
+
export declare const TAKEOVER_MESSAGE = "You are no longer the editor of this warning";
|
|
13
19
|
export declare const initialState: PublicWarningFormState;
|
|
14
20
|
export declare const reducer: import("redux").Reducer<PublicWarningFormState, import("redux").AnyAction>;
|
|
15
21
|
export declare const publicWarningFormActions: import("@reduxjs/toolkit").CaseReducerActions<{
|
|
@@ -47,9 +53,7 @@ export declare const publicWarningFormActions: import("@reduxjs/toolkit").CaseRe
|
|
|
47
53
|
publicWarning: PublicWarning;
|
|
48
54
|
message: string;
|
|
49
55
|
}>) => void;
|
|
50
|
-
setFormError: (draft: Draft<PublicWarningFormState>, action: PayloadAction<
|
|
51
|
-
error: string;
|
|
52
|
-
}>) => void;
|
|
56
|
+
setFormError: (draft: Draft<PublicWarningFormState>, action: PayloadAction<FormError>) => void;
|
|
53
57
|
setFormDirty: (draft: Draft<PublicWarningFormState>, action: PayloadAction<{
|
|
54
58
|
isFormDirty: boolean;
|
|
55
59
|
}>) => void;
|
|
@@ -26,7 +26,7 @@ export declare const getPublicWarningFormState: ((state: WarningModuleStore) =>
|
|
|
26
26
|
}> & {
|
|
27
27
|
clearCache: () => void;
|
|
28
28
|
};
|
|
29
|
-
export declare const getPublicWarningFormError: ((state: WarningModuleStore) =>
|
|
29
|
+
export declare const getPublicWarningFormError: ((state: WarningModuleStore) => import("./reducer").FormError | undefined) & import("reselect").OutputSelectorFields<(args_0: PublicWarningFormState) => import("./reducer").FormError | undefined, {
|
|
30
30
|
clearCache: () => void;
|
|
31
31
|
}> & {
|
|
32
32
|
clearCache: () => void;
|