@opengeoweb/warnings 9.14.0 → 9.16.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 +1301 -539
- package/package.json +5 -3
- package/src/index.d.ts +2 -0
- package/src/lib/components/DrawingTool/useObjectDrawDialogAction.d.ts +3 -7
- package/src/lib/components/DrawingToolForm/DrawingToolFormContents.d.ts +0 -6
- package/src/lib/components/ObjectManager/ConfirmDeleteDialog.d.ts +3 -5
- package/src/lib/components/ObjectManager/ObjectManager.d.ts +0 -1
- package/src/lib/components/ObjectManager/ObjectManagerConnect.d.ts +0 -4
- package/src/lib/components/ObjectManager/Objects.d.ts +0 -6
- package/src/lib/components/Providers/Providers.d.ts +5 -0
- package/src/lib/components/PublicWarningList/ConfirmWarningDialog.d.ts +0 -1
- package/src/lib/components/PublicWarningList/PublicWarningList.d.ts +0 -6
- package/src/lib/components/PublicWarningList/PublicWarningListConnect.d.ts +0 -8
- package/src/lib/components/PublicWarningsForm/AreaField/AreaField.d.ts +0 -8
- package/src/lib/components/PublicWarningsForm/LevelField/LevelField.d.ts +15 -5
- package/src/lib/components/PublicWarningsForm/PhenomenonField/PhenomenonField.d.ts +6 -4
- package/src/lib/components/PublicWarningsForm/ProbabilityField/ProbabilityField.d.ts +7 -0
- package/src/lib/components/PublicWarningsForm/ProbabilityField/index.d.ts +1 -0
- package/src/lib/components/PublicWarningsForm/PublicWarningsForm.d.ts +5 -6
- package/src/lib/components/PublicWarningsForm/PublicWarningsFormConnect.d.ts +9 -1
- package/src/lib/components/PublicWarningsForm/ValidFromField/ValidFromField.d.ts +4 -5
- package/src/lib/components/PublicWarningsForm/ValidUntilField/ValidUntilField.d.ts +6 -7
- package/src/lib/components/PublicWarningsFormDialog/PublicWarningsFormDialog.d.ts +0 -1
- package/src/lib/components/PublicWarningsFormDialog/PublicWarningsFormDialogConnect.d.ts +8 -8
- package/src/lib/components/WarningsMapView/WarningsMapView.d.ts +13 -0
- package/src/lib/store/config.d.ts +4 -14
- package/src/lib/store/drawings/listener.d.ts +2 -0
- package/src/lib/store/drawings/selectors.d.ts +1 -1
- package/src/lib/store/drawings/types.d.ts +2 -7
- package/src/lib/store/publicWarningForm/listener.d.ts +2 -0
- package/src/lib/store/publicWarningForm/selectors.d.ts +1 -1
- package/src/lib/store/publicWarnings/listener.d.ts +3 -0
- package/src/lib/store/publicWarnings/listener.spec.d.ts +1 -0
- package/src/lib/store/publicWarnings/selectors.d.ts +1 -1
- package/src/lib/store/types.d.ts +9 -0
- package/src/lib/utils/api.d.ts +3 -3
- package/src/lib/utils/i18n.d.ts +415 -0
- package/src/lib/store/drawings/sagas.d.ts +0 -8
- package/src/lib/store/publicWarningForm/sagas.d.ts +0 -16
- package/src/lib/store/publicWarnings/sagas.d.ts +0 -6
- /package/src/lib/{store/drawings/sagas.spec.d.ts → components/PublicWarningList/PublicWarningListConnect.editorToggle.integration.spec.d.ts} +0 -0
- /package/src/lib/{store/publicWarningForm/sagas.spec.d.ts → components/PublicWarningsForm/ProbabilityField/ProbabilityField.spec.d.ts} +0 -0
- /package/src/lib/{store/publicWarnings/sagas.spec.d.ts → components/WarningsMapView/WarningsMapView.spec.d.ts} +0 -0
package/index.esm.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { useState, useEffect } from 'react';
|
|
2
|
+
import React__default, { useState, useEffect, useRef } from 'react';
|
|
3
3
|
import { useDispatch, useSelector } from 'react-redux';
|
|
4
4
|
import { Polygons, Share, ExitDomain, Edit, Delete, DrawPolygon, Visibility, Add, Wind, Fog, Lightning, Snow, Rain, TemperatureHigh, TemperatureLow, CoastalEvent, breakpoints, Options, VisibilityOff, Success } from '@opengeoweb/theme';
|
|
5
|
-
import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawtoolSelectors, layerSelectors, uiSelectors,
|
|
6
|
-
import { emptyGeoJSON, MapControlButton, getIcon, rewindGeometry, getGeoJSONPropertyValue, currentlySupportedDrawModes } from '@opengeoweb/webmap-react';
|
|
7
|
-
import { useConfirmationDialog, ToggleMenu, dateUtils, calculateStartSize, ToolContainerDraggable, AlertBanner, ConfirmationDialog, getAxiosErrorMessage, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, LastUpdateTime, StatusTag, ErrorBoundary,
|
|
8
|
-
import {
|
|
5
|
+
import { uiTypes, uiActions, getSingularDrawtoolDrawLayerId, drawtoolSelectors, layerSelectors, uiSelectors, mapStoreActions, drawtoolActions, layerActions, useSetupDialog } from '@opengeoweb/store';
|
|
6
|
+
import { emptyGeoJSON, MapControlButton, getIcon, rewindGeometry, getGeoJSONPropertyValue, currentlySupportedDrawModes, MapView, MapViewLayer, defaultLayers, getFeatureExtent } from '@opengeoweb/webmap-react';
|
|
7
|
+
import { handleOutsideComponentTranslations, useConfirmationDialog, ToggleMenu, dateUtils, calculateStartSize, ToolContainerDraggable, AlertBanner, ConfirmationDialog, getAxiosErrorMessage, usePrevious, CustomIconButton, CustomTooltip, Avatar, getInitials, SwitchButton, LastUpdateTime, StatusTag, ErrorBoundary, pollingIntervalTimeout, isAxiosError as isAxiosError$1 } from '@opengeoweb/shared';
|
|
8
|
+
import { useTranslation } from 'react-i18next';
|
|
9
|
+
import { createEntityAdapter, createSlice, createSelector, createListenerMiddleware, isAnyOf } from '@reduxjs/toolkit';
|
|
10
|
+
import 'i18next';
|
|
9
11
|
import { snackbarActions } from '@opengeoweb/snackbar';
|
|
10
12
|
import { styled, Box, Typography, ListItem, Grid, Paper, ListItemButton, Stack, LinearProgress, Button, FormHelperText, MenuItem, Tabs, Tab, FormControl, Card, CardContent, ListItemIcon, CircularProgress, List } from '@mui/material';
|
|
11
13
|
import { VariableSizeList } from 'react-window';
|
|
@@ -15,8 +17,433 @@ import { getApi, createApiInstance, createNonAuthApiInstance, createFakeApiInsta
|
|
|
15
17
|
import { useFormContext } from 'react-hook-form';
|
|
16
18
|
import { isEqual, cloneDeep, clamp } from 'lodash';
|
|
17
19
|
import { useAuthenticationContext } from '@opengeoweb/authentication';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
+
import { produce } from 'immer';
|
|
21
|
+
import { generateMapId, LayerType, getWMJSMapById, WMBBOX } from '@opengeoweb/webmap';
|
|
22
|
+
import { defaultBbox } from '@opengeoweb/core';
|
|
23
|
+
import { isAxiosError } from 'axios';
|
|
24
|
+
|
|
25
|
+
var en = {
|
|
26
|
+
"drawing-tool-form-tools": "Tools",
|
|
27
|
+
"drawing-tool-form-opacity": "Opacity",
|
|
28
|
+
"drawing-tool-form-object-name": "Object name",
|
|
29
|
+
"drawing-tool-form-save": "Save new object",
|
|
30
|
+
"drawing-tool-form-update": "Update object",
|
|
31
|
+
"drawing-tool-form-exit-draw-mode": "press ESC to exit draw mode",
|
|
32
|
+
"drawing-tool-form-drawing-required": "An object drawing is required",
|
|
33
|
+
"close-dialog-cancel": "Cancel",
|
|
34
|
+
"close-dialog-confirm": "Close",
|
|
35
|
+
"close-draw-dialog-title": "Close Drawing toolbox",
|
|
36
|
+
"close-dialog-description": "There are changes in the form, are you sure you want to close?",
|
|
37
|
+
"drawing-tool-title": "Drawing Toolbox",
|
|
38
|
+
"object-manager-title": "Object Manager for",
|
|
39
|
+
"object-manager-add": "Add a new object",
|
|
40
|
+
"delete-dialog-cancel": "Cancel",
|
|
41
|
+
"delete-dialog-confirm": "Delete",
|
|
42
|
+
"delete-dialog-title": "Delete object",
|
|
43
|
+
"delete-dialog-description": "Are you sure you want to delete",
|
|
44
|
+
"delete-succes": "has been deleted",
|
|
45
|
+
"update-succes": "has been updated",
|
|
46
|
+
"save-succes": "has been saved",
|
|
47
|
+
"object-manager-no-objects": "No objects found",
|
|
48
|
+
"object-manager-options-menu": "Object options",
|
|
49
|
+
"object-manager-button-edit": "Edit",
|
|
50
|
+
"object-manager-button-share": "Share",
|
|
51
|
+
"object-manager-button-delete": "Delete",
|
|
52
|
+
"object-manager-button-view": "View",
|
|
53
|
+
"object-manager-no-object-selected": "(no object selected)",
|
|
54
|
+
"object-manager-object-selected": "object selected",
|
|
55
|
+
"object-manager-share-menu": "Share object to",
|
|
56
|
+
"public-warning-title": "Public Warning",
|
|
57
|
+
"close-warning-dialog-title": "Close Public warning",
|
|
58
|
+
"warning-edit-mode-title": "Switch to edit mode",
|
|
59
|
+
"warning-edit-mode-description": "This warning is already in edit mode by another user and important information could get lost in the switching process.",
|
|
60
|
+
"warning-dialog-cancel": "Go back",
|
|
61
|
+
"warning-edit-mode-confirm": "Edit mode",
|
|
62
|
+
"warning-view-mode-title": "Whoops",
|
|
63
|
+
"warning-view-mode-description": "Are you sure you want to switch to view mode? Your unsaved changes will be lost.",
|
|
64
|
+
"warning-view-mode-confirm": "Switch mode",
|
|
65
|
+
"warning-probability": "Probability",
|
|
66
|
+
"warning-button-clear": "Clear",
|
|
67
|
+
"warning-button-save": "Save",
|
|
68
|
+
"warning-button-saving": "Saving",
|
|
69
|
+
"warning-button-publish": "Publish",
|
|
70
|
+
"warning-button-publishing": "Publishing",
|
|
71
|
+
"warning-area": "Area",
|
|
72
|
+
"warning-button-add-object": "Add object",
|
|
73
|
+
"warning-description-original": "Description original",
|
|
74
|
+
"warning-description-translation": "Description translation",
|
|
75
|
+
"warning-description-NL": "Dutch (selected)",
|
|
76
|
+
"warning-level": "Level",
|
|
77
|
+
"warning-level-moderate": "Moderate",
|
|
78
|
+
"warning-level-severe": "Severe",
|
|
79
|
+
"warning-level-extreme": "Extreme",
|
|
80
|
+
"warning-phenomenon": "Phenomenon",
|
|
81
|
+
"warning-phenomenon-wind": "Wind",
|
|
82
|
+
"warning-phenomenon-fog": "Fog",
|
|
83
|
+
"warning-phenomenon-thunderstorm": "Thunderstorm",
|
|
84
|
+
"warning-phenomenon-snow-ice": "Snow/ice",
|
|
85
|
+
"warning-phenomenon-rain": "Rain",
|
|
86
|
+
"warning-phenomenon-high-temp": "High temperature",
|
|
87
|
+
"warning-phenomenon-low-temp": "Low temperature",
|
|
88
|
+
"warning-phenomenon-funnel-cloud": "Funnel cloud",
|
|
89
|
+
"warning-phenomenon-coastal-event": "Coastal event",
|
|
90
|
+
"warning-probability-moderate-level-invalid": "Probability should be at least 30% when level is moderate",
|
|
91
|
+
"warning-valid-from": "Valid from",
|
|
92
|
+
"warning-valid-until": "Valid until",
|
|
93
|
+
"warning-valid-from-error-before-current": "Valid from time cannot be before current time",
|
|
94
|
+
"warning-valid-from-error-max-hours": "Valid from time can be no more than {{MAX_HOURS}} hours after current time",
|
|
95
|
+
"warning-valid-until-error-before-current": "Valid until time cannot be before current time",
|
|
96
|
+
"warning-valid-until-error-max-hours": "Valid until time can be no more than {{MAX_HOURS}} hours after current time",
|
|
97
|
+
"warning-valid-until-error-min-hours": "Valid until time has to be at least {{MIN_HOURS}} hour after Valid from time",
|
|
98
|
+
"warning-dialog-delete-succes": "Warning has been deleted",
|
|
99
|
+
"warning-dialog-delete-title": "Delete warning",
|
|
100
|
+
"warning-dialog-delete-confirm": "Delete",
|
|
101
|
+
"warning-dialog-delete-description": "Are you sure you want to delete this warning?",
|
|
102
|
+
"warning-dialog-ignore-succes": "Warning has been ignored",
|
|
103
|
+
"warning-dialog-ignore-title": "Ignore warning",
|
|
104
|
+
"warning-dialog-ignore-confirm": "Ignore",
|
|
105
|
+
"warning-dialog-ignore-description": "Are you sure you want to ignore this warning?",
|
|
106
|
+
"warning-save-succes": "Public warning has succesfully been saved!",
|
|
107
|
+
"warning-publish-succes": "Public warning has succesfully been published!",
|
|
108
|
+
"warning-editor-user-viewer": "Viewer",
|
|
109
|
+
"warning-editor-user-editor": "Editor",
|
|
110
|
+
"warning-editor-add-editor": "You are now the editor for this warning",
|
|
111
|
+
"warning-editor-remove-editor": "You are now no longer the editor for this warning",
|
|
112
|
+
"warning-list-button_create": "Create a warning",
|
|
113
|
+
"warning-list-button-use": "Use",
|
|
114
|
+
"warning-list-button-ignore": "Ignore",
|
|
115
|
+
"warning-list-button-options": "Options",
|
|
116
|
+
"warning-list-status-draft": "Drafts",
|
|
117
|
+
"warning-list-status-published": "Published",
|
|
118
|
+
"warning-list-status-todo": "Reviews",
|
|
119
|
+
"warning-list-status-expired": "Expired (last 24 hours)",
|
|
120
|
+
"warning-list-header-incident": "Incident",
|
|
121
|
+
"warning-list-header-last-update": "Last update",
|
|
122
|
+
"warning-list-header-start-time": "Start time",
|
|
123
|
+
"warning-list-header-end-time": "End time",
|
|
124
|
+
"warning-list-header-domain": "Domain",
|
|
125
|
+
"warning-list-header-phenomenon": "Phenomenon",
|
|
126
|
+
"warning-list-header-level": "Level",
|
|
127
|
+
"warning-list-header-draft": "DRAFT"
|
|
128
|
+
};
|
|
129
|
+
var nl = {
|
|
130
|
+
"drawing-tool-form-tools": "Gereedschap",
|
|
131
|
+
"drawing-tool-form-opacity": "Dekking",
|
|
132
|
+
"drawing-tool-form-object-name": "Object naam",
|
|
133
|
+
"drawing-tool-form-save": "Nieuw object opslaan",
|
|
134
|
+
"drawing-tool-form-update": "Object bijwerken",
|
|
135
|
+
"drawing-tool-form-exit-draw-mode": "druk op ESC om tekenmodus te verlaten",
|
|
136
|
+
"drawing-tool-form-drawing-required": "Een object tekening is verplicht",
|
|
137
|
+
"close-dialog-cancel": "Annuleren",
|
|
138
|
+
"close-dialog-confirm": "Sluiten",
|
|
139
|
+
"close-draw-dialog-title": "Tekenen sluiten",
|
|
140
|
+
"close-dialog-description": "Er zijn wijzigingen in het formulier, weet je zeker dat je wilt afsluiten?",
|
|
141
|
+
"drawing-tool-title": "Tekenen",
|
|
142
|
+
"object-manager-title": "Object Manager voor",
|
|
143
|
+
"object-manager-add": "Nieuw object toevoegen",
|
|
144
|
+
"delete-dialog-cancel": "Annuleren",
|
|
145
|
+
"delete-dialog-confirm": "Verwijderen",
|
|
146
|
+
"delete-dialog-title": "Object verwijderen",
|
|
147
|
+
"delete-dialog-description": "Weet je zeker dat je dit object wilt verwijderen:",
|
|
148
|
+
"delete-succes": "is verwijderd",
|
|
149
|
+
"update-succes": "is bijgewerkt",
|
|
150
|
+
"save-succes": "is opgeslagen",
|
|
151
|
+
"object-manager-no-objects": "Geen objecten gevonden",
|
|
152
|
+
"object-manager-options-menu": "Object acties",
|
|
153
|
+
"object-manager-button-edit": "Bewerken",
|
|
154
|
+
"object-manager-button-share": "Delen",
|
|
155
|
+
"object-manager-button-delete": "Verwijderen",
|
|
156
|
+
"object-manager-button-view": "Bekijken",
|
|
157
|
+
"object-manager-no-object-selected": "(geen object geselecteerd)",
|
|
158
|
+
"object-manager-object-selected": "object geselecteerd",
|
|
159
|
+
"object-manager-share-menu": "Object delen naar",
|
|
160
|
+
"public-warning-title": "Publieke Waarschuwing",
|
|
161
|
+
"close-warning-dialog-title": "Publieke waarschuwing sluiten",
|
|
162
|
+
"warning-edit-mode-title": "Wissel naar bewerken",
|
|
163
|
+
"warning-edit-mode-description": "Deze waarschuwing wordt al bewerkt door een andere gebruiker en belangrijke informatie kan verloren gaan.",
|
|
164
|
+
"warning-dialog-cancel": "Ga terug",
|
|
165
|
+
"warning-edit-mode-confirm": "Bewerken",
|
|
166
|
+
"warning-view-mode-title": "Oeps",
|
|
167
|
+
"warning-view-mode-description": "Weet je zeker dat je wilt wisselen naar weergavemodus? Niet-opgeslagen wijzigingen gaan verloren.",
|
|
168
|
+
"warning-view-mode-confirm": "Wisselen",
|
|
169
|
+
"warning-probability": "Waarschijnlijkheid",
|
|
170
|
+
"warning-button-clear": "Wissen",
|
|
171
|
+
"warning-button-save": "Opslaan",
|
|
172
|
+
"warning-button-saving": "Opslaan",
|
|
173
|
+
"warning-button-publish": "Publiceren",
|
|
174
|
+
"warning-button-publishing": "Publiceren",
|
|
175
|
+
"warning-area": "Gebied",
|
|
176
|
+
"warning-button-add-object": "Object toevoegen",
|
|
177
|
+
"warning-description-original": "Beschrijving origineel",
|
|
178
|
+
"warning-description-translation": "Beschrijving vertaling",
|
|
179
|
+
"warning-description-NL": "Nederlands (geselecteerd)",
|
|
180
|
+
"warning-level": "Niveau",
|
|
181
|
+
"warning-level-moderate": "Gematigd",
|
|
182
|
+
"warning-level-severe": "Ernstig",
|
|
183
|
+
"warning-level-extreme": "Extreem",
|
|
184
|
+
"warning-phenomenon": "Fenomeen",
|
|
185
|
+
"warning-phenomenon-wind": "Windstoten",
|
|
186
|
+
"warning-phenomenon-fog": "Dichte mist",
|
|
187
|
+
"warning-phenomenon-thunderstorm": "Onweersbuien",
|
|
188
|
+
"warning-phenomenon-snow-ice": "Sneeuw/gladheid",
|
|
189
|
+
"warning-phenomenon-rain": "Zware regen",
|
|
190
|
+
"warning-phenomenon-high-temp": "Hitte",
|
|
191
|
+
"warning-phenomenon-low-temp": "Koude",
|
|
192
|
+
"warning-phenomenon-funnel-cloud": "Hozen",
|
|
193
|
+
"warning-phenomenon-coastal-event": "Kust incident",
|
|
194
|
+
"warning-probability-moderate-level-invalid": "Waarschijnlijkheid moet tenminste 30% zijn als Niveau Gematigd is",
|
|
195
|
+
"warning-valid-from": "Geldig vanaf",
|
|
196
|
+
"warning-valid-until": "Geldig tot",
|
|
197
|
+
"warning-valid-from-error-before-current": "Starttijd mag niet eerder zijn dan huidige tijd",
|
|
198
|
+
"warning-valid-from-error-max-hours": "Starttijd mag niet meer dan {{MAX_HOURS}} uur na huidige tijd zijn",
|
|
199
|
+
"warning-valid-until-error-before-current": "Eindtijd mag niet eerder zijn dan huidige tijd",
|
|
200
|
+
"warning-valid-until-error-max-hours": "Eindtijd mag niet meer dan {{MAX_HOURS}} uur na huidige tijd zijn",
|
|
201
|
+
"warning-valid-until-error-min-hours": "Eindtijd moet minstens {{MIN_HOURS}} uur later zijn dan starttijd",
|
|
202
|
+
"warning-dialog-delete-succes": "Waarschuwing is verwijderd",
|
|
203
|
+
"warning-dialog-delete-title": "Waarschuwing verwijderen",
|
|
204
|
+
"warning-dialog-delete-confirm": "Verwijderen",
|
|
205
|
+
"warning-dialog-delete-description": "Weet je zeker dat je deze waarschuwing wilt verwijderen?",
|
|
206
|
+
"warning-dialog-ignore-succes": "Waarschuwing is genegeerd",
|
|
207
|
+
"warning-dialog-ignore-title": "Waarschuwing negeren",
|
|
208
|
+
"warning-dialog-ignore-confirm": "Negeren",
|
|
209
|
+
"warning-dialog-ignore-description": "Weet je zeker dat je deze waarschuwing wilt negeren?",
|
|
210
|
+
"warning-save-succes": "Publieke waarschuwing is succesvol opgeslagen!",
|
|
211
|
+
"warning-publish-succes": "Publieke waarschuwing is succesvol gepubliceerd!",
|
|
212
|
+
"warning-editor-add-editor": "Je bent nu de editor van deze waarschuwing",
|
|
213
|
+
"warning-editor-remove-editor": "Je bent nu niet langer de editor van deze waarschuwing",
|
|
214
|
+
"warning-editor-user-viewer": "Kijker",
|
|
215
|
+
"warning-editor-user-editor": "Editor",
|
|
216
|
+
"warning-list-button_create": "Maak waarschuwing",
|
|
217
|
+
"warning-list-button-use": "Gebruik",
|
|
218
|
+
"warning-list-button-ignore": "Negeer",
|
|
219
|
+
"warning-list-button-options": "Opties",
|
|
220
|
+
"warning-list-status-draft": "Concepten",
|
|
221
|
+
"warning-list-status-published": "Gepubliceerd",
|
|
222
|
+
"warning-list-status-todo": "Te doen",
|
|
223
|
+
"warning-list-status-expired": "Verlopen (laatste 24 uur)",
|
|
224
|
+
"warning-list-header-incident": "Incident",
|
|
225
|
+
"warning-list-header-last-update": "Laatste update",
|
|
226
|
+
"warning-list-header-start-time": "Starttijd",
|
|
227
|
+
"warning-list-header-end-time": "Eindtijd",
|
|
228
|
+
"warning-list-header-domain": "Domein",
|
|
229
|
+
"warning-list-header-phenomenon": "Fenomeen",
|
|
230
|
+
"warning-list-header-level": "Hoogte",
|
|
231
|
+
"warning-list-header-draft": "CONCEPT"
|
|
232
|
+
};
|
|
233
|
+
var fi = {
|
|
234
|
+
"drawing-tool-form-tools": "ei käännetty",
|
|
235
|
+
"drawing-tool-form-opacity": "ei käännetty",
|
|
236
|
+
"drawing-tool-form-object-name": "ei käännetty",
|
|
237
|
+
"drawing-tool-form-save": "ei käännetty",
|
|
238
|
+
"drawing-tool-form-update": "ei käännetty",
|
|
239
|
+
"drawing-tool-form-exit-draw-mode": "ei käännetty",
|
|
240
|
+
"drawing-tool-form-drawing-required": "ei käännetty",
|
|
241
|
+
"close-dialog-cancel": "ei käännetty",
|
|
242
|
+
"close-dialog-confirm": "ei käännetty",
|
|
243
|
+
"close-draw-dialog-title": "ei käännetty",
|
|
244
|
+
"close-dialog-description": "ei käännetty",
|
|
245
|
+
"drawing-tool-title": "ei käännetty",
|
|
246
|
+
"object-manager-title": "ei käännetty",
|
|
247
|
+
"object-manager-add": "ei käännetty",
|
|
248
|
+
"delete-dialog-cancel": "ei käännetty",
|
|
249
|
+
"delete-dialog-confirm": "ei käännetty",
|
|
250
|
+
"delete-dialog-title": "ei käännetty",
|
|
251
|
+
"delete-dialog-description": "ei käännetty",
|
|
252
|
+
"delete-succes": "ei käännetty",
|
|
253
|
+
"update-succes": "ei käännetty",
|
|
254
|
+
"save-succes": "ei käännetty",
|
|
255
|
+
"object-manager-no-objects": "ei käännetty",
|
|
256
|
+
"object-manager-options-menu": "ei käännetty",
|
|
257
|
+
"object-manager-button-edit": "ei käännetty",
|
|
258
|
+
"object-manager-button-share": "ei käännetty",
|
|
259
|
+
"object-manager-button-delete": "ei käännetty",
|
|
260
|
+
"object-manager-button-view": "ei käännetty",
|
|
261
|
+
"object-manager-no-object-selected": "ei käännetty",
|
|
262
|
+
"object-manager-object-selected": "ei käännetty",
|
|
263
|
+
"object-manager-share-menu": "ei käännetty",
|
|
264
|
+
"public-warning-title": "ei käännetty",
|
|
265
|
+
"close-warning-dialog-title": "ei käännetty",
|
|
266
|
+
"warning-edit-mode-title": "ei käännetty",
|
|
267
|
+
"warning-edit-mode-description": "ei käännetty",
|
|
268
|
+
"warning-dialog-cancel": "ei käännetty",
|
|
269
|
+
"warning-edit-mode-confirm": "ei käännetty",
|
|
270
|
+
"warning-view-mode-title": "ei käännetty",
|
|
271
|
+
"warning-view-mode-description": "ei käännetty",
|
|
272
|
+
"warning-view-mode-confirm": "ei käännetty",
|
|
273
|
+
"warning-probability": "ei käännetty",
|
|
274
|
+
"warning-button-clear": "ei käännetty",
|
|
275
|
+
"warning-button-save": "ei käännetty",
|
|
276
|
+
"warning-button-saving": "ei käännetty",
|
|
277
|
+
"warning-button-publish": "ei käännetty",
|
|
278
|
+
"warning-button-publishing": "ei käännetty",
|
|
279
|
+
"warning-area": "ei käännetty",
|
|
280
|
+
"warning-button-add-object": "ei käännetty",
|
|
281
|
+
"warning-description-original": "ei käännetty",
|
|
282
|
+
"warning-description-translation": "ei käännetty",
|
|
283
|
+
"warning-description-NL": "ei käännetty",
|
|
284
|
+
"warning-level": "ei käännetty",
|
|
285
|
+
"warning-level-moderate": "ei käännetty",
|
|
286
|
+
"warning-level-severe": "ei käännetty",
|
|
287
|
+
"warning-level-extreme": "ei käännetty",
|
|
288
|
+
"warning-phenomenon": "ei käännetty",
|
|
289
|
+
"warning-phenomenon-wind": "ei käännetty",
|
|
290
|
+
"warning-phenomenon-fog": "ei käännetty",
|
|
291
|
+
"warning-phenomenon-thunderstorm": "ei käännetty",
|
|
292
|
+
"warning-phenomenon-snow-ice": "ei käännetty",
|
|
293
|
+
"warning-phenomenon-rain": "ei käännetty",
|
|
294
|
+
"warning-phenomenon-high-temp": "ei käännetty",
|
|
295
|
+
"warning-phenomenon-low-temp": "ei käännetty",
|
|
296
|
+
"warning-phenomenon-funnel-cloud": "ei käännetty",
|
|
297
|
+
"warning-phenomenon-coastal-event": "ei käännetty",
|
|
298
|
+
"warning-probability-moderate-level-invalid": "ei käännetty",
|
|
299
|
+
"warning-valid-from": "ei käännetty",
|
|
300
|
+
"warning-valid-until": "ei käännetty",
|
|
301
|
+
"warning-valid-from-error-before-current": "ei käännetty",
|
|
302
|
+
"warning-valid-from-error-max-hours": "ei käännetty",
|
|
303
|
+
"warning-valid-until-error-before-current": "ei käännetty",
|
|
304
|
+
"warning-valid-until-error-max-hours": "ei käännetty",
|
|
305
|
+
"warning-valid-until-error-min-hours": "ei käännetty",
|
|
306
|
+
"warning-dialog-delete-succes": "ei käännetty",
|
|
307
|
+
"warning-dialog-delete-title": "ei käännetty",
|
|
308
|
+
"warning-dialog-delete-confirm": "ei käännetty",
|
|
309
|
+
"warning-dialog-delete-description": "ei käännetty",
|
|
310
|
+
"warning-dialog-ignore-succes": "ei käännetty",
|
|
311
|
+
"warning-dialog-ignore-title": "ei käännetty",
|
|
312
|
+
"warning-dialog-ignore-confirm": "ei käännetty",
|
|
313
|
+
"warning-dialog-ignore-description": "ei käännetty",
|
|
314
|
+
"warning-save-succes": "ei käännetty",
|
|
315
|
+
"warning-publish-succes": "ei käännetty",
|
|
316
|
+
"warning-editor-user-viewer": "ei käännetty",
|
|
317
|
+
"warning-editor-user-editor": "ei käännetty",
|
|
318
|
+
"warning-editor-add-editor": "ei käännetty",
|
|
319
|
+
"warning-editor-remove-editor": "ei käännetty",
|
|
320
|
+
"warning-list-button_create": "ei käännetty",
|
|
321
|
+
"warning-list-button-use": "ei käännetty",
|
|
322
|
+
"warning-list-button-ignore": "ei käännetty",
|
|
323
|
+
"warning-list-button-options": "ei käännetty",
|
|
324
|
+
"warning-list-status-draft": "ei käännetty",
|
|
325
|
+
"warning-list-status-published": "ei käännetty",
|
|
326
|
+
"warning-list-status-todo": "ei käännetty",
|
|
327
|
+
"warning-list-status-expired": "ei käännetty",
|
|
328
|
+
"warning-list-header-incident": "ei käännetty",
|
|
329
|
+
"warning-list-header-last-update": "ei käännetty",
|
|
330
|
+
"warning-list-header-start-time": "ei käännetty",
|
|
331
|
+
"warning-list-header-end-time": "ei käännetty",
|
|
332
|
+
"warning-list-header-domain": "ei käännetty",
|
|
333
|
+
"warning-list-header-phenomenon": "ei käännetty",
|
|
334
|
+
"warning-list-header-level": "ei käännetty",
|
|
335
|
+
"warning-list-header-draft": "ei käännetty"
|
|
336
|
+
};
|
|
337
|
+
var no = {
|
|
338
|
+
"drawing-tool-form-tools": "ikke oversatt",
|
|
339
|
+
"drawing-tool-form-opacity": "ikke oversatt",
|
|
340
|
+
"drawing-tool-form-object-name": "ikke oversatt",
|
|
341
|
+
"drawing-tool-form-save": "ikke oversatt",
|
|
342
|
+
"drawing-tool-form-update": "ikke oversatt",
|
|
343
|
+
"drawing-tool-form-exit-draw-mode": "ikke oversatt",
|
|
344
|
+
"drawing-tool-form-drawing-required": "ikke oversatt",
|
|
345
|
+
"close-dialog-cancel": "ikke oversatt",
|
|
346
|
+
"close-dialog-confirm": "ikke oversatt",
|
|
347
|
+
"close-draw-dialog-title": "ikke oversatt",
|
|
348
|
+
"close-dialog-description": "ikke oversatt",
|
|
349
|
+
"drawing-tool-title": "ikke oversatt",
|
|
350
|
+
"object-manager-title": "ikke oversatt",
|
|
351
|
+
"object-manager-add": "ikke oversatt",
|
|
352
|
+
"delete-dialog-cancel": "ikke oversatt",
|
|
353
|
+
"delete-dialog-confirm": "ikke oversatt",
|
|
354
|
+
"delete-dialog-title": "ikke oversatt",
|
|
355
|
+
"delete-dialog-description": "ikke oversatt",
|
|
356
|
+
"delete-succes": "ikke oversatt",
|
|
357
|
+
"update-succes": "ikke oversatt",
|
|
358
|
+
"save-succes": "ikke oversatt",
|
|
359
|
+
"object-manager-no-objects": "ikke oversatt",
|
|
360
|
+
"object-manager-options-menu": "ikke oversatt",
|
|
361
|
+
"object-manager-button-edit": "ikke oversatt",
|
|
362
|
+
"object-manager-button-share": "ikke oversatt",
|
|
363
|
+
"object-manager-button-delete": "ikke oversatt",
|
|
364
|
+
"object-manager-button-view": "ikke oversatt",
|
|
365
|
+
"object-manager-no-object-selected": "ikke oversatt",
|
|
366
|
+
"object-manager-object-selected": "ikke oversatt",
|
|
367
|
+
"object-manager-share-menu": "ikke oversatt",
|
|
368
|
+
"public-warning-title": "ikke oversatt",
|
|
369
|
+
"close-warning-dialog-title": "ikke oversatt",
|
|
370
|
+
"warning-edit-mode-title": "ikke oversatt",
|
|
371
|
+
"warning-edit-mode-description": "ikke oversatt",
|
|
372
|
+
"warning-dialog-cancel": "ikke oversatt",
|
|
373
|
+
"warning-edit-mode-confirm": "ikke oversatt",
|
|
374
|
+
"warning-view-mode-title": "ikke oversatt",
|
|
375
|
+
"warning-view-mode-description": "ikke oversatt",
|
|
376
|
+
"warning-view-mode-confirm": "ikke oversatt",
|
|
377
|
+
"warning-probability": "ikke oversatt",
|
|
378
|
+
"warning-button-clear": "ikke oversatt",
|
|
379
|
+
"warning-button-save": "ikke oversatt",
|
|
380
|
+
"warning-button-saving": "ikke oversatt",
|
|
381
|
+
"warning-button-publish": "ikke oversatt",
|
|
382
|
+
"warning-button-publishing": "ikke oversatt",
|
|
383
|
+
"warning-area": "ikke oversatt",
|
|
384
|
+
"warning-button-add-object": "ikke oversatt",
|
|
385
|
+
"warning-description-original": "ikke oversatt",
|
|
386
|
+
"warning-description-translation": "ikke oversatt",
|
|
387
|
+
"warning-description-NL": "ikke oversatt",
|
|
388
|
+
"warning-level": "ikke oversatt",
|
|
389
|
+
"warning-level-moderate": "ikke oversatt",
|
|
390
|
+
"warning-level-severe": "ikke oversatt",
|
|
391
|
+
"warning-level-extreme": "ikke oversatt",
|
|
392
|
+
"warning-phenomenon": "ikke oversatt",
|
|
393
|
+
"warning-phenomenon-wind": "ikke oversatt",
|
|
394
|
+
"warning-phenomenon-fog": "ikke oversatt",
|
|
395
|
+
"warning-phenomenon-thunderstorm": "ikke oversatt",
|
|
396
|
+
"warning-phenomenon-snow-ice": "ikke oversatt",
|
|
397
|
+
"warning-phenomenon-rain": "ikke oversatt",
|
|
398
|
+
"warning-phenomenon-high-temp": "ikke oversatt",
|
|
399
|
+
"warning-phenomenon-low-temp": "ikke oversatt",
|
|
400
|
+
"warning-phenomenon-funnel-cloud": "ikke oversatt",
|
|
401
|
+
"warning-phenomenon-coastal-event": "ikke oversatt",
|
|
402
|
+
"warning-probability-moderate-level-invalid": "ikke oversatt",
|
|
403
|
+
"warning-valid-from": "ikke oversatt",
|
|
404
|
+
"warning-valid-until": "ikke oversatt",
|
|
405
|
+
"warning-valid-from-error-before-current": "ikke oversatt",
|
|
406
|
+
"warning-valid-from-error-max-hours": "ikke oversatt",
|
|
407
|
+
"warning-valid-until-error-before-current": "ikke oversatt",
|
|
408
|
+
"warning-valid-until-error-max-hours": "ikke oversatt",
|
|
409
|
+
"warning-valid-until-error-min-hours": "ikke oversatt",
|
|
410
|
+
"warning-dialog-delete-succes": "ikke oversatt",
|
|
411
|
+
"warning-dialog-delete-title": "ikke oversatt",
|
|
412
|
+
"warning-dialog-delete-confirm": "ikke oversatt",
|
|
413
|
+
"warning-dialog-delete-description": "ikke oversatt",
|
|
414
|
+
"warning-dialog-ignore-succes": "ikke oversatt",
|
|
415
|
+
"warning-dialog-ignore-title": "ikke oversatt",
|
|
416
|
+
"warning-dialog-ignore-confirm": "ikke oversatt",
|
|
417
|
+
"warning-dialog-ignore-description": "ikke oversatt",
|
|
418
|
+
"warning-save-succes": "ikke oversatt",
|
|
419
|
+
"warning-publish-succes": "ikke oversatt",
|
|
420
|
+
"warning-editor-user-viewer": "ikke oversatt",
|
|
421
|
+
"warning-editor-user-editor": "ikke oversatt",
|
|
422
|
+
"warning-editor-add-editor": "ikke oversatt",
|
|
423
|
+
"warning-editor-remove-editor": "ikke oversatt",
|
|
424
|
+
"warning-list-button_create": "ikke oversatt",
|
|
425
|
+
"warning-list-button-use": "ikke oversatt",
|
|
426
|
+
"warning-list-button-ignore": "ikke oversatt",
|
|
427
|
+
"warning-list-button-options": "ikke oversatt",
|
|
428
|
+
"warning-list-status-draft": "ikke oversatt",
|
|
429
|
+
"warning-list-status-published": "ikke oversatt",
|
|
430
|
+
"warning-list-status-todo": "ikke oversatt",
|
|
431
|
+
"warning-list-status-expired": "ikke oversatt",
|
|
432
|
+
"warning-list-header-incident": "ikke oversatt",
|
|
433
|
+
"warning-list-header-last-update": "ikke oversatt",
|
|
434
|
+
"warning-list-header-start-time": "ikke oversatt",
|
|
435
|
+
"warning-list-header-end-time": "ikke oversatt",
|
|
436
|
+
"warning-list-header-domain": "ikke oversatt",
|
|
437
|
+
"warning-list-header-phenomenon": "ikke oversatt",
|
|
438
|
+
"warning-list-header-level": "ikke oversatt",
|
|
439
|
+
"warning-list-header-draft": "ikke oversatt"
|
|
440
|
+
};
|
|
441
|
+
var warningsTranslations = {
|
|
442
|
+
en: en,
|
|
443
|
+
nl: nl,
|
|
444
|
+
fi: fi,
|
|
445
|
+
no: no
|
|
446
|
+
};
|
|
20
447
|
|
|
21
448
|
/******************************************************************************
|
|
22
449
|
Copyright (c) Microsoft Corporation.
|
|
@@ -108,7 +535,7 @@ const slice$2 = createSlice({
|
|
|
108
535
|
drawAdapter.setOne(draft, action.payload);
|
|
109
536
|
}
|
|
110
537
|
},
|
|
111
|
-
// action caught in drawings/
|
|
538
|
+
// action caught in drawings/listener
|
|
112
539
|
submitDrawValues: (
|
|
113
540
|
// eslint-disable-next-line no-unused-vars
|
|
114
541
|
draft,
|
|
@@ -218,17 +645,41 @@ const getWarningFormDirty = createSelector(selectDrawByInstanceId, drawing => (d
|
|
|
218
645
|
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
219
646
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
220
647
|
* */
|
|
221
|
-
const
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
648
|
+
const WARN_NAMESPACE = 'warn';
|
|
649
|
+
const outsideComponentTranslations = handleOutsideComponentTranslations(warningsTranslations, WARN_NAMESPACE);
|
|
650
|
+
|
|
651
|
+
/* *
|
|
652
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
653
|
+
* you may not use this file except in compliance with the License.
|
|
654
|
+
* You may obtain a copy of the License at
|
|
655
|
+
*
|
|
656
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
657
|
+
*
|
|
658
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
659
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
660
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
661
|
+
* See the License for the specific language governing permissions and
|
|
662
|
+
* limitations under the License.
|
|
663
|
+
*
|
|
664
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
665
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
666
|
+
* */
|
|
667
|
+
const confirmationDialogOptions = t => {
|
|
668
|
+
return {
|
|
669
|
+
cancelLabel: t('close-dialog-cancel'),
|
|
670
|
+
title: t('close-draw-dialog-title'),
|
|
671
|
+
description: t('close-dialog-description'),
|
|
672
|
+
confirmLabel: t('close-dialog-confirm'),
|
|
673
|
+
catchOnCancel: true
|
|
674
|
+
};
|
|
227
675
|
};
|
|
228
676
|
const useCloseDrawDialog = ({
|
|
229
677
|
mapId,
|
|
230
678
|
source
|
|
231
679
|
}) => {
|
|
680
|
+
const {
|
|
681
|
+
t
|
|
682
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
232
683
|
const dispatch = useDispatch();
|
|
233
684
|
const drawLayerId = getSingularDrawtoolDrawLayerId(mapId);
|
|
234
685
|
const drawDialogActiveDrawModeId = useSelector(store => drawtoolSelectors.getActiveDrawModeId(store, drawingDialogType));
|
|
@@ -238,7 +689,7 @@ const useCloseDrawDialog = ({
|
|
|
238
689
|
const confirmDialog = useConfirmationDialog();
|
|
239
690
|
const closeDrawDialog = (skipConfirmationDialog = false) => __awaiter(void 0, void 0, void 0, function* () {
|
|
240
691
|
if (isFormDirty && !skipConfirmationDialog) {
|
|
241
|
-
const mayProceed = yield confirmDialog(confirmationDialogOptions).then(() => true).catch(() => false);
|
|
692
|
+
const mayProceed = yield confirmDialog(confirmationDialogOptions(t)).then(() => true).catch(() => false);
|
|
242
693
|
if (!mayProceed) {
|
|
243
694
|
return;
|
|
244
695
|
}
|
|
@@ -294,7 +745,7 @@ const useCloseObjectDialog = ({
|
|
|
294
745
|
}) => {
|
|
295
746
|
const dispatch = useDispatch();
|
|
296
747
|
const drawLayerId = getSingularDrawtoolDrawLayerId(mapId);
|
|
297
|
-
const
|
|
748
|
+
const featureLayerContainsGeoJSON = useSelector(store => layerSelectors.getHasFeatureLayerGeoJSON(store, drawLayerId));
|
|
298
749
|
const closeObjectDialog = (shouldReset = true) => {
|
|
299
750
|
// reset active object
|
|
300
751
|
if (shouldReset) {
|
|
@@ -311,7 +762,7 @@ const useCloseObjectDialog = ({
|
|
|
311
762
|
setOpen: false,
|
|
312
763
|
source
|
|
313
764
|
}));
|
|
314
|
-
if (
|
|
765
|
+
if (featureLayerContainsGeoJSON && shouldReset) {
|
|
315
766
|
dispatch(mapStoreActions.layerChangeGeojson({
|
|
316
767
|
layerId: drawLayerId,
|
|
317
768
|
geojson: emptyGeoJSON
|
|
@@ -328,11 +779,11 @@ const useDialogOptions = ({
|
|
|
328
779
|
const isDialogOpen = useSelector(store => uiSelectors.getisDialogOpen(store, dialogType));
|
|
329
780
|
const dialogMapId = useSelector(store => uiSelectors.getDialogMapId(store, dialogType));
|
|
330
781
|
const dialogLayerId = getSingularDrawtoolDrawLayerId(dialogMapId);
|
|
331
|
-
const
|
|
782
|
+
const hasGeoJSON = useSelector(store => layerSelectors.getHasFeatureLayerGeoJSON(store, dialogLayerId));
|
|
332
783
|
return {
|
|
333
784
|
isDialogOpen,
|
|
334
785
|
dialogMapId,
|
|
335
|
-
|
|
786
|
+
hasGeoJSON,
|
|
336
787
|
dialogLayerId
|
|
337
788
|
};
|
|
338
789
|
};
|
|
@@ -340,13 +791,16 @@ const useObjectDrawDialogAction = ({
|
|
|
340
791
|
mapId,
|
|
341
792
|
source
|
|
342
793
|
}) => {
|
|
794
|
+
const {
|
|
795
|
+
t
|
|
796
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
343
797
|
const dispatch = useDispatch();
|
|
344
798
|
const confirmDialog = useConfirmationDialog();
|
|
345
799
|
const currentDrawLayerId = getSingularDrawtoolDrawLayerId(mapId);
|
|
346
800
|
// draw selectors
|
|
347
801
|
const {
|
|
348
802
|
isDialogOpen: isDrawDialogOpen,
|
|
349
|
-
|
|
803
|
+
hasGeoJSON: drawDialogLayerHasGeoJSON,
|
|
350
804
|
dialogLayerId: drawDialogLayerId
|
|
351
805
|
} = useDialogOptions({
|
|
352
806
|
dialogType: drawingDialogType
|
|
@@ -356,7 +810,7 @@ const useObjectDrawDialogAction = ({
|
|
|
356
810
|
// object selectors
|
|
357
811
|
const {
|
|
358
812
|
isDialogOpen: isObjectDialogOpen,
|
|
359
|
-
|
|
813
|
+
hasGeoJSON: objectDialogLayerHasGeoJSON,
|
|
360
814
|
dialogLayerId: objectDialogLayerId
|
|
361
815
|
} = useDialogOptions({
|
|
362
816
|
dialogType: objectDialogType
|
|
@@ -370,12 +824,12 @@ const useObjectDrawDialogAction = ({
|
|
|
370
824
|
const openObjectDialog = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
371
825
|
if (isDrawDialogOpen) {
|
|
372
826
|
if (isFormDirty) {
|
|
373
|
-
const mayProceed = yield confirmDialog(confirmationDialogOptions).then(() => true).catch(() => false);
|
|
827
|
+
const mayProceed = yield confirmDialog(confirmationDialogOptions(t)).then(() => true).catch(() => false);
|
|
374
828
|
if (!mayProceed) {
|
|
375
829
|
return;
|
|
376
830
|
}
|
|
377
831
|
}
|
|
378
|
-
if (
|
|
832
|
+
if (drawDialogLayerHasGeoJSON) {
|
|
379
833
|
clearGeoJSON(drawDialogLayerId);
|
|
380
834
|
}
|
|
381
835
|
closeDrawDialog(true);
|
|
@@ -388,11 +842,11 @@ const useObjectDrawDialogAction = ({
|
|
|
388
842
|
source
|
|
389
843
|
}));
|
|
390
844
|
// move shape to screen
|
|
391
|
-
if (isObjectDialogOpen &&
|
|
845
|
+
if (isObjectDialogOpen && objectDialogLayerHasGeoJSON) {
|
|
392
846
|
// update new shape
|
|
393
|
-
dispatch(mapStoreActions.
|
|
847
|
+
dispatch(mapStoreActions.layerSetGeojsonFromLayer({
|
|
394
848
|
layerId: currentDrawLayerId,
|
|
395
|
-
|
|
849
|
+
sourceLayerId: objectDialogLayerId
|
|
396
850
|
}));
|
|
397
851
|
// remove current shape
|
|
398
852
|
clearGeoJSON(objectDialogLayerId);
|
|
@@ -400,7 +854,7 @@ const useObjectDrawDialogAction = ({
|
|
|
400
854
|
});
|
|
401
855
|
const openDrawDialog = newGeoJSON => {
|
|
402
856
|
if (isObjectDialogOpen) {
|
|
403
|
-
if (
|
|
857
|
+
if (objectDialogLayerHasGeoJSON) {
|
|
404
858
|
clearGeoJSON(objectDialogLayerId);
|
|
405
859
|
}
|
|
406
860
|
const shouldResetShape = newGeoJSON === undefined;
|
|
@@ -419,11 +873,11 @@ const useObjectDrawDialogAction = ({
|
|
|
419
873
|
geoJSONLayerId: currentDrawLayerId
|
|
420
874
|
}));
|
|
421
875
|
// move shape to screen
|
|
422
|
-
if (isDrawDialogOpen &&
|
|
876
|
+
if (isDrawDialogOpen && drawDialogLayerHasGeoJSON) {
|
|
423
877
|
// update new shape
|
|
424
|
-
dispatch(mapStoreActions.
|
|
878
|
+
dispatch(mapStoreActions.layerSetGeojsonFromLayer({
|
|
425
879
|
layerId: currentDrawLayerId,
|
|
426
|
-
|
|
880
|
+
sourceLayerId: drawDialogLayerId
|
|
427
881
|
}));
|
|
428
882
|
// remove current shape
|
|
429
883
|
clearGeoJSON(drawDialogLayerId);
|
|
@@ -579,17 +1033,17 @@ var $TypeError$b = TypeError;
|
|
|
579
1033
|
|
|
580
1034
|
// `RequireObjectCoercible` abstract operation
|
|
581
1035
|
// https://tc39.es/ecma262/#sec-requireobjectcoercible
|
|
582
|
-
var requireObjectCoercible$
|
|
1036
|
+
var requireObjectCoercible$6 = function (it) {
|
|
583
1037
|
if (isNullOrUndefined$3(it)) throw new $TypeError$b("Can't call method on " + it);
|
|
584
1038
|
return it;
|
|
585
1039
|
};
|
|
586
1040
|
|
|
587
1041
|
// toObject with fallback for non-array-like ES3 strings
|
|
588
1042
|
var IndexedObject$2 = indexedObject;
|
|
589
|
-
var requireObjectCoercible$
|
|
1043
|
+
var requireObjectCoercible$5 = requireObjectCoercible$6;
|
|
590
1044
|
|
|
591
1045
|
var toIndexedObject$5 = function (it) {
|
|
592
|
-
return IndexedObject$2(requireObjectCoercible$
|
|
1046
|
+
return IndexedObject$2(requireObjectCoercible$5(it));
|
|
593
1047
|
};
|
|
594
1048
|
|
|
595
1049
|
var check = function (it) {
|
|
@@ -597,7 +1051,7 @@ var check = function (it) {
|
|
|
597
1051
|
};
|
|
598
1052
|
|
|
599
1053
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
600
|
-
var global$
|
|
1054
|
+
var global$i =
|
|
601
1055
|
// eslint-disable-next-line es/no-global-this -- safe
|
|
602
1056
|
check(typeof globalThis == 'object' && globalThis) ||
|
|
603
1057
|
check(typeof window == 'object' && window) ||
|
|
@@ -608,49 +1062,49 @@ var global$j =
|
|
|
608
1062
|
// eslint-disable-next-line no-new-func -- fallback
|
|
609
1063
|
(function () { return this; })() || Function('return this')();
|
|
610
1064
|
|
|
611
|
-
var
|
|
1065
|
+
var sharedStore = {exports: {}};
|
|
612
1066
|
|
|
613
|
-
var global$
|
|
1067
|
+
var global$h = global$i;
|
|
614
1068
|
|
|
615
1069
|
// eslint-disable-next-line es/no-object-defineproperty -- safe
|
|
616
1070
|
var defineProperty$7 = Object.defineProperty;
|
|
617
1071
|
|
|
618
1072
|
var defineGlobalProperty$3 = function (key, value) {
|
|
619
1073
|
try {
|
|
620
|
-
defineProperty$7(global$
|
|
1074
|
+
defineProperty$7(global$h, key, { value: value, configurable: true, writable: true });
|
|
621
1075
|
} catch (error) {
|
|
622
|
-
global$
|
|
1076
|
+
global$h[key] = value;
|
|
623
1077
|
} return value;
|
|
624
1078
|
};
|
|
625
1079
|
|
|
626
|
-
var
|
|
1080
|
+
var globalThis$1 = global$i;
|
|
627
1081
|
var defineGlobalProperty$2 = defineGlobalProperty$3;
|
|
628
1082
|
|
|
629
1083
|
var SHARED = '__core-js_shared__';
|
|
630
|
-
var store$3 =
|
|
631
|
-
|
|
632
|
-
var sharedStore = store$3;
|
|
1084
|
+
var store$3 = sharedStore.exports = globalThis$1[SHARED] || defineGlobalProperty$2(SHARED, {});
|
|
633
1085
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
(shared$4.exports = function (key, value) {
|
|
637
|
-
return store$2[key] || (store$2[key] = value !== undefined ? value : {});
|
|
638
|
-
})('versions', []).push({
|
|
639
|
-
version: '3.35.1',
|
|
1086
|
+
(store$3.versions || (store$3.versions = [])).push({
|
|
1087
|
+
version: '3.36.1',
|
|
640
1088
|
mode: 'global',
|
|
641
1089
|
copyright: '© 2014-2024 Denis Pushkarev (zloirock.ru)',
|
|
642
|
-
license: 'https://github.com/zloirock/core-js/blob/v3.
|
|
1090
|
+
license: 'https://github.com/zloirock/core-js/blob/v3.36.1/LICENSE',
|
|
643
1091
|
source: 'https://github.com/zloirock/core-js'
|
|
644
1092
|
});
|
|
645
1093
|
|
|
646
|
-
var
|
|
1094
|
+
var store$2 = sharedStore.exports;
|
|
1095
|
+
|
|
1096
|
+
var shared$4 = function (key, value) {
|
|
1097
|
+
return store$2[key] || (store$2[key] = value || {});
|
|
1098
|
+
};
|
|
1099
|
+
|
|
1100
|
+
var requireObjectCoercible$4 = requireObjectCoercible$6;
|
|
647
1101
|
|
|
648
1102
|
var $Object$3 = Object;
|
|
649
1103
|
|
|
650
1104
|
// `ToObject` abstract operation
|
|
651
1105
|
// https://tc39.es/ecma262/#sec-toobject
|
|
652
1106
|
var toObject$5 = function (argument) {
|
|
653
|
-
return $Object$3(requireObjectCoercible$
|
|
1107
|
+
return $Object$3(requireObjectCoercible$4(argument));
|
|
654
1108
|
};
|
|
655
1109
|
|
|
656
1110
|
var uncurryThis$g = functionUncurryThis;
|
|
@@ -677,7 +1131,7 @@ var uid$2 = function (key) {
|
|
|
677
1131
|
|
|
678
1132
|
var engineUserAgent = typeof navigator != 'undefined' && String(navigator.userAgent) || '';
|
|
679
1133
|
|
|
680
|
-
var global$g = global$
|
|
1134
|
+
var global$g = global$i;
|
|
681
1135
|
var userAgent = engineUserAgent;
|
|
682
1136
|
|
|
683
1137
|
var process = global$g.process;
|
|
@@ -708,7 +1162,7 @@ var engineV8Version = version;
|
|
|
708
1162
|
/* eslint-disable es/no-symbol -- required for testing */
|
|
709
1163
|
var V8_VERSION = engineV8Version;
|
|
710
1164
|
var fails$i = fails$l;
|
|
711
|
-
var global$f = global$
|
|
1165
|
+
var global$f = global$i;
|
|
712
1166
|
|
|
713
1167
|
var $String$5 = global$f.String;
|
|
714
1168
|
|
|
@@ -731,8 +1185,8 @@ var useSymbolAsUid = NATIVE_SYMBOL$2
|
|
|
731
1185
|
&& !Symbol.sham
|
|
732
1186
|
&& typeof Symbol.iterator == 'symbol';
|
|
733
1187
|
|
|
734
|
-
var global$e = global$
|
|
735
|
-
var shared$3 = shared$4
|
|
1188
|
+
var global$e = global$i;
|
|
1189
|
+
var shared$3 = shared$4;
|
|
736
1190
|
var hasOwn$a = hasOwnProperty_1;
|
|
737
1191
|
var uid$1 = uid$2;
|
|
738
1192
|
var NATIVE_SYMBOL$1 = symbolConstructorDetection;
|
|
@@ -764,18 +1218,18 @@ var isCallable$i = typeof documentAll == 'undefined' && documentAll !== undefine
|
|
|
764
1218
|
|
|
765
1219
|
var isCallable$h = isCallable$i;
|
|
766
1220
|
|
|
767
|
-
var isObject$
|
|
1221
|
+
var isObject$a = function (it) {
|
|
768
1222
|
return typeof it == 'object' ? it !== null : isCallable$h(it);
|
|
769
1223
|
};
|
|
770
1224
|
|
|
771
|
-
var isObject$
|
|
1225
|
+
var isObject$9 = isObject$a;
|
|
772
1226
|
|
|
773
1227
|
var $String$4 = String;
|
|
774
1228
|
var $TypeError$a = TypeError;
|
|
775
1229
|
|
|
776
1230
|
// `Assert: Type(argument) is Object`
|
|
777
|
-
var anObject$
|
|
778
|
-
if (isObject$
|
|
1231
|
+
var anObject$8 = function (argument) {
|
|
1232
|
+
if (isObject$9(argument)) return argument;
|
|
779
1233
|
throw new $TypeError$a($String$4(argument) + ' is not an object');
|
|
780
1234
|
};
|
|
781
1235
|
|
|
@@ -804,12 +1258,12 @@ var v8PrototypeDefineBug = DESCRIPTORS$c && fails$g(function () {
|
|
|
804
1258
|
|
|
805
1259
|
var objectDefineProperty = {};
|
|
806
1260
|
|
|
807
|
-
var global$d = global$
|
|
808
|
-
var isObject$
|
|
1261
|
+
var global$d = global$i;
|
|
1262
|
+
var isObject$8 = isObject$a;
|
|
809
1263
|
|
|
810
1264
|
var document$1 = global$d.document;
|
|
811
1265
|
// typeof document.createElement is 'object' in old IE
|
|
812
|
-
var EXISTS$1 = isObject$
|
|
1266
|
+
var EXISTS$1 = isObject$8(document$1) && isObject$8(document$1.createElement);
|
|
813
1267
|
|
|
814
1268
|
var documentCreateElement$2 = function (it) {
|
|
815
1269
|
return EXISTS$1 ? document$1.createElement(it) : {};
|
|
@@ -835,7 +1289,7 @@ var functionCall = NATIVE_BIND$1 ? call$a.bind(call$a) : function () {
|
|
|
835
1289
|
return call$a.apply(call$a, arguments);
|
|
836
1290
|
};
|
|
837
1291
|
|
|
838
|
-
var global$c = global$
|
|
1292
|
+
var global$c = global$i;
|
|
839
1293
|
var isCallable$g = isCallable$i;
|
|
840
1294
|
|
|
841
1295
|
var aFunction = function (argument) {
|
|
@@ -897,7 +1351,7 @@ var getMethod$2 = function (V, P) {
|
|
|
897
1351
|
|
|
898
1352
|
var call$9 = functionCall;
|
|
899
1353
|
var isCallable$d = isCallable$i;
|
|
900
|
-
var isObject$
|
|
1354
|
+
var isObject$7 = isObject$a;
|
|
901
1355
|
|
|
902
1356
|
var $TypeError$8 = TypeError;
|
|
903
1357
|
|
|
@@ -905,14 +1359,14 @@ var $TypeError$8 = TypeError;
|
|
|
905
1359
|
// https://tc39.es/ecma262/#sec-ordinarytoprimitive
|
|
906
1360
|
var ordinaryToPrimitive$1 = function (input, pref) {
|
|
907
1361
|
var fn, val;
|
|
908
|
-
if (pref === 'string' && isCallable$d(fn = input.toString) && !isObject$
|
|
909
|
-
if (isCallable$d(fn = input.valueOf) && !isObject$
|
|
910
|
-
if (pref !== 'string' && isCallable$d(fn = input.toString) && !isObject$
|
|
1362
|
+
if (pref === 'string' && isCallable$d(fn = input.toString) && !isObject$7(val = call$9(fn, input))) return val;
|
|
1363
|
+
if (isCallable$d(fn = input.valueOf) && !isObject$7(val = call$9(fn, input))) return val;
|
|
1364
|
+
if (pref !== 'string' && isCallable$d(fn = input.toString) && !isObject$7(val = call$9(fn, input))) return val;
|
|
911
1365
|
throw new $TypeError$8("Can't convert object to primitive value");
|
|
912
1366
|
};
|
|
913
1367
|
|
|
914
1368
|
var call$8 = functionCall;
|
|
915
|
-
var isObject$
|
|
1369
|
+
var isObject$6 = isObject$a;
|
|
916
1370
|
var isSymbol$1 = isSymbol$2;
|
|
917
1371
|
var getMethod$1 = getMethod$2;
|
|
918
1372
|
var ordinaryToPrimitive = ordinaryToPrimitive$1;
|
|
@@ -924,13 +1378,13 @@ var TO_PRIMITIVE = wellKnownSymbol$9('toPrimitive');
|
|
|
924
1378
|
// `ToPrimitive` abstract operation
|
|
925
1379
|
// https://tc39.es/ecma262/#sec-toprimitive
|
|
926
1380
|
var toPrimitive$1 = function (input, pref) {
|
|
927
|
-
if (!isObject$
|
|
1381
|
+
if (!isObject$6(input) || isSymbol$1(input)) return input;
|
|
928
1382
|
var exoticToPrim = getMethod$1(input, TO_PRIMITIVE);
|
|
929
1383
|
var result;
|
|
930
1384
|
if (exoticToPrim) {
|
|
931
1385
|
if (pref === undefined) pref = 'default';
|
|
932
1386
|
result = call$8(exoticToPrim, input, pref);
|
|
933
|
-
if (!isObject$
|
|
1387
|
+
if (!isObject$6(result) || isSymbol$1(result)) return result;
|
|
934
1388
|
throw new $TypeError$7("Can't convert object to primitive value");
|
|
935
1389
|
}
|
|
936
1390
|
if (pref === undefined) pref = 'number';
|
|
@@ -950,7 +1404,7 @@ var toPropertyKey$2 = function (argument) {
|
|
|
950
1404
|
var DESCRIPTORS$a = descriptors;
|
|
951
1405
|
var IE8_DOM_DEFINE$1 = ie8DomDefine;
|
|
952
1406
|
var V8_PROTOTYPE_DEFINE_BUG$1 = v8PrototypeDefineBug;
|
|
953
|
-
var anObject$
|
|
1407
|
+
var anObject$7 = anObject$8;
|
|
954
1408
|
var toPropertyKey$1 = toPropertyKey$2;
|
|
955
1409
|
|
|
956
1410
|
var $TypeError$6 = TypeError;
|
|
@@ -965,9 +1419,9 @@ var WRITABLE = 'writable';
|
|
|
965
1419
|
// `Object.defineProperty` method
|
|
966
1420
|
// https://tc39.es/ecma262/#sec-object.defineproperty
|
|
967
1421
|
objectDefineProperty.f = DESCRIPTORS$a ? V8_PROTOTYPE_DEFINE_BUG$1 ? function defineProperty(O, P, Attributes) {
|
|
968
|
-
anObject$
|
|
1422
|
+
anObject$7(O);
|
|
969
1423
|
P = toPropertyKey$1(P);
|
|
970
|
-
anObject$
|
|
1424
|
+
anObject$7(Attributes);
|
|
971
1425
|
if (typeof O === 'function' && P === 'prototype' && 'value' in Attributes && WRITABLE in Attributes && !Attributes[WRITABLE]) {
|
|
972
1426
|
var current = $getOwnPropertyDescriptor$1(O, P);
|
|
973
1427
|
if (current && current[WRITABLE]) {
|
|
@@ -980,9 +1434,9 @@ objectDefineProperty.f = DESCRIPTORS$a ? V8_PROTOTYPE_DEFINE_BUG$1 ? function de
|
|
|
980
1434
|
}
|
|
981
1435
|
} return $defineProperty(O, P, Attributes);
|
|
982
1436
|
} : $defineProperty : function defineProperty(O, P, Attributes) {
|
|
983
|
-
anObject$
|
|
1437
|
+
anObject$7(O);
|
|
984
1438
|
P = toPropertyKey$1(P);
|
|
985
|
-
anObject$
|
|
1439
|
+
anObject$7(Attributes);
|
|
986
1440
|
if (IE8_DOM_DEFINE$1) try {
|
|
987
1441
|
return $defineProperty(O, P, Attributes);
|
|
988
1442
|
} catch (error) { /* empty */ }
|
|
@@ -1053,6 +1507,7 @@ var createMethod$3 = function (IS_INCLUDES) {
|
|
|
1053
1507
|
return function ($this, el, fromIndex) {
|
|
1054
1508
|
var O = toIndexedObject$4($this);
|
|
1055
1509
|
var length = lengthOfArrayLike$2(O);
|
|
1510
|
+
if (length === 0) return !IS_INCLUDES && -1;
|
|
1056
1511
|
var index = toAbsoluteIndex(fromIndex, length);
|
|
1057
1512
|
var value;
|
|
1058
1513
|
// Array#includes uses SameValueZero equality algorithm
|
|
@@ -1124,7 +1579,7 @@ var objectKeys$2 = Object.keys || function keys(O) {
|
|
|
1124
1579
|
var DESCRIPTORS$9 = descriptors;
|
|
1125
1580
|
var V8_PROTOTYPE_DEFINE_BUG = v8PrototypeDefineBug;
|
|
1126
1581
|
var definePropertyModule$3 = objectDefineProperty;
|
|
1127
|
-
var anObject$
|
|
1582
|
+
var anObject$6 = anObject$8;
|
|
1128
1583
|
var toIndexedObject$2 = toIndexedObject$5;
|
|
1129
1584
|
var objectKeys$1 = objectKeys$2;
|
|
1130
1585
|
|
|
@@ -1132,7 +1587,7 @@ var objectKeys$1 = objectKeys$2;
|
|
|
1132
1587
|
// https://tc39.es/ecma262/#sec-object.defineproperties
|
|
1133
1588
|
// eslint-disable-next-line es/no-object-defineproperties -- safe
|
|
1134
1589
|
objectDefineProperties.f = DESCRIPTORS$9 && !V8_PROTOTYPE_DEFINE_BUG ? Object.defineProperties : function defineProperties(O, Properties) {
|
|
1135
|
-
anObject$
|
|
1590
|
+
anObject$6(O);
|
|
1136
1591
|
var props = toIndexedObject$2(Properties);
|
|
1137
1592
|
var keys = objectKeys$1(Properties);
|
|
1138
1593
|
var length = keys.length;
|
|
@@ -1146,7 +1601,7 @@ var getBuiltIn$3 = getBuiltIn$5;
|
|
|
1146
1601
|
|
|
1147
1602
|
var html$1 = getBuiltIn$3('document', 'documentElement');
|
|
1148
1603
|
|
|
1149
|
-
var shared$2 = shared$4
|
|
1604
|
+
var shared$2 = shared$4;
|
|
1150
1605
|
var uid = uid$2;
|
|
1151
1606
|
|
|
1152
1607
|
var keys = shared$2('keys');
|
|
@@ -1156,7 +1611,7 @@ var sharedKey$3 = function (key) {
|
|
|
1156
1611
|
};
|
|
1157
1612
|
|
|
1158
1613
|
/* global ActiveXObject -- old IE, WSH */
|
|
1159
|
-
var anObject$
|
|
1614
|
+
var anObject$5 = anObject$8;
|
|
1160
1615
|
var definePropertiesModule = objectDefineProperties;
|
|
1161
1616
|
var enumBugKeys$1 = enumBugKeys$3;
|
|
1162
1617
|
var hiddenKeys$2 = hiddenKeys$4;
|
|
@@ -1230,7 +1685,7 @@ hiddenKeys$2[IE_PROTO$1] = true;
|
|
|
1230
1685
|
var objectCreate = Object.create || function create(O, Properties) {
|
|
1231
1686
|
var result;
|
|
1232
1687
|
if (O !== null) {
|
|
1233
|
-
EmptyConstructor[PROTOTYPE] = anObject$
|
|
1688
|
+
EmptyConstructor[PROTOTYPE] = anObject$5(O);
|
|
1234
1689
|
result = new EmptyConstructor();
|
|
1235
1690
|
EmptyConstructor[PROTOTYPE] = null;
|
|
1236
1691
|
// add "__proto__" for Object.getPrototypeOf polyfill
|
|
@@ -1262,7 +1717,7 @@ var addToUnscopables$1 = function (key) {
|
|
|
1262
1717
|
|
|
1263
1718
|
var iterators = {};
|
|
1264
1719
|
|
|
1265
|
-
var global$b = global$
|
|
1720
|
+
var global$b = global$i;
|
|
1266
1721
|
var isCallable$c = isCallable$i;
|
|
1267
1722
|
|
|
1268
1723
|
var WeakMap$1 = global$b.WeakMap;
|
|
@@ -1290,11 +1745,11 @@ var createNonEnumerableProperty$8 = DESCRIPTORS$8 ? function (object, key, value
|
|
|
1290
1745
|
};
|
|
1291
1746
|
|
|
1292
1747
|
var NATIVE_WEAK_MAP = weakMapBasicDetection;
|
|
1293
|
-
var global$a = global$
|
|
1294
|
-
var isObject$
|
|
1748
|
+
var global$a = global$i;
|
|
1749
|
+
var isObject$5 = isObject$a;
|
|
1295
1750
|
var createNonEnumerableProperty$7 = createNonEnumerableProperty$8;
|
|
1296
1751
|
var hasOwn$8 = hasOwnProperty_1;
|
|
1297
|
-
var shared$1 = sharedStore;
|
|
1752
|
+
var shared$1 = sharedStore.exports;
|
|
1298
1753
|
var sharedKey$1 = sharedKey$3;
|
|
1299
1754
|
var hiddenKeys$1 = hiddenKeys$4;
|
|
1300
1755
|
|
|
@@ -1310,7 +1765,7 @@ var enforce = function (it) {
|
|
|
1310
1765
|
var getterFor = function (TYPE) {
|
|
1311
1766
|
return function (it) {
|
|
1312
1767
|
var state;
|
|
1313
|
-
if (!isObject$
|
|
1768
|
+
if (!isObject$5(it) || (state = get(it)).type !== TYPE) {
|
|
1314
1769
|
throw new TypeError$1('Incompatible receiver, ' + TYPE + ' required');
|
|
1315
1770
|
} return state;
|
|
1316
1771
|
};
|
|
@@ -1423,7 +1878,7 @@ var functionName = {
|
|
|
1423
1878
|
|
|
1424
1879
|
var uncurryThis$c = functionUncurryThis;
|
|
1425
1880
|
var isCallable$b = isCallable$i;
|
|
1426
|
-
var store = sharedStore;
|
|
1881
|
+
var store = sharedStore.exports;
|
|
1427
1882
|
|
|
1428
1883
|
var functionToString = uncurryThis$c(Function.toString);
|
|
1429
1884
|
|
|
@@ -1542,13 +1997,13 @@ var getBuiltIn$2 = getBuiltIn$5;
|
|
|
1542
1997
|
var uncurryThis$a = functionUncurryThis;
|
|
1543
1998
|
var getOwnPropertyNamesModule = objectGetOwnPropertyNames;
|
|
1544
1999
|
var getOwnPropertySymbolsModule$1 = objectGetOwnPropertySymbols;
|
|
1545
|
-
var anObject$
|
|
2000
|
+
var anObject$4 = anObject$8;
|
|
1546
2001
|
|
|
1547
2002
|
var concat$1 = uncurryThis$a([].concat);
|
|
1548
2003
|
|
|
1549
2004
|
// all object keys, includes non-enumerable and symbols
|
|
1550
2005
|
var ownKeys$1 = getBuiltIn$2('Reflect', 'ownKeys') || function ownKeys(it) {
|
|
1551
|
-
var keys = getOwnPropertyNamesModule.f(anObject$
|
|
2006
|
+
var keys = getOwnPropertyNamesModule.f(anObject$4(it));
|
|
1552
2007
|
var getOwnPropertySymbols = getOwnPropertySymbolsModule$1.f;
|
|
1553
2008
|
return getOwnPropertySymbols ? concat$1(keys, getOwnPropertySymbols(it)) : keys;
|
|
1554
2009
|
};
|
|
@@ -1593,7 +2048,7 @@ var POLYFILL = isForced$1.POLYFILL = 'P';
|
|
|
1593
2048
|
|
|
1594
2049
|
var isForced_1 = isForced$1;
|
|
1595
2050
|
|
|
1596
|
-
var global$9 = global$
|
|
2051
|
+
var global$9 = global$i;
|
|
1597
2052
|
var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
|
|
1598
2053
|
var createNonEnumerableProperty$6 = createNonEnumerableProperty$8;
|
|
1599
2054
|
var defineBuiltIn$3 = defineBuiltIn$4;
|
|
@@ -1681,7 +2136,7 @@ var objectGetPrototypeOf = CORRECT_PROTOTYPE_GETTER ? $Object$1.getPrototypeOf :
|
|
|
1681
2136
|
|
|
1682
2137
|
var fails$b = fails$l;
|
|
1683
2138
|
var isCallable$6 = isCallable$i;
|
|
1684
|
-
var isObject$
|
|
2139
|
+
var isObject$4 = isObject$a;
|
|
1685
2140
|
var getPrototypeOf$1 = objectGetPrototypeOf;
|
|
1686
2141
|
var defineBuiltIn$2 = defineBuiltIn$4;
|
|
1687
2142
|
var wellKnownSymbol$7 = wellKnownSymbol$a;
|
|
@@ -1704,7 +2159,7 @@ if ([].keys) {
|
|
|
1704
2159
|
}
|
|
1705
2160
|
}
|
|
1706
2161
|
|
|
1707
|
-
var NEW_ITERATOR_PROTOTYPE = !isObject$
|
|
2162
|
+
var NEW_ITERATOR_PROTOTYPE = !isObject$4(IteratorPrototype$2) || fails$b(function () {
|
|
1708
2163
|
var test = {};
|
|
1709
2164
|
// FF44- legacy iterators case
|
|
1710
2165
|
return IteratorPrototype$2[ITERATOR$3].call(test) !== test;
|
|
@@ -1764,10 +2219,10 @@ var functionUncurryThisAccessor = function (object, key, method) {
|
|
|
1764
2219
|
} catch (error) { /* empty */ }
|
|
1765
2220
|
};
|
|
1766
2221
|
|
|
1767
|
-
var isObject$
|
|
2222
|
+
var isObject$3 = isObject$a;
|
|
1768
2223
|
|
|
1769
2224
|
var isPossiblePrototype$1 = function (argument) {
|
|
1770
|
-
return isObject$
|
|
2225
|
+
return isObject$3(argument) || argument === null;
|
|
1771
2226
|
};
|
|
1772
2227
|
|
|
1773
2228
|
var isPossiblePrototype = isPossiblePrototype$1;
|
|
@@ -1782,7 +2237,8 @@ var aPossiblePrototype$1 = function (argument) {
|
|
|
1782
2237
|
|
|
1783
2238
|
/* eslint-disable no-proto -- safe */
|
|
1784
2239
|
var uncurryThisAccessor = functionUncurryThisAccessor;
|
|
1785
|
-
var
|
|
2240
|
+
var isObject$2 = isObject$a;
|
|
2241
|
+
var requireObjectCoercible$3 = requireObjectCoercible$6;
|
|
1786
2242
|
var aPossiblePrototype = aPossiblePrototype$1;
|
|
1787
2243
|
|
|
1788
2244
|
// `Object.setPrototypeOf` method
|
|
@@ -1799,8 +2255,9 @@ var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? functio
|
|
|
1799
2255
|
CORRECT_SETTER = test instanceof Array;
|
|
1800
2256
|
} catch (error) { /* empty */ }
|
|
1801
2257
|
return function setPrototypeOf(O, proto) {
|
|
1802
|
-
|
|
2258
|
+
requireObjectCoercible$3(O);
|
|
1803
2259
|
aPossiblePrototype(proto);
|
|
2260
|
+
if (!isObject$2(O)) return O;
|
|
1804
2261
|
if (CORRECT_SETTER) setter(O, proto);
|
|
1805
2262
|
else O.__proto__ = proto;
|
|
1806
2263
|
return O;
|
|
@@ -2085,7 +2542,7 @@ var DOMTokenListPrototype$1 = classList && classList.constructor && classList.co
|
|
|
2085
2542
|
|
|
2086
2543
|
var domTokenListPrototype = DOMTokenListPrototype$1 === Object.prototype ? undefined : DOMTokenListPrototype$1;
|
|
2087
2544
|
|
|
2088
|
-
var global$8 = global$
|
|
2545
|
+
var global$8 = global$i;
|
|
2089
2546
|
var DOMIterables = domIterables;
|
|
2090
2547
|
var DOMTokenListPrototype = domTokenListPrototype;
|
|
2091
2548
|
var ArrayIteratorMethods = es_array_iterator;
|
|
@@ -2232,14 +2689,8 @@ const OBJECT_ITEM_SIZE = 50;
|
|
|
2232
2689
|
const OBJECT_ITEM_SIZE_SMALL_WIDTH = 72;
|
|
2233
2690
|
const HEADER_ITEM_SIZE = 28;
|
|
2234
2691
|
const BREAKPOINT = 320;
|
|
2235
|
-
const NO_OBJECTS_FOUND = 'No objects found';
|
|
2236
|
-
const BUTTON_EDIT$2 = 'Edit';
|
|
2237
|
-
const BUTTON_DELETE$2 = 'Delete';
|
|
2238
|
-
const BUTTON_SHARE = 'Share';
|
|
2239
2692
|
const BUTTON_AIRMET = 'AIRMET';
|
|
2240
2693
|
const BUTTON_SIGMET = 'SIGMET';
|
|
2241
|
-
const BUTTON_PUBLIC_WARNING = 'PUBLIC WARNING';
|
|
2242
|
-
const MENU_SHARE = 'Share object to';
|
|
2243
2694
|
const getListInclHeaders = objects => {
|
|
2244
2695
|
const listInclHeaders = [];
|
|
2245
2696
|
const headerList = [];
|
|
@@ -2307,6 +2758,9 @@ const Objects = ({
|
|
|
2307
2758
|
activeObject,
|
|
2308
2759
|
isLoading: _isLoading = false
|
|
2309
2760
|
}) => {
|
|
2761
|
+
const {
|
|
2762
|
+
t
|
|
2763
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
2310
2764
|
const listRef = React__default.useRef(null);
|
|
2311
2765
|
const {
|
|
2312
2766
|
listInclHeaders,
|
|
@@ -2343,7 +2797,7 @@ const Objects = ({
|
|
|
2343
2797
|
paddingTop: '8px'
|
|
2344
2798
|
},
|
|
2345
2799
|
variant: "body1"
|
|
2346
|
-
},
|
|
2800
|
+
}, t('object-manager-no-objects'))) : ( /*#__PURE__*/React__default.createElement(VariableSizeList, {
|
|
2347
2801
|
height: _height - DEFAULT_ADD_BUTTON_HEIGHT,
|
|
2348
2802
|
width: _width,
|
|
2349
2803
|
itemCount: listInclHeaders.length,
|
|
@@ -2397,10 +2851,10 @@ const Objects = ({
|
|
|
2397
2851
|
}
|
|
2398
2852
|
},
|
|
2399
2853
|
buttonIcon: /*#__PURE__*/React__default.createElement(Share, null),
|
|
2400
|
-
menuTitle:
|
|
2401
|
-
tooltipTitle:
|
|
2854
|
+
menuTitle: t('object-manager-share-menu'),
|
|
2855
|
+
tooltipTitle: t('object-manager-button-share'),
|
|
2402
2856
|
menuPosition: "bottom",
|
|
2403
|
-
"aria-label":
|
|
2857
|
+
"aria-label": t('object-manager-button-share'),
|
|
2404
2858
|
menuItems: [{
|
|
2405
2859
|
text: BUTTON_AIRMET,
|
|
2406
2860
|
action: () => {},
|
|
@@ -2412,7 +2866,7 @@ const Objects = ({
|
|
|
2412
2866
|
icon: /*#__PURE__*/React__default.createElement(ExitDomain, null),
|
|
2413
2867
|
isDisabled: true
|
|
2414
2868
|
}, {
|
|
2415
|
-
text:
|
|
2869
|
+
text: t('public-warning-title').toUpperCase(),
|
|
2416
2870
|
action: () => {
|
|
2417
2871
|
onClickShare(object);
|
|
2418
2872
|
},
|
|
@@ -2422,18 +2876,18 @@ const Objects = ({
|
|
|
2422
2876
|
item: true,
|
|
2423
2877
|
className: "objectActions"
|
|
2424
2878
|
}, /*#__PURE__*/React__default.createElement(ToggleMenu, {
|
|
2425
|
-
menuTitle:
|
|
2426
|
-
tooltipTitle:
|
|
2879
|
+
menuTitle: t('object-manager-options-menu'),
|
|
2880
|
+
tooltipTitle: t('object-manager-options-menu'),
|
|
2427
2881
|
menuPosition: "bottom",
|
|
2428
2882
|
"aria-label": "Options",
|
|
2429
2883
|
menuItems: [{
|
|
2430
|
-
text:
|
|
2884
|
+
text: t('object-manager-button-edit'),
|
|
2431
2885
|
action: () => {
|
|
2432
2886
|
onClickEdit(object.id);
|
|
2433
2887
|
},
|
|
2434
2888
|
icon: /*#__PURE__*/React__default.createElement(Edit, null)
|
|
2435
2889
|
}, {
|
|
2436
|
-
text:
|
|
2890
|
+
text: t('object-manager-button-delete'),
|
|
2437
2891
|
action: () => {
|
|
2438
2892
|
onClickDelete(object.id);
|
|
2439
2893
|
},
|
|
@@ -2489,7 +2943,6 @@ const DEFAULT_OBJECT_MANAGER_MIN_SIZE = {
|
|
|
2489
2943
|
width: 160,
|
|
2490
2944
|
height: 300
|
|
2491
2945
|
};
|
|
2492
|
-
const BUTTON_ADD_OBJECT$1 = 'Add a new object';
|
|
2493
2946
|
const ObjectManager = ({
|
|
2494
2947
|
bounds,
|
|
2495
2948
|
onClose,
|
|
@@ -2512,6 +2965,9 @@ const ObjectManager = ({
|
|
|
2512
2965
|
error,
|
|
2513
2966
|
isLoading: _isLoading = false
|
|
2514
2967
|
}) => {
|
|
2968
|
+
const {
|
|
2969
|
+
t
|
|
2970
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
2515
2971
|
const minSize = DEFAULT_OBJECT_MANAGER_MIN_SIZE;
|
|
2516
2972
|
const startSizeCalc = calculateStartSize(minSize, _size, _startPosition);
|
|
2517
2973
|
const [sizeInState, setSizeInState] = React.useState(startSizeCalc);
|
|
@@ -2588,7 +3044,7 @@ const ObjectManager = ({
|
|
|
2588
3044
|
textTransform: 'none',
|
|
2589
3045
|
fontSize: '12px'
|
|
2590
3046
|
}
|
|
2591
|
-
},
|
|
3047
|
+
}, t('object-manager-add'))));
|
|
2592
3048
|
};
|
|
2593
3049
|
|
|
2594
3050
|
/* *
|
|
@@ -2659,16 +3115,17 @@ const createApi$1 = props => {
|
|
|
2659
3115
|
return getApiRoutes$1(props.auth ? authInstance : nonAuthInstance);
|
|
2660
3116
|
};
|
|
2661
3117
|
|
|
2662
|
-
const
|
|
2663
|
-
const
|
|
2664
|
-
const CANCEL$1 = 'Cancel';
|
|
2665
|
-
const getDeleteDescription = objectName => `Are you sure you want to delete "${objectName}"?`;
|
|
3118
|
+
const getDeleteDescription = (objectName, t) => `${t('delete-dialog-description')} "${objectName}"?`;
|
|
3119
|
+
const getDeleteSucces = (objectName, t) => `Object "${objectName}" ${t('delete-succes')}`;
|
|
2666
3120
|
const ConfirmDeleteDialog = ({
|
|
2667
3121
|
objectId,
|
|
2668
3122
|
objectName,
|
|
2669
3123
|
onDeleteSucces: _onDeleteSucces = () => {},
|
|
2670
3124
|
onClose: _onClose = () => {}
|
|
2671
3125
|
}) => {
|
|
3126
|
+
const {
|
|
3127
|
+
t
|
|
3128
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
2672
3129
|
const warningsApi = getWarningsApi();
|
|
2673
3130
|
const [isLoading, setIsLoading] = React__default.useState(false);
|
|
2674
3131
|
const [error, setError] = React__default.useState(undefined);
|
|
@@ -2683,12 +3140,12 @@ const ConfirmDeleteDialog = ({
|
|
|
2683
3140
|
setIsLoading(false);
|
|
2684
3141
|
}
|
|
2685
3142
|
});
|
|
2686
|
-
const description = getDeleteDescription(objectName);
|
|
3143
|
+
const description = getDeleteDescription(objectName, t);
|
|
2687
3144
|
return /*#__PURE__*/React__default.createElement(ConfirmationDialog, Object.assign({
|
|
2688
|
-
title:
|
|
3145
|
+
title: t('delete-dialog-title'),
|
|
2689
3146
|
open: true,
|
|
2690
|
-
confirmLabel:
|
|
2691
|
-
cancelLabel:
|
|
3147
|
+
confirmLabel: t('delete-dialog-confirm'),
|
|
3148
|
+
cancelLabel: t('delete-dialog-cancel'),
|
|
2692
3149
|
description: !error ? description : '',
|
|
2693
3150
|
onClose: _onClose,
|
|
2694
3151
|
onSubmit: onSubmit,
|
|
@@ -2941,11 +3398,13 @@ const {
|
|
|
2941
3398
|
} = slice;
|
|
2942
3399
|
const publicWarningFormActions = slice.actions;
|
|
2943
3400
|
|
|
2944
|
-
const getDeleteSucces = objectName => `${objectName} has been deleted`;
|
|
2945
3401
|
const ObjectManagerConnect = ({
|
|
2946
3402
|
bounds,
|
|
2947
3403
|
source: _source = 'app'
|
|
2948
3404
|
}) => {
|
|
3405
|
+
const {
|
|
3406
|
+
t
|
|
3407
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
2949
3408
|
const {
|
|
2950
3409
|
dialogOrder,
|
|
2951
3410
|
setDialogOrder,
|
|
@@ -3095,7 +3554,7 @@ const ObjectManagerConnect = ({
|
|
|
3095
3554
|
if (activeDrawingId && activeDrawingId === objectId) {
|
|
3096
3555
|
deleteGeoJSONLayer();
|
|
3097
3556
|
}
|
|
3098
|
-
openSnackbar(getDeleteSucces(objectName));
|
|
3557
|
+
openSnackbar(getDeleteSucces(objectName, t));
|
|
3099
3558
|
fetchDrawings();
|
|
3100
3559
|
};
|
|
3101
3560
|
const onDeleteDrawing = objectId => {
|
|
@@ -3110,7 +3569,7 @@ const ObjectManagerConnect = ({
|
|
|
3110
3569
|
return null;
|
|
3111
3570
|
}
|
|
3112
3571
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ObjectManager, {
|
|
3113
|
-
title:
|
|
3572
|
+
title: `${t('object-manager-title')} ${mapId}`,
|
|
3114
3573
|
bounds: bounds,
|
|
3115
3574
|
isOpen: isDialogOpen,
|
|
3116
3575
|
onClose: onClose,
|
|
@@ -3160,7 +3619,7 @@ var proxyAccessor$1 = function (Target, Source, key) {
|
|
|
3160
3619
|
};
|
|
3161
3620
|
|
|
3162
3621
|
var isCallable$4 = isCallable$i;
|
|
3163
|
-
var isObject$1 = isObject$
|
|
3622
|
+
var isObject$1 = isObject$a;
|
|
3164
3623
|
var setPrototypeOf$1 = objectSetPrototypeOf;
|
|
3165
3624
|
|
|
3166
3625
|
// makes subclassing work correct for wrapped built-ins
|
|
@@ -3232,7 +3691,7 @@ var normalizeStringArgument$1 = function (argument, $default) {
|
|
|
3232
3691
|
return argument === undefined ? arguments.length < 2 ? '' : $default : toString$6(argument);
|
|
3233
3692
|
};
|
|
3234
3693
|
|
|
3235
|
-
var isObject = isObject$
|
|
3694
|
+
var isObject = isObject$a;
|
|
3236
3695
|
var createNonEnumerableProperty$3 = createNonEnumerableProperty$8;
|
|
3237
3696
|
|
|
3238
3697
|
// `InstallErrorCause` abstract operation
|
|
@@ -3350,7 +3809,7 @@ var wrapErrorConstructorWithCause$1 = function (FULL_NAME, wrapper, FORCED, IS_A
|
|
|
3350
3809
|
|
|
3351
3810
|
/* eslint-disable no-unused-vars -- required for functions `.length` */
|
|
3352
3811
|
var $$4 = _export;
|
|
3353
|
-
var global$7 = global$
|
|
3812
|
+
var global$7 = global$i;
|
|
3354
3813
|
var apply = functionApply;
|
|
3355
3814
|
var wrapErrorConstructorWithCause = wrapErrorConstructorWithCause$1;
|
|
3356
3815
|
|
|
@@ -4865,6 +5324,7 @@ var warningListJSON = [
|
|
|
4865
5324
|
status: "DRAFT",
|
|
4866
5325
|
editor: "user.name",
|
|
4867
5326
|
warningDetail: {
|
|
5327
|
+
id: "550c2b5e-937d-11ee-a1bf-0ab3cf8a98c1",
|
|
4868
5328
|
phenomenon: "fog",
|
|
4869
5329
|
geoJSON: {
|
|
4870
5330
|
type: "FeatureCollection",
|
|
@@ -4908,7 +5368,9 @@ var warningListJSON = [
|
|
|
4908
5368
|
validFrom: "2023-12-05T14:48:09Z",
|
|
4909
5369
|
validUntil: "2023-12-05T18:48:09Z",
|
|
4910
5370
|
level: "moderate",
|
|
4911
|
-
probability: 30
|
|
5371
|
+
probability: 30,
|
|
5372
|
+
descriptionOriginal: "This is the original description",
|
|
5373
|
+
descriptionTranslation: "This is the translation"
|
|
4912
5374
|
}
|
|
4913
5375
|
},
|
|
4914
5376
|
{
|
|
@@ -5431,6 +5893,9 @@ const DrawingToolMapButtonConnect = ({
|
|
|
5431
5893
|
mapId,
|
|
5432
5894
|
source: _source = 'app'
|
|
5433
5895
|
}) => {
|
|
5896
|
+
const {
|
|
5897
|
+
t
|
|
5898
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
5434
5899
|
// const drawingDialogType = isMultiMap
|
|
5435
5900
|
// ? `${uiTypes.DialogTypes.DrawingTool}-${mapId}`
|
|
5436
5901
|
// : uiTypes.DialogTypes.DrawingTool;
|
|
@@ -5449,7 +5914,7 @@ const DrawingToolMapButtonConnect = ({
|
|
|
5449
5914
|
};
|
|
5450
5915
|
const isOpen = drawDialogMapId === mapId && isDrawDialogOpen;
|
|
5451
5916
|
return /*#__PURE__*/React.createElement(MapControlButton, {
|
|
5452
|
-
title:
|
|
5917
|
+
title: t('drawing-tool-title'),
|
|
5453
5918
|
"data-testid": "drawingToolButton",
|
|
5454
5919
|
onClick: onClick,
|
|
5455
5920
|
isActive: isOpen
|
|
@@ -5471,7 +5936,7 @@ const DEFAULT_DRAW_TOOL_MIN_SIZE = {
|
|
|
5471
5936
|
const DrawingTool = ({
|
|
5472
5937
|
bounds,
|
|
5473
5938
|
onClose,
|
|
5474
|
-
title
|
|
5939
|
+
title,
|
|
5475
5940
|
isOpen,
|
|
5476
5941
|
onMouseDown: _onMouseDown = () => {},
|
|
5477
5942
|
order: _order = 0,
|
|
@@ -5483,11 +5948,14 @@ const DrawingTool = ({
|
|
|
5483
5948
|
headerSize: _headerSize = 'xs',
|
|
5484
5949
|
children
|
|
5485
5950
|
}) => {
|
|
5951
|
+
const {
|
|
5952
|
+
t
|
|
5953
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
5486
5954
|
const minSize = DEFAULT_DRAW_TOOL_MIN_SIZE;
|
|
5487
5955
|
const startSizeCalc = calculateStartSize(minSize, _size, _startPosition);
|
|
5488
5956
|
const [sizeInState, setSizeInState] = React.useState(startSizeCalc);
|
|
5489
5957
|
return /*#__PURE__*/React.createElement(ToolContainerDraggable, {
|
|
5490
|
-
title:
|
|
5958
|
+
title: title || t('drawing-tool-title'),
|
|
5491
5959
|
startSize: sizeInState,
|
|
5492
5960
|
minWidth: minSize.width,
|
|
5493
5961
|
minHeight: minSize.height,
|
|
@@ -5545,7 +6013,7 @@ var whitespaces$2 = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u200
|
|
|
5545
6013
|
'\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
|
|
5546
6014
|
|
|
5547
6015
|
var uncurryThis$6 = functionUncurryThis;
|
|
5548
|
-
var requireObjectCoercible$2 = requireObjectCoercible$
|
|
6016
|
+
var requireObjectCoercible$2 = requireObjectCoercible$6;
|
|
5549
6017
|
var toString$5 = toString$7;
|
|
5550
6018
|
var whitespaces$1 = whitespaces$2;
|
|
5551
6019
|
|
|
@@ -5575,7 +6043,7 @@ var stringTrim = {
|
|
|
5575
6043
|
trim: createMethod$2(3)
|
|
5576
6044
|
};
|
|
5577
6045
|
|
|
5578
|
-
var global$6 = global$
|
|
6046
|
+
var global$6 = global$i;
|
|
5579
6047
|
var fails$7 = fails$l;
|
|
5580
6048
|
var uncurryThis$5 = functionUncurryThis;
|
|
5581
6049
|
var toString$4 = toString$7;
|
|
@@ -5665,12 +6133,6 @@ const useFormDirty = ({
|
|
|
5665
6133
|
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
5666
6134
|
* */
|
|
5667
6135
|
const opacityOptions = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0];
|
|
5668
|
-
const SAVE_OBJECT_BUTTON = 'Save new object';
|
|
5669
|
-
const UPDATE_OBJECT_BUTTON = 'Update object';
|
|
5670
|
-
const INPUT_OBJECT = 'Object name';
|
|
5671
|
-
const INPUT_OPACITY = 'Opacity';
|
|
5672
|
-
const DRAW_EXIT_MODE_MESSAGE = 'press ESC to exit draw mode';
|
|
5673
|
-
const coordinatesEmptyMessage = 'An object drawing is required';
|
|
5674
6136
|
const DrawingToolFormContentsNoMemo = ({
|
|
5675
6137
|
isLoading,
|
|
5676
6138
|
dialogError,
|
|
@@ -5687,6 +6149,9 @@ const DrawingToolFormContentsNoMemo = ({
|
|
|
5687
6149
|
opacity,
|
|
5688
6150
|
onSubmit
|
|
5689
6151
|
}) => {
|
|
6152
|
+
const {
|
|
6153
|
+
t
|
|
6154
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
5690
6155
|
const hasErrors = Object.keys(errors).length > 0;
|
|
5691
6156
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
|
|
5692
6157
|
sx: {
|
|
@@ -5710,7 +6175,7 @@ const DrawingToolFormContentsNoMemo = ({
|
|
|
5710
6175
|
item: true
|
|
5711
6176
|
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
5712
6177
|
variant: "body2"
|
|
5713
|
-
},
|
|
6178
|
+
}, t('drawing-tool-form-tools'))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
5714
6179
|
item: true,
|
|
5715
6180
|
container: true
|
|
5716
6181
|
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
@@ -5738,7 +6203,7 @@ const DrawingToolFormContentsNoMemo = ({
|
|
|
5738
6203
|
position: 'relative',
|
|
5739
6204
|
fontSize: 14
|
|
5740
6205
|
}
|
|
5741
|
-
},
|
|
6206
|
+
}, t('drawing-tool-form-exit-draw-mode'))), !!errors.geoJSON && isDirty && ( /*#__PURE__*/React__default.createElement(FormHelperText, {
|
|
5742
6207
|
error: true,
|
|
5743
6208
|
variant: "filled",
|
|
5744
6209
|
sx: {
|
|
@@ -5748,7 +6213,7 @@ const DrawingToolFormContentsNoMemo = ({
|
|
|
5748
6213
|
name: "geoJSON",
|
|
5749
6214
|
rules: {
|
|
5750
6215
|
validate: {
|
|
5751
|
-
coordinatesNotEmpty: value => isValidGeoJsonCoordinates(value) ||
|
|
6216
|
+
coordinatesNotEmpty: value => isValidGeoJsonCoordinates(value) || t('drawing-tool-form-drawing-required')
|
|
5752
6217
|
}
|
|
5753
6218
|
}
|
|
5754
6219
|
}))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
@@ -5760,7 +6225,7 @@ const DrawingToolFormContentsNoMemo = ({
|
|
|
5760
6225
|
sm: 6
|
|
5761
6226
|
}, /*#__PURE__*/React__default.createElement(ReactHookFormSelect, {
|
|
5762
6227
|
name: "opacity",
|
|
5763
|
-
label:
|
|
6228
|
+
label: t('drawing-tool-form-opacity'),
|
|
5764
6229
|
rules: {},
|
|
5765
6230
|
disabled: isLoading,
|
|
5766
6231
|
isReadOnly: false,
|
|
@@ -5775,7 +6240,7 @@ const DrawingToolFormContentsNoMemo = ({
|
|
|
5775
6240
|
item: true
|
|
5776
6241
|
}, /*#__PURE__*/React__default.createElement(ReactHookFormTextField, {
|
|
5777
6242
|
name: "objectName",
|
|
5778
|
-
label:
|
|
6243
|
+
label: t('drawing-tool-form-object-name'),
|
|
5779
6244
|
rules: {
|
|
5780
6245
|
required: true
|
|
5781
6246
|
},
|
|
@@ -5804,7 +6269,7 @@ const DrawingToolFormContentsNoMemo = ({
|
|
|
5804
6269
|
},
|
|
5805
6270
|
"data-testid": "saveDrawingFormButton",
|
|
5806
6271
|
disabled: isLoading || hasErrors
|
|
5807
|
-
}, id !== '' ?
|
|
6272
|
+
}, id !== '' ? t('drawing-tool-form-update') : t('drawing-tool-form-save'))));
|
|
5808
6273
|
};
|
|
5809
6274
|
const DrawingToolFormContents = /*#__PURE__*/React__default.memo(DrawingToolFormContentsNoMemo, isEqual);
|
|
5810
6275
|
|
|
@@ -6052,12 +6517,15 @@ const getDialogType = (mapId, isMultiMap) => {
|
|
|
6052
6517
|
};
|
|
6053
6518
|
const DrawingToolConnect = ({
|
|
6054
6519
|
bounds,
|
|
6055
|
-
title
|
|
6520
|
+
title,
|
|
6056
6521
|
showMapIdInTitle: _showMapIdInTitle = false,
|
|
6057
6522
|
mapId: initialMapId = null,
|
|
6058
6523
|
isMultiMap: _isMultiMap = false,
|
|
6059
6524
|
source: _source = 'app'
|
|
6060
6525
|
}) => {
|
|
6526
|
+
const {
|
|
6527
|
+
t
|
|
6528
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
6061
6529
|
const dialogType = getDialogType(initialMapId, _isMultiMap);
|
|
6062
6530
|
const activeMapId = useSelector(store => uiSelectors.getDialogMapId(store, dialogType));
|
|
6063
6531
|
// In case of a multimap, use the map id that is passed
|
|
@@ -6077,7 +6545,8 @@ const DrawingToolConnect = ({
|
|
|
6077
6545
|
uiIsLoading,
|
|
6078
6546
|
setFocused
|
|
6079
6547
|
} = useSetupDialog(dialogType, _source);
|
|
6080
|
-
const
|
|
6548
|
+
const defaultTitle = title || t('drawing-tool-title');
|
|
6549
|
+
const shownTitle = _showMapIdInTitle ? `${defaultTitle} ${mapId}` : defaultTitle;
|
|
6081
6550
|
const onClose = () => {
|
|
6082
6551
|
closeDrawDialog();
|
|
6083
6552
|
};
|
|
@@ -6136,14 +6605,13 @@ const DEFAULT_WARNING_DIALOG_POSITION = {
|
|
|
6136
6605
|
left: 60
|
|
6137
6606
|
};
|
|
6138
6607
|
const DEFAULT_WARNING_DIALOG_MIN_SIZE = {
|
|
6139
|
-
width:
|
|
6608
|
+
width: 264,
|
|
6140
6609
|
height: 300
|
|
6141
6610
|
};
|
|
6142
|
-
const DIALOG_TITLE = 'Public Warning';
|
|
6143
6611
|
const PublicWarningsFormDialog = ({
|
|
6144
6612
|
bounds,
|
|
6145
6613
|
onClose,
|
|
6146
|
-
title
|
|
6614
|
+
title,
|
|
6147
6615
|
isOpen,
|
|
6148
6616
|
onMouseDown: _onMouseDown = () => {},
|
|
6149
6617
|
order: _order = 0,
|
|
@@ -6159,14 +6627,34 @@ const PublicWarningsFormDialog = ({
|
|
|
6159
6627
|
shouldHideFormMode: _shouldHideFormMode = false,
|
|
6160
6628
|
publicWarningEditor
|
|
6161
6629
|
}) => {
|
|
6630
|
+
const {
|
|
6631
|
+
t
|
|
6632
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
6162
6633
|
const minSize = DEFAULT_WARNING_DIALOG_MIN_SIZE;
|
|
6163
6634
|
const startSizeCalc = calculateStartSize(minSize, _size, _startPosition);
|
|
6164
6635
|
const [sizeInState, setSizeInState] = React.useState(startSizeCalc);
|
|
6165
6636
|
const onChangeMode = () => {
|
|
6166
6637
|
_onChangeFormMode(!_isReadOnly);
|
|
6167
6638
|
};
|
|
6639
|
+
const fullTitle = title || t('public-warning-title');
|
|
6168
6640
|
return /*#__PURE__*/React.createElement(ToolContainerDraggable, Object.assign({
|
|
6169
|
-
title:
|
|
6641
|
+
title: _shouldHideFormMode ? fullTitle : undefined
|
|
6642
|
+
}, !_shouldHideFormMode && {
|
|
6643
|
+
leftHeaderComponent: ( /*#__PURE__*/React.createElement(Box, {
|
|
6644
|
+
className: "header-title"
|
|
6645
|
+
}, /*#__PURE__*/React.createElement(Typography, {
|
|
6646
|
+
variant: "h2",
|
|
6647
|
+
noWrap: true,
|
|
6648
|
+
sx: {
|
|
6649
|
+
fontSize: 12,
|
|
6650
|
+
fontWeight: 500,
|
|
6651
|
+
lineHeight: '22px',
|
|
6652
|
+
marginTop: '-1px',
|
|
6653
|
+
paddingLeft: 1
|
|
6654
|
+
},
|
|
6655
|
+
role: "heading"
|
|
6656
|
+
}, fullTitle)))
|
|
6657
|
+
}, {
|
|
6170
6658
|
startSize: sizeInState,
|
|
6171
6659
|
minWidth: minSize.width,
|
|
6172
6660
|
minHeight: minSize.height,
|
|
@@ -6195,7 +6683,7 @@ const PublicWarningsFormDialog = ({
|
|
|
6195
6683
|
setSizeInState(dragSize);
|
|
6196
6684
|
}
|
|
6197
6685
|
},
|
|
6198
|
-
|
|
6686
|
+
dragHandleIcon: null
|
|
6199
6687
|
}, !_shouldHideFormMode && {
|
|
6200
6688
|
rightHeaderComponent: ( /*#__PURE__*/React.createElement(Box, {
|
|
6201
6689
|
sx: {
|
|
@@ -6217,7 +6705,9 @@ const PublicWarningsFormDialog = ({
|
|
|
6217
6705
|
}
|
|
6218
6706
|
}, /*#__PURE__*/React.createElement(SwitchButton, {
|
|
6219
6707
|
checked: !_isReadOnly,
|
|
6220
|
-
onChange: onChangeMode
|
|
6708
|
+
onChange: onChangeMode,
|
|
6709
|
+
activeLabel: t('warning-editor-user-editor'),
|
|
6710
|
+
inActiveLabel: t('warning-editor-user-viewer')
|
|
6221
6711
|
})), /*#__PURE__*/React.createElement(Box, {
|
|
6222
6712
|
sx: {
|
|
6223
6713
|
position: 'relative',
|
|
@@ -6254,6 +6744,8 @@ var lengthOfArrayLike = lengthOfArrayLike$3;
|
|
|
6254
6744
|
|
|
6255
6745
|
var $TypeError$2 = TypeError;
|
|
6256
6746
|
|
|
6747
|
+
var REDUCE_EMPTY = 'Reduce of empty array with no initial value';
|
|
6748
|
+
|
|
6257
6749
|
// `Array.prototype.{ reduce, reduceRight }` methods implementation
|
|
6258
6750
|
var createMethod$1 = function (IS_RIGHT) {
|
|
6259
6751
|
return function (that, callbackfn, argumentsLength, memo) {
|
|
@@ -6261,6 +6753,7 @@ var createMethod$1 = function (IS_RIGHT) {
|
|
|
6261
6753
|
var self = IndexedObject(O);
|
|
6262
6754
|
var length = lengthOfArrayLike(O);
|
|
6263
6755
|
aCallable(callbackfn);
|
|
6756
|
+
if (length === 0 && argumentsLength < 2) throw new $TypeError$2(REDUCE_EMPTY);
|
|
6264
6757
|
var index = IS_RIGHT ? length - 1 : 0;
|
|
6265
6758
|
var i = IS_RIGHT ? -1 : 1;
|
|
6266
6759
|
if (argumentsLength < 2) while (true) {
|
|
@@ -6271,7 +6764,7 @@ var createMethod$1 = function (IS_RIGHT) {
|
|
|
6271
6764
|
}
|
|
6272
6765
|
index += i;
|
|
6273
6766
|
if (IS_RIGHT ? index < 0 : length <= index) {
|
|
6274
|
-
throw new $TypeError$2(
|
|
6767
|
+
throw new $TypeError$2(REDUCE_EMPTY);
|
|
6275
6768
|
}
|
|
6276
6769
|
}
|
|
6277
6770
|
for (;IS_RIGHT ? index >= 0 : length > index; index += i) if (index in self) {
|
|
@@ -6300,7 +6793,7 @@ var arrayMethodIsStrict$1 = function (METHOD_NAME, argument) {
|
|
|
6300
6793
|
});
|
|
6301
6794
|
};
|
|
6302
6795
|
|
|
6303
|
-
var global$5 = global$
|
|
6796
|
+
var global$5 = global$i;
|
|
6304
6797
|
var classof$2 = classofRaw$1;
|
|
6305
6798
|
|
|
6306
6799
|
var engineIsNode = classof$2(global$5.process) === 'process';
|
|
@@ -6325,7 +6818,7 @@ $$2({ target: 'Array', proto: true, forced: FORCED }, {
|
|
|
6325
6818
|
}
|
|
6326
6819
|
});
|
|
6327
6820
|
|
|
6328
|
-
var anObject$3 = anObject$
|
|
6821
|
+
var anObject$3 = anObject$8;
|
|
6329
6822
|
|
|
6330
6823
|
// `RegExp.prototype.flags` getter implementation
|
|
6331
6824
|
// https://tc39.es/ecma262/#sec-get-regexp.prototype.flags
|
|
@@ -6344,7 +6837,7 @@ var regexpFlags$1 = function () {
|
|
|
6344
6837
|
};
|
|
6345
6838
|
|
|
6346
6839
|
var fails$5 = fails$l;
|
|
6347
|
-
var global$4 = global$
|
|
6840
|
+
var global$4 = global$i;
|
|
6348
6841
|
|
|
6349
6842
|
// babel-minify and Closure Compiler transpiles RegExp('a', 'y') -> /a/y and it causes SyntaxError
|
|
6350
6843
|
var $RegExp$2 = global$4.RegExp;
|
|
@@ -6375,7 +6868,7 @@ var regexpStickyHelpers = {
|
|
|
6375
6868
|
};
|
|
6376
6869
|
|
|
6377
6870
|
var fails$4 = fails$l;
|
|
6378
|
-
var global$3 = global$
|
|
6871
|
+
var global$3 = global$i;
|
|
6379
6872
|
|
|
6380
6873
|
// babel-minify and Closure Compiler transpiles RegExp('.', 's') -> /./s and it causes SyntaxError
|
|
6381
6874
|
var $RegExp$1 = global$3.RegExp;
|
|
@@ -6386,7 +6879,7 @@ var regexpUnsupportedDotAll = fails$4(function () {
|
|
|
6386
6879
|
});
|
|
6387
6880
|
|
|
6388
6881
|
var fails$3 = fails$l;
|
|
6389
|
-
var global$2 = global$
|
|
6882
|
+
var global$2 = global$i;
|
|
6390
6883
|
|
|
6391
6884
|
// babel-minify and Closure Compiler transpiles RegExp('(?<a>b)', 'g') -> /(?<a>b)/g and it causes SyntaxError
|
|
6392
6885
|
var $RegExp = global$2.RegExp;
|
|
@@ -6404,7 +6897,7 @@ var uncurryThis$4 = functionUncurryThis;
|
|
|
6404
6897
|
var toString$3 = toString$7;
|
|
6405
6898
|
var regexpFlags = regexpFlags$1;
|
|
6406
6899
|
var stickyHelpers$1 = regexpStickyHelpers;
|
|
6407
|
-
var shared = shared$4
|
|
6900
|
+
var shared = shared$4;
|
|
6408
6901
|
var create = objectCreate;
|
|
6409
6902
|
var getInternalState = internalState.get;
|
|
6410
6903
|
var UNSUPPORTED_DOT_ALL = regexpUnsupportedDotAll;
|
|
@@ -6662,7 +7155,7 @@ var aConstructor$1 = function (argument) {
|
|
|
6662
7155
|
throw new $TypeError$1(tryToString(argument) + ' is not a constructor');
|
|
6663
7156
|
};
|
|
6664
7157
|
|
|
6665
|
-
var anObject$2 = anObject$
|
|
7158
|
+
var anObject$2 = anObject$8;
|
|
6666
7159
|
var aConstructor = aConstructor$1;
|
|
6667
7160
|
var isNullOrUndefined$1 = isNullOrUndefined$4;
|
|
6668
7161
|
var wellKnownSymbol = wellKnownSymbol$a;
|
|
@@ -6680,7 +7173,7 @@ var speciesConstructor$1 = function (O, defaultConstructor) {
|
|
|
6680
7173
|
var uncurryThis$2 = functionUncurryThis;
|
|
6681
7174
|
var toIntegerOrInfinity = toIntegerOrInfinity$3;
|
|
6682
7175
|
var toString$2 = toString$7;
|
|
6683
|
-
var requireObjectCoercible$1 = requireObjectCoercible$
|
|
7176
|
+
var requireObjectCoercible$1 = requireObjectCoercible$6;
|
|
6684
7177
|
|
|
6685
7178
|
var charAt$1 = uncurryThis$2(''.charAt);
|
|
6686
7179
|
var charCodeAt = uncurryThis$2(''.charCodeAt);
|
|
@@ -6723,7 +7216,7 @@ var advanceStringIndex$1 = function (S, index, unicode) {
|
|
|
6723
7216
|
};
|
|
6724
7217
|
|
|
6725
7218
|
var call$1 = functionCall;
|
|
6726
|
-
var anObject$1 = anObject$
|
|
7219
|
+
var anObject$1 = anObject$8;
|
|
6727
7220
|
var isCallable$1 = isCallable$i;
|
|
6728
7221
|
var classof = classofRaw$1;
|
|
6729
7222
|
var regexpExec = regexpExec$2;
|
|
@@ -6746,9 +7239,9 @@ var regexpExecAbstract = function (R, S) {
|
|
|
6746
7239
|
var call = functionCall;
|
|
6747
7240
|
var uncurryThis$1 = functionUncurryThis;
|
|
6748
7241
|
var fixRegExpWellKnownSymbolLogic = fixRegexpWellKnownSymbolLogic;
|
|
6749
|
-
var anObject = anObject$
|
|
7242
|
+
var anObject = anObject$8;
|
|
6750
7243
|
var isNullOrUndefined = isNullOrUndefined$4;
|
|
6751
|
-
var requireObjectCoercible = requireObjectCoercible$
|
|
7244
|
+
var requireObjectCoercible = requireObjectCoercible$6;
|
|
6752
7245
|
var speciesConstructor = speciesConstructor$1;
|
|
6753
7246
|
var advanceStringIndex = advanceStringIndex$1;
|
|
6754
7247
|
var toLength = toLength$2;
|
|
@@ -6854,8 +7347,6 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa
|
|
|
6854
7347
|
];
|
|
6855
7348
|
}, BUGGY || !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y);
|
|
6856
7349
|
|
|
6857
|
-
const LABEL_DESCRIPTION_ORIGINAL = 'Description original';
|
|
6858
|
-
const LABEL_DESCRIPTION_TRANSLATION = 'Description translation';
|
|
6859
7350
|
function a11yProps(index) {
|
|
6860
7351
|
return {
|
|
6861
7352
|
id: `tab-${index}`,
|
|
@@ -6873,6 +7364,9 @@ const tabStyle = {
|
|
|
6873
7364
|
}
|
|
6874
7365
|
};
|
|
6875
7366
|
const CustomTabPanel = props => {
|
|
7367
|
+
const {
|
|
7368
|
+
t
|
|
7369
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
6876
7370
|
const {
|
|
6877
7371
|
children,
|
|
6878
7372
|
value,
|
|
@@ -6915,18 +7409,40 @@ const CustomTabPanel = props => {
|
|
|
6915
7409
|
disabled: isDisabled
|
|
6916
7410
|
}, /*#__PURE__*/React__default.createElement(MenuItem, {
|
|
6917
7411
|
value: "NL"
|
|
6918
|
-
},
|
|
7412
|
+
}, t('warning-description-NL'))))), children);
|
|
6919
7413
|
};
|
|
6920
7414
|
const DescriptionField = ({
|
|
6921
7415
|
isDisabled: _isDisabled = false,
|
|
6922
7416
|
isReadOnly: _isReadOnly = false
|
|
6923
7417
|
}) => {
|
|
6924
|
-
const
|
|
7418
|
+
const {
|
|
7419
|
+
t
|
|
7420
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
7421
|
+
const {
|
|
7422
|
+
isRequired
|
|
7423
|
+
} = useDraftFormHelpers();
|
|
7424
|
+
const {
|
|
7425
|
+
formState
|
|
7426
|
+
} = useFormContext();
|
|
7427
|
+
const [activeTab, setActiveTab] = React__default.useState(0);
|
|
6925
7428
|
const handleChange = (event, newValue) => {
|
|
6926
|
-
|
|
7429
|
+
setActiveTab(newValue);
|
|
6927
7430
|
};
|
|
7431
|
+
const lastSubmitCount = useRef(0);
|
|
7432
|
+
// next code shows the tab for the textarea which is in the invalid state
|
|
7433
|
+
useEffect(() => {
|
|
7434
|
+
if (formState.submitCount === lastSubmitCount.current) {
|
|
7435
|
+
return;
|
|
7436
|
+
}
|
|
7437
|
+
lastSubmitCount.current = formState.submitCount;
|
|
7438
|
+
if ('descriptionOriginal' in formState.errors) {
|
|
7439
|
+
setActiveTab(0);
|
|
7440
|
+
} else if ('descriptionTranslation' in formState.errors) {
|
|
7441
|
+
setActiveTab(1);
|
|
7442
|
+
}
|
|
7443
|
+
}, [formState.errors, formState.submitCount]);
|
|
6928
7444
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Tabs, Object.assign({
|
|
6929
|
-
value:
|
|
7445
|
+
value: activeTab,
|
|
6930
7446
|
onChange: handleChange,
|
|
6931
7447
|
"aria-label": "description tabs"
|
|
6932
7448
|
}, _isDisabled && {
|
|
@@ -6938,53 +7454,55 @@ const DescriptionField = ({
|
|
|
6938
7454
|
}
|
|
6939
7455
|
}), /*#__PURE__*/React__default.createElement(Tab, Object.assign({
|
|
6940
7456
|
sx: tabStyle,
|
|
6941
|
-
label:
|
|
7457
|
+
label: t('warning-description-original'),
|
|
6942
7458
|
disabled: _isDisabled
|
|
6943
7459
|
}, a11yProps(0))), /*#__PURE__*/React__default.createElement(Tab, Object.assign({
|
|
6944
7460
|
sx: tabStyle,
|
|
6945
|
-
label:
|
|
7461
|
+
label: t('warning-description-translation'),
|
|
6946
7462
|
disabled: _isDisabled
|
|
6947
7463
|
}, a11yProps(1)))), /*#__PURE__*/React__default.createElement(CustomTabPanel, {
|
|
6948
|
-
value:
|
|
7464
|
+
value: activeTab,
|
|
6949
7465
|
index: 0,
|
|
6950
7466
|
isDisabled: _isDisabled,
|
|
6951
7467
|
isReadOnly: _isReadOnly
|
|
6952
7468
|
}, /*#__PURE__*/React__default.createElement(ReactHookFormTextField, {
|
|
6953
|
-
rules: {
|
|
7469
|
+
rules: {
|
|
7470
|
+
validate: {
|
|
7471
|
+
isRequired
|
|
7472
|
+
}
|
|
7473
|
+
},
|
|
6954
7474
|
minRows: 4,
|
|
6955
7475
|
name: "descriptionOriginal",
|
|
6956
7476
|
multiline: true,
|
|
6957
7477
|
disabled: _isDisabled,
|
|
6958
|
-
isReadOnly: _isReadOnly
|
|
7478
|
+
isReadOnly: _isReadOnly,
|
|
7479
|
+
onKeyDown: event => event.stopPropagation()
|
|
6959
7480
|
})), /*#__PURE__*/React__default.createElement(CustomTabPanel, {
|
|
6960
|
-
value:
|
|
7481
|
+
value: activeTab,
|
|
6961
7482
|
index: 1,
|
|
6962
7483
|
isDisabled: _isDisabled,
|
|
6963
7484
|
isReadOnly: _isReadOnly
|
|
6964
7485
|
}, /*#__PURE__*/React__default.createElement(ReactHookFormTextField, {
|
|
6965
|
-
rules: {
|
|
7486
|
+
rules: {
|
|
7487
|
+
validate: {
|
|
7488
|
+
isRequired
|
|
7489
|
+
}
|
|
7490
|
+
},
|
|
6966
7491
|
minRows: 4,
|
|
6967
7492
|
name: "descriptionTranslation",
|
|
6968
7493
|
multiline: true,
|
|
6969
7494
|
disabled: _isDisabled,
|
|
6970
|
-
isReadOnly: _isReadOnly
|
|
7495
|
+
isReadOnly: _isReadOnly,
|
|
7496
|
+
onKeyDown: event => event.stopPropagation()
|
|
6971
7497
|
})));
|
|
6972
7498
|
};
|
|
6973
7499
|
|
|
6974
|
-
const LABEL_AREA = 'Area';
|
|
6975
|
-
const BUTTON_ADD_OBJECT = 'Add object';
|
|
6976
|
-
const BUTTON_DELETE$1 = 'Delete';
|
|
6977
|
-
const BUTTON_VIEW = 'View';
|
|
6978
|
-
const BUTTON_EDIT$1 = 'Edit';
|
|
6979
|
-
const OBJECTS_MENU = 'Object options';
|
|
6980
|
-
const NO_OBJECT = '(no object selected)';
|
|
6981
|
-
const OBJECT_SELECTED = 'object selected';
|
|
6982
7500
|
const formatDate = lastUpdatedTime => dateUtils.dateToString(dateUtils.isoStringToDate(lastUpdatedTime), `${DATE_FORMAT_FNS} 'UTC'`);
|
|
6983
|
-
const getObjectName = (geoJSON, objectName) => {
|
|
7501
|
+
const getObjectName = (geoJSON, objectName, t) => {
|
|
6984
7502
|
if (geoJSON) {
|
|
6985
|
-
return objectName ||
|
|
7503
|
+
return objectName || t('object-manager-object-selected');
|
|
6986
7504
|
}
|
|
6987
|
-
return
|
|
7505
|
+
return t('object-manager-no-object-selected');
|
|
6988
7506
|
};
|
|
6989
7507
|
const AreaField = ({
|
|
6990
7508
|
onEditObject: _onEditObject = () => {},
|
|
@@ -6993,6 +7511,9 @@ const AreaField = ({
|
|
|
6993
7511
|
onAddObject: _onAddObject = () => {},
|
|
6994
7512
|
isDisabled: _isDisabled = false
|
|
6995
7513
|
}) => {
|
|
7514
|
+
const {
|
|
7515
|
+
t
|
|
7516
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
6996
7517
|
const {
|
|
6997
7518
|
getValues,
|
|
6998
7519
|
formState: {
|
|
@@ -7004,7 +7525,7 @@ const AreaField = ({
|
|
|
7004
7525
|
} = useDraftFormHelpers();
|
|
7005
7526
|
const lastUpdatedTime = getValues('object.lastUpdatedTime');
|
|
7006
7527
|
const geoJSON = getValues('geoJSON');
|
|
7007
|
-
const objectName = getObjectName(geoJSON, getValues('object.objectName'));
|
|
7528
|
+
const objectName = getObjectName(geoJSON, getValues('object.objectName'), t);
|
|
7008
7529
|
const hasErrors = (errors === null || errors === void 0 ? void 0 : errors.geoJSON) !== undefined;
|
|
7009
7530
|
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Typography, Object.assign({
|
|
7010
7531
|
variant: "h3",
|
|
@@ -7019,7 +7540,7 @@ const AreaField = ({
|
|
|
7019
7540
|
})
|
|
7020
7541
|
}, hasErrors && {
|
|
7021
7542
|
'aria-errormessage': errorMessages.required
|
|
7022
|
-
}),
|
|
7543
|
+
}), t('warning-area')), /*#__PURE__*/React__default.createElement(Card, {
|
|
7023
7544
|
elevation: 0,
|
|
7024
7545
|
sx: Object.assign({}, !geoJSON && {
|
|
7025
7546
|
background: 'none'
|
|
@@ -7045,8 +7566,8 @@ const AreaField = ({
|
|
|
7045
7566
|
variant: "body2",
|
|
7046
7567
|
color: "text.secondary"
|
|
7047
7568
|
}, lastUpdatedTime ? formatDate(lastUpdatedTime) : ''), geoJSON ? ( /*#__PURE__*/React__default.createElement(ToggleMenu, {
|
|
7048
|
-
menuTitle:
|
|
7049
|
-
tooltipTitle:
|
|
7569
|
+
menuTitle: t('object-manager-options-menu'),
|
|
7570
|
+
tooltipTitle: t('object-manager-options-menu'),
|
|
7050
7571
|
buttonSx: {
|
|
7051
7572
|
position: 'absolute',
|
|
7052
7573
|
right: 0,
|
|
@@ -7058,15 +7579,15 @@ const AreaField = ({
|
|
|
7058
7579
|
menuPosition: "bottom",
|
|
7059
7580
|
isDisabled: _isDisabled,
|
|
7060
7581
|
menuItems: [{
|
|
7061
|
-
text:
|
|
7582
|
+
text: t('object-manager-button-edit'),
|
|
7062
7583
|
action: _onEditObject,
|
|
7063
7584
|
icon: /*#__PURE__*/React__default.createElement(Edit, null)
|
|
7064
7585
|
}, {
|
|
7065
|
-
text:
|
|
7586
|
+
text: t('object-manager-button-view'),
|
|
7066
7587
|
action: _onViewObject,
|
|
7067
7588
|
icon: /*#__PURE__*/React__default.createElement(Visibility, null)
|
|
7068
7589
|
}, {
|
|
7069
|
-
text:
|
|
7590
|
+
text: t('object-manager-button-delete'),
|
|
7070
7591
|
action: _onDeleteObject,
|
|
7071
7592
|
icon: /*#__PURE__*/React__default.createElement(Delete, null)
|
|
7072
7593
|
}]
|
|
@@ -7086,7 +7607,7 @@ const AreaField = ({
|
|
|
7086
7607
|
size: "small",
|
|
7087
7608
|
onClick: _onAddObject,
|
|
7088
7609
|
disabled: _isDisabled
|
|
7089
|
-
},
|
|
7610
|
+
}, t('warning-button-add-object')));
|
|
7090
7611
|
};
|
|
7091
7612
|
|
|
7092
7613
|
/* *
|
|
@@ -7105,39 +7626,42 @@ const AreaField = ({
|
|
|
7105
7626
|
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
7106
7627
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
7107
7628
|
* */
|
|
7108
|
-
const
|
|
7109
|
-
|
|
7110
|
-
title: 'Wind',
|
|
7629
|
+
const warningPhenomena = t => [{
|
|
7630
|
+
title: t('warning-phenomenon-wind'),
|
|
7111
7631
|
key: 'wind',
|
|
7112
7632
|
icon: /*#__PURE__*/React.createElement(Wind, null)
|
|
7113
7633
|
}, {
|
|
7114
|
-
title: '
|
|
7634
|
+
title: t('warning-phenomenon-fog'),
|
|
7115
7635
|
key: 'fog',
|
|
7116
7636
|
icon: /*#__PURE__*/React.createElement(Fog, null)
|
|
7117
7637
|
}, {
|
|
7118
|
-
title: '
|
|
7638
|
+
title: t('warning-phenomenon-thunderstorm'),
|
|
7119
7639
|
key: 'thunderstorm',
|
|
7120
7640
|
icon: /*#__PURE__*/React.createElement(Lightning, null)
|
|
7121
7641
|
}, {
|
|
7122
|
-
title: '
|
|
7642
|
+
title: t('warning-phenomenon-snow-ice'),
|
|
7123
7643
|
key: 'snowIce',
|
|
7124
7644
|
icon: /*#__PURE__*/React.createElement(Snow, null)
|
|
7125
7645
|
}, {
|
|
7126
|
-
title: '
|
|
7646
|
+
title: t('warning-phenomenon-rain'),
|
|
7127
7647
|
key: 'rain',
|
|
7128
7648
|
icon: /*#__PURE__*/React.createElement(Rain, null)
|
|
7129
7649
|
}, {
|
|
7130
|
-
title: '
|
|
7650
|
+
title: t('warning-phenomenon-high-temp'),
|
|
7131
7651
|
key: 'highTemp',
|
|
7132
7652
|
icon: /*#__PURE__*/React.createElement(TemperatureHigh, null)
|
|
7133
7653
|
},
|
|
7134
|
-
// {
|
|
7654
|
+
// {
|
|
7655
|
+
// title: t('warning-phenomenon-funnel-cloud'),
|
|
7656
|
+
// key: 'funnelCloud',
|
|
7657
|
+
// icon: <FunnelCloud />,
|
|
7658
|
+
// },
|
|
7135
7659
|
{
|
|
7136
|
-
title: '
|
|
7660
|
+
title: t('warning-phenomenon-low-temp'),
|
|
7137
7661
|
key: 'lowTemp',
|
|
7138
7662
|
icon: /*#__PURE__*/React.createElement(TemperatureLow, null)
|
|
7139
7663
|
}, {
|
|
7140
|
-
title: '
|
|
7664
|
+
title: t('warning-phenomenon-coastal-event'),
|
|
7141
7665
|
key: 'coastalEvent',
|
|
7142
7666
|
icon: /*#__PURE__*/React.createElement(CoastalEvent, null)
|
|
7143
7667
|
}];
|
|
@@ -7145,12 +7669,15 @@ const Phenomenon = ({
|
|
|
7145
7669
|
isDisabled,
|
|
7146
7670
|
isReadOnly
|
|
7147
7671
|
}) => {
|
|
7672
|
+
const {
|
|
7673
|
+
t
|
|
7674
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
7148
7675
|
const {
|
|
7149
7676
|
isRequired
|
|
7150
7677
|
} = useDraftFormHelpers();
|
|
7151
7678
|
return /*#__PURE__*/React.createElement(ReactHookFormSelect, {
|
|
7152
7679
|
name: "phenomenon",
|
|
7153
|
-
label:
|
|
7680
|
+
label: t('warning-phenomenon'),
|
|
7154
7681
|
rules: {
|
|
7155
7682
|
validate: {
|
|
7156
7683
|
isRequired
|
|
@@ -7158,7 +7685,7 @@ const Phenomenon = ({
|
|
|
7158
7685
|
},
|
|
7159
7686
|
disabled: isDisabled || isReadOnly,
|
|
7160
7687
|
isReadOnly: isReadOnly
|
|
7161
|
-
}, warningPhenomena.map(phenomenon => {
|
|
7688
|
+
}, warningPhenomena(t).map(phenomenon => {
|
|
7162
7689
|
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
7163
7690
|
key: phenomenon.key,
|
|
7164
7691
|
value: phenomenon.key
|
|
@@ -7173,54 +7700,58 @@ const Phenomenon = ({
|
|
|
7173
7700
|
}));
|
|
7174
7701
|
};
|
|
7175
7702
|
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
7179
|
-
|
|
7180
|
-
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
color: '#D62A20',
|
|
7207
|
-
textColor: '#ffffff'
|
|
7208
|
-
}];
|
|
7703
|
+
var WarningLevel;
|
|
7704
|
+
(function (WarningLevel) {
|
|
7705
|
+
WarningLevel["moderate"] = "moderate";
|
|
7706
|
+
WarningLevel["severe"] = "severe";
|
|
7707
|
+
WarningLevel["extreme"] = "extreme";
|
|
7708
|
+
})(WarningLevel || (WarningLevel = {}));
|
|
7709
|
+
const LevelColors = {
|
|
7710
|
+
moderate: {
|
|
7711
|
+
color: '#FAE21E',
|
|
7712
|
+
textColor: '#051039'
|
|
7713
|
+
},
|
|
7714
|
+
severe: {
|
|
7715
|
+
color: '#E27000',
|
|
7716
|
+
textColor: '#051039'
|
|
7717
|
+
},
|
|
7718
|
+
extreme: {
|
|
7719
|
+
color: '#D62A20',
|
|
7720
|
+
textColor: '#ffffff'
|
|
7721
|
+
}
|
|
7722
|
+
};
|
|
7723
|
+
const levelOptions = t => [Object.assign({
|
|
7724
|
+
title: t('warning-level-moderate'),
|
|
7725
|
+
key: WarningLevel.moderate
|
|
7726
|
+
}, LevelColors[WarningLevel.moderate]), Object.assign({
|
|
7727
|
+
title: t('warning-level-severe'),
|
|
7728
|
+
key: WarningLevel.severe
|
|
7729
|
+
}, LevelColors[WarningLevel.severe]), Object.assign({
|
|
7730
|
+
title: t('warning-level-extreme'),
|
|
7731
|
+
key: WarningLevel.extreme
|
|
7732
|
+
}, LevelColors['extreme'])];
|
|
7209
7733
|
const LevelField = ({
|
|
7210
7734
|
isDisabled: _isDisabled = false,
|
|
7211
7735
|
isReadOnly: _isReadOnly = false
|
|
7212
7736
|
}) => {
|
|
7737
|
+
const {
|
|
7738
|
+
t
|
|
7739
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
7213
7740
|
const {
|
|
7214
7741
|
isRequired
|
|
7215
7742
|
} = useDraftFormHelpers();
|
|
7216
7743
|
const {
|
|
7217
|
-
watch
|
|
7744
|
+
watch,
|
|
7745
|
+
trigger
|
|
7218
7746
|
} = useFormContext();
|
|
7219
7747
|
const selectedLevel = watch('level');
|
|
7220
|
-
const levelDetails = levelOptions.find(level => level.key === selectedLevel);
|
|
7748
|
+
const levelDetails = levelOptions(t).find(level => level.key === selectedLevel);
|
|
7749
|
+
const onChangeLevel = () => {
|
|
7750
|
+
trigger(['level', 'probability']);
|
|
7751
|
+
};
|
|
7221
7752
|
return /*#__PURE__*/React.createElement(ReactHookFormSelect, {
|
|
7222
7753
|
name: "level",
|
|
7223
|
-
label:
|
|
7754
|
+
label: t('warning-level'),
|
|
7224
7755
|
rules: {
|
|
7225
7756
|
validate: {
|
|
7226
7757
|
isRequired
|
|
@@ -7234,8 +7765,9 @@ const LevelField = ({
|
|
|
7234
7765
|
}
|
|
7235
7766
|
},
|
|
7236
7767
|
disabled: _isDisabled || _isReadOnly,
|
|
7237
|
-
isReadOnly: _isReadOnly
|
|
7238
|
-
|
|
7768
|
+
isReadOnly: _isReadOnly,
|
|
7769
|
+
onChange: onChangeLevel
|
|
7770
|
+
}, levelOptions(t).map(level => ( /*#__PURE__*/React.createElement(MenuItem, {
|
|
7239
7771
|
value: level.key,
|
|
7240
7772
|
key: level.key,
|
|
7241
7773
|
sx: {
|
|
@@ -7276,23 +7808,28 @@ const LevelField = ({
|
|
|
7276
7808
|
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
7277
7809
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
7278
7810
|
* */
|
|
7279
|
-
const
|
|
7280
|
-
const
|
|
7281
|
-
const
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7811
|
+
const VALID_FROM_MAX_HOURS_AFTER_CURRENT = 168;
|
|
7812
|
+
const isValueBeforeCurrentTime$1 = (value, t) => isXHoursBefore(value, dateUtils.getCurrentTimeAsString(), 0) || t('warning-valid-from-error-before-current');
|
|
7813
|
+
const isMaxHoursAfterCurrentTime$1 = (value, t) => isXHoursAfter(value, dateUtils.getCurrentTimeAsString(), VALID_FROM_MAX_HOURS_AFTER_CURRENT) || t('warning-valid-from-error-max-hours', {
|
|
7814
|
+
ns: WARN_NAMESPACE,
|
|
7815
|
+
MAX_HOURS: VALID_FROM_MAX_HOURS_AFTER_CURRENT
|
|
7816
|
+
});
|
|
7285
7817
|
const ValidFrom = ({
|
|
7286
7818
|
isDisabled,
|
|
7287
7819
|
isReadOnly
|
|
7288
7820
|
}) => {
|
|
7821
|
+
const {
|
|
7822
|
+
t
|
|
7823
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
7289
7824
|
const {
|
|
7290
7825
|
isRequired
|
|
7291
7826
|
} = useDraftFormHelpers();
|
|
7292
7827
|
const {
|
|
7293
7828
|
trigger
|
|
7294
7829
|
} = useFormContext();
|
|
7295
|
-
const onChangeValidFrom = () =>
|
|
7830
|
+
const onChangeValidFrom = () => {
|
|
7831
|
+
trigger(['validFrom', 'validUntil']);
|
|
7832
|
+
};
|
|
7296
7833
|
return /*#__PURE__*/React.createElement(ReactHookFormDateTime, {
|
|
7297
7834
|
name: "validFrom",
|
|
7298
7835
|
rules: {
|
|
@@ -7300,12 +7837,12 @@ const ValidFrom = ({
|
|
|
7300
7837
|
isRequired,
|
|
7301
7838
|
isValidDate,
|
|
7302
7839
|
// The valid from time cannot be before the current time
|
|
7303
|
-
isValueBeforeCurrentTime: isValueBeforeCurrentTime$1,
|
|
7840
|
+
isValueBeforeCurrentTime: value => isValueBeforeCurrentTime$1(value, t),
|
|
7304
7841
|
// Valid from can be no more than X hours after current time
|
|
7305
|
-
isMaxHoursAfterCurrentTime: isMaxHoursAfterCurrentTime$1
|
|
7842
|
+
isMaxHoursAfterCurrentTime: value => isMaxHoursAfterCurrentTime$1(value, t)
|
|
7306
7843
|
}
|
|
7307
7844
|
},
|
|
7308
|
-
label:
|
|
7845
|
+
label: t('warning-valid-from'),
|
|
7309
7846
|
disablePast: true,
|
|
7310
7847
|
disabled: isDisabled || isReadOnly,
|
|
7311
7848
|
isReadOnly: isReadOnly,
|
|
@@ -7329,31 +7866,40 @@ const ValidFrom = ({
|
|
|
7329
7866
|
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
7330
7867
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
7331
7868
|
* */
|
|
7332
|
-
const
|
|
7333
|
-
const
|
|
7334
|
-
const
|
|
7335
|
-
const
|
|
7336
|
-
|
|
7337
|
-
|
|
7338
|
-
|
|
7339
|
-
const
|
|
7340
|
-
const isMinHoursAfterValidFrom = (value, validFromValue) => {
|
|
7869
|
+
const VALID_UNTIL_MAX_HOURS_AFTER_CURRENT = 180;
|
|
7870
|
+
const VALID_UNTIL_MIN_HOURS_AFTER_VALID_FROM = 1;
|
|
7871
|
+
const isValueBeforeCurrentTime = (value, t) => isXHoursBefore(value, dateUtils.getCurrentTimeAsString(), 0) || t('warning-valid-until-error-before-current');
|
|
7872
|
+
const isMaxHoursAfterCurrentTime = (value, t) => isXHoursAfter(value, dateUtils.getCurrentTimeAsString(), VALID_UNTIL_MAX_HOURS_AFTER_CURRENT) || t('warning-valid-until-error-max-hours', {
|
|
7873
|
+
ns: WARN_NAMESPACE,
|
|
7874
|
+
MAX_HOURS: VALID_UNTIL_MAX_HOURS_AFTER_CURRENT
|
|
7875
|
+
});
|
|
7876
|
+
const isMinHoursAfterValidFrom = (value, validFromValue, t) => {
|
|
7341
7877
|
if (isEmpty(value) || isEmpty(validFromValue) || !isValidDate(validFromValue)) {
|
|
7342
7878
|
return true;
|
|
7343
7879
|
}
|
|
7344
7880
|
const duration = dateUtils.differenceInHours(new Date(value), new Date(validFromValue));
|
|
7345
|
-
return duration >=
|
|
7881
|
+
return duration >= VALID_UNTIL_MIN_HOURS_AFTER_VALID_FROM || t('warning-valid-until-error-min-hours', {
|
|
7882
|
+
ns: WARN_NAMESPACE,
|
|
7883
|
+
MIN_HOURS: VALID_UNTIL_MIN_HOURS_AFTER_VALID_FROM
|
|
7884
|
+
});
|
|
7346
7885
|
};
|
|
7347
7886
|
const ValidUntil = ({
|
|
7348
7887
|
isDisabled,
|
|
7349
7888
|
isReadOnly
|
|
7350
7889
|
}) => {
|
|
7890
|
+
const {
|
|
7891
|
+
t
|
|
7892
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
7351
7893
|
const {
|
|
7352
7894
|
isRequired
|
|
7353
7895
|
} = useDraftFormHelpers();
|
|
7354
7896
|
const {
|
|
7355
|
-
getValues
|
|
7897
|
+
getValues,
|
|
7898
|
+
trigger
|
|
7356
7899
|
} = useFormContext();
|
|
7900
|
+
const onChangeValidUntil = () => {
|
|
7901
|
+
trigger(['validFrom', 'validUntil']);
|
|
7902
|
+
};
|
|
7357
7903
|
return /*#__PURE__*/React.createElement(ReactHookFormDateTime, {
|
|
7358
7904
|
name: "validUntil",
|
|
7359
7905
|
rules: {
|
|
@@ -7361,18 +7907,148 @@ const ValidUntil = ({
|
|
|
7361
7907
|
isRequired,
|
|
7362
7908
|
isValidDate,
|
|
7363
7909
|
// The valid until time cannot be before the current time
|
|
7364
|
-
isValueBeforeCurrentTime,
|
|
7910
|
+
isValueBeforeCurrentTime: value => isValueBeforeCurrentTime(value, t),
|
|
7365
7911
|
// Valid until time can be no more than X hours after current time
|
|
7366
|
-
isMaxHoursAfterCurrentTime,
|
|
7912
|
+
isMaxHoursAfterCurrentTime: value => isMaxHoursAfterCurrentTime(value, t),
|
|
7367
7913
|
// Valid until time has to be at least X hours after valid from time
|
|
7368
|
-
isMinHoursAfterValidFrom: value => isMinHoursAfterValidFrom(value, getValues('validFrom'))
|
|
7914
|
+
isMinHoursAfterValidFrom: value => isMinHoursAfterValidFrom(value, getValues('validFrom'), t)
|
|
7369
7915
|
}
|
|
7370
7916
|
},
|
|
7371
|
-
label:
|
|
7917
|
+
label: t('warning-valid-until'),
|
|
7372
7918
|
disablePast: true,
|
|
7373
7919
|
disabled: isDisabled || isReadOnly,
|
|
7374
|
-
isReadOnly: isReadOnly
|
|
7920
|
+
isReadOnly: isReadOnly,
|
|
7921
|
+
onChange: onChangeValidUntil
|
|
7922
|
+
});
|
|
7923
|
+
};
|
|
7924
|
+
|
|
7925
|
+
const zoomToFeature = (mapId, geojsonFeature) => {
|
|
7926
|
+
const webmapjs = getWMJSMapById(mapId);
|
|
7927
|
+
if (!webmapjs || !geojsonFeature) {
|
|
7928
|
+
return;
|
|
7929
|
+
}
|
|
7930
|
+
const bboxGeoJSON = getFeatureExtent(geojsonFeature);
|
|
7931
|
+
const projectedCoordinateBoxBottomLeft = webmapjs.getGeoCoordFromLatLong({
|
|
7932
|
+
x: bboxGeoJSON.left,
|
|
7933
|
+
y: bboxGeoJSON.bottom
|
|
7934
|
+
});
|
|
7935
|
+
const projectedCoordinateBoxTopRight = webmapjs.getGeoCoordFromLatLong({
|
|
7936
|
+
x: bboxGeoJSON.right,
|
|
7937
|
+
y: bboxGeoJSON.top
|
|
7375
7938
|
});
|
|
7939
|
+
if (projectedCoordinateBoxBottomLeft && projectedCoordinateBoxTopRight) {
|
|
7940
|
+
const transformedExtent = new WMBBOX({
|
|
7941
|
+
left: projectedCoordinateBoxBottomLeft.x,
|
|
7942
|
+
bottom: projectedCoordinateBoxBottomLeft.y,
|
|
7943
|
+
right: projectedCoordinateBoxTopRight.x,
|
|
7944
|
+
top: projectedCoordinateBoxTopRight.y
|
|
7945
|
+
});
|
|
7946
|
+
webmapjs.zoomTo(transformedExtent);
|
|
7947
|
+
webmapjs.zoomOut(1 / 2);
|
|
7948
|
+
webmapjs.draw();
|
|
7949
|
+
}
|
|
7950
|
+
};
|
|
7951
|
+
const WarningsMapView = ({
|
|
7952
|
+
geojsonFeature,
|
|
7953
|
+
defaultBbox: _defaultBbox = defaultBbox
|
|
7954
|
+
}) => {
|
|
7955
|
+
const mapId = React.useRef(`WarningsMapView_${generateMapId()}`).current;
|
|
7956
|
+
const warningLayer = {
|
|
7957
|
+
id: `${mapId}geojsonfeature`,
|
|
7958
|
+
geojson: geojsonFeature,
|
|
7959
|
+
layerType: LayerType.featureLayer
|
|
7960
|
+
};
|
|
7961
|
+
// Zoom to the geojson when the geojsonFeature is updated in an already mounted map component
|
|
7962
|
+
zoomToFeature(mapId, geojsonFeature);
|
|
7963
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
7964
|
+
style: {
|
|
7965
|
+
height: '200px',
|
|
7966
|
+
width: '100%'
|
|
7967
|
+
}
|
|
7968
|
+
}, /*#__PURE__*/React.createElement(MapView, {
|
|
7969
|
+
bbox: _defaultBbox.bbox,
|
|
7970
|
+
srs: _defaultBbox.srs,
|
|
7971
|
+
mapId: mapId,
|
|
7972
|
+
showScaleBar: false,
|
|
7973
|
+
onWMJSMount: mapId => {
|
|
7974
|
+
const webmapjs = getWMJSMapById(mapId);
|
|
7975
|
+
webmapjs.hideMouseCursorProperties();
|
|
7976
|
+
if (!geojsonFeature) {
|
|
7977
|
+
return;
|
|
7978
|
+
}
|
|
7979
|
+
// Zoom to the geojson when the map is ready
|
|
7980
|
+
zoomToFeature(mapId, geojsonFeature);
|
|
7981
|
+
},
|
|
7982
|
+
holdShiftToScroll: true
|
|
7983
|
+
}, /*#__PURE__*/React.createElement(MapViewLayer, Object.assign({}, defaultLayers.baseLayerGrey, {
|
|
7984
|
+
id: `${mapId}_baseLayer}`
|
|
7985
|
+
})), warningLayer.geojson && /*#__PURE__*/React.createElement(MapViewLayer, Object.assign({}, warningLayer)), /*#__PURE__*/React.createElement(MapViewLayer, Object.assign({}, defaultLayers.overLayer, {
|
|
7986
|
+
id: `${mapId}_overlayer}`
|
|
7987
|
+
}))));
|
|
7988
|
+
};
|
|
7989
|
+
|
|
7990
|
+
/* *
|
|
7991
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7992
|
+
* you may not use this file except in compliance with the License.
|
|
7993
|
+
* You may obtain a copy of the License at
|
|
7994
|
+
*
|
|
7995
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
7996
|
+
*
|
|
7997
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7998
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
7999
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
8000
|
+
* See the License for the specific language governing permissions and
|
|
8001
|
+
* limitations under the License.
|
|
8002
|
+
*
|
|
8003
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
8004
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
8005
|
+
* */
|
|
8006
|
+
const probablityOptions = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10];
|
|
8007
|
+
const defaultProbability = 30;
|
|
8008
|
+
const ProbabilityField = ({
|
|
8009
|
+
isDisabled,
|
|
8010
|
+
isReadOnly
|
|
8011
|
+
}) => {
|
|
8012
|
+
const {
|
|
8013
|
+
t
|
|
8014
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
8015
|
+
const {
|
|
8016
|
+
trigger,
|
|
8017
|
+
getValues
|
|
8018
|
+
} = useFormContext();
|
|
8019
|
+
const {
|
|
8020
|
+
isRequired
|
|
8021
|
+
} = useDraftFormHelpers();
|
|
8022
|
+
const isValidProbabilityForLevel = (value, fieldValues) => {
|
|
8023
|
+
if (fieldValues['level'] === 'moderate' && value < 30) {
|
|
8024
|
+
return t('warning-probability-moderate-level-invalid');
|
|
8025
|
+
}
|
|
8026
|
+
return true;
|
|
8027
|
+
};
|
|
8028
|
+
const onChangeProbability = () => {
|
|
8029
|
+
trigger('probability');
|
|
8030
|
+
// We don't want to trigger the missing value validation
|
|
8031
|
+
if (!isEmpty(getValues('level'))) {
|
|
8032
|
+
trigger('level');
|
|
8033
|
+
}
|
|
8034
|
+
};
|
|
8035
|
+
return /*#__PURE__*/React.createElement(ReactHookFormSelect, {
|
|
8036
|
+
name: "probability",
|
|
8037
|
+
label: t('warning-probability'),
|
|
8038
|
+
rules: {
|
|
8039
|
+
validate: {
|
|
8040
|
+
isRequired,
|
|
8041
|
+
isValidProbabilityForLevel
|
|
8042
|
+
}
|
|
8043
|
+
},
|
|
8044
|
+
disabled: isDisabled || isReadOnly,
|
|
8045
|
+
isReadOnly: isReadOnly,
|
|
8046
|
+
defaultValue: defaultProbability,
|
|
8047
|
+
onChange: onChangeProbability
|
|
8048
|
+
}, probablityOptions.map(probability => ( /*#__PURE__*/React.createElement(MenuItem, {
|
|
8049
|
+
value: probability,
|
|
8050
|
+
key: probability
|
|
8051
|
+
}, probability, " %"))));
|
|
7376
8052
|
};
|
|
7377
8053
|
|
|
7378
8054
|
const getEmptyPublicWarning = () => {
|
|
@@ -7396,6 +8072,15 @@ const getEmptyPublicWarning = () => {
|
|
|
7396
8072
|
geoJSON: null
|
|
7397
8073
|
};
|
|
7398
8074
|
};
|
|
8075
|
+
const getDefaultFeatureProperties = level => {
|
|
8076
|
+
return {
|
|
8077
|
+
fill: LevelColors[level].color,
|
|
8078
|
+
stroke: LevelColors[level].color,
|
|
8079
|
+
'fill-opacity': 0.2,
|
|
8080
|
+
'stroke-width': 2,
|
|
8081
|
+
'stroke-opacity': 1
|
|
8082
|
+
};
|
|
8083
|
+
};
|
|
7399
8084
|
const getFormData = (publicWarningsDetails, object) => {
|
|
7400
8085
|
const data = Object.assign(Object.assign({
|
|
7401
8086
|
IS_DRAFT: '',
|
|
@@ -7416,13 +8101,6 @@ const spinnerSx = {
|
|
|
7416
8101
|
margin: 'auto',
|
|
7417
8102
|
marginLeft: 1
|
|
7418
8103
|
};
|
|
7419
|
-
const LABEL_PROBABILITY = 'Probability';
|
|
7420
|
-
const BUTTON_CLEAR = 'Clear';
|
|
7421
|
-
const BUTTON_SAVE = 'Save';
|
|
7422
|
-
const BUTTON_SAVING = 'Saving';
|
|
7423
|
-
const BUTTON_PUBLISH = 'Publish';
|
|
7424
|
-
const BUTTON_PUBLISHING = 'Publishing';
|
|
7425
|
-
const probablityOptions = [100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0];
|
|
7426
8104
|
const ContainerWrapper = styled('div')(() => ({
|
|
7427
8105
|
containerType: 'size',
|
|
7428
8106
|
height: '100%'
|
|
@@ -7494,6 +8172,7 @@ const getErrors = errors => errors ? errors === null || errors === void 0 ? void
|
|
|
7494
8172
|
errors: []
|
|
7495
8173
|
}) : null;
|
|
7496
8174
|
const Form = ({
|
|
8175
|
+
defaultBbox,
|
|
7497
8176
|
onSaveForm: _onSaveForm = () => {},
|
|
7498
8177
|
onPublishForm: _onPublishForm = () => {},
|
|
7499
8178
|
object,
|
|
@@ -7506,6 +8185,9 @@ const Form = ({
|
|
|
7506
8185
|
isReadOnly: _isReadOnly2 = false,
|
|
7507
8186
|
onFormDirty: _onFormDirty = () => {}
|
|
7508
8187
|
}) => {
|
|
8188
|
+
const {
|
|
8189
|
+
t
|
|
8190
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
7509
8191
|
const {
|
|
7510
8192
|
handleSubmit,
|
|
7511
8193
|
reset,
|
|
@@ -7555,6 +8237,20 @@ const Form = ({
|
|
|
7555
8237
|
reset(getFormData(publicWarningDetails, object));
|
|
7556
8238
|
}, [object, reset, publicWarningDetails]);
|
|
7557
8239
|
const errors = getErrors(_error.message);
|
|
8240
|
+
// object is used making drawing, publicWarningDetails is used when showing the dialog from the warninglist.
|
|
8241
|
+
const warningGeoJSONFeature = (object === null || object === void 0 ? void 0 : object.geoJSON) || (publicWarningDetails === null || publicWarningDetails === void 0 ? void 0 : publicWarningDetails.geoJSON);
|
|
8242
|
+
// Add colors, if not defined
|
|
8243
|
+
const warningGeoJSONFeatureWithFillProps = produce(warningGeoJSONFeature, draft => {
|
|
8244
|
+
const draftFeature = draft === null || draft === void 0 ? void 0 : draft.features[0];
|
|
8245
|
+
if (draftFeature) {
|
|
8246
|
+
const level = WarningLevel[publicWarningDetails === null || publicWarningDetails === void 0 ? void 0 : publicWarningDetails.level] || WarningLevel[WarningLevel.moderate];
|
|
8247
|
+
const defaultProps = getDefaultFeatureProperties(level);
|
|
8248
|
+
if (!draftFeature.properties) {
|
|
8249
|
+
draftFeature.properties = Object.assign({}, defaultProps);
|
|
8250
|
+
}
|
|
8251
|
+
Object.assign(draftFeature.properties, Object.assign(Object.assign({}, defaultProps), draftFeature.properties));
|
|
8252
|
+
}
|
|
8253
|
+
});
|
|
7558
8254
|
return /*#__PURE__*/React.createElement(ContainerWrapper, null, /*#__PURE__*/React.createElement(ContainerFormWrapper, {
|
|
7559
8255
|
isReadOnly: _isReadOnly2
|
|
7560
8256
|
}, /*#__PURE__*/React.createElement(ContainerGrid, null, errors && ( /*#__PURE__*/React.createElement(Box, {
|
|
@@ -7587,6 +8283,16 @@ const Form = ({
|
|
|
7587
8283
|
onViewObject: () => {},
|
|
7588
8284
|
onDeleteObject: () => {},
|
|
7589
8285
|
onAddObject: () => {}
|
|
8286
|
+
}))), /*#__PURE__*/React.createElement(Grid, {
|
|
8287
|
+
item: true,
|
|
8288
|
+
xs: 12,
|
|
8289
|
+
container: true
|
|
8290
|
+
}, /*#__PURE__*/React.createElement(Grid, {
|
|
8291
|
+
item: true,
|
|
8292
|
+
xs: 12
|
|
8293
|
+
}, /*#__PURE__*/React.createElement(WarningsMapView, {
|
|
8294
|
+
geojsonFeature: warningGeoJSONFeatureWithFillProps,
|
|
8295
|
+
defaultBbox: defaultBbox
|
|
7590
8296
|
}))), /*#__PURE__*/React.createElement(Grid, {
|
|
7591
8297
|
item: true,
|
|
7592
8298
|
xs: 12,
|
|
@@ -7622,16 +8328,10 @@ const Form = ({
|
|
|
7622
8328
|
item: true,
|
|
7623
8329
|
xs: 12,
|
|
7624
8330
|
sm: 6
|
|
7625
|
-
}, /*#__PURE__*/React.createElement(
|
|
7626
|
-
|
|
7627
|
-
label: LABEL_PROBABILITY,
|
|
7628
|
-
rules: {},
|
|
7629
|
-
disabled: areFieldsDisabled || _isReadOnly2,
|
|
8331
|
+
}, /*#__PURE__*/React.createElement(ProbabilityField, {
|
|
8332
|
+
isDisabled: areFieldsDisabled,
|
|
7630
8333
|
isReadOnly: _isReadOnly2
|
|
7631
|
-
},
|
|
7632
|
-
value: probability,
|
|
7633
|
-
key: probability
|
|
7634
|
-
}, probability, " %")))))), /*#__PURE__*/React.createElement(Grid, {
|
|
8334
|
+
}))), /*#__PURE__*/React.createElement(Grid, {
|
|
7635
8335
|
item: true,
|
|
7636
8336
|
xs: 12,
|
|
7637
8337
|
container: true,
|
|
@@ -7669,7 +8369,7 @@ const Form = ({
|
|
|
7669
8369
|
},
|
|
7670
8370
|
disabled: areFieldsDisabled,
|
|
7671
8371
|
onClick: onPressClear
|
|
7672
|
-
},
|
|
8372
|
+
}, t('warning-button-clear'))), /*#__PURE__*/React.createElement(Grid, {
|
|
7673
8373
|
item: true,
|
|
7674
8374
|
xs: 12,
|
|
7675
8375
|
sm: 4
|
|
@@ -7685,7 +8385,7 @@ const Form = ({
|
|
|
7685
8385
|
style: {
|
|
7686
8386
|
position: 'relative'
|
|
7687
8387
|
}
|
|
7688
|
-
}, isSaving ?
|
|
8388
|
+
}, isSaving ? t('warning-button-saving') : t('warning-button-save'), isSaving && ( /*#__PURE__*/React.createElement(CircularProgress, {
|
|
7689
8389
|
"data-testid": "spinner",
|
|
7690
8390
|
color: "inherit",
|
|
7691
8391
|
sx: spinnerSx
|
|
@@ -7704,7 +8404,7 @@ const Form = ({
|
|
|
7704
8404
|
style: {
|
|
7705
8405
|
position: 'relative'
|
|
7706
8406
|
}
|
|
7707
|
-
}, isPublishing ?
|
|
8407
|
+
}, isPublishing ? t('warning-button-publishing') : t('warning-button-publish'), isPublishing && ( /*#__PURE__*/React.createElement(CircularProgress, {
|
|
7708
8408
|
"data-testid": "spinner",
|
|
7709
8409
|
color: "inherit",
|
|
7710
8410
|
sx: spinnerSx
|
|
@@ -7718,6 +8418,7 @@ const PublicWarningsForm = props => {
|
|
|
7718
8418
|
const defaultValues = getFormData(publicWarningDetails, object);
|
|
7719
8419
|
return /*#__PURE__*/React.createElement(ReactHookFormProvider, {
|
|
7720
8420
|
options: Object.assign(Object.assign({}, defaultFormOptions), {
|
|
8421
|
+
mode: 'onSubmit',
|
|
7721
8422
|
defaultValues
|
|
7722
8423
|
})
|
|
7723
8424
|
}, /*#__PURE__*/React.createElement(Form, Object.assign({}, props)));
|
|
@@ -7776,7 +8477,9 @@ const getSelectedPublicIsFormDirty = createSelector(getPublicWarningStore, publi
|
|
|
7776
8477
|
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
7777
8478
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
7778
8479
|
* */
|
|
7779
|
-
const PublicWarningsFormConnect = (
|
|
8480
|
+
const PublicWarningsFormConnect = ({
|
|
8481
|
+
defaultBbox
|
|
8482
|
+
}) => {
|
|
7780
8483
|
const publicWarning = useSelector(store => getPublicWarning(store));
|
|
7781
8484
|
const publicWarningObject = useSelector(store => getPublicWarningObject(store));
|
|
7782
8485
|
const publicWarningFormAction = useSelector(store => getPublicWarningFormState(store));
|
|
@@ -7828,16 +8531,19 @@ const PublicWarningsFormConnect = () => {
|
|
|
7828
8531
|
formAction: publicWarningFormAction,
|
|
7829
8532
|
isReadOnly: isReadOnly,
|
|
7830
8533
|
error: publicWarningFormError,
|
|
7831
|
-
onFormDirty: onFormDirty
|
|
8534
|
+
onFormDirty: onFormDirty,
|
|
8535
|
+
defaultBbox: defaultBbox
|
|
7832
8536
|
});
|
|
7833
8537
|
};
|
|
7834
8538
|
|
|
7835
|
-
const warningFormConfirmationOptions = {
|
|
7836
|
-
|
|
7837
|
-
|
|
7838
|
-
|
|
7839
|
-
|
|
7840
|
-
|
|
8539
|
+
const warningFormConfirmationOptions = t => {
|
|
8540
|
+
return {
|
|
8541
|
+
cancelLabel: t('close-dialog-cancel'),
|
|
8542
|
+
title: t('close-warning-dialog-title'),
|
|
8543
|
+
description: t('close-dialog-description'),
|
|
8544
|
+
confirmLabel: t('close-dialog-confirm'),
|
|
8545
|
+
catchOnCancel: true
|
|
8546
|
+
};
|
|
7841
8547
|
};
|
|
7842
8548
|
const isAlreadyEdited = (publicWarningEditor, username) => {
|
|
7843
8549
|
return publicWarningEditor !== undefined && publicWarningEditor !== '' && publicWarningEditor !== null && publicWarningEditor !== username;
|
|
@@ -7845,7 +8551,8 @@ const isAlreadyEdited = (publicWarningEditor, username) => {
|
|
|
7845
8551
|
const PublicWarningsFormDialogConnect = ({
|
|
7846
8552
|
bounds,
|
|
7847
8553
|
source: _source = 'app',
|
|
7848
|
-
startPosition
|
|
8554
|
+
startPosition,
|
|
8555
|
+
defaultBbox
|
|
7849
8556
|
}) => {
|
|
7850
8557
|
const warningsApi = getWarningsApi();
|
|
7851
8558
|
const {
|
|
@@ -7856,6 +8563,9 @@ const PublicWarningsFormDialogConnect = ({
|
|
|
7856
8563
|
onCloseDialog,
|
|
7857
8564
|
uiIsLoading
|
|
7858
8565
|
} = useSetupDialog(publicWarningDialogType, _source);
|
|
8566
|
+
const {
|
|
8567
|
+
t
|
|
8568
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
7859
8569
|
const dispatch = useDispatch();
|
|
7860
8570
|
const confirmDialog = useConfirmationDialog();
|
|
7861
8571
|
const formAction = useSelector(store => getPublicWarningFormState(store));
|
|
@@ -7889,9 +8599,10 @@ const PublicWarningsFormDialogConnect = ({
|
|
|
7889
8599
|
// We are taking over from another user, first confirm this is what they want
|
|
7890
8600
|
if (!isReadOnly && isAlreadyEdited(latestEditor, username)) {
|
|
7891
8601
|
yield confirmDialog({
|
|
7892
|
-
title: '
|
|
7893
|
-
description: '
|
|
7894
|
-
confirmLabel: '
|
|
8602
|
+
title: t('warning-edit-mode-title'),
|
|
8603
|
+
description: t('warning-edit-mode-description'),
|
|
8604
|
+
confirmLabel: t('warning-edit-mode-confirm'),
|
|
8605
|
+
cancelLabel: t('warning-dialog-cancel')
|
|
7895
8606
|
});
|
|
7896
8607
|
}
|
|
7897
8608
|
dispatch(publicWarningFormActions.toggleEditorWarning({
|
|
@@ -7904,9 +8615,10 @@ const PublicWarningsFormDialogConnect = ({
|
|
|
7904
8615
|
const onChangeFormMode = isReadOnly => {
|
|
7905
8616
|
if (isReadOnly && isFormDirty) {
|
|
7906
8617
|
confirmDialog({
|
|
7907
|
-
title: '
|
|
7908
|
-
description: '
|
|
7909
|
-
confirmLabel: '
|
|
8618
|
+
title: t('warning-view-mode-title'),
|
|
8619
|
+
description: t('warning-view-mode-description'),
|
|
8620
|
+
confirmLabel: t('warning-view-mode-confirm'),
|
|
8621
|
+
cancelLabel: t('warning-dialog-cancel')
|
|
7910
8622
|
}).then(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
7911
8623
|
yield setIsEditor(isReadOnly);
|
|
7912
8624
|
}));
|
|
@@ -7916,7 +8628,7 @@ const PublicWarningsFormDialogConnect = ({
|
|
|
7916
8628
|
};
|
|
7917
8629
|
const closeDialog = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
7918
8630
|
if (isFormDirty) {
|
|
7919
|
-
const mayProceed = yield confirmDialog(warningFormConfirmationOptions).then(() => true).catch(() => false);
|
|
8631
|
+
const mayProceed = yield confirmDialog(warningFormConfirmationOptions(t)).then(() => true).catch(() => false);
|
|
7920
8632
|
if (!mayProceed) {
|
|
7921
8633
|
return;
|
|
7922
8634
|
}
|
|
@@ -7943,27 +8655,23 @@ const PublicWarningsFormDialogConnect = ({
|
|
|
7943
8655
|
onChangeFormMode: onChangeFormMode,
|
|
7944
8656
|
shouldHideFormMode: shouldHideFormToggleMode,
|
|
7945
8657
|
publicWarningEditor: publicWarningEditor
|
|
7946
|
-
}, /*#__PURE__*/React__default.createElement(PublicWarningsFormConnect,
|
|
8658
|
+
}, /*#__PURE__*/React__default.createElement(PublicWarningsFormConnect, {
|
|
8659
|
+
defaultBbox: defaultBbox
|
|
8660
|
+
}));
|
|
7947
8661
|
};
|
|
7948
8662
|
|
|
7949
8663
|
const getStatus = status => {
|
|
7950
8664
|
switch (status) {
|
|
7951
8665
|
case 'DRAFT':
|
|
7952
|
-
return '
|
|
8666
|
+
return outsideComponentTranslations['warning-list-status-draft'];
|
|
7953
8667
|
case 'PUBLISHED':
|
|
7954
|
-
return '
|
|
8668
|
+
return outsideComponentTranslations['warning-list-status-published'];
|
|
7955
8669
|
case 'TODO':
|
|
7956
|
-
return '
|
|
8670
|
+
return outsideComponentTranslations['warning-list-status-todo'];
|
|
7957
8671
|
default:
|
|
7958
|
-
return '
|
|
8672
|
+
return outsideComponentTranslations['warning-list-status-expired'];
|
|
7959
8673
|
}
|
|
7960
8674
|
};
|
|
7961
|
-
const CREATE_WARNING = 'Create a warning';
|
|
7962
|
-
const BUTTON_EDIT = 'Edit';
|
|
7963
|
-
const BUTTON_DELETE = 'Delete';
|
|
7964
|
-
const BUTTON_USE = 'Use';
|
|
7965
|
-
const BUTTON_IGNORE = 'Ignore';
|
|
7966
|
-
const BUTTON_OPTIONS = 'Options';
|
|
7967
8675
|
const sortWarningsOnStatus = warnings => {
|
|
7968
8676
|
return warnings.reduce((allWarnings, warning) => {
|
|
7969
8677
|
if (warning.status === 'DRAFT') {
|
|
@@ -8047,6 +8755,9 @@ const WarningsOnStatus = ({
|
|
|
8047
8755
|
onDeleteWarning: _onDeleteWarning = () => {},
|
|
8048
8756
|
onIgnoreWarning: _onIgnoreWarning = () => {}
|
|
8049
8757
|
}) => {
|
|
8758
|
+
const {
|
|
8759
|
+
t
|
|
8760
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
8050
8761
|
const headerText = `${warnings.length} ${getStatus(status)}`;
|
|
8051
8762
|
const onClickWarning = warning => () => _onSelectWarning(warning);
|
|
8052
8763
|
const onClickEditWarning = warning => () => _onEditWarning(warning);
|
|
@@ -8058,22 +8769,22 @@ const WarningsOnStatus = ({
|
|
|
8058
8769
|
const getMenuItems = warning => {
|
|
8059
8770
|
if (status === 'DRAFT') {
|
|
8060
8771
|
return [{
|
|
8061
|
-
text:
|
|
8772
|
+
text: t('object-manager-button-edit'),
|
|
8062
8773
|
action: onClickEditWarning(warning),
|
|
8063
8774
|
icon: /*#__PURE__*/React__default.createElement(Edit, null)
|
|
8064
8775
|
}, {
|
|
8065
|
-
text:
|
|
8776
|
+
text: t('object-manager-button-delete'),
|
|
8066
8777
|
action: onClickDeleteWarning(warning.id),
|
|
8067
8778
|
icon: /*#__PURE__*/React__default.createElement(Delete, null)
|
|
8068
8779
|
}];
|
|
8069
8780
|
}
|
|
8070
8781
|
if (status === 'TODO') {
|
|
8071
8782
|
return [{
|
|
8072
|
-
text:
|
|
8783
|
+
text: t('warning-list-button-ignore'),
|
|
8073
8784
|
action: onClickIgnoreWarning(warning),
|
|
8074
8785
|
icon: /*#__PURE__*/React__default.createElement(VisibilityOff, null)
|
|
8075
8786
|
}, {
|
|
8076
|
-
text:
|
|
8787
|
+
text: t('warning-list-button-use'),
|
|
8077
8788
|
action: onClickUseWarning(warning),
|
|
8078
8789
|
icon: /*#__PURE__*/React__default.createElement(Success, null)
|
|
8079
8790
|
}];
|
|
@@ -8093,8 +8804,8 @@ const WarningsOnStatus = ({
|
|
|
8093
8804
|
"aria-label": `warninglist ${status}`
|
|
8094
8805
|
}, warnings.map(warning => {
|
|
8095
8806
|
var _a;
|
|
8096
|
-
const phenomenonDetails = warningPhenomena.find(phenomenon => phenomenon.key === warning.warningDetail.phenomenon);
|
|
8097
|
-
const levelDetails = levelOptions.find(level => level.key === warning.warningDetail.level);
|
|
8807
|
+
const phenomenonDetails = warningPhenomena(t).find(phenomenon => phenomenon.key === warning.warningDetail.phenomenon);
|
|
8808
|
+
const levelDetails = levelOptions(t).find(level => level.key === warning.warningDetail.level);
|
|
8098
8809
|
return /*#__PURE__*/React__default.createElement(ListItem, {
|
|
8099
8810
|
key: warning.id,
|
|
8100
8811
|
sx: {
|
|
@@ -8109,10 +8820,10 @@ const WarningsOnStatus = ({
|
|
|
8109
8820
|
containerType: 'inline-size'
|
|
8110
8821
|
},
|
|
8111
8822
|
secondaryAction: status !== 'EXPIRED' ? ( /*#__PURE__*/React__default.createElement(ToggleMenu, {
|
|
8112
|
-
menuTitle:
|
|
8113
|
-
tooltipTitle:
|
|
8823
|
+
menuTitle: t('warning-list-button-options'),
|
|
8824
|
+
tooltipTitle: t('warning-list-button-options'),
|
|
8114
8825
|
menuPosition: "bottom",
|
|
8115
|
-
"aria-label":
|
|
8826
|
+
"aria-label": t('warning-list-button-options'),
|
|
8116
8827
|
menuItems: getMenuItems(warning),
|
|
8117
8828
|
buttonIcon: /*#__PURE__*/React__default.createElement(Options, null)
|
|
8118
8829
|
})) : ( /*#__PURE__*/React__default.createElement(Box, {
|
|
@@ -8146,26 +8857,26 @@ const WarningsOnStatus = ({
|
|
|
8146
8857
|
columnSpacing: 2,
|
|
8147
8858
|
alignItems: "center"
|
|
8148
8859
|
}, /*#__PURE__*/React__default.createElement(WarningListColumnContent, {
|
|
8149
|
-
title:
|
|
8860
|
+
title: t('warning-list-header-incident'),
|
|
8150
8861
|
status: status,
|
|
8151
8862
|
width: 142
|
|
8152
8863
|
}), /*#__PURE__*/React__default.createElement(WarningListColumnContent, {
|
|
8153
|
-
title:
|
|
8864
|
+
title: t('warning-list-header-last-update'),
|
|
8154
8865
|
status: status,
|
|
8155
8866
|
width: 142
|
|
8156
8867
|
}, warning.lastUpdatedTime && `${dateUtils.dateToString(dateUtils.utc(warning.lastUpdatedTime), DATE_FORMAT_FNS)} UTC`), /*#__PURE__*/React__default.createElement(WarningListColumnContent, {
|
|
8157
|
-
title:
|
|
8868
|
+
title: t('warning-list-header-start-time'),
|
|
8158
8869
|
status: status,
|
|
8159
8870
|
width: 142
|
|
8160
8871
|
}, warning.warningDetail.validFrom && `${dateUtils.dateToString(dateUtils.utc(warning.warningDetail.validFrom), DATE_FORMAT_FNS)} UTC`), /*#__PURE__*/React__default.createElement(WarningListColumnContent, {
|
|
8161
|
-
title:
|
|
8872
|
+
title: t('warning-list-header-end-time'),
|
|
8162
8873
|
status: status,
|
|
8163
8874
|
width: 142
|
|
8164
8875
|
}, warning.warningDetail.validUntil && `${dateUtils.dateToString(dateUtils.utc(warning.warningDetail.validUntil), DATE_FORMAT_FNS)} UTC`), /*#__PURE__*/React__default.createElement(WarningListColumnContent, {
|
|
8165
|
-
title:
|
|
8876
|
+
title: t('warning-list-header-domain'),
|
|
8166
8877
|
status: status
|
|
8167
8878
|
}, warning.warningDetail.domain), /*#__PURE__*/React__default.createElement(WarningListColumnContent, {
|
|
8168
|
-
title:
|
|
8879
|
+
title: t('warning-list-header-phenomenon'),
|
|
8169
8880
|
status: status,
|
|
8170
8881
|
width: 140,
|
|
8171
8882
|
sx: {
|
|
@@ -8178,7 +8889,7 @@ const WarningsOnStatus = ({
|
|
|
8178
8889
|
bottom: -6
|
|
8179
8890
|
}
|
|
8180
8891
|
}, phenomenonDetails === null || phenomenonDetails === void 0 ? void 0 : phenomenonDetails.icon)), /*#__PURE__*/React__default.createElement(WarningListColumnContent, {
|
|
8181
|
-
title:
|
|
8892
|
+
title: t('warning-list-header-level'),
|
|
8182
8893
|
status: status
|
|
8183
8894
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
8184
8895
|
component: "span",
|
|
@@ -8191,7 +8902,8 @@ const WarningsOnStatus = ({
|
|
|
8191
8902
|
marginLeft: -0.5
|
|
8192
8903
|
}
|
|
8193
8904
|
}, ((_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, {
|
|
8194
|
-
status: status
|
|
8905
|
+
status: status,
|
|
8906
|
+
width: 96
|
|
8195
8907
|
}, status === 'DRAFT' ? ( /*#__PURE__*/React__default.createElement(Box, {
|
|
8196
8908
|
sx: {
|
|
8197
8909
|
position: 'relative',
|
|
@@ -8216,7 +8928,7 @@ const WarningsOnStatus = ({
|
|
|
8216
8928
|
},
|
|
8217
8929
|
variant: "flat",
|
|
8218
8930
|
startIcon: /*#__PURE__*/React__default.createElement(Edit, null)
|
|
8219
|
-
},
|
|
8931
|
+
}, t('warning-list-header-draft')))) : ( /*#__PURE__*/React__default.createElement(StatusTag, {
|
|
8220
8932
|
content: status.toLowerCase(),
|
|
8221
8933
|
color: status === 'EXPIRED' ? 'grey' : 'green',
|
|
8222
8934
|
sx: {
|
|
@@ -8238,6 +8950,9 @@ const PublicWarningList = ({
|
|
|
8238
8950
|
onRefetchWarnings: _onRefetchWarnings = () => {},
|
|
8239
8951
|
onIgnoreWarning: _onIgnoreWarning2 = () => {}
|
|
8240
8952
|
}) => {
|
|
8953
|
+
const {
|
|
8954
|
+
t
|
|
8955
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
8241
8956
|
const sortedWarnings = warnings ? sortWarningsOnStatus(warnings) : null;
|
|
8242
8957
|
return /*#__PURE__*/React__default.createElement(Box, {
|
|
8243
8958
|
sx: {
|
|
@@ -8258,7 +8973,7 @@ const PublicWarningList = ({
|
|
|
8258
8973
|
fontSize: '12px',
|
|
8259
8974
|
height: '32px'
|
|
8260
8975
|
}
|
|
8261
|
-
},
|
|
8976
|
+
}, t('warning-list-button_create'))), error && /*#__PURE__*/React__default.createElement(AlertBanner, {
|
|
8262
8977
|
title: error.message,
|
|
8263
8978
|
shouldClose: true
|
|
8264
8979
|
}), _isLoading && ( /*#__PURE__*/React__default.createElement(LinearProgress, {
|
|
@@ -8320,7 +9035,7 @@ var defineBuiltInAccessor$1 = function (target, name, descriptor) {
|
|
|
8320
9035
|
|
|
8321
9036
|
var $ = _export;
|
|
8322
9037
|
var DESCRIPTORS = descriptors;
|
|
8323
|
-
var global$1 = global$
|
|
9038
|
+
var global$1 = global$i;
|
|
8324
9039
|
var uncurryThis = functionUncurryThis;
|
|
8325
9040
|
var hasOwn = hasOwnProperty_1;
|
|
8326
9041
|
var isCallable = isCallable$i;
|
|
@@ -8410,7 +9125,6 @@ const isPublicWarningsLoading = createSelector(getPublicWarningsStore, store =>
|
|
|
8410
9125
|
const getPublicWarningsError = createSelector(getPublicWarningsStore, store => store === null || store === void 0 ? void 0 : store.error);
|
|
8411
9126
|
const getPublicWarningsLastUpdatedTime = createSelector(getPublicWarningsStore, store => store === null || store === void 0 ? void 0 : store.lastUpdatedTime);
|
|
8412
9127
|
|
|
8413
|
-
const CANCEL = 'Go back';
|
|
8414
9128
|
const ConfirmDeleteWarningDialog = ({
|
|
8415
9129
|
onClose: _onClose = () => {},
|
|
8416
9130
|
title,
|
|
@@ -8419,6 +9133,9 @@ const ConfirmDeleteWarningDialog = ({
|
|
|
8419
9133
|
confirmLabel,
|
|
8420
9134
|
callback
|
|
8421
9135
|
}) => {
|
|
9136
|
+
const {
|
|
9137
|
+
t
|
|
9138
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
8422
9139
|
const [isLoading, setIsLoading] = React__default.useState(false);
|
|
8423
9140
|
const [error, setError] = React__default.useState(undefined);
|
|
8424
9141
|
const onSubmit = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
@@ -8436,7 +9153,7 @@ const ConfirmDeleteWarningDialog = ({
|
|
|
8436
9153
|
title: title,
|
|
8437
9154
|
open: true,
|
|
8438
9155
|
confirmLabel: confirmLabel,
|
|
8439
|
-
cancelLabel:
|
|
9156
|
+
cancelLabel: t('warning-dialog-cancel'),
|
|
8440
9157
|
description: !error ? description : '',
|
|
8441
9158
|
onClose: _onClose,
|
|
8442
9159
|
onSubmit: onSubmit,
|
|
@@ -8460,15 +9177,10 @@ const ConfirmDeleteWarningDialog = ({
|
|
|
8460
9177
|
}));
|
|
8461
9178
|
};
|
|
8462
9179
|
|
|
8463
|
-
const DELETE_WARNING_SUCCESS_MESSAGE = `Warning has been deleted`;
|
|
8464
|
-
const DELETE_TITLE = 'Delete warning';
|
|
8465
|
-
const DELETE_CONFIRM = 'Delete';
|
|
8466
|
-
const DELETE_DESCRIPTION = 'Are you sure you want to delete this warning?';
|
|
8467
|
-
const IGNORE_WARNING_SUCCESS_MESSAGE = `Warning has been ignored`;
|
|
8468
|
-
const IGNORE_TITLE = 'Ignore warning';
|
|
8469
|
-
const IGNORE_CONFIRM = 'Ignore';
|
|
8470
|
-
const IGNORE_DESCRIPTION = 'Are you sure you want to ignore this warning?';
|
|
8471
9180
|
const PublicWarningListConnect = () => {
|
|
9181
|
+
const {
|
|
9182
|
+
t
|
|
9183
|
+
} = useTranslation(WARN_NAMESPACE);
|
|
8472
9184
|
const dispatch = useDispatch();
|
|
8473
9185
|
const confirmDialog = useConfirmationDialog();
|
|
8474
9186
|
const [confirmDialogOptions, setConfirmDialogOptions] = React__default.useState(undefined);
|
|
@@ -8480,7 +9192,7 @@ const PublicWarningListConnect = () => {
|
|
|
8480
9192
|
const lastUpdatedTime = useSelector(store => getPublicWarningsLastUpdatedTime(store));
|
|
8481
9193
|
const openPublicWarningDialog = (formAction, publicWarning) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8482
9194
|
if (isFormDirty) {
|
|
8483
|
-
const mayProceed = yield confirmDialog(warningFormConfirmationOptions).then(() => true).catch(() => false);
|
|
9195
|
+
const mayProceed = yield confirmDialog(warningFormConfirmationOptions(t)).then(() => true).catch(() => false);
|
|
8484
9196
|
if (!mayProceed) {
|
|
8485
9197
|
return;
|
|
8486
9198
|
}
|
|
@@ -8508,11 +9220,11 @@ const PublicWarningListConnect = () => {
|
|
|
8508
9220
|
const warningsApi = getWarningsApi();
|
|
8509
9221
|
const deleteWarning = warningId => {
|
|
8510
9222
|
setConfirmDialogOptions({
|
|
8511
|
-
confirmLabel:
|
|
8512
|
-
title:
|
|
8513
|
-
description:
|
|
9223
|
+
confirmLabel: t('warning-dialog-delete-confirm'),
|
|
9224
|
+
title: t('warning-dialog-delete-title'),
|
|
9225
|
+
description: t('warning-dialog-delete-description'),
|
|
8514
9226
|
request: () => warningsApi.deleteWarning(warningId),
|
|
8515
|
-
callback: () => onRemoveSuccess(warningId,
|
|
9227
|
+
callback: () => onRemoveSuccess(warningId, t('warning-dialog-delete-succes'))
|
|
8516
9228
|
});
|
|
8517
9229
|
};
|
|
8518
9230
|
const ignoreWarning = warning => {
|
|
@@ -8520,11 +9232,11 @@ const PublicWarningListConnect = () => {
|
|
|
8520
9232
|
status: 'IGNORED'
|
|
8521
9233
|
});
|
|
8522
9234
|
setConfirmDialogOptions({
|
|
8523
|
-
confirmLabel:
|
|
8524
|
-
title:
|
|
8525
|
-
description:
|
|
9235
|
+
confirmLabel: t('warning-dialog-ignore-confirm'),
|
|
9236
|
+
title: t('warning-dialog-ignore-title'),
|
|
9237
|
+
description: t('warning-dialog-ignore-description'),
|
|
8526
9238
|
request: () => warningsApi.updateWarning(ignoredWarning.id, ignoredWarning),
|
|
8527
|
-
callback: () => onRemoveSuccess(ignoredWarning.id,
|
|
9239
|
+
callback: () => onRemoveSuccess(ignoredWarning.id, t('warning-dialog-ignore-succes'))
|
|
8528
9240
|
});
|
|
8529
9241
|
};
|
|
8530
9242
|
const onRemoveSuccess = (warningId, snackbarMessage) => {
|
|
@@ -8611,174 +9323,144 @@ const componentsLookUp = (payload, apiProps) => {
|
|
|
8611
9323
|
}
|
|
8612
9324
|
};
|
|
8613
9325
|
|
|
8614
|
-
const
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
const
|
|
8630
|
-
yield
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
9326
|
+
const getErrorMessage = error => isAxiosError(error) ? getAxiosErrorMessage(error) : error.message;
|
|
9327
|
+
const getToggleEditorSuccessMessage = isEditor => outsideComponentTranslations[isEditor ? 'warning-editor-add-editor' : 'warning-editor-remove-editor'];
|
|
9328
|
+
const publicWarningFormListener = createListenerMiddleware();
|
|
9329
|
+
publicWarningFormListener.startListening({
|
|
9330
|
+
actionCreator: publicWarningFormActions.toggleEditorWarning,
|
|
9331
|
+
effect: ({
|
|
9332
|
+
payload
|
|
9333
|
+
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9334
|
+
listenerApi.cancelActiveListeners();
|
|
9335
|
+
try {
|
|
9336
|
+
const {
|
|
9337
|
+
warningId,
|
|
9338
|
+
isEditor,
|
|
9339
|
+
username
|
|
9340
|
+
} = payload;
|
|
9341
|
+
const warningsApi = getWarningsApi();
|
|
9342
|
+
yield warningsApi.toggleEditorWarning(warningId, isEditor);
|
|
9343
|
+
// update list to show correct avatar
|
|
9344
|
+
listenerApi.dispatch(publicWarningActions.fetchWarnings());
|
|
9345
|
+
listenerApi.dispatch(publicWarningFormActions.toggleEditorWarningSuccess({
|
|
9346
|
+
isEditor,
|
|
9347
|
+
username,
|
|
9348
|
+
message: getToggleEditorSuccessMessage(isEditor)
|
|
8634
9349
|
}));
|
|
8635
|
-
}
|
|
8636
|
-
|
|
9350
|
+
} catch (error) {
|
|
9351
|
+
const isDialogOpen = uiSelectors.getisDialogOpen(listenerApi.getState(), publicWarningDialogType);
|
|
9352
|
+
errorEffect(listenerApi.dispatch, getErrorMessage(error), isDialogOpen);
|
|
8637
9353
|
}
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
9354
|
+
})
|
|
9355
|
+
});
|
|
9356
|
+
publicWarningFormListener.startListening({
|
|
9357
|
+
actionCreator: publicWarningFormActions.publishWarning,
|
|
9358
|
+
effect: ({
|
|
9359
|
+
payload
|
|
9360
|
+
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9361
|
+
listenerApi.cancelActiveListeners();
|
|
9362
|
+
try {
|
|
9363
|
+
const {
|
|
9364
|
+
publicWarning
|
|
9365
|
+
} = payload;
|
|
9366
|
+
const publishedWarning = yield saveOrUpdateWarning(publicWarning);
|
|
9367
|
+
listenerApi.dispatch(publicWarningFormActions.publishWarningSuccess({
|
|
9368
|
+
publicWarning: publishedWarning,
|
|
9369
|
+
message: outsideComponentTranslations['warning-publish-succes']
|
|
9370
|
+
}));
|
|
9371
|
+
listenerApi.dispatch(uiActions.setToggleOpenDialog({
|
|
9372
|
+
type: publicWarningDialogType,
|
|
9373
|
+
setOpen: false
|
|
9374
|
+
}));
|
|
9375
|
+
} catch (error) {
|
|
9376
|
+
const isDialogOpen = uiSelectors.getisDialogOpen(listenerApi.getState(), publicWarningDialogType);
|
|
9377
|
+
errorEffect(listenerApi.dispatch, getErrorMessage(error), isDialogOpen);
|
|
9378
|
+
}
|
|
9379
|
+
})
|
|
9380
|
+
});
|
|
9381
|
+
publicWarningFormListener.startListening({
|
|
9382
|
+
actionCreator: publicWarningFormActions.saveWarning,
|
|
9383
|
+
effect: ({
|
|
9384
|
+
payload
|
|
9385
|
+
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9386
|
+
listenerApi.cancelActiveListeners();
|
|
9387
|
+
try {
|
|
9388
|
+
const {
|
|
9389
|
+
publicWarning
|
|
9390
|
+
} = payload;
|
|
9391
|
+
const savedWarning = yield saveOrUpdateWarning(publicWarning);
|
|
9392
|
+
listenerApi.dispatch(publicWarningFormActions.saveWarningSuccess({
|
|
9393
|
+
publicWarning: savedWarning,
|
|
9394
|
+
message: outsideComponentTranslations['warning-save-succes']
|
|
9395
|
+
}));
|
|
9396
|
+
} catch (error) {
|
|
9397
|
+
const isDialogOpen = uiSelectors.getisDialogOpen(listenerApi.getState(), publicWarningDialogType);
|
|
9398
|
+
errorEffect(listenerApi.dispatch, getErrorMessage(error), isDialogOpen);
|
|
9399
|
+
}
|
|
9400
|
+
})
|
|
9401
|
+
});
|
|
9402
|
+
// Side effects/snackbar listeners
|
|
9403
|
+
publicWarningFormListener.startListening({
|
|
9404
|
+
matcher: isAnyOf(publicWarningFormActions.publishWarningSuccess, publicWarningFormActions.saveWarningSuccess, publicWarningFormActions.toggleEditorWarningSuccess),
|
|
9405
|
+
effect: ({
|
|
9406
|
+
payload
|
|
9407
|
+
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9408
|
+
listenerApi.cancelActiveListeners();
|
|
9409
|
+
const {
|
|
9410
|
+
message
|
|
9411
|
+
} = payload;
|
|
9412
|
+
listenerApi.dispatch(snackbarActions.openSnackbar({
|
|
9413
|
+
message
|
|
8653
9414
|
}));
|
|
8654
|
-
const
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
9415
|
+
const isDialogOpen = uiSelectors.getisDialogOpen(listenerApi.getState(), publicWarningDialogType);
|
|
9416
|
+
toggleDialogLoadingEffect(listenerApi.dispatch, isDialogOpen, false);
|
|
9417
|
+
})
|
|
9418
|
+
});
|
|
9419
|
+
publicWarningFormListener.startListening({
|
|
9420
|
+
matcher: isAnyOf(publicWarningFormActions.publishWarning, publicWarningFormActions.saveWarning),
|
|
9421
|
+
effect: (_, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9422
|
+
listenerApi.cancelActiveListeners();
|
|
9423
|
+
const isDialogOpen = uiSelectors.getisDialogOpen(listenerApi.getState(), publicWarningDialogType);
|
|
9424
|
+
toggleDialogLoadingEffect(listenerApi.dispatch, isDialogOpen, true);
|
|
9425
|
+
})
|
|
9426
|
+
});
|
|
9427
|
+
publicWarningFormListener.startListening({
|
|
9428
|
+
actionCreator: publicWarningFormActions.openPublicWarningFormDialog,
|
|
9429
|
+
effect: (_, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9430
|
+
listenerApi.cancelActiveListeners();
|
|
9431
|
+
listenerApi.dispatch(uiActions.setToggleOpenDialog({
|
|
9432
|
+
setOpen: true,
|
|
9433
|
+
type: publicWarningDialogType
|
|
8658
9434
|
}));
|
|
8659
|
-
}
|
|
8660
|
-
}
|
|
8661
|
-
function*
|
|
8662
|
-
|
|
8663
|
-
}
|
|
8664
|
-
|
|
8665
|
-
const PUBLISH_SUCCES = 'Public warning has succesfully been published!';
|
|
8666
|
-
const SAVE_SUCCES = 'Public warning has succesfully been saved!';
|
|
8667
|
-
const getErrorMessage = error => isAxiosError$1(error) ? getAxiosErrorMessage(error) : error.message;
|
|
8668
|
-
function* saveOrUpdateWarning(publicWarning) {
|
|
8669
|
-
const warningsApi = yield call$c(getWarningsApi);
|
|
9435
|
+
})
|
|
9436
|
+
});
|
|
9437
|
+
const saveOrUpdateWarning = publicWarning => __awaiter(void 0, void 0, void 0, function* () {
|
|
9438
|
+
const warningsApi = getWarningsApi();
|
|
8670
9439
|
if (publicWarning.warningDetail.id) {
|
|
8671
|
-
yield
|
|
9440
|
+
yield warningsApi.updateWarning(publicWarning.warningDetail.id, publicWarning);
|
|
8672
9441
|
return publicWarning;
|
|
8673
9442
|
}
|
|
8674
|
-
const newWarningId = yield
|
|
9443
|
+
const newWarningId = yield warningsApi.saveWarningAs(publicWarning);
|
|
8675
9444
|
return Object.assign(Object.assign({}, publicWarning), {
|
|
8676
9445
|
warningDetail: Object.assign(Object.assign({}, publicWarning.warningDetail), {
|
|
8677
9446
|
id: newWarningId
|
|
8678
9447
|
})
|
|
8679
9448
|
});
|
|
8680
|
-
}
|
|
8681
|
-
const
|
|
8682
|
-
function* toggleEditorWarningSaga({
|
|
8683
|
-
payload
|
|
8684
|
-
}) {
|
|
8685
|
-
try {
|
|
8686
|
-
const {
|
|
8687
|
-
warningId,
|
|
8688
|
-
isEditor,
|
|
8689
|
-
username
|
|
8690
|
-
} = payload;
|
|
8691
|
-
const warningsApi = yield call$c(getWarningsApi);
|
|
8692
|
-
yield call$c(warningsApi.toggleEditorWarning, warningId, isEditor);
|
|
8693
|
-
// update list to show correct avatar
|
|
8694
|
-
yield put(publicWarningActions.fetchWarnings());
|
|
8695
|
-
yield put(publicWarningFormActions.toggleEditorWarningSuccess({
|
|
8696
|
-
isEditor,
|
|
8697
|
-
username,
|
|
8698
|
-
message: getToggleEditorSuccessMessage(isEditor)
|
|
8699
|
-
}));
|
|
8700
|
-
} catch (error) {
|
|
8701
|
-
yield call$c(errorSaga, getErrorMessage(error));
|
|
8702
|
-
}
|
|
8703
|
-
}
|
|
8704
|
-
function* publishWarningSaga({
|
|
8705
|
-
payload
|
|
8706
|
-
}) {
|
|
8707
|
-
try {
|
|
8708
|
-
const {
|
|
8709
|
-
publicWarning
|
|
8710
|
-
} = payload;
|
|
8711
|
-
const publishedWarning = yield call$c(saveOrUpdateWarning, publicWarning);
|
|
8712
|
-
yield put(publicWarningFormActions.publishWarningSuccess({
|
|
8713
|
-
publicWarning: publishedWarning,
|
|
8714
|
-
message: PUBLISH_SUCCES
|
|
8715
|
-
}));
|
|
8716
|
-
yield put(uiActions.setToggleOpenDialog({
|
|
8717
|
-
type: publicWarningDialogType,
|
|
8718
|
-
setOpen: false
|
|
8719
|
-
}));
|
|
8720
|
-
} catch (error) {
|
|
8721
|
-
yield call$c(errorSaga, getErrorMessage(error));
|
|
8722
|
-
}
|
|
8723
|
-
}
|
|
8724
|
-
function* saveWarningSaga({
|
|
8725
|
-
payload
|
|
8726
|
-
}) {
|
|
8727
|
-
try {
|
|
8728
|
-
const {
|
|
8729
|
-
publicWarning
|
|
8730
|
-
} = payload;
|
|
8731
|
-
const savedWarning = yield call$c(saveOrUpdateWarning, publicWarning);
|
|
8732
|
-
yield put(publicWarningFormActions.saveWarningSuccess({
|
|
8733
|
-
publicWarning: savedWarning,
|
|
8734
|
-
message: SAVE_SUCCES
|
|
8735
|
-
}));
|
|
8736
|
-
} catch (error) {
|
|
8737
|
-
yield call$c(errorSaga, getErrorMessage(error));
|
|
8738
|
-
}
|
|
8739
|
-
}
|
|
8740
|
-
function* successSaga({
|
|
8741
|
-
payload
|
|
8742
|
-
}) {
|
|
8743
|
-
const {
|
|
8744
|
-
message
|
|
8745
|
-
} = payload;
|
|
8746
|
-
yield put(snackbarActions.openSnackbar({
|
|
8747
|
-
message
|
|
8748
|
-
}));
|
|
8749
|
-
yield call$c(toggleDialogLoadingSaga, false);
|
|
8750
|
-
}
|
|
8751
|
-
function* errorSaga(message) {
|
|
8752
|
-
yield put(publicWarningFormActions.setFormError({
|
|
8753
|
-
message
|
|
8754
|
-
}));
|
|
8755
|
-
yield call$c(toggleDialogLoadingSaga, false);
|
|
8756
|
-
}
|
|
8757
|
-
function* toggleDialogLoadingSaga(isLoading) {
|
|
8758
|
-
const isDialogOpen = yield select(uiSelectors.getDialogDetailsByType, publicWarningDialogType);
|
|
9449
|
+
});
|
|
9450
|
+
const toggleDialogLoadingEffect = (dispatch, isDialogOpen, isLoading) => {
|
|
8759
9451
|
if (isDialogOpen) {
|
|
8760
|
-
|
|
9452
|
+
dispatch(uiActions.toggleIsLoadingDialog({
|
|
8761
9453
|
isLoading,
|
|
8762
9454
|
type: publicWarningDialogType
|
|
8763
9455
|
}));
|
|
8764
9456
|
}
|
|
8765
|
-
}
|
|
8766
|
-
|
|
8767
|
-
|
|
8768
|
-
|
|
8769
|
-
type: publicWarningDialogType
|
|
9457
|
+
};
|
|
9458
|
+
const errorEffect = (dispatch, message, isDialogOpen) => {
|
|
9459
|
+
dispatch(publicWarningFormActions.setFormError({
|
|
9460
|
+
message
|
|
8770
9461
|
}));
|
|
8771
|
-
|
|
8772
|
-
|
|
8773
|
-
// requests
|
|
8774
|
-
yield takeLatest(publicWarningFormActions.toggleEditorWarning, toggleEditorWarningSaga);
|
|
8775
|
-
yield takeLatest(publicWarningFormActions.publishWarning, publishWarningSaga);
|
|
8776
|
-
yield takeLatest(publicWarningFormActions.saveWarning, saveWarningSaga);
|
|
8777
|
-
// side effects ui/snackbar
|
|
8778
|
-
yield takeLatest([publicWarningFormActions.publishWarningSuccess, publicWarningFormActions.saveWarningSuccess, publicWarningFormActions.toggleEditorWarningSuccess], successSaga);
|
|
8779
|
-
yield takeLatest([publicWarningFormActions.publishWarning, publicWarningFormActions.saveWarning], toggleDialogLoadingSaga, true);
|
|
8780
|
-
yield takeLatest(publicWarningFormActions.openPublicWarningFormDialog, openDialogSaga);
|
|
8781
|
-
}
|
|
9462
|
+
toggleDialogLoadingEffect(dispatch, isDialogOpen, false);
|
|
9463
|
+
};
|
|
8782
9464
|
|
|
8783
9465
|
/* *
|
|
8784
9466
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -8797,35 +9479,115 @@ function* publicWarningRootSaga() {
|
|
|
8797
9479
|
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
8798
9480
|
* */
|
|
8799
9481
|
const getLastUpdatedTimeFormatted = () => dateUtils.dateToString(dateUtils.utc(), DATE_FORMAT_LASTUPDATEDTIME);
|
|
8800
|
-
|
|
8801
|
-
|
|
8802
|
-
|
|
9482
|
+
const publicWarningsListener = createListenerMiddleware();
|
|
9483
|
+
publicWarningsListener.startListening({
|
|
9484
|
+
actionCreator: publicWarningActions.fetchWarnings,
|
|
9485
|
+
effect: (_, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9486
|
+
listenerApi.cancelActiveListeners();
|
|
9487
|
+
try {
|
|
9488
|
+
const warningsApi = getWarningsApi();
|
|
9489
|
+
const {
|
|
9490
|
+
data: warnings
|
|
9491
|
+
} = yield warningsApi.getWarnings();
|
|
9492
|
+
const lastUpdatedTime = getLastUpdatedTimeFormatted();
|
|
9493
|
+
listenerApi.dispatch(publicWarningActions.fetchWarningsSuccess({
|
|
9494
|
+
warnings,
|
|
9495
|
+
lastUpdatedTime
|
|
9496
|
+
}));
|
|
9497
|
+
yield listenerApi.delay(pollingIntervalTimeout);
|
|
9498
|
+
listenerApi.dispatch(publicWarningActions.fetchWarnings());
|
|
9499
|
+
} catch (error) {
|
|
9500
|
+
// Don't set an error if the cancelActiveListeners was invoked (which throws a TaskAbortError)
|
|
9501
|
+
if ((error === null || error === void 0 ? void 0 : error.code) !== 'listener-cancelled') {
|
|
9502
|
+
listenerApi.dispatch(publicWarningActions.fetchWarningsError({
|
|
9503
|
+
error: {
|
|
9504
|
+
name: error.name,
|
|
9505
|
+
message: error.message
|
|
9506
|
+
}
|
|
9507
|
+
}));
|
|
9508
|
+
}
|
|
9509
|
+
}
|
|
9510
|
+
})
|
|
9511
|
+
});
|
|
9512
|
+
publicWarningsListener.startListening({
|
|
9513
|
+
matcher: isAnyOf(publicWarningFormActions.publishWarningSuccess, publicWarningFormActions.saveWarningSuccess),
|
|
9514
|
+
effect: (_, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9515
|
+
listenerApi.cancelActiveListeners();
|
|
9516
|
+
listenerApi.dispatch(publicWarningActions.fetchWarnings());
|
|
9517
|
+
})
|
|
9518
|
+
});
|
|
9519
|
+
|
|
9520
|
+
/* *
|
|
9521
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9522
|
+
* you may not use this file except in compliance with the License.
|
|
9523
|
+
* You may obtain a copy of the License at
|
|
9524
|
+
*
|
|
9525
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9526
|
+
*
|
|
9527
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9528
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9529
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9530
|
+
* See the License for the specific language governing permissions and
|
|
9531
|
+
* limitations under the License.
|
|
9532
|
+
*
|
|
9533
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
9534
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
9535
|
+
* */
|
|
9536
|
+
const getSnackbarMessage = (objectName, id) => id ? `Object "${objectName}" ${outsideComponentTranslations['update-succes']}!` : `Object "${objectName}" ${outsideComponentTranslations['save-succes']}!`;
|
|
9537
|
+
const drawingsListener = createListenerMiddleware();
|
|
9538
|
+
drawingsListener.startListening({
|
|
9539
|
+
actionCreator: drawActions.submitDrawValues,
|
|
9540
|
+
effect: ({
|
|
9541
|
+
payload
|
|
9542
|
+
}, listenerApi) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9543
|
+
listenerApi.cancelActiveListeners();
|
|
8803
9544
|
const {
|
|
8804
|
-
|
|
8805
|
-
|
|
8806
|
-
|
|
8807
|
-
|
|
8808
|
-
|
|
8809
|
-
|
|
8810
|
-
|
|
8811
|
-
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8817
|
-
|
|
9545
|
+
id
|
|
9546
|
+
} = payload,
|
|
9547
|
+
formValues = __rest(payload, ["id"]);
|
|
9548
|
+
try {
|
|
9549
|
+
listenerApi.dispatch(uiActions.toggleIsLoadingDialog({
|
|
9550
|
+
isLoading: true,
|
|
9551
|
+
type: drawingDialogType
|
|
9552
|
+
}));
|
|
9553
|
+
const warningsApi = getWarningsApi();
|
|
9554
|
+
if (!id) {
|
|
9555
|
+
const newID = yield warningsApi.saveDrawingAs(formValues);
|
|
9556
|
+
listenerApi.dispatch(drawActions.setDrawValues({
|
|
9557
|
+
drawingInstanceId: drawingDialogType,
|
|
9558
|
+
id: newID,
|
|
9559
|
+
objectName: formValues.objectName
|
|
9560
|
+
}));
|
|
9561
|
+
} else {
|
|
9562
|
+
yield warningsApi.updateDrawing(id, formValues);
|
|
8818
9563
|
}
|
|
8819
|
-
|
|
8820
|
-
|
|
8821
|
-
|
|
8822
|
-
|
|
8823
|
-
|
|
8824
|
-
|
|
8825
|
-
|
|
8826
|
-
|
|
8827
|
-
|
|
8828
|
-
|
|
9564
|
+
listenerApi.dispatch(uiActions.setErrorDialog({
|
|
9565
|
+
type: drawingDialogType,
|
|
9566
|
+
error: ''
|
|
9567
|
+
}));
|
|
9568
|
+
listenerApi.dispatch(snackbarActions.openSnackbar({
|
|
9569
|
+
message: getSnackbarMessage(formValues.objectName, id)
|
|
9570
|
+
}));
|
|
9571
|
+
listenerApi.dispatch(uiActions.toggleIsLoadingDialog({
|
|
9572
|
+
isLoading: false,
|
|
9573
|
+
type: drawingDialogType
|
|
9574
|
+
}));
|
|
9575
|
+
} catch (error) {
|
|
9576
|
+
// Don't do anything if the cancelActiveListeners was invoked (which throws a TaskAbortError)
|
|
9577
|
+
if (error.code !== 'listener-cancelled') {
|
|
9578
|
+
listenerApi.dispatch(uiActions.toggleIsLoadingDialog({
|
|
9579
|
+
isLoading: false,
|
|
9580
|
+
type: drawingDialogType
|
|
9581
|
+
}));
|
|
9582
|
+
const errorMessage = isAxiosError$1(error) ? getAxiosErrorMessage(error) : error.message;
|
|
9583
|
+
listenerApi.dispatch(uiActions.setErrorDialog({
|
|
9584
|
+
type: drawingDialogType,
|
|
9585
|
+
error: errorMessage
|
|
9586
|
+
}));
|
|
9587
|
+
}
|
|
9588
|
+
}
|
|
9589
|
+
})
|
|
9590
|
+
});
|
|
8829
9591
|
|
|
8830
9592
|
/* *
|
|
8831
9593
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -8850,7 +9612,7 @@ const drawingModuleConfig = {
|
|
|
8850
9612
|
publicWarningForm: reducer,
|
|
8851
9613
|
publicWarnings: reducer$1
|
|
8852
9614
|
},
|
|
8853
|
-
|
|
9615
|
+
middlewares: [drawingsListener.middleware, publicWarningsListener.middleware, publicWarningFormListener.middleware]
|
|
8854
9616
|
};
|
|
8855
9617
|
|
|
8856
|
-
export {
|
|
9618
|
+
export { DrawingToolConnect, Wrapper as DrawingToolForm, DrawingToolFormConnect, DrawingToolMapButtonConnect, ObjectManagerConnect, ObjectManagerMapButtonConnect, PublicWarningApiWrapper, PublicWarningsFormDialog, PublicWarningsFormDialogConnect, WarningsModuleProvider, componentsLookUp, drawingModuleConfig, isAlreadyEdited, useObjectDrawDialogAction, warningFormConfirmationOptions, warningsTranslations };
|