@opengeoweb/taf 2.2.1 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/index.d.ts +2 -3
- package/index.esm.js +2924 -1459
- package/index.umd.js +3192 -1627
- package/lib/TafDemo.stories.d.ts +2 -2
- package/lib/components/IssuesPane/IssuesButton.d.ts +5 -2
- package/lib/components/IssuesPane/IssuesPane.d.ts +8 -5
- package/lib/components/IssuesPane/IssuesPane.stories.d.ts +12 -3
- package/lib/components/IssuesPane/IssuesPaneWrapper.d.ts +4 -0
- package/lib/components/{ContentDialog/ContentDialog.spec.d.ts → IssuesPane/IssuesPaneWrapper.spec.d.ts} +0 -0
- package/lib/components/IssuesPane/types.d.ts +11 -0
- package/lib/components/IssuesPane/utils.d.ts +10 -0
- package/lib/components/{TafForm/TafFormRow → IssuesPane}/utils.spec.d.ts +0 -0
- package/lib/components/Spinner/Spinner.d.ts +2 -1
- package/lib/components/StatusIcon/StatusIcon.d.ts +8 -0
- package/lib/components/{TafForm/TafFormDialog/TafFormDialog.spec.d.ts → StatusIcon/StatusIcon.spec.d.ts} +0 -0
- package/lib/components/TabPanel/TabPanel.d.ts +8 -0
- package/lib/components/{TafForm/TafFormRow/change.spec.d.ts → TabPanel/TabPanel.spec.d.ts} +0 -0
- package/lib/components/TabPanel/index.d.ts +1 -0
- package/lib/components/TafForm/TafForm.d.ts +8 -23
- package/lib/components/TafForm/{TafFormRow/clouds.spec.d.ts → TafForm.spec.d.ts} +0 -0
- package/lib/components/TafForm/{TafFormWrapper.stories.d.ts → TafForm.stories.d.ts} +20 -0
- package/lib/components/TafForm/TafFormButtons/TafFormButtons.d.ts +5 -9
- package/lib/components/TafForm/TafFormButtons/TafFormOptionsButton.d.ts +11 -0
- package/lib/components/TafForm/{TafFormRow/probability.spec.d.ts → TafFormButtons/TafFormOptionsButton.spec.d.ts} +0 -0
- package/lib/components/TafForm/TafFormRow/types.d.ts +3 -2
- package/lib/components/TafForm/TafFormRow/{change.d.ts → validations/change.d.ts} +0 -0
- package/lib/components/TafForm/TafFormRow/{validField.spec.d.ts → validations/change.spec.d.ts} +0 -0
- package/lib/components/TafForm/TafFormRow/{clouds.d.ts → validations/clouds.d.ts} +1 -1
- package/lib/components/TafForm/TafFormRow/{visibility.spec.d.ts → validations/clouds.spec.d.ts} +0 -0
- package/lib/components/TafForm/TafFormRow/{probability.d.ts → validations/probability.d.ts} +0 -0
- package/lib/components/TafForm/TafFormRow/{weather.spec.d.ts → validations/probability.spec.d.ts} +0 -0
- package/lib/components/TafForm/TafFormRow/{utils.d.ts → validations/utils.d.ts} +0 -0
- package/lib/components/{TafList → TafForm/TafFormRow/validations}/utils.spec.d.ts +0 -0
- package/lib/components/TafForm/TafFormRow/{validField.d.ts → validations/validField.d.ts} +1 -1
- package/lib/components/TafForm/TafFormRow/{wind.spec.d.ts → validations/validField.spec.d.ts} +0 -0
- package/lib/components/TafForm/TafFormRow/{visibility.d.ts → validations/visibility.d.ts} +1 -1
- package/lib/components/TafForm/{TafFormWrapper.spec.d.ts → TafFormRow/validations/visibility.spec.d.ts} +0 -0
- package/lib/components/TafForm/TafFormRow/{weather.d.ts → validations/weather.d.ts} +1 -1
- package/lib/components/{TafList/TafList.spec.d.ts → TafForm/TafFormRow/validations/weather.spec.d.ts} +0 -0
- package/lib/components/TafForm/TafFormRow/{wind.d.ts → validations/wind.d.ts} +1 -1
- package/lib/components/{TafList/TafListAccordion.spec.d.ts → TafForm/TafFormRow/validations/wind.spec.d.ts} +0 -0
- package/lib/components/TafForm/index.d.ts +1 -2
- package/lib/components/TafForm/utils.d.ts +25 -2
- package/lib/components/TafHeader/TafHeader.d.ts +6 -0
- package/lib/components/{TafList/TafListButtons.spec.d.ts → TafHeader/TafHeader.spec.d.ts} +0 -0
- package/lib/components/TafLayout/LocationTabs/LocationTabs.d.ts +10 -0
- package/lib/components/{TafList/TafListRow.spec.d.ts → TafLayout/LocationTabs/LocationTabs.spec.d.ts} +0 -0
- package/lib/components/TafLayout/LocationTabs/LocationTabs.stories.d.ts +13 -0
- package/lib/components/TafLayout/LocationTabs/index.d.ts +1 -0
- package/lib/components/TafLayout/TacOverview/TacContainer.d.ts +8 -0
- package/lib/components/{TafList/TafListSection.spec.d.ts → TafLayout/TacOverview/TacContainer.spec.d.ts} +0 -0
- package/lib/components/TafLayout/TacOverview/TacOverview.d.ts +11 -0
- package/lib/components/TafLayout/TacOverview/TacOverview.spec.d.ts +1 -0
- package/lib/components/TafLayout/TacOverview/TacOverview.stories.d.ts +15 -0
- package/lib/components/TafLayout/TacOverview/TacOverviewMobile.d.ts +11 -0
- package/lib/components/TafLayout/TacOverview/TacOverviewMobile.spec.d.ts +1 -0
- package/lib/components/TafLayout/TacOverview/TacOverviewMobile.stories.d.ts +23 -0
- package/lib/components/TafLayout/TacOverview/index.d.ts +2 -0
- package/lib/components/TafLayout/TafLayout.d.ts +8 -0
- package/lib/components/TafLayout/TafLayout.spec.d.ts +1 -0
- package/lib/components/TafLayout/TafLayout.stories.d.ts +15 -0
- package/lib/components/TafLayout/TafPanel/TafPanel.d.ts +14 -0
- package/lib/components/TafLayout/TafPanel/TafPanel.spec.d.ts +1 -0
- package/lib/components/TafLayout/TafPanel/index.d.ts +1 -0
- package/lib/components/TafLayout/TopTabs/TopTabs.d.ts +9 -0
- package/lib/components/TafLayout/TopTabs/TopTabs.spec.d.ts +1 -0
- package/lib/components/TafLayout/TopTabs/TopTabs.stories.d.ts +13 -0
- package/lib/components/TafLayout/TopTabs/index.d.ts +1 -0
- package/lib/components/TafLayout/utils.d.ts +18 -0
- package/lib/components/TafLayout/utils.spec.d.ts +1 -0
- package/lib/components/TafModule/TafModule.d.ts +3 -0
- package/lib/components/TafModule/TafModule.spec.d.ts +1 -0
- package/lib/components/TafModule/TafModule.stories.d.ts +9 -0
- package/lib/components/TafModule/index.d.ts +1 -0
- package/lib/components/TafWrapper/TafWrapper.d.ts +6 -13
- package/lib/types.d.ts +17 -1
- package/lib/utils/__mocks__/api.d.ts +1 -0
- package/lib/utils/fakeApi.d.ts +1 -1
- package/lib/utils/mockdata/fakeTafList.d.ts +3 -0
- package/lib/utils/testUtils.d.ts +4 -5
- package/package.json +7 -6
- package/lib/components/ContentDialog/ContentDialog.d.ts +0 -14
- package/lib/components/ContentDialog/ContentDialog.stories.d.ts +0 -7
- package/lib/components/ContentDialog/index.d.ts +0 -1
- package/lib/components/IssuesPane/IssuesPane.styles.d.ts +0 -1
- package/lib/components/TafForm/TafForm.styles.d.ts +0 -1
- package/lib/components/TafForm/TafFormDialog/TafFormDialog.d.ts +0 -12
- package/lib/components/TafForm/TafFormDialog/TafFormDialog.stories.d.ts +0 -9
- package/lib/components/TafForm/TafFormWrapper.d.ts +0 -14
- package/lib/components/TafList/TafList.d.ts +0 -11
- package/lib/components/TafList/TafList.stories.d.ts +0 -8
- package/lib/components/TafList/TafListAccordion.d.ts +0 -11
- package/lib/components/TafList/TafListButtons.d.ts +0 -9
- package/lib/components/TafList/TafListRow.d.ts +0 -12
- package/lib/components/TafList/TafListSection.d.ts +0 -12
- package/lib/components/TafList/TafListSection.stories.d.ts +0 -18
- package/lib/components/TafList/index.d.ts +0 -3
- package/lib/components/TafList/utils.d.ts +0 -4
- package/lib/utils/utils.d.ts +0 -3
package/index.esm.js
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import makeStyles from '@mui/styles/makeStyles';
|
|
5
|
-
import moment from 'moment';
|
|
6
|
-
import { useIsMounted, useDraftFormHelpers, ToolContainerDraggable, useConfirmationDialog, usePreventBrowserClose, StatusTag, AlertBanner, ConfirmationServiceProvider, usePoller, isAxiosError, getAxiosErrorMessage } from '@opengeoweb/shared';
|
|
7
|
-
import { Add, Delete, DragIndicator, Close, InfoOutlined, Create, CheckCircle, Schedule, OpenInNew, ExpandMore } from '@mui/icons-material';
|
|
8
|
-
import { useApiContext, useApi, createApiInstance } from '@opengeoweb/api';
|
|
9
|
-
import { getDeepProperty, ReactHookFormHiddenInput, ReactHookFormProvider } from '@opengeoweb/form-fields';
|
|
3
|
+
import { TextField, SvgIcon, Grid, Box, Button, IconButton, Tooltip, Chip, Typography, createSvgIcon, Card, Tabs, Tab, Dialog, MenuList, MenuItem, Backdrop, CircularProgress } from '@mui/material';
|
|
10
4
|
import { useFormContext, Controller, useFieldArray } from 'react-hook-form';
|
|
11
5
|
import { ReactSortable, Sortable } from 'react-sortablejs';
|
|
6
|
+
import { getDeepProperty, ReactHookFormHiddenInput, ReactHookFormProvider } from '@opengeoweb/form-fields';
|
|
7
|
+
import { useApiContext, useApi, createApiInstance } from '@opengeoweb/api';
|
|
8
|
+
import { useIsMounted, ToggleMenu, useDraftFormHelpers, ToolContainerDraggable, useConfirmationDialog, usePreventBrowserClose, ToolButton, ToolHeader, AlertBanner, getAxiosErrorMessage, ConfirmationServiceProvider, usePoller } from '@opengeoweb/shared';
|
|
9
|
+
import moment from 'moment';
|
|
10
|
+
import { isEqual } from 'lodash';
|
|
11
|
+
import makeStyles from '@mui/styles/makeStyles';
|
|
12
|
+
import { DragIndicator, Schedule, CheckCircle } from '@mui/icons-material';
|
|
13
|
+
import ReactDOM from 'react-dom';
|
|
14
|
+
import LinearProgress from '@mui/material/LinearProgress';
|
|
15
|
+
import DoDisturbIcon from '@mui/icons-material/DoDisturb';
|
|
16
|
+
import Box$1 from '@mui/material/Box';
|
|
12
17
|
|
|
13
18
|
function _typeof(obj) {
|
|
14
19
|
"@babel/helpers - typeof";
|
|
@@ -117,119 +122,6 @@ function _nonIterableRest() {
|
|
|
117
122
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
118
123
|
}
|
|
119
124
|
|
|
120
|
-
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
121
|
-
var it;
|
|
122
|
-
|
|
123
|
-
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
|
124
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
125
|
-
if (it) o = it;
|
|
126
|
-
var i = 0;
|
|
127
|
-
|
|
128
|
-
var F = function () {};
|
|
129
|
-
|
|
130
|
-
return {
|
|
131
|
-
s: F,
|
|
132
|
-
n: function () {
|
|
133
|
-
if (i >= o.length) return {
|
|
134
|
-
done: true
|
|
135
|
-
};
|
|
136
|
-
return {
|
|
137
|
-
done: false,
|
|
138
|
-
value: o[i++]
|
|
139
|
-
};
|
|
140
|
-
},
|
|
141
|
-
e: function (e) {
|
|
142
|
-
throw e;
|
|
143
|
-
},
|
|
144
|
-
f: F
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
var normalCompletion = true,
|
|
152
|
-
didErr = false,
|
|
153
|
-
err;
|
|
154
|
-
return {
|
|
155
|
-
s: function () {
|
|
156
|
-
it = o[Symbol.iterator]();
|
|
157
|
-
},
|
|
158
|
-
n: function () {
|
|
159
|
-
var step = it.next();
|
|
160
|
-
normalCompletion = step.done;
|
|
161
|
-
return step;
|
|
162
|
-
},
|
|
163
|
-
e: function (e) {
|
|
164
|
-
didErr = true;
|
|
165
|
-
err = e;
|
|
166
|
-
},
|
|
167
|
-
f: function () {
|
|
168
|
-
try {
|
|
169
|
-
if (!normalCompletion && it.return != null) it.return();
|
|
170
|
-
} finally {
|
|
171
|
-
if (didErr) throw err;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/* *
|
|
178
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
179
|
-
* you may not use this file except in compliance with the License.
|
|
180
|
-
* You may obtain a copy of the License at
|
|
181
|
-
*
|
|
182
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
183
|
-
*
|
|
184
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
185
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
186
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
187
|
-
* See the License for the specific language governing permissions and
|
|
188
|
-
* limitations under the License.
|
|
189
|
-
*
|
|
190
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
191
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
192
|
-
* */
|
|
193
|
-
var useTafSettings = function useTafSettings( // eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/explicit-module-boundary-types
|
|
194
|
-
tafConfig) {
|
|
195
|
-
var locations = tafConfig.locations;
|
|
196
|
-
return {
|
|
197
|
-
locations: locations
|
|
198
|
-
};
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
var location_indicator_mwo = "EHDB";
|
|
202
|
-
var locations = {
|
|
203
|
-
EHAM: {
|
|
204
|
-
validity_duration: 30,
|
|
205
|
-
activity_period: 6
|
|
206
|
-
},
|
|
207
|
-
EHRD: {
|
|
208
|
-
validity_duration: 30,
|
|
209
|
-
activity_period: 6
|
|
210
|
-
},
|
|
211
|
-
EHGG: {
|
|
212
|
-
validity_duration: 30,
|
|
213
|
-
activity_period: 6
|
|
214
|
-
},
|
|
215
|
-
EHBK: {
|
|
216
|
-
validity_duration: 30,
|
|
217
|
-
activity_period: 6
|
|
218
|
-
},
|
|
219
|
-
EHLE: {
|
|
220
|
-
validity_duration: 30,
|
|
221
|
-
activity_period: 6
|
|
222
|
-
},
|
|
223
|
-
TNCB: {
|
|
224
|
-
validity_duration: 30,
|
|
225
|
-
activity_period: 6
|
|
226
|
-
}
|
|
227
|
-
};
|
|
228
|
-
var tafConfig = {
|
|
229
|
-
location_indicator_mwo: location_indicator_mwo,
|
|
230
|
-
locations: locations
|
|
231
|
-
};
|
|
232
|
-
|
|
233
125
|
/*! *****************************************************************************
|
|
234
126
|
Copyright (c) Microsoft Corporation.
|
|
235
127
|
|
|
@@ -2324,8 +2216,9 @@ var convertTafValuesToObject = function convertTafValuesToObject(formData) {
|
|
|
2324
2216
|
.filter(function (value) {
|
|
2325
2217
|
return Object.keys(value).length;
|
|
2326
2218
|
});
|
|
2219
|
+
var parsedBaseForecast = productToPost.baseForecast && parseFormValues(productToPost.baseForecast, tafStart, tafEnd);
|
|
2327
2220
|
var parsedFormValues = Object.assign(Object.assign({}, productToPost), {
|
|
2328
|
-
baseForecast:
|
|
2221
|
+
baseForecast: parsedBaseForecast,
|
|
2329
2222
|
changeGroups: parsedChangeGroups
|
|
2330
2223
|
});
|
|
2331
2224
|
return Object.keys(parsedFormValues).reduce(function (list, key) {
|
|
@@ -2500,11 +2393,26 @@ var getConfirmationDialogTitle = function getConfirmationDialogTitle(action) {
|
|
|
2500
2393
|
if (action === 'PUBLISH') return 'Publish';
|
|
2501
2394
|
if (action === 'AMEND') return 'This TAF is an amendment';
|
|
2502
2395
|
if (action === 'CORRECT') return 'This TAF is a correction';
|
|
2396
|
+
if (action === 'CANCEL') return 'Cancel TAF';
|
|
2503
2397
|
return 'Cancel TAF';
|
|
2504
|
-
};
|
|
2505
|
-
|
|
2506
|
-
|
|
2398
|
+
}; // Check if the amended/corrected TAF has been changed. Only compare the fields users are able to fill in
|
|
2399
|
+
// (i.e. exclude baseforecast valid time as that gets updated when doing an amendment automatically outside of the users influence)
|
|
2400
|
+
|
|
2401
|
+
var isTafAmendedCorrectedChanged = function isTafAmendedCorrectedChanged(isFormDirty, originalTaf, currentTaf) {
|
|
2402
|
+
var originalBaseF = originalTaf.baseForecast,
|
|
2403
|
+
originalChG = originalTaf.changeGroups;
|
|
2404
|
+
var currentBaseF = currentTaf.baseForecast,
|
|
2405
|
+
currentChG = currentTaf.changeGroups;
|
|
2406
|
+
|
|
2407
|
+
originalBaseF.valid;
|
|
2408
|
+
var originalNoValid = __rest(originalBaseF, ["valid"]);
|
|
2409
|
+
|
|
2410
|
+
currentBaseF.valid;
|
|
2411
|
+
var currentNoValid = __rest(currentBaseF, ["valid"]);
|
|
2507
2412
|
|
|
2413
|
+
return isFormDirty && (!isEqual(originalNoValid, currentNoValid) || !isEqual(originalChG, currentChG));
|
|
2414
|
+
};
|
|
2415
|
+
var getConfirmationDialogContent = function getConfirmationDialogContent(action, isFormDirty) {
|
|
2508
2416
|
switch (action) {
|
|
2509
2417
|
case 'DISCARD':
|
|
2510
2418
|
return 'Are you sure you would like to discard this TAF? Any changes made will be lost';
|
|
@@ -2514,7 +2422,7 @@ var getConfirmationDialogContent = function getConfirmationDialogContent(action)
|
|
|
2514
2422
|
|
|
2515
2423
|
case 'AMEND':
|
|
2516
2424
|
case 'CORRECT':
|
|
2517
|
-
return isFormDirty ? 'Do you want to publish it?' : 'Are you sure you want to publish the TAF? You did not make any changes!';
|
|
2425
|
+
return isFormDirty() ? 'Do you want to publish it?' : 'Are you sure you want to publish the TAF? You did not make any changes!';
|
|
2518
2426
|
|
|
2519
2427
|
default:
|
|
2520
2428
|
return 'Are you sure you want to cancel this TAF?';
|
|
@@ -2527,89 +2435,147 @@ var getConfirmationDialogButtonLabel = function getConfirmationDialogButtonLabel
|
|
|
2527
2435
|
return 'Discard';
|
|
2528
2436
|
}
|
|
2529
2437
|
|
|
2438
|
+
case 'CANCEL':
|
|
2439
|
+
return 'Cancel';
|
|
2440
|
+
|
|
2530
2441
|
default:
|
|
2531
2442
|
{
|
|
2532
2443
|
return 'Publish';
|
|
2533
2444
|
}
|
|
2534
2445
|
}
|
|
2535
2446
|
};
|
|
2447
|
+
var emptyChangegroup = {
|
|
2448
|
+
valid: '',
|
|
2449
|
+
wind: '',
|
|
2450
|
+
visibility: '',
|
|
2451
|
+
weather: {
|
|
2452
|
+
weather1: null,
|
|
2453
|
+
weather2: null,
|
|
2454
|
+
weather3: null
|
|
2455
|
+
},
|
|
2456
|
+
cloud: {
|
|
2457
|
+
cloud1: null,
|
|
2458
|
+
cloud2: null,
|
|
2459
|
+
cloud3: null,
|
|
2460
|
+
cloud4: null
|
|
2461
|
+
},
|
|
2462
|
+
change: null,
|
|
2463
|
+
probability: null
|
|
2464
|
+
};
|
|
2465
|
+
var getTafStatusLabel = function getTafStatusLabel(status) {
|
|
2466
|
+
switch (status) {
|
|
2467
|
+
case 'DRAFT_AMENDED':
|
|
2468
|
+
return 'draft amended';
|
|
2469
|
+
|
|
2470
|
+
case 'DRAFT_CORRECTED':
|
|
2471
|
+
return 'draft corrected';
|
|
2472
|
+
|
|
2473
|
+
default:
|
|
2474
|
+
return status.toLocaleLowerCase();
|
|
2475
|
+
}
|
|
2476
|
+
};
|
|
2477
|
+
var getMessageType = function getMessageType(taf, tafAction) {
|
|
2478
|
+
if (tafAction === 'CORRECT') {
|
|
2479
|
+
return 'COR';
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
if (tafAction === 'AMEND') {
|
|
2483
|
+
return 'AMD';
|
|
2484
|
+
}
|
|
2485
|
+
|
|
2486
|
+
return taf.messageType;
|
|
2487
|
+
}; // For corrections and amendment we need to add the previousValidStart and End for the TAC converter
|
|
2488
|
+
|
|
2489
|
+
var getAmendedCorrectedTafTimes = function getAmendedCorrectedTafTimes(taf, tafAction) {
|
|
2490
|
+
var previousValidDateStart = taf.previousValidDateStart && tafAction !== 'AMEND' ? taf.previousValidDateStart : taf.validDateStart;
|
|
2491
|
+
var previousValidDateEnd = taf.previousValidDateEnd && tafAction !== 'AMEND' ? taf.previousValidDateEnd : taf.validDateEnd; // For amendment change valid start time to current time
|
|
2492
|
+
// only do this if we're already within the validity period
|
|
2493
|
+
|
|
2494
|
+
if ((tafAction === 'AMEND' || tafAction === 'DRAFT_AMEND') && moment.utc() >= moment.utc(taf.validDateStart)) {
|
|
2495
|
+
var now = moment.utc().format('YYYY-MM-DDTHH:mm:ss[Z]');
|
|
2496
|
+
var validObj = {
|
|
2497
|
+
start: now,
|
|
2498
|
+
end: taf.baseForecast.valid.end
|
|
2499
|
+
};
|
|
2500
|
+
return Object.assign(Object.assign({}, taf), {
|
|
2501
|
+
previousValidDateStart: previousValidDateStart,
|
|
2502
|
+
previousValidDateEnd: previousValidDateEnd,
|
|
2503
|
+
validDateStart: now,
|
|
2504
|
+
baseForecast: Object.assign(Object.assign({}, taf.baseForecast), {
|
|
2505
|
+
valid: validObj
|
|
2506
|
+
})
|
|
2507
|
+
});
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2510
|
+
return Object.assign(Object.assign({}, taf), {
|
|
2511
|
+
previousValidDateStart: previousValidDateStart,
|
|
2512
|
+
previousValidDateEnd: previousValidDateEnd
|
|
2513
|
+
});
|
|
2514
|
+
};
|
|
2515
|
+
var prepareTafValues = function prepareTafValues(_taf, tafAction) {
|
|
2516
|
+
var addEmptyChangeGroup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
2517
|
+
// If action is AMEND/CORRECT/DRAFT_AMEND/DRAFT_CORRECTION - add previous valid start and end
|
|
2518
|
+
// If action is AMEND/DRAFT_AMEND - update validity start time to current time
|
|
2519
|
+
var taf = tafAction === 'AMEND' || tafAction === 'DRAFT_AMEND' || tafAction === 'CORRECT' || tafAction === 'DRAFT_CORRECT' ? getAmendedCorrectedTafTimes(_taf, tafAction) : _taf;
|
|
2520
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, taf), {
|
|
2521
|
+
messageType: getMessageType(taf, tafAction),
|
|
2522
|
+
baseForecast: formatFormValues(taf.baseForecast)
|
|
2523
|
+
}), taf.changeGroups && {
|
|
2524
|
+
changeGroups: taf.changeGroups.map(formatFormValues)
|
|
2525
|
+
}), addEmptyChangeGroup && {
|
|
2526
|
+
changeGroups: [emptyChangegroup]
|
|
2527
|
+
});
|
|
2528
|
+
};
|
|
2536
2529
|
|
|
2537
|
-
var
|
|
2530
|
+
var textFieldStyle = function textFieldStyle(theme) {
|
|
2538
2531
|
return {
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2532
|
+
// input
|
|
2533
|
+
marginRight: '2px',
|
|
2534
|
+
marginBottom: '4px',
|
|
2535
|
+
width: 56,
|
|
2536
|
+
height: 46,
|
|
2537
|
+
input: {
|
|
2538
|
+
textAlign: 'center',
|
|
2539
|
+
fontSize: 10,
|
|
2540
|
+
fontWeight: 500,
|
|
2541
|
+
paddingLeft: 0,
|
|
2542
|
+
paddingRight: 0,
|
|
2543
|
+
'&.Mui-disabled': {
|
|
2544
|
+
color: 'geowebColors.typographyAndIcons.text',
|
|
2545
|
+
WebkitTextFillColor: theme.palette.geowebColors.typographyAndIcons.text
|
|
2545
2546
|
},
|
|
2546
|
-
|
|
2547
|
-
|
|
2547
|
+
// TODO: https://gitlab.com/opengeoweb/opengeoweb/-/issues/1995 disables the default autofill styling, should be a better fix
|
|
2548
|
+
'&:-webkit-autofill': {
|
|
2549
|
+
WebkitTransitionDelay: '86400s' // 1 day delay
|
|
2550
|
+
|
|
2548
2551
|
}
|
|
2549
2552
|
},
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
WebkitTextFillColor: '#051039',
|
|
2553
|
+
label: {
|
|
2554
|
+
transformOrigin: 'center top',
|
|
2555
|
+
right: 0,
|
|
2556
|
+
textAlign: 'center',
|
|
2557
|
+
fontSize: '10px',
|
|
2556
2558
|
'&.Mui-disabled': {
|
|
2557
|
-
|
|
2558
|
-
}
|
|
2559
|
-
},
|
|
2560
|
-
textFieldLabel: {
|
|
2561
|
-
fontSize: '14px'
|
|
2562
|
-
},
|
|
2563
|
-
textFieldLabelShrink: {
|
|
2564
|
-
transform: 'translate(2px, 10px) scale(0.75) !important'
|
|
2565
|
-
},
|
|
2566
|
-
formRow: {
|
|
2567
|
-
marginTop: 8,
|
|
2568
|
-
backgroundColor: theme.palette.common.white,
|
|
2569
|
-
position: 'relative',
|
|
2570
|
-
'&.sortable-chosen': {
|
|
2571
|
-
boxShadow: theme.shadows[1]
|
|
2559
|
+
color: 'geowebColors.captions.captionStatus.rgba'
|
|
2572
2560
|
},
|
|
2573
|
-
'
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
},
|
|
2577
|
-
tacTitle: {
|
|
2578
|
-
fontSize: '20px',
|
|
2579
|
-
fontWeight: 500
|
|
2580
|
-
},
|
|
2581
|
-
tacText: {
|
|
2582
|
-
fontSize: '14px',
|
|
2583
|
-
color: '#000000'
|
|
2584
|
-
},
|
|
2585
|
-
tacLine: {
|
|
2586
|
-
margin: '0',
|
|
2587
|
-
padding: '.1em .1em .1em 0.8em',
|
|
2588
|
-
textIndent: '-0.7em',
|
|
2589
|
-
borderRadius: '3px'
|
|
2590
|
-
},
|
|
2591
|
-
addButton: {
|
|
2592
|
-
marginRight: '48px'
|
|
2593
|
-
},
|
|
2594
|
-
lifecycleButtons: {
|
|
2595
|
-
marginTop: '40px',
|
|
2596
|
-
marginBottom: '16px'
|
|
2597
|
-
},
|
|
2598
|
-
actionButton: {
|
|
2599
|
-
marginRight: '16px'
|
|
2600
|
-
},
|
|
2601
|
-
lastButton: {
|
|
2602
|
-
marginRight: '90px'
|
|
2561
|
+
whiteSpace: 'nowrap',
|
|
2562
|
+
maxWidth: '100%',
|
|
2563
|
+
transform: 'translate(0px, 16px) scale(1)'
|
|
2603
2564
|
},
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2565
|
+
// shrink
|
|
2566
|
+
' .MuiInputLabel-shrink': {
|
|
2567
|
+
transform: 'translate(2px, 10px) scale(0.75) !important',
|
|
2568
|
+
letterSpacing: '0.33px',
|
|
2569
|
+
textAlign: 'left'
|
|
2607
2570
|
},
|
|
2608
|
-
|
|
2609
|
-
|
|
2571
|
+
// root
|
|
2572
|
+
'&': {
|
|
2573
|
+
'.Mui-disabled:before': {
|
|
2574
|
+
borderColor: 'transparent'
|
|
2575
|
+
}
|
|
2610
2576
|
}
|
|
2611
2577
|
};
|
|
2612
|
-
}
|
|
2578
|
+
};
|
|
2613
2579
|
|
|
2614
2580
|
var getTafErrors = function getTafErrors(name, errors) {
|
|
2615
2581
|
var nameAsArray = name.split('.');
|
|
@@ -2632,25 +2598,13 @@ var getDisplayValue = function getDisplayValue(value, disabled) {
|
|
|
2632
2598
|
return disabled && !value ? '-' : value;
|
|
2633
2599
|
};
|
|
2634
2600
|
var BaseTextField = /*#__PURE__*/React__default.memo(function (props) {
|
|
2635
|
-
var classes = useStyles$9();
|
|
2636
2601
|
return /*#__PURE__*/React__default.createElement(TextField, Object.assign({
|
|
2637
2602
|
type: "text",
|
|
2638
2603
|
variant: "filled",
|
|
2639
|
-
|
|
2640
|
-
classes: {
|
|
2641
|
-
input: classes.textFieldInput,
|
|
2642
|
-
root: classes.textFieldRoot
|
|
2643
|
-
}
|
|
2644
|
-
},
|
|
2645
|
-
InputLabelProps: {
|
|
2646
|
-
classes: {
|
|
2647
|
-
root: classes.textFieldLabel,
|
|
2648
|
-
shrink: classes.textFieldLabelShrink
|
|
2649
|
-
}
|
|
2650
|
-
}
|
|
2604
|
+
sx: textFieldStyle
|
|
2651
2605
|
}, props));
|
|
2652
2606
|
}, function (prevProps, nextProps) {
|
|
2653
|
-
return prevProps.value === nextProps.value && prevProps.error === nextProps.error && prevProps.name === nextProps.name;
|
|
2607
|
+
return prevProps.value === nextProps.value && prevProps.error === nextProps.error && prevProps.name === nextProps.name && prevProps.disabled === nextProps.disabled;
|
|
2654
2608
|
});
|
|
2655
2609
|
|
|
2656
2610
|
var TafFormTextField = function TafFormTextField(_ref) {
|
|
@@ -2672,7 +2626,6 @@ var TafFormTextField = function TafFormTextField(_ref) {
|
|
|
2672
2626
|
autoComplete = _ref$autoComplete === void 0 ? [] : _ref$autoComplete,
|
|
2673
2627
|
_ref$autoFocus = _ref.autoFocus,
|
|
2674
2628
|
autoFocus = _ref$autoFocus === void 0 ? false : _ref$autoFocus;
|
|
2675
|
-
var classes = useStyles$9();
|
|
2676
2629
|
|
|
2677
2630
|
var _useFormContext = useFormContext(),
|
|
2678
2631
|
control = _useFormContext.control,
|
|
@@ -2729,11 +2682,7 @@ var TafFormTextField = function TafFormTextField(_ref) {
|
|
|
2729
2682
|
inputRef.current.disabled = false;
|
|
2730
2683
|
(_a = inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
2731
2684
|
}, []);
|
|
2732
|
-
return /*#__PURE__*/React__default.createElement(
|
|
2733
|
-
item: true,
|
|
2734
|
-
xs: true,
|
|
2735
|
-
className: classes.textFieldGridItem
|
|
2736
|
-
}, /*#__PURE__*/React__default.createElement(Controller, {
|
|
2685
|
+
return /*#__PURE__*/React__default.createElement(Controller, {
|
|
2737
2686
|
render: function render(_props) {
|
|
2738
2687
|
var displayValue = formatter ? formatter(_props.value) : getDisplayValue(_props.value, disabled);
|
|
2739
2688
|
return /*#__PURE__*/React__default.createElement(BaseTextField, {
|
|
@@ -2761,7 +2710,7 @@ var TafFormTextField = function TafFormTextField(_ref) {
|
|
|
2761
2710
|
defaultValue: defaultValue,
|
|
2762
2711
|
rules: rules,
|
|
2763
2712
|
onFocus: onFocusField
|
|
2764
|
-
})
|
|
2713
|
+
});
|
|
2765
2714
|
};
|
|
2766
2715
|
|
|
2767
2716
|
/* *
|
|
@@ -2825,6 +2774,71 @@ var validateProbabilityField = function validateProbabilityField(value) {
|
|
|
2825
2774
|
return isValid ? true : invalidProbabilityMessage;
|
|
2826
2775
|
};
|
|
2827
2776
|
|
|
2777
|
+
/* *
|
|
2778
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2779
|
+
* you may not use this file except in compliance with the License.
|
|
2780
|
+
* You may obtain a copy of the License at
|
|
2781
|
+
*
|
|
2782
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2783
|
+
*
|
|
2784
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2785
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2786
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2787
|
+
* See the License for the specific language governing permissions and
|
|
2788
|
+
* limitations under the License.
|
|
2789
|
+
*
|
|
2790
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2791
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2792
|
+
* */
|
|
2793
|
+
var AddIcon = /*#__PURE__*/React.createElement(SvgIcon, null, /*#__PURE__*/React.createElement("path", {
|
|
2794
|
+
d: "M10.647 10.647h6.82a1.276 1.276 0 1 0 0-2.552h-6.82v-6.82a1.276 1.276 0 1 0-2.552 0v6.82h-6.82a1.276 1.276 0 1 0 0 2.552h6.82v6.82a1.274 1.274 0 0 0 1.276 1.275c.705 0 1.276-.571 1.276-1.276v-6.82z"
|
|
2795
|
+
}));
|
|
2796
|
+
var DeleteIcon = /*#__PURE__*/React.createElement(SvgIcon, null, /*#__PURE__*/React.createElement("path", {
|
|
2797
|
+
d: "M17.504 8.228c.588 0 1.027.48.973 1.066l-.876 9.64A1.197 1.197 0 0 1 16.434 20H8.41c-.59 0-1.115-.48-1.167-1.066l-.877-9.64a.962.962 0 0 1 .973-1.066zm-2.115 1.228a.82.82 0 0 0-.819.82v7.674a.818.818 0 0 0 1.638 0v-7.675a.819.819 0 0 0-.819-.819zm-2.968 0a.819.819 0 0 0-.819.82v7.674a.818.818 0 1 0 1.638 0v-7.675a.82.82 0 0 0-.82-.819zm-2.968 0a.819.819 0 0 0-.818.82v7.674a.818.818 0 1 0 1.637 0v-7.675a.82.82 0 0 0-.82-.819zM13.432 4c.21 0 .404.168.436.376l.107.758 3.256-.01a1.606 1.606 0 0 1 1.61 1.6l.001.535-12.841.038L6 6.76a1.605 1.605 0 0 1 1.6-1.61l3.262-.008.103-.758a.454.454 0 0 1 .434-.38z"
|
|
2798
|
+
}));
|
|
2799
|
+
var CrossIcon = /*#__PURE__*/React.createElement(SvgIcon, null, /*#__PURE__*/React.createElement("path", {
|
|
2800
|
+
d: "m13.805 12 4.821-4.822a1.276 1.276 0 1 0-1.804-1.804L12 10.195 7.178 5.374a1.276 1.276 0 1 0-1.804 1.804L10.196 12l-4.822 4.822a1.276 1.276 0 1 0 1.804 1.805L12 13.805l4.822 4.822a1.274 1.274 0 0 0 1.804 0c.499-.5.499-1.306 0-1.805L13.805 12z"
|
|
2801
|
+
}));
|
|
2802
|
+
|
|
2803
|
+
var TafFormOptionsButton = function TafFormOptionsButton(_ref) {
|
|
2804
|
+
var isChangeGroup = _ref.isChangeGroup,
|
|
2805
|
+
addChangeGroupBelow = _ref.addChangeGroupBelow,
|
|
2806
|
+
addChangeGroupAbove = _ref.addChangeGroupAbove,
|
|
2807
|
+
removeChangeGroup = _ref.removeChangeGroup,
|
|
2808
|
+
clearRow = _ref.clearRow,
|
|
2809
|
+
index = _ref.index;
|
|
2810
|
+
var insertAbove = {
|
|
2811
|
+
text: 'Insert 1 row above',
|
|
2812
|
+
icon: AddIcon,
|
|
2813
|
+
action: addChangeGroupAbove
|
|
2814
|
+
};
|
|
2815
|
+
var insertBelow = {
|
|
2816
|
+
text: 'Insert 1 row below',
|
|
2817
|
+
icon: AddIcon,
|
|
2818
|
+
action: addChangeGroupBelow
|
|
2819
|
+
};
|
|
2820
|
+
var deleteRow = {
|
|
2821
|
+
text: 'Delete row',
|
|
2822
|
+
icon: DeleteIcon,
|
|
2823
|
+
action: removeChangeGroup
|
|
2824
|
+
};
|
|
2825
|
+
var clear = {
|
|
2826
|
+
text: 'Clear row',
|
|
2827
|
+
icon: CrossIcon,
|
|
2828
|
+
action: clearRow
|
|
2829
|
+
};
|
|
2830
|
+
var menuItemsBaseForecast = [insertBelow, clear];
|
|
2831
|
+
var menuItemsChangeGroup = [insertAbove, insertBelow, deleteRow, clear];
|
|
2832
|
+
return /*#__PURE__*/React.createElement(ToggleMenu, {
|
|
2833
|
+
buttonTestId: "tafFormOptions[".concat(index, "]"),
|
|
2834
|
+
buttonSx: {
|
|
2835
|
+
marginTop: '10px',
|
|
2836
|
+
marginLeft: '4px'
|
|
2837
|
+
},
|
|
2838
|
+
menuItems: isChangeGroup ? menuItemsChangeGroup : menuItemsBaseForecast
|
|
2839
|
+
});
|
|
2840
|
+
};
|
|
2841
|
+
|
|
2828
2842
|
var getDefaultValue = function getDefaultValue(fieldName, data) {
|
|
2829
2843
|
if (!data) {
|
|
2830
2844
|
return '';
|
|
@@ -2845,17 +2859,16 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
2845
2859
|
disabled = _a$disabled === void 0 ? false : _a$disabled,
|
|
2846
2860
|
_a$index = _a.index,
|
|
2847
2861
|
index = _a$index === void 0 ? -1 : _a$index,
|
|
2848
|
-
_a$lastRow = _a.lastRow,
|
|
2849
|
-
lastRow = _a$lastRow === void 0 ? false : _a$lastRow,
|
|
2850
2862
|
onRemoveChangeGroup = _a.onRemoveChangeGroup,
|
|
2851
2863
|
_a$field = _a.field,
|
|
2852
2864
|
field = _a$field === void 0 ? null : _a$field,
|
|
2853
2865
|
_a$dragHandle = _a.dragHandle,
|
|
2854
2866
|
dragHandle = _a$dragHandle === void 0 ? null : _a$dragHandle,
|
|
2855
|
-
|
|
2856
|
-
|
|
2867
|
+
onAddChangeGroupBelow = _a.onAddChangeGroupBelow,
|
|
2868
|
+
onAddChangeGroupAbove = _a.onAddChangeGroupAbove,
|
|
2869
|
+
onClearRow = _a.onClearRow,
|
|
2870
|
+
props = __rest(_a, ["isChangeGroup", "disabled", "index", "onRemoveChangeGroup", "field", "dragHandle", "onAddChangeGroupBelow", "onAddChangeGroupAbove", "onClearRow"]);
|
|
2857
2871
|
|
|
2858
|
-
var classes = useStyles$9();
|
|
2859
2872
|
var namePrefix = !isChangeGroup ? 'baseForecast' : "changeGroups[".concat(index, "]");
|
|
2860
2873
|
var fieldNames = getFieldNames(isChangeGroup, index);
|
|
2861
2874
|
|
|
@@ -2971,14 +2984,39 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
2971
2984
|
return validFields;
|
|
2972
2985
|
};
|
|
2973
2986
|
|
|
2974
|
-
var
|
|
2975
|
-
|
|
2976
|
-
}, [
|
|
2987
|
+
var addChangeGroupBelow = React__default.useCallback(function () {
|
|
2988
|
+
onAddChangeGroupBelow(index);
|
|
2989
|
+
}, [onAddChangeGroupBelow, index]);
|
|
2990
|
+
var addChangeGroupAbove = React__default.useCallback(function () {
|
|
2991
|
+
onAddChangeGroupAbove(index);
|
|
2992
|
+
}, [onAddChangeGroupAbove, index]);
|
|
2993
|
+
var clearRow = React__default.useCallback(function () {
|
|
2994
|
+
onClearRow(index);
|
|
2995
|
+
}, [onClearRow, index]);
|
|
2977
2996
|
return /*#__PURE__*/React__default.createElement(Grid, Object.assign({
|
|
2997
|
+
sx: {
|
|
2998
|
+
marginTop: '8px',
|
|
2999
|
+
backgroundColor: 'geowebColors.cards.cardContainer',
|
|
3000
|
+
position: 'relative',
|
|
3001
|
+
'&.sortable-chosen': {
|
|
3002
|
+
boxShadow: 1
|
|
3003
|
+
},
|
|
3004
|
+
'&.sortable-ghost': {
|
|
3005
|
+
opacity: 0.5
|
|
3006
|
+
}
|
|
3007
|
+
},
|
|
3008
|
+
justifyContent: "flex-start",
|
|
2978
3009
|
"data-testid": "row-".concat(namePrefix),
|
|
2979
3010
|
container: true,
|
|
2980
|
-
ref: ref
|
|
2981
|
-
|
|
3011
|
+
ref: ref,
|
|
3012
|
+
columns: 24
|
|
3013
|
+
}, props), /*#__PURE__*/React__default.createElement(Grid, {
|
|
3014
|
+
item: true,
|
|
3015
|
+
container: true,
|
|
3016
|
+
justifyContent: "flex-end",
|
|
3017
|
+
xs: 24,
|
|
3018
|
+
sm: 23
|
|
3019
|
+
}, !isChangeGroup && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TafFormTextField, {
|
|
2982
3020
|
label: "Type",
|
|
2983
3021
|
name: fieldNames.messageType,
|
|
2984
3022
|
disabled: true
|
|
@@ -2991,13 +3029,12 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
2991
3029
|
label: "Issue time",
|
|
2992
3030
|
name: "issueDate",
|
|
2993
3031
|
disabled: true
|
|
2994
|
-
})), isChangeGroup && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
display: 'flex'
|
|
3032
|
+
})), isChangeGroup && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
|
|
3033
|
+
sx: {
|
|
3034
|
+
width: 56,
|
|
3035
|
+
marginRight: '2px'
|
|
2999
3036
|
}
|
|
3000
|
-
}, dragHandle), /*#__PURE__*/React__default.createElement(TafFormTextField, {
|
|
3037
|
+
}, !disabled && dragHandle), /*#__PURE__*/React__default.createElement(TafFormTextField, {
|
|
3001
3038
|
label: "Prob",
|
|
3002
3039
|
name: fieldNames.probability,
|
|
3003
3040
|
disabled: disabled,
|
|
@@ -3235,33 +3272,26 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
3235
3272
|
}
|
|
3236
3273
|
}
|
|
3237
3274
|
}
|
|
3238
|
-
}),
|
|
3239
|
-
className: classes.emptyButtonContainer,
|
|
3275
|
+
})), !disabled && /*#__PURE__*/React__default.createElement(Grid, {
|
|
3240
3276
|
item: true,
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
item: true
|
|
3249
|
-
}, /*#__PURE__*/React__default.createElement(IconButton, {
|
|
3250
|
-
"aria-label": "add",
|
|
3251
|
-
"data-testid": "add-changeGroup",
|
|
3252
|
-
onClick: addChangeGroup,
|
|
3253
|
-
size: "large"
|
|
3254
|
-
}, /*#__PURE__*/React__default.createElement(Add, null)), /*#__PURE__*/React__default.createElement(IconButton, Object.assign({
|
|
3255
|
-
"aria-label": "delete",
|
|
3256
|
-
"data-testid": "remove-changeGroup",
|
|
3257
|
-
onClick: function onClick() {
|
|
3258
|
-
return onRemoveChangeGroup(index);
|
|
3277
|
+
container: true,
|
|
3278
|
+
justifyContent: "flex-end",
|
|
3279
|
+
alignItems: "flex-end",
|
|
3280
|
+
xs: 24,
|
|
3281
|
+
sm: 1,
|
|
3282
|
+
sx: {
|
|
3283
|
+
marginBottom: '16px'
|
|
3259
3284
|
}
|
|
3260
|
-
},
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3285
|
+
}, /*#__PURE__*/React__default.createElement(TafFormOptionsButton, {
|
|
3286
|
+
isChangeGroup: isChangeGroup,
|
|
3287
|
+
addChangeGroupBelow: addChangeGroupBelow,
|
|
3288
|
+
addChangeGroupAbove: addChangeGroupAbove,
|
|
3289
|
+
removeChangeGroup: function removeChangeGroup() {
|
|
3290
|
+
return onRemoveChangeGroup(index);
|
|
3291
|
+
},
|
|
3292
|
+
clearRow: clearRow,
|
|
3293
|
+
index: index
|
|
3294
|
+
})));
|
|
3265
3295
|
});
|
|
3266
3296
|
|
|
3267
3297
|
/* *
|
|
@@ -3280,52 +3310,346 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
3280
3310
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3281
3311
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3282
3312
|
* */
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3313
|
+
var buttonsStyle = {
|
|
3314
|
+
button: {
|
|
3315
|
+
minWidth: {
|
|
3316
|
+
xs: '56px',
|
|
3317
|
+
sm: '64px'
|
|
3318
|
+
},
|
|
3319
|
+
width: {
|
|
3320
|
+
xs: '56px',
|
|
3321
|
+
sm: '64px'
|
|
3322
|
+
},
|
|
3323
|
+
marginLeft: {
|
|
3324
|
+
xs: 0.5,
|
|
3325
|
+
sm: 1
|
|
3326
|
+
},
|
|
3327
|
+
marginTop: 3,
|
|
3328
|
+
marginBottom: 3
|
|
3294
3329
|
}
|
|
3295
3330
|
};
|
|
3296
3331
|
|
|
3297
|
-
var
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3332
|
+
var ViewModeButtons = function ViewModeButtons(_ref) {
|
|
3333
|
+
var canBe = _ref.canBe,
|
|
3334
|
+
onTafViewModeButtonPress = _ref.onTafViewModeButtonPress;
|
|
3335
|
+
return !canBe.includes('CANCELLED') && !canBe.includes('CORRECTED') && !canBe.includes('AMENDED') ? null : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, canBe.includes('CANCELLED') && /*#__PURE__*/React__default.createElement(Button, {
|
|
3336
|
+
"data-testid": "canceltaf",
|
|
3337
|
+
variant: "tertiary",
|
|
3338
|
+
onClick: function onClick() {
|
|
3339
|
+
return onTafViewModeButtonPress('CANCEL');
|
|
3340
|
+
}
|
|
3341
|
+
}, "Cancel"), canBe.includes('CORRECTED') && /*#__PURE__*/React__default.createElement(Button, {
|
|
3342
|
+
"data-testid": "correctaf",
|
|
3343
|
+
variant: "tertiary",
|
|
3344
|
+
onClick: function onClick() {
|
|
3345
|
+
return onTafViewModeButtonPress('CORRECT');
|
|
3346
|
+
}
|
|
3347
|
+
}, "Correct"), canBe.includes('AMENDED') && /*#__PURE__*/React__default.createElement(Button, {
|
|
3348
|
+
"data-testid": "amendtaf",
|
|
3349
|
+
variant: "tertiary",
|
|
3350
|
+
onClick: function onClick() {
|
|
3351
|
+
return onTafViewModeButtonPress('AMEND');
|
|
3352
|
+
}
|
|
3353
|
+
}, "Amend"));
|
|
3354
|
+
};
|
|
3355
|
+
|
|
3356
|
+
var TafFormButtons = function TafFormButtons(_ref2) {
|
|
3357
|
+
var _ref2$isFormDisabled = _ref2.isFormDisabled,
|
|
3358
|
+
isFormDisabled = _ref2$isFormDisabled === void 0 ? false : _ref2$isFormDisabled,
|
|
3359
|
+
tafAction = _ref2.tafAction,
|
|
3360
|
+
_ref2$canBe = _ref2.canBe,
|
|
3361
|
+
canBe = _ref2$canBe === void 0 ? [] : _ref2$canBe,
|
|
3362
|
+
onTafEditModeButtonPress = _ref2.onTafEditModeButtonPress,
|
|
3363
|
+
onTafViewModeButtonPress = _ref2.onTafViewModeButtonPress;
|
|
3364
|
+
return /*#__PURE__*/React__default.createElement(Grid, {
|
|
3365
|
+
container: true,
|
|
3366
|
+
justifyContent: "flex-end",
|
|
3367
|
+
sx: buttonsStyle,
|
|
3368
|
+
columns: 24
|
|
3369
|
+
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
3370
|
+
item: true,
|
|
3371
|
+
container: true,
|
|
3372
|
+
justifyContent: "flex-end",
|
|
3373
|
+
xs: 24,
|
|
3374
|
+
sm: 23
|
|
3375
|
+
}, isFormDisabled ? /*#__PURE__*/React__default.createElement(ViewModeButtons, {
|
|
3376
|
+
canBe: canBe,
|
|
3377
|
+
onTafViewModeButtonPress: onTafViewModeButtonPress
|
|
3378
|
+
}) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Button, {
|
|
3379
|
+
"data-testid": "discardtaf",
|
|
3380
|
+
variant: "tertiary",
|
|
3381
|
+
onClick: function onClick() {
|
|
3382
|
+
// Simply discard the changes and close the dialog.
|
|
3383
|
+
onTafEditModeButtonPress('DISCARD');
|
|
3384
|
+
}
|
|
3385
|
+
}, "Discard"), /*#__PURE__*/React__default.createElement(Button, {
|
|
3386
|
+
"data-testid": "savedrafttaf",
|
|
3387
|
+
variant: "tertiary",
|
|
3388
|
+
onClick: function onClick() {
|
|
3389
|
+
/* Save the TAF as draft:
|
|
3390
|
+
if action NEW or DRAFT - new status will be DRAFT -- default
|
|
3391
|
+
if action AMEND - new status will be DRAFT_AMENDED
|
|
3392
|
+
if action CORRECT - new status will be DRAFT_CORRECTED
|
|
3393
|
+
if action DRAFT_AMEND - new status will be DRAFT_AMENDED
|
|
3394
|
+
if action DRAFT_CORRECT - new status will be DRAFT_CORRECTED
|
|
3395
|
+
*/
|
|
3396
|
+
switch (tafAction) {
|
|
3397
|
+
case 'AMEND':
|
|
3398
|
+
case 'DRAFT_AMEND':
|
|
3399
|
+
onTafEditModeButtonPress('DRAFT_AMEND');
|
|
3400
|
+
break;
|
|
3401
|
+
|
|
3402
|
+
case 'CORRECT':
|
|
3403
|
+
case 'DRAFT_CORRECT':
|
|
3404
|
+
onTafEditModeButtonPress('DRAFT_CORRECT');
|
|
3405
|
+
break;
|
|
3406
|
+
|
|
3407
|
+
default:
|
|
3408
|
+
onTafEditModeButtonPress('DRAFT');
|
|
3409
|
+
break;
|
|
3410
|
+
}
|
|
3411
|
+
}
|
|
3412
|
+
}, "Save"), /*#__PURE__*/React__default.createElement(Button, {
|
|
3413
|
+
"data-testid": "publishtaf",
|
|
3414
|
+
variant: "tertiary",
|
|
3415
|
+
onClick: function onClick() {
|
|
3416
|
+
/* Publish the TAF:
|
|
3417
|
+
if action NEW or DRAFT - new status will be PUBLISHED -- default
|
|
3418
|
+
if action AMEND - new status will be AMENDED
|
|
3419
|
+
if action CORRECT - new status will be CORRECTED
|
|
3420
|
+
if action DRAFT_AMEND - new status will be AMENDED
|
|
3421
|
+
if action DRAFT_CORRECT - new status will be CORRECTED
|
|
3422
|
+
*/
|
|
3423
|
+
switch (tafAction) {
|
|
3424
|
+
case 'AMEND':
|
|
3425
|
+
case 'DRAFT_AMEND':
|
|
3426
|
+
onTafEditModeButtonPress('AMEND');
|
|
3427
|
+
break;
|
|
3428
|
+
|
|
3429
|
+
case 'CORRECT':
|
|
3430
|
+
case 'DRAFT_CORRECT':
|
|
3431
|
+
onTafEditModeButtonPress('CORRECT');
|
|
3432
|
+
break;
|
|
3433
|
+
|
|
3434
|
+
default:
|
|
3435
|
+
onTafEditModeButtonPress('PUBLISH');
|
|
3436
|
+
break;
|
|
3437
|
+
}
|
|
3438
|
+
}
|
|
3439
|
+
}, "Publish"))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
3440
|
+
item: true,
|
|
3441
|
+
sm: 1
|
|
3442
|
+
}));
|
|
3443
|
+
};
|
|
3444
|
+
|
|
3445
|
+
/* *
|
|
3446
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3447
|
+
* you may not use this file except in compliance with the License.
|
|
3448
|
+
* You may obtain a copy of the License at
|
|
3449
|
+
*
|
|
3450
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3451
|
+
*
|
|
3452
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3453
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3454
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3455
|
+
* See the License for the specific language governing permissions and
|
|
3456
|
+
* limitations under the License.
|
|
3457
|
+
*
|
|
3458
|
+
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3459
|
+
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3460
|
+
* */
|
|
3461
|
+
var useStyles = makeStyles(function () {
|
|
3462
|
+
return {
|
|
3463
|
+
dragHandle: {
|
|
3464
|
+
backgroundColor: 'transparent',
|
|
3465
|
+
'&:hover': {
|
|
3466
|
+
backgroundColor: 'transparent'
|
|
3467
|
+
},
|
|
3468
|
+
cursor: function cursor(isSorting) {
|
|
3469
|
+
return isSorting ? 'grabbing' : 'grab';
|
|
3470
|
+
}
|
|
3313
3471
|
}
|
|
3314
3472
|
};
|
|
3473
|
+
});
|
|
3474
|
+
|
|
3475
|
+
var DragHandle = function DragHandle(_ref) {
|
|
3476
|
+
var _ref$isSorting = _ref.isSorting,
|
|
3477
|
+
isSorting = _ref$isSorting === void 0 ? false : _ref$isSorting,
|
|
3478
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
3479
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
3480
|
+
index = _ref.index;
|
|
3481
|
+
var classes = useStyles(isSorting);
|
|
3482
|
+
return /*#__PURE__*/React__default.createElement(IconButton, {
|
|
3483
|
+
className: "".concat(classes.dragHandle, " handle"),
|
|
3484
|
+
"data-testid": "dragHandle-".concat(index),
|
|
3485
|
+
disableRipple: true,
|
|
3486
|
+
disabled: isDisabled,
|
|
3487
|
+
size: "large"
|
|
3488
|
+
}, /*#__PURE__*/React__default.createElement(DragIndicator, null));
|
|
3489
|
+
};
|
|
3490
|
+
|
|
3491
|
+
/* *
|
|
3492
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3493
|
+
* you may not use this file except in compliance with the License.
|
|
3494
|
+
* You may obtain a copy of the License at
|
|
3495
|
+
*
|
|
3496
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3497
|
+
*
|
|
3498
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3499
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3500
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3501
|
+
* See the License for the specific language governing permissions and
|
|
3502
|
+
* limitations under the License.
|
|
3503
|
+
*
|
|
3504
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3505
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3506
|
+
* */
|
|
3507
|
+
var getCustomError = function getCustomError(error) {
|
|
3508
|
+
var name = error.ref.name;
|
|
3509
|
+
var isChangeGroup = name.includes('changeGroups');
|
|
3510
|
+
var matchRowNumber = name.match(/\[(.*?)\]/);
|
|
3511
|
+
var row = matchRowNumber ? parseInt(matchRowNumber[1], 10) : null;
|
|
3512
|
+
return Object.assign(Object.assign({}, error), {
|
|
3513
|
+
isChangeGroup: isChangeGroup,
|
|
3514
|
+
row: row
|
|
3515
|
+
});
|
|
3516
|
+
};
|
|
3517
|
+
var getIssuesLabel = function getIssuesLabel(sumOfErrors) {
|
|
3518
|
+
switch (sumOfErrors) {
|
|
3519
|
+
case 0:
|
|
3520
|
+
return '0 issues';
|
|
3521
|
+
|
|
3522
|
+
case 1:
|
|
3523
|
+
return '1 issue';
|
|
3524
|
+
|
|
3525
|
+
default:
|
|
3526
|
+
return "".concat(sumOfErrors, " issues");
|
|
3527
|
+
}
|
|
3528
|
+
};
|
|
3529
|
+
|
|
3530
|
+
var getErrorValues = function getErrorValues(fieldErrors) {
|
|
3531
|
+
if (!fieldErrors) return [];
|
|
3532
|
+
return Object.keys(fieldErrors).reduce(function (list, key) {
|
|
3533
|
+
var error = Object.assign({}, fieldErrors[key]);
|
|
3534
|
+
|
|
3535
|
+
if (error.ref) {
|
|
3536
|
+
return list.concat(getCustomError(error));
|
|
3537
|
+
}
|
|
3538
|
+
|
|
3539
|
+
return list.concat(getErrorValues(error));
|
|
3540
|
+
}, []);
|
|
3541
|
+
};
|
|
3542
|
+
|
|
3543
|
+
var filterDuplicateErrors = function filterDuplicateErrors(errors) {
|
|
3544
|
+
return errors.reduce(function (list, error) {
|
|
3545
|
+
// check on type validateRequiredSub and validateRequiredMainOptional since these are giving 'duplicates'
|
|
3546
|
+
if (error.type === 'validateRequiredSub') {
|
|
3547
|
+
var exist = list.find(function (e) {
|
|
3548
|
+
return e.type === 'validateRequiredSub' && e.row === error.row;
|
|
3549
|
+
});
|
|
3550
|
+
return exist ? list : list.concat(error);
|
|
3551
|
+
}
|
|
3552
|
+
|
|
3553
|
+
if (error.type === 'validateRequiredMainOptional') {
|
|
3554
|
+
var _exist = list.find(function (e) {
|
|
3555
|
+
return e.type === 'validateRequiredMainOptional' && e.row === error.row;
|
|
3556
|
+
});
|
|
3557
|
+
|
|
3558
|
+
return _exist ? list : list.concat(error);
|
|
3559
|
+
}
|
|
3560
|
+
|
|
3561
|
+
return list.concat(error);
|
|
3562
|
+
}, []);
|
|
3563
|
+
};
|
|
3564
|
+
var getErrors = function getErrors(errors) {
|
|
3565
|
+
var errorList = Object.keys(errors).reduce(function (list, key) {
|
|
3566
|
+
var errorValue = errors[key];
|
|
3567
|
+
|
|
3568
|
+
if (Array.isArray(errorValue)) {
|
|
3569
|
+
var errorValues = errorValue.reduce(function (l, i) {
|
|
3570
|
+
return l.concat(getErrorValues(i));
|
|
3571
|
+
}, []);
|
|
3572
|
+
return list.concat.apply(list, _toConsumableArray(errorValues));
|
|
3573
|
+
}
|
|
3574
|
+
|
|
3575
|
+
return list.concat(getErrorValues(errorValue));
|
|
3576
|
+
}, []);
|
|
3577
|
+
return errorList;
|
|
3315
3578
|
};
|
|
3316
3579
|
|
|
3580
|
+
/* *
|
|
3581
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3582
|
+
* you may not use this file except in compliance with the License.
|
|
3583
|
+
* You may obtain a copy of the License at
|
|
3584
|
+
*
|
|
3585
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3586
|
+
*
|
|
3587
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3588
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3589
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3590
|
+
* See the License for the specific language governing permissions and
|
|
3591
|
+
* limitations under the License.
|
|
3592
|
+
*
|
|
3593
|
+
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3594
|
+
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3595
|
+
* */
|
|
3596
|
+
|
|
3317
3597
|
var IssuesButton = function IssuesButton(_ref) {
|
|
3318
|
-
var
|
|
3319
|
-
|
|
3320
|
-
|
|
3598
|
+
var _ref$errors = _ref.errors,
|
|
3599
|
+
errors = _ref$errors === void 0 ? {} : _ref$errors,
|
|
3600
|
+
_ref$isIssuesPaneOpen = _ref.isIssuesPaneOpen,
|
|
3601
|
+
isIssuesPaneOpen = _ref$isIssuesPaneOpen === void 0 ? false : _ref$isIssuesPaneOpen,
|
|
3602
|
+
_ref$setIsIssuesPaneO = _ref.setIsIssuesPaneOpen,
|
|
3603
|
+
setIsIssuesPaneOpen = _ref$setIsIssuesPaneO === void 0 ? function () {
|
|
3604
|
+
return null;
|
|
3605
|
+
} : _ref$setIsIssuesPaneO;
|
|
3606
|
+
var errorList = filterDuplicateErrors(getErrors(errors));
|
|
3607
|
+
var totalErrors = errorList.length;
|
|
3608
|
+
var errorStatus = totalErrors > 0 ? 'error' : 'success';
|
|
3609
|
+
var buttonColor = "geowebColors.functional.".concat(errorStatus);
|
|
3610
|
+
|
|
3611
|
+
var toggleIssuesPane = function toggleIssuesPane(newPosition) {
|
|
3612
|
+
return setIsIssuesPaneOpen(!isIssuesPaneOpen, newPosition);
|
|
3613
|
+
};
|
|
3614
|
+
|
|
3615
|
+
var onClickButton = function onClickButton(event) {
|
|
3616
|
+
var _a;
|
|
3617
|
+
|
|
3618
|
+
var _event$currentTarget$ = event.currentTarget.getBoundingClientRect(),
|
|
3619
|
+
left = _event$currentTarget$.left,
|
|
3620
|
+
top = _event$currentTarget$.top;
|
|
3621
|
+
|
|
3622
|
+
var parentOffset = ((_a = document.getElementById('tafmodule')) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) || {
|
|
3623
|
+
top: 0,
|
|
3624
|
+
left: 0
|
|
3625
|
+
};
|
|
3626
|
+
var newPosition = {
|
|
3627
|
+
left: left - parentOffset.left + 100,
|
|
3628
|
+
top: top - parentOffset.top
|
|
3629
|
+
};
|
|
3630
|
+
toggleIssuesPane(newPosition);
|
|
3631
|
+
};
|
|
3632
|
+
|
|
3321
3633
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
3322
3634
|
title: "View details"
|
|
3323
3635
|
}, /*#__PURE__*/React.createElement(Chip, {
|
|
3324
3636
|
"data-testid": "issuesButton",
|
|
3637
|
+
className: "status-".concat(errorStatus),
|
|
3325
3638
|
size: "small",
|
|
3326
|
-
label: getIssuesLabel(
|
|
3327
|
-
|
|
3328
|
-
|
|
3639
|
+
label: getIssuesLabel(totalErrors),
|
|
3640
|
+
onClick: onClickButton,
|
|
3641
|
+
sx: {
|
|
3642
|
+
width: '74px',
|
|
3643
|
+
color: '#ffffff',
|
|
3644
|
+
backgroundColor: buttonColor,
|
|
3645
|
+
'&:hover': {
|
|
3646
|
+
backgroundColor: buttonColor
|
|
3647
|
+
},
|
|
3648
|
+
'&:focus': {
|
|
3649
|
+
backgroundColor: buttonColor
|
|
3650
|
+
},
|
|
3651
|
+
fontSize: 12
|
|
3652
|
+
}
|
|
3329
3653
|
}));
|
|
3330
3654
|
};
|
|
3331
3655
|
|
|
@@ -3366,32 +3690,6 @@ var ThumbsUp = function ThumbsUp(props) {
|
|
|
3366
3690
|
})));
|
|
3367
3691
|
};
|
|
3368
3692
|
|
|
3369
|
-
/* *
|
|
3370
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3371
|
-
* you may not use this file except in compliance with the License.
|
|
3372
|
-
* You may obtain a copy of the License at
|
|
3373
|
-
*
|
|
3374
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3375
|
-
*
|
|
3376
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3377
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3378
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3379
|
-
* See the License for the specific language governing permissions and
|
|
3380
|
-
* limitations under the License.
|
|
3381
|
-
*
|
|
3382
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3383
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3384
|
-
* */
|
|
3385
|
-
var useStyles$8 = makeStyles({
|
|
3386
|
-
paneContent: {
|
|
3387
|
-
marginTop: '16px',
|
|
3388
|
-
marginLeft: '24px'
|
|
3389
|
-
},
|
|
3390
|
-
image: {
|
|
3391
|
-
fontSize: '4rem'
|
|
3392
|
-
}
|
|
3393
|
-
});
|
|
3394
|
-
|
|
3395
3693
|
var getPaneTitle = function getPaneTitle(sumOfErrors) {
|
|
3396
3694
|
switch (sumOfErrors) {
|
|
3397
3695
|
case 0:
|
|
@@ -3430,7 +3728,7 @@ var humanizeErrorMessage = function humanizeErrorMessage(nameAsString) {
|
|
|
3430
3728
|
var nameWithoutBrackets = nameAsString.replace(/[[\]']+/g, '');
|
|
3431
3729
|
var nameLowerCase = nameWithoutBrackets.toLowerCase();
|
|
3432
3730
|
|
|
3433
|
-
var _nameLowerCase$split$ = nameLowerCase.split(/([0-9]+)/) // split
|
|
3731
|
+
var _nameLowerCase$split$ = nameLowerCase.split(/([0-9]+)/) // split num bers from field and build array
|
|
3434
3732
|
.filter(function (s) {
|
|
3435
3733
|
return s.length;
|
|
3436
3734
|
}),
|
|
@@ -3458,33 +3756,73 @@ var getErrorMessage = function getErrorMessage(error, index) {
|
|
|
3458
3756
|
var fieldErrorTitle = humanizeErrorMessage(firstNamePart);
|
|
3459
3757
|
return "".concat(index + 1, ". ").concat(fieldErrorTitle, ": ").concat(getErrorDefaultMessage(error));
|
|
3460
3758
|
};
|
|
3759
|
+
var MODAL_DIALOG_ELEMENT = 'modal-dialog';
|
|
3760
|
+
var useIssuesPane = function useIssuesPane() {
|
|
3761
|
+
var _React$useState = React.useState(false),
|
|
3762
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3763
|
+
isIssuesPaneOpen = _React$useState2[0],
|
|
3764
|
+
setIsIssuesPaneOpen = _React$useState2[1];
|
|
3461
3765
|
|
|
3462
|
-
var
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
var
|
|
3468
|
-
|
|
3469
|
-
|
|
3766
|
+
var _React$useState3 = React.useState(null),
|
|
3767
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3768
|
+
startPosition = _React$useState4[0],
|
|
3769
|
+
setStartPosition = _React$useState4[1];
|
|
3770
|
+
|
|
3771
|
+
var onToggleIssuesPane = function onToggleIssuesPane(isOpen, newPosition) {
|
|
3772
|
+
if (!startPosition) {
|
|
3773
|
+
setStartPosition(newPosition);
|
|
3774
|
+
}
|
|
3775
|
+
|
|
3776
|
+
setIsIssuesPaneOpen(isOpen);
|
|
3777
|
+
};
|
|
3778
|
+
|
|
3779
|
+
var onCloseIssuesPane = function onCloseIssuesPane() {
|
|
3780
|
+
return setIsIssuesPaneOpen(false);
|
|
3781
|
+
};
|
|
3782
|
+
|
|
3783
|
+
return {
|
|
3784
|
+
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
3785
|
+
startPosition: startPosition,
|
|
3786
|
+
onToggleIssuesPane: onToggleIssuesPane,
|
|
3787
|
+
onCloseIssuesPane: onCloseIssuesPane
|
|
3788
|
+
};
|
|
3789
|
+
};
|
|
3790
|
+
|
|
3791
|
+
var IssuesPane = function IssuesPane(_ref3) {
|
|
3792
|
+
var _ref3$errorList = _ref3.errorList,
|
|
3793
|
+
errorList = _ref3$errorList === void 0 ? [] : _ref3$errorList,
|
|
3794
|
+
isOpen = _ref3.isOpen,
|
|
3795
|
+
handleClose = _ref3.handleClose,
|
|
3796
|
+
_ref3$startPosition = _ref3.startPosition,
|
|
3797
|
+
startPosition = _ref3$startPosition === void 0 ? {
|
|
3798
|
+
left: 20,
|
|
3799
|
+
top: 50
|
|
3800
|
+
} : _ref3$startPosition;
|
|
3801
|
+
var rootElement = document.getElementById(MODAL_DIALOG_ELEMENT) || document.body;
|
|
3802
|
+
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(ToolContainerDraggable, {
|
|
3803
|
+
startSize: {
|
|
3470
3804
|
width: '577px',
|
|
3471
3805
|
height: '200px'
|
|
3472
3806
|
},
|
|
3473
|
-
startPosition:
|
|
3474
|
-
left: 370,
|
|
3475
|
-
top: 570
|
|
3476
|
-
},
|
|
3807
|
+
startPosition: startPosition,
|
|
3477
3808
|
minWidth: 300,
|
|
3478
3809
|
onClose: handleClose,
|
|
3479
3810
|
title: getPaneTitle(errorList.length),
|
|
3480
3811
|
headerSize: "xs",
|
|
3481
3812
|
isOpen: isOpen,
|
|
3482
3813
|
"data-testid": "moveable-issues-pane",
|
|
3483
|
-
bounds: "
|
|
3484
|
-
}, /*#__PURE__*/React.createElement(
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3814
|
+
bounds: "parent"
|
|
3815
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
3816
|
+
component: "div",
|
|
3817
|
+
sx: {
|
|
3818
|
+
marginTop: '16px',
|
|
3819
|
+
marginLeft: '24px'
|
|
3820
|
+
}
|
|
3821
|
+
}, errorList.length === 0 && /*#__PURE__*/React.createElement(Box, {
|
|
3822
|
+
component: "div",
|
|
3823
|
+
sx: {
|
|
3824
|
+
fontSize: '4rem'
|
|
3825
|
+
},
|
|
3488
3826
|
"data-testid": "zeroIssuesImage"
|
|
3489
3827
|
}, /*#__PURE__*/React.createElement(ThumbsUp, null)), errorList.length > 0 && errorList.map(function (error, index) {
|
|
3490
3828
|
return /*#__PURE__*/React.createElement(Typography // eslint-disable-next-line react/no-array-index-key
|
|
@@ -3494,256 +3832,71 @@ var IssuesPane = function IssuesPane(_ref3) {
|
|
|
3494
3832
|
variant: "body1",
|
|
3495
3833
|
"data-testid": "errorMessage"
|
|
3496
3834
|
}, getErrorMessage(error, index));
|
|
3497
|
-
})));
|
|
3498
|
-
};
|
|
3499
|
-
|
|
3500
|
-
var getCustomError = function getCustomError(error) {
|
|
3501
|
-
var name = error.ref.name;
|
|
3502
|
-
var isChangeGroup = name.includes('changeGroups');
|
|
3503
|
-
var matchRowNumber = name.match(/\[(.*?)\]/);
|
|
3504
|
-
var row = matchRowNumber ? parseInt(matchRowNumber[1], 10) : null;
|
|
3505
|
-
return Object.assign(Object.assign({}, error), {
|
|
3506
|
-
isChangeGroup: isChangeGroup,
|
|
3507
|
-
row: row
|
|
3508
|
-
});
|
|
3509
|
-
};
|
|
3510
|
-
|
|
3511
|
-
var getErrorValues = function getErrorValues(fieldErrors) {
|
|
3512
|
-
if (!fieldErrors) return [];
|
|
3513
|
-
return Object.keys(fieldErrors).reduce(function (list, key) {
|
|
3514
|
-
var error = Object.assign({}, fieldErrors[key]);
|
|
3515
|
-
|
|
3516
|
-
if (error.ref) {
|
|
3517
|
-
return list.concat(getCustomError(error));
|
|
3518
|
-
}
|
|
3519
|
-
|
|
3520
|
-
return list.concat(getErrorValues(error));
|
|
3521
|
-
}, []);
|
|
3522
|
-
};
|
|
3523
|
-
|
|
3524
|
-
var getErrors = function getErrors(errors) {
|
|
3525
|
-
var errorList = Object.keys(errors).reduce(function (list, key) {
|
|
3526
|
-
var errorValue = errors[key];
|
|
3527
|
-
|
|
3528
|
-
if (Array.isArray(errorValue)) {
|
|
3529
|
-
var errorValues = errorValue.reduce(function (l, i) {
|
|
3530
|
-
return l.concat(getErrorValues(i));
|
|
3531
|
-
}, []);
|
|
3532
|
-
return list.concat.apply(list, _toConsumableArray(errorValues));
|
|
3533
|
-
}
|
|
3534
|
-
|
|
3535
|
-
return list.concat(getErrorValues(errorValue));
|
|
3536
|
-
}, []);
|
|
3537
|
-
return errorList;
|
|
3538
|
-
};
|
|
3539
|
-
|
|
3540
|
-
var filterDuplicateErrors = function filterDuplicateErrors(errors) {
|
|
3541
|
-
return errors.reduce(function (list, error) {
|
|
3542
|
-
// check on type validateRequiredSub and validateRequiredMainOptional since these are giving 'duplicates'
|
|
3543
|
-
if (error.type === 'validateRequiredSub') {
|
|
3544
|
-
var exist = list.find(function (e) {
|
|
3545
|
-
return e.type === 'validateRequiredSub' && e.row === error.row;
|
|
3546
|
-
});
|
|
3547
|
-
return exist ? list : list.concat(error);
|
|
3548
|
-
}
|
|
3549
|
-
|
|
3550
|
-
if (error.type === 'validateRequiredMainOptional') {
|
|
3551
|
-
var _exist = list.find(function (e) {
|
|
3552
|
-
return e.type === 'validateRequiredMainOptional' && e.row === error.row;
|
|
3553
|
-
});
|
|
3554
|
-
|
|
3555
|
-
return _exist ? list : list.concat(error);
|
|
3556
|
-
}
|
|
3557
|
-
|
|
3558
|
-
return list.concat(error);
|
|
3559
|
-
}, []);
|
|
3835
|
+
}))), rootElement);
|
|
3560
3836
|
};
|
|
3561
3837
|
|
|
3562
|
-
var
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
var _useFormContext = useFormContext(),
|
|
3568
|
-
errors = _useFormContext.errors;
|
|
3569
|
-
|
|
3570
|
-
var errorList = filterDuplicateErrors(getErrors(errors));
|
|
3571
|
-
|
|
3572
|
-
var _React$useState = React__default.useState(false),
|
|
3573
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3574
|
-
isIssuesPaneOpen = _React$useState2[0],
|
|
3575
|
-
setIsIssuesPaneOpen = _React$useState2[1];
|
|
3838
|
+
var fromStatusToAction = function fromStatusToAction(tafStatus) {
|
|
3839
|
+
switch (tafStatus) {
|
|
3840
|
+
case 'DRAFT':
|
|
3841
|
+
return 'DRAFT';
|
|
3576
3842
|
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
};
|
|
3843
|
+
case 'DRAFT_AMENDED':
|
|
3844
|
+
return 'DRAFT_AMEND';
|
|
3580
3845
|
|
|
3581
|
-
|
|
3582
|
-
|
|
3583
|
-
justifyContent: "space-between",
|
|
3584
|
-
alignItems: "center",
|
|
3585
|
-
className: classes.lifecycleButtons
|
|
3586
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
3587
|
-
item: true
|
|
3588
|
-
}, /*#__PURE__*/React__default.createElement(IssuesButton, {
|
|
3589
|
-
sumOfErrors: errorList.length,
|
|
3590
|
-
togglePane: toggleIssuesPane
|
|
3591
|
-
})), /*#__PURE__*/React__default.createElement(Grid, {
|
|
3592
|
-
item: true
|
|
3593
|
-
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
3594
|
-
"data-testid": "discardtaf",
|
|
3595
|
-
variant: "outlined",
|
|
3596
|
-
color: "secondary",
|
|
3597
|
-
type: "button",
|
|
3598
|
-
className: classes.actionButton,
|
|
3599
|
-
onClick: function onClick() {
|
|
3600
|
-
// Simply discard the changes and close the dialog.
|
|
3601
|
-
onTafFormButtonPress('DISCARD');
|
|
3602
|
-
}
|
|
3603
|
-
}, "Discard"), /*#__PURE__*/React__default.createElement(Button, {
|
|
3604
|
-
"data-testid": "savedrafttaf",
|
|
3605
|
-
variant: "outlined",
|
|
3606
|
-
color: "secondary",
|
|
3607
|
-
type: "button",
|
|
3608
|
-
className: classes.actionButton,
|
|
3609
|
-
onClick: function onClick() {
|
|
3610
|
-
/* Save the TAF as draft:
|
|
3611
|
-
if action NEW or DRAFT - new status will be DRAFT -- default
|
|
3612
|
-
if action AMEND - new status will be DRAFT_AMENDED
|
|
3613
|
-
if action CORRECT - new status will be DRAFT_CORRECTED
|
|
3614
|
-
if action DRAFT_AMEND - new status will be DRAFT_AMENDED
|
|
3615
|
-
if action DRAFT_CORRECT - new status will be DRAFT_CORRECTED
|
|
3616
|
-
*/
|
|
3617
|
-
switch (tafAction) {
|
|
3618
|
-
case 'AMEND':
|
|
3619
|
-
case 'DRAFT_AMEND':
|
|
3620
|
-
onTafFormButtonPress('DRAFT_AMEND');
|
|
3621
|
-
break;
|
|
3846
|
+
case 'DRAFT_CORRECTED':
|
|
3847
|
+
return 'DRAFT_CORRECT';
|
|
3622
3848
|
|
|
3623
|
-
|
|
3624
|
-
|
|
3625
|
-
onTafFormButtonPress('DRAFT_CORRECT');
|
|
3626
|
-
break;
|
|
3849
|
+
case 'PUBLISHED':
|
|
3850
|
+
return 'PUBLISH';
|
|
3627
3851
|
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
break;
|
|
3631
|
-
}
|
|
3632
|
-
}
|
|
3633
|
-
}, "Save"), /*#__PURE__*/React__default.createElement(Button, {
|
|
3634
|
-
"data-testid": "publishtaf",
|
|
3635
|
-
variant: "outlined",
|
|
3636
|
-
color: "secondary",
|
|
3637
|
-
type: "button",
|
|
3638
|
-
className: classes.lastButton,
|
|
3639
|
-
onClick: function onClick() {
|
|
3640
|
-
/* Publish the TAF:
|
|
3641
|
-
if action NEW or DRAFT - new status will be PUBLISHED -- default
|
|
3642
|
-
if action AMEND - new status will be AMENDED
|
|
3643
|
-
if action CORRECT - new status will be CORRECTED
|
|
3644
|
-
if action DRAFT_AMEND - new status will be AMENDED
|
|
3645
|
-
if action DRAFT_CORRECT - new status will be CORRECTED
|
|
3646
|
-
*/
|
|
3647
|
-
switch (tafAction) {
|
|
3648
|
-
case 'AMEND':
|
|
3649
|
-
case 'DRAFT_AMEND':
|
|
3650
|
-
onTafFormButtonPress('AMEND');
|
|
3651
|
-
break;
|
|
3852
|
+
case 'AMENDED':
|
|
3853
|
+
return 'AMEND';
|
|
3652
3854
|
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
onTafFormButtonPress('CORRECT');
|
|
3656
|
-
break;
|
|
3855
|
+
case 'CORRECTED':
|
|
3856
|
+
return 'CORRECT';
|
|
3657
3857
|
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
break;
|
|
3661
|
-
}
|
|
3662
|
-
}
|
|
3663
|
-
}, "Publish"))), /*#__PURE__*/React__default.createElement(IssuesPane, {
|
|
3664
|
-
errorList: errorList,
|
|
3665
|
-
handleClose: toggleIssuesPane,
|
|
3666
|
-
isOpen: isIssuesPaneOpen
|
|
3667
|
-
}));
|
|
3668
|
-
};
|
|
3858
|
+
case 'CANCELLED':
|
|
3859
|
+
return 'CANCEL';
|
|
3669
3860
|
|
|
3670
|
-
|
|
3671
|
-
|
|
3672
|
-
|
|
3673
|
-
|
|
3674
|
-
*
|
|
3675
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3676
|
-
*
|
|
3677
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3678
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3679
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3680
|
-
* See the License for the specific language governing permissions and
|
|
3681
|
-
* limitations under the License.
|
|
3682
|
-
*
|
|
3683
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3684
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3685
|
-
* */
|
|
3686
|
-
var useStyles$7 = makeStyles(function () {
|
|
3687
|
-
return {
|
|
3688
|
-
dragHandle: {
|
|
3689
|
-
backgroundColor: 'transparent',
|
|
3690
|
-
'&:hover': {
|
|
3691
|
-
backgroundColor: 'transparent'
|
|
3692
|
-
},
|
|
3693
|
-
cursor: function cursor(isSorting) {
|
|
3694
|
-
return isSorting ? 'grabbing' : 'grab';
|
|
3695
|
-
}
|
|
3696
|
-
}
|
|
3697
|
-
};
|
|
3698
|
-
});
|
|
3861
|
+
default:
|
|
3862
|
+
return 'NEW';
|
|
3863
|
+
}
|
|
3864
|
+
}; // prevents default functionality
|
|
3699
3865
|
|
|
3700
|
-
var DragHandle = function DragHandle(_ref) {
|
|
3701
|
-
var _ref$isSorting = _ref.isSorting,
|
|
3702
|
-
isSorting = _ref$isSorting === void 0 ? false : _ref$isSorting,
|
|
3703
|
-
_ref$isDisabled = _ref.isDisabled,
|
|
3704
|
-
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
3705
|
-
index = _ref.index;
|
|
3706
|
-
var classes = useStyles$7(isSorting);
|
|
3707
|
-
return /*#__PURE__*/React__default.createElement(IconButton, {
|
|
3708
|
-
className: "".concat(classes.dragHandle, " handle"),
|
|
3709
|
-
"data-testid": "dragHandle-".concat(index),
|
|
3710
|
-
disableRipple: true,
|
|
3711
|
-
disabled: isDisabled,
|
|
3712
|
-
size: "large"
|
|
3713
|
-
}, /*#__PURE__*/React__default.createElement(DragIndicator, null));
|
|
3714
|
-
};
|
|
3715
3866
|
|
|
3716
3867
|
var noop = function noop() {};
|
|
3717
3868
|
|
|
3718
|
-
var emptyChangegroup = {
|
|
3719
|
-
valid: '',
|
|
3720
|
-
wind: '',
|
|
3721
|
-
visibility: '',
|
|
3722
|
-
weather: {
|
|
3723
|
-
weather1: null,
|
|
3724
|
-
weather2: null,
|
|
3725
|
-
weather3: null
|
|
3726
|
-
},
|
|
3727
|
-
cloud: {
|
|
3728
|
-
cloud1: null,
|
|
3729
|
-
cloud2: null,
|
|
3730
|
-
cloud3: null,
|
|
3731
|
-
cloud4: null
|
|
3732
|
-
},
|
|
3733
|
-
change: null,
|
|
3734
|
-
probability: null
|
|
3735
|
-
};
|
|
3736
|
-
|
|
3737
3869
|
var TafForm = function TafForm(_ref) {
|
|
3738
|
-
var isDisabled = _ref.isDisabled,
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
staticTAC = _ref$staticTAC === void 0 ? '' : _ref$staticTAC,
|
|
3870
|
+
var _ref$isDisabled = _ref.isDisabled,
|
|
3871
|
+
isDefaultDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
3872
|
+
tafFromBackend = _ref.tafFromBackend,
|
|
3742
3873
|
_ref$onFormAction = _ref.onFormAction,
|
|
3743
3874
|
onFormAction = _ref$onFormAction === void 0 ? function () {
|
|
3744
3875
|
return null;
|
|
3745
|
-
} : _ref$onFormAction
|
|
3746
|
-
|
|
3876
|
+
} : _ref$onFormAction,
|
|
3877
|
+
_ref$onFormDirty = _ref.onFormDirty,
|
|
3878
|
+
onFormDirty = _ref$onFormDirty === void 0 ? function () {
|
|
3879
|
+
return null;
|
|
3880
|
+
} : _ref$onFormDirty,
|
|
3881
|
+
_ref$isIssuesPaneOpen = _ref.isIssuesPaneOpen,
|
|
3882
|
+
isIssuesPaneOpen = _ref$isIssuesPaneOpen === void 0 ? false : _ref$isIssuesPaneOpen,
|
|
3883
|
+
_ref$setIsIssuesPaneO = _ref.setIsIssuesPaneOpen,
|
|
3884
|
+
setIsIssuesPaneOpen = _ref$setIsIssuesPaneO === void 0 ? function () {
|
|
3885
|
+
return null;
|
|
3886
|
+
} : _ref$setIsIssuesPaneO;
|
|
3887
|
+
var originalTaf = tafFromBackend.taf;
|
|
3888
|
+
var defaultTafAction = fromStatusToAction(originalTaf.status);
|
|
3889
|
+
|
|
3890
|
+
var _React$useState = React__default.useState(defaultTafAction),
|
|
3891
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3892
|
+
tafAction = _React$useState2[0],
|
|
3893
|
+
setTafAction = _React$useState2[1];
|
|
3894
|
+
|
|
3895
|
+
var _React$useState3 = React__default.useState(isDefaultDisabled),
|
|
3896
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3897
|
+
isDisabled = _React$useState4[0],
|
|
3898
|
+
setIsDisabled = _React$useState4[1];
|
|
3899
|
+
|
|
3747
3900
|
var confirmDialog = useConfirmationDialog();
|
|
3748
3901
|
|
|
3749
3902
|
var _useDraftFormHelpers = useDraftFormHelpers(),
|
|
@@ -3759,22 +3912,23 @@ var TafForm = function TafForm(_ref) {
|
|
|
3759
3912
|
var _useFormContext = useFormContext(),
|
|
3760
3913
|
control = _useFormContext.control,
|
|
3761
3914
|
handleSubmit = _useFormContext.handleSubmit,
|
|
3762
|
-
watch = _useFormContext.watch,
|
|
3763
3915
|
trigger = _useFormContext.trigger,
|
|
3764
3916
|
formState = _useFormContext.formState,
|
|
3765
|
-
getValues = _useFormContext.getValues
|
|
3917
|
+
getValues = _useFormContext.getValues,
|
|
3918
|
+
setValue = _useFormContext.setValue,
|
|
3919
|
+
reset = _useFormContext.reset;
|
|
3766
3920
|
|
|
3767
3921
|
var isFormDirty = formState.isDirty,
|
|
3768
3922
|
errors = formState.errors;
|
|
3769
3923
|
usePreventBrowserClose(isFormDirty && !isDisabled);
|
|
3770
3924
|
var hiddenInputFields = ['baseTime', 'issueDate', 'type', 'uuid', 'validDateStart', 'validDateEnd', 'status', 'previousId', 'previousValidDateStart', 'previousValidDateEnd'];
|
|
3771
3925
|
|
|
3772
|
-
var _React$
|
|
3773
|
-
_React$
|
|
3774
|
-
delayedFormValues = _React$
|
|
3775
|
-
setDelayedFormValues = _React$
|
|
3926
|
+
var _React$useState5 = React__default.useState(getValues()),
|
|
3927
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
3928
|
+
delayedFormValues = _React$useState6[0],
|
|
3929
|
+
setDelayedFormValues = _React$useState6[1];
|
|
3776
3930
|
|
|
3777
|
-
var _useTACGenerator = useTACGenerator(
|
|
3931
|
+
var _useTACGenerator = useTACGenerator(tafFromBackend.taf, api.getTAC),
|
|
3778
3932
|
_useTACGenerator2 = _slicedToArray(_useTACGenerator, 2),
|
|
3779
3933
|
TAC = _useTACGenerator2[0],
|
|
3780
3934
|
updateTAC = _useTACGenerator2[1];
|
|
@@ -3786,7 +3940,7 @@ var TafForm = function TafForm(_ref) {
|
|
|
3786
3940
|
};
|
|
3787
3941
|
|
|
3788
3942
|
React__default.useEffect(function () {
|
|
3789
|
-
if (
|
|
3943
|
+
if (isMounted.current && isFormDirty) {
|
|
3790
3944
|
var newTAC = hasErrors ? null : convertTafValuesToObject(delayedFormValues);
|
|
3791
3945
|
updateTAC(newTAC);
|
|
3792
3946
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -3798,7 +3952,11 @@ var TafForm = function TafForm(_ref) {
|
|
|
3798
3952
|
updateTAC(convertTafValuesToObject(delayedFormValues));
|
|
3799
3953
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3800
3954
|
|
|
3801
|
-
}, [hasErrors]);
|
|
3955
|
+
}, [hasErrors]); // Needed to be able to show a confirmation dialog on switching tabs when form is edited and not saved
|
|
3956
|
+
|
|
3957
|
+
React__default.useEffect(function () {
|
|
3958
|
+
onFormDirty(isFormDirty);
|
|
3959
|
+
}, [isFormDirty, onFormDirty]);
|
|
3802
3960
|
|
|
3803
3961
|
var onSubmit = function onSubmit(data) {
|
|
3804
3962
|
// eslint-disable-next-line no-console
|
|
@@ -3808,12 +3966,30 @@ var TafForm = function TafForm(_ref) {
|
|
|
3808
3966
|
var showConfirmDialog = function showConfirmDialog(action) {
|
|
3809
3967
|
return confirmDialog({
|
|
3810
3968
|
title: getConfirmationDialogTitle(action),
|
|
3811
|
-
description: getConfirmationDialogContent(action,
|
|
3969
|
+
description: getConfirmationDialogContent(action, function () {
|
|
3970
|
+
return isTafAmendedCorrectedChanged(isFormDirty, originalTaf, convertTafValuesToObject(getValues()));
|
|
3971
|
+
}),
|
|
3812
3972
|
confirmLabel: getConfirmationDialogButtonLabel(action)
|
|
3813
3973
|
});
|
|
3814
3974
|
};
|
|
3815
3975
|
|
|
3816
|
-
var
|
|
3976
|
+
var resetFormValues = function resetFormValues() {
|
|
3977
|
+
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
|
|
3978
|
+
var shouldAddEmptyChangGroup = arguments.length > 1 ? arguments[1] : undefined;
|
|
3979
|
+
var newTaf = prepareTafValues(tafFromBackend.taf, action, shouldAddEmptyChangGroup);
|
|
3980
|
+
reset(newTaf);
|
|
3981
|
+
};
|
|
3982
|
+
|
|
3983
|
+
var resetForm = function resetForm() {
|
|
3984
|
+
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
|
|
3985
|
+
var resetDisabled = arguments.length > 1 ? arguments[1] : undefined;
|
|
3986
|
+
var shouldAddEmptyChangGroup = !(tafFromBackend.taf && tafFromBackend.taf.changeGroups) && !resetDisabled;
|
|
3987
|
+
resetFormValues(action, shouldAddEmptyChangGroup);
|
|
3988
|
+
setIsDisabled(resetDisabled);
|
|
3989
|
+
setTafAction(action);
|
|
3990
|
+
};
|
|
3991
|
+
|
|
3992
|
+
var onTafEditModeButtonPress = function onTafEditModeButtonPress(action) {
|
|
3817
3993
|
switch (action) {
|
|
3818
3994
|
case 'DRAFT':
|
|
3819
3995
|
case 'DRAFT_AMEND':
|
|
@@ -3827,10 +4003,10 @@ var TafForm = function TafForm(_ref) {
|
|
|
3827
4003
|
case 'DISCARD':
|
|
3828
4004
|
if (isFormDirty) {
|
|
3829
4005
|
showConfirmDialog(action).then(function () {
|
|
3830
|
-
|
|
4006
|
+
resetForm(undefined, isDefaultDisabled);
|
|
3831
4007
|
});
|
|
3832
4008
|
} else {
|
|
3833
|
-
|
|
4009
|
+
resetForm(undefined, isDefaultDisabled);
|
|
3834
4010
|
}
|
|
3835
4011
|
|
|
3836
4012
|
break;
|
|
@@ -3840,9 +4016,35 @@ var TafForm = function TafForm(_ref) {
|
|
|
3840
4016
|
case 'PUBLISH':
|
|
3841
4017
|
toggleIsDraft(false);
|
|
3842
4018
|
handleSubmit(function (data) {
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
4019
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
4020
|
+
var didSucceed;
|
|
4021
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
4022
|
+
while (1) {
|
|
4023
|
+
switch (_context.prev = _context.next) {
|
|
4024
|
+
case 0:
|
|
4025
|
+
_context.next = 2;
|
|
4026
|
+
return showConfirmDialog(action);
|
|
4027
|
+
|
|
4028
|
+
case 2:
|
|
4029
|
+
_context.next = 4;
|
|
4030
|
+
return onFormAction(action, convertTafValuesToObject(data));
|
|
4031
|
+
|
|
4032
|
+
case 4:
|
|
4033
|
+
didSucceed = _context.sent;
|
|
4034
|
+
|
|
4035
|
+
if (didSucceed) {
|
|
4036
|
+
setIsDisabled(true);
|
|
4037
|
+
reset(prepareTafValues(convertTafValuesToObject(data), action, false));
|
|
4038
|
+
setTafAction(null);
|
|
4039
|
+
}
|
|
4040
|
+
|
|
4041
|
+
case 6:
|
|
4042
|
+
case "end":
|
|
4043
|
+
return _context.stop();
|
|
4044
|
+
}
|
|
4045
|
+
}
|
|
4046
|
+
}, _callee);
|
|
4047
|
+
}));
|
|
3846
4048
|
})();
|
|
3847
4049
|
break;
|
|
3848
4050
|
|
|
@@ -3852,14 +4054,28 @@ var TafForm = function TafForm(_ref) {
|
|
|
3852
4054
|
}
|
|
3853
4055
|
};
|
|
3854
4056
|
|
|
3855
|
-
var
|
|
3856
|
-
|
|
3857
|
-
|
|
3858
|
-
|
|
3859
|
-
|
|
3860
|
-
|
|
3861
|
-
|
|
3862
|
-
|
|
4057
|
+
var onTafViewModeButtonPress = function onTafViewModeButtonPress(action) {
|
|
4058
|
+
switch (action) {
|
|
4059
|
+
case 'CANCEL':
|
|
4060
|
+
showConfirmDialog(action).then(function () {
|
|
4061
|
+
onFormAction(action, tafFromBackend.taf);
|
|
4062
|
+
});
|
|
4063
|
+
break;
|
|
4064
|
+
|
|
4065
|
+
default:
|
|
4066
|
+
resetForm(action, false);
|
|
4067
|
+
break;
|
|
4068
|
+
}
|
|
4069
|
+
};
|
|
4070
|
+
|
|
4071
|
+
var _useFieldArray = useFieldArray({
|
|
4072
|
+
control: control,
|
|
4073
|
+
name: 'changeGroups'
|
|
4074
|
+
}),
|
|
4075
|
+
fields = _useFieldArray.fields,
|
|
4076
|
+
insert = _useFieldArray.insert,
|
|
4077
|
+
remove = _useFieldArray.remove,
|
|
4078
|
+
move = _useFieldArray.move;
|
|
3863
4079
|
|
|
3864
4080
|
var _useDragOrder = useDragOrder(trigger, move, onFormBlur),
|
|
3865
4081
|
onChangeOrder = _useDragOrder.onChangeOrder,
|
|
@@ -3881,51 +4097,116 @@ var TafForm = function TafForm(_ref) {
|
|
|
3881
4097
|
|
|
3882
4098
|
|
|
3883
4099
|
var focusFirstInput = function focusFirstInput(rowIndex) {
|
|
3884
|
-
var
|
|
4100
|
+
var selector = rowIndex === -1 ? "[name=\"baseForecast.wind\"]" : "[name=\"changeGroups[".concat(rowIndex, "].probability\"]");
|
|
4101
|
+
var nextRowFirstInput = document.querySelector(selector);
|
|
3885
4102
|
|
|
3886
4103
|
if (nextRowFirstInput) {
|
|
3887
4104
|
nextRowFirstInput.focus();
|
|
3888
4105
|
}
|
|
4106
|
+
}; // adding rows and validation don't work well combined, with always skipping validation of fields of rows above the one the inserted row. A setTimeout prevents this issue
|
|
4107
|
+
|
|
4108
|
+
|
|
4109
|
+
var setFocusAndValidate = function setFocusAndValidate(rowIndex) {
|
|
4110
|
+
return setTimeout(function () {
|
|
4111
|
+
focusFirstInput(rowIndex);
|
|
4112
|
+
trigger(); // trigger all fields validation
|
|
4113
|
+
}, 0);
|
|
3889
4114
|
};
|
|
3890
4115
|
|
|
3891
4116
|
var onAddRow = function onAddRow() {
|
|
3892
4117
|
var rowIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
|
|
3893
|
-
var
|
|
3894
|
-
|
|
4118
|
+
var above = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4119
|
+
var newRowIndex = above ? rowIndex : rowIndex + 1;
|
|
4120
|
+
insert(newRowIndex, emptyChangegroup, false);
|
|
4121
|
+
setFocusAndValidate(newRowIndex);
|
|
4122
|
+
};
|
|
3895
4123
|
|
|
3896
|
-
|
|
3897
|
-
|
|
3898
|
-
|
|
3899
|
-
|
|
4124
|
+
var _onClearRow = function onClearRow() {
|
|
4125
|
+
var rowIndex = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
|
|
4126
|
+
var isChangeGroup = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
4127
|
+
confirmDialog({
|
|
4128
|
+
title: 'Clear row',
|
|
4129
|
+
description: 'Are you sure you want to clear this row?',
|
|
4130
|
+
confirmLabel: 'Yes'
|
|
4131
|
+
}).then(function () {
|
|
4132
|
+
if (isChangeGroup) {
|
|
4133
|
+
remove(rowIndex);
|
|
4134
|
+
insert(rowIndex, emptyChangegroup, false);
|
|
4135
|
+
} else {
|
|
4136
|
+
var baseForecastFields = getFieldNames(false, -1);
|
|
4137
|
+
setValue(baseForecastFields.wind, '');
|
|
4138
|
+
setValue(baseForecastFields.visibility, '');
|
|
4139
|
+
setValue(baseForecastFields.weather1, '');
|
|
4140
|
+
setValue(baseForecastFields.weather2, '');
|
|
4141
|
+
setValue(baseForecastFields.weather3, '');
|
|
4142
|
+
setValue(baseForecastFields.cloud1, '');
|
|
4143
|
+
setValue(baseForecastFields.cloud2, '');
|
|
4144
|
+
setValue(baseForecastFields.cloud3, '');
|
|
4145
|
+
setValue(baseForecastFields.cloud4, '');
|
|
4146
|
+
}
|
|
4147
|
+
|
|
4148
|
+
setFocusAndValidate(rowIndex);
|
|
4149
|
+
});
|
|
3900
4150
|
};
|
|
3901
4151
|
|
|
4152
|
+
var _React$useState7 = React__default.useState(false),
|
|
4153
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
4154
|
+
shouldValidate = _React$useState8[0],
|
|
4155
|
+
setShouldValidate = _React$useState8[1];
|
|
4156
|
+
|
|
4157
|
+
React__default.useEffect(function () {
|
|
4158
|
+
var defaultValues = prepareTafValues(tafFromBackend.taf, undefined, !isDisabled && !tafFromBackend.taf.changeGroups); // set initial form values
|
|
4159
|
+
|
|
4160
|
+
reset(defaultValues); // set validate flag to validate after the values have been set
|
|
4161
|
+
|
|
4162
|
+
setShouldValidate(true);
|
|
4163
|
+
return function () {
|
|
4164
|
+
reset();
|
|
4165
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4166
|
+
}, []);
|
|
3902
4167
|
React__default.useEffect(function () {
|
|
3903
|
-
if (!isDisabled) {
|
|
4168
|
+
if (shouldValidate && !isDisabled) {
|
|
3904
4169
|
// trigger validation on all changegroup validity times after initial load since they could be outside the new validity period
|
|
3905
|
-
var
|
|
4170
|
+
var _tafFromBackend$taf$c = tafFromBackend.taf.changeGroups,
|
|
4171
|
+
changeGroups = _tafFromBackend$taf$c === void 0 ? [] : _tafFromBackend$taf$c;
|
|
4172
|
+
var validFields = changeGroups.map(function (_field, index) {
|
|
3906
4173
|
return "changeGroups[".concat(index, "].valid");
|
|
3907
4174
|
});
|
|
3908
4175
|
trigger(validFields);
|
|
3909
4176
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3910
4177
|
|
|
3911
|
-
}, []);
|
|
4178
|
+
}, [shouldValidate]);
|
|
3912
4179
|
return /*#__PURE__*/React__default.createElement("form", {
|
|
4180
|
+
"data-testid": "taf-form",
|
|
3913
4181
|
onSubmit: handleSubmit(onSubmit),
|
|
3914
4182
|
onBlur: onFormBlur
|
|
3915
4183
|
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
3916
|
-
|
|
4184
|
+
sx: {
|
|
4185
|
+
fontSize: '20px',
|
|
4186
|
+
fontWeight: 500,
|
|
4187
|
+
height: '24px'
|
|
4188
|
+
}
|
|
3917
4189
|
}, "TAC"), /*#__PURE__*/React__default.createElement(Typography, {
|
|
3918
|
-
|
|
3919
|
-
|
|
4190
|
+
sx: {
|
|
4191
|
+
fontSize: '14px',
|
|
4192
|
+
margin: '8px 0px'
|
|
4193
|
+
},
|
|
4194
|
+
"data-testid": "form-tac-message"
|
|
3920
4195
|
}, TAC.split('\n').map(function (line) {
|
|
3921
|
-
return /*#__PURE__*/React__default.createElement(
|
|
4196
|
+
return /*#__PURE__*/React__default.createElement(Box, {
|
|
4197
|
+
component: "span",
|
|
3922
4198
|
key: line,
|
|
3923
|
-
|
|
3924
|
-
|
|
4199
|
+
"data-testid": "tafform-tac-message-line",
|
|
4200
|
+
sx: {
|
|
4201
|
+
textIndent: '-0.7em',
|
|
4202
|
+
borderRadius: '3px',
|
|
4203
|
+
paddingRight: '0.7em'
|
|
4204
|
+
}
|
|
3925
4205
|
}, line);
|
|
3926
4206
|
})), /*#__PURE__*/React__default.createElement(TafFormRow, {
|
|
3927
4207
|
disabled: isDisabled,
|
|
3928
|
-
|
|
4208
|
+
onAddChangeGroupBelow: onAddRow,
|
|
4209
|
+
onClearRow: _onClearRow
|
|
3929
4210
|
}), /*#__PURE__*/React__default.createElement(ReactSortable, {
|
|
3930
4211
|
tag: "div",
|
|
3931
4212
|
list: fields,
|
|
@@ -3943,13 +4224,17 @@ var TafForm = function TafForm(_ref) {
|
|
|
3943
4224
|
}, fields.map(function (item, index) {
|
|
3944
4225
|
return /*#__PURE__*/React__default.createElement(TafFormRow, {
|
|
3945
4226
|
field: item,
|
|
3946
|
-
className: classes.formRow,
|
|
3947
4227
|
key: item.id,
|
|
3948
4228
|
index: index,
|
|
3949
|
-
lastRow: fields.length === index + 1,
|
|
3950
4229
|
disabled: isDisabled,
|
|
3951
4230
|
onRemoveChangeGroup: onRemoverow,
|
|
3952
|
-
|
|
4231
|
+
onAddChangeGroupBelow: onAddRow,
|
|
4232
|
+
onAddChangeGroupAbove: function onAddChangeGroupAbove() {
|
|
4233
|
+
return onAddRow(index, true);
|
|
4234
|
+
},
|
|
4235
|
+
onClearRow: function onClearRow() {
|
|
4236
|
+
return _onClearRow(index, true);
|
|
4237
|
+
},
|
|
3953
4238
|
isChangeGroup: true,
|
|
3954
4239
|
dragHandle: /*#__PURE__*/React__default.createElement(DragHandle, {
|
|
3955
4240
|
isDisabled: fields.length === 1 || isDisabled,
|
|
@@ -3957,9 +4242,26 @@ var TafForm = function TafForm(_ref) {
|
|
|
3957
4242
|
index: index
|
|
3958
4243
|
})
|
|
3959
4244
|
});
|
|
3960
|
-
})), !isDisabled && /*#__PURE__*/React__default.createElement(
|
|
4245
|
+
})), !isDisabled && /*#__PURE__*/React__default.createElement(Grid, {
|
|
4246
|
+
container: true,
|
|
4247
|
+
justifyContent: "space-between",
|
|
4248
|
+
alignItems: "center",
|
|
4249
|
+
sx: {
|
|
4250
|
+
marginLeft: 1.5,
|
|
4251
|
+
marginTop: 1
|
|
4252
|
+
}
|
|
4253
|
+
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4254
|
+
item: true
|
|
4255
|
+
}, /*#__PURE__*/React__default.createElement(IssuesButton, {
|
|
4256
|
+
errors: errors,
|
|
4257
|
+
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
4258
|
+
setIsIssuesPaneOpen: setIsIssuesPaneOpen
|
|
4259
|
+
}))), /*#__PURE__*/React__default.createElement(TafFormButtons, {
|
|
4260
|
+
isFormDisabled: isDisabled,
|
|
3961
4261
|
tafAction: tafAction,
|
|
3962
|
-
|
|
4262
|
+
canBe: tafFromBackend.canbe,
|
|
4263
|
+
onTafEditModeButtonPress: onTafEditModeButtonPress,
|
|
4264
|
+
onTafViewModeButtonPress: onTafViewModeButtonPress
|
|
3963
4265
|
}), hiddenInputFields.map(function (field) {
|
|
3964
4266
|
return /*#__PURE__*/React__default.createElement(ReactHookFormHiddenInput, {
|
|
3965
4267
|
name: field,
|
|
@@ -3981,157 +4283,23 @@ var TafForm = function TafForm(_ref) {
|
|
|
3981
4283
|
* See the License for the specific language governing permissions and
|
|
3982
4284
|
* limitations under the License.
|
|
3983
4285
|
*
|
|
3984
|
-
* Copyright
|
|
3985
|
-
* Copyright
|
|
4286
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4287
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3986
4288
|
* */
|
|
3987
|
-
var getMessageType = function getMessageType(taf, tafAction) {
|
|
3988
|
-
if (tafAction === 'CORRECT') {
|
|
3989
|
-
return 'COR';
|
|
3990
|
-
}
|
|
3991
|
-
|
|
3992
|
-
if (tafAction === 'AMEND') {
|
|
3993
|
-
return 'AMD';
|
|
3994
|
-
}
|
|
3995
|
-
|
|
3996
|
-
return taf.messageType;
|
|
3997
|
-
}; // For corrections and amendment we need to add the previousValidStart and End for the TAC converter
|
|
3998
|
-
|
|
3999
|
-
var getAmendedCorrectedTafTimes = function getAmendedCorrectedTafTimes(taf, tafAction) {
|
|
4000
|
-
var previousValidDateStart = taf.previousValidDateStart && tafAction !== 'AMEND' ? taf.previousValidDateStart : taf.validDateStart;
|
|
4001
|
-
var previousValidDateEnd = taf.previousValidDateEnd && tafAction !== 'AMEND' ? taf.previousValidDateEnd : taf.validDateEnd; // For amendment change valid start time to current time
|
|
4002
|
-
// only do this if we're already within the validity period
|
|
4003
|
-
|
|
4004
|
-
if ((tafAction === 'AMEND' || tafAction === 'DRAFT_AMEND') && moment.utc() >= moment.utc(taf.validDateStart)) {
|
|
4005
|
-
var now = moment.utc().format('YYYY-MM-DDTHH:mm:ss[Z]');
|
|
4006
|
-
var validObj = {
|
|
4007
|
-
start: now,
|
|
4008
|
-
end: taf.baseForecast.valid.end
|
|
4009
|
-
};
|
|
4010
|
-
return Object.assign(Object.assign({}, taf), {
|
|
4011
|
-
previousValidDateStart: previousValidDateStart,
|
|
4012
|
-
previousValidDateEnd: previousValidDateEnd,
|
|
4013
|
-
validDateStart: now,
|
|
4014
|
-
baseForecast: Object.assign(Object.assign({}, taf.baseForecast), {
|
|
4015
|
-
valid: validObj
|
|
4016
|
-
})
|
|
4017
|
-
});
|
|
4018
|
-
}
|
|
4019
|
-
|
|
4020
|
-
return Object.assign(Object.assign({}, taf), {
|
|
4021
|
-
previousValidDateStart: previousValidDateStart,
|
|
4022
|
-
previousValidDateEnd: previousValidDateEnd
|
|
4023
|
-
});
|
|
4024
|
-
};
|
|
4025
|
-
var prepareTafValues = function prepareTafValues(_taf, tafAction) {
|
|
4026
|
-
var addEmptyChangeGroup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
4027
|
-
// If action is AMEND/CORRECT/DRAFT_AMEND/DRAFT_CORRECTION - add previous valid start and end
|
|
4028
|
-
// If action is AMEND/DRAFT_AMEND - update validity start time to current time
|
|
4029
|
-
var taf = tafAction === 'AMEND' || tafAction === 'DRAFT_AMEND' || tafAction === 'CORRECT' || tafAction === 'DRAFT_CORRECT' ? getAmendedCorrectedTafTimes(_taf, tafAction) : _taf;
|
|
4030
|
-
return Object.assign(Object.assign(Object.assign(Object.assign({}, taf), {
|
|
4031
|
-
messageType: getMessageType(taf, tafAction),
|
|
4032
|
-
baseForecast: formatFormValues(taf.baseForecast)
|
|
4033
|
-
}), taf.changeGroups && {
|
|
4034
|
-
changeGroups: taf.changeGroups.map(formatFormValues)
|
|
4035
|
-
}), addEmptyChangeGroup && {
|
|
4036
|
-
changeGroups: [emptyChangegroup]
|
|
4037
|
-
});
|
|
4038
|
-
};
|
|
4039
|
-
|
|
4040
|
-
var TafFormWrapper = function TafFormWrapper(_ref) {
|
|
4041
|
-
var tafFromBackend = _ref.tafFromBackend,
|
|
4042
|
-
mode = _ref.mode,
|
|
4043
|
-
tafAction = _ref.tafAction,
|
|
4044
|
-
_ref$TAC = _ref.TAC,
|
|
4045
|
-
TAC = _ref$TAC === void 0 ? '' : _ref$TAC,
|
|
4046
|
-
onFormAction = _ref.onFormAction;
|
|
4047
|
-
var taf = tafFromBackend.taf;
|
|
4048
|
-
var isDisabled = mode === 'view';
|
|
4049
|
-
var defaultValues = prepareTafValues(taf, tafAction, !isDisabled && !taf.changeGroups);
|
|
4050
|
-
var options = {
|
|
4051
|
-
defaultValues: defaultValues,
|
|
4052
|
-
mode: 'onTouched',
|
|
4053
|
-
reValidateMode: 'onChange',
|
|
4054
|
-
criteriaMode: 'all'
|
|
4055
|
-
};
|
|
4056
|
-
return /*#__PURE__*/React__default.createElement(ReactHookFormProvider, {
|
|
4057
|
-
options: options
|
|
4058
|
-
}, /*#__PURE__*/React__default.createElement(TafForm, {
|
|
4059
|
-
isDisabled: isDisabled,
|
|
4060
|
-
tafAction: tafAction,
|
|
4061
|
-
staticTAC: TAC,
|
|
4062
|
-
onFormAction: onFormAction
|
|
4063
|
-
}));
|
|
4064
|
-
};
|
|
4065
|
-
|
|
4066
|
-
var useStyles$6 = makeStyles({
|
|
4067
|
-
dialogHeader: {
|
|
4068
|
-
borderRadius: '3px',
|
|
4069
|
-
border: 'solid 1px #f6f5f5',
|
|
4070
|
-
zIndex: 1,
|
|
4071
|
-
padding: '16px 20px'
|
|
4072
|
-
},
|
|
4073
|
-
dialogTitle: {
|
|
4074
|
-
display: 'flex',
|
|
4075
|
-
alignItems: 'center'
|
|
4076
|
-
},
|
|
4077
|
-
dialogCloseButton: {
|
|
4078
|
-
display: 'flex',
|
|
4079
|
-
justifyContent: 'flex-end'
|
|
4080
|
-
},
|
|
4081
|
-
dialogChildren: {
|
|
4082
|
-
display: 'flex',
|
|
4083
|
-
padding: 20,
|
|
4084
|
-
minHeight: 200,
|
|
4085
|
-
minWidth: 400,
|
|
4086
|
-
height: '100%'
|
|
4087
|
-
}
|
|
4088
|
-
});
|
|
4089
4289
|
|
|
4090
|
-
var
|
|
4091
|
-
var
|
|
4092
|
-
_a.
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
"data-testid": "contentDialog",
|
|
4104
|
-
open: open,
|
|
4105
|
-
onClose: function onClose() {
|
|
4106
|
-
return onFormAction('CLOSE');
|
|
4107
|
-
},
|
|
4108
|
-
maxWidth: other.maxWidth ? other.maxWidth : 'lg',
|
|
4109
|
-
PaperProps: {
|
|
4110
|
-
style: {
|
|
4111
|
-
position: 'inherit'
|
|
4112
|
-
}
|
|
4113
|
-
}
|
|
4114
|
-
}, other), /*#__PURE__*/React.createElement(DialogTitle, {
|
|
4115
|
-
className: classes.dialogHeader
|
|
4116
|
-
}, /*#__PURE__*/React.createElement(Grid, {
|
|
4117
|
-
container: true
|
|
4118
|
-
}, /*#__PURE__*/React.createElement(Grid, {
|
|
4119
|
-
item: true,
|
|
4120
|
-
xs: 11,
|
|
4121
|
-
className: classes.dialogTitle
|
|
4122
|
-
}, titleComponent), /*#__PURE__*/React.createElement(Grid, {
|
|
4123
|
-
item: true,
|
|
4124
|
-
xs: true,
|
|
4125
|
-
className: classes.dialogCloseButton
|
|
4126
|
-
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
4127
|
-
"data-testid": "closeDialog",
|
|
4128
|
-
size: "small",
|
|
4129
|
-
onClick: function onClick() {
|
|
4130
|
-
return onFormAction('CLOSE');
|
|
4131
|
-
}
|
|
4132
|
-
}, /*#__PURE__*/React.createElement(Close, null))))), alertBanner !== null && alertBanner, /*#__PURE__*/React.createElement(DialogContent, {
|
|
4133
|
-
className: classes.dialogChildren
|
|
4134
|
-
}, children));
|
|
4290
|
+
var TabPanel = function TabPanel(_a) {
|
|
4291
|
+
var children = _a.children,
|
|
4292
|
+
value = _a.value,
|
|
4293
|
+
index = _a.index,
|
|
4294
|
+
other = __rest(_a, ["children", "value", "index"]);
|
|
4295
|
+
|
|
4296
|
+
return /*#__PURE__*/React__default.createElement(Box, Object.assign({
|
|
4297
|
+
role: "tabpanel",
|
|
4298
|
+
hidden: value !== index,
|
|
4299
|
+
id: "simple-tabpanel-".concat(index),
|
|
4300
|
+
"aria-labelledby": "simple-tab-".concat(index),
|
|
4301
|
+
"data-testid": "tab-panel-".concat(index)
|
|
4302
|
+
}, other), value === index && children);
|
|
4135
4303
|
};
|
|
4136
4304
|
|
|
4137
4305
|
/* *
|
|
@@ -4147,175 +4315,139 @@ var ContentDialog = function ContentDialog(_a) {
|
|
|
4147
4315
|
* See the License for the specific language governing permissions and
|
|
4148
4316
|
* limitations under the License.
|
|
4149
4317
|
*
|
|
4150
|
-
* Copyright
|
|
4151
|
-
* Copyright
|
|
4318
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4319
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
4152
4320
|
* */
|
|
4153
4321
|
|
|
4154
|
-
var
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
});
|
|
4322
|
+
var TafHeader = function TafHeader(_ref) {
|
|
4323
|
+
var title = _ref.title;
|
|
4324
|
+
return /*#__PURE__*/React__default.createElement(Typography, {
|
|
4325
|
+
sx: {
|
|
4326
|
+
textAlign: 'center',
|
|
4327
|
+
fontWeight: 500,
|
|
4328
|
+
paddingTop: '6px',
|
|
4329
|
+
textTransform: 'capitalize'
|
|
4330
|
+
}
|
|
4331
|
+
}, title);
|
|
4164
4332
|
};
|
|
4165
4333
|
|
|
4166
|
-
var
|
|
4167
|
-
|
|
4168
|
-
|
|
4334
|
+
var location_indicator_mwo = "EHDB";
|
|
4335
|
+
var locations = {
|
|
4336
|
+
EHAM: {
|
|
4337
|
+
validity_duration: 30,
|
|
4338
|
+
activity_period: 6,
|
|
4339
|
+
label: "Schiphol"
|
|
4340
|
+
},
|
|
4341
|
+
EHRD: {
|
|
4342
|
+
validity_duration: 30,
|
|
4343
|
+
activity_period: 6,
|
|
4344
|
+
label: "Rotterdam"
|
|
4345
|
+
},
|
|
4346
|
+
EHGG: {
|
|
4347
|
+
validity_duration: 30,
|
|
4348
|
+
activity_period: 6,
|
|
4349
|
+
label: "Eelde"
|
|
4350
|
+
},
|
|
4351
|
+
EHBK: {
|
|
4352
|
+
validity_duration: 30,
|
|
4353
|
+
activity_period: 6,
|
|
4354
|
+
label: "Maastricht"
|
|
4355
|
+
},
|
|
4356
|
+
EHLE: {
|
|
4357
|
+
validity_duration: 30,
|
|
4358
|
+
activity_period: 6,
|
|
4359
|
+
label: "Lelystad"
|
|
4360
|
+
},
|
|
4361
|
+
TNCB: {
|
|
4362
|
+
validity_duration: 30,
|
|
4363
|
+
activity_period: 6,
|
|
4364
|
+
label: "Bonaire"
|
|
4365
|
+
}
|
|
4366
|
+
};
|
|
4367
|
+
var locationOrder = [
|
|
4368
|
+
"EHAM",
|
|
4369
|
+
"EHRD",
|
|
4370
|
+
"EHLE",
|
|
4371
|
+
"EHGG",
|
|
4372
|
+
"EHBK",
|
|
4373
|
+
"TNCB"
|
|
4374
|
+
];
|
|
4375
|
+
var tafConfig = {
|
|
4376
|
+
location_indicator_mwo: location_indicator_mwo,
|
|
4377
|
+
locations: locations,
|
|
4378
|
+
locationOrder: locationOrder
|
|
4379
|
+
};
|
|
4169
4380
|
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
color: "red"
|
|
4174
|
-
});
|
|
4175
|
-
}
|
|
4381
|
+
var getTafSettings = function getTafSettings() {
|
|
4382
|
+
return tafConfig;
|
|
4383
|
+
};
|
|
4176
4384
|
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4385
|
+
var tafSettings = getTafSettings();
|
|
4386
|
+
var getLocationSetting = function getLocationSetting(location) {
|
|
4387
|
+
var locationSettings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : tafSettings.locations;
|
|
4388
|
+
return locationSettings[location];
|
|
4389
|
+
};
|
|
4390
|
+
var sortTafsOnLocation = function sortTafsOnLocation(tafList) {
|
|
4391
|
+
var locationOrder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : tafSettings.locationOrder;
|
|
4392
|
+
if (!tafList) return [];
|
|
4393
|
+
return _toConsumableArray(tafList).sort(function (_ref, _ref2) {
|
|
4394
|
+
var tafA = _ref.taf;
|
|
4395
|
+
var tafB = _ref2.taf;
|
|
4396
|
+
return locationOrder.indexOf(tafA.location) < locationOrder.indexOf(tafB.location) ? -1 : 1;
|
|
4180
4397
|
});
|
|
4181
4398
|
};
|
|
4399
|
+
var getBaseTime = function getBaseTime(baseTime, location) {
|
|
4400
|
+
var currentBaseTime = moment.utc(baseTime);
|
|
4401
|
+
var activityPeriod = getLocationSetting(location).activity_period;
|
|
4402
|
+
var nextBaseTime = moment.utc(baseTime).add(activityPeriod, 'hours');
|
|
4403
|
+
return {
|
|
4404
|
+
currentBaseTime: currentBaseTime,
|
|
4405
|
+
nextBaseTime: nextBaseTime
|
|
4406
|
+
};
|
|
4407
|
+
};
|
|
4408
|
+
var getTafTimeSlot = function getTafTimeSlot(baseTime, location, status) {
|
|
4409
|
+
var now = moment.utc();
|
|
4182
4410
|
|
|
4183
|
-
var
|
|
4184
|
-
|
|
4185
|
-
|
|
4411
|
+
var _getBaseTime = getBaseTime(baseTime, location),
|
|
4412
|
+
currentBaseTime = _getBaseTime.currentBaseTime,
|
|
4413
|
+
nextBaseTime = _getBaseTime.nextBaseTime;
|
|
4414
|
+
|
|
4415
|
+
if (status === 'EXPIRED') {
|
|
4416
|
+
return 'EXPIRED';
|
|
4186
4417
|
}
|
|
4187
4418
|
|
|
4188
|
-
if (
|
|
4189
|
-
return '
|
|
4419
|
+
if (currentBaseTime < now && nextBaseTime > now) {
|
|
4420
|
+
return 'ACTIVE';
|
|
4190
4421
|
}
|
|
4191
4422
|
|
|
4192
|
-
return '
|
|
4423
|
+
return 'UPCOMING';
|
|
4193
4424
|
};
|
|
4194
|
-
var
|
|
4195
|
-
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4205
|
-
|
|
4206
|
-
|
|
4207
|
-
alignIcon: {
|
|
4208
|
-
display: 'flex',
|
|
4209
|
-
alignSelf: 'center'
|
|
4210
|
-
}
|
|
4211
|
-
});
|
|
4425
|
+
var sortTafTimeSlots = function sortTafTimeSlots(tafList) {
|
|
4426
|
+
var sortedListOnLocation = sortTafsOnLocation(tafList);
|
|
4427
|
+
return sortedListOnLocation.reduce(function (sortedTafList, tafFromBackend) {
|
|
4428
|
+
var taf = tafFromBackend.taf;
|
|
4429
|
+
var timeSlot = getTafTimeSlot(taf.baseTime, taf.location, taf.status);
|
|
4430
|
+
|
|
4431
|
+
if (timeSlot === 'EXPIRED') {
|
|
4432
|
+
sortedTafList.expired.push(tafFromBackend);
|
|
4433
|
+
} else if (timeSlot === 'ACTIVE') {
|
|
4434
|
+
sortedTafList.current.push(tafFromBackend);
|
|
4435
|
+
} else {
|
|
4436
|
+
sortedTafList.upcoming.push(tafFromBackend);
|
|
4437
|
+
}
|
|
4212
4438
|
|
|
4213
|
-
|
|
4214
|
-
|
|
4215
|
-
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
className: classes.cardWrapper
|
|
4226
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4227
|
-
container: true,
|
|
4228
|
-
alignItems: "center",
|
|
4229
|
-
spacing: 1
|
|
4230
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4231
|
-
item: true,
|
|
4232
|
-
xs: 3,
|
|
4233
|
-
sm: 2,
|
|
4234
|
-
md: 1
|
|
4235
|
-
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
4236
|
-
variant: "subtitle2",
|
|
4237
|
-
noWrap: true,
|
|
4238
|
-
className: classes.font
|
|
4239
|
-
}, taf.location)), /*#__PURE__*/React__default.createElement(Grid, {
|
|
4240
|
-
item: true,
|
|
4241
|
-
xs: 3,
|
|
4242
|
-
sm: 3,
|
|
4243
|
-
md: 1,
|
|
4244
|
-
container: true
|
|
4245
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4246
|
-
item: true,
|
|
4247
|
-
xs: 3,
|
|
4248
|
-
sm: 3,
|
|
4249
|
-
md: 3,
|
|
4250
|
-
className: classes.alignIcon
|
|
4251
|
-
}, showTac && /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
4252
|
-
"data-testid": "taflistrow-tactooltip",
|
|
4253
|
-
title: /*#__PURE__*/React__default.createElement("div", {
|
|
4254
|
-
style: {
|
|
4255
|
-
whiteSpace: 'pre-line'
|
|
4256
|
-
}
|
|
4257
|
-
}, TAC),
|
|
4258
|
-
placement: "bottom-start"
|
|
4259
|
-
}, /*#__PURE__*/React__default.createElement(InfoOutlined, {
|
|
4260
|
-
"data-testid": "taflistrow-tacicon",
|
|
4261
|
-
color: "secondary",
|
|
4262
|
-
fontSize: "small"
|
|
4263
|
-
}))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
4264
|
-
item: true,
|
|
4265
|
-
xs: 9,
|
|
4266
|
-
sm: 9,
|
|
4267
|
-
md: 9
|
|
4268
|
-
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
4269
|
-
variant: "subtitle2",
|
|
4270
|
-
className: classes.font,
|
|
4271
|
-
"data-testid": "baseTime"
|
|
4272
|
-
}, baseTime))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
4273
|
-
item: true,
|
|
4274
|
-
xs: 3,
|
|
4275
|
-
sm: 2,
|
|
4276
|
-
md: 1
|
|
4277
|
-
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
4278
|
-
variant: "subtitle2",
|
|
4279
|
-
className: classes.font,
|
|
4280
|
-
"data-testid": "validTimeDate"
|
|
4281
|
-
}, validTimeDate)), /*#__PURE__*/React__default.createElement(Grid, {
|
|
4282
|
-
item: true,
|
|
4283
|
-
xs: 3,
|
|
4284
|
-
sm: 3,
|
|
4285
|
-
md: 6
|
|
4286
|
-
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
4287
|
-
variant: "subtitle2",
|
|
4288
|
-
className: classes.font,
|
|
4289
|
-
"data-testid": "validTimeSlot"
|
|
4290
|
-
}, formatValidToString({
|
|
4291
|
-
start: taf.validDateStart,
|
|
4292
|
-
end: taf.validDateEnd
|
|
4293
|
-
}))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
4294
|
-
item: true,
|
|
4295
|
-
xs: 12,
|
|
4296
|
-
sm: 4,
|
|
4297
|
-
md: 3
|
|
4298
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4299
|
-
container: true,
|
|
4300
|
-
justifyContent: "flex-start",
|
|
4301
|
-
spacing: 2
|
|
4302
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4303
|
-
item: true,
|
|
4304
|
-
xs: 8,
|
|
4305
|
-
container: true,
|
|
4306
|
-
justifyContent: "flex-end"
|
|
4307
|
-
}, taf.status === 'DRAFT' || taf.status === 'DRAFT_CORRECTED' || taf.status === 'DRAFT_AMENDED' ? /*#__PURE__*/React__default.createElement(Button, {
|
|
4308
|
-
color: "secondary",
|
|
4309
|
-
size: "small",
|
|
4310
|
-
"data-testid": "tafRow-draft",
|
|
4311
|
-
startIcon: /*#__PURE__*/React__default.createElement(Create, {
|
|
4312
|
-
fontSize: "small",
|
|
4313
|
-
color: "secondary"
|
|
4314
|
-
})
|
|
4315
|
-
}, getDraftTitle(taf.status)) : getStatusTagList(taf)), /*#__PURE__*/React__default.createElement(Grid, {
|
|
4316
|
-
item: true,
|
|
4317
|
-
className: classes.alignIcon
|
|
4318
|
-
}, taf.status !== 'NEW' && taf.status !== 'DRAFT' && taf.status !== 'DRAFT_CORRECTED' && taf.status !== 'DRAFT_AMENDED' && taf.status !== 'CANCELLED' && listType !== 'EXPIRED' && getActiveStatus(listType, classes.activeStatus))))));
|
|
4439
|
+
return sortedTafList;
|
|
4440
|
+
}, {
|
|
4441
|
+
current: [],
|
|
4442
|
+
upcoming: [],
|
|
4443
|
+
expired: []
|
|
4444
|
+
});
|
|
4445
|
+
};
|
|
4446
|
+
var muiTabA11yProps = function muiTabA11yProps(index) {
|
|
4447
|
+
return {
|
|
4448
|
+
id: "simple-tab-".concat(index),
|
|
4449
|
+
'aria-controls': "simple-tabpanel-".concat(index)
|
|
4450
|
+
};
|
|
4319
4451
|
};
|
|
4320
4452
|
|
|
4321
4453
|
/* *
|
|
@@ -4331,243 +4463,347 @@ var TafListRow = function TafListRow(_ref) {
|
|
|
4331
4463
|
* See the License for the specific language governing permissions and
|
|
4332
4464
|
* limitations under the License.
|
|
4333
4465
|
*
|
|
4334
|
-
* Copyright
|
|
4335
|
-
* Copyright
|
|
4466
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4467
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
4336
4468
|
* */
|
|
4337
|
-
var
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
var baseTime = moment.utc(taf.baseTime);
|
|
4341
|
-
var activityPeriod = locationSettings[taf.location].activity_period;
|
|
4342
|
-
var nextBaseTime = moment.utc(taf.baseTime).add(activityPeriod, 'hours');
|
|
4469
|
+
var EditIcon = createSvgIcon( /*#__PURE__*/React.createElement("path", {
|
|
4470
|
+
d: "m8.332 17.09-.005.001-2.652.604.956-2.542.001-.001.001-.001.857-.744 1.69 1.945-.848.738zm.71.815L20.932 7.577 17.823 4 5.933 14.329l-.01.008.005.005L4.173 19l4.857-1.09-.004-.02.019.02-.002-.005z"
|
|
4471
|
+
}), 'Edit');
|
|
4343
4472
|
|
|
4344
|
-
|
|
4345
|
-
|
|
4473
|
+
var StatusIcon = function StatusIcon(_ref) {
|
|
4474
|
+
var timeSlot = _ref.timeSlot,
|
|
4475
|
+
status = _ref.status;
|
|
4476
|
+
|
|
4477
|
+
if (status === 'NEW') {
|
|
4478
|
+
return null;
|
|
4346
4479
|
}
|
|
4347
4480
|
|
|
4348
|
-
if (
|
|
4349
|
-
return
|
|
4481
|
+
if (status === 'EXPIRED') {
|
|
4482
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
4483
|
+
title: "Expired",
|
|
4484
|
+
placement: "right"
|
|
4485
|
+
}, /*#__PURE__*/React.createElement(Schedule, {
|
|
4486
|
+
"data-testid": "status-expired",
|
|
4487
|
+
fontSize: "small",
|
|
4488
|
+
sx: {
|
|
4489
|
+
transform: 'scaleX(-1)',
|
|
4490
|
+
color: 'geowebColors.buttons.tertiary.disabled.color'
|
|
4491
|
+
}
|
|
4492
|
+
}));
|
|
4350
4493
|
}
|
|
4351
4494
|
|
|
4352
|
-
|
|
4495
|
+
if (status === 'CANCELLED') {
|
|
4496
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
4497
|
+
title: "Cancelled",
|
|
4498
|
+
placement: "right"
|
|
4499
|
+
}, /*#__PURE__*/React.createElement(DoDisturbIcon, {
|
|
4500
|
+
"data-testid": "status-cancelled",
|
|
4501
|
+
fontSize: "small",
|
|
4502
|
+
sx: {
|
|
4503
|
+
color: 'geowebColors.captions.captionError.rgba'
|
|
4504
|
+
}
|
|
4505
|
+
}));
|
|
4506
|
+
}
|
|
4507
|
+
|
|
4508
|
+
if (status === 'DRAFT' || status === 'DRAFT_CORRECTED' || status === 'DRAFT_AMENDED') {
|
|
4509
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
4510
|
+
title: "Draft",
|
|
4511
|
+
placement: "right"
|
|
4512
|
+
}, /*#__PURE__*/React.createElement(SvgIcon, {
|
|
4513
|
+
component: EditIcon,
|
|
4514
|
+
"data-testid": "status-draft",
|
|
4515
|
+
sx: {
|
|
4516
|
+
color: 'geowebColors.buttons.tertiary.default.color'
|
|
4517
|
+
}
|
|
4518
|
+
}));
|
|
4519
|
+
}
|
|
4520
|
+
|
|
4521
|
+
return timeSlot === 'ACTIVE' ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
4522
|
+
title: "Active",
|
|
4523
|
+
placement: "right"
|
|
4524
|
+
}, /*#__PURE__*/React.createElement(CheckCircle, {
|
|
4525
|
+
"data-testid": "status-active",
|
|
4526
|
+
fontSize: "small",
|
|
4527
|
+
sx: {
|
|
4528
|
+
color: 'geowebColors.functional.success'
|
|
4529
|
+
}
|
|
4530
|
+
})) : /*#__PURE__*/React.createElement(Tooltip, {
|
|
4531
|
+
title: "Upcoming",
|
|
4532
|
+
placement: "right"
|
|
4533
|
+
}, /*#__PURE__*/React.createElement(Schedule, {
|
|
4534
|
+
"data-testid": "status-upcoming",
|
|
4535
|
+
fontSize: "small",
|
|
4536
|
+
sx: {
|
|
4537
|
+
color: 'geowebColors.functional.success'
|
|
4538
|
+
}
|
|
4539
|
+
}));
|
|
4353
4540
|
};
|
|
4354
4541
|
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
*
|
|
4360
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4361
|
-
*
|
|
4362
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
4363
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4364
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4365
|
-
* See the License for the specific language governing permissions and
|
|
4366
|
-
* limitations under the License.
|
|
4367
|
-
*
|
|
4368
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4369
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
4370
|
-
* */
|
|
4542
|
+
var TacContainer = function TacContainer(_ref) {
|
|
4543
|
+
var taf = _ref.taf,
|
|
4544
|
+
_ref$isActive = _ref.isActive,
|
|
4545
|
+
isActive = _ref$isActive === void 0 ? false : _ref$isActive;
|
|
4371
4546
|
|
|
4372
|
-
var
|
|
4373
|
-
|
|
4374
|
-
toggleFormDialog = _ref.toggleFormDialog,
|
|
4375
|
-
tafFromBackend = _ref.tafFromBackend,
|
|
4376
|
-
children = _ref.children,
|
|
4377
|
-
_ref$alertBanner = _ref.alertBanner,
|
|
4378
|
-
alertBanner = _ref$alertBanner === void 0 ? null : _ref$alertBanner,
|
|
4379
|
-
onFormAction = _ref.onFormAction;
|
|
4380
|
-
var taf = tafFromBackend ? tafFromBackend.taf : null;
|
|
4381
|
-
|
|
4382
|
-
var _useTafSettings = useTafSettings(tafConfig),
|
|
4383
|
-
locationSettings = _useTafSettings.locations;
|
|
4384
|
-
|
|
4385
|
-
return /*#__PURE__*/React__default.createElement(ContentDialog, {
|
|
4386
|
-
open: open,
|
|
4387
|
-
toggleDialogStatus: toggleFormDialog,
|
|
4388
|
-
titleComponent: /*#__PURE__*/React__default.createElement(TafListRow, {
|
|
4389
|
-
taf: taf,
|
|
4390
|
-
listType: getListType(taf, locationSettings)
|
|
4391
|
-
}),
|
|
4392
|
-
alertBanner: alertBanner,
|
|
4393
|
-
onFormAction: onFormAction
|
|
4394
|
-
}, children);
|
|
4395
|
-
};
|
|
4547
|
+
var _useApiContext = useApiContext(),
|
|
4548
|
+
api = _useApiContext.api;
|
|
4396
4549
|
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
*
|
|
4402
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4403
|
-
*
|
|
4404
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
4405
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4406
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4407
|
-
* See the License for the specific language governing permissions and
|
|
4408
|
-
* limitations under the License.
|
|
4409
|
-
*
|
|
4410
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4411
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
4412
|
-
* */
|
|
4413
|
-
var useStyles$4 = makeStyles({
|
|
4414
|
-
actionButtons: {
|
|
4415
|
-
paddingRight: '98px',
|
|
4416
|
-
paddingTop: '40px',
|
|
4417
|
-
paddingBottom: '16px'
|
|
4418
|
-
}
|
|
4419
|
-
});
|
|
4550
|
+
var _useTACGenerator = useTACGenerator(taf, api.getTAC),
|
|
4551
|
+
_useTACGenerator2 = _slicedToArray(_useTACGenerator, 2),
|
|
4552
|
+
TAC = _useTACGenerator2[0],
|
|
4553
|
+
retrieveTAC = _useTACGenerator2[1];
|
|
4420
4554
|
|
|
4421
|
-
var
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
var
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
justifyContent: "flex-end",
|
|
4430
|
-
"data-testid": "taflist-canbebuttons",
|
|
4431
|
-
spacing: 1,
|
|
4432
|
-
className: classes.actionButtons
|
|
4433
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4434
|
-
item: true
|
|
4435
|
-
}, canBe.includes('CANCELLED') && /*#__PURE__*/React__default.createElement(Button, {
|
|
4436
|
-
"data-testid": "canceltaf",
|
|
4437
|
-
variant: "outlined",
|
|
4438
|
-
color: "secondary",
|
|
4439
|
-
onClick: function onClick() {
|
|
4440
|
-
return onClickTafActionButton(uuid, 'CANCEL');
|
|
4555
|
+
var status = taf.status,
|
|
4556
|
+
location = taf.location,
|
|
4557
|
+
baseTime = taf.baseTime;
|
|
4558
|
+
var locationLabel = getLocationSetting(location).label;
|
|
4559
|
+
var timeSlot = getTafTimeSlot(baseTime, location, status);
|
|
4560
|
+
React__default.useEffect(function () {
|
|
4561
|
+
if (isActive) {
|
|
4562
|
+
retrieveTAC(taf);
|
|
4441
4563
|
}
|
|
4442
|
-
},
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4564
|
+
}, [taf, isActive, retrieveTAC]);
|
|
4565
|
+
return /*#__PURE__*/React__default.createElement(Box, {
|
|
4566
|
+
sx: {
|
|
4567
|
+
marginBottom: '20px'
|
|
4568
|
+
},
|
|
4569
|
+
"data-location": location,
|
|
4570
|
+
className: isActive ? 'active' : null
|
|
4571
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
4572
|
+
sx: {
|
|
4573
|
+
display: 'flex',
|
|
4574
|
+
alignItems: 'center',
|
|
4575
|
+
marginBottom: '2px'
|
|
4450
4576
|
}
|
|
4451
|
-
},
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4577
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
4578
|
+
sx: {
|
|
4579
|
+
width: 20,
|
|
4580
|
+
height: 20,
|
|
4581
|
+
display: 'flex',
|
|
4582
|
+
marginRight: '6px'
|
|
4583
|
+
}
|
|
4584
|
+
}, /*#__PURE__*/React__default.createElement(StatusIcon, {
|
|
4585
|
+
timeSlot: timeSlot,
|
|
4586
|
+
status: status
|
|
4587
|
+
})), /*#__PURE__*/React__default.createElement(Typography, {
|
|
4588
|
+
sx: Object.assign({
|
|
4589
|
+
lineHeight: 1
|
|
4590
|
+
}, isActive && {
|
|
4591
|
+
backgroundColor: 'geowebColors.functional.warningHighlight.rgba',
|
|
4592
|
+
padding: '0 2px',
|
|
4593
|
+
marginLeft: '-2px'
|
|
4594
|
+
})
|
|
4595
|
+
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
4596
|
+
sx: {
|
|
4597
|
+
fontSize: '12px',
|
|
4598
|
+
color: 'geowebColors.captions.captionInformation.rgba'
|
|
4599
|
+
},
|
|
4600
|
+
"data-testid": "tafLocation",
|
|
4601
|
+
component: "span"
|
|
4602
|
+
}, location), /*#__PURE__*/React__default.createElement(Typography, {
|
|
4603
|
+
sx: {
|
|
4604
|
+
fontSize: '12px',
|
|
4605
|
+
marginLeft: '10px'
|
|
4606
|
+
},
|
|
4607
|
+
"data-testid": "tafLocationLabel",
|
|
4608
|
+
component: "span"
|
|
4609
|
+
}, locationLabel))), /*#__PURE__*/React__default.createElement(Box, {
|
|
4610
|
+
sx: {
|
|
4611
|
+
fontSize: '12px',
|
|
4612
|
+
letterSpacing: '0.4px',
|
|
4613
|
+
color: 'geowebColors.captions.captionStatus.rgba'
|
|
4459
4614
|
}
|
|
4460
|
-
},
|
|
4615
|
+
}, TAC.split('\n').map(function (line) {
|
|
4616
|
+
return /*#__PURE__*/React__default.createElement(Box, {
|
|
4617
|
+
component: "span",
|
|
4618
|
+
key: line,
|
|
4619
|
+
sx: {
|
|
4620
|
+
display: 'inline-block'
|
|
4621
|
+
}
|
|
4622
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
4623
|
+
component: "span",
|
|
4624
|
+
sx: Object.assign({
|
|
4625
|
+
display: 'inline',
|
|
4626
|
+
boxDecorationBreak: 'clone',
|
|
4627
|
+
WebkitBoxDecorationBreak: 'clone'
|
|
4628
|
+
}, isActive && {
|
|
4629
|
+
backgroundColor: 'geowebColors.functional.warningHighlight.rgba'
|
|
4630
|
+
})
|
|
4631
|
+
}, line));
|
|
4632
|
+
})));
|
|
4461
4633
|
};
|
|
4462
4634
|
|
|
4463
|
-
var
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4635
|
+
var TacOverview = function TacOverview(_ref) {
|
|
4636
|
+
var _ref$upcomingTafs = _ref.upcomingTafs,
|
|
4637
|
+
upcomingTafs = _ref$upcomingTafs === void 0 ? [] : _ref$upcomingTafs,
|
|
4638
|
+
_ref$currentTafs = _ref.currentTafs,
|
|
4639
|
+
currentTafs = _ref$currentTafs === void 0 ? [] : _ref$currentTafs,
|
|
4640
|
+
_ref$expiredTafs = _ref.expiredTafs,
|
|
4641
|
+
expiredTafs = _ref$expiredTafs === void 0 ? [] : _ref$expiredTafs,
|
|
4642
|
+
_ref$hideTitle = _ref.hideTitle,
|
|
4643
|
+
hideTitle = _ref$hideTitle === void 0 ? false : _ref$hideTitle,
|
|
4644
|
+
_ref$activeTaf = _ref.activeTaf,
|
|
4645
|
+
activeTaf = _ref$activeTaf === void 0 ? null : _ref$activeTaf;
|
|
4646
|
+
|
|
4647
|
+
var _React$useState = React__default.useState(0),
|
|
4648
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
4649
|
+
activeTab = _React$useState2[0],
|
|
4650
|
+
setActiveTab = _React$useState2[1];
|
|
4474
4651
|
|
|
4475
|
-
var
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4652
|
+
var scrollRef = React__default.useRef(null);
|
|
4653
|
+
var tabs = [{
|
|
4654
|
+
title: 'Upcoming',
|
|
4655
|
+
tafList: upcomingTafs
|
|
4656
|
+
}, {
|
|
4657
|
+
title: 'Current & Expired',
|
|
4658
|
+
tafList: sortTafsOnLocation([].concat(_toConsumableArray(currentTafs), _toConsumableArray(expiredTafs)))
|
|
4659
|
+
}];
|
|
4660
|
+
var activeLocation = (activeTaf === null || activeTaf === void 0 ? void 0 : activeTaf.taf.location) || null;
|
|
4479
4661
|
|
|
4480
|
-
|
|
4481
|
-
|
|
4662
|
+
var isActiveLocation = function isActiveLocation(location) {
|
|
4663
|
+
return location === activeLocation;
|
|
4664
|
+
};
|
|
4482
4665
|
|
|
4483
|
-
|
|
4484
|
-
|
|
4666
|
+
var scrollToPosition = React__default.useCallback(function () {
|
|
4667
|
+
if (!scrollRef.current) return;
|
|
4668
|
+
var containerTop = scrollRef.current.getBoundingClientRect().top;
|
|
4669
|
+
var firstLocation = scrollRef.current.querySelector("[data-location=\"".concat(activeLocation, "\"]"));
|
|
4670
|
+
var paddingTop = parseInt(getComputedStyle(scrollRef.current).paddingTop, 10);
|
|
4671
|
+
var newScrollPosition = (firstLocation === null || firstLocation === void 0 ? void 0 : firstLocation.getBoundingClientRect().top) - containerTop + scrollRef.current.scrollTop - paddingTop;
|
|
4672
|
+
scrollRef.current.scrollTo(newScrollPosition, newScrollPosition);
|
|
4673
|
+
}, [activeLocation]);
|
|
4674
|
+
|
|
4675
|
+
var resetScrollPosition = function resetScrollPosition() {
|
|
4676
|
+
return scrollRef.current.scrollTo(0, 0);
|
|
4677
|
+
};
|
|
4485
4678
|
|
|
4486
|
-
|
|
4487
|
-
|
|
4488
|
-
|
|
4679
|
+
var onChangeTab = function onChangeTab(_event, newValue) {
|
|
4680
|
+
setActiveTab(newValue);
|
|
4681
|
+
resetScrollPosition();
|
|
4682
|
+
};
|
|
4683
|
+
|
|
4684
|
+
React__default.useEffect(function () {
|
|
4685
|
+
if (activeLocation) {
|
|
4686
|
+
scrollToPosition();
|
|
4687
|
+
}
|
|
4688
|
+
}, [activeLocation, scrollToPosition]);
|
|
4689
|
+
React__default.useEffect(function () {
|
|
4690
|
+
var SCROLL_DELAY = 1000;
|
|
4691
|
+
var timer = setTimeout(function () {
|
|
4692
|
+
scrollToPosition();
|
|
4693
|
+
}, SCROLL_DELAY);
|
|
4694
|
+
return function () {
|
|
4695
|
+
clearTimeout(timer);
|
|
4696
|
+
};
|
|
4697
|
+
}, [activeTab, scrollToPosition]);
|
|
4698
|
+
return /*#__PURE__*/React__default.createElement(Card, {
|
|
4699
|
+
variant: "outlined",
|
|
4700
|
+
sx: {
|
|
4701
|
+
maxHeight: '100%',
|
|
4702
|
+
overflow: 'hidden',
|
|
4703
|
+
display: 'flex',
|
|
4704
|
+
flexDirection: 'column'
|
|
4705
|
+
}
|
|
4706
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
4707
|
+
sx: {
|
|
4708
|
+
zIndex: 1
|
|
4709
|
+
}
|
|
4710
|
+
}, !hideTitle && /*#__PURE__*/React__default.createElement(TafHeader, {
|
|
4711
|
+
title: "TAC Overview"
|
|
4712
|
+
}), /*#__PURE__*/React__default.createElement(Tabs, {
|
|
4713
|
+
value: activeTab,
|
|
4714
|
+
onChange: onChangeTab,
|
|
4715
|
+
"aria-label": "tabs"
|
|
4716
|
+
}, tabs.map(function (tab, index) {
|
|
4717
|
+
return /*#__PURE__*/React__default.createElement(Tab, Object.assign({
|
|
4718
|
+
key: tab.title,
|
|
4719
|
+
sx: {
|
|
4720
|
+
flexGrow: 1
|
|
4721
|
+
},
|
|
4722
|
+
label: tab.title,
|
|
4723
|
+
"data-testid": "tab-".concat(index)
|
|
4724
|
+
}, muiTabA11yProps(index)));
|
|
4725
|
+
}))), /*#__PURE__*/React__default.createElement(Box, {
|
|
4726
|
+
ref: scrollRef,
|
|
4727
|
+
sx: {
|
|
4728
|
+
padding: '10px',
|
|
4729
|
+
maxHeight: '100%',
|
|
4730
|
+
overflow: 'auto'
|
|
4731
|
+
}
|
|
4732
|
+
}, tabs.map(function (tab, index) {
|
|
4733
|
+
return /*#__PURE__*/React__default.createElement(TabPanel, {
|
|
4734
|
+
key: tab.title,
|
|
4735
|
+
value: activeTab,
|
|
4736
|
+
index: index
|
|
4737
|
+
}, tab.tafList.map(function (_ref2) {
|
|
4738
|
+
var taf = _ref2.taf;
|
|
4739
|
+
return /*#__PURE__*/React__default.createElement(TacContainer, {
|
|
4740
|
+
key: taf.uuid,
|
|
4741
|
+
taf: taf,
|
|
4742
|
+
isActive: isActiveLocation(taf.location)
|
|
4743
|
+
});
|
|
4744
|
+
}));
|
|
4745
|
+
})));
|
|
4489
4746
|
};
|
|
4490
4747
|
|
|
4491
|
-
var
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
_ref$errorCancelTaf = _ref.errorCancelTaf,
|
|
4495
|
-
errorCancelTaf = _ref$errorCancelTaf === void 0 ? [] : _ref$errorCancelTaf,
|
|
4496
|
-
onClickTafActionButton = _ref.onClickTafActionButton;
|
|
4497
|
-
var classes = useStyles$3();
|
|
4498
|
-
var status = tafListItem.taf.status;
|
|
4748
|
+
var TacOverviewIcon = /*#__PURE__*/React.createElement(SvgIcon, null, /*#__PURE__*/React.createElement("path", {
|
|
4749
|
+
d: "M3 3h4v4H3V3zm0 7h4v4H3v-4zm0 7h4v4H3v-4zm7-14h11v4H10V3zm0 7h11v4H10v-4zm0 7h11v4H10v-4z"
|
|
4750
|
+
}));
|
|
4499
4751
|
|
|
4500
|
-
|
|
4501
|
-
|
|
4752
|
+
var TacOverviewMobile = function TacOverviewMobile(_ref) {
|
|
4753
|
+
var upcomingTafs = _ref.upcomingTafs,
|
|
4754
|
+
currentTafs = _ref.currentTafs,
|
|
4755
|
+
expiredTafs = _ref.expiredTafs,
|
|
4756
|
+
activeTaf = _ref.activeTaf,
|
|
4757
|
+
_ref$defaultOpen = _ref.defaultOpen,
|
|
4758
|
+
defaultOpen = _ref$defaultOpen === void 0 ? false : _ref$defaultOpen;
|
|
4502
4759
|
|
|
4503
|
-
var
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4760
|
+
var _React$useState = React.useState(defaultOpen),
|
|
4761
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
4762
|
+
isOpen = _React$useState2[0],
|
|
4763
|
+
toggleOpen = _React$useState2[1];
|
|
4507
4764
|
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
requestTAC(tafListItem.taf);
|
|
4512
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4765
|
+
var onClose = function onClose() {
|
|
4766
|
+
return toggleOpen(false);
|
|
4767
|
+
};
|
|
4513
4768
|
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
return /*#__PURE__*/React__default.createElement(Accordion, Object.assign({
|
|
4517
|
-
"data-testid": "tafListItem",
|
|
4518
|
-
className: classes.accordion
|
|
4519
|
-
}, popOut ? {
|
|
4520
|
-
expanded: false
|
|
4521
|
-
} : {}, {
|
|
4769
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ToolButton, {
|
|
4770
|
+
active: isOpen,
|
|
4522
4771
|
onClick: function onClick() {
|
|
4523
|
-
|
|
4524
|
-
onClickTafActionButton(tafListItem.taf.uuid, fromStatusToAction(tafListItem.taf.status));
|
|
4525
|
-
}
|
|
4772
|
+
return toggleOpen(true);
|
|
4526
4773
|
},
|
|
4527
|
-
|
|
4528
|
-
|
|
4774
|
+
"data-testid": "tac-overview-mobile-button",
|
|
4775
|
+
sx: {
|
|
4776
|
+
display: {
|
|
4777
|
+
xs: 'inline-flex',
|
|
4778
|
+
sm: 'none'
|
|
4779
|
+
},
|
|
4780
|
+
position: 'absolute',
|
|
4781
|
+
right: '8px',
|
|
4782
|
+
top: '30px'
|
|
4529
4783
|
}
|
|
4530
|
-
}), /*#__PURE__*/
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
|
|
4551
|
-
|
|
4552
|
-
})
|
|
4553
|
-
severity: "error",
|
|
4554
|
-
title: "Cancelling this TAF failed, please try again",
|
|
4555
|
-
dataTestId: "tafList-cancelAlert"
|
|
4556
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
4557
|
-
className: classes.formPadding
|
|
4558
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4559
|
-
item: true
|
|
4560
|
-
}, /*#__PURE__*/React__default.createElement(TafFormWrapper, {
|
|
4561
|
-
tafFromBackend: tafListItem,
|
|
4562
|
-
mode: "view",
|
|
4563
|
-
TAC: TAC
|
|
4564
|
-
})), /*#__PURE__*/React__default.createElement(Grid, {
|
|
4565
|
-
item: true
|
|
4566
|
-
}, /*#__PURE__*/React__default.createElement(TafListButtons, {
|
|
4567
|
-
canBe: tafListItem.canbe,
|
|
4568
|
-
uuid: tafListItem.taf.uuid,
|
|
4569
|
-
onClickTafActionButton: onClickTafActionButton
|
|
4570
|
-
}))))));
|
|
4784
|
+
}, TacOverviewIcon), /*#__PURE__*/React.createElement(Dialog, {
|
|
4785
|
+
open: isOpen,
|
|
4786
|
+
onClose: onClose,
|
|
4787
|
+
PaperProps: {
|
|
4788
|
+
sx: {
|
|
4789
|
+
margin: 2,
|
|
4790
|
+
width: '100%',
|
|
4791
|
+
height: '100%'
|
|
4792
|
+
}
|
|
4793
|
+
},
|
|
4794
|
+
"data-testid": "tac-overview-mobile"
|
|
4795
|
+
}, /*#__PURE__*/React.createElement(ToolHeader, {
|
|
4796
|
+
title: "TAC Overview",
|
|
4797
|
+
size: "small",
|
|
4798
|
+
isDraggable: false,
|
|
4799
|
+
onClose: onClose
|
|
4800
|
+
}), /*#__PURE__*/React.createElement(TacOverview, {
|
|
4801
|
+
upcomingTafs: upcomingTafs,
|
|
4802
|
+
currentTafs: currentTafs,
|
|
4803
|
+
expiredTafs: expiredTafs,
|
|
4804
|
+
activeTaf: activeTaf,
|
|
4805
|
+
hideTitle: true
|
|
4806
|
+
})));
|
|
4571
4807
|
};
|
|
4572
4808
|
|
|
4573
4809
|
/* *
|
|
@@ -4583,136 +4819,139 @@ var TafListAccordion = function TafListAccordion(_ref) {
|
|
|
4583
4819
|
* See the License for the specific language governing permissions and
|
|
4584
4820
|
* limitations under the License.
|
|
4585
4821
|
*
|
|
4586
|
-
* Copyright
|
|
4587
|
-
* Copyright
|
|
4822
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4823
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
4588
4824
|
* */
|
|
4589
|
-
var useStyles$2 = makeStyles({
|
|
4590
|
-
listHeaders: {
|
|
4591
|
-
color: '#9d9d9d'
|
|
4592
|
-
},
|
|
4593
|
-
formPadding: {
|
|
4594
|
-
padding: '8px'
|
|
4595
|
-
},
|
|
4596
|
-
paperButton: {
|
|
4597
|
-
width: '100%'
|
|
4598
|
-
}
|
|
4599
|
-
});
|
|
4600
4825
|
|
|
4601
|
-
var
|
|
4602
|
-
|
|
4603
|
-
title = _ref.title,
|
|
4604
|
-
listType = _ref.listType,
|
|
4605
|
-
_ref$errorCancelTaf = _ref.errorCancelTaf,
|
|
4606
|
-
errorCancelTaf = _ref$errorCancelTaf === void 0 ? [] : _ref$errorCancelTaf,
|
|
4607
|
-
onClickTafActionButton = _ref.onClickTafActionButton;
|
|
4608
|
-
var classes = useStyles$2();
|
|
4609
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Typography, {
|
|
4610
|
-
variant: "subtitle2",
|
|
4611
|
-
className: classes.listHeaders
|
|
4612
|
-
}, title), /*#__PURE__*/React__default.createElement("div", {
|
|
4613
|
-
"data-testid": "tafList".concat(listType)
|
|
4614
|
-
}, tafList.map(function (tafListItem) {
|
|
4615
|
-
return /*#__PURE__*/React__default.createElement(TafListAccordion, {
|
|
4616
|
-
key: "".concat(tafListItem.taf.uuid, "-").concat(tafListItem.taf.status),
|
|
4617
|
-
tafListItem: tafListItem,
|
|
4618
|
-
listType: listType,
|
|
4619
|
-
errorCancelTaf: errorCancelTaf,
|
|
4620
|
-
onClickTafActionButton: onClickTafActionButton
|
|
4621
|
-
});
|
|
4622
|
-
})));
|
|
4826
|
+
var formatBaseTime = function formatBaseTime(time) {
|
|
4827
|
+
return time.format('HH:mm DD MMM');
|
|
4623
4828
|
};
|
|
4624
4829
|
|
|
4625
|
-
var
|
|
4626
|
-
|
|
4627
|
-
|
|
4628
|
-
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4830
|
+
var TopTabs = function TopTabs(_ref) {
|
|
4831
|
+
var timeSlot = _ref.timeSlot,
|
|
4832
|
+
_ref$onChangeTimeSlot = _ref.onChangeTimeSlot,
|
|
4833
|
+
onChangeTimeSlot = _ref$onChangeTimeSlot === void 0 ? function () {} : _ref$onChangeTimeSlot,
|
|
4834
|
+
_ref$tafFromBackend = _ref.tafFromBackend,
|
|
4835
|
+
tafFromBackend = _ref$tafFromBackend === void 0 ? {
|
|
4836
|
+
taf: {
|
|
4837
|
+
baseTime: '2022-01-06T12:00:00Z',
|
|
4838
|
+
location: 'EHAM'
|
|
4839
|
+
}
|
|
4840
|
+
} : _ref$tafFromBackend;
|
|
4841
|
+
|
|
4842
|
+
if (!tafFromBackend) {
|
|
4843
|
+
return null;
|
|
4635
4844
|
}
|
|
4636
|
-
});
|
|
4637
4845
|
|
|
4638
|
-
var
|
|
4639
|
-
var tafList = _ref.tafList,
|
|
4640
|
-
isLoading = _ref.isLoading,
|
|
4641
|
-
error = _ref.error,
|
|
4642
|
-
_ref$errorCancelTaf = _ref.errorCancelTaf,
|
|
4643
|
-
errorCancelTaf = _ref$errorCancelTaf === void 0 ? [] : _ref$errorCancelTaf,
|
|
4644
|
-
onClickTafActionButton = _ref.onClickTafActionButton;
|
|
4645
|
-
var classes = useStyles$1();
|
|
4846
|
+
var activeTab = timeSlot === 'UPCOMING' ? 0 : 1;
|
|
4646
4847
|
|
|
4647
|
-
var
|
|
4648
|
-
|
|
4848
|
+
var _getBaseTime = getBaseTime(tafFromBackend.taf.baseTime, tafFromBackend.taf.location),
|
|
4849
|
+
currentBaseTime = _getBaseTime.currentBaseTime,
|
|
4850
|
+
nextBaseTime = _getBaseTime.nextBaseTime;
|
|
4649
4851
|
|
|
4650
|
-
var
|
|
4651
|
-
|
|
4652
|
-
|
|
4852
|
+
var tabs = [{
|
|
4853
|
+
title: "Upcoming ".concat(formatBaseTime(nextBaseTime)),
|
|
4854
|
+
timeSlot: 'UPCOMING'
|
|
4855
|
+
}, {
|
|
4856
|
+
title: "Current ".concat(formatBaseTime(currentBaseTime)),
|
|
4857
|
+
timeSlot: 'ACTIVE'
|
|
4858
|
+
}];
|
|
4653
4859
|
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4860
|
+
var onChangeTab = function onChangeTab(_event, newValue) {
|
|
4861
|
+
onChangeTimeSlot(tabs[newValue].timeSlot);
|
|
4862
|
+
};
|
|
4657
4863
|
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
upcomingTafs.push(taf);
|
|
4672
|
-
}
|
|
4864
|
+
return /*#__PURE__*/React__default.createElement(Tabs, {
|
|
4865
|
+
value: activeTab,
|
|
4866
|
+
onChange: onChangeTab,
|
|
4867
|
+
"aria-label": "timeslot-tabs",
|
|
4868
|
+
"data-testid": "timeslot-tabs",
|
|
4869
|
+
variant: "fullWidth"
|
|
4870
|
+
}, tabs.map(function (tab, index) {
|
|
4871
|
+
return /*#__PURE__*/React__default.createElement(Tab, Object.assign({
|
|
4872
|
+
key: tab.title,
|
|
4873
|
+
label: tab.title,
|
|
4874
|
+
"data-testid": "toptab-".concat(index),
|
|
4875
|
+
sx: {
|
|
4876
|
+
fontSize: 16
|
|
4673
4877
|
}
|
|
4674
|
-
}
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
_iterator.f();
|
|
4678
|
-
}
|
|
4679
|
-
}
|
|
4878
|
+
}, muiTabA11yProps(index)));
|
|
4879
|
+
}));
|
|
4880
|
+
};
|
|
4680
4881
|
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
|
|
4697
|
-
|
|
4698
|
-
|
|
4699
|
-
|
|
4700
|
-
|
|
4701
|
-
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
|
|
4706
|
-
|
|
4707
|
-
|
|
4708
|
-
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
|
|
4712
|
-
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4882
|
+
/* *
|
|
4883
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4884
|
+
* you may not use this file except in compliance with the License.
|
|
4885
|
+
* You may obtain a copy of the License at
|
|
4886
|
+
*
|
|
4887
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4888
|
+
*
|
|
4889
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4890
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4891
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4892
|
+
* See the License for the specific language governing permissions and
|
|
4893
|
+
* limitations under the License.
|
|
4894
|
+
*
|
|
4895
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4896
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
4897
|
+
* */
|
|
4898
|
+
|
|
4899
|
+
var LocationTabs = function LocationTabs(_ref) {
|
|
4900
|
+
var tafList = _ref.tafList,
|
|
4901
|
+
_ref$activeIndex = _ref.activeIndex,
|
|
4902
|
+
activeIndex = _ref$activeIndex === void 0 ? 0 : _ref$activeIndex,
|
|
4903
|
+
_ref$onChangeTab = _ref.onChangeTab,
|
|
4904
|
+
onChangeTab = _ref$onChangeTab === void 0 ? function () {} : _ref$onChangeTab,
|
|
4905
|
+
timeSlot = _ref.timeSlot;
|
|
4906
|
+
return /*#__PURE__*/React.createElement(MenuList, {
|
|
4907
|
+
"data-testid": "location-tabs",
|
|
4908
|
+
sx: {
|
|
4909
|
+
paddingTop: '32px'
|
|
4910
|
+
}
|
|
4911
|
+
}, tafList.map(function (_ref2, index) {
|
|
4912
|
+
var taf = _ref2.taf;
|
|
4913
|
+
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
4914
|
+
key: taf.uuid,
|
|
4915
|
+
selected: index === activeIndex,
|
|
4916
|
+
sx: {
|
|
4917
|
+
backgroundColor: 'geowebColors.cards.cardContainer',
|
|
4918
|
+
borderColor: 'geowebColors.cards.cardContainerBorder',
|
|
4919
|
+
borderWidth: '1px',
|
|
4920
|
+
borderStyle: 'solid',
|
|
4921
|
+
margin: '0 0 4px',
|
|
4922
|
+
height: '56px',
|
|
4923
|
+
justifyContent: 'center',
|
|
4924
|
+
':after': {
|
|
4925
|
+
background: 'none!important'
|
|
4926
|
+
},
|
|
4927
|
+
'&.Mui-selected': {
|
|
4928
|
+
backgroundColor: 'geowebColors.cards.cardContainer',
|
|
4929
|
+
marginRight: '-17px',
|
|
4930
|
+
borderRight: '0px',
|
|
4931
|
+
zIndex: 1
|
|
4932
|
+
}
|
|
4933
|
+
},
|
|
4934
|
+
onClick: function onClick() {
|
|
4935
|
+
return onChangeTab(index);
|
|
4936
|
+
}
|
|
4937
|
+
}, /*#__PURE__*/React.createElement(Box$1, {
|
|
4938
|
+
component: "span",
|
|
4939
|
+
sx: {
|
|
4940
|
+
fontSize: '12px',
|
|
4941
|
+
fontWeight: '500',
|
|
4942
|
+
letterSpacing: '0.09px',
|
|
4943
|
+
'& + svg': {
|
|
4944
|
+
position: 'absolute',
|
|
4945
|
+
bottom: '1px',
|
|
4946
|
+
width: '20px',
|
|
4947
|
+
height: '20px'
|
|
4948
|
+
}
|
|
4949
|
+
}
|
|
4950
|
+
}, taf.location), /*#__PURE__*/React.createElement(StatusIcon, {
|
|
4951
|
+
timeSlot: timeSlot,
|
|
4952
|
+
status: taf.status
|
|
4953
|
+
}));
|
|
4954
|
+
}));
|
|
4716
4955
|
};
|
|
4717
4956
|
|
|
4718
4957
|
/* *
|
|
@@ -4731,285 +4970,544 @@ var TafList = function TafList(_ref) {
|
|
|
4731
4970
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4732
4971
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
4733
4972
|
* */
|
|
4734
|
-
var useStyles = makeStyles({
|
|
4735
|
-
backdrop: {
|
|
4736
|
-
zIndex: 1500,
|
|
4737
|
-
color: '#fff'
|
|
4738
|
-
}
|
|
4739
|
-
});
|
|
4740
4973
|
|
|
4741
|
-
var Spinner = function Spinner() {
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
className: classes.backdrop
|
|
4746
|
-
}, /*#__PURE__*/React__default.createElement(CircularProgress, {
|
|
4974
|
+
var Spinner = function Spinner(props) {
|
|
4975
|
+
return /*#__PURE__*/React__default.createElement(Backdrop, Object.assign({
|
|
4976
|
+
open: true
|
|
4977
|
+
}, props), /*#__PURE__*/React__default.createElement(CircularProgress, {
|
|
4747
4978
|
"data-testid": "spinner",
|
|
4748
4979
|
color: "inherit"
|
|
4749
4980
|
}));
|
|
4750
4981
|
};
|
|
4751
4982
|
|
|
4752
|
-
var
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
4757
|
-
errorCancelTaf = _React$useState2[0],
|
|
4758
|
-
setErrorCancelTaf = _React$useState2[1];
|
|
4759
|
-
|
|
4760
|
-
React__default.useEffect(function () {
|
|
4761
|
-
var cancelErrorMessageHandler = errorCancelTaf.length > 0 ? setTimeout(function () {
|
|
4762
|
-
if (errorCancelTaf.length > 0) {
|
|
4763
|
-
setErrorCancelTaf(errorCancelTaf.slice(1));
|
|
4764
|
-
}
|
|
4765
|
-
}, pollingInterval) : null;
|
|
4766
|
-
return function () {
|
|
4767
|
-
if (cancelErrorMessageHandler !== null) {
|
|
4768
|
-
clearTimeout(cancelErrorMessageHandler);
|
|
4769
|
-
}
|
|
4770
|
-
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4771
|
-
}, [errorCancelTaf]);
|
|
4772
|
-
return [errorCancelTaf, setErrorCancelTaf];
|
|
4773
|
-
};
|
|
4774
|
-
var getSelectedTaf = function getSelectedTaf(selectedTafId, tafList) {
|
|
4775
|
-
if (tafList === null) return undefined;
|
|
4776
|
-
return tafList.find(function (element) {
|
|
4777
|
-
return element.taf.uuid === selectedTafId;
|
|
4778
|
-
});
|
|
4779
|
-
};
|
|
4780
|
-
|
|
4781
|
-
var TafWrapper = function TafWrapper() {
|
|
4782
|
-
var _useApiContext = useApiContext(),
|
|
4783
|
-
api = _useApiContext.api;
|
|
4784
|
-
|
|
4785
|
-
var confirmDialog = useConfirmationDialog();
|
|
4786
|
-
|
|
4787
|
-
var _React$useState3 = React__default.useState(false),
|
|
4788
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
4789
|
-
isTafDialogOpen = _React$useState4[0],
|
|
4790
|
-
setTafDialogOpen = _React$useState4[1];
|
|
4791
|
-
|
|
4792
|
-
var _React$useState5 = React__default.useState(null),
|
|
4793
|
-
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
4794
|
-
selectedTafId = _React$useState6[0],
|
|
4795
|
-
setselectedTafId = _React$useState6[1];
|
|
4983
|
+
var fromActionToStatus = function fromActionToStatus(tafAction) {
|
|
4984
|
+
switch (tafAction) {
|
|
4985
|
+
case 'DRAFT':
|
|
4986
|
+
return 'DRAFT';
|
|
4796
4987
|
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
tafDialogAction = _React$useState8[0],
|
|
4800
|
-
setTafDialogAction = _React$useState8[1];
|
|
4988
|
+
case 'DRAFT_AMEND':
|
|
4989
|
+
return 'DRAFT_AMENDED';
|
|
4801
4990
|
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
errorPostMessage = _React$useState10[0],
|
|
4805
|
-
setErrorPostMessage = _React$useState10[1];
|
|
4991
|
+
case 'DRAFT_CORRECT':
|
|
4992
|
+
return 'DRAFT_CORRECTED';
|
|
4806
4993
|
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
errorPostMessageText = _React$useState12[0],
|
|
4810
|
-
setErrorPostMessageText = _React$useState12[1];
|
|
4994
|
+
case 'PUBLISH':
|
|
4995
|
+
return 'PUBLISHED';
|
|
4811
4996
|
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
showSpinner = _React$useState14[0],
|
|
4815
|
-
setSpinner = _React$useState14[1]; // clear error message for cancel after 10 seconds
|
|
4997
|
+
case 'AMEND':
|
|
4998
|
+
return 'AMENDED';
|
|
4816
4999
|
|
|
5000
|
+
case 'CORRECT':
|
|
5001
|
+
return 'CORRECTED';
|
|
4817
5002
|
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
errorCancelTaf = _useTimeoutCancelErro2[0],
|
|
4821
|
-
setErrorCancelTaf = _useTimeoutCancelErro2[1]; // Retrieve list of tafs
|
|
5003
|
+
case 'CANCEL':
|
|
5004
|
+
return 'CANCELLED';
|
|
4822
5005
|
|
|
5006
|
+
default:
|
|
5007
|
+
return 'NEW';
|
|
5008
|
+
}
|
|
5009
|
+
};
|
|
4823
5010
|
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
5011
|
+
var TafPanel = function TafPanel(_ref) {
|
|
5012
|
+
var tafFromBackend = _ref.tafFromBackend,
|
|
5013
|
+
activeTafIndex = _ref.activeTafIndex,
|
|
5014
|
+
index = _ref.index,
|
|
5015
|
+
_ref$onPostTaf = _ref.onPostTaf,
|
|
5016
|
+
onPostTaf = _ref$onPostTaf === void 0 ? function () {} : _ref$onPostTaf,
|
|
5017
|
+
_ref$onFormDirty = _ref.onFormDirty,
|
|
5018
|
+
onFormDirty = _ref$onFormDirty === void 0 ? function () {
|
|
5019
|
+
return null;
|
|
5020
|
+
} : _ref$onFormDirty,
|
|
5021
|
+
_ref$isIssuesPaneOpen = _ref.isIssuesPaneOpen,
|
|
5022
|
+
isIssuesPaneOpen = _ref$isIssuesPaneOpen === void 0 ? false : _ref$isIssuesPaneOpen,
|
|
5023
|
+
_ref$setIsIssuesPaneO = _ref.setIsIssuesPaneOpen,
|
|
5024
|
+
setIsIssuesPaneOpen = _ref$setIsIssuesPaneO === void 0 ? function () {
|
|
5025
|
+
return null;
|
|
5026
|
+
} : _ref$setIsIssuesPaneO;
|
|
4829
5027
|
|
|
4830
|
-
var
|
|
4831
|
-
|
|
4832
|
-
};
|
|
5028
|
+
var _useApiContext = useApiContext(),
|
|
5029
|
+
api = _useApiContext.api;
|
|
4833
5030
|
|
|
4834
|
-
|
|
5031
|
+
var _React$useState = React__default.useState(false),
|
|
5032
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
5033
|
+
isLoading = _React$useState2[0],
|
|
5034
|
+
setLoading = _React$useState2[1];
|
|
4835
5035
|
|
|
4836
|
-
var
|
|
4837
|
-
|
|
4838
|
-
|
|
5036
|
+
var _React$useState3 = React__default.useState(null),
|
|
5037
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
5038
|
+
error = _React$useState4[0],
|
|
5039
|
+
setError = _React$useState4[1]; // removes cancelled error message
|
|
4839
5040
|
|
|
4840
|
-
setErrorPostMessage(false);
|
|
4841
|
-
setErrorPostMessageText('');
|
|
4842
|
-
setTafDialogOpen(!isTafDialogOpen);
|
|
4843
|
-
};
|
|
4844
5041
|
|
|
4845
5042
|
React__default.useEffect(function () {
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
}
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
title: 'Cancel TAF',
|
|
4856
|
-
description: 'Are you sure you want to cancel this TAF?',
|
|
4857
|
-
confirmLabel: 'Cancel'
|
|
4858
|
-
}).then(function () {
|
|
4859
|
-
var _getSelectedTaf = getSelectedTaf(tafUuid, tafList),
|
|
4860
|
-
taf = _getSelectedTaf.taf;
|
|
4861
|
-
|
|
4862
|
-
postTaf({
|
|
4863
|
-
taf: taf,
|
|
4864
|
-
changeStatusTo: 'CANCELLED'
|
|
4865
|
-
});
|
|
4866
|
-
});
|
|
4867
|
-
} else if (selectedTafId === tafUuid) {
|
|
4868
|
-
setTafDialogAction(action);
|
|
4869
|
-
toggleTafDialog();
|
|
4870
|
-
} else {
|
|
4871
|
-
setTafDialogAction(action);
|
|
4872
|
-
setselectedTafId(tafUuid);
|
|
4873
|
-
}
|
|
4874
|
-
};
|
|
5043
|
+
var cancelErrorTimeout = error && error.type === 'CANCELLED' ? setTimeout(function () {
|
|
5044
|
+
setError(null);
|
|
5045
|
+
}, 10000) : null;
|
|
5046
|
+
return function () {
|
|
5047
|
+
if (cancelErrorTimeout !== null) {
|
|
5048
|
+
clearTimeout(cancelErrorTimeout);
|
|
5049
|
+
}
|
|
5050
|
+
};
|
|
5051
|
+
}, [error]);
|
|
4875
5052
|
|
|
4876
5053
|
var postTaf = function postTaf(data) {
|
|
4877
5054
|
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
5055
|
+
var newError;
|
|
4878
5056
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
4879
5057
|
while (1) {
|
|
4880
5058
|
switch (_context.prev = _context.next) {
|
|
4881
5059
|
case 0:
|
|
4882
|
-
|
|
4883
|
-
|
|
5060
|
+
_context.prev = 0;
|
|
5061
|
+
setLoading(true);
|
|
4884
5062
|
_context.next = 4;
|
|
4885
5063
|
return api.postTaf(data);
|
|
4886
5064
|
|
|
4887
5065
|
case 4:
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
getNewTafList(); // If a post has succeeded remove error message
|
|
5066
|
+
setLoading(false);
|
|
5067
|
+
setError(null);
|
|
5068
|
+
onFormDirty(false); // callback
|
|
4892
5069
|
|
|
4893
|
-
|
|
4894
|
-
_context.next =
|
|
5070
|
+
onPostTaf();
|
|
5071
|
+
_context.next = 16;
|
|
4895
5072
|
break;
|
|
4896
5073
|
|
|
4897
5074
|
case 10:
|
|
4898
5075
|
_context.prev = 10;
|
|
4899
|
-
_context.t0 = _context["catch"](
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
}
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
case 14:
|
|
5076
|
+
_context.t0 = _context["catch"](0);
|
|
5077
|
+
newError = data.changeStatusTo === 'CANCELLED' ? {
|
|
5078
|
+
type: 'CANCELLED',
|
|
5079
|
+
title: 'Cancelling this TAF failed, please try again'
|
|
5080
|
+
} : {
|
|
5081
|
+
type: 'SERVER',
|
|
5082
|
+
title: 'An error has occurred while saving, please try again',
|
|
5083
|
+
message: getAxiosErrorMessage(_context.t0)
|
|
5084
|
+
};
|
|
5085
|
+
setError(newError);
|
|
5086
|
+
setLoading(false);
|
|
5087
|
+
throw _context.t0;
|
|
5088
|
+
|
|
5089
|
+
case 16:
|
|
4914
5090
|
case "end":
|
|
4915
5091
|
return _context.stop();
|
|
4916
5092
|
}
|
|
4917
5093
|
}
|
|
4918
|
-
}, _callee, null, [[
|
|
5094
|
+
}, _callee, null, [[0, 10]]);
|
|
4919
5095
|
}));
|
|
4920
5096
|
};
|
|
4921
5097
|
|
|
4922
|
-
var
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
return 'DRAFT';
|
|
5098
|
+
var getViewMode = function getViewMode(status) {
|
|
5099
|
+
return status === 'NEW' || status === 'DRAFT' || status === 'DRAFT_AMENDED' || status === 'DRAFT_CORRECTED' ? 'edit' : 'view';
|
|
5100
|
+
};
|
|
4926
5101
|
|
|
4927
|
-
|
|
4928
|
-
|
|
5102
|
+
var onTafAction = function onTafAction(action, taf) {
|
|
5103
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
5104
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
5105
|
+
while (1) {
|
|
5106
|
+
switch (_context2.prev = _context2.next) {
|
|
5107
|
+
case 0:
|
|
5108
|
+
_context2.prev = 0;
|
|
5109
|
+
_context2.t0 = action;
|
|
5110
|
+
_context2.next = _context2.t0 === 'DRAFT' ? 4 : _context2.t0 === 'DRAFT_AMEND' ? 4 : _context2.t0 === 'DRAFT_CORRECT' ? 4 : _context2.t0 === 'PUBLISH' ? 4 : _context2.t0 === 'AMEND' ? 4 : _context2.t0 === 'CANCEL' ? 4 : _context2.t0 === 'CORRECT' ? 4 : 7;
|
|
5111
|
+
break;
|
|
4929
5112
|
|
|
4930
|
-
|
|
4931
|
-
|
|
5113
|
+
case 4:
|
|
5114
|
+
_context2.next = 6;
|
|
5115
|
+
return postTaf({
|
|
5116
|
+
taf: taf,
|
|
5117
|
+
changeStatusTo: fromActionToStatus(action)
|
|
5118
|
+
});
|
|
4932
5119
|
|
|
4933
|
-
|
|
4934
|
-
|
|
5120
|
+
case 6:
|
|
5121
|
+
return _context2.abrupt("return", true);
|
|
4935
5122
|
|
|
4936
|
-
|
|
4937
|
-
|
|
5123
|
+
case 7:
|
|
5124
|
+
return _context2.abrupt("return", false);
|
|
4938
5125
|
|
|
4939
|
-
|
|
4940
|
-
|
|
5126
|
+
case 8:
|
|
5127
|
+
_context2.next = 13;
|
|
5128
|
+
break;
|
|
4941
5129
|
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
5130
|
+
case 10:
|
|
5131
|
+
_context2.prev = 10;
|
|
5132
|
+
_context2.t1 = _context2["catch"](0);
|
|
5133
|
+
return _context2.abrupt("return", false);
|
|
5134
|
+
|
|
5135
|
+
case 13:
|
|
5136
|
+
case "end":
|
|
5137
|
+
return _context2.stop();
|
|
5138
|
+
}
|
|
5139
|
+
}
|
|
5140
|
+
}, _callee2, null, [[0, 10]]);
|
|
5141
|
+
}));
|
|
4945
5142
|
};
|
|
4946
5143
|
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
5144
|
+
return /*#__PURE__*/React__default.createElement(TabPanel, {
|
|
5145
|
+
value: activeTafIndex,
|
|
5146
|
+
index: index,
|
|
5147
|
+
"data-testid": "taf-panel".concat(activeTafIndex === index ? '-active' : '')
|
|
5148
|
+
}, /*#__PURE__*/React__default.createElement(TafHeader, {
|
|
5149
|
+
title: getTafStatusLabel(tafFromBackend.taf.status)
|
|
5150
|
+
}), isLoading && /*#__PURE__*/React__default.createElement(Spinner, {
|
|
5151
|
+
"data-testid": "taf-loading",
|
|
5152
|
+
sx: {
|
|
5153
|
+
position: 'absolute',
|
|
5154
|
+
zIndex: 1,
|
|
5155
|
+
color: 'geowebColors.backdrops.white.fill'
|
|
5156
|
+
}
|
|
5157
|
+
}), error && /*#__PURE__*/React__default.createElement(AlertBanner, {
|
|
5158
|
+
severity: "error",
|
|
5159
|
+
title: error.title,
|
|
5160
|
+
info: error.message,
|
|
5161
|
+
dataTestId: "taf-error"
|
|
5162
|
+
}), /*#__PURE__*/React__default.createElement(TafForm, {
|
|
5163
|
+
isDisabled: getViewMode(tafFromBackend.taf.status) === 'view',
|
|
5164
|
+
tafFromBackend: tafFromBackend,
|
|
5165
|
+
onFormAction: onTafAction,
|
|
5166
|
+
onFormDirty: onFormDirty,
|
|
5167
|
+
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
5168
|
+
setIsIssuesPaneOpen: setIsIssuesPaneOpen
|
|
5169
|
+
}));
|
|
5170
|
+
};
|
|
4959
5171
|
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
5172
|
+
/* *
|
|
5173
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5174
|
+
* you may not use this file except in compliance with the License.
|
|
5175
|
+
* You may obtain a copy of the License at
|
|
5176
|
+
*
|
|
5177
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5178
|
+
*
|
|
5179
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5180
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5181
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5182
|
+
* See the License for the specific language governing permissions and
|
|
5183
|
+
* limitations under the License.
|
|
5184
|
+
*
|
|
5185
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5186
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
5187
|
+
* */
|
|
4971
5188
|
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
5189
|
+
var IssuesPaneWrapper = function IssuesPaneWrapper(props) {
|
|
5190
|
+
var _useFormContext = useFormContext(),
|
|
5191
|
+
errors = _useFormContext.formState.errors;
|
|
5192
|
+
|
|
5193
|
+
var errorList = filterDuplicateErrors(getErrors(errors));
|
|
5194
|
+
return /*#__PURE__*/React.createElement(IssuesPane, Object.assign({
|
|
5195
|
+
errorList: errorList
|
|
5196
|
+
}, props));
|
|
5197
|
+
};
|
|
5198
|
+
|
|
5199
|
+
var TafLayout = function TafLayout(_ref) {
|
|
5200
|
+
var _ref$tafList = _ref.tafList,
|
|
5201
|
+
tafList = _ref$tafList === void 0 ? [] : _ref$tafList,
|
|
5202
|
+
_ref$onPostTaf = _ref.onPostTaf,
|
|
5203
|
+
onPostTaf = _ref$onPostTaf === void 0 ? function () {} : _ref$onPostTaf;
|
|
5204
|
+
var confirmDialog = useConfirmationDialog();
|
|
5205
|
+
|
|
5206
|
+
var _useIssuesPane = useIssuesPane(),
|
|
5207
|
+
isIssuesPaneOpen = _useIssuesPane.isIssuesPaneOpen,
|
|
5208
|
+
onToggleIssuesPane = _useIssuesPane.onToggleIssuesPane,
|
|
5209
|
+
onCloseIssuesPane = _useIssuesPane.onCloseIssuesPane,
|
|
5210
|
+
startPosition = _useIssuesPane.startPosition;
|
|
5211
|
+
|
|
5212
|
+
var _React$useState = React__default.useState(sortTafTimeSlots(tafList)),
|
|
5213
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
5214
|
+
_React$useState2$ = _React$useState2[0],
|
|
5215
|
+
upcoming = _React$useState2$.upcoming,
|
|
5216
|
+
current = _React$useState2$.current,
|
|
5217
|
+
expired = _React$useState2$.expired,
|
|
5218
|
+
updateSortedTafs = _React$useState2[1];
|
|
5219
|
+
|
|
5220
|
+
var _current$slice = current.slice(-1),
|
|
5221
|
+
_current$slice2 = _slicedToArray(_current$slice, 1),
|
|
5222
|
+
lastCurrentTaf = _current$slice2[0];
|
|
5223
|
+
|
|
5224
|
+
var _React$useState3 = React__default.useState('UPCOMING'),
|
|
5225
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
5226
|
+
timeSlot = _React$useState4[0],
|
|
5227
|
+
setTimeSlot = _React$useState4[1];
|
|
5228
|
+
|
|
5229
|
+
var _React$useState5 = React__default.useState(upcoming),
|
|
5230
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
5231
|
+
locations = _React$useState6[0],
|
|
5232
|
+
setLocations = _React$useState6[1];
|
|
5233
|
+
|
|
5234
|
+
var _React$useState7 = React__default.useState(0),
|
|
5235
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
5236
|
+
activeTafIndex = _React$useState8[0],
|
|
5237
|
+
setActiveTafIndex = _React$useState8[1];
|
|
5238
|
+
|
|
5239
|
+
var _React$useState9 = React__default.useState(false),
|
|
5240
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
5241
|
+
isFormDirty = _React$useState10[0],
|
|
5242
|
+
setIsFormDirty = _React$useState10[1];
|
|
5243
|
+
|
|
5244
|
+
function onChangeTab(action, value) {
|
|
5245
|
+
if (isFormDirty) {
|
|
5246
|
+
confirmDialog({
|
|
5247
|
+
title: 'Whoops',
|
|
5248
|
+
description: 'Do you want to leave this open TAF without saving it? All changes will be lost.',
|
|
5249
|
+
confirmLabel: 'Exit without saving'
|
|
5250
|
+
}).then(function () {
|
|
5251
|
+
action(value);
|
|
5252
|
+
});
|
|
5253
|
+
} else {
|
|
5254
|
+
action(value);
|
|
4975
5255
|
}
|
|
5256
|
+
}
|
|
5257
|
+
|
|
5258
|
+
var onChangeLocationTab = function onChangeLocationTab(index) {
|
|
5259
|
+
onChangeTab(setActiveTafIndex, index);
|
|
4976
5260
|
};
|
|
4977
5261
|
|
|
4978
|
-
var
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5262
|
+
var onChangeTimeSlot = function onChangeTimeSlot(newTimeSlot) {
|
|
5263
|
+
onChangeTab(changeTimeSlot, newTimeSlot);
|
|
5264
|
+
};
|
|
5265
|
+
|
|
5266
|
+
var changeTimeSlot = function changeTimeSlot(newTimeSlot) {
|
|
5267
|
+
setTimeSlot(newTimeSlot);
|
|
5268
|
+
setLocations(newTimeSlot === 'ACTIVE' ? current : upcoming);
|
|
5269
|
+
setActiveTafIndex(0);
|
|
5270
|
+
};
|
|
5271
|
+
|
|
5272
|
+
React__default.useEffect(function () {
|
|
5273
|
+
var newSortedTafs = sortTafTimeSlots(tafList);
|
|
5274
|
+
var updatedLocations = timeSlot === 'ACTIVE' ? newSortedTafs.current : newSortedTafs.upcoming;
|
|
5275
|
+
updateSortedTafs(sortTafTimeSlots(tafList));
|
|
5276
|
+
setLocations(updatedLocations); // update active index
|
|
5277
|
+
|
|
5278
|
+
var newActiveIndex = updatedLocations.findIndex(function (location) {
|
|
5279
|
+
return location.taf.previousId === locations[activeTafIndex].taf.uuid;
|
|
5280
|
+
});
|
|
5281
|
+
var newIndex = newActiveIndex !== -1 ? newActiveIndex : activeTafIndex;
|
|
5282
|
+
setActiveTafIndex(newIndex); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5283
|
+
}, [tafList, setLocations]);
|
|
5284
|
+
|
|
5285
|
+
if (!tafList) {
|
|
5286
|
+
return null;
|
|
5287
|
+
}
|
|
5288
|
+
|
|
5289
|
+
var activeTaf = locations[activeTafIndex];
|
|
5290
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
|
|
5291
|
+
id: MODAL_DIALOG_ELEMENT,
|
|
5292
|
+
component: "div",
|
|
5293
|
+
sx: {
|
|
5294
|
+
width: '100%',
|
|
5295
|
+
height: '100%',
|
|
5296
|
+
position: 'absolute',
|
|
5297
|
+
overflow: 'hidden',
|
|
5298
|
+
pointerEvents: 'none'
|
|
5299
|
+
}
|
|
5300
|
+
}), /*#__PURE__*/React__default.createElement(Box, {
|
|
5301
|
+
sx: {
|
|
5302
|
+
height: '100%',
|
|
5303
|
+
maxHeight: '100%'
|
|
5304
|
+
}
|
|
5305
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
5306
|
+
sx: {
|
|
5307
|
+
minWidth: 320,
|
|
5308
|
+
maxWidth: 1272,
|
|
5309
|
+
margin: 'auto',
|
|
5310
|
+
height: '100%',
|
|
5311
|
+
display: 'flex',
|
|
5312
|
+
flexDirection: 'column'
|
|
5313
|
+
}
|
|
5314
|
+
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
5315
|
+
container: true,
|
|
5316
|
+
spacing: 2,
|
|
5317
|
+
sx: {
|
|
5318
|
+
paddingLeft: 1,
|
|
5319
|
+
paddingRight: 1
|
|
5320
|
+
}
|
|
5321
|
+
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
5322
|
+
item: true,
|
|
5323
|
+
xs: 12,
|
|
5324
|
+
sm: 9
|
|
5325
|
+
}, /*#__PURE__*/React__default.createElement(TopTabs, {
|
|
5326
|
+
tafFromBackend: lastCurrentTaf,
|
|
5327
|
+
timeSlot: timeSlot,
|
|
5328
|
+
onChangeTimeSlot: onChangeTimeSlot
|
|
5329
|
+
}))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
5330
|
+
container: true,
|
|
5331
|
+
flexGrow: 1,
|
|
5332
|
+
overflow: "hidden"
|
|
5333
|
+
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
5334
|
+
container: true,
|
|
5335
|
+
spacing: 2,
|
|
5336
|
+
sx: {
|
|
5337
|
+
height: '100%',
|
|
5338
|
+
paddingLeft: 1,
|
|
5339
|
+
paddingRight: 1,
|
|
5340
|
+
paddingTop: 2,
|
|
5341
|
+
overflow: 'auto'
|
|
5342
|
+
}
|
|
5343
|
+
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
5344
|
+
item: true,
|
|
5345
|
+
xs: 3,
|
|
5346
|
+
sm: 1
|
|
5347
|
+
}, /*#__PURE__*/React__default.createElement(LocationTabs, {
|
|
5348
|
+
tafList: locations,
|
|
5349
|
+
activeIndex: activeTafIndex,
|
|
5350
|
+
onChangeTab: onChangeLocationTab,
|
|
5351
|
+
timeSlot: timeSlot
|
|
5352
|
+
})), /*#__PURE__*/React__default.createElement(Grid, {
|
|
5353
|
+
item: true,
|
|
5354
|
+
xs: true
|
|
5355
|
+
}, /*#__PURE__*/React__default.createElement(Card, {
|
|
5356
|
+
variant: "outlined",
|
|
5357
|
+
sx: {
|
|
5358
|
+
padding: 1,
|
|
5359
|
+
paddingTop: 0,
|
|
5360
|
+
marginBottom: '12px',
|
|
5361
|
+
position: 'relative'
|
|
5362
|
+
}
|
|
5363
|
+
}, /*#__PURE__*/React__default.createElement(TacOverviewMobile, {
|
|
5364
|
+
upcomingTafs: upcoming,
|
|
5365
|
+
currentTafs: current,
|
|
5366
|
+
expiredTafs: expired,
|
|
5367
|
+
activeTaf: activeTaf
|
|
5368
|
+
}), locations.map(function (tafFromBackend, index) {
|
|
5369
|
+
return /*#__PURE__*/React__default.createElement(TafPanel, {
|
|
5370
|
+
key: tafFromBackend.taf.uuid,
|
|
5371
|
+
activeTafIndex: activeTafIndex,
|
|
5372
|
+
index: index,
|
|
5373
|
+
tafFromBackend: tafFromBackend,
|
|
5374
|
+
onPostTaf: onPostTaf,
|
|
5375
|
+
onFormDirty: setIsFormDirty,
|
|
5376
|
+
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
5377
|
+
setIsIssuesPaneOpen: onToggleIssuesPane
|
|
5378
|
+
});
|
|
5379
|
+
}))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
5380
|
+
item: true,
|
|
5381
|
+
xs: 3,
|
|
5382
|
+
sx: {
|
|
5383
|
+
height: '100%'
|
|
5384
|
+
},
|
|
5385
|
+
display: {
|
|
5386
|
+
xs: 'none',
|
|
5387
|
+
sm: 'block'
|
|
5388
|
+
}
|
|
5389
|
+
}, /*#__PURE__*/React__default.createElement(TacOverview, {
|
|
5390
|
+
upcomingTafs: upcoming,
|
|
5391
|
+
currentTafs: current,
|
|
5392
|
+
expiredTafs: expired,
|
|
5393
|
+
activeTaf: activeTaf
|
|
5394
|
+
})))))), /*#__PURE__*/React__default.createElement(IssuesPaneWrapper, {
|
|
5395
|
+
handleClose: onCloseIssuesPane,
|
|
5396
|
+
isOpen: isIssuesPaneOpen,
|
|
5397
|
+
startPosition: startPosition
|
|
5398
|
+
}));
|
|
5001
5399
|
};
|
|
5002
|
-
|
|
5003
|
-
*
|
|
5004
|
-
*
|
|
5400
|
+
|
|
5401
|
+
/* *
|
|
5402
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5403
|
+
* you may not use this file except in compliance with the License.
|
|
5404
|
+
* You may obtain a copy of the License at
|
|
5405
|
+
*
|
|
5406
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5005
5407
|
*
|
|
5006
|
-
*
|
|
5007
|
-
*
|
|
5008
|
-
|
|
5408
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5409
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5410
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5411
|
+
* See the License for the specific language governing permissions and
|
|
5412
|
+
* limitations under the License.
|
|
5413
|
+
*
|
|
5414
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5415
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
5416
|
+
* */
|
|
5417
|
+
|
|
5418
|
+
var TafWrapper = function TafWrapper(_ref) {
|
|
5419
|
+
var children = _ref.children;
|
|
5420
|
+
return /*#__PURE__*/React.createElement(ConfirmationServiceProvider, null, /*#__PURE__*/React.createElement(ReactHookFormProvider, {
|
|
5421
|
+
options: {
|
|
5422
|
+
mode: 'onTouched',
|
|
5423
|
+
reValidateMode: 'onChange',
|
|
5424
|
+
criteriaMode: 'all'
|
|
5425
|
+
}
|
|
5426
|
+
}, children));
|
|
5427
|
+
};
|
|
5428
|
+
|
|
5429
|
+
var TafModule = function TafModule() {
|
|
5430
|
+
var _useApiContext = useApiContext(),
|
|
5431
|
+
api = _useApiContext.api;
|
|
5432
|
+
|
|
5433
|
+
var _React$useState = React.useState(false),
|
|
5434
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
5435
|
+
isLoading = _React$useState2[0],
|
|
5436
|
+
setLoading = _React$useState2[1];
|
|
5437
|
+
|
|
5438
|
+
var _useApi = useApi(api.getTafList),
|
|
5439
|
+
getTafListError = _useApi.error,
|
|
5440
|
+
isFetchingInitial = _useApi.isLoading,
|
|
5441
|
+
tafList = _useApi.result,
|
|
5442
|
+
fetchNewTafList = _useApi.fetchApiData;
|
|
5443
|
+
|
|
5444
|
+
usePoller([tafList, getTafListError], function () {
|
|
5445
|
+
return fetchNewTafList({});
|
|
5446
|
+
});
|
|
5009
5447
|
|
|
5448
|
+
var reFetchNewTafList = function reFetchNewTafList() {
|
|
5449
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
5450
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
5451
|
+
while (1) {
|
|
5452
|
+
switch (_context.prev = _context.next) {
|
|
5453
|
+
case 0:
|
|
5454
|
+
_context.prev = 0;
|
|
5455
|
+
setLoading(true);
|
|
5456
|
+
_context.next = 4;
|
|
5457
|
+
return fetchNewTafList({});
|
|
5458
|
+
|
|
5459
|
+
case 4:
|
|
5460
|
+
setLoading(false);
|
|
5461
|
+
_context.next = 10;
|
|
5462
|
+
break;
|
|
5463
|
+
|
|
5464
|
+
case 7:
|
|
5465
|
+
_context.prev = 7;
|
|
5466
|
+
_context.t0 = _context["catch"](0);
|
|
5467
|
+
setLoading(false);
|
|
5468
|
+
|
|
5469
|
+
case 10:
|
|
5470
|
+
case "end":
|
|
5471
|
+
return _context.stop();
|
|
5472
|
+
}
|
|
5473
|
+
}
|
|
5474
|
+
}, _callee, null, [[0, 7]]);
|
|
5475
|
+
}));
|
|
5476
|
+
};
|
|
5477
|
+
|
|
5478
|
+
var hasTafListError = getTafListError !== null;
|
|
5479
|
+
|
|
5480
|
+
if (isFetchingInitial) {
|
|
5481
|
+
return /*#__PURE__*/React.createElement(LinearProgress, {
|
|
5482
|
+
color: "secondary",
|
|
5483
|
+
"data-testid": "loading-bar"
|
|
5484
|
+
});
|
|
5485
|
+
}
|
|
5486
|
+
|
|
5487
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
5488
|
+
component: "div",
|
|
5489
|
+
id: "tafmodule",
|
|
5490
|
+
sx: {
|
|
5491
|
+
height: '100%'
|
|
5492
|
+
}
|
|
5493
|
+
}, isLoading && /*#__PURE__*/React.createElement(LinearProgress, {
|
|
5494
|
+
"data-testid": "loading-bar",
|
|
5495
|
+
color: "secondary",
|
|
5496
|
+
sx: {
|
|
5497
|
+
marginBottom: '-4px'
|
|
5498
|
+
}
|
|
5499
|
+
}), hasTafListError && /*#__PURE__*/React.createElement(AlertBanner, {
|
|
5500
|
+
severity: "error",
|
|
5501
|
+
title: "An error has occurred while retrieving the list",
|
|
5502
|
+
info: getTafListError.message
|
|
5503
|
+
}), /*#__PURE__*/React.createElement(TafLayout, {
|
|
5504
|
+
tafList: tafList,
|
|
5505
|
+
onPostTaf: reFetchNewTafList
|
|
5506
|
+
}));
|
|
5507
|
+
};
|
|
5010
5508
|
|
|
5011
|
-
var
|
|
5012
|
-
return /*#__PURE__*/
|
|
5509
|
+
var Wrapper = function Wrapper() {
|
|
5510
|
+
return /*#__PURE__*/React.createElement(TafWrapper, null, /*#__PURE__*/React.createElement(TafModule, null));
|
|
5013
5511
|
};
|
|
5014
5512
|
|
|
5015
5513
|
/* *
|
|
@@ -5028,7 +5526,7 @@ var ConfirmationWrapper = function ConfirmationWrapper() {
|
|
|
5028
5526
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5029
5527
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
5030
5528
|
* */
|
|
5031
|
-
var createApi = function createApi(url, appUrl, auth, setAuth, authTokenUrl, authClientId) {
|
|
5529
|
+
var createApi$1 = function createApi(url, appUrl, auth, setAuth, authTokenUrl, authClientId) {
|
|
5032
5530
|
var axiosInstance = createApiInstance(url, appUrl, auth, setAuth, authTokenUrl, authClientId);
|
|
5033
5531
|
return {
|
|
5034
5532
|
// api data
|
|
@@ -5044,4 +5542,971 @@ var createApi = function createApi(url, appUrl, auth, setAuth, authTokenUrl, aut
|
|
|
5044
5542
|
};
|
|
5045
5543
|
};
|
|
5046
5544
|
|
|
5047
|
-
|
|
5545
|
+
var currentDate = moment.utc().format('YYYY-MM-DD');
|
|
5546
|
+
var tomorrowDate = moment.utc().add(1, 'day').format('YYYY-MM-DD');
|
|
5547
|
+
var airportPeriod = 6;
|
|
5548
|
+
var airportValidity = 40;
|
|
5549
|
+
|
|
5550
|
+
var validDateRange = function validDateRange(refHour, period) {
|
|
5551
|
+
var startHour = period * Math.floor(parseInt(refHour.format('HH'), 10) / period) % 24;
|
|
5552
|
+
var start = refHour.set({
|
|
5553
|
+
hour: startHour,
|
|
5554
|
+
minute: 0,
|
|
5555
|
+
second: 0
|
|
5556
|
+
});
|
|
5557
|
+
var end = start.clone().add(airportValidity, 'hours');
|
|
5558
|
+
return [start.format('YYYY-MM-DDTHH:mm:ss'), end.format('YYYY-MM-DDTHH:mm:ss')];
|
|
5559
|
+
};
|
|
5560
|
+
|
|
5561
|
+
var dateAdd = function dateAdd(refDateAsString, hours) {
|
|
5562
|
+
return moment.utc(refDateAsString).add(hours, 'hours').format('YYYY-MM-DDTHH:mm:ss');
|
|
5563
|
+
};
|
|
5564
|
+
|
|
5565
|
+
var _validDateRange = validDateRange(moment.utc(), airportPeriod),
|
|
5566
|
+
_validDateRange2 = _slicedToArray(_validDateRange, 2),
|
|
5567
|
+
currentValidDateStart = _validDateRange2[0],
|
|
5568
|
+
currentValidDateEnd = _validDateRange2[1];
|
|
5569
|
+
|
|
5570
|
+
var _validDateRange3 = validDateRange(moment.utc().add(6, 'hours'), airportPeriod),
|
|
5571
|
+
_validDateRange4 = _slicedToArray(_validDateRange3, 2),
|
|
5572
|
+
upcomingValidDateStart = _validDateRange4[0],
|
|
5573
|
+
upcomingValidDateEnd = _validDateRange4[1];
|
|
5574
|
+
|
|
5575
|
+
var _validDateRange5 = validDateRange(moment.utc().add(-6, 'hours'), airportPeriod),
|
|
5576
|
+
_validDateRange6 = _slicedToArray(_validDateRange5, 2),
|
|
5577
|
+
expiredValidDateStart = _validDateRange6[0],
|
|
5578
|
+
expiredValidDateEnd = _validDateRange6[1];
|
|
5579
|
+
|
|
5580
|
+
var fakeTafList = [{
|
|
5581
|
+
creationDate: upcomingValidDateStart,
|
|
5582
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
5583
|
+
taf: {
|
|
5584
|
+
uuid: '5f9583fjdf0f337925',
|
|
5585
|
+
baseTime: upcomingValidDateStart,
|
|
5586
|
+
validDateStart: upcomingValidDateStart,
|
|
5587
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5588
|
+
location: 'EHAM',
|
|
5589
|
+
status: 'NEW',
|
|
5590
|
+
type: 'NORMAL',
|
|
5591
|
+
messageType: 'ORG',
|
|
5592
|
+
baseForecast: {
|
|
5593
|
+
valid: {
|
|
5594
|
+
start: upcomingValidDateStart,
|
|
5595
|
+
end: upcomingValidDateEnd
|
|
5596
|
+
}
|
|
5597
|
+
}
|
|
5598
|
+
}
|
|
5599
|
+
}, {
|
|
5600
|
+
creationDate: upcomingValidDateStart,
|
|
5601
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
5602
|
+
taf: {
|
|
5603
|
+
uuid: '5f9583fjd111137925',
|
|
5604
|
+
baseTime: upcomingValidDateStart,
|
|
5605
|
+
validDateStart: upcomingValidDateStart,
|
|
5606
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5607
|
+
location: 'EHRD',
|
|
5608
|
+
status: 'DRAFT',
|
|
5609
|
+
type: 'NORMAL',
|
|
5610
|
+
messageType: 'ORG',
|
|
5611
|
+
baseForecast: {
|
|
5612
|
+
valid: {
|
|
5613
|
+
start: upcomingValidDateStart,
|
|
5614
|
+
end: upcomingValidDateEnd
|
|
5615
|
+
},
|
|
5616
|
+
wind: {
|
|
5617
|
+
direction: 180,
|
|
5618
|
+
speed: 10,
|
|
5619
|
+
unit: 'KT'
|
|
5620
|
+
},
|
|
5621
|
+
cavOK: true
|
|
5622
|
+
}
|
|
5623
|
+
}
|
|
5624
|
+
}, {
|
|
5625
|
+
creationDate: upcomingValidDateStart,
|
|
5626
|
+
canbe: ['CANCELLED', 'AMENDED', 'DISCARDED'],
|
|
5627
|
+
taf: {
|
|
5628
|
+
uuid: '754905485',
|
|
5629
|
+
baseTime: upcomingValidDateStart,
|
|
5630
|
+
previousId: '5f9583fjdf45ff4330f337925',
|
|
5631
|
+
validDateStart: upcomingValidDateStart,
|
|
5632
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5633
|
+
previousValidDateStart: upcomingValidDateStart,
|
|
5634
|
+
previousValidDateEnd: upcomingValidDateEnd,
|
|
5635
|
+
location: 'EHLE',
|
|
5636
|
+
status: 'DRAFT_AMENDED',
|
|
5637
|
+
type: 'NORMAL',
|
|
5638
|
+
messageType: 'AMD',
|
|
5639
|
+
baseForecast: {
|
|
5640
|
+
valid: {
|
|
5641
|
+
start: upcomingValidDateStart,
|
|
5642
|
+
end: upcomingValidDateEnd
|
|
5643
|
+
},
|
|
5644
|
+
visibility: {
|
|
5645
|
+
range: 600,
|
|
5646
|
+
unit: 'M'
|
|
5647
|
+
},
|
|
5648
|
+
wind: {
|
|
5649
|
+
direction: 180,
|
|
5650
|
+
speed: 10,
|
|
5651
|
+
unit: 'KT'
|
|
5652
|
+
},
|
|
5653
|
+
weather: {
|
|
5654
|
+
weather1: 'SN'
|
|
5655
|
+
},
|
|
5656
|
+
cloud: {
|
|
5657
|
+
cloud1: {
|
|
5658
|
+
coverage: 'BKN',
|
|
5659
|
+
height: 35
|
|
5660
|
+
}
|
|
5661
|
+
}
|
|
5662
|
+
},
|
|
5663
|
+
changeGroups: [{
|
|
5664
|
+
change: 'TEMPO',
|
|
5665
|
+
probability: 'PROB30',
|
|
5666
|
+
valid: {
|
|
5667
|
+
start: dateAdd(upcomingValidDateStart, 3),
|
|
5668
|
+
end: dateAdd(upcomingValidDateStart, 4)
|
|
5669
|
+
},
|
|
5670
|
+
visibility: {
|
|
5671
|
+
range: 100,
|
|
5672
|
+
unit: 'M'
|
|
5673
|
+
},
|
|
5674
|
+
cloud: {
|
|
5675
|
+
cloud1: {
|
|
5676
|
+
verticalVisibility: 5
|
|
5677
|
+
}
|
|
5678
|
+
}
|
|
5679
|
+
}]
|
|
5680
|
+
}
|
|
5681
|
+
}, {
|
|
5682
|
+
creationDate: upcomingValidDateStart,
|
|
5683
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
5684
|
+
taf: {
|
|
5685
|
+
uuid: '43545345345',
|
|
5686
|
+
issueDate: upcomingValidDateStart,
|
|
5687
|
+
baseTime: "".concat(currentDate, "T18:00:00Z"),
|
|
5688
|
+
validDateStart: "".concat(currentDate, "T18:00:00Z"),
|
|
5689
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5690
|
+
previousId: 'jkdjkdfjkgdf',
|
|
5691
|
+
previousValidDateStart: upcomingValidDateStart,
|
|
5692
|
+
previousValidDateEnd: upcomingValidDateEnd,
|
|
5693
|
+
location: 'EHLE',
|
|
5694
|
+
status: 'CORRECTED',
|
|
5695
|
+
type: 'NORMAL',
|
|
5696
|
+
messageType: 'COR',
|
|
5697
|
+
baseForecast: {
|
|
5698
|
+
valid: {
|
|
5699
|
+
start: upcomingValidDateStart,
|
|
5700
|
+
end: upcomingValidDateEnd
|
|
5701
|
+
},
|
|
5702
|
+
wind: {
|
|
5703
|
+
direction: 350,
|
|
5704
|
+
speed: 46,
|
|
5705
|
+
gust: 67,
|
|
5706
|
+
unit: 'KT'
|
|
5707
|
+
},
|
|
5708
|
+
cavOK: true
|
|
5709
|
+
},
|
|
5710
|
+
changeGroups: [{
|
|
5711
|
+
change: 'BECMG',
|
|
5712
|
+
valid: {
|
|
5713
|
+
start: dateAdd(upcomingValidDateStart, 1),
|
|
5714
|
+
end: dateAdd(upcomingValidDateStart, 2)
|
|
5715
|
+
},
|
|
5716
|
+
visibility: {
|
|
5717
|
+
range: 1000,
|
|
5718
|
+
unit: 'M'
|
|
5719
|
+
},
|
|
5720
|
+
weather: {
|
|
5721
|
+
weather1: 'MIFG'
|
|
5722
|
+
},
|
|
5723
|
+
cloud: {
|
|
5724
|
+
cloud1: 'NSC'
|
|
5725
|
+
}
|
|
5726
|
+
}, {
|
|
5727
|
+
change: 'FM',
|
|
5728
|
+
valid: {
|
|
5729
|
+
start: dateAdd(upcomingValidDateStart, 2)
|
|
5730
|
+
},
|
|
5731
|
+
visibility: {
|
|
5732
|
+
range: 6000,
|
|
5733
|
+
unit: 'M'
|
|
5734
|
+
},
|
|
5735
|
+
weather: {
|
|
5736
|
+
weather1: '+SHRA'
|
|
5737
|
+
},
|
|
5738
|
+
cloud: {
|
|
5739
|
+
cloud1: {
|
|
5740
|
+
coverage: 'BKN',
|
|
5741
|
+
height: 40
|
|
5742
|
+
},
|
|
5743
|
+
cloud2: {
|
|
5744
|
+
coverage: 'OVC',
|
|
5745
|
+
height: 60,
|
|
5746
|
+
type: 'CB'
|
|
5747
|
+
}
|
|
5748
|
+
}
|
|
5749
|
+
}]
|
|
5750
|
+
}
|
|
5751
|
+
}, {
|
|
5752
|
+
creationDate: upcomingValidDateStart,
|
|
5753
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
5754
|
+
taf: {
|
|
5755
|
+
uuid: '5f9583fjdf45ff4330f337925',
|
|
5756
|
+
issueDate: upcomingValidDateStart,
|
|
5757
|
+
baseTime: upcomingValidDateStart,
|
|
5758
|
+
validDateStart: upcomingValidDateStart,
|
|
5759
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5760
|
+
location: 'EHGG',
|
|
5761
|
+
status: 'PUBLISHED',
|
|
5762
|
+
type: 'NORMAL',
|
|
5763
|
+
messageType: 'ORG',
|
|
5764
|
+
baseForecast: {
|
|
5765
|
+
valid: {
|
|
5766
|
+
start: upcomingValidDateEnd,
|
|
5767
|
+
end: upcomingValidDateEnd
|
|
5768
|
+
},
|
|
5769
|
+
visibility: {
|
|
5770
|
+
range: 600,
|
|
5771
|
+
unit: 'M'
|
|
5772
|
+
},
|
|
5773
|
+
wind: {
|
|
5774
|
+
direction: 180,
|
|
5775
|
+
speed: 10,
|
|
5776
|
+
unit: 'KT'
|
|
5777
|
+
},
|
|
5778
|
+
weather: {
|
|
5779
|
+
weather1: 'SN'
|
|
5780
|
+
},
|
|
5781
|
+
cloud: {
|
|
5782
|
+
cloud1: {
|
|
5783
|
+
coverage: 'BKN',
|
|
5784
|
+
height: 35
|
|
5785
|
+
}
|
|
5786
|
+
}
|
|
5787
|
+
},
|
|
5788
|
+
changeGroups: [{
|
|
5789
|
+
change: 'TEMPO',
|
|
5790
|
+
probability: 'PROB30',
|
|
5791
|
+
valid: {
|
|
5792
|
+
start: dateAdd(upcomingValidDateStart, 1),
|
|
5793
|
+
end: dateAdd(upcomingValidDateStart, 2)
|
|
5794
|
+
},
|
|
5795
|
+
visibility: {
|
|
5796
|
+
range: 200,
|
|
5797
|
+
unit: 'M'
|
|
5798
|
+
},
|
|
5799
|
+
cloud: {
|
|
5800
|
+
cloud1: {
|
|
5801
|
+
verticalVisibility: 5
|
|
5802
|
+
}
|
|
5803
|
+
}
|
|
5804
|
+
}]
|
|
5805
|
+
}
|
|
5806
|
+
}, {
|
|
5807
|
+
creationDate: upcomingValidDateStart,
|
|
5808
|
+
canbe: ['AMENDED'],
|
|
5809
|
+
taf: {
|
|
5810
|
+
uuid: '5464565464',
|
|
5811
|
+
previousId: '5445fghrfg3546456',
|
|
5812
|
+
issueDate: upcomingValidDateStart,
|
|
5813
|
+
baseTime: upcomingValidDateStart,
|
|
5814
|
+
validDateStart: upcomingValidDateStart,
|
|
5815
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5816
|
+
previousValidDateStart: upcomingValidDateStart,
|
|
5817
|
+
previousValidDateEnd: upcomingValidDateEnd,
|
|
5818
|
+
location: 'EHBK',
|
|
5819
|
+
status: 'CANCELLED',
|
|
5820
|
+
type: 'NORMAL',
|
|
5821
|
+
messageType: 'CNL',
|
|
5822
|
+
baseForecast: {
|
|
5823
|
+
valid: {
|
|
5824
|
+
start: upcomingValidDateStart,
|
|
5825
|
+
end: upcomingValidDateEnd
|
|
5826
|
+
},
|
|
5827
|
+
visibility: {
|
|
5828
|
+
range: 600,
|
|
5829
|
+
unit: 'M'
|
|
5830
|
+
},
|
|
5831
|
+
wind: {
|
|
5832
|
+
direction: 180,
|
|
5833
|
+
speed: 10,
|
|
5834
|
+
unit: 'KT'
|
|
5835
|
+
},
|
|
5836
|
+
weather: {
|
|
5837
|
+
weather1: 'SN'
|
|
5838
|
+
},
|
|
5839
|
+
cloud: {
|
|
5840
|
+
cloud1: {
|
|
5841
|
+
coverage: 'BKN',
|
|
5842
|
+
height: 35
|
|
5843
|
+
}
|
|
5844
|
+
}
|
|
5845
|
+
}
|
|
5846
|
+
}
|
|
5847
|
+
}, {
|
|
5848
|
+
creationDate: upcomingValidDateStart,
|
|
5849
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
5850
|
+
taf: {
|
|
5851
|
+
uuid: 'gh56734fghfgh',
|
|
5852
|
+
previousId: '8574jnf93475',
|
|
5853
|
+
issueDate: "".concat(currentDate, "T16:16:00Z"),
|
|
5854
|
+
baseTime: upcomingValidDateStart,
|
|
5855
|
+
validDateStart: upcomingValidDateStart,
|
|
5856
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5857
|
+
previousValidDateStart: upcomingValidDateStart,
|
|
5858
|
+
previousValidDateEnd: upcomingValidDateEnd,
|
|
5859
|
+
location: 'TNCB',
|
|
5860
|
+
status: 'AMENDED',
|
|
5861
|
+
type: 'NORMAL',
|
|
5862
|
+
messageType: 'AMD',
|
|
5863
|
+
baseForecast: {
|
|
5864
|
+
valid: {
|
|
5865
|
+
start: "".concat(currentDate, "T16:12:00Z"),
|
|
5866
|
+
end: upcomingValidDateEnd
|
|
5867
|
+
},
|
|
5868
|
+
visibility: {
|
|
5869
|
+
range: 600,
|
|
5870
|
+
unit: 'M'
|
|
5871
|
+
},
|
|
5872
|
+
wind: {
|
|
5873
|
+
direction: 180,
|
|
5874
|
+
speed: 10,
|
|
5875
|
+
unit: 'KT'
|
|
5876
|
+
},
|
|
5877
|
+
weather: {
|
|
5878
|
+
weather1: 'SN'
|
|
5879
|
+
},
|
|
5880
|
+
cloud: {
|
|
5881
|
+
cloud1: {
|
|
5882
|
+
coverage: 'BKN',
|
|
5883
|
+
height: 35
|
|
5884
|
+
}
|
|
5885
|
+
}
|
|
5886
|
+
}
|
|
5887
|
+
}
|
|
5888
|
+
}, {
|
|
5889
|
+
creationDate: currentValidDateStart,
|
|
5890
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
5891
|
+
taf: {
|
|
5892
|
+
uuid: 'giskdj09845872039',
|
|
5893
|
+
issueDate: currentValidDateStart,
|
|
5894
|
+
baseTime: currentValidDateStart,
|
|
5895
|
+
validDateStart: currentValidDateStart,
|
|
5896
|
+
validDateEnd: currentValidDateEnd,
|
|
5897
|
+
location: 'EHAM',
|
|
5898
|
+
status: 'PUBLISHED',
|
|
5899
|
+
type: 'NORMAL',
|
|
5900
|
+
messageType: 'ORG',
|
|
5901
|
+
baseForecast: {
|
|
5902
|
+
valid: {
|
|
5903
|
+
start: currentValidDateStart,
|
|
5904
|
+
end: currentValidDateEnd
|
|
5905
|
+
},
|
|
5906
|
+
visibility: {
|
|
5907
|
+
range: 500,
|
|
5908
|
+
unit: 'M'
|
|
5909
|
+
},
|
|
5910
|
+
wind: {
|
|
5911
|
+
direction: 200,
|
|
5912
|
+
speed: 20,
|
|
5913
|
+
gust: 35,
|
|
5914
|
+
unit: 'KT'
|
|
5915
|
+
},
|
|
5916
|
+
weather: {
|
|
5917
|
+
weather1: 'SN'
|
|
5918
|
+
},
|
|
5919
|
+
cloud: {
|
|
5920
|
+
cloud1: {
|
|
5921
|
+
coverage: 'BKN',
|
|
5922
|
+
height: 40
|
|
5923
|
+
}
|
|
5924
|
+
}
|
|
5925
|
+
}
|
|
5926
|
+
}
|
|
5927
|
+
}, {
|
|
5928
|
+
creationDate: currentValidDateStart,
|
|
5929
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
5930
|
+
taf: {
|
|
5931
|
+
uuid: 'ghskdj09845872039',
|
|
5932
|
+
baseTime: currentValidDateStart,
|
|
5933
|
+
validDateStart: currentValidDateStart,
|
|
5934
|
+
validDateEnd: currentValidDateEnd,
|
|
5935
|
+
location: 'EHRD',
|
|
5936
|
+
status: 'NEW',
|
|
5937
|
+
type: 'NORMAL',
|
|
5938
|
+
messageType: 'ORG',
|
|
5939
|
+
baseForecast: {
|
|
5940
|
+
valid: {
|
|
5941
|
+
start: currentValidDateStart,
|
|
5942
|
+
end: currentValidDateEnd
|
|
5943
|
+
}
|
|
5944
|
+
}
|
|
5945
|
+
}
|
|
5946
|
+
}, {
|
|
5947
|
+
creationDate: currentValidDateStart,
|
|
5948
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
5949
|
+
taf: {
|
|
5950
|
+
uuid: 'ghskdj09845872040',
|
|
5951
|
+
issueDate: currentValidDateStart,
|
|
5952
|
+
baseTime: currentValidDateStart,
|
|
5953
|
+
validDateStart: currentValidDateStart,
|
|
5954
|
+
validDateEnd: currentValidDateEnd,
|
|
5955
|
+
location: 'EHLE',
|
|
5956
|
+
status: 'NEW',
|
|
5957
|
+
type: 'NORMAL',
|
|
5958
|
+
messageType: 'ORG',
|
|
5959
|
+
baseForecast: {
|
|
5960
|
+
valid: {
|
|
5961
|
+
start: currentValidDateStart,
|
|
5962
|
+
end: currentValidDateEnd
|
|
5963
|
+
}
|
|
5964
|
+
}
|
|
5965
|
+
}
|
|
5966
|
+
}, {
|
|
5967
|
+
creationDate: "".concat(currentDate, "T06:00:00Z"),
|
|
5968
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
5969
|
+
taf: {
|
|
5970
|
+
uuid: 'ghskdj09845872041',
|
|
5971
|
+
issueDate: currentValidDateStart,
|
|
5972
|
+
baseTime: currentValidDateStart,
|
|
5973
|
+
validDateStart: currentValidDateStart,
|
|
5974
|
+
validDateEnd: currentValidDateEnd,
|
|
5975
|
+
location: 'EHGG',
|
|
5976
|
+
status: 'NEW',
|
|
5977
|
+
type: 'NORMAL',
|
|
5978
|
+
messageType: 'ORG',
|
|
5979
|
+
baseForecast: {
|
|
5980
|
+
valid: {
|
|
5981
|
+
start: currentValidDateStart,
|
|
5982
|
+
end: currentValidDateEnd
|
|
5983
|
+
}
|
|
5984
|
+
}
|
|
5985
|
+
}
|
|
5986
|
+
}, {
|
|
5987
|
+
creationDate: "".concat(currentDate, "T06:00:00Z"),
|
|
5988
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
5989
|
+
taf: {
|
|
5990
|
+
uuid: 'ghskdj09845872042',
|
|
5991
|
+
issueDate: currentValidDateStart,
|
|
5992
|
+
baseTime: currentValidDateStart,
|
|
5993
|
+
validDateStart: currentValidDateStart,
|
|
5994
|
+
validDateEnd: currentValidDateEnd,
|
|
5995
|
+
location: 'EHBK',
|
|
5996
|
+
status: 'NEW',
|
|
5997
|
+
type: 'NORMAL',
|
|
5998
|
+
messageType: 'ORG',
|
|
5999
|
+
baseForecast: {
|
|
6000
|
+
valid: {
|
|
6001
|
+
start: currentValidDateStart,
|
|
6002
|
+
end: currentValidDateEnd
|
|
6003
|
+
}
|
|
6004
|
+
}
|
|
6005
|
+
}
|
|
6006
|
+
}, {
|
|
6007
|
+
creationDate: "".concat(currentDate, "T06:00:00Z"),
|
|
6008
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6009
|
+
taf: {
|
|
6010
|
+
uuid: 'ghskdj09845872043',
|
|
6011
|
+
issueDate: currentValidDateStart,
|
|
6012
|
+
baseTime: currentValidDateStart,
|
|
6013
|
+
validDateStart: currentValidDateStart,
|
|
6014
|
+
validDateEnd: currentValidDateEnd,
|
|
6015
|
+
location: 'TNCB',
|
|
6016
|
+
status: 'NEW',
|
|
6017
|
+
type: 'NORMAL',
|
|
6018
|
+
messageType: 'ORG',
|
|
6019
|
+
baseForecast: {
|
|
6020
|
+
valid: {
|
|
6021
|
+
start: currentValidDateStart,
|
|
6022
|
+
end: currentValidDateEnd
|
|
6023
|
+
}
|
|
6024
|
+
}
|
|
6025
|
+
}
|
|
6026
|
+
}, {
|
|
6027
|
+
creationDate: expiredValidDateStart,
|
|
6028
|
+
canbe: [],
|
|
6029
|
+
taf: {
|
|
6030
|
+
uuid: 'sdkjhsdf90845890',
|
|
6031
|
+
issueDate: expiredValidDateStart,
|
|
6032
|
+
baseTime: expiredValidDateStart,
|
|
6033
|
+
validDateStart: expiredValidDateStart,
|
|
6034
|
+
validDateEnd: expiredValidDateEnd,
|
|
6035
|
+
location: 'EHAM',
|
|
6036
|
+
status: 'EXPIRED',
|
|
6037
|
+
type: 'NORMAL',
|
|
6038
|
+
messageType: 'ORG',
|
|
6039
|
+
baseForecast: {
|
|
6040
|
+
valid: {
|
|
6041
|
+
start: expiredValidDateStart,
|
|
6042
|
+
end: expiredValidDateEnd
|
|
6043
|
+
},
|
|
6044
|
+
cavOK: true,
|
|
6045
|
+
wind: {
|
|
6046
|
+
direction: 50,
|
|
6047
|
+
speed: 5,
|
|
6048
|
+
unit: 'KT'
|
|
6049
|
+
}
|
|
6050
|
+
},
|
|
6051
|
+
changeGroups: [{
|
|
6052
|
+
change: 'BECMG',
|
|
6053
|
+
valid: {
|
|
6054
|
+
start: dateAdd(expiredValidDateStart, 1),
|
|
6055
|
+
end: dateAdd(expiredValidDateStart, 4)
|
|
6056
|
+
},
|
|
6057
|
+
visibility: {
|
|
6058
|
+
range: 1000,
|
|
6059
|
+
unit: 'M'
|
|
6060
|
+
},
|
|
6061
|
+
weather: {
|
|
6062
|
+
weather1: 'MIFG'
|
|
6063
|
+
}
|
|
6064
|
+
}, {
|
|
6065
|
+
change: 'FM',
|
|
6066
|
+
valid: {
|
|
6067
|
+
start: dateAdd(expiredValidDateStart, 5)
|
|
6068
|
+
},
|
|
6069
|
+
visibility: {
|
|
6070
|
+
range: 6000,
|
|
6071
|
+
unit: 'M'
|
|
6072
|
+
},
|
|
6073
|
+
weather: {
|
|
6074
|
+
weather1: '+SHRA'
|
|
6075
|
+
},
|
|
6076
|
+
cloud: {
|
|
6077
|
+
cloud1: {
|
|
6078
|
+
coverage: 'BKN',
|
|
6079
|
+
height: 40
|
|
6080
|
+
},
|
|
6081
|
+
cloud2: {
|
|
6082
|
+
coverage: 'OVC',
|
|
6083
|
+
height: 60,
|
|
6084
|
+
type: 'CB'
|
|
6085
|
+
}
|
|
6086
|
+
}
|
|
6087
|
+
}]
|
|
6088
|
+
}
|
|
6089
|
+
}];
|
|
6090
|
+
var fakeNewTaf = {
|
|
6091
|
+
creationDate: "".concat(currentDate, "T12:00:00Z"),
|
|
6092
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6093
|
+
taf: {
|
|
6094
|
+
type: 'NORMAL',
|
|
6095
|
+
messageType: 'ORG',
|
|
6096
|
+
status: 'NEW',
|
|
6097
|
+
uuid: '5f9583fjdf0445332f337925',
|
|
6098
|
+
baseTime: "".concat(currentDate, "T12:00:00Z"),
|
|
6099
|
+
validDateStart: "".concat(currentDate, "T12:00:00Z"),
|
|
6100
|
+
validDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6101
|
+
location: 'EHBK',
|
|
6102
|
+
baseForecast: {
|
|
6103
|
+
valid: {
|
|
6104
|
+
start: "".concat(currentDate, "T12:00:00Z"),
|
|
6105
|
+
end: "".concat(tomorrowDate, "T18:00:00Z")
|
|
6106
|
+
}
|
|
6107
|
+
}
|
|
6108
|
+
}
|
|
6109
|
+
};
|
|
6110
|
+
({
|
|
6111
|
+
creationDate: "2022-01-06T12:00:00Z",
|
|
6112
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6113
|
+
taf: Object.assign(Object.assign({}, fakeNewTaf.taf), {
|
|
6114
|
+
baseTime: "2022-01-06T12:00:00Z",
|
|
6115
|
+
validDateStart: "2022-01-06T12:00:00Z",
|
|
6116
|
+
validDateEnd: "2022-01-07T18:00:00Z",
|
|
6117
|
+
baseForecast: {
|
|
6118
|
+
valid: {
|
|
6119
|
+
start: "2022-01-06T12:00:00Z",
|
|
6120
|
+
end: "2022-01-07T18:00:00Z"
|
|
6121
|
+
}
|
|
6122
|
+
}
|
|
6123
|
+
})
|
|
6124
|
+
});
|
|
6125
|
+
var fakePublishedTaf = {
|
|
6126
|
+
creationDate: "".concat(currentDate, "T12:00:00Z"),
|
|
6127
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
6128
|
+
taf: {
|
|
6129
|
+
uuid: 'slsdkjg-023895',
|
|
6130
|
+
issueDate: "".concat(currentDate, "T12:00:00Z"),
|
|
6131
|
+
baseTime: "".concat(currentDate, "T12:00:00Z"),
|
|
6132
|
+
validDateStart: "".concat(currentDate, "T12:00:00Z"),
|
|
6133
|
+
validDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6134
|
+
location: 'EHLE',
|
|
6135
|
+
status: 'PUBLISHED',
|
|
6136
|
+
type: 'NORMAL',
|
|
6137
|
+
messageType: 'ORG',
|
|
6138
|
+
baseForecast: {
|
|
6139
|
+
valid: {
|
|
6140
|
+
start: "".concat(currentDate, "T12:00:00Z"),
|
|
6141
|
+
end: "".concat(tomorrowDate, "T18:00:00Z")
|
|
6142
|
+
},
|
|
6143
|
+
wind: {
|
|
6144
|
+
direction: 50,
|
|
6145
|
+
speed: 5,
|
|
6146
|
+
unit: 'KT'
|
|
6147
|
+
},
|
|
6148
|
+
cavOK: true
|
|
6149
|
+
},
|
|
6150
|
+
changeGroups: [{
|
|
6151
|
+
change: 'FM',
|
|
6152
|
+
valid: {
|
|
6153
|
+
start: "".concat(currentDate, "T12:00:00Z")
|
|
6154
|
+
},
|
|
6155
|
+
visibility: {
|
|
6156
|
+
range: 6000,
|
|
6157
|
+
unit: 'M'
|
|
6158
|
+
},
|
|
6159
|
+
weather: {
|
|
6160
|
+
weather1: '+SHRA'
|
|
6161
|
+
},
|
|
6162
|
+
wind: {
|
|
6163
|
+
direction: 10,
|
|
6164
|
+
speed: 10,
|
|
6165
|
+
unit: 'KT',
|
|
6166
|
+
gust: 35
|
|
6167
|
+
},
|
|
6168
|
+
cloud: {
|
|
6169
|
+
cloud1: {
|
|
6170
|
+
coverage: 'BKN',
|
|
6171
|
+
height: 40
|
|
6172
|
+
},
|
|
6173
|
+
cloud2: {
|
|
6174
|
+
coverage: 'OVC',
|
|
6175
|
+
height: 60,
|
|
6176
|
+
type: 'CB'
|
|
6177
|
+
}
|
|
6178
|
+
}
|
|
6179
|
+
}, {
|
|
6180
|
+
change: 'BECMG',
|
|
6181
|
+
valid: {
|
|
6182
|
+
start: "".concat(currentDate, "T23:00:00Z"),
|
|
6183
|
+
end: "".concat(tomorrowDate, "T00:00:00Z")
|
|
6184
|
+
},
|
|
6185
|
+
wind: {
|
|
6186
|
+
direction: 150,
|
|
6187
|
+
speed: 5,
|
|
6188
|
+
unit: 'KT'
|
|
6189
|
+
},
|
|
6190
|
+
visibility: {
|
|
6191
|
+
range: 1000,
|
|
6192
|
+
unit: 'M'
|
|
6193
|
+
},
|
|
6194
|
+
weather: {
|
|
6195
|
+
weather1: 'MIFG'
|
|
6196
|
+
}
|
|
6197
|
+
}]
|
|
6198
|
+
}
|
|
6199
|
+
};
|
|
6200
|
+
({
|
|
6201
|
+
creationDate: "2022-01-06T12:00:00Z",
|
|
6202
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
6203
|
+
taf: Object.assign(Object.assign({}, fakePublishedTaf.taf), {
|
|
6204
|
+
location: 'EHGG',
|
|
6205
|
+
baseTime: "2022-01-06T12:00:00Z",
|
|
6206
|
+
issueDate: "2022-01-06T12:00:00Z",
|
|
6207
|
+
validDateStart: "2022-01-06T12:00:00Z",
|
|
6208
|
+
validDateEnd: "2022-01-07T18:00:00Z",
|
|
6209
|
+
baseForecast: Object.assign(Object.assign({}, fakePublishedTaf.taf.baseForecast), {
|
|
6210
|
+
valid: {
|
|
6211
|
+
start: "2022-01-06T12:00:00Z",
|
|
6212
|
+
end: "2022-01-07T18:00:00Z"
|
|
6213
|
+
}
|
|
6214
|
+
}),
|
|
6215
|
+
changeGroups: [{
|
|
6216
|
+
change: 'FM',
|
|
6217
|
+
valid: {
|
|
6218
|
+
start: "2022-01-06T12:00:00Z"
|
|
6219
|
+
},
|
|
6220
|
+
visibility: {
|
|
6221
|
+
range: 6000,
|
|
6222
|
+
unit: 'M'
|
|
6223
|
+
},
|
|
6224
|
+
weather: {
|
|
6225
|
+
weather1: '+SHRA'
|
|
6226
|
+
},
|
|
6227
|
+
wind: {
|
|
6228
|
+
direction: 10,
|
|
6229
|
+
speed: 10,
|
|
6230
|
+
unit: 'KT',
|
|
6231
|
+
gust: 35
|
|
6232
|
+
},
|
|
6233
|
+
cloud: {
|
|
6234
|
+
cloud1: {
|
|
6235
|
+
coverage: 'BKN',
|
|
6236
|
+
height: 40
|
|
6237
|
+
},
|
|
6238
|
+
cloud2: {
|
|
6239
|
+
coverage: 'OVC',
|
|
6240
|
+
height: 60,
|
|
6241
|
+
type: 'CB'
|
|
6242
|
+
}
|
|
6243
|
+
}
|
|
6244
|
+
}, {
|
|
6245
|
+
change: 'BECMG',
|
|
6246
|
+
valid: {
|
|
6247
|
+
start: "2022-01-06T23:00:00Z",
|
|
6248
|
+
end: "2022-01-07T00:00:00Z"
|
|
6249
|
+
},
|
|
6250
|
+
wind: {
|
|
6251
|
+
direction: 150,
|
|
6252
|
+
speed: 5,
|
|
6253
|
+
unit: 'KT'
|
|
6254
|
+
},
|
|
6255
|
+
visibility: {
|
|
6256
|
+
range: 1000,
|
|
6257
|
+
unit: 'M'
|
|
6258
|
+
},
|
|
6259
|
+
weather: {
|
|
6260
|
+
weather1: 'MIFG'
|
|
6261
|
+
}
|
|
6262
|
+
}]
|
|
6263
|
+
})
|
|
6264
|
+
});
|
|
6265
|
+
var fakeDraftTaf = {
|
|
6266
|
+
creationDate: "".concat(currentDate, "T18:00:00Z"),
|
|
6267
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6268
|
+
taf: {
|
|
6269
|
+
uuid: '5f9583fjdf0f337925',
|
|
6270
|
+
baseTime: "".concat(currentDate, "T18:00:00Z"),
|
|
6271
|
+
validDateStart: "".concat(currentDate, "T18:00:00Z"),
|
|
6272
|
+
validDateEnd: "".concat(tomorrowDate, "T23:59:00Z"),
|
|
6273
|
+
location: 'EHLE',
|
|
6274
|
+
status: 'DRAFT',
|
|
6275
|
+
type: 'NORMAL',
|
|
6276
|
+
messageType: 'ORG',
|
|
6277
|
+
baseForecast: {
|
|
6278
|
+
valid: {
|
|
6279
|
+
start: "".concat(currentDate, "T18:00:00Z"),
|
|
6280
|
+
end: "".concat(tomorrowDate, "T23:59:00Z")
|
|
6281
|
+
},
|
|
6282
|
+
wind: {
|
|
6283
|
+
direction: 150,
|
|
6284
|
+
speed: 5,
|
|
6285
|
+
unit: 'KT'
|
|
6286
|
+
},
|
|
6287
|
+
visibility: {
|
|
6288
|
+
range: 1000,
|
|
6289
|
+
unit: 'M'
|
|
6290
|
+
},
|
|
6291
|
+
weather: {
|
|
6292
|
+
weather1: 'BCFG'
|
|
6293
|
+
},
|
|
6294
|
+
cloud: {
|
|
6295
|
+
cloud1: {
|
|
6296
|
+
coverage: 'FEW',
|
|
6297
|
+
height: 15
|
|
6298
|
+
}
|
|
6299
|
+
}
|
|
6300
|
+
}
|
|
6301
|
+
}
|
|
6302
|
+
};
|
|
6303
|
+
({
|
|
6304
|
+
creationDate: "2022-01-06T18:00:00Z",
|
|
6305
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6306
|
+
taf: Object.assign(Object.assign({}, fakeDraftTaf.taf), {
|
|
6307
|
+
baseTime: "2022-01-06T18:00:00Z",
|
|
6308
|
+
validDateStart: "2022-01-06T18:00:00Z",
|
|
6309
|
+
validDateEnd: "2022-01-07T23:59:00Z",
|
|
6310
|
+
baseForecast: Object.assign(Object.assign({}, fakeDraftTaf.taf.baseForecast), {
|
|
6311
|
+
valid: {
|
|
6312
|
+
start: "2022-01-06T18:00:00Z",
|
|
6313
|
+
end: "2022-01-07T23:59:00Z"
|
|
6314
|
+
}
|
|
6315
|
+
})
|
|
6316
|
+
})
|
|
6317
|
+
});
|
|
6318
|
+
var fakeDraftAmendmentTaf = {
|
|
6319
|
+
creationDate: "".concat(currentDate, "T14:00:00Z"),
|
|
6320
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6321
|
+
taf: {
|
|
6322
|
+
uuid: '954905487',
|
|
6323
|
+
previousId: '5f9583fjdf45ff4330f337925',
|
|
6324
|
+
issueDate: "".concat(currentDate, "T14:00:00Z"),
|
|
6325
|
+
baseTime: "".concat(currentDate, "T12:00:00Z"),
|
|
6326
|
+
validDateStart: "".concat(currentDate, "T14:00:00Z"),
|
|
6327
|
+
validDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6328
|
+
previousValidDateStart: "".concat(currentDate, "T12:00:00Z"),
|
|
6329
|
+
previousValidDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6330
|
+
location: 'EHAM',
|
|
6331
|
+
status: 'DRAFT_AMENDED',
|
|
6332
|
+
type: 'NORMAL',
|
|
6333
|
+
messageType: 'AMD',
|
|
6334
|
+
baseForecast: {
|
|
6335
|
+
valid: {
|
|
6336
|
+
start: "".concat(currentDate, "T14:00:00Z"),
|
|
6337
|
+
end: "".concat(tomorrowDate, "T18:00:00Z")
|
|
6338
|
+
},
|
|
6339
|
+
visibility: {
|
|
6340
|
+
range: 600,
|
|
6341
|
+
unit: 'M'
|
|
6342
|
+
},
|
|
6343
|
+
wind: {
|
|
6344
|
+
direction: 180,
|
|
6345
|
+
speed: 10,
|
|
6346
|
+
unit: 'KT'
|
|
6347
|
+
},
|
|
6348
|
+
weather: {
|
|
6349
|
+
weather1: 'SN'
|
|
6350
|
+
},
|
|
6351
|
+
cloud: {
|
|
6352
|
+
cloud1: {
|
|
6353
|
+
coverage: 'BKN',
|
|
6354
|
+
height: 35
|
|
6355
|
+
}
|
|
6356
|
+
}
|
|
6357
|
+
},
|
|
6358
|
+
changeGroups: [{
|
|
6359
|
+
change: 'TEMPO',
|
|
6360
|
+
probability: 'PROB30',
|
|
6361
|
+
valid: {
|
|
6362
|
+
start: "".concat(currentDate, "T15:00:00Z"),
|
|
6363
|
+
end: "".concat(currentDate, "T16:00:00Z")
|
|
6364
|
+
},
|
|
6365
|
+
visibility: {
|
|
6366
|
+
range: 100,
|
|
6367
|
+
unit: 'M'
|
|
6368
|
+
},
|
|
6369
|
+
cloud: {
|
|
6370
|
+
cloud1: {
|
|
6371
|
+
verticalVisibility: 5
|
|
6372
|
+
}
|
|
6373
|
+
}
|
|
6374
|
+
}]
|
|
6375
|
+
}
|
|
6376
|
+
};
|
|
6377
|
+
|
|
6378
|
+
({
|
|
6379
|
+
creationDate: "2022-01-06T14:00:00Z",
|
|
6380
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6381
|
+
taf: Object.assign(Object.assign({}, fakeDraftAmendmentTaf.taf), {
|
|
6382
|
+
location: 'EHRD',
|
|
6383
|
+
issueDate: "2022-01-06T14:00:00Z",
|
|
6384
|
+
baseTime: "2022-01-06T12:00:00Z",
|
|
6385
|
+
validDateStart: "2022-01-06T14:00:00Z",
|
|
6386
|
+
validDateEnd: "2022-01-07T18:00:00Z",
|
|
6387
|
+
previousValidDateStart: "2022-01-06T12:00:00Z",
|
|
6388
|
+
previousValidDateEnd: "2022-01-07T18:00:00Z",
|
|
6389
|
+
baseForecast: Object.assign(Object.assign({}, fakeDraftAmendmentTaf.taf.baseForecast), {
|
|
6390
|
+
valid: {
|
|
6391
|
+
start: "2022-01-06T14:00:00Z",
|
|
6392
|
+
end: "2022-01-07T18:00:00Z"
|
|
6393
|
+
}
|
|
6394
|
+
}),
|
|
6395
|
+
changeGroups: []
|
|
6396
|
+
})
|
|
6397
|
+
});
|
|
6398
|
+
var fakeAmendmentTaf = {
|
|
6399
|
+
creationDate: "".concat(currentDate, "T14:00:00Z"),
|
|
6400
|
+
canbe: ['CANCELLED', 'CORRECTED', 'AMENDED'],
|
|
6401
|
+
taf: {
|
|
6402
|
+
uuid: '754905486',
|
|
6403
|
+
previousId: '5f9583fjdf45ff4330f337925',
|
|
6404
|
+
issueDate: "".concat(currentDate, "T14:00:00Z"),
|
|
6405
|
+
baseTime: "".concat(currentDate, "T12:00:00Z"),
|
|
6406
|
+
validDateStart: "".concat(currentDate, "T14:00:00Z"),
|
|
6407
|
+
validDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6408
|
+
previousValidDateStart: "".concat(currentDate, "T12:00:00Z"),
|
|
6409
|
+
previousValidDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6410
|
+
location: 'EHAM',
|
|
6411
|
+
status: 'AMENDED',
|
|
6412
|
+
type: 'NORMAL',
|
|
6413
|
+
messageType: 'AMD',
|
|
6414
|
+
baseForecast: {
|
|
6415
|
+
valid: {
|
|
6416
|
+
start: "".concat(currentDate, "T14:00:00Z"),
|
|
6417
|
+
end: "".concat(tomorrowDate, "T18:00:00Z")
|
|
6418
|
+
},
|
|
6419
|
+
visibility: {
|
|
6420
|
+
range: 600,
|
|
6421
|
+
unit: 'M'
|
|
6422
|
+
},
|
|
6423
|
+
wind: {
|
|
6424
|
+
direction: 180,
|
|
6425
|
+
speed: 10,
|
|
6426
|
+
unit: 'KT'
|
|
6427
|
+
},
|
|
6428
|
+
weather: {
|
|
6429
|
+
weather1: 'SN'
|
|
6430
|
+
},
|
|
6431
|
+
cloud: {
|
|
6432
|
+
cloud1: {
|
|
6433
|
+
coverage: 'BKN',
|
|
6434
|
+
height: 35
|
|
6435
|
+
}
|
|
6436
|
+
}
|
|
6437
|
+
}
|
|
6438
|
+
}
|
|
6439
|
+
}; // Only use for display purposes in the list!
|
|
6440
|
+
|
|
6441
|
+
({
|
|
6442
|
+
creationDate: "2022-01-06T14:00:00Z",
|
|
6443
|
+
canbe: ['CANCELLED', 'CORRECTED', 'AMENDED'],
|
|
6444
|
+
taf: Object.assign(Object.assign({}, fakeAmendmentTaf.taf), {
|
|
6445
|
+
uuid: '7549058980',
|
|
6446
|
+
issueDate: "2022-01-06T14:00:00Z",
|
|
6447
|
+
baseTime: "2022-01-06T12:00:00Z",
|
|
6448
|
+
validDateStart: "2022-01-06T14:00:00Z",
|
|
6449
|
+
validDateEnd: "2022-01-07T18:00:00Z",
|
|
6450
|
+
previousValidDateStart: "2022-01-06T12:00:00Z",
|
|
6451
|
+
previousValidDateEnd: "2022-01-07T18:00:00Z",
|
|
6452
|
+
baseForecast: Object.assign(Object.assign({}, fakeAmendmentTaf.taf.baseForecast), {
|
|
6453
|
+
valid: {
|
|
6454
|
+
start: "2022-01-06T14:00:00Z",
|
|
6455
|
+
end: "2022-01-07T18:00:00Z"
|
|
6456
|
+
}
|
|
6457
|
+
})
|
|
6458
|
+
})
|
|
6459
|
+
});
|
|
6460
|
+
|
|
6461
|
+
var fakeTafTac = 'TAF EHAM 0812/0918 20020G35KT 0500 SN BKN040\nBECMG 0814/0816 0700 BKN001=';
|
|
6462
|
+
|
|
6463
|
+
var fakePromise = function fakePromise(withRandomError) {
|
|
6464
|
+
return new Promise(function (resolve, reject) {
|
|
6465
|
+
setTimeout(function () {
|
|
6466
|
+
if (!withRandomError) return resolve();
|
|
6467
|
+
var randomError = Math.floor(Math.random() * 4) + 1;
|
|
6468
|
+
return randomError === 4 ? reject(new Error('something went wrong')) : resolve();
|
|
6469
|
+
}, 300);
|
|
6470
|
+
});
|
|
6471
|
+
};
|
|
6472
|
+
|
|
6473
|
+
var fakeAxiosInstance = {
|
|
6474
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars, @typescript-eslint/explicit-module-boundary-types
|
|
6475
|
+
get: function get(_url, _params) {
|
|
6476
|
+
return fakePromise(false);
|
|
6477
|
+
},
|
|
6478
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars, @typescript-eslint/explicit-module-boundary-types
|
|
6479
|
+
post: function post(_url, _params) {
|
|
6480
|
+
return fakePromise(false);
|
|
6481
|
+
}
|
|
6482
|
+
};
|
|
6483
|
+
var createApi = function createApi() {
|
|
6484
|
+
return {
|
|
6485
|
+
getTafList: function getTafList() {
|
|
6486
|
+
// eslint-disable-next-line no-console
|
|
6487
|
+
console.log('Retrieving new TAF list');
|
|
6488
|
+
return fakeAxiosInstance.get('/taflist').then(function () {
|
|
6489
|
+
return {
|
|
6490
|
+
data: _toConsumableArray(fakeTafList)
|
|
6491
|
+
};
|
|
6492
|
+
});
|
|
6493
|
+
},
|
|
6494
|
+
getTAC: function getTAC() {
|
|
6495
|
+
// eslint-disable-next-line no-console
|
|
6496
|
+
return fakeAxiosInstance.post('/taf2tac').then(function () {
|
|
6497
|
+
return {
|
|
6498
|
+
data: fakeTafTac
|
|
6499
|
+
};
|
|
6500
|
+
});
|
|
6501
|
+
},
|
|
6502
|
+
postTaf: function postTaf(_postTaf) {
|
|
6503
|
+
// eslint-disable-next-line no-console
|
|
6504
|
+
console.log("The new status of the taf will be ".concat(_postTaf.changeStatusTo)); // eslint-disable-next-line no-console
|
|
6505
|
+
|
|
6506
|
+
console.log('form has been posted with following values:', _postTaf.taf);
|
|
6507
|
+
return fakeAxiosInstance.post('/taf', _postTaf);
|
|
6508
|
+
}
|
|
6509
|
+
};
|
|
6510
|
+
};
|
|
6511
|
+
|
|
6512
|
+
export { TafForm, Wrapper as TafModule, createApi$1 as createApi, createApi as createFakeApi };
|