@opengeoweb/warnings 9.3.1 → 9.4.1
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 +217 -66
- package/package.json +1 -1
- package/src/lib/components/PublicWarningList/ConfirmDeleteWarningDialog.d.ts +11 -0
- package/src/lib/components/PublicWarningList/ConfirmDeleteWarningDialog.spec.d.ts +1 -0
- package/src/lib/components/PublicWarningList/PublicWarningList.d.ts +2 -0
- package/src/lib/components/PublicWarningList/PublicWarningListConnect.d.ts +1 -0
- package/src/lib/components/PublicWarningList/PublicWarningListConnect.stories.d.ts +1 -0
- package/src/lib/store/publicWarningForm/types.d.ts +1 -0
- package/src/lib/utils/api.d.ts +2 -0
- package/src/lib/utils/fakeApi.d.ts +1 -0
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,
|
|
7
|
+
import { useConfirmationDialog, ToggleMenu, dateUtils, calculateStartSize, ToolContainerDraggable, AlertBanner, ConfirmationDialog, getAxiosErrorMessage, usePrevious, CustomIconButton, SwitchButton, StatusTag, ErrorBoundary, isAxiosError } 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';
|
|
@@ -962,7 +962,7 @@ var HEADER_ITEM_SIZE = 28;
|
|
|
962
962
|
var BREAKPOINT = 320;
|
|
963
963
|
var NO_OBJECTS_FOUND = 'No objects found';
|
|
964
964
|
var BUTTON_EDIT$2 = 'Edit';
|
|
965
|
-
var BUTTON_DELETE$
|
|
965
|
+
var BUTTON_DELETE$2 = 'Delete';
|
|
966
966
|
var BUTTON_SHARE = 'Share';
|
|
967
967
|
var BUTTON_AIRMET = 'AIRMET';
|
|
968
968
|
var BUTTON_SIGMET = 'SIGMET';
|
|
@@ -973,8 +973,7 @@ var getListInclHeaders = function getListInclHeaders(objects) {
|
|
|
973
973
|
var headerList = [];
|
|
974
974
|
// Construct list incl day headers
|
|
975
975
|
objects.forEach(function (object, index) {
|
|
976
|
-
var
|
|
977
|
-
var header = dateUtils.dateToString(objectDate, DATE_FORMAT_HEADER, true);
|
|
976
|
+
var header = dateUtils.dateToString(dateUtils.utc(object.lastUpdatedTime), DATE_FORMAT_HEADER);
|
|
978
977
|
var isNewDay = !headerList.find(function (item) {
|
|
979
978
|
return item === header;
|
|
980
979
|
});
|
|
@@ -1111,7 +1110,6 @@ var Objects = function Objects(_ref2) {
|
|
|
1111
1110
|
}, header);
|
|
1112
1111
|
}
|
|
1113
1112
|
var object = objects[listItem.index];
|
|
1114
|
-
var objectDate = dateUtils.isoStringToDate(object.lastUpdatedTime);
|
|
1115
1113
|
return /*#__PURE__*/React__default.createElement(ContainerDiv, null, /*#__PURE__*/React__default.createElement(ListItem, {
|
|
1116
1114
|
style: style,
|
|
1117
1115
|
disablePadding: true,
|
|
@@ -1167,7 +1165,7 @@ var Objects = function Objects(_ref2) {
|
|
|
1167
1165
|
},
|
|
1168
1166
|
icon: /*#__PURE__*/React__default.createElement(Edit, null)
|
|
1169
1167
|
}, {
|
|
1170
|
-
text: BUTTON_DELETE$
|
|
1168
|
+
text: BUTTON_DELETE$2,
|
|
1171
1169
|
action: function action() {
|
|
1172
1170
|
onClickDelete(object.id);
|
|
1173
1171
|
},
|
|
@@ -1207,7 +1205,7 @@ var Objects = function Objects(_ref2) {
|
|
|
1207
1205
|
maxHeight: '32px',
|
|
1208
1206
|
overflow: 'hidden'
|
|
1209
1207
|
}
|
|
1210
|
-
}, object.scope === 'global' && 'Global: ', dateUtils.dateToString(
|
|
1208
|
+
}, object.scope === 'global' && 'Global: ', "".concat(dateUtils.dateToString(dateUtils.utc(object.lastUpdatedTime), DATE_FORMAT), " UTC")))))));
|
|
1211
1209
|
})));
|
|
1212
1210
|
});
|
|
1213
1211
|
};
|
|
@@ -1397,8 +1395,14 @@ var getApiRoutes$1 = function getApiRoutes(axiosInstance) {
|
|
|
1397
1395
|
return getIdFromUrl(headerLocation);
|
|
1398
1396
|
});
|
|
1399
1397
|
},
|
|
1400
|
-
updateWarning: function updateWarning(
|
|
1401
|
-
return axiosInstance.post("/warnings/".concat(
|
|
1398
|
+
updateWarning: function updateWarning(warningId, data) {
|
|
1399
|
+
return axiosInstance.post("/warnings/".concat(warningId, "/"), data);
|
|
1400
|
+
},
|
|
1401
|
+
deleteWarning: function deleteWarning(warningId) {
|
|
1402
|
+
return axiosInstance.post("/warnings/".concat(warningId, "?delete=true"));
|
|
1403
|
+
},
|
|
1404
|
+
toggleEditorWarning: function toggleEditorWarning(warningId, isEditor) {
|
|
1405
|
+
return axiosInstance.post("/warnings/".concat(warningId, "?editor=").concat(isEditor ? 'true' : 'false'));
|
|
1402
1406
|
}
|
|
1403
1407
|
};
|
|
1404
1408
|
};
|
|
@@ -1411,10 +1415,10 @@ var createApi$1 = function createApi(props) {
|
|
|
1411
1415
|
return getApiRoutes$1(props.auth ? authInstance : nonAuthInstance);
|
|
1412
1416
|
};
|
|
1413
1417
|
|
|
1414
|
-
var DELETE_TITLE = 'Delete object';
|
|
1415
|
-
var DELETE_CONFIRM = 'Delete';
|
|
1416
|
-
var CANCEL = 'Cancel';
|
|
1417
|
-
var getDeleteDescription = function getDeleteDescription(objectName) {
|
|
1418
|
+
var DELETE_TITLE$1 = 'Delete object';
|
|
1419
|
+
var DELETE_CONFIRM$1 = 'Delete';
|
|
1420
|
+
var CANCEL$1 = 'Cancel';
|
|
1421
|
+
var getDeleteDescription$1 = function getDeleteDescription(objectName) {
|
|
1418
1422
|
return "Are you sure you want to delete \"".concat(objectName, "\"?");
|
|
1419
1423
|
};
|
|
1420
1424
|
var ConfirmDeleteDialog = function ConfirmDeleteDialog(_ref) {
|
|
@@ -1459,12 +1463,12 @@ var ConfirmDeleteDialog = function ConfirmDeleteDialog(_ref) {
|
|
|
1459
1463
|
}, _callee, null, [[1, 8]]);
|
|
1460
1464
|
}));
|
|
1461
1465
|
};
|
|
1462
|
-
var description = getDeleteDescription(objectName);
|
|
1466
|
+
var description = getDeleteDescription$1(objectName);
|
|
1463
1467
|
return /*#__PURE__*/React__default.createElement(ConfirmationDialog, Object.assign({
|
|
1464
|
-
title: DELETE_TITLE,
|
|
1468
|
+
title: DELETE_TITLE$1,
|
|
1465
1469
|
open: true,
|
|
1466
|
-
confirmLabel: DELETE_CONFIRM,
|
|
1467
|
-
cancelLabel: CANCEL,
|
|
1470
|
+
confirmLabel: DELETE_CONFIRM$1,
|
|
1471
|
+
cancelLabel: CANCEL$1,
|
|
1468
1472
|
description: !error ? description : '',
|
|
1469
1473
|
onClose: onClose,
|
|
1470
1474
|
onSubmit: onSubmit,
|
|
@@ -1543,7 +1547,6 @@ var slice$1 = createSlice({
|
|
|
1543
1547
|
}
|
|
1544
1548
|
},
|
|
1545
1549
|
openPublicWarningFormDialog: function openPublicWarningFormDialog(draft, action) {
|
|
1546
|
-
var _a;
|
|
1547
1550
|
var _action$payload2 = action.payload,
|
|
1548
1551
|
object = _action$payload2.object,
|
|
1549
1552
|
publicWarning = _action$payload2.publicWarning,
|
|
@@ -1551,7 +1554,7 @@ var slice$1 = createSlice({
|
|
|
1551
1554
|
formState = _action$payload2$form === void 0 ? '' : _action$payload2$form;
|
|
1552
1555
|
draft.object = object;
|
|
1553
1556
|
draft.publicWarning = publicWarning;
|
|
1554
|
-
draft.selectedPublicWarningId =
|
|
1557
|
+
draft.selectedPublicWarningId = publicWarning === null || publicWarning === void 0 ? void 0 : publicWarning.id;
|
|
1555
1558
|
draft.formState = formState;
|
|
1556
1559
|
},
|
|
1557
1560
|
// publish warning
|
|
@@ -1867,7 +1870,7 @@ var drawingListJSON = [
|
|
|
1867
1870
|
{
|
|
1868
1871
|
id: "923723984872338768743",
|
|
1869
1872
|
objectName: "Drawing object 101",
|
|
1870
|
-
lastUpdatedTime: "2022-06-
|
|
1873
|
+
lastUpdatedTime: "2022-06-01T23:00:00Z",
|
|
1871
1874
|
scope: "user",
|
|
1872
1875
|
geoJSON: {
|
|
1873
1876
|
type: "FeatureCollection",
|
|
@@ -2706,7 +2709,7 @@ var drawingsListFullContentJSON = [
|
|
|
2706
2709
|
var warningListJSON = [
|
|
2707
2710
|
{
|
|
2708
2711
|
id: "b6daea16-46db-497a-865e-9e7320ad8d12",
|
|
2709
|
-
lastUpdatedTime: "2023-12-06T06:56:
|
|
2712
|
+
lastUpdatedTime: "2023-12-06T06:56:39Z",
|
|
2710
2713
|
status: "TODO",
|
|
2711
2714
|
warningDetail: {
|
|
2712
2715
|
id: "b6daea16-46db-497a-865e-9e7320ad8d12",
|
|
@@ -2791,8 +2794,8 @@ var warningListJSON = [
|
|
|
2791
2794
|
}
|
|
2792
2795
|
]
|
|
2793
2796
|
},
|
|
2794
|
-
validFrom: "2023-12-19T00:00:
|
|
2795
|
-
validUntil: "2023-12-20T00:00:
|
|
2797
|
+
validFrom: "2023-12-19T00:00:00Z",
|
|
2798
|
+
validUntil: "2023-12-20T00:00:00Z",
|
|
2796
2799
|
level: "moderate",
|
|
2797
2800
|
domain: "public",
|
|
2798
2801
|
warningProposalSource: "PASCAL-ECMWF-EPS",
|
|
@@ -2802,7 +2805,7 @@ var warningListJSON = [
|
|
|
2802
2805
|
},
|
|
2803
2806
|
{
|
|
2804
2807
|
id: "bcbb6f28-235c-495f-b1a3-976c49079ca0",
|
|
2805
|
-
lastUpdatedTime: "2023-12-06T06:56:
|
|
2808
|
+
lastUpdatedTime: "2023-12-06T06:56:39Z",
|
|
2806
2809
|
status: "TODO",
|
|
2807
2810
|
warningDetail: {
|
|
2808
2811
|
id: "bcbb6f28-235c-495f-b1a3-976c49079ca0",
|
|
@@ -2919,8 +2922,8 @@ var warningListJSON = [
|
|
|
2919
2922
|
}
|
|
2920
2923
|
]
|
|
2921
2924
|
},
|
|
2922
|
-
validFrom: "2023-12-19T00:00:
|
|
2923
|
-
validUntil: "2023-12-20T00:00:
|
|
2925
|
+
validFrom: "2023-12-19T00:00:00Z",
|
|
2926
|
+
validUntil: "2023-12-20T00:00:00Z",
|
|
2924
2927
|
level: "moderate",
|
|
2925
2928
|
domain: "public",
|
|
2926
2929
|
warningProposalSource: "PASCAL-ECMWF-EPS",
|
|
@@ -2930,7 +2933,7 @@ var warningListJSON = [
|
|
|
2930
2933
|
},
|
|
2931
2934
|
{
|
|
2932
2935
|
id: "6053fdab-a258-4bba-9d7a-5467714cc808",
|
|
2933
|
-
lastUpdatedTime: "2023-12-06T06:56:
|
|
2936
|
+
lastUpdatedTime: "2023-12-06T06:56:38Z",
|
|
2934
2937
|
status: "TODO",
|
|
2935
2938
|
warningDetail: {
|
|
2936
2939
|
id: "6053fdab-a258-4bba-9d7a-5467714cc808",
|
|
@@ -3007,8 +3010,8 @@ var warningListJSON = [
|
|
|
3007
3010
|
}
|
|
3008
3011
|
]
|
|
3009
3012
|
},
|
|
3010
|
-
validFrom: "2023-12-18T00:00:
|
|
3011
|
-
validUntil: "2023-12-19T00:00:
|
|
3013
|
+
validFrom: "2023-12-18T00:00:00Z",
|
|
3014
|
+
validUntil: "2023-12-19T00:00:00Z",
|
|
3012
3015
|
level: "moderate",
|
|
3013
3016
|
domain: "public",
|
|
3014
3017
|
warningProposalSource: "PASCAL-ECMWF-EPS",
|
|
@@ -3018,7 +3021,7 @@ var warningListJSON = [
|
|
|
3018
3021
|
},
|
|
3019
3022
|
{
|
|
3020
3023
|
id: "5eb1c7d3-f052-453d-8e39-e51e8b855754",
|
|
3021
|
-
lastUpdatedTime: "2023-12-06T06:56:
|
|
3024
|
+
lastUpdatedTime: "2023-12-06T06:56:38Z",
|
|
3022
3025
|
status: "TODO",
|
|
3023
3026
|
warningDetail: {
|
|
3024
3027
|
id: "5eb1c7d3-f052-453d-8e39-e51e8b855754",
|
|
@@ -3131,8 +3134,8 @@ var warningListJSON = [
|
|
|
3131
3134
|
}
|
|
3132
3135
|
]
|
|
3133
3136
|
},
|
|
3134
|
-
validFrom: "2023-12-11T00:00:
|
|
3135
|
-
validUntil: "2023-12-12T00:00:
|
|
3137
|
+
validFrom: "2023-12-11T00:00:00Z",
|
|
3138
|
+
validUntil: "2023-12-12T00:00:00Z",
|
|
3136
3139
|
level: "moderate",
|
|
3137
3140
|
domain: "public",
|
|
3138
3141
|
warningProposalSource: "PASCAL-ECMWF-EPS",
|
|
@@ -3142,7 +3145,7 @@ var warningListJSON = [
|
|
|
3142
3145
|
},
|
|
3143
3146
|
{
|
|
3144
3147
|
id: "7688a48e-db0b-43b3-a467-e00353f3eb34",
|
|
3145
|
-
lastUpdatedTime: "2023-12-06T06:56:
|
|
3148
|
+
lastUpdatedTime: "2023-12-06T06:56:38Z",
|
|
3146
3149
|
status: "TODO",
|
|
3147
3150
|
warningDetail: {
|
|
3148
3151
|
id: "7688a48e-db0b-43b3-a467-e00353f3eb34",
|
|
@@ -3307,8 +3310,8 @@ var warningListJSON = [
|
|
|
3307
3310
|
}
|
|
3308
3311
|
]
|
|
3309
3312
|
},
|
|
3310
|
-
validFrom: "2023-12-11T00:00:
|
|
3311
|
-
validUntil: "2023-12-12T00:00:
|
|
3313
|
+
validFrom: "2023-12-11T00:00:00Z",
|
|
3314
|
+
validUntil: "2023-12-12T00:00:00Z",
|
|
3312
3315
|
level: "moderate",
|
|
3313
3316
|
domain: "public",
|
|
3314
3317
|
warningProposalSource: "PASCAL-ECMWF-EPS",
|
|
@@ -3318,8 +3321,9 @@ var warningListJSON = [
|
|
|
3318
3321
|
},
|
|
3319
3322
|
{
|
|
3320
3323
|
id: "550c2b5e-937d-11ee-a1bf-0ab3cf8a98c1",
|
|
3321
|
-
lastUpdatedTime: "2023-12-05T14:48:
|
|
3324
|
+
lastUpdatedTime: "2023-12-05T14:48:20Z",
|
|
3322
3325
|
status: "DRAFT",
|
|
3326
|
+
editor: "user.name",
|
|
3323
3327
|
warningDetail: {
|
|
3324
3328
|
phenomenon: "fog",
|
|
3325
3329
|
geoJSON: {
|
|
@@ -3361,16 +3365,17 @@ var warningListJSON = [
|
|
|
3361
3365
|
}
|
|
3362
3366
|
]
|
|
3363
3367
|
},
|
|
3364
|
-
validFrom: "2023-12-05T14:48:
|
|
3365
|
-
validUntil: "2023-12-05T18:48:
|
|
3368
|
+
validFrom: "2023-12-05T14:48:09Z",
|
|
3369
|
+
validUntil: "2023-12-05T18:48:09Z",
|
|
3366
3370
|
level: "moderate",
|
|
3367
3371
|
probability: 30
|
|
3368
3372
|
}
|
|
3369
3373
|
},
|
|
3370
3374
|
{
|
|
3371
3375
|
id: "078e6676-937d-11ee-b619-0ab3cf8a98c1",
|
|
3372
|
-
lastUpdatedTime: "2023-12-05T14:46:
|
|
3376
|
+
lastUpdatedTime: "2023-12-05T14:46:10Z",
|
|
3373
3377
|
status: "DRAFT",
|
|
3378
|
+
editor: "other.user",
|
|
3374
3379
|
warningDetail: {
|
|
3375
3380
|
phenomenon: "coastalEvent",
|
|
3376
3381
|
geoJSON: {
|
|
@@ -3412,15 +3417,15 @@ var warningListJSON = [
|
|
|
3412
3417
|
}
|
|
3413
3418
|
]
|
|
3414
3419
|
},
|
|
3415
|
-
validFrom: "2023-12-05T14:46:
|
|
3416
|
-
validUntil: "2023-12-05T20:46:
|
|
3420
|
+
validFrom: "2023-12-05T14:46:01Z",
|
|
3421
|
+
validUntil: "2023-12-05T20:46:01Z",
|
|
3417
3422
|
level: "severe",
|
|
3418
3423
|
probability: 30
|
|
3419
3424
|
}
|
|
3420
3425
|
},
|
|
3421
3426
|
{
|
|
3422
3427
|
id: "f1e8981e-937c-11ee-a1bf-0ab3cf8a98c1",
|
|
3423
|
-
lastUpdatedTime: "2023-12-05T14:45:
|
|
3428
|
+
lastUpdatedTime: "2023-12-05T14:45:33Z",
|
|
3424
3429
|
status: "DRAFT",
|
|
3425
3430
|
warningDetail: {
|
|
3426
3431
|
phenomenon: "wind",
|
|
@@ -3476,13 +3481,13 @@ var warningListJSON = [
|
|
|
3476
3481
|
}
|
|
3477
3482
|
]
|
|
3478
3483
|
},
|
|
3479
|
-
validFrom: "2023-12-05T14:45:
|
|
3484
|
+
validFrom: "2023-12-05T14:45:28Z",
|
|
3480
3485
|
probability: 30
|
|
3481
3486
|
}
|
|
3482
3487
|
},
|
|
3483
3488
|
{
|
|
3484
3489
|
id: "30fe2e4c-937d-11ee-b3d1-0ab3cf8a98c1",
|
|
3485
|
-
lastUpdatedTime: "2023-12-05T14:47:
|
|
3490
|
+
lastUpdatedTime: "2023-12-05T14:47:19Z",
|
|
3486
3491
|
status: "PUBLISHED",
|
|
3487
3492
|
warningDetail: {
|
|
3488
3493
|
phenomenon: "snowIce",
|
|
@@ -3525,15 +3530,15 @@ var warningListJSON = [
|
|
|
3525
3530
|
}
|
|
3526
3531
|
]
|
|
3527
3532
|
},
|
|
3528
|
-
validFrom: "2023-12-05T14:47:
|
|
3529
|
-
validUntil: "2023-12-18T16:47:
|
|
3533
|
+
validFrom: "2023-12-05T14:47:03Z",
|
|
3534
|
+
validUntil: "2023-12-18T16:47:03Z",
|
|
3530
3535
|
level: "severe",
|
|
3531
3536
|
probability: 70
|
|
3532
3537
|
}
|
|
3533
3538
|
},
|
|
3534
3539
|
{
|
|
3535
3540
|
id: "20f54a8a-937d-11ee-b619-0ab3cf8a98c1",
|
|
3536
|
-
lastUpdatedTime: "2023-12-05T14:46:
|
|
3541
|
+
lastUpdatedTime: "2023-12-05T14:46:52Z",
|
|
3537
3542
|
status: "PUBLISHED",
|
|
3538
3543
|
warningDetail: {
|
|
3539
3544
|
phenomenon: "lowTemp",
|
|
@@ -3576,15 +3581,15 @@ var warningListJSON = [
|
|
|
3576
3581
|
}
|
|
3577
3582
|
]
|
|
3578
3583
|
},
|
|
3579
|
-
validFrom: "2023-12-05T14:46:
|
|
3580
|
-
validUntil: "2023-12-07T20:48:
|
|
3584
|
+
validFrom: "2023-12-05T14:46:39Z",
|
|
3585
|
+
validUntil: "2023-12-07T20:48:39Z",
|
|
3581
3586
|
level: "moderate",
|
|
3582
3587
|
probability: 80
|
|
3583
3588
|
}
|
|
3584
3589
|
},
|
|
3585
3590
|
{
|
|
3586
3591
|
id: "14f7903a-937d-11ee-b619-0ab3cf8a98c1",
|
|
3587
|
-
lastUpdatedTime: "2023-12-05T14:46:
|
|
3592
|
+
lastUpdatedTime: "2023-12-05T14:46:32Z",
|
|
3588
3593
|
status: "PUBLISHED",
|
|
3589
3594
|
warningDetail: {
|
|
3590
3595
|
phenomenon: "funnelCloud",
|
|
@@ -3627,15 +3632,15 @@ var warningListJSON = [
|
|
|
3627
3632
|
}
|
|
3628
3633
|
]
|
|
3629
3634
|
},
|
|
3630
|
-
validFrom: "2023-12-06T14:46:
|
|
3631
|
-
validUntil: "2023-12-06T20:46:
|
|
3635
|
+
validFrom: "2023-12-06T14:46:19Z",
|
|
3636
|
+
validUntil: "2023-12-06T20:46:19Z",
|
|
3632
3637
|
level: "severe",
|
|
3633
3638
|
probability: 30
|
|
3634
3639
|
}
|
|
3635
3640
|
},
|
|
3636
3641
|
{
|
|
3637
3642
|
id: "4b94edb8-937d-11ee-b619-0ab3cf8a98c1",
|
|
3638
|
-
lastUpdatedTime: "2023-12-05T14:48:
|
|
3643
|
+
lastUpdatedTime: "2023-12-05T14:48:04Z",
|
|
3639
3644
|
status: "EXPIRED",
|
|
3640
3645
|
warningDetail: {
|
|
3641
3646
|
phenomenon: "snowIce",
|
|
@@ -3678,15 +3683,15 @@ var warningListJSON = [
|
|
|
3678
3683
|
}
|
|
3679
3684
|
]
|
|
3680
3685
|
},
|
|
3681
|
-
validFrom: "2023-12-05T14:47:
|
|
3682
|
-
validUntil: "2023-12-05T20:47:
|
|
3686
|
+
validFrom: "2023-12-05T14:47:50Z",
|
|
3687
|
+
validUntil: "2023-12-05T20:47:50Z",
|
|
3683
3688
|
level: "moderate",
|
|
3684
3689
|
probability: 40
|
|
3685
3690
|
}
|
|
3686
3691
|
},
|
|
3687
3692
|
{
|
|
3688
3693
|
id: "3f756602-937d-11ee-a1bf-0ab3cf8a98c1",
|
|
3689
|
-
lastUpdatedTime: "2023-12-05T14:47:
|
|
3694
|
+
lastUpdatedTime: "2023-12-05T14:47:43Z",
|
|
3690
3695
|
status: "EXPIRED",
|
|
3691
3696
|
warningDetail: {
|
|
3692
3697
|
phenomenon: "thunderstorm",
|
|
@@ -3729,8 +3734,8 @@ var warningListJSON = [
|
|
|
3729
3734
|
}
|
|
3730
3735
|
]
|
|
3731
3736
|
},
|
|
3732
|
-
validFrom: "2023-12-05T14:47:
|
|
3733
|
-
validUntil: "2023-12-05T20:47:
|
|
3737
|
+
validFrom: "2023-12-05T14:47:34Z",
|
|
3738
|
+
validUntil: "2023-12-05T20:47:34Z",
|
|
3734
3739
|
level: "extreme",
|
|
3735
3740
|
probability: 40
|
|
3736
3741
|
}
|
|
@@ -3774,6 +3779,7 @@ var warningList = warningListJSON;
|
|
|
3774
3779
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
3775
3780
|
* */
|
|
3776
3781
|
var ERROR_NOT_FOUND = 'Request failed with status code 400';
|
|
3782
|
+
var MOCK_USERNAME = 'user.name';
|
|
3777
3783
|
var extractDrawingDetailsFromJSON = function extractDrawingDetailsFromJSON(drawingId) {
|
|
3778
3784
|
return drawingsListFullContent.find(function (element) {
|
|
3779
3785
|
return element.id === drawingId;
|
|
@@ -3838,6 +3844,25 @@ var getApiRoutes = function getApiRoutes(axiosInstance) {
|
|
|
3838
3844
|
// eslint-disable-next-line no-console
|
|
3839
3845
|
console.log("api: update warning ".concat(warningId), data);
|
|
3840
3846
|
return axiosInstance.post("/warnings/".concat(warningId, "/"), data);
|
|
3847
|
+
},
|
|
3848
|
+
deleteWarning: function deleteWarning(warningId) {
|
|
3849
|
+
// eslint-disable-next-line no-console
|
|
3850
|
+
console.log('api: delete warning', warningId);
|
|
3851
|
+
warningList.splice(warningList.findIndex(function (warning) {
|
|
3852
|
+
return warning.id === warningId;
|
|
3853
|
+
}), 1);
|
|
3854
|
+
return axiosInstance.post("/warnings/".concat(warningId, "?delete=true"));
|
|
3855
|
+
},
|
|
3856
|
+
toggleEditorWarning: function toggleEditorWarning(warningId, isEditor) {
|
|
3857
|
+
// eslint-disable-next-line no-console
|
|
3858
|
+
console.log('api: toggle editor warning', warningId, isEditor);
|
|
3859
|
+
var index = warningList.findIndex(function (warning) {
|
|
3860
|
+
return warning.id === warningId;
|
|
3861
|
+
});
|
|
3862
|
+
warningList.splice(index, 1, Object.assign(Object.assign({}, warningList[index]), {
|
|
3863
|
+
editor: isEditor ? MOCK_USERNAME : null
|
|
3864
|
+
}));
|
|
3865
|
+
return axiosInstance.post("/warnings/".concat(warningId, "?editor=").concat(isEditor ? 'true' : 'false'));
|
|
3841
3866
|
}
|
|
3842
3867
|
};
|
|
3843
3868
|
};
|
|
@@ -4777,7 +4802,7 @@ var DescriptionField = function DescriptionField(_ref) {
|
|
|
4777
4802
|
* */
|
|
4778
4803
|
var LABEL_AREA = 'Area';
|
|
4779
4804
|
var BUTTON_ADD_OBJECT = 'Add object';
|
|
4780
|
-
var BUTTON_DELETE = 'Delete';
|
|
4805
|
+
var BUTTON_DELETE$1 = 'Delete';
|
|
4781
4806
|
var BUTTON_VIEW = 'View';
|
|
4782
4807
|
var BUTTON_EDIT$1 = 'Edit';
|
|
4783
4808
|
var OBJECTS_MENU = 'Object options';
|
|
@@ -4872,7 +4897,7 @@ var AreaField = function AreaField(_ref) {
|
|
|
4872
4897
|
action: onViewObject,
|
|
4873
4898
|
icon: /*#__PURE__*/React__default.createElement(Visibility, null)
|
|
4874
4899
|
}, {
|
|
4875
|
-
text: BUTTON_DELETE,
|
|
4900
|
+
text: BUTTON_DELETE$1,
|
|
4876
4901
|
action: onDeleteObject,
|
|
4877
4902
|
icon: /*#__PURE__*/React__default.createElement(Delete, null)
|
|
4878
4903
|
}]
|
|
@@ -5788,6 +5813,7 @@ var getStatus = function getStatus(status) {
|
|
|
5788
5813
|
};
|
|
5789
5814
|
var CREATE_WARNING = 'Create a warning';
|
|
5790
5815
|
var BUTTON_EDIT = 'Edit';
|
|
5816
|
+
var BUTTON_DELETE = 'Delete';
|
|
5791
5817
|
var BUTTON_OPTIONS = 'Options';
|
|
5792
5818
|
var sortWarningsOnStatus = function sortWarningsOnStatus(warnings) {
|
|
5793
5819
|
return warnings.reduce(function (allWarnings, warning) {
|
|
@@ -5856,7 +5882,8 @@ var WarningsOnStatus = function WarningsOnStatus(_ref) {
|
|
|
5856
5882
|
status = _ref.status,
|
|
5857
5883
|
activeWarningId = _ref.activeWarningId,
|
|
5858
5884
|
onSelectWarning = _ref.onSelectWarning,
|
|
5859
|
-
onEditWarning = _ref.onEditWarning
|
|
5885
|
+
onEditWarning = _ref.onEditWarning,
|
|
5886
|
+
onDeleteWarning = _ref.onDeleteWarning;
|
|
5860
5887
|
var headerText = "".concat(warnings.length, " ").concat(getStatus(status));
|
|
5861
5888
|
var onClickWarning = function onClickWarning(warning) {
|
|
5862
5889
|
return function () {
|
|
@@ -5868,6 +5895,11 @@ var WarningsOnStatus = function WarningsOnStatus(_ref) {
|
|
|
5868
5895
|
return onEditWarning(warning);
|
|
5869
5896
|
};
|
|
5870
5897
|
};
|
|
5898
|
+
var onClickDeleteWarning = function onClickDeleteWarning(warningId) {
|
|
5899
|
+
return function () {
|
|
5900
|
+
return onDeleteWarning(warningId);
|
|
5901
|
+
};
|
|
5902
|
+
};
|
|
5871
5903
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
5872
5904
|
sx: {
|
|
5873
5905
|
paddingBottom: 2
|
|
@@ -5908,6 +5940,10 @@ var WarningsOnStatus = function WarningsOnStatus(_ref) {
|
|
|
5908
5940
|
text: BUTTON_EDIT,
|
|
5909
5941
|
action: onClickEditWarning(warning),
|
|
5910
5942
|
icon: /*#__PURE__*/React__default.createElement(Edit, null)
|
|
5943
|
+
}, {
|
|
5944
|
+
text: BUTTON_DELETE,
|
|
5945
|
+
action: onClickDeleteWarning(warning.id),
|
|
5946
|
+
icon: /*#__PURE__*/React__default.createElement(Delete, null)
|
|
5911
5947
|
}] : [],
|
|
5912
5948
|
buttonIcon: /*#__PURE__*/React__default.createElement(Options, null)
|
|
5913
5949
|
}))
|
|
@@ -5936,15 +5972,15 @@ var WarningsOnStatus = function WarningsOnStatus(_ref) {
|
|
|
5936
5972
|
title: "Last update",
|
|
5937
5973
|
status: status,
|
|
5938
5974
|
width: 142
|
|
5939
|
-
}, warning.lastUpdatedTime && "".concat(dateUtils.dateToString(dateUtils.
|
|
5975
|
+
}, warning.lastUpdatedTime && "".concat(dateUtils.dateToString(dateUtils.utc(warning.lastUpdatedTime), DATE_FORMAT), " UTC")), /*#__PURE__*/React__default.createElement(WarningListColumnContent, {
|
|
5940
5976
|
title: "Start time",
|
|
5941
5977
|
status: status,
|
|
5942
5978
|
width: 142
|
|
5943
|
-
}, warning.warningDetail.validFrom && "".concat(dateUtils.dateToString(dateUtils.
|
|
5979
|
+
}, warning.warningDetail.validFrom && "".concat(dateUtils.dateToString(dateUtils.utc(warning.warningDetail.validFrom), DATE_FORMAT), " UTC")), /*#__PURE__*/React__default.createElement(WarningListColumnContent, {
|
|
5944
5980
|
title: "End time",
|
|
5945
5981
|
status: status,
|
|
5946
5982
|
width: 142
|
|
5947
|
-
}, warning.warningDetail.validUntil && "".concat(dateUtils.dateToString(dateUtils.
|
|
5983
|
+
}, warning.warningDetail.validUntil && "".concat(dateUtils.dateToString(dateUtils.utc(warning.warningDetail.validUntil), DATE_FORMAT), " UTC")), /*#__PURE__*/React__default.createElement(WarningListColumnContent, {
|
|
5948
5984
|
title: "Domain",
|
|
5949
5985
|
status: status
|
|
5950
5986
|
}, warning.warningDetail.domain), /*#__PURE__*/React__default.createElement(WarningListColumnContent, {
|
|
@@ -6005,6 +6041,8 @@ var PublicWarningList = function PublicWarningList(_ref2) {
|
|
|
6005
6041
|
onEditWarning = _ref2$onEditWarning === void 0 ? function () {} : _ref2$onEditWarning,
|
|
6006
6042
|
_ref2$onCreateWarning = _ref2.onCreateWarning,
|
|
6007
6043
|
onCreateWarning = _ref2$onCreateWarning === void 0 ? function () {} : _ref2$onCreateWarning,
|
|
6044
|
+
_ref2$onDeleteWarning = _ref2.onDeleteWarning,
|
|
6045
|
+
onDeleteWarning = _ref2$onDeleteWarning === void 0 ? function () {} : _ref2$onDeleteWarning,
|
|
6008
6046
|
_ref2$selectedPublicW = _ref2.selectedPublicWarningId,
|
|
6009
6047
|
selectedPublicWarningId = _ref2$selectedPublicW === void 0 ? '' : _ref2$selectedPublicW;
|
|
6010
6048
|
var sortedWarnings = warnings ? sortWarningsOnStatus(warnings) : null;
|
|
@@ -6038,24 +6076,28 @@ var PublicWarningList = function PublicWarningList(_ref2) {
|
|
|
6038
6076
|
warnings: sortedWarnings.todo,
|
|
6039
6077
|
onSelectWarning: onSelectWarning,
|
|
6040
6078
|
onEditWarning: onEditWarning,
|
|
6079
|
+
onDeleteWarning: onDeleteWarning,
|
|
6041
6080
|
activeWarningId: selectedPublicWarningId
|
|
6042
6081
|
}), /*#__PURE__*/React__default.createElement(WarningsOnStatus, {
|
|
6043
6082
|
status: "DRAFT",
|
|
6044
6083
|
warnings: sortedWarnings.draft,
|
|
6045
6084
|
onSelectWarning: onSelectWarning,
|
|
6046
6085
|
onEditWarning: onEditWarning,
|
|
6086
|
+
onDeleteWarning: onDeleteWarning,
|
|
6047
6087
|
activeWarningId: selectedPublicWarningId
|
|
6048
6088
|
}), /*#__PURE__*/React__default.createElement(WarningsOnStatus, {
|
|
6049
6089
|
status: "PUBLISHED",
|
|
6050
6090
|
warnings: sortedWarnings.published,
|
|
6051
6091
|
onSelectWarning: onSelectWarning,
|
|
6052
6092
|
onEditWarning: onEditWarning,
|
|
6093
|
+
onDeleteWarning: onDeleteWarning,
|
|
6053
6094
|
activeWarningId: selectedPublicWarningId
|
|
6054
6095
|
}), /*#__PURE__*/React__default.createElement(WarningsOnStatus, {
|
|
6055
6096
|
status: "EXPIRED",
|
|
6056
6097
|
warnings: sortedWarnings.expired,
|
|
6057
6098
|
onSelectWarning: onSelectWarning,
|
|
6058
6099
|
onEditWarning: onEditWarning,
|
|
6100
|
+
onDeleteWarning: onDeleteWarning,
|
|
6059
6101
|
activeWarningId: selectedPublicWarningId
|
|
6060
6102
|
}))));
|
|
6061
6103
|
};
|
|
@@ -6145,9 +6187,90 @@ var getPublicWarningsError = createSelector(getPublicWarningsStore, function (st
|
|
|
6145
6187
|
return store === null || store === void 0 ? void 0 : store.error;
|
|
6146
6188
|
});
|
|
6147
6189
|
|
|
6190
|
+
var DELETE_TITLE = 'Delete warning';
|
|
6191
|
+
var DELETE_CONFIRM = 'Delete';
|
|
6192
|
+
var CANCEL = 'Go back';
|
|
6193
|
+
var getDeleteDescription = function getDeleteDescription() {
|
|
6194
|
+
return "Are you sure you want to delete this warning?";
|
|
6195
|
+
};
|
|
6196
|
+
var ConfirmDeleteWarningDialog = function ConfirmDeleteWarningDialog(_ref) {
|
|
6197
|
+
var warningId = _ref.warningId,
|
|
6198
|
+
_ref$onDeleteSucces = _ref.onDeleteSucces,
|
|
6199
|
+
onDeleteSucces = _ref$onDeleteSucces === void 0 ? function () {} : _ref$onDeleteSucces,
|
|
6200
|
+
_ref$onClose = _ref.onClose,
|
|
6201
|
+
onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose;
|
|
6202
|
+
var warningsApi = getWarningsApi();
|
|
6203
|
+
var _React$useState = React__default.useState(false),
|
|
6204
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
6205
|
+
isLoading = _React$useState2[0],
|
|
6206
|
+
setIsLoading = _React$useState2[1];
|
|
6207
|
+
var _React$useState3 = React__default.useState(undefined),
|
|
6208
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
6209
|
+
error = _React$useState4[0],
|
|
6210
|
+
setError = _React$useState4[1];
|
|
6211
|
+
var onSubmit = function onSubmit() {
|
|
6212
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
6213
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
6214
|
+
while (1) switch (_context.prev = _context.next) {
|
|
6215
|
+
case 0:
|
|
6216
|
+
setIsLoading(true);
|
|
6217
|
+
_context.prev = 1;
|
|
6218
|
+
_context.next = 4;
|
|
6219
|
+
return warningsApi.deleteWarning(warningId);
|
|
6220
|
+
case 4:
|
|
6221
|
+
onDeleteSucces(warningId);
|
|
6222
|
+
setIsLoading(false);
|
|
6223
|
+
_context.next = 12;
|
|
6224
|
+
break;
|
|
6225
|
+
case 8:
|
|
6226
|
+
_context.prev = 8;
|
|
6227
|
+
_context.t0 = _context["catch"](1);
|
|
6228
|
+
setError(getAxiosErrorMessage(_context.t0));
|
|
6229
|
+
setIsLoading(false);
|
|
6230
|
+
case 12:
|
|
6231
|
+
case "end":
|
|
6232
|
+
return _context.stop();
|
|
6233
|
+
}
|
|
6234
|
+
}, _callee, null, [[1, 8]]);
|
|
6235
|
+
}));
|
|
6236
|
+
};
|
|
6237
|
+
var description = getDeleteDescription();
|
|
6238
|
+
return /*#__PURE__*/React__default.createElement(ConfirmationDialog, Object.assign({
|
|
6239
|
+
title: DELETE_TITLE,
|
|
6240
|
+
open: true,
|
|
6241
|
+
confirmLabel: DELETE_CONFIRM,
|
|
6242
|
+
cancelLabel: CANCEL,
|
|
6243
|
+
description: !error ? description : '',
|
|
6244
|
+
onClose: onClose,
|
|
6245
|
+
onSubmit: onSubmit,
|
|
6246
|
+
isLoading: isLoading,
|
|
6247
|
+
sx: {
|
|
6248
|
+
width: 330
|
|
6249
|
+
}
|
|
6250
|
+
}, error && {
|
|
6251
|
+
content: ( /*#__PURE__*/React__default.createElement(Box, {
|
|
6252
|
+
sx: {
|
|
6253
|
+
marginBottom: 0
|
|
6254
|
+
}
|
|
6255
|
+
}, /*#__PURE__*/React__default.createElement(AlertBanner, {
|
|
6256
|
+
title: error
|
|
6257
|
+
}), /*#__PURE__*/React__default.createElement(Typography, {
|
|
6258
|
+
variant: "body1",
|
|
6259
|
+
sx: {
|
|
6260
|
+
marginTop: 1
|
|
6261
|
+
}
|
|
6262
|
+
}, description)))
|
|
6263
|
+
}));
|
|
6264
|
+
};
|
|
6265
|
+
|
|
6266
|
+
var DELETE_WARNING_SUCCESS_MESSAGE = "Warning has been deleted";
|
|
6148
6267
|
var PublicWarningListConnect = function PublicWarningListConnect() {
|
|
6149
6268
|
var dispatch = useDispatch();
|
|
6150
6269
|
var confirmDialog = useConfirmationDialog();
|
|
6270
|
+
var _React$useState = React__default.useState(undefined),
|
|
6271
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
6272
|
+
confirmDeleteWarning = _React$useState2[0],
|
|
6273
|
+
setConfirmDeleteWarning = _React$useState2[1];
|
|
6151
6274
|
var warnings = useSelector(function (store) {
|
|
6152
6275
|
return selectAllPublicWarnings(store);
|
|
6153
6276
|
});
|
|
@@ -6208,19 +6331,47 @@ var PublicWarningListConnect = function PublicWarningListConnect() {
|
|
|
6208
6331
|
var editWarning = function editWarning(publicWarning) {
|
|
6209
6332
|
openPublicWarningDialog('', publicWarning);
|
|
6210
6333
|
};
|
|
6334
|
+
var openSnackbar = function openSnackbar(message) {
|
|
6335
|
+
dispatch(snackbarActions.openSnackbar({
|
|
6336
|
+
message: message
|
|
6337
|
+
}));
|
|
6338
|
+
};
|
|
6339
|
+
var deleteWarning = function deleteWarning(warningId) {
|
|
6340
|
+
setConfirmDeleteWarning(warningId);
|
|
6341
|
+
};
|
|
6342
|
+
var onDeleteSuccess = function onDeleteSuccess(warningId) {
|
|
6343
|
+
// close confirm dialog
|
|
6344
|
+
setConfirmDeleteWarning(undefined);
|
|
6345
|
+
// Close warning dialog if needed
|
|
6346
|
+
if (selectedPublicWarningId === warningId) {
|
|
6347
|
+
dispatch(uiActions.setToggleOpenDialog({
|
|
6348
|
+
setOpen: false,
|
|
6349
|
+
type: publicWarningDialogType
|
|
6350
|
+
}));
|
|
6351
|
+
}
|
|
6352
|
+
openSnackbar(DELETE_WARNING_SUCCESS_MESSAGE);
|
|
6353
|
+
dispatch(publicWarningActions.fetchWarnings());
|
|
6354
|
+
};
|
|
6211
6355
|
React__default.useEffect(function () {
|
|
6212
6356
|
// fetch warnings on mount
|
|
6213
6357
|
dispatch(publicWarningActions.fetchWarnings());
|
|
6214
6358
|
}, [dispatch]);
|
|
6215
|
-
return /*#__PURE__*/React__default.createElement(PublicWarningList, {
|
|
6359
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PublicWarningList, {
|
|
6216
6360
|
warnings: warnings,
|
|
6217
6361
|
isLoading: isLoading,
|
|
6218
6362
|
error: error,
|
|
6219
6363
|
onSelectWarning: selectWarning,
|
|
6220
6364
|
onCreateWarning: createWarning,
|
|
6221
6365
|
onEditWarning: editWarning,
|
|
6366
|
+
onDeleteWarning: deleteWarning,
|
|
6222
6367
|
selectedPublicWarningId: selectedPublicWarningId
|
|
6223
|
-
})
|
|
6368
|
+
}), confirmDeleteWarning && ( /*#__PURE__*/React__default.createElement(ConfirmDeleteWarningDialog, {
|
|
6369
|
+
warningId: confirmDeleteWarning,
|
|
6370
|
+
onDeleteSucces: onDeleteSuccess,
|
|
6371
|
+
onClose: function onClose() {
|
|
6372
|
+
return setConfirmDeleteWarning(undefined);
|
|
6373
|
+
}
|
|
6374
|
+
})));
|
|
6224
6375
|
};
|
|
6225
6376
|
|
|
6226
6377
|
/* *
|
package/package.json
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export declare const DELETE_TITLE = "Delete warning";
|
|
3
|
+
export declare const DELETE_CONFIRM = "Delete";
|
|
4
|
+
export declare const CANCEL = "Go back";
|
|
5
|
+
export declare const getDeleteDescription: () => string;
|
|
6
|
+
export declare const ConfirmDeleteWarningDialog: React.FC<{
|
|
7
|
+
warningId: string;
|
|
8
|
+
onDeleteSucces: (warningId: string) => void;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
}>;
|
|
11
|
+
export default ConfirmDeleteWarningDialog;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import { PublicWarning, PublicWarningStatus } from '../../store/publicWarningForm/types';
|
|
4
4
|
export declare const CREATE_WARNING = "Create a warning";
|
|
5
5
|
export declare const BUTTON_EDIT = "Edit";
|
|
6
|
+
export declare const BUTTON_DELETE = "Delete";
|
|
6
7
|
export declare const BUTTON_OPTIONS = "Options";
|
|
7
8
|
export declare const WarningListColumnContent: React.FC<GridProps & {
|
|
8
9
|
title?: string;
|
|
@@ -17,6 +18,7 @@ export declare const PublicWarningList: React.FC<{
|
|
|
17
18
|
onSelectWarning?: (warning: PublicWarning) => void;
|
|
18
19
|
onEditWarning?: (warning: PublicWarning) => void;
|
|
19
20
|
onCreateWarning?: () => void;
|
|
21
|
+
onDeleteWarning?: (warningId: string) => void;
|
|
20
22
|
selectedPublicWarningId?: string;
|
|
21
23
|
}>;
|
|
22
24
|
export default PublicWarningList;
|
|
@@ -6,3 +6,4 @@ export default _default;
|
|
|
6
6
|
export declare const PublicWarningListLight: () => React.ReactElement;
|
|
7
7
|
export declare const PublicWarningListDark: () => React.ReactElement;
|
|
8
8
|
export declare const PublicWarningListError: () => React.ReactElement;
|
|
9
|
+
export declare const PublicWarningListErrorDeleteWarning: () => React.ReactElement;
|
|
@@ -16,6 +16,7 @@ export type PublicWarningDetail = {
|
|
|
16
16
|
export type PublicWarningStatus = 'DRAFT' | 'PUBLISHED' | 'TODO' | 'EXPIRED';
|
|
17
17
|
export type PublicWarning = {
|
|
18
18
|
status: PublicWarningStatus;
|
|
19
|
+
editor?: string;
|
|
19
20
|
warningDetail: PublicWarningDetail;
|
|
20
21
|
id?: string;
|
|
21
22
|
lastUpdatedTime?: string;
|
package/src/lib/utils/api.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export type WarningsApi = {
|
|
|
19
19
|
}>;
|
|
20
20
|
saveWarningAs: (data: PublicWarning) => Promise<string>;
|
|
21
21
|
updateWarning: (warningId: string, data: PublicWarning) => Promise<void>;
|
|
22
|
+
deleteWarning: (warningId: string) => Promise<void>;
|
|
23
|
+
toggleEditorWarning: (warningId: string, isEditor: boolean) => Promise<void>;
|
|
22
24
|
};
|
|
23
25
|
export declare const getApiRoutes: (axiosInstance: AxiosInstance) => WarningsApi;
|
|
24
26
|
export declare const getWarningsApi: () => WarningsApi;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { WarningsApi } from './api';
|
|
2
2
|
import { DrawingFromBE } from '../store/drawings/types';
|
|
3
3
|
export declare const ERROR_NOT_FOUND = "Request failed with status code 400";
|
|
4
|
+
export declare const MOCK_USERNAME = "user.name";
|
|
4
5
|
export declare const extractDrawingDetailsFromJSON: (drawingId: string) => DrawingFromBE;
|
|
5
6
|
export declare const createApi: () => WarningsApi;
|