@opengeoweb/taf 2.3.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/index.d.ts +2 -3
- package/index.esm.js +3089 -1447
- package/index.umd.js +3367 -1631
- 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/{TafLayout → StatusIcon}/StatusIcon.d.ts +0 -0
- package/lib/components/{TafLayout → StatusIcon}/StatusIcon.spec.d.ts +0 -0
- package/lib/components/{TafLayout/TabPanel → TabPanel}/TabPanel.d.ts +0 -0
- package/lib/components/{TafLayout/TabPanel → TabPanel}/TabPanel.spec.d.ts +0 -0
- package/lib/components/{TafLayout/TabPanel → TabPanel}/index.d.ts +0 -0
- package/lib/components/TafForm/TafForm.d.ts +7 -22
- package/lib/components/TafForm/{TafFormDialog/TafFormDialog.spec.d.ts → TafForm.spec.d.ts} +0 -0
- package/lib/components/TafForm/{TafFormRow/change.spec.d.ts → TafForm.statusChanges.spec.d.ts} +0 -0
- package/lib/components/TafForm/{TafFormWrapper.stories.d.ts → TafForm.stories.d.ts} +0 -0
- package/lib/components/TafForm/TafFormButtons/TafFormButtons.d.ts +6 -9
- package/lib/components/TafForm/TafFormRow/{change.d.ts → validations/change.d.ts} +0 -0
- package/lib/components/TafForm/TafFormRow/{clouds.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/{probability.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/{validField.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/{visibility.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/TafFormRow/{weather.spec.d.ts → validations/visibility.spec.d.ts} +0 -0
- package/lib/components/TafForm/TafFormRow/{weather.d.ts → validations/weather.d.ts} +1 -1
- package/lib/components/TafForm/TafFormRow/{wind.spec.d.ts → validations/weather.spec.d.ts} +0 -0
- package/lib/components/TafForm/TafFormRow/{wind.d.ts → validations/wind.d.ts} +1 -1
- package/lib/components/TafForm/{TafFormWrapper.spec.d.ts → 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 -0
- package/lib/components/{TafLayout → TafHeader}/TafHeader.d.ts +0 -0
- package/lib/components/{TafLayout → TafHeader}/TafHeader.spec.d.ts +0 -0
- package/lib/components/TafLayout/TacOverview/ExportButton.d.ts +7 -0
- package/lib/components/{TafList/TafList.spec.d.ts → TafLayout/TacOverview/ExportButton.spec.d.ts} +0 -0
- package/lib/components/TafLayout/TacOverview/TacContainer.d.ts +4 -4
- package/lib/components/TafLayout/TacOverview/TacOverview.d.ts +3 -0
- package/lib/components/TafLayout/TacOverview/TacOverview.stories.d.ts +2 -0
- package/lib/components/TafLayout/TacOverview/TacOverviewMobile.d.ts +11 -0
- package/lib/components/{TafList/TafListAccordion.spec.d.ts → TafLayout/TacOverview/TacOverviewMobile.spec.d.ts} +0 -0
- package/lib/components/TafLayout/TacOverview/TacOverviewMobile.stories.d.ts +23 -0
- package/lib/components/TafLayout/TacOverview/index.d.ts +1 -0
- package/lib/components/TafLayout/TafLayout.d.ts +6 -0
- package/lib/components/{TafList/TafListButtons.spec.d.ts → TafLayout/TafLayout.spec.d.ts} +0 -0
- package/lib/components/TafLayout/TafLayout.stories.d.ts +10 -2
- package/lib/components/TafLayout/TafPanel/TafPanel.d.ts +32 -0
- package/lib/components/{TafList/TafListRow.spec.d.ts → TafLayout/TafPanel/TafPanel.spec.d.ts} +0 -0
- package/lib/components/TafLayout/TafPanel/index.d.ts +1 -0
- package/lib/components/TafLayout/TopTabs/TopTabs.d.ts +0 -2
- package/lib/components/TafLayout/utils.d.ts +17 -1
- package/lib/components/TafModule/TafModule.d.ts +3 -0
- package/lib/components/{TafList/TafListSection.spec.d.ts → TafModule/TafModule.spec.d.ts} +0 -0
- package/lib/components/TafModule/TafModule.stories.d.ts +10 -0
- package/lib/components/TafModule/TafModuleProvider.d.ts +22 -0
- package/lib/components/TafModule/index.d.ts +1 -0
- package/lib/components/TafWrapper/TafWrapper.d.ts +6 -13
- package/lib/types.d.ts +1 -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 +9 -3
- package/lib/utils/testUtils.d.ts +7 -10
- 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/Providers/Providers.d.ts +0 -11
- 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 -10
- 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,15 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import { TextField, SvgIcon, Grid, Box,
|
|
4
|
-
import makeStyles from '@mui/styles/makeStyles';
|
|
5
|
-
import moment from 'moment';
|
|
6
|
-
import { useIsMounted, ToggleMenu, useDraftFormHelpers, ToolContainerDraggable, useConfirmationDialog, usePreventBrowserClose, StatusTag, AlertBanner, ConfirmationServiceProvider, usePoller, isAxiosError, getAxiosErrorMessage } from '@opengeoweb/shared';
|
|
7
|
-
import { 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, getAxiosErrorMessage, AlertBanner, ConfirmationServiceProvider, usePoller } from '@opengeoweb/shared';
|
|
9
|
+
import moment from 'moment';
|
|
12
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';
|
|
13
17
|
|
|
14
18
|
function _typeof(obj) {
|
|
15
19
|
"@babel/helpers - typeof";
|
|
@@ -118,134 +122,6 @@ function _nonIterableRest() {
|
|
|
118
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.");
|
|
119
123
|
}
|
|
120
124
|
|
|
121
|
-
function _createForOfIteratorHelper(o, allowArrayLike) {
|
|
122
|
-
var it;
|
|
123
|
-
|
|
124
|
-
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
|
125
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
126
|
-
if (it) o = it;
|
|
127
|
-
var i = 0;
|
|
128
|
-
|
|
129
|
-
var F = function () {};
|
|
130
|
-
|
|
131
|
-
return {
|
|
132
|
-
s: F,
|
|
133
|
-
n: function () {
|
|
134
|
-
if (i >= o.length) return {
|
|
135
|
-
done: true
|
|
136
|
-
};
|
|
137
|
-
return {
|
|
138
|
-
done: false,
|
|
139
|
-
value: o[i++]
|
|
140
|
-
};
|
|
141
|
-
},
|
|
142
|
-
e: function (e) {
|
|
143
|
-
throw e;
|
|
144
|
-
},
|
|
145
|
-
f: F
|
|
146
|
-
};
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
var normalCompletion = true,
|
|
153
|
-
didErr = false,
|
|
154
|
-
err;
|
|
155
|
-
return {
|
|
156
|
-
s: function () {
|
|
157
|
-
it = o[Symbol.iterator]();
|
|
158
|
-
},
|
|
159
|
-
n: function () {
|
|
160
|
-
var step = it.next();
|
|
161
|
-
normalCompletion = step.done;
|
|
162
|
-
return step;
|
|
163
|
-
},
|
|
164
|
-
e: function (e) {
|
|
165
|
-
didErr = true;
|
|
166
|
-
err = e;
|
|
167
|
-
},
|
|
168
|
-
f: function () {
|
|
169
|
-
try {
|
|
170
|
-
if (!normalCompletion && it.return != null) it.return();
|
|
171
|
-
} finally {
|
|
172
|
-
if (didErr) throw err;
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
/* *
|
|
179
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
180
|
-
* you may not use this file except in compliance with the License.
|
|
181
|
-
* You may obtain a copy of the License at
|
|
182
|
-
*
|
|
183
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
184
|
-
*
|
|
185
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
186
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
187
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
188
|
-
* See the License for the specific language governing permissions and
|
|
189
|
-
* limitations under the License.
|
|
190
|
-
*
|
|
191
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
192
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
193
|
-
* */
|
|
194
|
-
var useTafSettings = function useTafSettings( // eslint-disable-next-line @typescript-eslint/no-explicit-any,@typescript-eslint/explicit-module-boundary-types
|
|
195
|
-
tafConfig) {
|
|
196
|
-
var locations = tafConfig.locations;
|
|
197
|
-
return {
|
|
198
|
-
locations: locations
|
|
199
|
-
};
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
var location_indicator_mwo = "EHDB";
|
|
203
|
-
var locations = {
|
|
204
|
-
EHAM: {
|
|
205
|
-
validity_duration: 30,
|
|
206
|
-
activity_period: 6,
|
|
207
|
-
label: "Schiphol"
|
|
208
|
-
},
|
|
209
|
-
EHRD: {
|
|
210
|
-
validity_duration: 30,
|
|
211
|
-
activity_period: 6,
|
|
212
|
-
label: "Rotterdam"
|
|
213
|
-
},
|
|
214
|
-
EHGG: {
|
|
215
|
-
validity_duration: 30,
|
|
216
|
-
activity_period: 6,
|
|
217
|
-
label: "Eelde"
|
|
218
|
-
},
|
|
219
|
-
EHBK: {
|
|
220
|
-
validity_duration: 30,
|
|
221
|
-
activity_period: 6,
|
|
222
|
-
label: "Maastricht"
|
|
223
|
-
},
|
|
224
|
-
EHLE: {
|
|
225
|
-
validity_duration: 30,
|
|
226
|
-
activity_period: 6,
|
|
227
|
-
label: "Lelystad"
|
|
228
|
-
},
|
|
229
|
-
TNCB: {
|
|
230
|
-
validity_duration: 30,
|
|
231
|
-
activity_period: 6,
|
|
232
|
-
label: "Bonaire"
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
var locationOrder = [
|
|
236
|
-
"EHAM",
|
|
237
|
-
"EHRD",
|
|
238
|
-
"EHLE",
|
|
239
|
-
"EHGG",
|
|
240
|
-
"EHBK",
|
|
241
|
-
"TNCB"
|
|
242
|
-
];
|
|
243
|
-
var tafConfig = {
|
|
244
|
-
location_indicator_mwo: location_indicator_mwo,
|
|
245
|
-
locations: locations,
|
|
246
|
-
locationOrder: locationOrder
|
|
247
|
-
};
|
|
248
|
-
|
|
249
125
|
/*! *****************************************************************************
|
|
250
126
|
Copyright (c) Microsoft Corporation.
|
|
251
127
|
|
|
@@ -2340,8 +2216,9 @@ var convertTafValuesToObject = function convertTafValuesToObject(formData) {
|
|
|
2340
2216
|
.filter(function (value) {
|
|
2341
2217
|
return Object.keys(value).length;
|
|
2342
2218
|
});
|
|
2219
|
+
var parsedBaseForecast = productToPost.baseForecast && parseFormValues(productToPost.baseForecast, tafStart, tafEnd);
|
|
2343
2220
|
var parsedFormValues = Object.assign(Object.assign({}, productToPost), {
|
|
2344
|
-
baseForecast:
|
|
2221
|
+
baseForecast: parsedBaseForecast,
|
|
2345
2222
|
changeGroups: parsedChangeGroups
|
|
2346
2223
|
});
|
|
2347
2224
|
return Object.keys(parsedFormValues).reduce(function (list, key) {
|
|
@@ -2417,6 +2294,10 @@ var getFieldNames = function getFieldNames(isChangeGroup, index) {
|
|
|
2417
2294
|
var TAC_MISSING_DATA = 'Missing data: no TAC can be generated';
|
|
2418
2295
|
var TAC_NOT_AVAILABLE = 'No TAC available';
|
|
2419
2296
|
var TAC_RETRIEVING_DATA = 'Retrieving TAC';
|
|
2297
|
+
var TAC_FAILED = 'Failed to retrieve TAC';
|
|
2298
|
+
var tacHasError = function tacHasError(tac) {
|
|
2299
|
+
return tac === TAC_MISSING_DATA || tac === TAC_NOT_AVAILABLE || tac === TAC_RETRIEVING_DATA || tac === TAC_FAILED;
|
|
2300
|
+
};
|
|
2420
2301
|
var useTACGenerator = function useTACGenerator(taf, requestTAC) {
|
|
2421
2302
|
var standardTAC = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
2422
2303
|
|
|
@@ -2428,7 +2309,7 @@ var useTACGenerator = function useTACGenerator(taf, requestTAC) {
|
|
|
2428
2309
|
var _useIsMounted = useIsMounted(),
|
|
2429
2310
|
isMounted = _useIsMounted.isMounted;
|
|
2430
2311
|
|
|
2431
|
-
var retrieveTAC = function
|
|
2312
|
+
var retrieveTAC = React__default.useCallback(function (tafToPost) {
|
|
2432
2313
|
if (shouldRetrieveTAC(tafToPost)) {
|
|
2433
2314
|
requestTAC(tafToPost).then(function (result) {
|
|
2434
2315
|
if (isMounted.current) {
|
|
@@ -2436,14 +2317,13 @@ var useTACGenerator = function useTACGenerator(taf, requestTAC) {
|
|
|
2436
2317
|
}
|
|
2437
2318
|
})["catch"](function () {
|
|
2438
2319
|
if (isMounted.current) {
|
|
2439
|
-
setTAC(
|
|
2320
|
+
setTAC(TAC_FAILED);
|
|
2440
2321
|
}
|
|
2441
2322
|
});
|
|
2442
2323
|
} else {
|
|
2443
2324
|
setTAC(TAC_MISSING_DATA);
|
|
2444
2325
|
}
|
|
2445
|
-
};
|
|
2446
|
-
|
|
2326
|
+
}, [isMounted, requestTAC]);
|
|
2447
2327
|
React__default.useEffect(function () {
|
|
2448
2328
|
if (taf.status !== 'NEW' && !standardTAC) {
|
|
2449
2329
|
retrieveTAC(taf);
|
|
@@ -2516,6 +2396,7 @@ var getConfirmationDialogTitle = function getConfirmationDialogTitle(action) {
|
|
|
2516
2396
|
if (action === 'PUBLISH') return 'Publish';
|
|
2517
2397
|
if (action === 'AMEND') return 'This TAF is an amendment';
|
|
2518
2398
|
if (action === 'CORRECT') return 'This TAF is a correction';
|
|
2399
|
+
if (action === 'CANCEL') return 'Cancel TAF';
|
|
2519
2400
|
return 'Cancel TAF';
|
|
2520
2401
|
}; // Check if the amended/corrected TAF has been changed. Only compare the fields users are able to fill in
|
|
2521
2402
|
// (i.e. exclude baseforecast valid time as that gets updated when doing an amendment automatically outside of the users influence)
|
|
@@ -2557,90 +2438,210 @@ var getConfirmationDialogButtonLabel = function getConfirmationDialogButtonLabel
|
|
|
2557
2438
|
return 'Discard';
|
|
2558
2439
|
}
|
|
2559
2440
|
|
|
2441
|
+
case 'CANCEL':
|
|
2442
|
+
return 'Cancel';
|
|
2443
|
+
|
|
2560
2444
|
default:
|
|
2561
2445
|
{
|
|
2562
2446
|
return 'Publish';
|
|
2563
2447
|
}
|
|
2564
2448
|
}
|
|
2565
2449
|
};
|
|
2450
|
+
var emptyChangegroup = {
|
|
2451
|
+
valid: '',
|
|
2452
|
+
wind: '',
|
|
2453
|
+
visibility: '',
|
|
2454
|
+
weather: {
|
|
2455
|
+
weather1: null,
|
|
2456
|
+
weather2: null,
|
|
2457
|
+
weather3: null
|
|
2458
|
+
},
|
|
2459
|
+
cloud: {
|
|
2460
|
+
cloud1: null,
|
|
2461
|
+
cloud2: null,
|
|
2462
|
+
cloud3: null,
|
|
2463
|
+
cloud4: null
|
|
2464
|
+
},
|
|
2465
|
+
change: null,
|
|
2466
|
+
probability: null
|
|
2467
|
+
};
|
|
2468
|
+
var getTafStatusLabel = function getTafStatusLabel(status) {
|
|
2469
|
+
switch (status) {
|
|
2470
|
+
case 'DRAFT_AMENDED':
|
|
2471
|
+
return 'draft amended';
|
|
2566
2472
|
|
|
2567
|
-
|
|
2568
|
-
|
|
2473
|
+
case 'DRAFT_CORRECTED':
|
|
2474
|
+
return 'draft corrected';
|
|
2569
2475
|
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2476
|
+
default:
|
|
2477
|
+
return status.toLocaleLowerCase();
|
|
2478
|
+
}
|
|
2479
|
+
};
|
|
2480
|
+
var getMessageType = function getMessageType(taf, tafAction) {
|
|
2481
|
+
if (tafAction === 'CORRECT') {
|
|
2482
|
+
return 'COR';
|
|
2483
|
+
}
|
|
2576
2484
|
|
|
2485
|
+
if (tafAction === 'AMEND') {
|
|
2486
|
+
return 'AMD';
|
|
2487
|
+
}
|
|
2577
2488
|
|
|
2578
|
-
|
|
2489
|
+
if (tafAction === 'CANCEL') {
|
|
2490
|
+
return 'CNL';
|
|
2579
2491
|
}
|
|
2580
2492
|
|
|
2581
|
-
return
|
|
2493
|
+
return taf.messageType;
|
|
2494
|
+
}; // For corrections and amendment we need to add the previousValidStart and End for the TAC converter
|
|
2495
|
+
|
|
2496
|
+
var getAmendedCorrectedTafTimes = function getAmendedCorrectedTafTimes(taf, tafAction) {
|
|
2497
|
+
var previousValidDateStart = taf.previousValidDateStart && tafAction !== 'AMEND' ? taf.previousValidDateStart : taf.validDateStart;
|
|
2498
|
+
var previousValidDateEnd = taf.previousValidDateEnd && tafAction !== 'AMEND' ? taf.previousValidDateEnd : taf.validDateEnd; // For amendment change valid start time to current time
|
|
2499
|
+
// only do this if we're already within the validity period
|
|
2500
|
+
|
|
2501
|
+
if ((tafAction === 'AMEND' || tafAction === 'DRAFT_AMEND') && moment.utc() >= moment.utc(taf.validDateStart)) {
|
|
2502
|
+
var now = moment.utc().format('YYYY-MM-DDTHH:mm:ss[Z]');
|
|
2503
|
+
var validObj = {
|
|
2504
|
+
start: now,
|
|
2505
|
+
end: taf.baseForecast.valid.end
|
|
2506
|
+
};
|
|
2507
|
+
return Object.assign(Object.assign({}, taf), {
|
|
2508
|
+
previousValidDateStart: previousValidDateStart,
|
|
2509
|
+
previousValidDateEnd: previousValidDateEnd,
|
|
2510
|
+
validDateStart: now,
|
|
2511
|
+
baseForecast: Object.assign(Object.assign({}, taf.baseForecast), {
|
|
2512
|
+
valid: validObj
|
|
2513
|
+
})
|
|
2514
|
+
});
|
|
2515
|
+
}
|
|
2516
|
+
|
|
2517
|
+
return Object.assign(Object.assign({}, taf), {
|
|
2518
|
+
previousValidDateStart: previousValidDateStart,
|
|
2519
|
+
previousValidDateEnd: previousValidDateEnd
|
|
2520
|
+
});
|
|
2521
|
+
};
|
|
2522
|
+
var prepareTafValues = function prepareTafValues(_taf, tafAction) {
|
|
2523
|
+
var addEmptyChangeGroup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
2524
|
+
// If action is AMEND/CORRECT/DRAFT_AMEND/DRAFT_CORRECTION - add previous valid start and end
|
|
2525
|
+
// If action is AMEND/DRAFT_AMEND - update validity start time to current time
|
|
2526
|
+
var taf = tafAction === 'AMEND' || tafAction === 'DRAFT_AMEND' || tafAction === 'CORRECT' || tafAction === 'DRAFT_CORRECT' ? getAmendedCorrectedTafTimes(_taf, tafAction) : _taf;
|
|
2527
|
+
return Object.assign(Object.assign(Object.assign(Object.assign({}, taf), {
|
|
2528
|
+
messageType: getMessageType(taf, tafAction),
|
|
2529
|
+
baseForecast: formatFormValues(taf.baseForecast)
|
|
2530
|
+
}), taf.changeGroups && {
|
|
2531
|
+
changeGroups: taf.changeGroups.map(formatFormValues)
|
|
2532
|
+
}), addEmptyChangeGroup && {
|
|
2533
|
+
changeGroups: [emptyChangegroup]
|
|
2534
|
+
});
|
|
2582
2535
|
};
|
|
2536
|
+
var getIsFormDefaultDisabled = function getIsFormDefaultDisabled(status) {
|
|
2537
|
+
return !(status === 'NEW' || status === 'DRAFT' || status === 'DRAFT_AMENDED' || status === 'DRAFT_CORRECTED');
|
|
2538
|
+
};
|
|
2539
|
+
var fromStatusToAction = function fromStatusToAction(tafStatus) {
|
|
2540
|
+
switch (tafStatus) {
|
|
2541
|
+
case 'DRAFT':
|
|
2542
|
+
return 'DRAFT';
|
|
2583
2543
|
|
|
2584
|
-
|
|
2585
|
-
|
|
2544
|
+
case 'DRAFT_AMENDED':
|
|
2545
|
+
return 'DRAFT_AMEND';
|
|
2546
|
+
|
|
2547
|
+
case 'DRAFT_CORRECTED':
|
|
2548
|
+
return 'DRAFT_CORRECT';
|
|
2549
|
+
|
|
2550
|
+
case 'PUBLISHED':
|
|
2551
|
+
return 'PUBLISH';
|
|
2552
|
+
|
|
2553
|
+
case 'AMENDED':
|
|
2554
|
+
return 'AMEND';
|
|
2555
|
+
|
|
2556
|
+
case 'CORRECTED':
|
|
2557
|
+
return 'CORRECT';
|
|
2558
|
+
|
|
2559
|
+
case 'CANCELLED':
|
|
2560
|
+
return 'CANCEL';
|
|
2561
|
+
|
|
2562
|
+
default:
|
|
2563
|
+
return 'NEW';
|
|
2564
|
+
}
|
|
2586
2565
|
};
|
|
2587
|
-
|
|
2566
|
+
|
|
2567
|
+
var textFieldStyle = function textFieldStyle(theme) {
|
|
2588
2568
|
return {
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2569
|
+
// input
|
|
2570
|
+
marginRight: '2px',
|
|
2571
|
+
marginBottom: '4px',
|
|
2572
|
+
width: 56,
|
|
2573
|
+
height: 46,
|
|
2574
|
+
input: {
|
|
2592
2575
|
textAlign: 'center',
|
|
2593
2576
|
fontSize: 10,
|
|
2594
2577
|
fontWeight: 500,
|
|
2595
2578
|
paddingLeft: 0,
|
|
2596
2579
|
paddingRight: 0,
|
|
2597
|
-
marginBotom: '2px',
|
|
2598
2580
|
'&.Mui-disabled': {
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2581
|
+
color: 'geowebColors.typographyAndIcons.text',
|
|
2582
|
+
WebkitTextFillColor: theme.palette.geowebColors.typographyAndIcons.text
|
|
2583
|
+
},
|
|
2584
|
+
// TODO: https://gitlab.com/opengeoweb/opengeoweb/-/issues/1995 disables the default autofill styling, should be a better fix
|
|
2585
|
+
'&:-webkit-autofill': {
|
|
2586
|
+
WebkitTransitionDelay: '86400s' // 1 day delay
|
|
2587
|
+
|
|
2604
2588
|
}
|
|
2605
2589
|
},
|
|
2606
|
-
|
|
2590
|
+
label: {
|
|
2591
|
+
transformOrigin: 'center top',
|
|
2592
|
+
right: 0,
|
|
2593
|
+
textAlign: 'center',
|
|
2607
2594
|
fontSize: '10px',
|
|
2608
2595
|
'&.Mui-disabled': {
|
|
2609
|
-
color:
|
|
2596
|
+
color: 'geowebColors.captions.captionStatus.rgba'
|
|
2610
2597
|
},
|
|
2611
2598
|
whiteSpace: 'nowrap',
|
|
2612
|
-
maxWidth: '100%'
|
|
2599
|
+
maxWidth: '100%',
|
|
2600
|
+
transform: 'translate(0px, 16px) scale(1)'
|
|
2613
2601
|
},
|
|
2614
|
-
|
|
2602
|
+
// shrink
|
|
2603
|
+
' .MuiInputLabel-shrink': {
|
|
2615
2604
|
transform: 'translate(2px, 10px) scale(0.75) !important',
|
|
2616
|
-
letterSpacing: '0.33px'
|
|
2605
|
+
letterSpacing: '0.33px',
|
|
2606
|
+
textAlign: 'left'
|
|
2607
|
+
},
|
|
2608
|
+
// root
|
|
2609
|
+
'&': {
|
|
2610
|
+
'.Mui-disabled:before': {
|
|
2611
|
+
borderColor: 'transparent'
|
|
2612
|
+
}
|
|
2617
2613
|
}
|
|
2618
2614
|
};
|
|
2619
|
-
}
|
|
2615
|
+
};
|
|
2616
|
+
|
|
2617
|
+
var getTafErrors = function getTafErrors(name, errors) {
|
|
2618
|
+
var nameAsArray = name.split('.');
|
|
2619
|
+
|
|
2620
|
+
if (nameAsArray[0].includes('changeGroups')) {
|
|
2621
|
+
if (errors.changeGroups) {
|
|
2622
|
+
var changeGroupNum = nameAsArray[0].slice(13, nameAsArray[0].length - 1);
|
|
2623
|
+
var restArray = nameAsArray.slice(1);
|
|
2624
|
+
return getDeepProperty(restArray, errors.changeGroups[changeGroupNum]);
|
|
2625
|
+
} // No changegroup errors
|
|
2626
|
+
|
|
2627
|
+
|
|
2628
|
+
return null;
|
|
2629
|
+
}
|
|
2630
|
+
|
|
2631
|
+
return getDeepProperty(nameAsArray, errors);
|
|
2632
|
+
};
|
|
2633
|
+
|
|
2634
|
+
var getDisplayValue = function getDisplayValue(value, disabled) {
|
|
2635
|
+
return disabled && !value ? '-' : value;
|
|
2636
|
+
};
|
|
2620
2637
|
var BaseTextField = /*#__PURE__*/React__default.memo(function (props) {
|
|
2621
|
-
var classes = useStyles$8();
|
|
2622
2638
|
return /*#__PURE__*/React__default.createElement(TextField, Object.assign({
|
|
2623
2639
|
type: "text",
|
|
2624
2640
|
variant: "filled",
|
|
2625
|
-
|
|
2626
|
-
classes: {
|
|
2627
|
-
root: classes.textFieldInput,
|
|
2628
|
-
input: classes.textFieldInput
|
|
2629
|
-
}
|
|
2630
|
-
},
|
|
2631
|
-
InputLabelProps: {
|
|
2632
|
-
classes: {
|
|
2633
|
-
root: classes.textFieldLabel,
|
|
2634
|
-
shrink: classes.textFieldLabelShrink
|
|
2635
|
-
}
|
|
2636
|
-
},
|
|
2637
|
-
sx: {
|
|
2638
|
-
marginRight: '2px',
|
|
2639
|
-
marginBottom: '2px'
|
|
2640
|
-
}
|
|
2641
|
+
sx: textFieldStyle
|
|
2641
2642
|
}, props));
|
|
2642
2643
|
}, function (prevProps, nextProps) {
|
|
2643
|
-
return prevProps.value === nextProps.value && prevProps.error === nextProps.error && prevProps.name === nextProps.name;
|
|
2644
|
+
return prevProps.value === nextProps.value && prevProps.error === nextProps.error && prevProps.name === nextProps.name && prevProps.disabled === nextProps.disabled;
|
|
2644
2645
|
});
|
|
2645
2646
|
|
|
2646
2647
|
var TafFormTextField = function TafFormTextField(_ref) {
|
|
@@ -2868,7 +2869,8 @@ var TafFormOptionsButton = function TafFormOptionsButton(_ref) {
|
|
|
2868
2869
|
return /*#__PURE__*/React.createElement(ToggleMenu, {
|
|
2869
2870
|
buttonTestId: "tafFormOptions[".concat(index, "]"),
|
|
2870
2871
|
buttonSx: {
|
|
2871
|
-
|
|
2872
|
+
marginTop: '10px',
|
|
2873
|
+
marginLeft: '4px'
|
|
2872
2874
|
},
|
|
2873
2875
|
menuItems: isChangeGroup ? menuItemsChangeGroup : menuItemsBaseForecast
|
|
2874
2876
|
});
|
|
@@ -3043,13 +3045,14 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
3043
3045
|
justifyContent: "flex-start",
|
|
3044
3046
|
"data-testid": "row-".concat(namePrefix),
|
|
3045
3047
|
container: true,
|
|
3046
|
-
ref: ref
|
|
3048
|
+
ref: ref,
|
|
3049
|
+
columns: 24
|
|
3047
3050
|
}, props), /*#__PURE__*/React__default.createElement(Grid, {
|
|
3048
3051
|
item: true,
|
|
3049
|
-
xs: 11
|
|
3050
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
3051
3052
|
container: true,
|
|
3052
|
-
justifyContent: "flex-end"
|
|
3053
|
+
justifyContent: "flex-end",
|
|
3054
|
+
xs: 24,
|
|
3055
|
+
sm: 23
|
|
3053
3056
|
}, !isChangeGroup && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TafFormTextField, {
|
|
3054
3057
|
label: "Type",
|
|
3055
3058
|
name: fieldNames.messageType,
|
|
@@ -3306,9 +3309,16 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
3306
3309
|
}
|
|
3307
3310
|
}
|
|
3308
3311
|
}
|
|
3309
|
-
}))
|
|
3312
|
+
})), !disabled && /*#__PURE__*/React__default.createElement(Grid, {
|
|
3310
3313
|
item: true,
|
|
3311
|
-
|
|
3314
|
+
container: true,
|
|
3315
|
+
justifyContent: "flex-end",
|
|
3316
|
+
alignItems: "flex-end",
|
|
3317
|
+
xs: 24,
|
|
3318
|
+
sm: 1,
|
|
3319
|
+
sx: {
|
|
3320
|
+
marginBottom: '16px'
|
|
3321
|
+
}
|
|
3312
3322
|
}, /*#__PURE__*/React__default.createElement(TafFormOptionsButton, {
|
|
3313
3323
|
isChangeGroup: isChangeGroup,
|
|
3314
3324
|
addChangeGroupBelow: addChangeGroupBelow,
|
|
@@ -3337,53 +3347,348 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
3337
3347
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3338
3348
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3339
3349
|
* */
|
|
3350
|
+
var tafActionToDraftAction = function tafActionToDraftAction(tafAction) {
|
|
3351
|
+
switch (tafAction) {
|
|
3352
|
+
case 'AMEND':
|
|
3353
|
+
case 'DRAFT_AMEND':
|
|
3354
|
+
return 'DRAFT_AMEND';
|
|
3340
3355
|
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
return '0 issues';
|
|
3345
|
-
|
|
3346
|
-
case 1:
|
|
3347
|
-
return '1 issue';
|
|
3356
|
+
case 'CORRECT':
|
|
3357
|
+
case 'DRAFT_CORRECT':
|
|
3358
|
+
return 'DRAFT_CORRECT';
|
|
3348
3359
|
|
|
3349
3360
|
default:
|
|
3350
|
-
return
|
|
3361
|
+
return 'DRAFT';
|
|
3351
3362
|
}
|
|
3352
3363
|
};
|
|
3353
3364
|
|
|
3354
|
-
var
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3365
|
+
var tafActionToPublishAction = function tafActionToPublishAction(tafAction) {
|
|
3366
|
+
switch (tafAction) {
|
|
3367
|
+
case 'AMEND':
|
|
3368
|
+
case 'DRAFT_AMEND':
|
|
3369
|
+
return 'AMEND';
|
|
3358
3370
|
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3371
|
+
case 'CORRECT':
|
|
3372
|
+
case 'DRAFT_CORRECT':
|
|
3373
|
+
return 'CORRECT';
|
|
3374
|
+
|
|
3375
|
+
default:
|
|
3376
|
+
return 'PUBLISH';
|
|
3377
|
+
}
|
|
3378
|
+
};
|
|
3379
|
+
|
|
3380
|
+
var buttonsStyle = {
|
|
3381
|
+
button: {
|
|
3382
|
+
minWidth: {
|
|
3383
|
+
xs: '56px',
|
|
3384
|
+
sm: '64px'
|
|
3367
3385
|
},
|
|
3368
|
-
|
|
3369
|
-
|
|
3386
|
+
width: {
|
|
3387
|
+
xs: '56px',
|
|
3388
|
+
sm: '64px'
|
|
3370
3389
|
},
|
|
3371
|
-
|
|
3390
|
+
marginLeft: {
|
|
3391
|
+
xs: 0.5,
|
|
3392
|
+
sm: 1
|
|
3393
|
+
},
|
|
3394
|
+
marginTop: 3,
|
|
3395
|
+
marginBottom: 3
|
|
3396
|
+
}
|
|
3397
|
+
};
|
|
3398
|
+
|
|
3399
|
+
var ViewModeButtons = function ViewModeButtons(_ref) {
|
|
3400
|
+
var canBe = _ref.canBe,
|
|
3401
|
+
onTafViewModeButtonPress = _ref.onTafViewModeButtonPress;
|
|
3402
|
+
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, {
|
|
3403
|
+
"data-testid": "canceltaf",
|
|
3404
|
+
variant: "tertiary",
|
|
3405
|
+
onClick: function onClick() {
|
|
3406
|
+
return onTafViewModeButtonPress('CANCEL');
|
|
3407
|
+
}
|
|
3408
|
+
}, "Cancel"), canBe.includes('CORRECTED') && /*#__PURE__*/React__default.createElement(Button, {
|
|
3409
|
+
"data-testid": "correcttaf",
|
|
3410
|
+
variant: "tertiary",
|
|
3411
|
+
onClick: function onClick() {
|
|
3412
|
+
return onTafViewModeButtonPress('CORRECT');
|
|
3413
|
+
}
|
|
3414
|
+
}, "Correct"), canBe.includes('AMENDED') && /*#__PURE__*/React__default.createElement(Button, {
|
|
3415
|
+
"data-testid": "amendtaf",
|
|
3416
|
+
variant: "tertiary",
|
|
3417
|
+
onClick: function onClick() {
|
|
3418
|
+
return onTafViewModeButtonPress('AMEND');
|
|
3419
|
+
}
|
|
3420
|
+
}, "Amend"));
|
|
3421
|
+
};
|
|
3422
|
+
|
|
3423
|
+
var TafFormButtons = function TafFormButtons(_ref2) {
|
|
3424
|
+
var _ref2$isFormDisabled = _ref2.isFormDisabled,
|
|
3425
|
+
isFormDisabled = _ref2$isFormDisabled === void 0 ? false : _ref2$isFormDisabled,
|
|
3426
|
+
tafAction = _ref2.tafAction,
|
|
3427
|
+
_ref2$canBe = _ref2.canBe,
|
|
3428
|
+
canBe = _ref2$canBe === void 0 ? [] : _ref2$canBe,
|
|
3429
|
+
onTafEditModeButtonPress = _ref2.onTafEditModeButtonPress,
|
|
3430
|
+
onTafViewModeButtonPress = _ref2.onTafViewModeButtonPress;
|
|
3431
|
+
return /*#__PURE__*/React__default.createElement(Grid, {
|
|
3432
|
+
container: true,
|
|
3433
|
+
justifyContent: "flex-end",
|
|
3434
|
+
sx: buttonsStyle,
|
|
3435
|
+
columns: 24
|
|
3436
|
+
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
3437
|
+
item: true,
|
|
3438
|
+
container: true,
|
|
3439
|
+
justifyContent: "flex-end",
|
|
3440
|
+
xs: 24,
|
|
3441
|
+
sm: 23
|
|
3442
|
+
}, isFormDisabled ? /*#__PURE__*/React__default.createElement(ViewModeButtons, {
|
|
3443
|
+
canBe: canBe,
|
|
3444
|
+
onTafViewModeButtonPress: onTafViewModeButtonPress
|
|
3445
|
+
}) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Button, {
|
|
3446
|
+
"data-testid": "discardtaf",
|
|
3447
|
+
variant: "tertiary",
|
|
3448
|
+
onClick: function onClick() {
|
|
3449
|
+
// Simply discard the changes and close the dialog.
|
|
3450
|
+
onTafEditModeButtonPress('DISCARD');
|
|
3451
|
+
}
|
|
3452
|
+
}, "Discard"), /*#__PURE__*/React__default.createElement(Button, {
|
|
3453
|
+
"data-testid": "savedrafttaf",
|
|
3454
|
+
variant: "tertiary",
|
|
3455
|
+
onClick: function onClick() {
|
|
3456
|
+
/* Save the TAF as draft:
|
|
3457
|
+
if action NEW or DRAFT - new status will be DRAFT -- default
|
|
3458
|
+
if action AMEND - new status will be DRAFT_AMENDED
|
|
3459
|
+
if action CORRECT - new status will be DRAFT_CORRECTED
|
|
3460
|
+
if action DRAFT_AMEND - new status will be DRAFT_AMENDED
|
|
3461
|
+
if action DRAFT_CORRECT - new status will be DRAFT_CORRECTED
|
|
3462
|
+
*/
|
|
3463
|
+
onTafEditModeButtonPress(tafActionToDraftAction(tafAction));
|
|
3464
|
+
}
|
|
3465
|
+
}, "Save"), /*#__PURE__*/React__default.createElement(Button, {
|
|
3466
|
+
"data-testid": "publishtaf",
|
|
3467
|
+
variant: "tertiary",
|
|
3468
|
+
onClick: function onClick() {
|
|
3469
|
+
/* Publish the TAF:
|
|
3470
|
+
if action NEW or DRAFT - new status will be PUBLISHED -- default
|
|
3471
|
+
if action AMEND - new status will be AMENDED
|
|
3472
|
+
if action CORRECT - new status will be CORRECTED
|
|
3473
|
+
if action DRAFT_AMEND - new status will be AMENDED
|
|
3474
|
+
if action DRAFT_CORRECT - new status will be CORRECTED
|
|
3475
|
+
*/
|
|
3476
|
+
onTafEditModeButtonPress(tafActionToPublishAction(tafAction));
|
|
3477
|
+
}
|
|
3478
|
+
}, "Publish"))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
3479
|
+
item: true,
|
|
3480
|
+
sm: 1
|
|
3481
|
+
}));
|
|
3482
|
+
};
|
|
3483
|
+
|
|
3484
|
+
/* *
|
|
3485
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3486
|
+
* you may not use this file except in compliance with the License.
|
|
3487
|
+
* You may obtain a copy of the License at
|
|
3488
|
+
*
|
|
3489
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3490
|
+
*
|
|
3491
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3492
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3493
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3494
|
+
* See the License for the specific language governing permissions and
|
|
3495
|
+
* limitations under the License.
|
|
3496
|
+
*
|
|
3497
|
+
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3498
|
+
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3499
|
+
* */
|
|
3500
|
+
var useStyles = makeStyles(function () {
|
|
3501
|
+
return {
|
|
3502
|
+
dragHandle: {
|
|
3503
|
+
backgroundColor: 'transparent',
|
|
3504
|
+
'&:hover': {
|
|
3505
|
+
backgroundColor: 'transparent'
|
|
3506
|
+
},
|
|
3507
|
+
cursor: function cursor(isSorting) {
|
|
3508
|
+
return isSorting ? 'grabbing' : 'grab';
|
|
3509
|
+
}
|
|
3510
|
+
}
|
|
3372
3511
|
};
|
|
3512
|
+
});
|
|
3513
|
+
|
|
3514
|
+
var DragHandle = function DragHandle(_ref) {
|
|
3515
|
+
var _ref$isSorting = _ref.isSorting,
|
|
3516
|
+
isSorting = _ref$isSorting === void 0 ? false : _ref$isSorting,
|
|
3517
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
3518
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
3519
|
+
index = _ref.index;
|
|
3520
|
+
var classes = useStyles(isSorting);
|
|
3521
|
+
return /*#__PURE__*/React__default.createElement(IconButton, {
|
|
3522
|
+
className: "".concat(classes.dragHandle, " handle"),
|
|
3523
|
+
"data-testid": "dragHandle-".concat(index),
|
|
3524
|
+
disableRipple: true,
|
|
3525
|
+
disabled: isDisabled,
|
|
3526
|
+
size: "large"
|
|
3527
|
+
}, /*#__PURE__*/React__default.createElement(DragIndicator, null));
|
|
3528
|
+
};
|
|
3529
|
+
|
|
3530
|
+
/* *
|
|
3531
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3532
|
+
* you may not use this file except in compliance with the License.
|
|
3533
|
+
* You may obtain a copy of the License at
|
|
3534
|
+
*
|
|
3535
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3536
|
+
*
|
|
3537
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3538
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3539
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3540
|
+
* See the License for the specific language governing permissions and
|
|
3541
|
+
* limitations under the License.
|
|
3542
|
+
*
|
|
3543
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3544
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3545
|
+
* */
|
|
3546
|
+
var getCustomError = function getCustomError(error) {
|
|
3547
|
+
var name = error.ref.name;
|
|
3548
|
+
var isChangeGroup = name.includes('changeGroups');
|
|
3549
|
+
var matchRowNumber = name.match(/\[(.*?)\]/);
|
|
3550
|
+
var row = matchRowNumber ? parseInt(matchRowNumber[1], 10) : null;
|
|
3551
|
+
return Object.assign(Object.assign({}, error), {
|
|
3552
|
+
isChangeGroup: isChangeGroup,
|
|
3553
|
+
row: row
|
|
3554
|
+
});
|
|
3555
|
+
};
|
|
3556
|
+
var getIssuesLabel = function getIssuesLabel(sumOfErrors) {
|
|
3557
|
+
switch (sumOfErrors) {
|
|
3558
|
+
case 0:
|
|
3559
|
+
return '0 issues';
|
|
3560
|
+
|
|
3561
|
+
case 1:
|
|
3562
|
+
return '1 issue';
|
|
3563
|
+
|
|
3564
|
+
default:
|
|
3565
|
+
return "".concat(sumOfErrors, " issues");
|
|
3566
|
+
}
|
|
3567
|
+
};
|
|
3568
|
+
|
|
3569
|
+
var getErrorValues = function getErrorValues(fieldErrors) {
|
|
3570
|
+
if (!fieldErrors) return [];
|
|
3571
|
+
return Object.keys(fieldErrors).reduce(function (list, key) {
|
|
3572
|
+
var error = Object.assign({}, fieldErrors[key]);
|
|
3573
|
+
|
|
3574
|
+
if (error.ref) {
|
|
3575
|
+
return list.concat(getCustomError(error));
|
|
3576
|
+
}
|
|
3577
|
+
|
|
3578
|
+
return list.concat(getErrorValues(error));
|
|
3579
|
+
}, []);
|
|
3580
|
+
};
|
|
3581
|
+
|
|
3582
|
+
var filterDuplicateErrors = function filterDuplicateErrors(errors) {
|
|
3583
|
+
return errors.reduce(function (list, error) {
|
|
3584
|
+
// check on type validateRequiredSub and validateRequiredMainOptional since these are giving 'duplicates'
|
|
3585
|
+
if (error.type === 'validateRequiredSub') {
|
|
3586
|
+
var exist = list.find(function (e) {
|
|
3587
|
+
return e.type === 'validateRequiredSub' && e.row === error.row;
|
|
3588
|
+
});
|
|
3589
|
+
return exist ? list : list.concat(error);
|
|
3590
|
+
}
|
|
3591
|
+
|
|
3592
|
+
if (error.type === 'validateRequiredMainOptional') {
|
|
3593
|
+
var _exist = list.find(function (e) {
|
|
3594
|
+
return e.type === 'validateRequiredMainOptional' && e.row === error.row;
|
|
3595
|
+
});
|
|
3596
|
+
|
|
3597
|
+
return _exist ? list : list.concat(error);
|
|
3598
|
+
}
|
|
3599
|
+
|
|
3600
|
+
return list.concat(error);
|
|
3601
|
+
}, []);
|
|
3602
|
+
};
|
|
3603
|
+
var getErrors = function getErrors(errors) {
|
|
3604
|
+
var errorList = Object.keys(errors).reduce(function (list, key) {
|
|
3605
|
+
var errorValue = errors[key];
|
|
3606
|
+
|
|
3607
|
+
if (Array.isArray(errorValue)) {
|
|
3608
|
+
var errorValues = errorValue.reduce(function (l, i) {
|
|
3609
|
+
return l.concat(getErrorValues(i));
|
|
3610
|
+
}, []);
|
|
3611
|
+
return list.concat.apply(list, _toConsumableArray(errorValues));
|
|
3612
|
+
}
|
|
3613
|
+
|
|
3614
|
+
return list.concat(getErrorValues(errorValue));
|
|
3615
|
+
}, []);
|
|
3616
|
+
return errorList;
|
|
3373
3617
|
};
|
|
3374
3618
|
|
|
3619
|
+
/* *
|
|
3620
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3621
|
+
* you may not use this file except in compliance with the License.
|
|
3622
|
+
* You may obtain a copy of the License at
|
|
3623
|
+
*
|
|
3624
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3625
|
+
*
|
|
3626
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3627
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3628
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3629
|
+
* See the License for the specific language governing permissions and
|
|
3630
|
+
* limitations under the License.
|
|
3631
|
+
*
|
|
3632
|
+
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3633
|
+
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3634
|
+
* */
|
|
3635
|
+
|
|
3375
3636
|
var IssuesButton = function IssuesButton(_ref) {
|
|
3376
|
-
var
|
|
3377
|
-
|
|
3378
|
-
|
|
3637
|
+
var _ref$errors = _ref.errors,
|
|
3638
|
+
errors = _ref$errors === void 0 ? {} : _ref$errors,
|
|
3639
|
+
_ref$isIssuesPaneOpen = _ref.isIssuesPaneOpen,
|
|
3640
|
+
isIssuesPaneOpen = _ref$isIssuesPaneOpen === void 0 ? false : _ref$isIssuesPaneOpen,
|
|
3641
|
+
_ref$setIsIssuesPaneO = _ref.setIsIssuesPaneOpen,
|
|
3642
|
+
setIsIssuesPaneOpen = _ref$setIsIssuesPaneO === void 0 ? function () {
|
|
3643
|
+
return null;
|
|
3644
|
+
} : _ref$setIsIssuesPaneO;
|
|
3645
|
+
var errorList = filterDuplicateErrors(getErrors(errors));
|
|
3646
|
+
var totalErrors = errorList.length;
|
|
3647
|
+
var errorStatus = totalErrors > 0 ? 'error' : 'success';
|
|
3648
|
+
var buttonColor = "geowebColors.functional.".concat(errorStatus);
|
|
3649
|
+
|
|
3650
|
+
var toggleIssuesPane = function toggleIssuesPane(newPosition) {
|
|
3651
|
+
return setIsIssuesPaneOpen(!isIssuesPaneOpen, newPosition);
|
|
3652
|
+
};
|
|
3653
|
+
|
|
3654
|
+
var onClickButton = function onClickButton(event) {
|
|
3655
|
+
var _a;
|
|
3656
|
+
|
|
3657
|
+
var _event$currentTarget$ = event.currentTarget.getBoundingClientRect(),
|
|
3658
|
+
left = _event$currentTarget$.left,
|
|
3659
|
+
top = _event$currentTarget$.top;
|
|
3660
|
+
|
|
3661
|
+
var parentOffset = ((_a = document.getElementById('tafmodule')) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) || {
|
|
3662
|
+
top: 0,
|
|
3663
|
+
left: 0
|
|
3664
|
+
};
|
|
3665
|
+
var newPosition = {
|
|
3666
|
+
left: left - parentOffset.left + 100,
|
|
3667
|
+
top: top - parentOffset.top
|
|
3668
|
+
};
|
|
3669
|
+
toggleIssuesPane(newPosition);
|
|
3670
|
+
};
|
|
3671
|
+
|
|
3379
3672
|
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
3380
3673
|
title: "View details"
|
|
3381
3674
|
}, /*#__PURE__*/React.createElement(Chip, {
|
|
3382
3675
|
"data-testid": "issuesButton",
|
|
3676
|
+
className: "status-".concat(errorStatus),
|
|
3383
3677
|
size: "small",
|
|
3384
|
-
label: getIssuesLabel(
|
|
3385
|
-
|
|
3386
|
-
|
|
3678
|
+
label: getIssuesLabel(totalErrors),
|
|
3679
|
+
onClick: onClickButton,
|
|
3680
|
+
sx: {
|
|
3681
|
+
width: '74px',
|
|
3682
|
+
color: '#ffffff',
|
|
3683
|
+
backgroundColor: buttonColor,
|
|
3684
|
+
'&:hover': {
|
|
3685
|
+
backgroundColor: buttonColor
|
|
3686
|
+
},
|
|
3687
|
+
'&:focus': {
|
|
3688
|
+
backgroundColor: buttonColor
|
|
3689
|
+
},
|
|
3690
|
+
fontSize: 12
|
|
3691
|
+
}
|
|
3387
3692
|
}));
|
|
3388
3693
|
};
|
|
3389
3694
|
|
|
@@ -3424,32 +3729,6 @@ var ThumbsUp = function ThumbsUp(props) {
|
|
|
3424
3729
|
})));
|
|
3425
3730
|
};
|
|
3426
3731
|
|
|
3427
|
-
/* *
|
|
3428
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3429
|
-
* you may not use this file except in compliance with the License.
|
|
3430
|
-
* You may obtain a copy of the License at
|
|
3431
|
-
*
|
|
3432
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3433
|
-
*
|
|
3434
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3435
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3436
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3437
|
-
* See the License for the specific language governing permissions and
|
|
3438
|
-
* limitations under the License.
|
|
3439
|
-
*
|
|
3440
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3441
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3442
|
-
* */
|
|
3443
|
-
var useStyles$7 = makeStyles({
|
|
3444
|
-
paneContent: {
|
|
3445
|
-
marginTop: '16px',
|
|
3446
|
-
marginLeft: '24px'
|
|
3447
|
-
},
|
|
3448
|
-
image: {
|
|
3449
|
-
fontSize: '4rem'
|
|
3450
|
-
}
|
|
3451
|
-
});
|
|
3452
|
-
|
|
3453
3732
|
var getPaneTitle = function getPaneTitle(sumOfErrors) {
|
|
3454
3733
|
switch (sumOfErrors) {
|
|
3455
3734
|
case 0:
|
|
@@ -3488,7 +3767,7 @@ var humanizeErrorMessage = function humanizeErrorMessage(nameAsString) {
|
|
|
3488
3767
|
var nameWithoutBrackets = nameAsString.replace(/[[\]']+/g, '');
|
|
3489
3768
|
var nameLowerCase = nameWithoutBrackets.toLowerCase();
|
|
3490
3769
|
|
|
3491
|
-
var _nameLowerCase$split$ = nameLowerCase.split(/([0-9]+)/) // split
|
|
3770
|
+
var _nameLowerCase$split$ = nameLowerCase.split(/([0-9]+)/) // split num bers from field and build array
|
|
3492
3771
|
.filter(function (s) {
|
|
3493
3772
|
return s.length;
|
|
3494
3773
|
}),
|
|
@@ -3516,33 +3795,73 @@ var getErrorMessage = function getErrorMessage(error, index) {
|
|
|
3516
3795
|
var fieldErrorTitle = humanizeErrorMessage(firstNamePart);
|
|
3517
3796
|
return "".concat(index + 1, ". ").concat(fieldErrorTitle, ": ").concat(getErrorDefaultMessage(error));
|
|
3518
3797
|
};
|
|
3798
|
+
var MODAL_DIALOG_ELEMENT = 'modal-dialog';
|
|
3799
|
+
var useIssuesPane = function useIssuesPane() {
|
|
3800
|
+
var _React$useState = React.useState(false),
|
|
3801
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3802
|
+
isIssuesPaneOpen = _React$useState2[0],
|
|
3803
|
+
setIsIssuesPaneOpen = _React$useState2[1];
|
|
3519
3804
|
|
|
3520
|
-
var
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
var
|
|
3526
|
-
|
|
3527
|
-
|
|
3805
|
+
var _React$useState3 = React.useState(null),
|
|
3806
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3807
|
+
startPosition = _React$useState4[0],
|
|
3808
|
+
setStartPosition = _React$useState4[1];
|
|
3809
|
+
|
|
3810
|
+
var onToggleIssuesPane = function onToggleIssuesPane(isOpen, newPosition) {
|
|
3811
|
+
if (!startPosition) {
|
|
3812
|
+
setStartPosition(newPosition);
|
|
3813
|
+
}
|
|
3814
|
+
|
|
3815
|
+
setIsIssuesPaneOpen(isOpen);
|
|
3816
|
+
};
|
|
3817
|
+
|
|
3818
|
+
var onCloseIssuesPane = function onCloseIssuesPane() {
|
|
3819
|
+
return setIsIssuesPaneOpen(false);
|
|
3820
|
+
};
|
|
3821
|
+
|
|
3822
|
+
return {
|
|
3823
|
+
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
3824
|
+
startPosition: startPosition,
|
|
3825
|
+
onToggleIssuesPane: onToggleIssuesPane,
|
|
3826
|
+
onCloseIssuesPane: onCloseIssuesPane
|
|
3827
|
+
};
|
|
3828
|
+
};
|
|
3829
|
+
|
|
3830
|
+
var IssuesPane = function IssuesPane(_ref3) {
|
|
3831
|
+
var _ref3$errorList = _ref3.errorList,
|
|
3832
|
+
errorList = _ref3$errorList === void 0 ? [] : _ref3$errorList,
|
|
3833
|
+
isOpen = _ref3.isOpen,
|
|
3834
|
+
handleClose = _ref3.handleClose,
|
|
3835
|
+
_ref3$startPosition = _ref3.startPosition,
|
|
3836
|
+
startPosition = _ref3$startPosition === void 0 ? {
|
|
3837
|
+
left: 20,
|
|
3838
|
+
top: 50
|
|
3839
|
+
} : _ref3$startPosition;
|
|
3840
|
+
var rootElement = document.getElementById(MODAL_DIALOG_ELEMENT) || document.body;
|
|
3841
|
+
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(ToolContainerDraggable, {
|
|
3842
|
+
startSize: {
|
|
3528
3843
|
width: '577px',
|
|
3529
3844
|
height: '200px'
|
|
3530
3845
|
},
|
|
3531
|
-
startPosition:
|
|
3532
|
-
right: 20,
|
|
3533
|
-
top: 50
|
|
3534
|
-
},
|
|
3846
|
+
startPosition: startPosition,
|
|
3535
3847
|
minWidth: 300,
|
|
3536
3848
|
onClose: handleClose,
|
|
3537
3849
|
title: getPaneTitle(errorList.length),
|
|
3538
3850
|
headerSize: "xs",
|
|
3539
3851
|
isOpen: isOpen,
|
|
3540
3852
|
"data-testid": "moveable-issues-pane",
|
|
3541
|
-
bounds: "
|
|
3542
|
-
}, /*#__PURE__*/React.createElement(
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3853
|
+
bounds: "parent"
|
|
3854
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
3855
|
+
component: "div",
|
|
3856
|
+
sx: {
|
|
3857
|
+
marginTop: '16px',
|
|
3858
|
+
marginLeft: '24px'
|
|
3859
|
+
}
|
|
3860
|
+
}, errorList.length === 0 && /*#__PURE__*/React.createElement(Box, {
|
|
3861
|
+
component: "div",
|
|
3862
|
+
sx: {
|
|
3863
|
+
fontSize: '4rem'
|
|
3864
|
+
},
|
|
3546
3865
|
"data-testid": "zeroIssuesImage"
|
|
3547
3866
|
}, /*#__PURE__*/React.createElement(ThumbsUp, null)), errorList.length > 0 && errorList.map(function (error, index) {
|
|
3548
3867
|
return /*#__PURE__*/React.createElement(Typography // eslint-disable-next-line react/no-array-index-key
|
|
@@ -3552,387 +3871,178 @@ var IssuesPane = function IssuesPane(_ref3) {
|
|
|
3552
3871
|
variant: "body1",
|
|
3553
3872
|
"data-testid": "errorMessage"
|
|
3554
3873
|
}, getErrorMessage(error, index));
|
|
3555
|
-
})));
|
|
3874
|
+
}))), rootElement);
|
|
3556
3875
|
};
|
|
3557
3876
|
|
|
3558
|
-
var
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
});
|
|
3877
|
+
var TafModuleContext = /*#__PURE__*/React.createContext({
|
|
3878
|
+
onValidateForm: null,
|
|
3879
|
+
registerValidateForm: null,
|
|
3880
|
+
tafAction: null,
|
|
3881
|
+
setTafAction: null
|
|
3882
|
+
});
|
|
3883
|
+
var useTafModuleContext = function useTafModuleContext() {
|
|
3884
|
+
return React.useContext(TafModuleContext);
|
|
3567
3885
|
};
|
|
3886
|
+
var useTafModuleState = function useTafModuleState() {
|
|
3887
|
+
var _React$useState = React.useState(function () {
|
|
3888
|
+
return new Promise(function () {
|
|
3889
|
+
return true;
|
|
3890
|
+
});
|
|
3891
|
+
}),
|
|
3892
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3893
|
+
onValidateForm = _React$useState2[0],
|
|
3894
|
+
registerValidateForm = _React$useState2[1];
|
|
3568
3895
|
|
|
3569
|
-
var
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3896
|
+
var _React$useState3 = React.useState(),
|
|
3897
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3898
|
+
tafAction = _React$useState4[0],
|
|
3899
|
+
setTafAction = _React$useState4[1];
|
|
3573
3900
|
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3901
|
+
var onRegisterValidateForm = function onRegisterValidateForm(promiseToRegister) {
|
|
3902
|
+
registerValidateForm(function () {
|
|
3903
|
+
return promiseToRegister;
|
|
3904
|
+
});
|
|
3905
|
+
};
|
|
3577
3906
|
|
|
3578
|
-
|
|
3579
|
-
|
|
3907
|
+
return {
|
|
3908
|
+
onValidateForm: onValidateForm,
|
|
3909
|
+
registerValidateForm: onRegisterValidateForm,
|
|
3910
|
+
tafAction: tafAction,
|
|
3911
|
+
setTafAction: setTafAction
|
|
3912
|
+
};
|
|
3580
3913
|
};
|
|
3581
|
-
|
|
3582
|
-
var
|
|
3583
|
-
var
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
var errorValues = errorValue.reduce(function (l, i) {
|
|
3588
|
-
return l.concat(getErrorValues(i));
|
|
3589
|
-
}, []);
|
|
3590
|
-
return list.concat.apply(list, _toConsumableArray(errorValues));
|
|
3591
|
-
}
|
|
3592
|
-
|
|
3593
|
-
return list.concat(getErrorValues(errorValue));
|
|
3594
|
-
}, []);
|
|
3595
|
-
return errorList;
|
|
3914
|
+
var TafModuleProvider = function TafModuleProvider(_ref) {
|
|
3915
|
+
var children = _ref.children;
|
|
3916
|
+
var contextState = useTafModuleState();
|
|
3917
|
+
return /*#__PURE__*/React.createElement(TafModuleContext.Provider, {
|
|
3918
|
+
value: contextState
|
|
3919
|
+
}, children);
|
|
3596
3920
|
};
|
|
3597
3921
|
|
|
3598
|
-
var
|
|
3599
|
-
return errors.reduce(function (list, error) {
|
|
3600
|
-
// check on type validateRequiredSub and validateRequiredMainOptional since these are giving 'duplicates'
|
|
3601
|
-
if (error.type === 'validateRequiredSub') {
|
|
3602
|
-
var exist = list.find(function (e) {
|
|
3603
|
-
return e.type === 'validateRequiredSub' && e.row === error.row;
|
|
3604
|
-
});
|
|
3605
|
-
return exist ? list : list.concat(error);
|
|
3606
|
-
}
|
|
3922
|
+
var noop = function noop() {};
|
|
3607
3923
|
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3924
|
+
var TafForm = function TafForm(_ref) {
|
|
3925
|
+
var tafFromBackend = _ref.tafFromBackend,
|
|
3926
|
+
_ref$onFormAction = _ref.onFormAction,
|
|
3927
|
+
onFormAction = _ref$onFormAction === void 0 ? function () {
|
|
3928
|
+
return null;
|
|
3929
|
+
} : _ref$onFormAction,
|
|
3930
|
+
_ref$onFormDirty = _ref.onFormDirty,
|
|
3931
|
+
onFormDirty = _ref$onFormDirty === void 0 ? function () {
|
|
3932
|
+
return null;
|
|
3933
|
+
} : _ref$onFormDirty,
|
|
3934
|
+
_ref$isIssuesPaneOpen = _ref.isIssuesPaneOpen,
|
|
3935
|
+
isIssuesPaneOpen = _ref$isIssuesPaneOpen === void 0 ? false : _ref$isIssuesPaneOpen,
|
|
3936
|
+
_ref$setIsIssuesPaneO = _ref.setIsIssuesPaneOpen,
|
|
3937
|
+
setIsIssuesPaneOpen = _ref$setIsIssuesPaneO === void 0 ? function () {
|
|
3938
|
+
return null;
|
|
3939
|
+
} : _ref$setIsIssuesPaneO,
|
|
3940
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
3941
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
3942
|
+
_ref$setIsDisabled = _ref.setIsDisabled,
|
|
3943
|
+
setIsDisabled = _ref$setIsDisabled === void 0 ? function () {
|
|
3944
|
+
return null;
|
|
3945
|
+
} : _ref$setIsDisabled;
|
|
3946
|
+
var originalTaf = tafFromBackend.taf;
|
|
3947
|
+
var isDefaultDisabled = getIsFormDefaultDisabled(tafFromBackend.taf.status);
|
|
3948
|
+
var confirmDialog = useConfirmationDialog();
|
|
3612
3949
|
|
|
3613
|
-
|
|
3614
|
-
|
|
3950
|
+
var _useDraftFormHelpers = useDraftFormHelpers(),
|
|
3951
|
+
toggleIsDraft = _useDraftFormHelpers.toggleIsDraft,
|
|
3952
|
+
DraftFieldHelper = _useDraftFormHelpers.DraftFieldHelper;
|
|
3615
3953
|
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3954
|
+
var _useTafModuleContext = useTafModuleContext(),
|
|
3955
|
+
registerValidateForm = _useTafModuleContext.registerValidateForm,
|
|
3956
|
+
tafAction = _useTafModuleContext.tafAction,
|
|
3957
|
+
setTafAction = _useTafModuleContext.setTafAction;
|
|
3958
|
+
|
|
3959
|
+
var _useApiContext = useApiContext(),
|
|
3960
|
+
api = _useApiContext.api;
|
|
3619
3961
|
|
|
3620
|
-
var
|
|
3621
|
-
|
|
3622
|
-
onTafFormButtonPress = _ref.onTafFormButtonPress;
|
|
3962
|
+
var _useIsMounted = useIsMounted(),
|
|
3963
|
+
isMounted = _useIsMounted.isMounted;
|
|
3623
3964
|
|
|
3624
3965
|
var _useFormContext = useFormContext(),
|
|
3625
|
-
|
|
3966
|
+
control = _useFormContext.control,
|
|
3967
|
+
handleSubmit = _useFormContext.handleSubmit,
|
|
3968
|
+
trigger = _useFormContext.trigger,
|
|
3969
|
+
formState = _useFormContext.formState,
|
|
3970
|
+
getValues = _useFormContext.getValues,
|
|
3971
|
+
setValue = _useFormContext.setValue,
|
|
3972
|
+
reset = _useFormContext.reset;
|
|
3626
3973
|
|
|
3627
|
-
var
|
|
3974
|
+
var isFormDirty = formState.isDirty,
|
|
3975
|
+
errors = formState.errors;
|
|
3976
|
+
usePreventBrowserClose(isFormDirty && !isDisabled);
|
|
3977
|
+
var hiddenInputFields = ['baseTime', 'issueDate', 'type', 'uuid', 'validDateStart', 'validDateEnd', 'status', 'previousId', 'previousValidDateStart', 'previousValidDateEnd'];
|
|
3628
3978
|
|
|
3629
|
-
var _React$useState = React__default.useState(
|
|
3979
|
+
var _React$useState = React__default.useState(getValues()),
|
|
3630
3980
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3631
|
-
|
|
3632
|
-
|
|
3981
|
+
delayedFormValues = _React$useState2[0],
|
|
3982
|
+
setDelayedFormValues = _React$useState2[1];
|
|
3983
|
+
|
|
3984
|
+
var _useTACGenerator = useTACGenerator(tafFromBackend.taf, api.getTAC),
|
|
3985
|
+
_useTACGenerator2 = _slicedToArray(_useTACGenerator, 2),
|
|
3986
|
+
TAC = _useTACGenerator2[0],
|
|
3987
|
+
updateTAC = _useTACGenerator2[1];
|
|
3988
|
+
|
|
3989
|
+
var hasErrors = Object.keys(errors).length;
|
|
3633
3990
|
|
|
3634
|
-
var
|
|
3635
|
-
|
|
3991
|
+
var onFormBlur = function onFormBlur() {
|
|
3992
|
+
setDelayedFormValues(getValues());
|
|
3636
3993
|
};
|
|
3637
3994
|
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
margin: '10px 0px 22px 0px'
|
|
3644
|
-
}
|
|
3645
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
3646
|
-
item: true
|
|
3647
|
-
}, /*#__PURE__*/React__default.createElement(IssuesButton, {
|
|
3648
|
-
sumOfErrors: errorList.length,
|
|
3649
|
-
togglePane: toggleIssuesPane
|
|
3650
|
-
}))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
3651
|
-
container: true,
|
|
3652
|
-
justifyContent: "flex-end",
|
|
3653
|
-
sx: {
|
|
3654
|
-
paddingRight: '28px'
|
|
3655
|
-
}
|
|
3656
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
3657
|
-
item: true
|
|
3658
|
-
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
3659
|
-
"data-testid": "discardtaf",
|
|
3660
|
-
variant: "tertiary",
|
|
3661
|
-
onClick: function onClick() {
|
|
3662
|
-
// Simply discard the changes and close the dialog.
|
|
3663
|
-
onTafFormButtonPress('DISCARD');
|
|
3664
|
-
}
|
|
3665
|
-
}, "Discard"), /*#__PURE__*/React__default.createElement(Button, {
|
|
3666
|
-
"data-testid": "savedrafttaf",
|
|
3667
|
-
variant: "tertiary",
|
|
3668
|
-
sx: {
|
|
3669
|
-
margin: '0px 10px'
|
|
3670
|
-
},
|
|
3671
|
-
onClick: function onClick() {
|
|
3672
|
-
/* Save the TAF as draft:
|
|
3673
|
-
if action NEW or DRAFT - new status will be DRAFT -- default
|
|
3674
|
-
if action AMEND - new status will be DRAFT_AMENDED
|
|
3675
|
-
if action CORRECT - new status will be DRAFT_CORRECTED
|
|
3676
|
-
if action DRAFT_AMEND - new status will be DRAFT_AMENDED
|
|
3677
|
-
if action DRAFT_CORRECT - new status will be DRAFT_CORRECTED
|
|
3678
|
-
*/
|
|
3679
|
-
switch (tafAction) {
|
|
3680
|
-
case 'AMEND':
|
|
3681
|
-
case 'DRAFT_AMEND':
|
|
3682
|
-
onTafFormButtonPress('DRAFT_AMEND');
|
|
3683
|
-
break;
|
|
3995
|
+
React__default.useEffect(function () {
|
|
3996
|
+
if (isMounted.current && isFormDirty) {
|
|
3997
|
+
var newTAC = hasErrors ? null : convertTafValuesToObject(delayedFormValues);
|
|
3998
|
+
updateTAC(newTAC);
|
|
3999
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3684
4000
|
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
4001
|
+
}, [delayedFormValues]);
|
|
4002
|
+
React__default.useEffect(function () {
|
|
4003
|
+
// prevent updating an error while typing
|
|
4004
|
+
if (!hasErrors && isFormDirty && document.activeElement.tagName !== 'INPUT') {
|
|
4005
|
+
updateTAC(convertTafValuesToObject(delayedFormValues));
|
|
4006
|
+
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3689
4007
|
|
|
3690
|
-
|
|
3691
|
-
onTafFormButtonPress('DRAFT');
|
|
3692
|
-
break;
|
|
3693
|
-
}
|
|
3694
|
-
}
|
|
3695
|
-
}, "Save"), /*#__PURE__*/React__default.createElement(Button, {
|
|
3696
|
-
"data-testid": "publishtaf",
|
|
3697
|
-
variant: "tertiary",
|
|
3698
|
-
onClick: function onClick() {
|
|
3699
|
-
/* Publish the TAF:
|
|
3700
|
-
if action NEW or DRAFT - new status will be PUBLISHED -- default
|
|
3701
|
-
if action AMEND - new status will be AMENDED
|
|
3702
|
-
if action CORRECT - new status will be CORRECTED
|
|
3703
|
-
if action DRAFT_AMEND - new status will be AMENDED
|
|
3704
|
-
if action DRAFT_CORRECT - new status will be CORRECTED
|
|
3705
|
-
*/
|
|
3706
|
-
switch (tafAction) {
|
|
3707
|
-
case 'AMEND':
|
|
3708
|
-
case 'DRAFT_AMEND':
|
|
3709
|
-
onTafFormButtonPress('AMEND');
|
|
3710
|
-
break;
|
|
4008
|
+
}, [hasErrors]); // Needed to be able to show a confirmation dialog on switching tabs when form is edited and not saved
|
|
3711
4009
|
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
break;
|
|
4010
|
+
React__default.useEffect(function () {
|
|
4011
|
+
onFormDirty(isFormDirty);
|
|
4012
|
+
}, [isFormDirty, onFormDirty]);
|
|
3716
4013
|
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
}
|
|
3722
|
-
}, "Publish"))), /*#__PURE__*/React__default.createElement(IssuesPane, {
|
|
3723
|
-
errorList: errorList,
|
|
3724
|
-
handleClose: toggleIssuesPane,
|
|
3725
|
-
isOpen: isIssuesPaneOpen
|
|
3726
|
-
}));
|
|
3727
|
-
};
|
|
4014
|
+
var onSubmit = function onSubmit(data) {
|
|
4015
|
+
// eslint-disable-next-line no-console
|
|
4016
|
+
console.log('submit:', convertTafValuesToObject(data));
|
|
4017
|
+
};
|
|
3728
4018
|
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3738
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3739
|
-
* See the License for the specific language governing permissions and
|
|
3740
|
-
* limitations under the License.
|
|
3741
|
-
*
|
|
3742
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3743
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3744
|
-
* */
|
|
3745
|
-
var useStyles$6 = makeStyles(function () {
|
|
3746
|
-
return {
|
|
3747
|
-
dragHandle: {
|
|
3748
|
-
backgroundColor: 'transparent',
|
|
3749
|
-
'&:hover': {
|
|
3750
|
-
backgroundColor: 'transparent'
|
|
3751
|
-
},
|
|
3752
|
-
cursor: function cursor(isSorting) {
|
|
3753
|
-
return isSorting ? 'grabbing' : 'grab';
|
|
3754
|
-
}
|
|
3755
|
-
}
|
|
4019
|
+
var showConfirmDialog = function showConfirmDialog(action) {
|
|
4020
|
+
return confirmDialog({
|
|
4021
|
+
title: getConfirmationDialogTitle(action),
|
|
4022
|
+
description: getConfirmationDialogContent(action, function () {
|
|
4023
|
+
return isTafAmendedCorrectedChanged(isFormDirty, originalTaf, convertTafValuesToObject(getValues()));
|
|
4024
|
+
}),
|
|
4025
|
+
confirmLabel: getConfirmationDialogButtonLabel(action)
|
|
4026
|
+
});
|
|
3756
4027
|
};
|
|
3757
|
-
});
|
|
3758
4028
|
|
|
3759
|
-
var
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
var classes = useStyles$6(isSorting);
|
|
3766
|
-
return /*#__PURE__*/React__default.createElement(IconButton, {
|
|
3767
|
-
className: "".concat(classes.dragHandle, " handle"),
|
|
3768
|
-
"data-testid": "dragHandle-".concat(index),
|
|
3769
|
-
disableRipple: true,
|
|
3770
|
-
disabled: isDisabled,
|
|
3771
|
-
size: "large"
|
|
3772
|
-
}, /*#__PURE__*/React__default.createElement(DragIndicator, null));
|
|
3773
|
-
};
|
|
4029
|
+
var resetFormValues = function resetFormValues() {
|
|
4030
|
+
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
|
|
4031
|
+
var shouldAddEmptyChangGroup = arguments.length > 1 ? arguments[1] : undefined;
|
|
4032
|
+
var newTaf = prepareTafValues(tafFromBackend.taf, action, shouldAddEmptyChangGroup);
|
|
4033
|
+
reset(newTaf);
|
|
4034
|
+
};
|
|
3774
4035
|
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3783
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3784
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3785
|
-
* See the License for the specific language governing permissions and
|
|
3786
|
-
* limitations under the License.
|
|
3787
|
-
*
|
|
3788
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3789
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3790
|
-
* */
|
|
3791
|
-
|
|
3792
|
-
var TafListButtons = function TafListButtons(_ref) {
|
|
3793
|
-
var uuid = _ref.uuid,
|
|
3794
|
-
canBe = _ref.canBe,
|
|
3795
|
-
onClickTafActionButton = _ref.onClickTafActionButton,
|
|
3796
|
-
_ref$testId = _ref.testId,
|
|
3797
|
-
testId = _ref$testId === void 0 ? 'taflist-canbebuttons' : _ref$testId;
|
|
3798
|
-
return !canBe.includes('CANCELLED') && !canBe.includes('CORRECTED') && !canBe.includes('AMENDED') ? null : /*#__PURE__*/React__default.createElement(Grid, {
|
|
3799
|
-
container: true,
|
|
3800
|
-
justifyContent: "flex-end",
|
|
3801
|
-
alignItems: "center",
|
|
3802
|
-
"data-testid": testId,
|
|
3803
|
-
sx: {
|
|
3804
|
-
margin: '10px 0px 22px 0px',
|
|
3805
|
-
paddingRight: '28px'
|
|
3806
|
-
}
|
|
3807
|
-
}, canBe.includes('CANCELLED') && /*#__PURE__*/React__default.createElement(Button, {
|
|
3808
|
-
"data-testid": "canceltaf",
|
|
3809
|
-
variant: "tertiary",
|
|
3810
|
-
onClick: function onClick() {
|
|
3811
|
-
return onClickTafActionButton('CANCEL', uuid);
|
|
3812
|
-
}
|
|
3813
|
-
}, "Cancel"), canBe.includes('CORRECTED') && /*#__PURE__*/React__default.createElement(Button, {
|
|
3814
|
-
"data-testid": "correctaf",
|
|
3815
|
-
variant: "tertiary",
|
|
3816
|
-
sx: {
|
|
3817
|
-
margin: '0px 10px'
|
|
3818
|
-
},
|
|
3819
|
-
onClick: function onClick() {
|
|
3820
|
-
return onClickTafActionButton('CORRECT', uuid);
|
|
3821
|
-
}
|
|
3822
|
-
}, "Correct"), canBe.includes('AMENDED') && /*#__PURE__*/React__default.createElement(Button, {
|
|
3823
|
-
"data-testid": "amendtaf",
|
|
3824
|
-
variant: "tertiary",
|
|
3825
|
-
onClick: function onClick() {
|
|
3826
|
-
return onClickTafActionButton('AMEND', uuid);
|
|
3827
|
-
}
|
|
3828
|
-
}, "Amend"));
|
|
3829
|
-
};
|
|
3830
|
-
|
|
3831
|
-
var noop = function noop() {};
|
|
3832
|
-
|
|
3833
|
-
var emptyChangegroup = {
|
|
3834
|
-
valid: '',
|
|
3835
|
-
wind: '',
|
|
3836
|
-
visibility: '',
|
|
3837
|
-
weather: {
|
|
3838
|
-
weather1: null,
|
|
3839
|
-
weather2: null,
|
|
3840
|
-
weather3: null
|
|
3841
|
-
},
|
|
3842
|
-
cloud: {
|
|
3843
|
-
cloud1: null,
|
|
3844
|
-
cloud2: null,
|
|
3845
|
-
cloud3: null,
|
|
3846
|
-
cloud4: null
|
|
3847
|
-
},
|
|
3848
|
-
change: null,
|
|
3849
|
-
probability: null
|
|
3850
|
-
};
|
|
3851
|
-
|
|
3852
|
-
var TafForm = function TafForm(_ref) {
|
|
3853
|
-
var isDisabled = _ref.isDisabled,
|
|
3854
|
-
tafAction = _ref.tafAction,
|
|
3855
|
-
_ref$staticTAC = _ref.staticTAC,
|
|
3856
|
-
staticTAC = _ref$staticTAC === void 0 ? '' : _ref$staticTAC,
|
|
3857
|
-
tafFromBackend = _ref.tafFromBackend,
|
|
3858
|
-
_ref$onFormAction = _ref.onFormAction,
|
|
3859
|
-
onFormAction = _ref$onFormAction === void 0 ? function () {
|
|
3860
|
-
return null;
|
|
3861
|
-
} : _ref$onFormAction;
|
|
3862
|
-
var originalTaf = tafFromBackend.taf;
|
|
3863
|
-
var confirmDialog = useConfirmationDialog();
|
|
3864
|
-
|
|
3865
|
-
var _useDraftFormHelpers = useDraftFormHelpers(),
|
|
3866
|
-
toggleIsDraft = _useDraftFormHelpers.toggleIsDraft,
|
|
3867
|
-
DraftFieldHelper = _useDraftFormHelpers.DraftFieldHelper;
|
|
3868
|
-
|
|
3869
|
-
var _useApiContext = useApiContext(),
|
|
3870
|
-
api = _useApiContext.api;
|
|
3871
|
-
|
|
3872
|
-
var _useIsMounted = useIsMounted(),
|
|
3873
|
-
isMounted = _useIsMounted.isMounted;
|
|
3874
|
-
|
|
3875
|
-
var _useFormContext = useFormContext(),
|
|
3876
|
-
control = _useFormContext.control,
|
|
3877
|
-
handleSubmit = _useFormContext.handleSubmit,
|
|
3878
|
-
watch = _useFormContext.watch,
|
|
3879
|
-
trigger = _useFormContext.trigger,
|
|
3880
|
-
formState = _useFormContext.formState,
|
|
3881
|
-
getValues = _useFormContext.getValues,
|
|
3882
|
-
setValue = _useFormContext.setValue;
|
|
3883
|
-
|
|
3884
|
-
var isFormDirty = formState.isDirty,
|
|
3885
|
-
errors = formState.errors;
|
|
3886
|
-
usePreventBrowserClose(isFormDirty && !isDisabled);
|
|
3887
|
-
var hiddenInputFields = ['baseTime', 'issueDate', 'type', 'uuid', 'validDateStart', 'validDateEnd', 'status', 'previousId', 'previousValidDateStart', 'previousValidDateEnd'];
|
|
3888
|
-
|
|
3889
|
-
var _React$useState = React__default.useState(watch()),
|
|
3890
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3891
|
-
delayedFormValues = _React$useState2[0],
|
|
3892
|
-
setDelayedFormValues = _React$useState2[1];
|
|
3893
|
-
|
|
3894
|
-
var _useTACGenerator = useTACGenerator(convertTafValuesToObject(delayedFormValues), api.getTAC, staticTAC),
|
|
3895
|
-
_useTACGenerator2 = _slicedToArray(_useTACGenerator, 2),
|
|
3896
|
-
TAC = _useTACGenerator2[0],
|
|
3897
|
-
updateTAC = _useTACGenerator2[1];
|
|
3898
|
-
|
|
3899
|
-
var hasErrors = Object.keys(errors).length;
|
|
3900
|
-
|
|
3901
|
-
var onFormBlur = function onFormBlur() {
|
|
3902
|
-
setDelayedFormValues(getValues());
|
|
3903
|
-
};
|
|
3904
|
-
|
|
3905
|
-
React__default.useEffect(function () {
|
|
3906
|
-
if (staticTAC === '' && isMounted.current && isFormDirty) {
|
|
3907
|
-
var newTAC = hasErrors ? null : convertTafValuesToObject(delayedFormValues);
|
|
3908
|
-
updateTAC(newTAC);
|
|
3909
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3910
|
-
|
|
3911
|
-
}, [delayedFormValues]);
|
|
3912
|
-
React__default.useEffect(function () {
|
|
3913
|
-
// prevent updating an error while typing
|
|
3914
|
-
if (!hasErrors && isFormDirty && document.activeElement.tagName !== 'INPUT') {
|
|
3915
|
-
updateTAC(convertTafValuesToObject(delayedFormValues));
|
|
3916
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3917
|
-
|
|
3918
|
-
}, [hasErrors]);
|
|
3919
|
-
|
|
3920
|
-
var onSubmit = function onSubmit(data) {
|
|
3921
|
-
// eslint-disable-next-line no-console
|
|
3922
|
-
console.log('submit:', convertTafValuesToObject(data));
|
|
3923
|
-
};
|
|
3924
|
-
|
|
3925
|
-
var showConfirmDialog = function showConfirmDialog(action) {
|
|
3926
|
-
return confirmDialog({
|
|
3927
|
-
title: getConfirmationDialogTitle(action),
|
|
3928
|
-
description: getConfirmationDialogContent(action, function () {
|
|
3929
|
-
return isTafAmendedCorrectedChanged(isFormDirty, originalTaf, convertTafValuesToObject(getValues()));
|
|
3930
|
-
}),
|
|
3931
|
-
confirmLabel: getConfirmationDialogButtonLabel(action)
|
|
3932
|
-
});
|
|
4036
|
+
var resetForm = function resetForm() {
|
|
4037
|
+
var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : undefined;
|
|
4038
|
+
var resetDisabled = arguments.length > 1 ? arguments[1] : undefined;
|
|
4039
|
+
var shouldAddEmptyChangGroup = !(tafFromBackend.taf && tafFromBackend.taf.changeGroups) && !resetDisabled;
|
|
4040
|
+
resetFormValues(action, shouldAddEmptyChangGroup);
|
|
4041
|
+
setIsDisabled(resetDisabled);
|
|
4042
|
+
setTafAction(action);
|
|
3933
4043
|
};
|
|
3934
4044
|
|
|
3935
|
-
var
|
|
4045
|
+
var onTafEditModeButtonPress = function onTafEditModeButtonPress(action) {
|
|
3936
4046
|
switch (action) {
|
|
3937
4047
|
case 'DRAFT':
|
|
3938
4048
|
case 'DRAFT_AMEND':
|
|
@@ -3940,16 +4050,17 @@ var TafForm = function TafForm(_ref) {
|
|
|
3940
4050
|
toggleIsDraft(true);
|
|
3941
4051
|
handleSubmit(function (data) {
|
|
3942
4052
|
onFormAction(action, convertTafValuesToObject(data));
|
|
4053
|
+
reset(getValues());
|
|
3943
4054
|
})();
|
|
3944
4055
|
break;
|
|
3945
4056
|
|
|
3946
4057
|
case 'DISCARD':
|
|
3947
4058
|
if (isFormDirty) {
|
|
3948
4059
|
showConfirmDialog(action).then(function () {
|
|
3949
|
-
|
|
4060
|
+
resetForm(undefined, isDefaultDisabled);
|
|
3950
4061
|
});
|
|
3951
4062
|
} else {
|
|
3952
|
-
|
|
4063
|
+
resetForm(undefined, isDefaultDisabled);
|
|
3953
4064
|
}
|
|
3954
4065
|
|
|
3955
4066
|
break;
|
|
@@ -3959,9 +4070,35 @@ var TafForm = function TafForm(_ref) {
|
|
|
3959
4070
|
case 'PUBLISH':
|
|
3960
4071
|
toggleIsDraft(false);
|
|
3961
4072
|
handleSubmit(function (data) {
|
|
3962
|
-
|
|
3963
|
-
|
|
3964
|
-
|
|
4073
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
4074
|
+
var didSucceed;
|
|
4075
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
4076
|
+
while (1) {
|
|
4077
|
+
switch (_context.prev = _context.next) {
|
|
4078
|
+
case 0:
|
|
4079
|
+
_context.next = 2;
|
|
4080
|
+
return showConfirmDialog(action);
|
|
4081
|
+
|
|
4082
|
+
case 2:
|
|
4083
|
+
_context.next = 4;
|
|
4084
|
+
return onFormAction(action, convertTafValuesToObject(data));
|
|
4085
|
+
|
|
4086
|
+
case 4:
|
|
4087
|
+
didSucceed = _context.sent;
|
|
4088
|
+
|
|
4089
|
+
if (didSucceed) {
|
|
4090
|
+
setIsDisabled(true);
|
|
4091
|
+
reset(prepareTafValues(convertTafValuesToObject(data), action, false));
|
|
4092
|
+
setTafAction(null);
|
|
4093
|
+
}
|
|
4094
|
+
|
|
4095
|
+
case 6:
|
|
4096
|
+
case "end":
|
|
4097
|
+
return _context.stop();
|
|
4098
|
+
}
|
|
4099
|
+
}
|
|
4100
|
+
}, _callee);
|
|
4101
|
+
}));
|
|
3965
4102
|
})();
|
|
3966
4103
|
break;
|
|
3967
4104
|
|
|
@@ -3969,13 +4106,18 @@ var TafForm = function TafForm(_ref) {
|
|
|
3969
4106
|
onFormAction(action);
|
|
3970
4107
|
break;
|
|
3971
4108
|
}
|
|
3972
|
-
};
|
|
3973
|
-
|
|
4109
|
+
};
|
|
3974
4110
|
|
|
3975
4111
|
var onTafViewModeButtonPress = function onTafViewModeButtonPress(action) {
|
|
3976
4112
|
switch (action) {
|
|
4113
|
+
case 'CANCEL':
|
|
4114
|
+
showConfirmDialog(action).then(function () {
|
|
4115
|
+
onFormAction(action, convertTafValuesToObject(prepareTafValues(tafFromBackend.taf, action)));
|
|
4116
|
+
});
|
|
4117
|
+
break;
|
|
4118
|
+
|
|
3977
4119
|
default:
|
|
3978
|
-
|
|
4120
|
+
resetForm(action, false);
|
|
3979
4121
|
break;
|
|
3980
4122
|
}
|
|
3981
4123
|
};
|
|
@@ -4061,16 +4203,53 @@ var TafForm = function TafForm(_ref) {
|
|
|
4061
4203
|
});
|
|
4062
4204
|
};
|
|
4063
4205
|
|
|
4206
|
+
var _React$useState3 = React__default.useState(false),
|
|
4207
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
4208
|
+
shouldValidate = _React$useState4[0],
|
|
4209
|
+
setShouldValidate = _React$useState4[1];
|
|
4210
|
+
|
|
4211
|
+
React__default.useEffect(function () {
|
|
4212
|
+
setIsDisabled(isDefaultDisabled);
|
|
4213
|
+
var defaultValues = prepareTafValues(tafFromBackend.taf, undefined, !isDefaultDisabled && !tafFromBackend.taf.changeGroups); // set initial form values
|
|
4214
|
+
|
|
4215
|
+
reset(defaultValues); // set validate flag to validate after the values have been set
|
|
4216
|
+
|
|
4217
|
+
setShouldValidate(true); // register validate method to use in parent components
|
|
4218
|
+
|
|
4219
|
+
var onValidateFormPromise = function onValidateFormPromise() {
|
|
4220
|
+
return new Promise(function (resolve, reject) {
|
|
4221
|
+
toggleIsDraft(true);
|
|
4222
|
+
handleSubmit(function (formData) {
|
|
4223
|
+
resolve(convertTafValuesToObject(formData));
|
|
4224
|
+
})().then(function (formData) {
|
|
4225
|
+
if (formData === undefined) {
|
|
4226
|
+
reject();
|
|
4227
|
+
}
|
|
4228
|
+
|
|
4229
|
+
resolve(formData);
|
|
4230
|
+
});
|
|
4231
|
+
});
|
|
4232
|
+
};
|
|
4233
|
+
|
|
4234
|
+
registerValidateForm(onValidateFormPromise); // set default taf action
|
|
4235
|
+
|
|
4236
|
+
setTafAction(fromStatusToAction(originalTaf.status));
|
|
4237
|
+
return function () {
|
|
4238
|
+
reset({});
|
|
4239
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4240
|
+
}, []);
|
|
4064
4241
|
React__default.useEffect(function () {
|
|
4065
|
-
if (!isDisabled) {
|
|
4242
|
+
if (shouldValidate && !isDisabled) {
|
|
4066
4243
|
// trigger validation on all changegroup validity times after initial load since they could be outside the new validity period
|
|
4067
|
-
var
|
|
4244
|
+
var _tafFromBackend$taf$c = tafFromBackend.taf.changeGroups,
|
|
4245
|
+
changeGroups = _tafFromBackend$taf$c === void 0 ? [] : _tafFromBackend$taf$c;
|
|
4246
|
+
var validFields = changeGroups.map(function (_field, index) {
|
|
4068
4247
|
return "changeGroups[".concat(index, "].valid");
|
|
4069
4248
|
});
|
|
4070
4249
|
trigger(validFields);
|
|
4071
4250
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4072
4251
|
|
|
4073
|
-
}, []);
|
|
4252
|
+
}, [shouldValidate]);
|
|
4074
4253
|
return /*#__PURE__*/React__default.createElement("form", {
|
|
4075
4254
|
"data-testid": "taf-form",
|
|
4076
4255
|
onSubmit: handleSubmit(onSubmit),
|
|
@@ -4078,7 +4257,8 @@ var TafForm = function TafForm(_ref) {
|
|
|
4078
4257
|
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
4079
4258
|
sx: {
|
|
4080
4259
|
fontSize: '20px',
|
|
4081
|
-
fontWeight: 500
|
|
4260
|
+
fontWeight: 500,
|
|
4261
|
+
height: '24px'
|
|
4082
4262
|
}
|
|
4083
4263
|
}, "TAC"), /*#__PURE__*/React__default.createElement(Typography, {
|
|
4084
4264
|
sx: {
|
|
@@ -4093,7 +4273,8 @@ var TafForm = function TafForm(_ref) {
|
|
|
4093
4273
|
"data-testid": "tafform-tac-message-line",
|
|
4094
4274
|
sx: {
|
|
4095
4275
|
textIndent: '-0.7em',
|
|
4096
|
-
borderRadius: '3px'
|
|
4276
|
+
borderRadius: '3px',
|
|
4277
|
+
paddingRight: '0.7em'
|
|
4097
4278
|
}
|
|
4098
4279
|
}, line);
|
|
4099
4280
|
})), /*#__PURE__*/React__default.createElement(TafFormRow, {
|
|
@@ -4135,15 +4316,26 @@ var TafForm = function TafForm(_ref) {
|
|
|
4135
4316
|
index: index
|
|
4136
4317
|
})
|
|
4137
4318
|
});
|
|
4138
|
-
})),
|
|
4139
|
-
|
|
4319
|
+
})), !isDisabled && /*#__PURE__*/React__default.createElement(Grid, {
|
|
4320
|
+
container: true,
|
|
4321
|
+
justifyContent: "space-between",
|
|
4322
|
+
alignItems: "center",
|
|
4323
|
+
sx: {
|
|
4324
|
+
marginLeft: 1.5,
|
|
4325
|
+
marginTop: 1
|
|
4326
|
+
}
|
|
4327
|
+
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4328
|
+
item: true
|
|
4329
|
+
}, /*#__PURE__*/React__default.createElement(IssuesButton, {
|
|
4330
|
+
errors: errors,
|
|
4331
|
+
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
4332
|
+
setIsIssuesPaneOpen: setIsIssuesPaneOpen
|
|
4333
|
+
}))), /*#__PURE__*/React__default.createElement(TafFormButtons, {
|
|
4334
|
+
isFormDisabled: isDisabled,
|
|
4140
4335
|
tafAction: tafAction,
|
|
4141
|
-
onTafFormButtonPress: onTafButtonPress
|
|
4142
|
-
}) : /*#__PURE__*/React__default.createElement(TafListButtons, {
|
|
4143
|
-
uuid: originalTaf.uuid,
|
|
4144
4336
|
canBe: tafFromBackend.canbe,
|
|
4145
|
-
|
|
4146
|
-
|
|
4337
|
+
onTafEditModeButtonPress: onTafEditModeButtonPress,
|
|
4338
|
+
onTafViewModeButtonPress: onTafViewModeButtonPress
|
|
4147
4339
|
}), hiddenInputFields.map(function (field) {
|
|
4148
4340
|
return /*#__PURE__*/React__default.createElement(ReactHookFormHiddenInput, {
|
|
4149
4341
|
name: field,
|
|
@@ -4165,158 +4357,23 @@ var TafForm = function TafForm(_ref) {
|
|
|
4165
4357
|
* See the License for the specific language governing permissions and
|
|
4166
4358
|
* limitations under the License.
|
|
4167
4359
|
*
|
|
4168
|
-
* Copyright
|
|
4169
|
-
* Copyright
|
|
4360
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4361
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
4170
4362
|
* */
|
|
4171
|
-
var getMessageType = function getMessageType(taf, tafAction) {
|
|
4172
|
-
if (tafAction === 'CORRECT') {
|
|
4173
|
-
return 'COR';
|
|
4174
|
-
}
|
|
4175
|
-
|
|
4176
|
-
if (tafAction === 'AMEND') {
|
|
4177
|
-
return 'AMD';
|
|
4178
|
-
}
|
|
4179
|
-
|
|
4180
|
-
return taf.messageType;
|
|
4181
|
-
}; // For corrections and amendment we need to add the previousValidStart and End for the TAC converter
|
|
4182
|
-
|
|
4183
|
-
var getAmendedCorrectedTafTimes = function getAmendedCorrectedTafTimes(taf, tafAction) {
|
|
4184
|
-
var previousValidDateStart = taf.previousValidDateStart && tafAction !== 'AMEND' ? taf.previousValidDateStart : taf.validDateStart;
|
|
4185
|
-
var previousValidDateEnd = taf.previousValidDateEnd && tafAction !== 'AMEND' ? taf.previousValidDateEnd : taf.validDateEnd; // For amendment change valid start time to current time
|
|
4186
|
-
// only do this if we're already within the validity period
|
|
4187
|
-
|
|
4188
|
-
if ((tafAction === 'AMEND' || tafAction === 'DRAFT_AMEND') && moment.utc() >= moment.utc(taf.validDateStart)) {
|
|
4189
|
-
var now = moment.utc().format('YYYY-MM-DDTHH:mm:ss[Z]');
|
|
4190
|
-
var validObj = {
|
|
4191
|
-
start: now,
|
|
4192
|
-
end: taf.baseForecast.valid.end
|
|
4193
|
-
};
|
|
4194
|
-
return Object.assign(Object.assign({}, taf), {
|
|
4195
|
-
previousValidDateStart: previousValidDateStart,
|
|
4196
|
-
previousValidDateEnd: previousValidDateEnd,
|
|
4197
|
-
validDateStart: now,
|
|
4198
|
-
baseForecast: Object.assign(Object.assign({}, taf.baseForecast), {
|
|
4199
|
-
valid: validObj
|
|
4200
|
-
})
|
|
4201
|
-
});
|
|
4202
|
-
}
|
|
4203
|
-
|
|
4204
|
-
return Object.assign(Object.assign({}, taf), {
|
|
4205
|
-
previousValidDateStart: previousValidDateStart,
|
|
4206
|
-
previousValidDateEnd: previousValidDateEnd
|
|
4207
|
-
});
|
|
4208
|
-
};
|
|
4209
|
-
var prepareTafValues = function prepareTafValues(_taf, tafAction) {
|
|
4210
|
-
var addEmptyChangeGroup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
4211
|
-
// If action is AMEND/CORRECT/DRAFT_AMEND/DRAFT_CORRECTION - add previous valid start and end
|
|
4212
|
-
// If action is AMEND/DRAFT_AMEND - update validity start time to current time
|
|
4213
|
-
var taf = tafAction === 'AMEND' || tafAction === 'DRAFT_AMEND' || tafAction === 'CORRECT' || tafAction === 'DRAFT_CORRECT' ? getAmendedCorrectedTafTimes(_taf, tafAction) : _taf;
|
|
4214
|
-
return Object.assign(Object.assign(Object.assign(Object.assign({}, taf), {
|
|
4215
|
-
messageType: getMessageType(taf, tafAction),
|
|
4216
|
-
baseForecast: formatFormValues(taf.baseForecast)
|
|
4217
|
-
}), taf.changeGroups && {
|
|
4218
|
-
changeGroups: taf.changeGroups.map(formatFormValues)
|
|
4219
|
-
}), addEmptyChangeGroup && {
|
|
4220
|
-
changeGroups: [emptyChangegroup]
|
|
4221
|
-
});
|
|
4222
|
-
};
|
|
4223
|
-
|
|
4224
|
-
var TafFormWrapper = function TafFormWrapper(_ref) {
|
|
4225
|
-
var tafFromBackend = _ref.tafFromBackend,
|
|
4226
|
-
mode = _ref.mode,
|
|
4227
|
-
tafAction = _ref.tafAction,
|
|
4228
|
-
_ref$TAC = _ref.TAC,
|
|
4229
|
-
TAC = _ref$TAC === void 0 ? '' : _ref$TAC,
|
|
4230
|
-
onFormAction = _ref.onFormAction;
|
|
4231
|
-
var taf = tafFromBackend.taf;
|
|
4232
|
-
var isDisabled = mode === 'view';
|
|
4233
|
-
var defaultValues = prepareTafValues(taf, tafAction, !isDisabled && !taf.changeGroups);
|
|
4234
|
-
var options = {
|
|
4235
|
-
defaultValues: defaultValues,
|
|
4236
|
-
mode: 'onTouched',
|
|
4237
|
-
reValidateMode: 'onChange',
|
|
4238
|
-
criteriaMode: 'all'
|
|
4239
|
-
};
|
|
4240
|
-
return /*#__PURE__*/React__default.createElement(ReactHookFormProvider, {
|
|
4241
|
-
options: options
|
|
4242
|
-
}, /*#__PURE__*/React__default.createElement(TafForm, {
|
|
4243
|
-
isDisabled: isDisabled,
|
|
4244
|
-
tafAction: tafAction,
|
|
4245
|
-
staticTAC: TAC,
|
|
4246
|
-
onFormAction: onFormAction,
|
|
4247
|
-
tafFromBackend: tafFromBackend
|
|
4248
|
-
}));
|
|
4249
|
-
};
|
|
4250
|
-
|
|
4251
|
-
var useStyles$5 = makeStyles({
|
|
4252
|
-
dialogHeader: {
|
|
4253
|
-
borderRadius: '3px',
|
|
4254
|
-
border: 'solid 1px #f6f5f5',
|
|
4255
|
-
zIndex: 1,
|
|
4256
|
-
padding: '16px 20px'
|
|
4257
|
-
},
|
|
4258
|
-
dialogTitle: {
|
|
4259
|
-
display: 'flex',
|
|
4260
|
-
alignItems: 'center'
|
|
4261
|
-
},
|
|
4262
|
-
dialogCloseButton: {
|
|
4263
|
-
display: 'flex',
|
|
4264
|
-
justifyContent: 'flex-end'
|
|
4265
|
-
},
|
|
4266
|
-
dialogChildren: {
|
|
4267
|
-
display: 'flex',
|
|
4268
|
-
padding: 20,
|
|
4269
|
-
minHeight: 200,
|
|
4270
|
-
minWidth: 400,
|
|
4271
|
-
height: '100%'
|
|
4272
|
-
}
|
|
4273
|
-
});
|
|
4274
4363
|
|
|
4275
|
-
var
|
|
4276
|
-
var
|
|
4277
|
-
_a.
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
"data-testid": "contentDialog",
|
|
4289
|
-
open: open,
|
|
4290
|
-
onClose: function onClose() {
|
|
4291
|
-
return onFormAction('CLOSE');
|
|
4292
|
-
},
|
|
4293
|
-
maxWidth: other.maxWidth ? other.maxWidth : 'lg',
|
|
4294
|
-
PaperProps: {
|
|
4295
|
-
style: {
|
|
4296
|
-
position: 'inherit'
|
|
4297
|
-
}
|
|
4298
|
-
}
|
|
4299
|
-
}, other), /*#__PURE__*/React.createElement(DialogTitle, {
|
|
4300
|
-
className: classes.dialogHeader
|
|
4301
|
-
}, /*#__PURE__*/React.createElement(Grid, {
|
|
4302
|
-
container: true
|
|
4303
|
-
}, /*#__PURE__*/React.createElement(Grid, {
|
|
4304
|
-
item: true,
|
|
4305
|
-
xs: 11,
|
|
4306
|
-
className: classes.dialogTitle
|
|
4307
|
-
}, titleComponent), /*#__PURE__*/React.createElement(Grid, {
|
|
4308
|
-
item: true,
|
|
4309
|
-
xs: true,
|
|
4310
|
-
className: classes.dialogCloseButton
|
|
4311
|
-
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
4312
|
-
"data-testid": "closeDialog",
|
|
4313
|
-
size: "small",
|
|
4314
|
-
onClick: function onClick() {
|
|
4315
|
-
return onFormAction('CLOSE');
|
|
4316
|
-
}
|
|
4317
|
-
}, /*#__PURE__*/React.createElement(Close, null))))), alertBanner !== null && alertBanner, /*#__PURE__*/React.createElement(DialogContent, {
|
|
4318
|
-
className: classes.dialogChildren
|
|
4319
|
-
}, children));
|
|
4364
|
+
var TabPanel = function TabPanel(_a) {
|
|
4365
|
+
var children = _a.children,
|
|
4366
|
+
value = _a.value,
|
|
4367
|
+
index = _a.index,
|
|
4368
|
+
other = __rest(_a, ["children", "value", "index"]);
|
|
4369
|
+
|
|
4370
|
+
return /*#__PURE__*/React__default.createElement(Box, Object.assign({
|
|
4371
|
+
role: "tabpanel",
|
|
4372
|
+
hidden: value !== index,
|
|
4373
|
+
id: "simple-tabpanel-".concat(index),
|
|
4374
|
+
"aria-labelledby": "simple-tab-".concat(index),
|
|
4375
|
+
"data-testid": "tab-panel-".concat(index)
|
|
4376
|
+
}, other), value === index && children);
|
|
4320
4377
|
};
|
|
4321
4378
|
|
|
4322
4379
|
/* *
|
|
@@ -4332,361 +4389,168 @@ var ContentDialog = function ContentDialog(_a) {
|
|
|
4332
4389
|
* See the License for the specific language governing permissions and
|
|
4333
4390
|
* limitations under the License.
|
|
4334
4391
|
*
|
|
4335
|
-
* Copyright
|
|
4336
|
-
* Copyright
|
|
4392
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4393
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
4337
4394
|
* */
|
|
4338
4395
|
|
|
4339
|
-
var
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
});
|
|
4349
|
-
};
|
|
4350
|
-
|
|
4351
|
-
var getStatusTagList = function getStatusTagList(taf) {
|
|
4352
|
-
// do not return anything if status = 'NEW'
|
|
4353
|
-
if (taf.status === 'NEW') return null;
|
|
4354
|
-
|
|
4355
|
-
if (taf.status === 'CANCELLED') {
|
|
4356
|
-
return /*#__PURE__*/React__default.createElement(StatusTag, {
|
|
4357
|
-
content: "cancelled",
|
|
4358
|
-
color: "red"
|
|
4359
|
-
});
|
|
4360
|
-
}
|
|
4361
|
-
|
|
4362
|
-
return /*#__PURE__*/React__default.createElement(StatusTag, {
|
|
4363
|
-
content: taf.status.toLowerCase(),
|
|
4364
|
-
color: taf.status === 'EXPIRED' ? 'grey' : 'green'
|
|
4365
|
-
});
|
|
4396
|
+
var TafHeader = function TafHeader(_ref) {
|
|
4397
|
+
var title = _ref.title;
|
|
4398
|
+
return /*#__PURE__*/React__default.createElement(Typography, {
|
|
4399
|
+
sx: {
|
|
4400
|
+
textAlign: 'center',
|
|
4401
|
+
fontWeight: 500,
|
|
4402
|
+
paddingTop: '6px',
|
|
4403
|
+
textTransform: 'capitalize'
|
|
4404
|
+
}
|
|
4405
|
+
}, title);
|
|
4366
4406
|
};
|
|
4367
4407
|
|
|
4368
|
-
var
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4408
|
+
var location_indicator_mwo = "EHDB";
|
|
4409
|
+
var locations = {
|
|
4410
|
+
EHAM: {
|
|
4411
|
+
validity_duration: 30,
|
|
4412
|
+
activity_period: 6,
|
|
4413
|
+
label: "Schiphol"
|
|
4414
|
+
},
|
|
4415
|
+
EHRD: {
|
|
4416
|
+
validity_duration: 30,
|
|
4417
|
+
activity_period: 6,
|
|
4418
|
+
label: "Rotterdam"
|
|
4419
|
+
},
|
|
4420
|
+
EHGG: {
|
|
4421
|
+
validity_duration: 30,
|
|
4422
|
+
activity_period: 6,
|
|
4423
|
+
label: "Eelde"
|
|
4424
|
+
},
|
|
4425
|
+
EHBK: {
|
|
4426
|
+
validity_duration: 30,
|
|
4427
|
+
activity_period: 6,
|
|
4428
|
+
label: "Maastricht"
|
|
4429
|
+
},
|
|
4430
|
+
EHLE: {
|
|
4431
|
+
validity_duration: 30,
|
|
4432
|
+
activity_period: 6,
|
|
4433
|
+
label: "Lelystad"
|
|
4434
|
+
},
|
|
4435
|
+
TNCB: {
|
|
4436
|
+
validity_duration: 30,
|
|
4437
|
+
activity_period: 6,
|
|
4438
|
+
label: "Bonaire"
|
|
4439
|
+
}
|
|
4440
|
+
};
|
|
4441
|
+
var locationOrder = [
|
|
4442
|
+
"EHAM",
|
|
4443
|
+
"EHRD",
|
|
4444
|
+
"EHLE",
|
|
4445
|
+
"EHGG",
|
|
4446
|
+
"EHBK",
|
|
4447
|
+
"TNCB"
|
|
4448
|
+
];
|
|
4449
|
+
var tafConfig = {
|
|
4450
|
+
location_indicator_mwo: location_indicator_mwo,
|
|
4451
|
+
locations: locations,
|
|
4452
|
+
locationOrder: locationOrder
|
|
4378
4453
|
};
|
|
4379
|
-
var useStyles$4 = makeStyles({
|
|
4380
|
-
cardWrapper: {
|
|
4381
|
-
width: '100%'
|
|
4382
|
-
},
|
|
4383
|
-
cardContent: {
|
|
4384
|
-
width: '100%'
|
|
4385
|
-
},
|
|
4386
|
-
activeStatus: {
|
|
4387
|
-
color: '#72bb23'
|
|
4388
|
-
},
|
|
4389
|
-
font: {
|
|
4390
|
-
fontWeight: 'normal'
|
|
4391
|
-
},
|
|
4392
|
-
alignIcon: {
|
|
4393
|
-
display: 'flex',
|
|
4394
|
-
alignSelf: 'center'
|
|
4395
|
-
}
|
|
4396
|
-
});
|
|
4397
4454
|
|
|
4398
|
-
var
|
|
4399
|
-
|
|
4400
|
-
listType = _ref.listType,
|
|
4401
|
-
_ref$TAC = _ref.TAC,
|
|
4402
|
-
TAC = _ref$TAC === void 0 ? '' : _ref$TAC,
|
|
4403
|
-
_ref$showTac = _ref.showTac,
|
|
4404
|
-
showTac = _ref$showTac === void 0 ? false : _ref$showTac;
|
|
4405
|
-
var classes = useStyles$4();
|
|
4406
|
-
var validTimeDate = moment.utc(taf.validDateStart).format('DD MMM');
|
|
4407
|
-
var baseTime = moment.utc(taf.baseTime).format('HH:mm');
|
|
4408
|
-
return /*#__PURE__*/React__default.createElement(Card, {
|
|
4409
|
-
elevation: 0,
|
|
4410
|
-
className: classes.cardWrapper
|
|
4411
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4412
|
-
container: true,
|
|
4413
|
-
alignItems: "center",
|
|
4414
|
-
spacing: 1
|
|
4415
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4416
|
-
item: true,
|
|
4417
|
-
xs: 3,
|
|
4418
|
-
sm: 2,
|
|
4419
|
-
md: 1
|
|
4420
|
-
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
4421
|
-
variant: "subtitle2",
|
|
4422
|
-
noWrap: true,
|
|
4423
|
-
className: classes.font
|
|
4424
|
-
}, taf.location)), /*#__PURE__*/React__default.createElement(Grid, {
|
|
4425
|
-
item: true,
|
|
4426
|
-
xs: 3,
|
|
4427
|
-
sm: 3,
|
|
4428
|
-
md: 1,
|
|
4429
|
-
container: true
|
|
4430
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4431
|
-
item: true,
|
|
4432
|
-
xs: 3,
|
|
4433
|
-
sm: 3,
|
|
4434
|
-
md: 3,
|
|
4435
|
-
className: classes.alignIcon
|
|
4436
|
-
}, showTac && /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
4437
|
-
"data-testid": "taflistrow-tactooltip",
|
|
4438
|
-
title: /*#__PURE__*/React__default.createElement("div", {
|
|
4439
|
-
style: {
|
|
4440
|
-
whiteSpace: 'pre-line'
|
|
4441
|
-
}
|
|
4442
|
-
}, TAC),
|
|
4443
|
-
placement: "bottom-start"
|
|
4444
|
-
}, /*#__PURE__*/React__default.createElement(InfoOutlined, {
|
|
4445
|
-
"data-testid": "taflistrow-tacicon",
|
|
4446
|
-
color: "secondary",
|
|
4447
|
-
fontSize: "small"
|
|
4448
|
-
}))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
4449
|
-
item: true,
|
|
4450
|
-
xs: 9,
|
|
4451
|
-
sm: 9,
|
|
4452
|
-
md: 9
|
|
4453
|
-
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
4454
|
-
variant: "subtitle2",
|
|
4455
|
-
className: classes.font,
|
|
4456
|
-
"data-testid": "baseTime"
|
|
4457
|
-
}, baseTime))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
4458
|
-
item: true,
|
|
4459
|
-
xs: 3,
|
|
4460
|
-
sm: 2,
|
|
4461
|
-
md: 1
|
|
4462
|
-
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
4463
|
-
variant: "subtitle2",
|
|
4464
|
-
className: classes.font,
|
|
4465
|
-
"data-testid": "validTimeDate"
|
|
4466
|
-
}, validTimeDate)), /*#__PURE__*/React__default.createElement(Grid, {
|
|
4467
|
-
item: true,
|
|
4468
|
-
xs: 3,
|
|
4469
|
-
sm: 3,
|
|
4470
|
-
md: 6
|
|
4471
|
-
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
4472
|
-
variant: "subtitle2",
|
|
4473
|
-
className: classes.font,
|
|
4474
|
-
"data-testid": "validTimeSlot"
|
|
4475
|
-
}, formatValidToString({
|
|
4476
|
-
start: taf.validDateStart,
|
|
4477
|
-
end: taf.validDateEnd
|
|
4478
|
-
}))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
4479
|
-
item: true,
|
|
4480
|
-
xs: 12,
|
|
4481
|
-
sm: 4,
|
|
4482
|
-
md: 3
|
|
4483
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4484
|
-
container: true,
|
|
4485
|
-
justifyContent: "flex-start",
|
|
4486
|
-
spacing: 2
|
|
4487
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4488
|
-
item: true,
|
|
4489
|
-
xs: 8,
|
|
4490
|
-
container: true,
|
|
4491
|
-
justifyContent: "flex-end"
|
|
4492
|
-
}, taf.status === 'DRAFT' || taf.status === 'DRAFT_CORRECTED' || taf.status === 'DRAFT_AMENDED' ? /*#__PURE__*/React__default.createElement(Button, {
|
|
4493
|
-
color: "secondary",
|
|
4494
|
-
size: "small",
|
|
4495
|
-
"data-testid": "tafRow-draft",
|
|
4496
|
-
startIcon: /*#__PURE__*/React__default.createElement(Create, {
|
|
4497
|
-
fontSize: "small",
|
|
4498
|
-
color: "secondary"
|
|
4499
|
-
})
|
|
4500
|
-
}, getDraftTitle(taf.status)) : getStatusTagList(taf)), /*#__PURE__*/React__default.createElement(Grid, {
|
|
4501
|
-
item: true,
|
|
4502
|
-
className: classes.alignIcon
|
|
4503
|
-
}, taf.status !== 'NEW' && taf.status !== 'DRAFT' && taf.status !== 'DRAFT_CORRECTED' && taf.status !== 'DRAFT_AMENDED' && taf.status !== 'CANCELLED' && listType !== 'EXPIRED' && getActiveStatus(listType, classes.activeStatus))))));
|
|
4455
|
+
var getTafSettings = function getTafSettings() {
|
|
4456
|
+
return tafConfig;
|
|
4504
4457
|
};
|
|
4505
4458
|
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
var
|
|
4523
|
-
|
|
4459
|
+
var tafSettings = getTafSettings();
|
|
4460
|
+
var getLocationSetting = function getLocationSetting(location) {
|
|
4461
|
+
var locationSettings = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : tafSettings.locations;
|
|
4462
|
+
return locationSettings[location];
|
|
4463
|
+
};
|
|
4464
|
+
var sortTafsOnLocation = function sortTafsOnLocation(tafList) {
|
|
4465
|
+
var locationOrder = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : tafSettings.locationOrder;
|
|
4466
|
+
if (!tafList) return [];
|
|
4467
|
+
return _toConsumableArray(tafList).sort(function (_ref, _ref2) {
|
|
4468
|
+
var tafA = _ref.taf;
|
|
4469
|
+
var tafB = _ref2.taf;
|
|
4470
|
+
return locationOrder.indexOf(tafA.location) < locationOrder.indexOf(tafB.location) ? -1 : 1;
|
|
4471
|
+
});
|
|
4472
|
+
};
|
|
4473
|
+
var getBaseTime = function getBaseTime(baseTime, location) {
|
|
4474
|
+
var currentBaseTime = moment.utc(baseTime);
|
|
4475
|
+
var activityPeriod = getLocationSetting(location).activity_period;
|
|
4476
|
+
var nextBaseTime = moment.utc(baseTime).add(activityPeriod, 'hours');
|
|
4477
|
+
return {
|
|
4478
|
+
currentBaseTime: currentBaseTime,
|
|
4479
|
+
nextBaseTime: nextBaseTime
|
|
4480
|
+
};
|
|
4481
|
+
};
|
|
4482
|
+
var getTafTimeSlot = function getTafTimeSlot(baseTime, location, status) {
|
|
4524
4483
|
var now = moment.utc();
|
|
4525
|
-
var baseTime = moment.utc(taf.baseTime);
|
|
4526
|
-
var activityPeriod = locationSettings[taf.location].activity_period;
|
|
4527
|
-
var nextBaseTime = moment.utc(taf.baseTime).add(activityPeriod, 'hours');
|
|
4528
4484
|
|
|
4529
|
-
|
|
4485
|
+
var _getBaseTime = getBaseTime(baseTime, location),
|
|
4486
|
+
currentBaseTime = _getBaseTime.currentBaseTime,
|
|
4487
|
+
nextBaseTime = _getBaseTime.nextBaseTime;
|
|
4488
|
+
|
|
4489
|
+
if (status === 'EXPIRED') {
|
|
4530
4490
|
return 'EXPIRED';
|
|
4531
4491
|
}
|
|
4532
4492
|
|
|
4533
|
-
if (
|
|
4493
|
+
if (currentBaseTime < now && nextBaseTime > now) {
|
|
4534
4494
|
return 'ACTIVE';
|
|
4535
4495
|
}
|
|
4536
4496
|
|
|
4537
4497
|
return 'UPCOMING';
|
|
4538
4498
|
};
|
|
4499
|
+
var sortTafTimeSlots = function sortTafTimeSlots(tafList) {
|
|
4500
|
+
var sortedListOnLocation = sortTafsOnLocation(tafList);
|
|
4501
|
+
return sortedListOnLocation.reduce(function (sortedTafList, tafFromBackend) {
|
|
4502
|
+
var taf = tafFromBackend.taf;
|
|
4503
|
+
var timeSlot = getTafTimeSlot(taf.baseTime, taf.location, taf.status);
|
|
4504
|
+
|
|
4505
|
+
if (timeSlot === 'EXPIRED') {
|
|
4506
|
+
sortedTafList.expired.push(tafFromBackend);
|
|
4507
|
+
} else if (timeSlot === 'ACTIVE') {
|
|
4508
|
+
sortedTafList.current.push(tafFromBackend);
|
|
4509
|
+
} else {
|
|
4510
|
+
sortedTafList.upcoming.push(tafFromBackend);
|
|
4511
|
+
}
|
|
4539
4512
|
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
*
|
|
4547
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
4548
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4549
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4550
|
-
* See the License for the specific language governing permissions and
|
|
4551
|
-
* limitations under the License.
|
|
4552
|
-
*
|
|
4553
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4554
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
4555
|
-
* */
|
|
4556
|
-
|
|
4557
|
-
var TafFormDialog = function TafFormDialog(_ref) {
|
|
4558
|
-
var open = _ref.open,
|
|
4559
|
-
toggleFormDialog = _ref.toggleFormDialog,
|
|
4560
|
-
tafFromBackend = _ref.tafFromBackend,
|
|
4561
|
-
children = _ref.children,
|
|
4562
|
-
_ref$alertBanner = _ref.alertBanner,
|
|
4563
|
-
alertBanner = _ref$alertBanner === void 0 ? null : _ref$alertBanner,
|
|
4564
|
-
onFormAction = _ref.onFormAction;
|
|
4565
|
-
var taf = tafFromBackend ? tafFromBackend.taf : null;
|
|
4566
|
-
|
|
4567
|
-
var _useTafSettings = useTafSettings(tafConfig),
|
|
4568
|
-
locationSettings = _useTafSettings.locations;
|
|
4569
|
-
|
|
4570
|
-
return /*#__PURE__*/React__default.createElement(ContentDialog, {
|
|
4571
|
-
open: open,
|
|
4572
|
-
toggleDialogStatus: toggleFormDialog,
|
|
4573
|
-
titleComponent: /*#__PURE__*/React__default.createElement(TafListRow, {
|
|
4574
|
-
taf: taf,
|
|
4575
|
-
listType: getListType(taf, locationSettings)
|
|
4576
|
-
}),
|
|
4577
|
-
alertBanner: alertBanner,
|
|
4578
|
-
onFormAction: onFormAction
|
|
4579
|
-
}, children);
|
|
4513
|
+
return sortedTafList;
|
|
4514
|
+
}, {
|
|
4515
|
+
current: [],
|
|
4516
|
+
upcoming: [],
|
|
4517
|
+
expired: []
|
|
4518
|
+
});
|
|
4580
4519
|
};
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
}
|
|
4586
|
-
|
|
4587
|
-
|
|
4520
|
+
var muiTabA11yProps = function muiTabA11yProps(index) {
|
|
4521
|
+
return {
|
|
4522
|
+
id: "simple-tab-".concat(index),
|
|
4523
|
+
'aria-controls': "simple-tabpanel-".concat(index)
|
|
4524
|
+
};
|
|
4525
|
+
};
|
|
4526
|
+
var emptyBaseForecast = {
|
|
4527
|
+
wind: '',
|
|
4528
|
+
visibility: '',
|
|
4529
|
+
weather: {
|
|
4530
|
+
weather1: '',
|
|
4531
|
+
weather2: '',
|
|
4532
|
+
weather3: ''
|
|
4588
4533
|
},
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
var fromStatusToAction = function fromStatusToAction(tafStatus) {
|
|
4595
|
-
switch (tafStatus) {
|
|
4596
|
-
case 'DRAFT':
|
|
4597
|
-
return 'DRAFT';
|
|
4598
|
-
|
|
4599
|
-
case 'DRAFT_AMENDED':
|
|
4600
|
-
return 'DRAFT_AMEND';
|
|
4601
|
-
|
|
4602
|
-
case 'DRAFT_CORRECTED':
|
|
4603
|
-
return 'DRAFT_CORRECT';
|
|
4604
|
-
|
|
4605
|
-
default:
|
|
4606
|
-
return 'NEW';
|
|
4534
|
+
cloud: {
|
|
4535
|
+
cloud1: '',
|
|
4536
|
+
cloud2: '',
|
|
4537
|
+
cloud3: '',
|
|
4538
|
+
cloud4: ''
|
|
4607
4539
|
}
|
|
4608
4540
|
};
|
|
4609
|
-
|
|
4610
|
-
var
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
var _useTACGenerator = useTACGenerator(tafListItem.taf, api.getTAC),
|
|
4623
|
-
_useTACGenerator2 = _slicedToArray(_useTACGenerator, 2),
|
|
4624
|
-
TAC = _useTACGenerator2[0],
|
|
4625
|
-
requestTAC = _useTACGenerator2[1];
|
|
4626
|
-
|
|
4627
|
-
React__default.useEffect(function () {
|
|
4628
|
-
// only re-retrieve TAC if draft state
|
|
4629
|
-
if (tafListItem.taf.status === 'DRAFT' || tafListItem.taf.status === 'DRAFT_AMENDED' || tafListItem.taf.status === 'DRAFT_CORRECTED') {
|
|
4630
|
-
requestTAC(tafListItem.taf);
|
|
4631
|
-
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4632
|
-
|
|
4633
|
-
}, [tafListItem.taf]);
|
|
4634
|
-
var popOut = status === 'NEW' || status === 'DRAFT' || status === 'DRAFT_AMENDED' || status === 'DRAFT_CORRECTED';
|
|
4635
|
-
return /*#__PURE__*/React__default.createElement(Accordion, Object.assign({
|
|
4636
|
-
"data-testid": "tafListItem",
|
|
4637
|
-
className: classes.accordion
|
|
4638
|
-
}, popOut ? {
|
|
4639
|
-
expanded: false
|
|
4640
|
-
} : {}, {
|
|
4641
|
-
onClick: function onClick() {
|
|
4642
|
-
if (popOut) {
|
|
4643
|
-
onClickTafActionButton(fromStatusToAction(tafListItem.taf.status), tafListItem.taf.uuid);
|
|
4644
|
-
}
|
|
4645
|
-
},
|
|
4646
|
-
TransitionProps: {
|
|
4647
|
-
unmountOnExit: true
|
|
4648
|
-
}
|
|
4649
|
-
}), /*#__PURE__*/React__default.createElement(AccordionSummary, {
|
|
4650
|
-
"data-testid": "tafListSectionAccordionSummary",
|
|
4651
|
-
expandIcon: popOut ? /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
4652
|
-
title: "Popout to edit",
|
|
4653
|
-
className: classes.expandIcon
|
|
4654
|
-
}, /*#__PURE__*/React__default.createElement(OpenInNew, {
|
|
4655
|
-
"data-testid": "popOutIcon",
|
|
4656
|
-
fontSize: "small"
|
|
4657
|
-
})) : /*#__PURE__*/React__default.createElement(ExpandMore, {
|
|
4658
|
-
className: classes.expandIcon,
|
|
4659
|
-
"data-testid": "expandIcon"
|
|
4660
|
-
})
|
|
4661
|
-
}, /*#__PURE__*/React__default.createElement(TafListRow, {
|
|
4662
|
-
taf: tafListItem.taf,
|
|
4663
|
-
listType: listType,
|
|
4664
|
-
TAC: TAC,
|
|
4665
|
-
showTac: true
|
|
4666
|
-
})), /*#__PURE__*/React__default.createElement(AccordionDetails, null, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4667
|
-
container: true,
|
|
4668
|
-
direction: "column"
|
|
4669
|
-
}, errorCancelTaf.length > 0 && errorCancelTaf.find(function (uuid) {
|
|
4670
|
-
return uuid === tafListItem.taf.uuid;
|
|
4671
|
-
}) && /*#__PURE__*/React__default.createElement(AlertBanner, {
|
|
4672
|
-
severity: "error",
|
|
4673
|
-
title: "Cancelling this TAF failed, please try again",
|
|
4674
|
-
dataTestId: "tafList-cancelAlert"
|
|
4675
|
-
}), /*#__PURE__*/React__default.createElement("div", {
|
|
4676
|
-
className: classes.formPadding
|
|
4677
|
-
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4678
|
-
item: true
|
|
4679
|
-
}, /*#__PURE__*/React__default.createElement(TafFormWrapper, {
|
|
4680
|
-
tafFromBackend: tafListItem,
|
|
4681
|
-
mode: "view",
|
|
4682
|
-
TAC: TAC
|
|
4683
|
-
})), /*#__PURE__*/React__default.createElement(Grid, {
|
|
4684
|
-
item: true
|
|
4685
|
-
}, /*#__PURE__*/React__default.createElement(TafListButtons, {
|
|
4686
|
-
canBe: tafListItem.canbe,
|
|
4687
|
-
uuid: tafListItem.taf.uuid,
|
|
4688
|
-
onClickTafActionButton: onClickTafActionButton
|
|
4689
|
-
}))))));
|
|
4541
|
+
var prepareTafExportValues = function prepareTafExportValues(tafToCopy, currentTaf) {
|
|
4542
|
+
var _a;
|
|
4543
|
+
|
|
4544
|
+
var convertedCopy = prepareTafValues(tafToCopy, undefined, false);
|
|
4545
|
+
var baseForecast = convertedCopy.baseForecast,
|
|
4546
|
+
_convertedCopy$change = convertedCopy.changeGroups,
|
|
4547
|
+
changeGroups = _convertedCopy$change === void 0 ? [] : _convertedCopy$change;
|
|
4548
|
+
return Object.assign(Object.assign({}, currentTaf), {
|
|
4549
|
+
baseForecast: Object.assign(Object.assign(Object.assign({}, emptyBaseForecast), baseForecast), {
|
|
4550
|
+
valid: (_a = currentTaf === null || currentTaf === void 0 ? void 0 : currentTaf.baseForecast) === null || _a === void 0 ? void 0 : _a.valid
|
|
4551
|
+
}),
|
|
4552
|
+
changeGroups: changeGroups
|
|
4553
|
+
});
|
|
4690
4554
|
};
|
|
4691
4555
|
|
|
4692
4556
|
/* *
|
|
@@ -4702,136 +4566,80 @@ var TafListAccordion = function TafListAccordion(_ref) {
|
|
|
4702
4566
|
* See the License for the specific language governing permissions and
|
|
4703
4567
|
* limitations under the License.
|
|
4704
4568
|
*
|
|
4705
|
-
* Copyright
|
|
4706
|
-
* Copyright
|
|
4569
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4570
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
4707
4571
|
* */
|
|
4708
|
-
var
|
|
4709
|
-
|
|
4710
|
-
|
|
4711
|
-
},
|
|
4712
|
-
formPadding: {
|
|
4713
|
-
padding: '8px'
|
|
4714
|
-
},
|
|
4715
|
-
paperButton: {
|
|
4716
|
-
width: '100%'
|
|
4717
|
-
}
|
|
4718
|
-
});
|
|
4572
|
+
var EditIcon = createSvgIcon( /*#__PURE__*/React.createElement("path", {
|
|
4573
|
+
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"
|
|
4574
|
+
}), 'Edit');
|
|
4719
4575
|
|
|
4720
|
-
var
|
|
4721
|
-
var
|
|
4722
|
-
|
|
4723
|
-
listType = _ref.listType,
|
|
4724
|
-
_ref$errorCancelTaf = _ref.errorCancelTaf,
|
|
4725
|
-
errorCancelTaf = _ref$errorCancelTaf === void 0 ? [] : _ref$errorCancelTaf,
|
|
4726
|
-
onClickTafActionButton = _ref.onClickTafActionButton;
|
|
4727
|
-
var classes = useStyles$2();
|
|
4728
|
-
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Typography, {
|
|
4729
|
-
variant: "subtitle2",
|
|
4730
|
-
className: classes.listHeaders
|
|
4731
|
-
}, title), /*#__PURE__*/React__default.createElement("div", {
|
|
4732
|
-
"data-testid": "tafList".concat(listType)
|
|
4733
|
-
}, tafList.map(function (tafListItem) {
|
|
4734
|
-
return /*#__PURE__*/React__default.createElement(TafListAccordion, {
|
|
4735
|
-
key: "".concat(tafListItem.taf.uuid, "-").concat(tafListItem.taf.status),
|
|
4736
|
-
tafListItem: tafListItem,
|
|
4737
|
-
listType: listType,
|
|
4738
|
-
errorCancelTaf: errorCancelTaf,
|
|
4739
|
-
onClickTafActionButton: onClickTafActionButton
|
|
4740
|
-
});
|
|
4741
|
-
})));
|
|
4742
|
-
};
|
|
4576
|
+
var StatusIcon = function StatusIcon(_ref) {
|
|
4577
|
+
var timeSlot = _ref.timeSlot,
|
|
4578
|
+
status = _ref.status;
|
|
4743
4579
|
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
marginBottom: '5px'
|
|
4747
|
-
},
|
|
4748
|
-
listHeaders: {
|
|
4749
|
-
color: '#9d9d9d'
|
|
4750
|
-
},
|
|
4751
|
-
listBody: {
|
|
4752
|
-
width: '100%',
|
|
4753
|
-
minHeight: '600px'
|
|
4580
|
+
if (status === 'NEW') {
|
|
4581
|
+
return null;
|
|
4754
4582
|
}
|
|
4755
|
-
});
|
|
4756
|
-
|
|
4757
|
-
var TafList = function TafList(_ref) {
|
|
4758
|
-
var tafList = _ref.tafList,
|
|
4759
|
-
isLoading = _ref.isLoading,
|
|
4760
|
-
error = _ref.error,
|
|
4761
|
-
_ref$errorCancelTaf = _ref.errorCancelTaf,
|
|
4762
|
-
errorCancelTaf = _ref$errorCancelTaf === void 0 ? [] : _ref$errorCancelTaf,
|
|
4763
|
-
onClickTafActionButton = _ref.onClickTafActionButton;
|
|
4764
|
-
var classes = useStyles$1();
|
|
4765
|
-
|
|
4766
|
-
var _useTafSettings = useTafSettings(tafConfig),
|
|
4767
|
-
locationSettings = _useTafSettings.locations;
|
|
4768
4583
|
|
|
4769
|
-
|
|
4770
|
-
|
|
4771
|
-
|
|
4584
|
+
if (status === 'EXPIRED') {
|
|
4585
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
4586
|
+
title: "Expired",
|
|
4587
|
+
placement: "right"
|
|
4588
|
+
}, /*#__PURE__*/React.createElement(Schedule, {
|
|
4589
|
+
"data-testid": "status-expired",
|
|
4590
|
+
fontSize: "small",
|
|
4591
|
+
sx: {
|
|
4592
|
+
transform: 'scaleX(-1)',
|
|
4593
|
+
color: 'geowebColors.buttons.tertiary.disabled.color'
|
|
4594
|
+
}
|
|
4595
|
+
}));
|
|
4596
|
+
}
|
|
4772
4597
|
|
|
4773
|
-
if (
|
|
4774
|
-
|
|
4775
|
-
|
|
4598
|
+
if (status === 'CANCELLED') {
|
|
4599
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
4600
|
+
title: "Cancelled",
|
|
4601
|
+
placement: "right"
|
|
4602
|
+
}, /*#__PURE__*/React.createElement(DoDisturbIcon, {
|
|
4603
|
+
"data-testid": "status-cancelled",
|
|
4604
|
+
fontSize: "small",
|
|
4605
|
+
sx: {
|
|
4606
|
+
color: 'geowebColors.captions.captionError.rgba'
|
|
4607
|
+
}
|
|
4608
|
+
}));
|
|
4609
|
+
}
|
|
4776
4610
|
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
expiredTafs.push(taf);
|
|
4787
|
-
} else if (baseTime < now && nextBaseTime > now) {
|
|
4788
|
-
currentTafs.push(taf);
|
|
4789
|
-
} else {
|
|
4790
|
-
upcomingTafs.push(taf);
|
|
4791
|
-
}
|
|
4611
|
+
if (status === 'DRAFT' || status === 'DRAFT_CORRECTED' || status === 'DRAFT_AMENDED') {
|
|
4612
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
4613
|
+
title: "Draft",
|
|
4614
|
+
placement: "right"
|
|
4615
|
+
}, /*#__PURE__*/React.createElement(SvgIcon, {
|
|
4616
|
+
component: EditIcon,
|
|
4617
|
+
"data-testid": "status-draft",
|
|
4618
|
+
sx: {
|
|
4619
|
+
color: 'geowebColors.buttons.tertiary.default.color'
|
|
4792
4620
|
}
|
|
4793
|
-
}
|
|
4794
|
-
_iterator.e(err);
|
|
4795
|
-
} finally {
|
|
4796
|
-
_iterator.f();
|
|
4797
|
-
}
|
|
4621
|
+
}));
|
|
4798
4622
|
}
|
|
4799
4623
|
|
|
4800
|
-
return /*#__PURE__*/
|
|
4801
|
-
|
|
4802
|
-
|
|
4803
|
-
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
|
|
4810
|
-
info: error.message ? error.message : '',
|
|
4811
|
-
dataTestId: "tafList-alert"
|
|
4812
|
-
}), tafList && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(TafListSection, {
|
|
4624
|
+
return timeSlot === 'ACTIVE' ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
4625
|
+
title: "Active",
|
|
4626
|
+
placement: "right"
|
|
4627
|
+
}, /*#__PURE__*/React.createElement(CheckCircle, {
|
|
4628
|
+
"data-testid": "status-active",
|
|
4629
|
+
fontSize: "small",
|
|
4630
|
+
sx: {
|
|
4631
|
+
color: 'geowebColors.functional.success'
|
|
4632
|
+
}
|
|
4633
|
+
})) : /*#__PURE__*/React.createElement(Tooltip, {
|
|
4813
4634
|
title: "Upcoming",
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
|
|
4819
|
-
|
|
4820
|
-
|
|
4821
|
-
|
|
4822
|
-
errorCancelTaf: errorCancelTaf,
|
|
4823
|
-
onClickTafActionButton: onClickTafActionButton
|
|
4824
|
-
}), /*#__PURE__*/React__default.createElement(TafListSection, {
|
|
4825
|
-
title: "Expired",
|
|
4826
|
-
listType: "EXPIRED",
|
|
4827
|
-
tafList: expiredTafs,
|
|
4828
|
-
errorCancelTaf: errorCancelTaf,
|
|
4829
|
-
onClickTafActionButton: onClickTafActionButton
|
|
4830
|
-
})), isLoading && /*#__PURE__*/React__default.createElement(Skeleton, {
|
|
4831
|
-
"data-testid": "tafList-skeleton",
|
|
4832
|
-
variant: "rectangular",
|
|
4833
|
-
height: "660px"
|
|
4834
|
-
})));
|
|
4635
|
+
placement: "right"
|
|
4636
|
+
}, /*#__PURE__*/React.createElement(Schedule, {
|
|
4637
|
+
"data-testid": "status-upcoming",
|
|
4638
|
+
fontSize: "small",
|
|
4639
|
+
sx: {
|
|
4640
|
+
color: 'geowebColors.functional.success'
|
|
4641
|
+
}
|
|
4642
|
+
}));
|
|
4835
4643
|
};
|
|
4836
4644
|
|
|
4837
4645
|
/* *
|
|
@@ -4847,189 +4655,601 @@ var TafList = function TafList(_ref) {
|
|
|
4847
4655
|
* See the License for the specific language governing permissions and
|
|
4848
4656
|
* limitations under the License.
|
|
4849
4657
|
*
|
|
4850
|
-
* Copyright
|
|
4851
|
-
* Copyright
|
|
4658
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4659
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
4852
4660
|
* */
|
|
4853
|
-
var
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
color: '#fff'
|
|
4857
|
-
}
|
|
4858
|
-
});
|
|
4661
|
+
var ExportIcon = /*#__PURE__*/React__default.createElement(SvgIcon, null, /*#__PURE__*/React__default.createElement("path", {
|
|
4662
|
+
d: "M14.744 5.476a1.252 1.252 0 1 0 0 2.504h2.752v9.516H6.48v-1.753a1.251 1.251 0 1 0-2.504 0v3.004c0 .693.561 1.253 1.252 1.253h13.52C19.44 20 20 19.44 20 18.747V6.727c0-.69-.56-1.251-1.252-1.251zM9.133 2.385a1.252 1.252 0 0 0-1.77 0L1.773 7.974l5.54 5.54c.49.49 1.281.49 1.77 0l.022-.026a1.25 1.25 0 0 0-.021-1.745L6.568 9.225h1.371c.914 0 2.756.618 4.045 2.763 1.29 2.145.352 2.526.653 2.526.301 0 1.943-1.798.721-4.295-1.71-3.498-4.6-3.498-5.346-3.498H6.568l2.565-2.565a1.253 1.253 0 0 0 0-1.771z"
|
|
4663
|
+
}));
|
|
4859
4664
|
|
|
4860
|
-
var
|
|
4861
|
-
var
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4665
|
+
var ExportButton = function ExportButton(_ref) {
|
|
4666
|
+
var onClick = _ref.onClick,
|
|
4667
|
+
isHidden = _ref.isHidden;
|
|
4668
|
+
return isHidden ? null : /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
4669
|
+
title: "Import TAC",
|
|
4670
|
+
placement: "left"
|
|
4671
|
+
}, /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(ToolButton, {
|
|
4672
|
+
onClick: onClick,
|
|
4673
|
+
"data-testid": "export-tac-button"
|
|
4674
|
+
}, ExportIcon)));
|
|
4869
4675
|
};
|
|
4870
4676
|
|
|
4871
|
-
var
|
|
4872
|
-
var
|
|
4677
|
+
var TacContainer = function TacContainer(_ref) {
|
|
4678
|
+
var taf = _ref.taf,
|
|
4679
|
+
_ref$isActive = _ref.isActive,
|
|
4680
|
+
isActive = _ref$isActive === void 0 ? false : _ref$isActive,
|
|
4681
|
+
_ref$isFormDisabled = _ref.isFormDisabled,
|
|
4682
|
+
isFormDisabled = _ref$isFormDisabled === void 0 ? false : _ref$isFormDisabled;
|
|
4873
4683
|
|
|
4874
|
-
var
|
|
4875
|
-
|
|
4876
|
-
errorCancelTaf = _React$useState2[0],
|
|
4877
|
-
setErrorCancelTaf = _React$useState2[1];
|
|
4684
|
+
var _useApiContext = useApiContext(),
|
|
4685
|
+
api = _useApiContext.api;
|
|
4878
4686
|
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
}
|
|
4884
|
-
}, pollingInterval) : null;
|
|
4885
|
-
return function () {
|
|
4886
|
-
if (cancelErrorMessageHandler !== null) {
|
|
4887
|
-
clearTimeout(cancelErrorMessageHandler);
|
|
4888
|
-
}
|
|
4889
|
-
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4890
|
-
}, [errorCancelTaf]);
|
|
4891
|
-
return [errorCancelTaf, setErrorCancelTaf];
|
|
4892
|
-
};
|
|
4893
|
-
var getSelectedTaf = function getSelectedTaf(selectedTafId, tafList) {
|
|
4894
|
-
if (tafList === null) return undefined;
|
|
4895
|
-
return tafList.find(function (element) {
|
|
4896
|
-
return element.taf.uuid === selectedTafId;
|
|
4897
|
-
});
|
|
4898
|
-
};
|
|
4687
|
+
var _useTACGenerator = useTACGenerator(taf, api.getTAC),
|
|
4688
|
+
_useTACGenerator2 = _slicedToArray(_useTACGenerator, 2),
|
|
4689
|
+
TAC = _useTACGenerator2[0],
|
|
4690
|
+
retrieveTAC = _useTACGenerator2[1];
|
|
4899
4691
|
|
|
4900
|
-
var
|
|
4901
|
-
|
|
4902
|
-
|
|
4692
|
+
var status = taf.status,
|
|
4693
|
+
location = taf.location,
|
|
4694
|
+
baseTime = taf.baseTime;
|
|
4695
|
+
var locationLabel = getLocationSetting(location).label;
|
|
4696
|
+
var timeSlot = getTafTimeSlot(baseTime, location, status);
|
|
4903
4697
|
|
|
4904
|
-
var
|
|
4698
|
+
var _useFormContext = useFormContext(),
|
|
4699
|
+
getValues = _useFormContext.getValues,
|
|
4700
|
+
trigger = _useFormContext.trigger,
|
|
4701
|
+
setValue = _useFormContext.setValue;
|
|
4905
4702
|
|
|
4906
|
-
var
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4703
|
+
var handleExport = function handleExport() {
|
|
4704
|
+
var currentTaf = getValues();
|
|
4705
|
+
var newTaf = prepareTafExportValues(taf, currentTaf);
|
|
4706
|
+
setValue('baseForecast', newTaf.baseForecast, {
|
|
4707
|
+
shouldDirty: true
|
|
4708
|
+
});
|
|
4709
|
+
setValue('changeGroups', newTaf.changeGroups, {
|
|
4710
|
+
shouldDirty: true
|
|
4711
|
+
});
|
|
4712
|
+
setTimeout(function () {
|
|
4713
|
+
trigger(); // trigger all fields validation
|
|
4714
|
+
}, 0);
|
|
4715
|
+
};
|
|
4910
4716
|
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4717
|
+
React__default.useEffect(function () {
|
|
4718
|
+
if (isActive) {
|
|
4719
|
+
retrieveTAC(taf);
|
|
4720
|
+
}
|
|
4721
|
+
}, [taf, isActive, retrieveTAC]);
|
|
4722
|
+
return /*#__PURE__*/React__default.createElement(Box, {
|
|
4723
|
+
sx: {
|
|
4724
|
+
marginBottom: '20px'
|
|
4725
|
+
},
|
|
4726
|
+
"data-location": location,
|
|
4727
|
+
className: isActive ? 'active' : null
|
|
4728
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
4729
|
+
sx: {
|
|
4730
|
+
display: 'flex',
|
|
4731
|
+
alignItems: 'center',
|
|
4732
|
+
justifyContent: 'space-between',
|
|
4733
|
+
height: 24
|
|
4734
|
+
}
|
|
4735
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
4736
|
+
sx: {
|
|
4737
|
+
display: 'flex',
|
|
4738
|
+
alignItems: 'center'
|
|
4739
|
+
}
|
|
4740
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
4741
|
+
sx: {
|
|
4742
|
+
width: 24,
|
|
4743
|
+
height: 24,
|
|
4744
|
+
display: 'flex',
|
|
4745
|
+
marginRight: '2px',
|
|
4746
|
+
alignItems: 'center',
|
|
4747
|
+
justifyContent: 'center'
|
|
4748
|
+
}
|
|
4749
|
+
}, /*#__PURE__*/React__default.createElement(StatusIcon, {
|
|
4750
|
+
timeSlot: timeSlot,
|
|
4751
|
+
status: status
|
|
4752
|
+
})), /*#__PURE__*/React__default.createElement(Typography, {
|
|
4753
|
+
sx: Object.assign({
|
|
4754
|
+
lineHeight: 1
|
|
4755
|
+
}, isActive && {
|
|
4756
|
+
backgroundColor: 'geowebColors.functional.warningHighlight.rgba',
|
|
4757
|
+
padding: '0 2px',
|
|
4758
|
+
marginLeft: '-2px'
|
|
4759
|
+
})
|
|
4760
|
+
}, /*#__PURE__*/React__default.createElement(Typography, {
|
|
4761
|
+
sx: {
|
|
4762
|
+
fontSize: '12px',
|
|
4763
|
+
color: 'geowebColors.captions.captionInformation.rgba'
|
|
4764
|
+
},
|
|
4765
|
+
"data-testid": "tafLocation",
|
|
4766
|
+
component: "span"
|
|
4767
|
+
}, location), /*#__PURE__*/React__default.createElement(Typography, {
|
|
4768
|
+
sx: {
|
|
4769
|
+
fontSize: '12px',
|
|
4770
|
+
marginLeft: '10px'
|
|
4771
|
+
},
|
|
4772
|
+
"data-testid": "tafLocationLabel",
|
|
4773
|
+
component: "span"
|
|
4774
|
+
}, locationLabel))), /*#__PURE__*/React__default.createElement(ExportButton, {
|
|
4775
|
+
onClick: handleExport,
|
|
4776
|
+
isHidden: isFormDisabled || tacHasError(TAC)
|
|
4777
|
+
})), /*#__PURE__*/React__default.createElement(Box, {
|
|
4778
|
+
sx: {
|
|
4779
|
+
fontSize: '12px',
|
|
4780
|
+
letterSpacing: '0.4px',
|
|
4781
|
+
color: 'geowebColors.captions.captionStatus.rgba'
|
|
4782
|
+
}
|
|
4783
|
+
}, TAC.split('\n').map(function (line) {
|
|
4784
|
+
return /*#__PURE__*/React__default.createElement(Box, {
|
|
4785
|
+
component: "span",
|
|
4786
|
+
key: line,
|
|
4787
|
+
sx: {
|
|
4788
|
+
display: 'inline-block'
|
|
4789
|
+
}
|
|
4790
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
4791
|
+
component: "span",
|
|
4792
|
+
sx: Object.assign({
|
|
4793
|
+
display: 'inline',
|
|
4794
|
+
boxDecorationBreak: 'clone',
|
|
4795
|
+
WebkitBoxDecorationBreak: 'clone'
|
|
4796
|
+
}, isActive && {
|
|
4797
|
+
backgroundColor: 'geowebColors.functional.warningHighlight.rgba'
|
|
4798
|
+
})
|
|
4799
|
+
}, line));
|
|
4800
|
+
})));
|
|
4801
|
+
};
|
|
4915
4802
|
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4803
|
+
var TacOverview = function TacOverview(_ref) {
|
|
4804
|
+
var _ref$upcomingTafs = _ref.upcomingTafs,
|
|
4805
|
+
upcomingTafs = _ref$upcomingTafs === void 0 ? [] : _ref$upcomingTafs,
|
|
4806
|
+
_ref$currentTafs = _ref.currentTafs,
|
|
4807
|
+
currentTafs = _ref$currentTafs === void 0 ? [] : _ref$currentTafs,
|
|
4808
|
+
_ref$expiredTafs = _ref.expiredTafs,
|
|
4809
|
+
expiredTafs = _ref$expiredTafs === void 0 ? [] : _ref$expiredTafs,
|
|
4810
|
+
_ref$hideTitle = _ref.hideTitle,
|
|
4811
|
+
hideTitle = _ref$hideTitle === void 0 ? false : _ref$hideTitle,
|
|
4812
|
+
_ref$activeTaf = _ref.activeTaf,
|
|
4813
|
+
activeTaf = _ref$activeTaf === void 0 ? null : _ref$activeTaf,
|
|
4814
|
+
_ref$isFormDisabled = _ref.isFormDisabled,
|
|
4815
|
+
isFormDisabled = _ref$isFormDisabled === void 0 ? false : _ref$isFormDisabled;
|
|
4816
|
+
|
|
4817
|
+
var _React$useState = React__default.useState(0),
|
|
4818
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
4819
|
+
activeTab = _React$useState2[0],
|
|
4820
|
+
setActiveTab = _React$useState2[1];
|
|
4920
4821
|
|
|
4921
|
-
var
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4822
|
+
var scrollRef = React__default.useRef(null);
|
|
4823
|
+
var tabs = [{
|
|
4824
|
+
title: 'Upcoming',
|
|
4825
|
+
tafList: upcomingTafs
|
|
4826
|
+
}, {
|
|
4827
|
+
title: 'Current & Expired',
|
|
4828
|
+
tafList: sortTafsOnLocation([].concat(_toConsumableArray(currentTafs), _toConsumableArray(expiredTafs)))
|
|
4829
|
+
}];
|
|
4830
|
+
var activeLocation = (activeTaf === null || activeTaf === void 0 ? void 0 : activeTaf.taf.location) || null;
|
|
4925
4831
|
|
|
4926
|
-
var
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
setErrorPostMessageText = _React$useState12[1];
|
|
4832
|
+
var isActiveLocation = function isActiveLocation(location) {
|
|
4833
|
+
return location === activeLocation;
|
|
4834
|
+
};
|
|
4930
4835
|
|
|
4931
|
-
var
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4836
|
+
var scrollToPosition = React__default.useCallback(function () {
|
|
4837
|
+
if (!scrollRef.current) return;
|
|
4838
|
+
var containerTop = scrollRef.current.getBoundingClientRect().top;
|
|
4839
|
+
var firstLocation = scrollRef.current.querySelector("[data-location=\"".concat(activeLocation, "\"]"));
|
|
4840
|
+
var paddingTop = parseInt(getComputedStyle(scrollRef.current).paddingTop, 10);
|
|
4841
|
+
var newScrollPosition = (firstLocation === null || firstLocation === void 0 ? void 0 : firstLocation.getBoundingClientRect().top) - containerTop + scrollRef.current.scrollTop - paddingTop;
|
|
4842
|
+
scrollRef.current.scrollTo(newScrollPosition, newScrollPosition);
|
|
4843
|
+
}, [activeLocation]);
|
|
4844
|
+
|
|
4845
|
+
var resetScrollPosition = function resetScrollPosition() {
|
|
4846
|
+
return scrollRef.current.scrollTo(0, 0);
|
|
4847
|
+
};
|
|
4848
|
+
|
|
4849
|
+
var onChangeTab = function onChangeTab(_event, newValue) {
|
|
4850
|
+
setActiveTab(newValue);
|
|
4851
|
+
resetScrollPosition();
|
|
4852
|
+
};
|
|
4935
4853
|
|
|
4854
|
+
React__default.useEffect(function () {
|
|
4855
|
+
if (activeLocation) {
|
|
4856
|
+
scrollToPosition();
|
|
4857
|
+
}
|
|
4858
|
+
}, [activeLocation, scrollToPosition]);
|
|
4859
|
+
React__default.useEffect(function () {
|
|
4860
|
+
var SCROLL_DELAY = 1000;
|
|
4861
|
+
var timer = setTimeout(function () {
|
|
4862
|
+
scrollToPosition();
|
|
4863
|
+
}, SCROLL_DELAY);
|
|
4864
|
+
return function () {
|
|
4865
|
+
clearTimeout(timer);
|
|
4866
|
+
};
|
|
4867
|
+
}, [activeTab, scrollToPosition]);
|
|
4868
|
+
return /*#__PURE__*/React__default.createElement(Card, {
|
|
4869
|
+
variant: "outlined",
|
|
4870
|
+
sx: {
|
|
4871
|
+
maxHeight: '100%',
|
|
4872
|
+
overflow: 'hidden',
|
|
4873
|
+
display: 'flex',
|
|
4874
|
+
flexDirection: 'column'
|
|
4875
|
+
}
|
|
4876
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
4877
|
+
sx: {
|
|
4878
|
+
zIndex: 1
|
|
4879
|
+
}
|
|
4880
|
+
}, !hideTitle && /*#__PURE__*/React__default.createElement(TafHeader, {
|
|
4881
|
+
title: "TAC Overview"
|
|
4882
|
+
}), /*#__PURE__*/React__default.createElement(Tabs, {
|
|
4883
|
+
value: activeTab,
|
|
4884
|
+
onChange: onChangeTab,
|
|
4885
|
+
"aria-label": "tabs"
|
|
4886
|
+
}, tabs.map(function (tab, index) {
|
|
4887
|
+
return /*#__PURE__*/React__default.createElement(Tab, Object.assign({
|
|
4888
|
+
key: tab.title,
|
|
4889
|
+
sx: {
|
|
4890
|
+
flexGrow: 1
|
|
4891
|
+
},
|
|
4892
|
+
label: tab.title,
|
|
4893
|
+
"data-testid": "tab-".concat(index)
|
|
4894
|
+
}, muiTabA11yProps(index)));
|
|
4895
|
+
}))), /*#__PURE__*/React__default.createElement(Box, {
|
|
4896
|
+
ref: scrollRef,
|
|
4897
|
+
sx: {
|
|
4898
|
+
padding: '10px',
|
|
4899
|
+
maxHeight: '100%',
|
|
4900
|
+
overflow: 'auto'
|
|
4901
|
+
}
|
|
4902
|
+
}, tabs.map(function (tab, index) {
|
|
4903
|
+
return /*#__PURE__*/React__default.createElement(TabPanel, {
|
|
4904
|
+
key: tab.title,
|
|
4905
|
+
value: activeTab,
|
|
4906
|
+
index: index
|
|
4907
|
+
}, tab.tafList.map(function (_ref2) {
|
|
4908
|
+
var taf = _ref2.taf;
|
|
4909
|
+
return /*#__PURE__*/React__default.createElement(TacContainer, {
|
|
4910
|
+
key: taf.uuid,
|
|
4911
|
+
taf: taf,
|
|
4912
|
+
isActive: isActiveLocation(taf.location),
|
|
4913
|
+
isFormDisabled: isFormDisabled
|
|
4914
|
+
});
|
|
4915
|
+
}));
|
|
4916
|
+
})));
|
|
4917
|
+
};
|
|
4936
4918
|
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
setErrorCancelTaf = _useTimeoutCancelErro2[1]; // Retrieve list of tafs
|
|
4919
|
+
var TacOverviewIcon = /*#__PURE__*/React.createElement(SvgIcon, null, /*#__PURE__*/React.createElement("path", {
|
|
4920
|
+
d: "M3 3h4v4H3V3zm0 7h4v4H3v-4zm0 7h4v4H3v-4zm7-14h11v4H10V3zm0 7h11v4H10v-4zm0 7h11v4H10v-4z"
|
|
4921
|
+
}));
|
|
4941
4922
|
|
|
4923
|
+
var TacOverviewMobile = function TacOverviewMobile(_ref) {
|
|
4924
|
+
var upcomingTafs = _ref.upcomingTafs,
|
|
4925
|
+
currentTafs = _ref.currentTafs,
|
|
4926
|
+
expiredTafs = _ref.expiredTafs,
|
|
4927
|
+
activeTaf = _ref.activeTaf,
|
|
4928
|
+
_ref$defaultOpen = _ref.defaultOpen,
|
|
4929
|
+
defaultOpen = _ref$defaultOpen === void 0 ? false : _ref$defaultOpen;
|
|
4942
4930
|
|
|
4943
|
-
var
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
fetchNewTafList = _useApi.fetchApiData;
|
|
4931
|
+
var _React$useState = React.useState(defaultOpen),
|
|
4932
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
4933
|
+
isOpen = _React$useState2[0],
|
|
4934
|
+
toggleOpen = _React$useState2[1];
|
|
4948
4935
|
|
|
4949
|
-
var
|
|
4950
|
-
|
|
4936
|
+
var onClose = function onClose() {
|
|
4937
|
+
return toggleOpen(false);
|
|
4951
4938
|
};
|
|
4952
4939
|
|
|
4953
|
-
|
|
4940
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ToolButton, {
|
|
4941
|
+
active: isOpen,
|
|
4942
|
+
onClick: function onClick() {
|
|
4943
|
+
return toggleOpen(true);
|
|
4944
|
+
},
|
|
4945
|
+
"data-testid": "tac-overview-mobile-button",
|
|
4946
|
+
sx: {
|
|
4947
|
+
display: {
|
|
4948
|
+
xs: 'inline-flex',
|
|
4949
|
+
sm: 'none'
|
|
4950
|
+
},
|
|
4951
|
+
position: 'absolute',
|
|
4952
|
+
right: '8px',
|
|
4953
|
+
top: '30px'
|
|
4954
|
+
}
|
|
4955
|
+
}, TacOverviewIcon), /*#__PURE__*/React.createElement(Dialog, {
|
|
4956
|
+
open: isOpen,
|
|
4957
|
+
onClose: onClose,
|
|
4958
|
+
PaperProps: {
|
|
4959
|
+
sx: {
|
|
4960
|
+
margin: 2,
|
|
4961
|
+
width: '100%',
|
|
4962
|
+
height: '100%'
|
|
4963
|
+
}
|
|
4964
|
+
},
|
|
4965
|
+
"data-testid": "tac-overview-mobile"
|
|
4966
|
+
}, /*#__PURE__*/React.createElement(ToolHeader, {
|
|
4967
|
+
title: "TAC Overview",
|
|
4968
|
+
size: "small",
|
|
4969
|
+
isDraggable: false,
|
|
4970
|
+
onClose: onClose
|
|
4971
|
+
}), /*#__PURE__*/React.createElement(TacOverview, {
|
|
4972
|
+
upcomingTafs: upcomingTafs,
|
|
4973
|
+
currentTafs: currentTafs,
|
|
4974
|
+
expiredTafs: expiredTafs,
|
|
4975
|
+
activeTaf: activeTaf,
|
|
4976
|
+
hideTitle: true
|
|
4977
|
+
})));
|
|
4978
|
+
};
|
|
4979
|
+
|
|
4980
|
+
/* *
|
|
4981
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4982
|
+
* you may not use this file except in compliance with the License.
|
|
4983
|
+
* You may obtain a copy of the License at
|
|
4984
|
+
*
|
|
4985
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4986
|
+
*
|
|
4987
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4988
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4989
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4990
|
+
* See the License for the specific language governing permissions and
|
|
4991
|
+
* limitations under the License.
|
|
4992
|
+
*
|
|
4993
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4994
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
4995
|
+
* */
|
|
4996
|
+
|
|
4997
|
+
var formatBaseTime = function formatBaseTime(time) {
|
|
4998
|
+
return time.format('HH:mm DD MMM');
|
|
4999
|
+
};
|
|
5000
|
+
|
|
5001
|
+
var TopTabs = function TopTabs(_ref) {
|
|
5002
|
+
var timeSlot = _ref.timeSlot,
|
|
5003
|
+
_ref$onChangeTimeSlot = _ref.onChangeTimeSlot,
|
|
5004
|
+
onChangeTimeSlot = _ref$onChangeTimeSlot === void 0 ? function () {} : _ref$onChangeTimeSlot,
|
|
5005
|
+
_ref$tafFromBackend = _ref.tafFromBackend,
|
|
5006
|
+
tafFromBackend = _ref$tafFromBackend === void 0 ? {
|
|
5007
|
+
taf: {
|
|
5008
|
+
baseTime: '2022-01-06T12:00:00Z',
|
|
5009
|
+
location: 'EHAM'
|
|
5010
|
+
}
|
|
5011
|
+
} : _ref$tafFromBackend;
|
|
5012
|
+
|
|
5013
|
+
if (!tafFromBackend) {
|
|
5014
|
+
return null;
|
|
5015
|
+
}
|
|
5016
|
+
|
|
5017
|
+
var activeTab = timeSlot === 'UPCOMING' ? 0 : 1;
|
|
5018
|
+
|
|
5019
|
+
var _getBaseTime = getBaseTime(tafFromBackend.taf.baseTime, tafFromBackend.taf.location),
|
|
5020
|
+
currentBaseTime = _getBaseTime.currentBaseTime,
|
|
5021
|
+
nextBaseTime = _getBaseTime.nextBaseTime;
|
|
4954
5022
|
|
|
4955
|
-
var
|
|
4956
|
-
|
|
4957
|
-
|
|
5023
|
+
var tabs = [{
|
|
5024
|
+
title: "Upcoming ".concat(formatBaseTime(nextBaseTime)),
|
|
5025
|
+
timeSlot: 'UPCOMING'
|
|
5026
|
+
}, {
|
|
5027
|
+
title: "Current ".concat(formatBaseTime(currentBaseTime)),
|
|
5028
|
+
timeSlot: 'ACTIVE'
|
|
5029
|
+
}];
|
|
4958
5030
|
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
setTafDialogOpen(!isTafDialogOpen);
|
|
5031
|
+
var onChangeTab = function onChangeTab(_event, newValue) {
|
|
5032
|
+
onChangeTimeSlot(tabs[newValue].timeSlot);
|
|
4962
5033
|
};
|
|
4963
5034
|
|
|
4964
|
-
React__default.
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
5035
|
+
return /*#__PURE__*/React__default.createElement(Tabs, {
|
|
5036
|
+
value: activeTab,
|
|
5037
|
+
onChange: onChangeTab,
|
|
5038
|
+
"aria-label": "timeslot-tabs",
|
|
5039
|
+
"data-testid": "timeslot-tabs",
|
|
5040
|
+
variant: "fullWidth"
|
|
5041
|
+
}, tabs.map(function (tab, index) {
|
|
5042
|
+
return /*#__PURE__*/React__default.createElement(Tab, Object.assign({
|
|
5043
|
+
key: tab.title,
|
|
5044
|
+
label: tab.title,
|
|
5045
|
+
"data-testid": "toptab-".concat(index),
|
|
5046
|
+
sx: {
|
|
5047
|
+
fontSize: 16
|
|
5048
|
+
}
|
|
5049
|
+
}, muiTabA11yProps(index)));
|
|
5050
|
+
}));
|
|
5051
|
+
};
|
|
4968
5052
|
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
5053
|
+
/* *
|
|
5054
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5055
|
+
* you may not use this file except in compliance with the License.
|
|
5056
|
+
* You may obtain a copy of the License at
|
|
5057
|
+
*
|
|
5058
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5059
|
+
*
|
|
5060
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5061
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5062
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5063
|
+
* See the License for the specific language governing permissions and
|
|
5064
|
+
* limitations under the License.
|
|
5065
|
+
*
|
|
5066
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5067
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
5068
|
+
* */
|
|
5069
|
+
|
|
5070
|
+
var LocationTabs = function LocationTabs(_ref) {
|
|
5071
|
+
var tafList = _ref.tafList,
|
|
5072
|
+
_ref$activeIndex = _ref.activeIndex,
|
|
5073
|
+
activeIndex = _ref$activeIndex === void 0 ? 0 : _ref$activeIndex,
|
|
5074
|
+
_ref$onChangeTab = _ref.onChangeTab,
|
|
5075
|
+
onChangeTab = _ref$onChangeTab === void 0 ? function () {} : _ref$onChangeTab,
|
|
5076
|
+
timeSlot = _ref.timeSlot;
|
|
5077
|
+
return /*#__PURE__*/React.createElement(MenuList, {
|
|
5078
|
+
"data-testid": "location-tabs",
|
|
5079
|
+
sx: {
|
|
5080
|
+
paddingTop: '32px'
|
|
4992
5081
|
}
|
|
5082
|
+
}, tafList.map(function (_ref2, index) {
|
|
5083
|
+
var taf = _ref2.taf;
|
|
5084
|
+
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
5085
|
+
key: taf.uuid,
|
|
5086
|
+
selected: index === activeIndex,
|
|
5087
|
+
sx: {
|
|
5088
|
+
backgroundColor: 'geowebColors.cards.cardContainer',
|
|
5089
|
+
borderColor: 'geowebColors.cards.cardContainerBorder',
|
|
5090
|
+
borderWidth: '1px',
|
|
5091
|
+
borderStyle: 'solid',
|
|
5092
|
+
margin: '0 0 4px',
|
|
5093
|
+
height: '56px',
|
|
5094
|
+
justifyContent: 'center',
|
|
5095
|
+
':after': {
|
|
5096
|
+
background: 'none!important'
|
|
5097
|
+
},
|
|
5098
|
+
'&.Mui-selected': {
|
|
5099
|
+
backgroundColor: 'geowebColors.cards.cardContainer',
|
|
5100
|
+
marginRight: '-17px',
|
|
5101
|
+
borderRight: '0px',
|
|
5102
|
+
zIndex: 1
|
|
5103
|
+
}
|
|
5104
|
+
},
|
|
5105
|
+
onClick: function onClick() {
|
|
5106
|
+
return onChangeTab(index);
|
|
5107
|
+
}
|
|
5108
|
+
}, /*#__PURE__*/React.createElement(Box$1, {
|
|
5109
|
+
component: "span",
|
|
5110
|
+
sx: {
|
|
5111
|
+
fontSize: '12px',
|
|
5112
|
+
fontWeight: '500',
|
|
5113
|
+
letterSpacing: '0.09px',
|
|
5114
|
+
'& + svg': {
|
|
5115
|
+
position: 'absolute',
|
|
5116
|
+
bottom: '1px',
|
|
5117
|
+
width: '20px',
|
|
5118
|
+
height: '20px'
|
|
5119
|
+
}
|
|
5120
|
+
}
|
|
5121
|
+
}, taf.location), /*#__PURE__*/React.createElement(StatusIcon, {
|
|
5122
|
+
timeSlot: timeSlot,
|
|
5123
|
+
status: taf.status
|
|
5124
|
+
}));
|
|
5125
|
+
}));
|
|
5126
|
+
};
|
|
5127
|
+
|
|
5128
|
+
/* *
|
|
5129
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5130
|
+
* you may not use this file except in compliance with the License.
|
|
5131
|
+
* You may obtain a copy of the License at
|
|
5132
|
+
*
|
|
5133
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5134
|
+
*
|
|
5135
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5136
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5137
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5138
|
+
* See the License for the specific language governing permissions and
|
|
5139
|
+
* limitations under the License.
|
|
5140
|
+
*
|
|
5141
|
+
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5142
|
+
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
5143
|
+
* */
|
|
5144
|
+
|
|
5145
|
+
var Spinner = function Spinner(props) {
|
|
5146
|
+
return /*#__PURE__*/React__default.createElement(Backdrop, Object.assign({
|
|
5147
|
+
open: true
|
|
5148
|
+
}, props), /*#__PURE__*/React__default.createElement(CircularProgress, {
|
|
5149
|
+
"data-testid": "spinner",
|
|
5150
|
+
color: "inherit"
|
|
5151
|
+
}));
|
|
5152
|
+
};
|
|
5153
|
+
|
|
5154
|
+
var fromActionToStatus = function fromActionToStatus(tafAction) {
|
|
5155
|
+
switch (tafAction) {
|
|
5156
|
+
case 'DRAFT':
|
|
5157
|
+
return 'DRAFT';
|
|
5158
|
+
|
|
5159
|
+
case 'DRAFT_AMEND':
|
|
5160
|
+
return 'DRAFT_AMENDED';
|
|
5161
|
+
|
|
5162
|
+
case 'DRAFT_CORRECT':
|
|
5163
|
+
return 'DRAFT_CORRECTED';
|
|
5164
|
+
|
|
5165
|
+
case 'PUBLISH':
|
|
5166
|
+
return 'PUBLISHED';
|
|
5167
|
+
|
|
5168
|
+
case 'AMEND':
|
|
5169
|
+
return 'AMENDED';
|
|
5170
|
+
|
|
5171
|
+
case 'CORRECT':
|
|
5172
|
+
return 'CORRECTED';
|
|
5173
|
+
|
|
5174
|
+
case 'CANCEL':
|
|
5175
|
+
return 'CANCELLED';
|
|
5176
|
+
|
|
5177
|
+
default:
|
|
5178
|
+
return 'NEW';
|
|
5179
|
+
}
|
|
5180
|
+
};
|
|
5181
|
+
|
|
5182
|
+
var parseErrorMessage = function parseErrorMessage(error, params) {
|
|
5183
|
+
return params.changeStatusTo === 'CANCELLED' ? {
|
|
5184
|
+
type: 'CANCELLED',
|
|
5185
|
+
title: 'Cancelling this TAF failed, please try again'
|
|
5186
|
+
} : {
|
|
5187
|
+
type: 'SERVER',
|
|
5188
|
+
title: 'An error has occurred while saving, please try again',
|
|
5189
|
+
message: getAxiosErrorMessage(error)
|
|
4993
5190
|
};
|
|
5191
|
+
};
|
|
4994
5192
|
|
|
4995
|
-
|
|
5193
|
+
var usePostTafRequest = function usePostTafRequest(request) {
|
|
5194
|
+
var errorParser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : parseErrorMessage;
|
|
5195
|
+
|
|
5196
|
+
var _useIsMounted = useIsMounted(),
|
|
5197
|
+
isMounted = _useIsMounted.isMounted;
|
|
5198
|
+
|
|
5199
|
+
var _React$useState = React__default.useState(false),
|
|
5200
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
5201
|
+
isLoading = _React$useState2[0],
|
|
5202
|
+
setLoading = _React$useState2[1];
|
|
5203
|
+
|
|
5204
|
+
var _React$useState3 = React__default.useState(null),
|
|
5205
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
5206
|
+
error = _React$useState4[0],
|
|
5207
|
+
setError = _React$useState4[1];
|
|
5208
|
+
|
|
5209
|
+
var doRequest = function doRequest(params) {
|
|
4996
5210
|
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
5211
|
+
var newErrorr;
|
|
4997
5212
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
4998
5213
|
while (1) {
|
|
4999
5214
|
switch (_context.prev = _context.next) {
|
|
5000
5215
|
case 0:
|
|
5001
|
-
|
|
5216
|
+
setLoading(true);
|
|
5002
5217
|
_context.prev = 1;
|
|
5003
5218
|
_context.next = 4;
|
|
5004
|
-
return
|
|
5219
|
+
return request(params);
|
|
5005
5220
|
|
|
5006
5221
|
case 4:
|
|
5007
|
-
if (
|
|
5008
|
-
|
|
5222
|
+
if (isMounted.current) {
|
|
5223
|
+
_context.next = 6;
|
|
5224
|
+
break;
|
|
5225
|
+
}
|
|
5009
5226
|
|
|
5010
|
-
|
|
5227
|
+
return _context.abrupt("return");
|
|
5011
5228
|
|
|
5012
|
-
|
|
5013
|
-
|
|
5229
|
+
case 6:
|
|
5230
|
+
setLoading(false);
|
|
5231
|
+
setError(null);
|
|
5232
|
+
_context.next = 18;
|
|
5014
5233
|
break;
|
|
5015
5234
|
|
|
5016
5235
|
case 10:
|
|
5017
5236
|
_context.prev = 10;
|
|
5018
5237
|
_context.t0 = _context["catch"](1);
|
|
5019
5238
|
|
|
5020
|
-
if (
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
setErrorPostMessage(true);
|
|
5024
|
-
|
|
5025
|
-
if (isAxiosError(_context.t0)) {
|
|
5026
|
-
setErrorPostMessageText(getAxiosErrorMessage(_context.t0));
|
|
5027
|
-
}
|
|
5239
|
+
if (isMounted.current) {
|
|
5240
|
+
_context.next = 14;
|
|
5241
|
+
break;
|
|
5028
5242
|
}
|
|
5029
5243
|
|
|
5030
|
-
|
|
5244
|
+
return _context.abrupt("return");
|
|
5031
5245
|
|
|
5032
5246
|
case 14:
|
|
5247
|
+
newErrorr = errorParser ? errorParser(_context.t0, params) : _context.t0;
|
|
5248
|
+
setLoading(false);
|
|
5249
|
+
setError(newErrorr);
|
|
5250
|
+
throw newErrorr;
|
|
5251
|
+
|
|
5252
|
+
case 18:
|
|
5033
5253
|
case "end":
|
|
5034
5254
|
return _context.stop();
|
|
5035
5255
|
}
|
|
@@ -5038,97 +5258,552 @@ var TafWrapper = function TafWrapper() {
|
|
|
5038
5258
|
}));
|
|
5039
5259
|
};
|
|
5040
5260
|
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5261
|
+
return {
|
|
5262
|
+
isLoading: isLoading,
|
|
5263
|
+
error: error,
|
|
5264
|
+
setError: setError,
|
|
5265
|
+
doRequest: doRequest
|
|
5266
|
+
};
|
|
5267
|
+
};
|
|
5045
5268
|
|
|
5046
|
-
|
|
5047
|
-
|
|
5269
|
+
var TafPanel = function TafPanel(_ref) {
|
|
5270
|
+
var tafFromBackend = _ref.tafFromBackend,
|
|
5271
|
+
activeTafIndex = _ref.activeTafIndex,
|
|
5272
|
+
index = _ref.index,
|
|
5273
|
+
_ref$isLoading = _ref.isLoading,
|
|
5274
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
5275
|
+
_ref$postTaf = _ref.postTaf,
|
|
5276
|
+
postTaf = _ref$postTaf === void 0 ? function () {
|
|
5277
|
+
return null;
|
|
5278
|
+
} : _ref$postTaf,
|
|
5279
|
+
_ref$onFormDirty = _ref.onFormDirty,
|
|
5280
|
+
onFormDirty = _ref$onFormDirty === void 0 ? function () {
|
|
5281
|
+
return null;
|
|
5282
|
+
} : _ref$onFormDirty,
|
|
5283
|
+
_ref$isIssuesPaneOpen = _ref.isIssuesPaneOpen,
|
|
5284
|
+
isIssuesPaneOpen = _ref$isIssuesPaneOpen === void 0 ? false : _ref$isIssuesPaneOpen,
|
|
5285
|
+
_ref$setIsIssuesPaneO = _ref.setIsIssuesPaneOpen,
|
|
5286
|
+
setIsIssuesPaneOpen = _ref$setIsIssuesPaneO === void 0 ? function () {
|
|
5287
|
+
return null;
|
|
5288
|
+
} : _ref$setIsIssuesPaneO,
|
|
5289
|
+
_ref$isFormDisabled = _ref.isFormDisabled,
|
|
5290
|
+
isFormDisabled = _ref$isFormDisabled === void 0 ? false : _ref$isFormDisabled,
|
|
5291
|
+
_ref$setIsFormDisable = _ref.setIsFormDisabled,
|
|
5292
|
+
setIsFormDisabled = _ref$setIsFormDisable === void 0 ? function () {
|
|
5293
|
+
return null;
|
|
5294
|
+
} : _ref$setIsFormDisable,
|
|
5295
|
+
error = _ref.error;
|
|
5048
5296
|
|
|
5049
|
-
|
|
5050
|
-
|
|
5297
|
+
var onTafAction = function onTafAction(action, taf) {
|
|
5298
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
5299
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
5300
|
+
while (1) {
|
|
5301
|
+
switch (_context2.prev = _context2.next) {
|
|
5302
|
+
case 0:
|
|
5303
|
+
_context2.prev = 0;
|
|
5304
|
+
_context2.t0 = action;
|
|
5305
|
+
_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;
|
|
5306
|
+
break;
|
|
5051
5307
|
|
|
5052
|
-
|
|
5053
|
-
|
|
5308
|
+
case 4:
|
|
5309
|
+
_context2.next = 6;
|
|
5310
|
+
return postTaf({
|
|
5311
|
+
taf: taf,
|
|
5312
|
+
changeStatusTo: fromActionToStatus(action)
|
|
5313
|
+
});
|
|
5054
5314
|
|
|
5055
|
-
|
|
5056
|
-
|
|
5315
|
+
case 6:
|
|
5316
|
+
return _context2.abrupt("return", true);
|
|
5057
5317
|
|
|
5058
|
-
|
|
5059
|
-
|
|
5318
|
+
case 7:
|
|
5319
|
+
return _context2.abrupt("return", false);
|
|
5060
5320
|
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5321
|
+
case 8:
|
|
5322
|
+
_context2.next = 13;
|
|
5323
|
+
break;
|
|
5324
|
+
|
|
5325
|
+
case 10:
|
|
5326
|
+
_context2.prev = 10;
|
|
5327
|
+
_context2.t1 = _context2["catch"](0);
|
|
5328
|
+
return _context2.abrupt("return", false);
|
|
5329
|
+
|
|
5330
|
+
case 13:
|
|
5331
|
+
case "end":
|
|
5332
|
+
return _context2.stop();
|
|
5333
|
+
}
|
|
5334
|
+
}
|
|
5335
|
+
}, _callee2, null, [[0, 10]]);
|
|
5336
|
+
}));
|
|
5064
5337
|
};
|
|
5065
5338
|
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5339
|
+
return /*#__PURE__*/React__default.createElement(TabPanel, {
|
|
5340
|
+
value: activeTafIndex,
|
|
5341
|
+
index: index,
|
|
5342
|
+
"data-testid": "taf-panel".concat(activeTafIndex === index ? '-active' : '')
|
|
5343
|
+
}, /*#__PURE__*/React__default.createElement(TafHeader, {
|
|
5344
|
+
title: getTafStatusLabel(tafFromBackend.taf.status)
|
|
5345
|
+
}), isLoading && /*#__PURE__*/React__default.createElement(Spinner, {
|
|
5346
|
+
"data-testid": "taf-loading",
|
|
5347
|
+
sx: {
|
|
5348
|
+
position: 'absolute',
|
|
5349
|
+
zIndex: 1,
|
|
5350
|
+
color: 'geowebColors.backdrops.white.fill'
|
|
5351
|
+
}
|
|
5352
|
+
}), error && /*#__PURE__*/React__default.createElement(AlertBanner, {
|
|
5353
|
+
severity: "error",
|
|
5354
|
+
title: error.title,
|
|
5355
|
+
info: error.message,
|
|
5356
|
+
dataTestId: "taf-error"
|
|
5357
|
+
}), /*#__PURE__*/React__default.createElement(TafForm, {
|
|
5358
|
+
tafFromBackend: tafFromBackend,
|
|
5359
|
+
onFormAction: onTafAction,
|
|
5360
|
+
onFormDirty: onFormDirty,
|
|
5361
|
+
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
5362
|
+
setIsIssuesPaneOpen: setIsIssuesPaneOpen,
|
|
5363
|
+
isDisabled: isFormDisabled,
|
|
5364
|
+
setIsDisabled: setIsFormDisabled
|
|
5365
|
+
}));
|
|
5366
|
+
};
|
|
5078
5367
|
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5368
|
+
/* *
|
|
5369
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5370
|
+
* you may not use this file except in compliance with the License.
|
|
5371
|
+
* You may obtain a copy of the License at
|
|
5372
|
+
*
|
|
5373
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5374
|
+
*
|
|
5375
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5376
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5377
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5378
|
+
* See the License for the specific language governing permissions and
|
|
5379
|
+
* limitations under the License.
|
|
5380
|
+
*
|
|
5381
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5382
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
5383
|
+
* */
|
|
5090
5384
|
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5385
|
+
var IssuesPaneWrapper = function IssuesPaneWrapper(props) {
|
|
5386
|
+
var _useFormContext = useFormContext(),
|
|
5387
|
+
errors = _useFormContext.formState.errors;
|
|
5388
|
+
|
|
5389
|
+
var errorList = filterDuplicateErrors(getErrors(errors));
|
|
5390
|
+
return /*#__PURE__*/React.createElement(IssuesPane, Object.assign({
|
|
5391
|
+
errorList: errorList
|
|
5392
|
+
}, props));
|
|
5393
|
+
};
|
|
5394
|
+
|
|
5395
|
+
var CONFIRM_DIALOG_OPTIONS = {
|
|
5396
|
+
title: 'Whoops',
|
|
5397
|
+
description: "It's not possible to autosave this TAF due to the presence of issue(s). Are you sure you want to close this TAF? Any changes made will be lost.",
|
|
5398
|
+
confirmLabel: 'Exit without saving'
|
|
5399
|
+
};
|
|
5400
|
+
|
|
5401
|
+
var TafLayout = function TafLayout(_ref) {
|
|
5402
|
+
var _ref$tafList = _ref.tafList,
|
|
5403
|
+
tafList = _ref$tafList === void 0 ? [] : _ref$tafList,
|
|
5404
|
+
_ref$onPostTaf = _ref.onPostTaf,
|
|
5405
|
+
onPostTaf = _ref$onPostTaf === void 0 ? function () {} : _ref$onPostTaf;
|
|
5406
|
+
|
|
5407
|
+
var _useApiContext = useApiContext(),
|
|
5408
|
+
api = _useApiContext.api;
|
|
5409
|
+
|
|
5410
|
+
var confirmDialog = useConfirmationDialog();
|
|
5411
|
+
|
|
5412
|
+
var _useIssuesPane = useIssuesPane(),
|
|
5413
|
+
isIssuesPaneOpen = _useIssuesPane.isIssuesPaneOpen,
|
|
5414
|
+
onToggleIssuesPane = _useIssuesPane.onToggleIssuesPane,
|
|
5415
|
+
onCloseIssuesPane = _useIssuesPane.onCloseIssuesPane,
|
|
5416
|
+
startPosition = _useIssuesPane.startPosition;
|
|
5417
|
+
|
|
5418
|
+
var _usePostTafRequest = usePostTafRequest(api.postTaf),
|
|
5419
|
+
isLoading = _usePostTafRequest.isLoading,
|
|
5420
|
+
postTafRequest = _usePostTafRequest.doRequest,
|
|
5421
|
+
error = _usePostTafRequest.error,
|
|
5422
|
+
setError = _usePostTafRequest.setError;
|
|
5423
|
+
|
|
5424
|
+
var _useTafModuleContext = useTafModuleContext(),
|
|
5425
|
+
onValidateForm = _useTafModuleContext.onValidateForm,
|
|
5426
|
+
tafAction = _useTafModuleContext.tafAction;
|
|
5427
|
+
|
|
5428
|
+
var _React$useState = React__default.useState(sortTafTimeSlots(tafList)),
|
|
5429
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
5430
|
+
_React$useState2$ = _React$useState2[0],
|
|
5431
|
+
upcoming = _React$useState2$.upcoming,
|
|
5432
|
+
current = _React$useState2$.current,
|
|
5433
|
+
expired = _React$useState2$.expired,
|
|
5434
|
+
updateSortedTafs = _React$useState2[1];
|
|
5435
|
+
|
|
5436
|
+
var _current$slice = current.slice(-1),
|
|
5437
|
+
_current$slice2 = _slicedToArray(_current$slice, 1),
|
|
5438
|
+
lastCurrentTaf = _current$slice2[0];
|
|
5439
|
+
|
|
5440
|
+
var _React$useState3 = React__default.useState('UPCOMING'),
|
|
5441
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
5442
|
+
timeSlot = _React$useState4[0],
|
|
5443
|
+
setTimeSlot = _React$useState4[1];
|
|
5444
|
+
|
|
5445
|
+
var _React$useState5 = React__default.useState(upcoming),
|
|
5446
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
5447
|
+
locations = _React$useState6[0],
|
|
5448
|
+
setLocations = _React$useState6[1];
|
|
5449
|
+
|
|
5450
|
+
var _React$useState7 = React__default.useState(0),
|
|
5451
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
5452
|
+
activeTafIndex = _React$useState8[0],
|
|
5453
|
+
setActiveTafIndex = _React$useState8[1];
|
|
5454
|
+
|
|
5455
|
+
var _React$useState9 = React__default.useState(false),
|
|
5456
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
5457
|
+
isFormDirty = _React$useState10[0],
|
|
5458
|
+
setIsFormDirty = _React$useState10[1];
|
|
5459
|
+
|
|
5460
|
+
var _React$useState11 = React__default.useState(false),
|
|
5461
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
5462
|
+
isFormDisabled = _React$useState12[0],
|
|
5463
|
+
setIsFormDisabled = _React$useState12[1];
|
|
5464
|
+
|
|
5465
|
+
var postTaf = function postTaf(data) {
|
|
5466
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
5467
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
5468
|
+
while (1) {
|
|
5469
|
+
switch (_context.prev = _context.next) {
|
|
5470
|
+
case 0:
|
|
5471
|
+
_context.next = 2;
|
|
5472
|
+
return postTafRequest(data);
|
|
5473
|
+
|
|
5474
|
+
case 2:
|
|
5475
|
+
// callback
|
|
5476
|
+
onPostTaf();
|
|
5477
|
+
|
|
5478
|
+
case 3:
|
|
5479
|
+
case "end":
|
|
5480
|
+
return _context.stop();
|
|
5481
|
+
}
|
|
5482
|
+
}
|
|
5483
|
+
}, _callee);
|
|
5484
|
+
}));
|
|
5095
5485
|
};
|
|
5096
5486
|
|
|
5097
|
-
|
|
5098
|
-
|
|
5099
|
-
|
|
5100
|
-
|
|
5101
|
-
|
|
5102
|
-
|
|
5103
|
-
|
|
5104
|
-
|
|
5105
|
-
|
|
5106
|
-
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5487
|
+
function onChangeTab(action, value) {
|
|
5488
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
5489
|
+
var taf;
|
|
5490
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
5491
|
+
while (1) {
|
|
5492
|
+
switch (_context2.prev = _context2.next) {
|
|
5493
|
+
case 0:
|
|
5494
|
+
if (!isFormDirty) {
|
|
5495
|
+
_context2.next = 15;
|
|
5496
|
+
break;
|
|
5497
|
+
}
|
|
5498
|
+
|
|
5499
|
+
_context2.prev = 1;
|
|
5500
|
+
_context2.next = 4;
|
|
5501
|
+
return onValidateForm();
|
|
5502
|
+
|
|
5503
|
+
case 4:
|
|
5504
|
+
taf = _context2.sent;
|
|
5505
|
+
_context2.next = 7;
|
|
5506
|
+
return postTaf({
|
|
5507
|
+
taf: taf,
|
|
5508
|
+
changeStatusTo: fromActionToStatus(tafActionToDraftAction(tafAction))
|
|
5509
|
+
});
|
|
5510
|
+
|
|
5511
|
+
case 7:
|
|
5512
|
+
action(value);
|
|
5513
|
+
_context2.next = 13;
|
|
5514
|
+
break;
|
|
5515
|
+
|
|
5516
|
+
case 10:
|
|
5517
|
+
_context2.prev = 10;
|
|
5518
|
+
_context2.t0 = _context2["catch"](1);
|
|
5519
|
+
confirmDialog(CONFIRM_DIALOG_OPTIONS).then(function () {
|
|
5520
|
+
action(value);
|
|
5521
|
+
});
|
|
5522
|
+
|
|
5523
|
+
case 13:
|
|
5524
|
+
_context2.next = 16;
|
|
5525
|
+
break;
|
|
5526
|
+
|
|
5527
|
+
case 15:
|
|
5528
|
+
action(value);
|
|
5529
|
+
|
|
5530
|
+
case 16:
|
|
5531
|
+
case "end":
|
|
5532
|
+
return _context2.stop();
|
|
5533
|
+
}
|
|
5534
|
+
}
|
|
5535
|
+
}, _callee2, null, [[1, 10]]);
|
|
5536
|
+
}));
|
|
5537
|
+
}
|
|
5538
|
+
|
|
5539
|
+
var onChangeLocationTab = function onChangeLocationTab(index) {
|
|
5540
|
+
onChangeTab(setActiveTafIndex, index);
|
|
5541
|
+
};
|
|
5542
|
+
|
|
5543
|
+
var onChangeTimeSlot = function onChangeTimeSlot(newTimeSlot) {
|
|
5544
|
+
onChangeTab(changeTimeSlot, newTimeSlot);
|
|
5545
|
+
};
|
|
5546
|
+
|
|
5547
|
+
var changeTimeSlot = function changeTimeSlot(newTimeSlot) {
|
|
5548
|
+
setTimeSlot(newTimeSlot);
|
|
5549
|
+
setLocations(newTimeSlot === 'ACTIVE' ? current : upcoming);
|
|
5550
|
+
setActiveTafIndex(0);
|
|
5551
|
+
};
|
|
5552
|
+
|
|
5553
|
+
React__default.useEffect(function () {
|
|
5554
|
+
var newSortedTafs = sortTafTimeSlots(tafList);
|
|
5555
|
+
var updatedLocations = timeSlot === 'ACTIVE' ? newSortedTafs.current : newSortedTafs.upcoming;
|
|
5556
|
+
updateSortedTafs(sortTafTimeSlots(tafList));
|
|
5557
|
+
setLocations(updatedLocations); // update active index
|
|
5558
|
+
|
|
5559
|
+
var newActiveIndex = updatedLocations.findIndex(function (location) {
|
|
5560
|
+
return location.taf.previousId === locations[activeTafIndex].taf.uuid;
|
|
5561
|
+
});
|
|
5562
|
+
var newIndex = newActiveIndex !== -1 ? newActiveIndex : activeTafIndex;
|
|
5563
|
+
setActiveTafIndex(newIndex); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5564
|
+
}, [tafList, setLocations]);
|
|
5565
|
+
React__default.useEffect(function () {
|
|
5566
|
+
var cancelErrorTimeout = error && error.type === 'CANCELLED' ? setTimeout(function () {
|
|
5567
|
+
setError(null);
|
|
5568
|
+
}, 10000) : null;
|
|
5569
|
+
return function () {
|
|
5570
|
+
if (cancelErrorTimeout !== null) {
|
|
5571
|
+
clearTimeout(cancelErrorTimeout);
|
|
5572
|
+
}
|
|
5573
|
+
};
|
|
5574
|
+
}, [error, setError]);
|
|
5575
|
+
|
|
5576
|
+
if (!tafList) {
|
|
5577
|
+
return null;
|
|
5578
|
+
}
|
|
5579
|
+
|
|
5580
|
+
var activeTaf = locations[activeTafIndex];
|
|
5581
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Box, {
|
|
5582
|
+
id: MODAL_DIALOG_ELEMENT,
|
|
5583
|
+
component: "div",
|
|
5584
|
+
sx: {
|
|
5585
|
+
width: '100%',
|
|
5586
|
+
height: '100%',
|
|
5587
|
+
position: 'absolute',
|
|
5588
|
+
overflow: 'hidden',
|
|
5589
|
+
pointerEvents: 'none'
|
|
5590
|
+
}
|
|
5591
|
+
}), /*#__PURE__*/React__default.createElement(Box, {
|
|
5592
|
+
sx: {
|
|
5593
|
+
height: '100%',
|
|
5594
|
+
maxHeight: '100%'
|
|
5595
|
+
}
|
|
5596
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
5597
|
+
sx: {
|
|
5598
|
+
minWidth: 320,
|
|
5599
|
+
maxWidth: 1272,
|
|
5600
|
+
margin: 'auto',
|
|
5601
|
+
height: '100%',
|
|
5602
|
+
display: 'flex',
|
|
5603
|
+
flexDirection: 'column'
|
|
5604
|
+
}
|
|
5605
|
+
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
5606
|
+
container: true,
|
|
5607
|
+
spacing: 2,
|
|
5608
|
+
sx: {
|
|
5609
|
+
paddingLeft: 1,
|
|
5610
|
+
paddingRight: 1
|
|
5611
|
+
}
|
|
5612
|
+
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
5613
|
+
item: true,
|
|
5614
|
+
xs: 12,
|
|
5615
|
+
sm: 9
|
|
5616
|
+
}, /*#__PURE__*/React__default.createElement(TopTabs, {
|
|
5617
|
+
tafFromBackend: lastCurrentTaf,
|
|
5618
|
+
timeSlot: timeSlot,
|
|
5619
|
+
onChangeTimeSlot: onChangeTimeSlot
|
|
5620
|
+
}))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
5621
|
+
container: true,
|
|
5622
|
+
flexGrow: 1,
|
|
5623
|
+
overflow: "hidden"
|
|
5624
|
+
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
5625
|
+
container: true,
|
|
5626
|
+
spacing: 2,
|
|
5627
|
+
sx: {
|
|
5628
|
+
height: '100%',
|
|
5629
|
+
paddingLeft: 1,
|
|
5630
|
+
paddingRight: 1,
|
|
5631
|
+
paddingTop: 2,
|
|
5632
|
+
overflow: 'auto'
|
|
5633
|
+
}
|
|
5634
|
+
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
5635
|
+
item: true,
|
|
5636
|
+
xs: 3,
|
|
5637
|
+
sm: 1
|
|
5638
|
+
}, /*#__PURE__*/React__default.createElement(LocationTabs, {
|
|
5639
|
+
tafList: locations,
|
|
5640
|
+
activeIndex: activeTafIndex,
|
|
5641
|
+
onChangeTab: onChangeLocationTab,
|
|
5642
|
+
timeSlot: timeSlot
|
|
5643
|
+
})), /*#__PURE__*/React__default.createElement(Grid, {
|
|
5644
|
+
item: true,
|
|
5645
|
+
xs: true
|
|
5646
|
+
}, /*#__PURE__*/React__default.createElement(Card, {
|
|
5647
|
+
variant: "outlined",
|
|
5648
|
+
sx: {
|
|
5649
|
+
padding: 1,
|
|
5650
|
+
paddingTop: 0,
|
|
5651
|
+
marginBottom: '12px',
|
|
5652
|
+
position: 'relative'
|
|
5653
|
+
}
|
|
5654
|
+
}, /*#__PURE__*/React__default.createElement(TacOverviewMobile, {
|
|
5655
|
+
upcomingTafs: upcoming,
|
|
5656
|
+
currentTafs: current,
|
|
5657
|
+
expiredTafs: expired,
|
|
5658
|
+
activeTaf: activeTaf
|
|
5659
|
+
}), locations.map(function (tafFromBackend, index) {
|
|
5660
|
+
return /*#__PURE__*/React__default.createElement(TafPanel, {
|
|
5661
|
+
key: tafFromBackend.taf.uuid,
|
|
5662
|
+
activeTafIndex: activeTafIndex,
|
|
5663
|
+
index: index,
|
|
5664
|
+
tafFromBackend: tafFromBackend,
|
|
5665
|
+
onFormDirty: setIsFormDirty,
|
|
5666
|
+
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
5667
|
+
setIsIssuesPaneOpen: onToggleIssuesPane,
|
|
5668
|
+
isFormDisabled: isFormDisabled,
|
|
5669
|
+
setIsFormDisabled: setIsFormDisabled,
|
|
5670
|
+
postTaf: postTaf,
|
|
5671
|
+
isLoading: isLoading,
|
|
5672
|
+
error: error
|
|
5673
|
+
});
|
|
5674
|
+
}))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
5675
|
+
item: true,
|
|
5676
|
+
xs: 3,
|
|
5677
|
+
sx: {
|
|
5678
|
+
height: '100%'
|
|
5679
|
+
},
|
|
5680
|
+
display: {
|
|
5681
|
+
xs: 'none',
|
|
5682
|
+
sm: 'block'
|
|
5683
|
+
}
|
|
5684
|
+
}, /*#__PURE__*/React__default.createElement(TacOverview, {
|
|
5685
|
+
upcomingTafs: upcoming,
|
|
5686
|
+
currentTafs: current,
|
|
5687
|
+
expiredTafs: expired,
|
|
5688
|
+
activeTaf: activeTaf,
|
|
5689
|
+
isFormDisabled: isFormDisabled
|
|
5690
|
+
})))))), /*#__PURE__*/React__default.createElement(IssuesPaneWrapper, {
|
|
5691
|
+
handleClose: onCloseIssuesPane,
|
|
5692
|
+
isOpen: isIssuesPaneOpen,
|
|
5693
|
+
startPosition: startPosition
|
|
5694
|
+
}));
|
|
5120
5695
|
};
|
|
5121
|
-
|
|
5122
|
-
*
|
|
5123
|
-
*
|
|
5696
|
+
|
|
5697
|
+
/* *
|
|
5698
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5699
|
+
* you may not use this file except in compliance with the License.
|
|
5700
|
+
* You may obtain a copy of the License at
|
|
5701
|
+
*
|
|
5702
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5124
5703
|
*
|
|
5125
|
-
*
|
|
5126
|
-
*
|
|
5127
|
-
|
|
5704
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5705
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5706
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5707
|
+
* See the License for the specific language governing permissions and
|
|
5708
|
+
* limitations under the License.
|
|
5709
|
+
*
|
|
5710
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5711
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
5712
|
+
* */
|
|
5128
5713
|
|
|
5714
|
+
var TafWrapper = function TafWrapper(_ref) {
|
|
5715
|
+
var children = _ref.children;
|
|
5716
|
+
return /*#__PURE__*/React.createElement(TafModuleProvider, null, /*#__PURE__*/React.createElement(ConfirmationServiceProvider, null, /*#__PURE__*/React.createElement(ReactHookFormProvider, {
|
|
5717
|
+
options: {
|
|
5718
|
+
mode: 'onTouched',
|
|
5719
|
+
reValidateMode: 'onChange',
|
|
5720
|
+
criteriaMode: 'all'
|
|
5721
|
+
}
|
|
5722
|
+
}, children)));
|
|
5723
|
+
};
|
|
5724
|
+
|
|
5725
|
+
var TafModule = function TafModule() {
|
|
5726
|
+
var _useApiContext = useApiContext(),
|
|
5727
|
+
api = _useApiContext.api;
|
|
5728
|
+
|
|
5729
|
+
var _React$useState = React.useState(false),
|
|
5730
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
5731
|
+
isLoading = _React$useState2[0],
|
|
5732
|
+
setLoading = _React$useState2[1];
|
|
5733
|
+
|
|
5734
|
+
var _useApi = useApi(api.getTafList),
|
|
5735
|
+
getTafListError = _useApi.error,
|
|
5736
|
+
isFetchingInitial = _useApi.isLoading,
|
|
5737
|
+
tafList = _useApi.result,
|
|
5738
|
+
fetchNewTafList = _useApi.fetchApiData;
|
|
5129
5739
|
|
|
5130
|
-
|
|
5131
|
-
|
|
5740
|
+
usePoller([tafList, getTafListError], function () {
|
|
5741
|
+
return fetchNewTafList({});
|
|
5742
|
+
});
|
|
5743
|
+
|
|
5744
|
+
var reFetchNewTafList = function reFetchNewTafList() {
|
|
5745
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
5746
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
5747
|
+
while (1) {
|
|
5748
|
+
switch (_context.prev = _context.next) {
|
|
5749
|
+
case 0:
|
|
5750
|
+
_context.prev = 0;
|
|
5751
|
+
setLoading(true);
|
|
5752
|
+
_context.next = 4;
|
|
5753
|
+
return fetchNewTafList({});
|
|
5754
|
+
|
|
5755
|
+
case 4:
|
|
5756
|
+
setLoading(false);
|
|
5757
|
+
_context.next = 10;
|
|
5758
|
+
break;
|
|
5759
|
+
|
|
5760
|
+
case 7:
|
|
5761
|
+
_context.prev = 7;
|
|
5762
|
+
_context.t0 = _context["catch"](0);
|
|
5763
|
+
setLoading(false);
|
|
5764
|
+
|
|
5765
|
+
case 10:
|
|
5766
|
+
case "end":
|
|
5767
|
+
return _context.stop();
|
|
5768
|
+
}
|
|
5769
|
+
}
|
|
5770
|
+
}, _callee, null, [[0, 7]]);
|
|
5771
|
+
}));
|
|
5772
|
+
};
|
|
5773
|
+
|
|
5774
|
+
var hasTafListError = getTafListError !== null;
|
|
5775
|
+
|
|
5776
|
+
if (isFetchingInitial) {
|
|
5777
|
+
return /*#__PURE__*/React.createElement(LinearProgress, {
|
|
5778
|
+
color: "secondary",
|
|
5779
|
+
"data-testid": "loading-bar"
|
|
5780
|
+
});
|
|
5781
|
+
}
|
|
5782
|
+
|
|
5783
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
5784
|
+
component: "div",
|
|
5785
|
+
id: "tafmodule",
|
|
5786
|
+
sx: {
|
|
5787
|
+
height: '100%'
|
|
5788
|
+
}
|
|
5789
|
+
}, isLoading && /*#__PURE__*/React.createElement(LinearProgress, {
|
|
5790
|
+
"data-testid": "loading-bar",
|
|
5791
|
+
color: "secondary",
|
|
5792
|
+
sx: {
|
|
5793
|
+
marginBottom: '-4px'
|
|
5794
|
+
}
|
|
5795
|
+
}), hasTafListError && /*#__PURE__*/React.createElement(AlertBanner, {
|
|
5796
|
+
severity: "error",
|
|
5797
|
+
title: "An error has occurred while retrieving the list",
|
|
5798
|
+
info: getTafListError.message
|
|
5799
|
+
}), /*#__PURE__*/React.createElement(TafLayout, {
|
|
5800
|
+
tafList: tafList,
|
|
5801
|
+
onPostTaf: reFetchNewTafList
|
|
5802
|
+
}));
|
|
5803
|
+
};
|
|
5804
|
+
|
|
5805
|
+
var Wrapper = function Wrapper() {
|
|
5806
|
+
return /*#__PURE__*/React.createElement(TafWrapper, null, /*#__PURE__*/React.createElement(TafModule, null));
|
|
5132
5807
|
};
|
|
5133
5808
|
|
|
5134
5809
|
/* *
|
|
@@ -5147,7 +5822,7 @@ var ConfirmationWrapper = function ConfirmationWrapper() {
|
|
|
5147
5822
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5148
5823
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
5149
5824
|
* */
|
|
5150
|
-
var createApi = function createApi(url, appUrl, auth, setAuth, authTokenUrl, authClientId) {
|
|
5825
|
+
var createApi$1 = function createApi(url, appUrl, auth, setAuth, authTokenUrl, authClientId) {
|
|
5151
5826
|
var axiosInstance = createApiInstance(url, appUrl, auth, setAuth, authTokenUrl, authClientId);
|
|
5152
5827
|
return {
|
|
5153
5828
|
// api data
|
|
@@ -5163,4 +5838,971 @@ var createApi = function createApi(url, appUrl, auth, setAuth, authTokenUrl, aut
|
|
|
5163
5838
|
};
|
|
5164
5839
|
};
|
|
5165
5840
|
|
|
5166
|
-
|
|
5841
|
+
var currentDate = moment.utc().format('YYYY-MM-DD');
|
|
5842
|
+
var tomorrowDate = moment.utc().add(1, 'day').format('YYYY-MM-DD');
|
|
5843
|
+
var airportPeriod = 6;
|
|
5844
|
+
var airportValidity = 40;
|
|
5845
|
+
|
|
5846
|
+
var validDateRange = function validDateRange(refHour, period) {
|
|
5847
|
+
var startHour = period * Math.floor(parseInt(refHour.format('HH'), 10) / period) % 24;
|
|
5848
|
+
var start = refHour.set({
|
|
5849
|
+
hour: startHour,
|
|
5850
|
+
minute: 0,
|
|
5851
|
+
second: 0
|
|
5852
|
+
});
|
|
5853
|
+
var end = start.clone().add(airportValidity, 'hours');
|
|
5854
|
+
return [start.format('YYYY-MM-DDTHH:mm:ss'), end.format('YYYY-MM-DDTHH:mm:ss')];
|
|
5855
|
+
};
|
|
5856
|
+
|
|
5857
|
+
var dateAdd = function dateAdd(refDateAsString, hours) {
|
|
5858
|
+
return moment.utc(refDateAsString).add(hours, 'hours').format('YYYY-MM-DDTHH:mm:ss');
|
|
5859
|
+
};
|
|
5860
|
+
|
|
5861
|
+
var _validDateRange = validDateRange(moment.utc(), airportPeriod),
|
|
5862
|
+
_validDateRange2 = _slicedToArray(_validDateRange, 2),
|
|
5863
|
+
currentValidDateStart = _validDateRange2[0],
|
|
5864
|
+
currentValidDateEnd = _validDateRange2[1];
|
|
5865
|
+
|
|
5866
|
+
var _validDateRange3 = validDateRange(moment.utc().add(6, 'hours'), airportPeriod),
|
|
5867
|
+
_validDateRange4 = _slicedToArray(_validDateRange3, 2),
|
|
5868
|
+
upcomingValidDateStart = _validDateRange4[0],
|
|
5869
|
+
upcomingValidDateEnd = _validDateRange4[1];
|
|
5870
|
+
|
|
5871
|
+
var _validDateRange5 = validDateRange(moment.utc().add(-6, 'hours'), airportPeriod),
|
|
5872
|
+
_validDateRange6 = _slicedToArray(_validDateRange5, 2),
|
|
5873
|
+
expiredValidDateStart = _validDateRange6[0],
|
|
5874
|
+
expiredValidDateEnd = _validDateRange6[1];
|
|
5875
|
+
|
|
5876
|
+
var fakeTafList = [{
|
|
5877
|
+
creationDate: upcomingValidDateStart,
|
|
5878
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
5879
|
+
taf: {
|
|
5880
|
+
uuid: '5f9583fjdf0f337925',
|
|
5881
|
+
baseTime: upcomingValidDateStart,
|
|
5882
|
+
validDateStart: upcomingValidDateStart,
|
|
5883
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5884
|
+
location: 'EHAM',
|
|
5885
|
+
status: 'NEW',
|
|
5886
|
+
type: 'NORMAL',
|
|
5887
|
+
messageType: 'ORG',
|
|
5888
|
+
baseForecast: {
|
|
5889
|
+
valid: {
|
|
5890
|
+
start: upcomingValidDateStart,
|
|
5891
|
+
end: upcomingValidDateEnd
|
|
5892
|
+
}
|
|
5893
|
+
}
|
|
5894
|
+
}
|
|
5895
|
+
}, {
|
|
5896
|
+
creationDate: upcomingValidDateStart,
|
|
5897
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
5898
|
+
taf: {
|
|
5899
|
+
uuid: '5f9583fjd111137925',
|
|
5900
|
+
baseTime: upcomingValidDateStart,
|
|
5901
|
+
validDateStart: upcomingValidDateStart,
|
|
5902
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5903
|
+
location: 'EHRD',
|
|
5904
|
+
status: 'DRAFT',
|
|
5905
|
+
type: 'NORMAL',
|
|
5906
|
+
messageType: 'ORG',
|
|
5907
|
+
baseForecast: {
|
|
5908
|
+
valid: {
|
|
5909
|
+
start: upcomingValidDateStart,
|
|
5910
|
+
end: upcomingValidDateEnd
|
|
5911
|
+
},
|
|
5912
|
+
wind: {
|
|
5913
|
+
direction: 180,
|
|
5914
|
+
speed: 10,
|
|
5915
|
+
unit: 'KT'
|
|
5916
|
+
},
|
|
5917
|
+
cavOK: true
|
|
5918
|
+
}
|
|
5919
|
+
}
|
|
5920
|
+
}, {
|
|
5921
|
+
creationDate: upcomingValidDateStart,
|
|
5922
|
+
canbe: ['CANCELLED', 'AMENDED', 'DISCARDED'],
|
|
5923
|
+
taf: {
|
|
5924
|
+
uuid: '754905485',
|
|
5925
|
+
baseTime: upcomingValidDateStart,
|
|
5926
|
+
previousId: '5f9583fjdf45ff4330f337925',
|
|
5927
|
+
validDateStart: upcomingValidDateStart,
|
|
5928
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5929
|
+
previousValidDateStart: upcomingValidDateStart,
|
|
5930
|
+
previousValidDateEnd: upcomingValidDateEnd,
|
|
5931
|
+
location: 'EHLE',
|
|
5932
|
+
status: 'DRAFT_AMENDED',
|
|
5933
|
+
type: 'NORMAL',
|
|
5934
|
+
messageType: 'AMD',
|
|
5935
|
+
baseForecast: {
|
|
5936
|
+
valid: {
|
|
5937
|
+
start: upcomingValidDateStart,
|
|
5938
|
+
end: upcomingValidDateEnd
|
|
5939
|
+
},
|
|
5940
|
+
visibility: {
|
|
5941
|
+
range: 600,
|
|
5942
|
+
unit: 'M'
|
|
5943
|
+
},
|
|
5944
|
+
wind: {
|
|
5945
|
+
direction: 180,
|
|
5946
|
+
speed: 10,
|
|
5947
|
+
unit: 'KT'
|
|
5948
|
+
},
|
|
5949
|
+
weather: {
|
|
5950
|
+
weather1: 'SN'
|
|
5951
|
+
},
|
|
5952
|
+
cloud: {
|
|
5953
|
+
cloud1: {
|
|
5954
|
+
coverage: 'BKN',
|
|
5955
|
+
height: 35
|
|
5956
|
+
}
|
|
5957
|
+
}
|
|
5958
|
+
},
|
|
5959
|
+
changeGroups: [{
|
|
5960
|
+
change: 'TEMPO',
|
|
5961
|
+
probability: 'PROB30',
|
|
5962
|
+
valid: {
|
|
5963
|
+
start: dateAdd(upcomingValidDateStart, 3),
|
|
5964
|
+
end: dateAdd(upcomingValidDateStart, 4)
|
|
5965
|
+
},
|
|
5966
|
+
visibility: {
|
|
5967
|
+
range: 100,
|
|
5968
|
+
unit: 'M'
|
|
5969
|
+
},
|
|
5970
|
+
cloud: {
|
|
5971
|
+
cloud1: {
|
|
5972
|
+
verticalVisibility: 5
|
|
5973
|
+
}
|
|
5974
|
+
}
|
|
5975
|
+
}]
|
|
5976
|
+
}
|
|
5977
|
+
}, {
|
|
5978
|
+
creationDate: upcomingValidDateStart,
|
|
5979
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
5980
|
+
taf: {
|
|
5981
|
+
uuid: '43545345345',
|
|
5982
|
+
issueDate: upcomingValidDateStart,
|
|
5983
|
+
baseTime: "".concat(currentDate, "T18:00:00Z"),
|
|
5984
|
+
validDateStart: "".concat(currentDate, "T18:00:00Z"),
|
|
5985
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5986
|
+
previousId: 'jkdjkdfjkgdf',
|
|
5987
|
+
previousValidDateStart: upcomingValidDateStart,
|
|
5988
|
+
previousValidDateEnd: upcomingValidDateEnd,
|
|
5989
|
+
location: 'EHLE',
|
|
5990
|
+
status: 'CORRECTED',
|
|
5991
|
+
type: 'NORMAL',
|
|
5992
|
+
messageType: 'COR',
|
|
5993
|
+
baseForecast: {
|
|
5994
|
+
valid: {
|
|
5995
|
+
start: upcomingValidDateStart,
|
|
5996
|
+
end: upcomingValidDateEnd
|
|
5997
|
+
},
|
|
5998
|
+
wind: {
|
|
5999
|
+
direction: 350,
|
|
6000
|
+
speed: 46,
|
|
6001
|
+
gust: 67,
|
|
6002
|
+
unit: 'KT'
|
|
6003
|
+
},
|
|
6004
|
+
cavOK: true
|
|
6005
|
+
},
|
|
6006
|
+
changeGroups: [{
|
|
6007
|
+
change: 'BECMG',
|
|
6008
|
+
valid: {
|
|
6009
|
+
start: dateAdd(upcomingValidDateStart, 1),
|
|
6010
|
+
end: dateAdd(upcomingValidDateStart, 2)
|
|
6011
|
+
},
|
|
6012
|
+
visibility: {
|
|
6013
|
+
range: 1000,
|
|
6014
|
+
unit: 'M'
|
|
6015
|
+
},
|
|
6016
|
+
weather: {
|
|
6017
|
+
weather1: 'MIFG'
|
|
6018
|
+
},
|
|
6019
|
+
cloud: {
|
|
6020
|
+
cloud1: 'NSC'
|
|
6021
|
+
}
|
|
6022
|
+
}, {
|
|
6023
|
+
change: 'FM',
|
|
6024
|
+
valid: {
|
|
6025
|
+
start: dateAdd(upcomingValidDateStart, 2)
|
|
6026
|
+
},
|
|
6027
|
+
visibility: {
|
|
6028
|
+
range: 6000,
|
|
6029
|
+
unit: 'M'
|
|
6030
|
+
},
|
|
6031
|
+
weather: {
|
|
6032
|
+
weather1: '+SHRA'
|
|
6033
|
+
},
|
|
6034
|
+
cloud: {
|
|
6035
|
+
cloud1: {
|
|
6036
|
+
coverage: 'BKN',
|
|
6037
|
+
height: 40
|
|
6038
|
+
},
|
|
6039
|
+
cloud2: {
|
|
6040
|
+
coverage: 'OVC',
|
|
6041
|
+
height: 60,
|
|
6042
|
+
type: 'CB'
|
|
6043
|
+
}
|
|
6044
|
+
}
|
|
6045
|
+
}]
|
|
6046
|
+
}
|
|
6047
|
+
}, {
|
|
6048
|
+
creationDate: upcomingValidDateStart,
|
|
6049
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
6050
|
+
taf: {
|
|
6051
|
+
uuid: '5f9583fjdf45ff4330f337925',
|
|
6052
|
+
issueDate: upcomingValidDateStart,
|
|
6053
|
+
baseTime: upcomingValidDateStart,
|
|
6054
|
+
validDateStart: upcomingValidDateStart,
|
|
6055
|
+
validDateEnd: upcomingValidDateEnd,
|
|
6056
|
+
location: 'EHGG',
|
|
6057
|
+
status: 'PUBLISHED',
|
|
6058
|
+
type: 'NORMAL',
|
|
6059
|
+
messageType: 'ORG',
|
|
6060
|
+
baseForecast: {
|
|
6061
|
+
valid: {
|
|
6062
|
+
start: upcomingValidDateEnd,
|
|
6063
|
+
end: upcomingValidDateEnd
|
|
6064
|
+
},
|
|
6065
|
+
visibility: {
|
|
6066
|
+
range: 600,
|
|
6067
|
+
unit: 'M'
|
|
6068
|
+
},
|
|
6069
|
+
wind: {
|
|
6070
|
+
direction: 180,
|
|
6071
|
+
speed: 10,
|
|
6072
|
+
unit: 'KT'
|
|
6073
|
+
},
|
|
6074
|
+
weather: {
|
|
6075
|
+
weather1: 'SN'
|
|
6076
|
+
},
|
|
6077
|
+
cloud: {
|
|
6078
|
+
cloud1: {
|
|
6079
|
+
coverage: 'BKN',
|
|
6080
|
+
height: 35
|
|
6081
|
+
}
|
|
6082
|
+
}
|
|
6083
|
+
},
|
|
6084
|
+
changeGroups: [{
|
|
6085
|
+
change: 'TEMPO',
|
|
6086
|
+
probability: 'PROB30',
|
|
6087
|
+
valid: {
|
|
6088
|
+
start: dateAdd(upcomingValidDateStart, 1),
|
|
6089
|
+
end: dateAdd(upcomingValidDateStart, 2)
|
|
6090
|
+
},
|
|
6091
|
+
visibility: {
|
|
6092
|
+
range: 200,
|
|
6093
|
+
unit: 'M'
|
|
6094
|
+
},
|
|
6095
|
+
cloud: {
|
|
6096
|
+
cloud1: {
|
|
6097
|
+
verticalVisibility: 5
|
|
6098
|
+
}
|
|
6099
|
+
}
|
|
6100
|
+
}]
|
|
6101
|
+
}
|
|
6102
|
+
}, {
|
|
6103
|
+
creationDate: upcomingValidDateStart,
|
|
6104
|
+
canbe: ['AMENDED'],
|
|
6105
|
+
taf: {
|
|
6106
|
+
uuid: '5464565464',
|
|
6107
|
+
previousId: '5445fghrfg3546456',
|
|
6108
|
+
issueDate: upcomingValidDateStart,
|
|
6109
|
+
baseTime: upcomingValidDateStart,
|
|
6110
|
+
validDateStart: upcomingValidDateStart,
|
|
6111
|
+
validDateEnd: upcomingValidDateEnd,
|
|
6112
|
+
previousValidDateStart: upcomingValidDateStart,
|
|
6113
|
+
previousValidDateEnd: upcomingValidDateEnd,
|
|
6114
|
+
location: 'EHBK',
|
|
6115
|
+
status: 'CANCELLED',
|
|
6116
|
+
type: 'NORMAL',
|
|
6117
|
+
messageType: 'CNL',
|
|
6118
|
+
baseForecast: {
|
|
6119
|
+
valid: {
|
|
6120
|
+
start: upcomingValidDateStart,
|
|
6121
|
+
end: upcomingValidDateEnd
|
|
6122
|
+
},
|
|
6123
|
+
visibility: {
|
|
6124
|
+
range: 600,
|
|
6125
|
+
unit: 'M'
|
|
6126
|
+
},
|
|
6127
|
+
wind: {
|
|
6128
|
+
direction: 180,
|
|
6129
|
+
speed: 10,
|
|
6130
|
+
unit: 'KT'
|
|
6131
|
+
},
|
|
6132
|
+
weather: {
|
|
6133
|
+
weather1: 'SN'
|
|
6134
|
+
},
|
|
6135
|
+
cloud: {
|
|
6136
|
+
cloud1: {
|
|
6137
|
+
coverage: 'BKN',
|
|
6138
|
+
height: 35
|
|
6139
|
+
}
|
|
6140
|
+
}
|
|
6141
|
+
}
|
|
6142
|
+
}
|
|
6143
|
+
}, {
|
|
6144
|
+
creationDate: upcomingValidDateStart,
|
|
6145
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
6146
|
+
taf: {
|
|
6147
|
+
uuid: 'gh56734fghfgh',
|
|
6148
|
+
previousId: '8574jnf93475',
|
|
6149
|
+
issueDate: "".concat(currentDate, "T16:16:00Z"),
|
|
6150
|
+
baseTime: upcomingValidDateStart,
|
|
6151
|
+
validDateStart: upcomingValidDateStart,
|
|
6152
|
+
validDateEnd: upcomingValidDateEnd,
|
|
6153
|
+
previousValidDateStart: upcomingValidDateStart,
|
|
6154
|
+
previousValidDateEnd: upcomingValidDateEnd,
|
|
6155
|
+
location: 'TNCB',
|
|
6156
|
+
status: 'AMENDED',
|
|
6157
|
+
type: 'NORMAL',
|
|
6158
|
+
messageType: 'AMD',
|
|
6159
|
+
baseForecast: {
|
|
6160
|
+
valid: {
|
|
6161
|
+
start: "".concat(currentDate, "T16:12:00Z"),
|
|
6162
|
+
end: upcomingValidDateEnd
|
|
6163
|
+
},
|
|
6164
|
+
visibility: {
|
|
6165
|
+
range: 600,
|
|
6166
|
+
unit: 'M'
|
|
6167
|
+
},
|
|
6168
|
+
wind: {
|
|
6169
|
+
direction: 180,
|
|
6170
|
+
speed: 10,
|
|
6171
|
+
unit: 'KT'
|
|
6172
|
+
},
|
|
6173
|
+
weather: {
|
|
6174
|
+
weather1: 'SN'
|
|
6175
|
+
},
|
|
6176
|
+
cloud: {
|
|
6177
|
+
cloud1: {
|
|
6178
|
+
coverage: 'BKN',
|
|
6179
|
+
height: 35
|
|
6180
|
+
}
|
|
6181
|
+
}
|
|
6182
|
+
}
|
|
6183
|
+
}
|
|
6184
|
+
}, {
|
|
6185
|
+
creationDate: currentValidDateStart,
|
|
6186
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
6187
|
+
taf: {
|
|
6188
|
+
uuid: 'giskdj09845872039',
|
|
6189
|
+
issueDate: currentValidDateStart,
|
|
6190
|
+
baseTime: currentValidDateStart,
|
|
6191
|
+
validDateStart: currentValidDateStart,
|
|
6192
|
+
validDateEnd: currentValidDateEnd,
|
|
6193
|
+
location: 'EHAM',
|
|
6194
|
+
status: 'PUBLISHED',
|
|
6195
|
+
type: 'NORMAL',
|
|
6196
|
+
messageType: 'ORG',
|
|
6197
|
+
baseForecast: {
|
|
6198
|
+
valid: {
|
|
6199
|
+
start: currentValidDateStart,
|
|
6200
|
+
end: currentValidDateEnd
|
|
6201
|
+
},
|
|
6202
|
+
visibility: {
|
|
6203
|
+
range: 500,
|
|
6204
|
+
unit: 'M'
|
|
6205
|
+
},
|
|
6206
|
+
wind: {
|
|
6207
|
+
direction: 200,
|
|
6208
|
+
speed: 20,
|
|
6209
|
+
gust: 35,
|
|
6210
|
+
unit: 'KT'
|
|
6211
|
+
},
|
|
6212
|
+
weather: {
|
|
6213
|
+
weather1: 'SN'
|
|
6214
|
+
},
|
|
6215
|
+
cloud: {
|
|
6216
|
+
cloud1: {
|
|
6217
|
+
coverage: 'BKN',
|
|
6218
|
+
height: 40
|
|
6219
|
+
}
|
|
6220
|
+
}
|
|
6221
|
+
}
|
|
6222
|
+
}
|
|
6223
|
+
}, {
|
|
6224
|
+
creationDate: currentValidDateStart,
|
|
6225
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6226
|
+
taf: {
|
|
6227
|
+
uuid: 'ghskdj09845872039',
|
|
6228
|
+
baseTime: currentValidDateStart,
|
|
6229
|
+
validDateStart: currentValidDateStart,
|
|
6230
|
+
validDateEnd: currentValidDateEnd,
|
|
6231
|
+
location: 'EHRD',
|
|
6232
|
+
status: 'NEW',
|
|
6233
|
+
type: 'NORMAL',
|
|
6234
|
+
messageType: 'ORG',
|
|
6235
|
+
baseForecast: {
|
|
6236
|
+
valid: {
|
|
6237
|
+
start: currentValidDateStart,
|
|
6238
|
+
end: currentValidDateEnd
|
|
6239
|
+
}
|
|
6240
|
+
}
|
|
6241
|
+
}
|
|
6242
|
+
}, {
|
|
6243
|
+
creationDate: currentValidDateStart,
|
|
6244
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6245
|
+
taf: {
|
|
6246
|
+
uuid: 'ghskdj09845872040',
|
|
6247
|
+
issueDate: currentValidDateStart,
|
|
6248
|
+
baseTime: currentValidDateStart,
|
|
6249
|
+
validDateStart: currentValidDateStart,
|
|
6250
|
+
validDateEnd: currentValidDateEnd,
|
|
6251
|
+
location: 'EHLE',
|
|
6252
|
+
status: 'NEW',
|
|
6253
|
+
type: 'NORMAL',
|
|
6254
|
+
messageType: 'ORG',
|
|
6255
|
+
baseForecast: {
|
|
6256
|
+
valid: {
|
|
6257
|
+
start: currentValidDateStart,
|
|
6258
|
+
end: currentValidDateEnd
|
|
6259
|
+
}
|
|
6260
|
+
}
|
|
6261
|
+
}
|
|
6262
|
+
}, {
|
|
6263
|
+
creationDate: "".concat(currentDate, "T06:00:00Z"),
|
|
6264
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6265
|
+
taf: {
|
|
6266
|
+
uuid: 'ghskdj09845872041',
|
|
6267
|
+
issueDate: currentValidDateStart,
|
|
6268
|
+
baseTime: currentValidDateStart,
|
|
6269
|
+
validDateStart: currentValidDateStart,
|
|
6270
|
+
validDateEnd: currentValidDateEnd,
|
|
6271
|
+
location: 'EHGG',
|
|
6272
|
+
status: 'NEW',
|
|
6273
|
+
type: 'NORMAL',
|
|
6274
|
+
messageType: 'ORG',
|
|
6275
|
+
baseForecast: {
|
|
6276
|
+
valid: {
|
|
6277
|
+
start: currentValidDateStart,
|
|
6278
|
+
end: currentValidDateEnd
|
|
6279
|
+
}
|
|
6280
|
+
}
|
|
6281
|
+
}
|
|
6282
|
+
}, {
|
|
6283
|
+
creationDate: "".concat(currentDate, "T06:00:00Z"),
|
|
6284
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6285
|
+
taf: {
|
|
6286
|
+
uuid: 'ghskdj09845872042',
|
|
6287
|
+
issueDate: currentValidDateStart,
|
|
6288
|
+
baseTime: currentValidDateStart,
|
|
6289
|
+
validDateStart: currentValidDateStart,
|
|
6290
|
+
validDateEnd: currentValidDateEnd,
|
|
6291
|
+
location: 'EHBK',
|
|
6292
|
+
status: 'NEW',
|
|
6293
|
+
type: 'NORMAL',
|
|
6294
|
+
messageType: 'ORG',
|
|
6295
|
+
baseForecast: {
|
|
6296
|
+
valid: {
|
|
6297
|
+
start: currentValidDateStart,
|
|
6298
|
+
end: currentValidDateEnd
|
|
6299
|
+
}
|
|
6300
|
+
}
|
|
6301
|
+
}
|
|
6302
|
+
}, {
|
|
6303
|
+
creationDate: "".concat(currentDate, "T06:00:00Z"),
|
|
6304
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6305
|
+
taf: {
|
|
6306
|
+
uuid: 'ghskdj09845872043',
|
|
6307
|
+
issueDate: currentValidDateStart,
|
|
6308
|
+
baseTime: currentValidDateStart,
|
|
6309
|
+
validDateStart: currentValidDateStart,
|
|
6310
|
+
validDateEnd: currentValidDateEnd,
|
|
6311
|
+
location: 'TNCB',
|
|
6312
|
+
status: 'NEW',
|
|
6313
|
+
type: 'NORMAL',
|
|
6314
|
+
messageType: 'ORG',
|
|
6315
|
+
baseForecast: {
|
|
6316
|
+
valid: {
|
|
6317
|
+
start: currentValidDateStart,
|
|
6318
|
+
end: currentValidDateEnd
|
|
6319
|
+
}
|
|
6320
|
+
}
|
|
6321
|
+
}
|
|
6322
|
+
}, {
|
|
6323
|
+
creationDate: expiredValidDateStart,
|
|
6324
|
+
canbe: [],
|
|
6325
|
+
taf: {
|
|
6326
|
+
uuid: 'sdkjhsdf90845890',
|
|
6327
|
+
issueDate: expiredValidDateStart,
|
|
6328
|
+
baseTime: expiredValidDateStart,
|
|
6329
|
+
validDateStart: expiredValidDateStart,
|
|
6330
|
+
validDateEnd: expiredValidDateEnd,
|
|
6331
|
+
location: 'EHAM',
|
|
6332
|
+
status: 'EXPIRED',
|
|
6333
|
+
type: 'NORMAL',
|
|
6334
|
+
messageType: 'ORG',
|
|
6335
|
+
baseForecast: {
|
|
6336
|
+
valid: {
|
|
6337
|
+
start: expiredValidDateStart,
|
|
6338
|
+
end: expiredValidDateEnd
|
|
6339
|
+
},
|
|
6340
|
+
cavOK: true,
|
|
6341
|
+
wind: {
|
|
6342
|
+
direction: 50,
|
|
6343
|
+
speed: 5,
|
|
6344
|
+
unit: 'KT'
|
|
6345
|
+
}
|
|
6346
|
+
},
|
|
6347
|
+
changeGroups: [{
|
|
6348
|
+
change: 'BECMG',
|
|
6349
|
+
valid: {
|
|
6350
|
+
start: dateAdd(expiredValidDateStart, 1),
|
|
6351
|
+
end: dateAdd(expiredValidDateStart, 4)
|
|
6352
|
+
},
|
|
6353
|
+
visibility: {
|
|
6354
|
+
range: 1000,
|
|
6355
|
+
unit: 'M'
|
|
6356
|
+
},
|
|
6357
|
+
weather: {
|
|
6358
|
+
weather1: 'MIFG'
|
|
6359
|
+
}
|
|
6360
|
+
}, {
|
|
6361
|
+
change: 'FM',
|
|
6362
|
+
valid: {
|
|
6363
|
+
start: dateAdd(expiredValidDateStart, 5)
|
|
6364
|
+
},
|
|
6365
|
+
visibility: {
|
|
6366
|
+
range: 6000,
|
|
6367
|
+
unit: 'M'
|
|
6368
|
+
},
|
|
6369
|
+
weather: {
|
|
6370
|
+
weather1: '+SHRA'
|
|
6371
|
+
},
|
|
6372
|
+
cloud: {
|
|
6373
|
+
cloud1: {
|
|
6374
|
+
coverage: 'BKN',
|
|
6375
|
+
height: 40
|
|
6376
|
+
},
|
|
6377
|
+
cloud2: {
|
|
6378
|
+
coverage: 'OVC',
|
|
6379
|
+
height: 60,
|
|
6380
|
+
type: 'CB'
|
|
6381
|
+
}
|
|
6382
|
+
}
|
|
6383
|
+
}]
|
|
6384
|
+
}
|
|
6385
|
+
}];
|
|
6386
|
+
var fakeNewTaf = {
|
|
6387
|
+
creationDate: "".concat(currentDate, "T12:00:00Z"),
|
|
6388
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6389
|
+
taf: {
|
|
6390
|
+
type: 'NORMAL',
|
|
6391
|
+
messageType: 'ORG',
|
|
6392
|
+
status: 'NEW',
|
|
6393
|
+
uuid: '5f9583fjdf0445332f337925',
|
|
6394
|
+
baseTime: "".concat(currentDate, "T12:00:00Z"),
|
|
6395
|
+
validDateStart: "".concat(currentDate, "T12:00:00Z"),
|
|
6396
|
+
validDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6397
|
+
location: 'EHBK',
|
|
6398
|
+
baseForecast: {
|
|
6399
|
+
valid: {
|
|
6400
|
+
start: "".concat(currentDate, "T12:00:00Z"),
|
|
6401
|
+
end: "".concat(tomorrowDate, "T18:00:00Z")
|
|
6402
|
+
}
|
|
6403
|
+
}
|
|
6404
|
+
}
|
|
6405
|
+
};
|
|
6406
|
+
({
|
|
6407
|
+
creationDate: "2022-01-06T12:00:00Z",
|
|
6408
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6409
|
+
taf: Object.assign(Object.assign({}, fakeNewTaf.taf), {
|
|
6410
|
+
baseTime: "2022-01-06T12:00:00Z",
|
|
6411
|
+
validDateStart: "2022-01-06T12:00:00Z",
|
|
6412
|
+
validDateEnd: "2022-01-07T18:00:00Z",
|
|
6413
|
+
baseForecast: {
|
|
6414
|
+
valid: {
|
|
6415
|
+
start: "2022-01-06T12:00:00Z",
|
|
6416
|
+
end: "2022-01-07T18:00:00Z"
|
|
6417
|
+
}
|
|
6418
|
+
}
|
|
6419
|
+
})
|
|
6420
|
+
});
|
|
6421
|
+
var fakePublishedTaf = {
|
|
6422
|
+
creationDate: "".concat(currentDate, "T12:00:00Z"),
|
|
6423
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
6424
|
+
taf: {
|
|
6425
|
+
uuid: 'slsdkjg-023895',
|
|
6426
|
+
issueDate: "".concat(currentDate, "T12:00:00Z"),
|
|
6427
|
+
baseTime: "".concat(currentDate, "T12:00:00Z"),
|
|
6428
|
+
validDateStart: "".concat(currentDate, "T12:00:00Z"),
|
|
6429
|
+
validDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6430
|
+
location: 'EHLE',
|
|
6431
|
+
status: 'PUBLISHED',
|
|
6432
|
+
type: 'NORMAL',
|
|
6433
|
+
messageType: 'ORG',
|
|
6434
|
+
baseForecast: {
|
|
6435
|
+
valid: {
|
|
6436
|
+
start: "".concat(currentDate, "T12:00:00Z"),
|
|
6437
|
+
end: "".concat(tomorrowDate, "T18:00:00Z")
|
|
6438
|
+
},
|
|
6439
|
+
wind: {
|
|
6440
|
+
direction: 50,
|
|
6441
|
+
speed: 5,
|
|
6442
|
+
unit: 'KT'
|
|
6443
|
+
},
|
|
6444
|
+
cavOK: true
|
|
6445
|
+
},
|
|
6446
|
+
changeGroups: [{
|
|
6447
|
+
change: 'FM',
|
|
6448
|
+
valid: {
|
|
6449
|
+
start: "".concat(currentDate, "T12:00:00Z")
|
|
6450
|
+
},
|
|
6451
|
+
visibility: {
|
|
6452
|
+
range: 6000,
|
|
6453
|
+
unit: 'M'
|
|
6454
|
+
},
|
|
6455
|
+
weather: {
|
|
6456
|
+
weather1: '+SHRA'
|
|
6457
|
+
},
|
|
6458
|
+
wind: {
|
|
6459
|
+
direction: 10,
|
|
6460
|
+
speed: 10,
|
|
6461
|
+
unit: 'KT',
|
|
6462
|
+
gust: 35
|
|
6463
|
+
},
|
|
6464
|
+
cloud: {
|
|
6465
|
+
cloud1: {
|
|
6466
|
+
coverage: 'BKN',
|
|
6467
|
+
height: 40
|
|
6468
|
+
},
|
|
6469
|
+
cloud2: {
|
|
6470
|
+
coverage: 'OVC',
|
|
6471
|
+
height: 60,
|
|
6472
|
+
type: 'CB'
|
|
6473
|
+
}
|
|
6474
|
+
}
|
|
6475
|
+
}, {
|
|
6476
|
+
change: 'BECMG',
|
|
6477
|
+
valid: {
|
|
6478
|
+
start: "".concat(currentDate, "T23:00:00Z"),
|
|
6479
|
+
end: "".concat(tomorrowDate, "T01:00:00Z")
|
|
6480
|
+
},
|
|
6481
|
+
wind: {
|
|
6482
|
+
direction: 150,
|
|
6483
|
+
speed: 5,
|
|
6484
|
+
unit: 'KT'
|
|
6485
|
+
},
|
|
6486
|
+
visibility: {
|
|
6487
|
+
range: 1000,
|
|
6488
|
+
unit: 'M'
|
|
6489
|
+
},
|
|
6490
|
+
weather: {
|
|
6491
|
+
weather1: 'MIFG'
|
|
6492
|
+
}
|
|
6493
|
+
}]
|
|
6494
|
+
}
|
|
6495
|
+
};
|
|
6496
|
+
({
|
|
6497
|
+
creationDate: "2022-01-06T12:00:00Z",
|
|
6498
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
6499
|
+
taf: Object.assign(Object.assign({}, fakePublishedTaf.taf), {
|
|
6500
|
+
location: 'EHGG',
|
|
6501
|
+
baseTime: "2022-01-06T12:00:00Z",
|
|
6502
|
+
issueDate: "2022-01-06T12:00:00Z",
|
|
6503
|
+
validDateStart: "2022-01-06T12:00:00Z",
|
|
6504
|
+
validDateEnd: "2022-01-07T18:00:00Z",
|
|
6505
|
+
baseForecast: Object.assign(Object.assign({}, fakePublishedTaf.taf.baseForecast), {
|
|
6506
|
+
valid: {
|
|
6507
|
+
start: "2022-01-06T12:00:00Z",
|
|
6508
|
+
end: "2022-01-07T18:00:00Z"
|
|
6509
|
+
}
|
|
6510
|
+
}),
|
|
6511
|
+
changeGroups: [{
|
|
6512
|
+
change: 'FM',
|
|
6513
|
+
valid: {
|
|
6514
|
+
start: "2022-01-06T12:00:00Z"
|
|
6515
|
+
},
|
|
6516
|
+
visibility: {
|
|
6517
|
+
range: 6000,
|
|
6518
|
+
unit: 'M'
|
|
6519
|
+
},
|
|
6520
|
+
weather: {
|
|
6521
|
+
weather1: '+SHRA'
|
|
6522
|
+
},
|
|
6523
|
+
wind: {
|
|
6524
|
+
direction: 10,
|
|
6525
|
+
speed: 10,
|
|
6526
|
+
unit: 'KT',
|
|
6527
|
+
gust: 35
|
|
6528
|
+
},
|
|
6529
|
+
cloud: {
|
|
6530
|
+
cloud1: {
|
|
6531
|
+
coverage: 'BKN',
|
|
6532
|
+
height: 40
|
|
6533
|
+
},
|
|
6534
|
+
cloud2: {
|
|
6535
|
+
coverage: 'OVC',
|
|
6536
|
+
height: 60,
|
|
6537
|
+
type: 'CB'
|
|
6538
|
+
}
|
|
6539
|
+
}
|
|
6540
|
+
}, {
|
|
6541
|
+
change: 'BECMG',
|
|
6542
|
+
valid: {
|
|
6543
|
+
start: "2022-01-06T23:00:00Z",
|
|
6544
|
+
end: "2022-01-07T00:00:00Z"
|
|
6545
|
+
},
|
|
6546
|
+
wind: {
|
|
6547
|
+
direction: 150,
|
|
6548
|
+
speed: 5,
|
|
6549
|
+
unit: 'KT'
|
|
6550
|
+
},
|
|
6551
|
+
visibility: {
|
|
6552
|
+
range: 1000,
|
|
6553
|
+
unit: 'M'
|
|
6554
|
+
},
|
|
6555
|
+
weather: {
|
|
6556
|
+
weather1: 'MIFG'
|
|
6557
|
+
}
|
|
6558
|
+
}]
|
|
6559
|
+
})
|
|
6560
|
+
});
|
|
6561
|
+
var fakeDraftTaf = {
|
|
6562
|
+
creationDate: "".concat(currentDate, "T18:00:00Z"),
|
|
6563
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6564
|
+
taf: {
|
|
6565
|
+
uuid: '5f9583fjdf0f337925',
|
|
6566
|
+
baseTime: "".concat(currentDate, "T18:00:00Z"),
|
|
6567
|
+
validDateStart: "".concat(currentDate, "T18:00:00Z"),
|
|
6568
|
+
validDateEnd: "".concat(tomorrowDate, "T23:59:00Z"),
|
|
6569
|
+
location: 'EHLE',
|
|
6570
|
+
status: 'DRAFT',
|
|
6571
|
+
type: 'NORMAL',
|
|
6572
|
+
messageType: 'ORG',
|
|
6573
|
+
baseForecast: {
|
|
6574
|
+
valid: {
|
|
6575
|
+
start: "".concat(currentDate, "T18:00:00Z"),
|
|
6576
|
+
end: "".concat(tomorrowDate, "T23:59:00Z")
|
|
6577
|
+
},
|
|
6578
|
+
wind: {
|
|
6579
|
+
direction: 150,
|
|
6580
|
+
speed: 5,
|
|
6581
|
+
unit: 'KT'
|
|
6582
|
+
},
|
|
6583
|
+
visibility: {
|
|
6584
|
+
range: 1000,
|
|
6585
|
+
unit: 'M'
|
|
6586
|
+
},
|
|
6587
|
+
weather: {
|
|
6588
|
+
weather1: 'BCFG'
|
|
6589
|
+
},
|
|
6590
|
+
cloud: {
|
|
6591
|
+
cloud1: {
|
|
6592
|
+
coverage: 'FEW',
|
|
6593
|
+
height: 15
|
|
6594
|
+
}
|
|
6595
|
+
}
|
|
6596
|
+
}
|
|
6597
|
+
}
|
|
6598
|
+
};
|
|
6599
|
+
({
|
|
6600
|
+
creationDate: "2022-01-06T18:00:00Z",
|
|
6601
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6602
|
+
taf: Object.assign(Object.assign({}, fakeDraftTaf.taf), {
|
|
6603
|
+
baseTime: "2022-01-06T18:00:00Z",
|
|
6604
|
+
validDateStart: "2022-01-06T18:00:00Z",
|
|
6605
|
+
validDateEnd: "2022-01-07T23:59:00Z",
|
|
6606
|
+
baseForecast: Object.assign(Object.assign({}, fakeDraftTaf.taf.baseForecast), {
|
|
6607
|
+
valid: {
|
|
6608
|
+
start: "2022-01-06T18:00:00Z",
|
|
6609
|
+
end: "2022-01-07T23:59:00Z"
|
|
6610
|
+
}
|
|
6611
|
+
})
|
|
6612
|
+
})
|
|
6613
|
+
});
|
|
6614
|
+
var fakeDraftAmendmentTaf = {
|
|
6615
|
+
creationDate: "".concat(currentDate, "T14:00:00Z"),
|
|
6616
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6617
|
+
taf: {
|
|
6618
|
+
uuid: '954905487',
|
|
6619
|
+
previousId: '5f9583fjdf45ff4330f337925',
|
|
6620
|
+
issueDate: "".concat(currentDate, "T14:00:00Z"),
|
|
6621
|
+
baseTime: "".concat(currentDate, "T12:00:00Z"),
|
|
6622
|
+
validDateStart: "".concat(currentDate, "T14:00:00Z"),
|
|
6623
|
+
validDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6624
|
+
previousValidDateStart: "".concat(currentDate, "T12:00:00Z"),
|
|
6625
|
+
previousValidDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6626
|
+
location: 'EHAM',
|
|
6627
|
+
status: 'DRAFT_AMENDED',
|
|
6628
|
+
type: 'NORMAL',
|
|
6629
|
+
messageType: 'AMD',
|
|
6630
|
+
baseForecast: {
|
|
6631
|
+
valid: {
|
|
6632
|
+
start: "".concat(currentDate, "T14:00:00Z"),
|
|
6633
|
+
end: "".concat(tomorrowDate, "T18:00:00Z")
|
|
6634
|
+
},
|
|
6635
|
+
visibility: {
|
|
6636
|
+
range: 600,
|
|
6637
|
+
unit: 'M'
|
|
6638
|
+
},
|
|
6639
|
+
wind: {
|
|
6640
|
+
direction: 180,
|
|
6641
|
+
speed: 10,
|
|
6642
|
+
unit: 'KT'
|
|
6643
|
+
},
|
|
6644
|
+
weather: {
|
|
6645
|
+
weather1: 'SN'
|
|
6646
|
+
},
|
|
6647
|
+
cloud: {
|
|
6648
|
+
cloud1: {
|
|
6649
|
+
coverage: 'BKN',
|
|
6650
|
+
height: 35
|
|
6651
|
+
}
|
|
6652
|
+
}
|
|
6653
|
+
},
|
|
6654
|
+
changeGroups: [{
|
|
6655
|
+
change: 'TEMPO',
|
|
6656
|
+
probability: 'PROB30',
|
|
6657
|
+
valid: {
|
|
6658
|
+
start: "".concat(currentDate, "T15:00:00Z"),
|
|
6659
|
+
end: "".concat(currentDate, "T16:00:00Z")
|
|
6660
|
+
},
|
|
6661
|
+
visibility: {
|
|
6662
|
+
range: 100,
|
|
6663
|
+
unit: 'M'
|
|
6664
|
+
},
|
|
6665
|
+
cloud: {
|
|
6666
|
+
cloud1: {
|
|
6667
|
+
verticalVisibility: 5
|
|
6668
|
+
}
|
|
6669
|
+
}
|
|
6670
|
+
}]
|
|
6671
|
+
}
|
|
6672
|
+
};
|
|
6673
|
+
|
|
6674
|
+
({
|
|
6675
|
+
creationDate: "2022-01-06T14:00:00Z",
|
|
6676
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6677
|
+
taf: Object.assign(Object.assign({}, fakeDraftAmendmentTaf.taf), {
|
|
6678
|
+
location: 'EHRD',
|
|
6679
|
+
issueDate: "2022-01-06T14:00:00Z",
|
|
6680
|
+
baseTime: "2022-01-06T12:00:00Z",
|
|
6681
|
+
validDateStart: "2022-01-06T14:00:00Z",
|
|
6682
|
+
validDateEnd: "2022-01-07T18:00:00Z",
|
|
6683
|
+
previousValidDateStart: "2022-01-06T12:00:00Z",
|
|
6684
|
+
previousValidDateEnd: "2022-01-07T18:00:00Z",
|
|
6685
|
+
baseForecast: Object.assign(Object.assign({}, fakeDraftAmendmentTaf.taf.baseForecast), {
|
|
6686
|
+
valid: {
|
|
6687
|
+
start: "2022-01-06T14:00:00Z",
|
|
6688
|
+
end: "2022-01-07T18:00:00Z"
|
|
6689
|
+
}
|
|
6690
|
+
}),
|
|
6691
|
+
changeGroups: []
|
|
6692
|
+
})
|
|
6693
|
+
});
|
|
6694
|
+
var fakeAmendmentTaf = {
|
|
6695
|
+
creationDate: "".concat(currentDate, "T14:00:00Z"),
|
|
6696
|
+
canbe: ['CANCELLED', 'CORRECTED', 'AMENDED'],
|
|
6697
|
+
taf: {
|
|
6698
|
+
uuid: '754905486',
|
|
6699
|
+
previousId: '5f9583fjdf45ff4330f337925',
|
|
6700
|
+
issueDate: "".concat(currentDate, "T14:00:00Z"),
|
|
6701
|
+
baseTime: "".concat(currentDate, "T12:00:00Z"),
|
|
6702
|
+
validDateStart: "".concat(currentDate, "T14:00:00Z"),
|
|
6703
|
+
validDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6704
|
+
previousValidDateStart: "".concat(currentDate, "T12:00:00Z"),
|
|
6705
|
+
previousValidDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6706
|
+
location: 'EHAM',
|
|
6707
|
+
status: 'AMENDED',
|
|
6708
|
+
type: 'NORMAL',
|
|
6709
|
+
messageType: 'AMD',
|
|
6710
|
+
baseForecast: {
|
|
6711
|
+
valid: {
|
|
6712
|
+
start: "".concat(currentDate, "T14:00:00Z"),
|
|
6713
|
+
end: "".concat(tomorrowDate, "T18:00:00Z")
|
|
6714
|
+
},
|
|
6715
|
+
visibility: {
|
|
6716
|
+
range: 600,
|
|
6717
|
+
unit: 'M'
|
|
6718
|
+
},
|
|
6719
|
+
wind: {
|
|
6720
|
+
direction: 180,
|
|
6721
|
+
speed: 10,
|
|
6722
|
+
unit: 'KT'
|
|
6723
|
+
},
|
|
6724
|
+
weather: {
|
|
6725
|
+
weather1: 'SN'
|
|
6726
|
+
},
|
|
6727
|
+
cloud: {
|
|
6728
|
+
cloud1: {
|
|
6729
|
+
coverage: 'BKN',
|
|
6730
|
+
height: 35
|
|
6731
|
+
}
|
|
6732
|
+
}
|
|
6733
|
+
}
|
|
6734
|
+
}
|
|
6735
|
+
};
|
|
6736
|
+
|
|
6737
|
+
({
|
|
6738
|
+
creationDate: "2022-01-06T14:00:00Z",
|
|
6739
|
+
canbe: ['CANCELLED', 'CORRECTED', 'AMENDED'],
|
|
6740
|
+
taf: Object.assign(Object.assign({}, fakeAmendmentTaf.taf), {
|
|
6741
|
+
uuid: '7549058980',
|
|
6742
|
+
issueDate: "2022-01-06T14:00:00Z",
|
|
6743
|
+
baseTime: "2022-01-06T12:00:00Z",
|
|
6744
|
+
validDateStart: "2022-01-06T14:00:00Z",
|
|
6745
|
+
validDateEnd: "2022-01-07T18:00:00Z",
|
|
6746
|
+
previousValidDateStart: "2022-01-06T12:00:00Z",
|
|
6747
|
+
previousValidDateEnd: "2022-01-07T18:00:00Z",
|
|
6748
|
+
baseForecast: Object.assign(Object.assign({}, fakeAmendmentTaf.taf.baseForecast), {
|
|
6749
|
+
valid: {
|
|
6750
|
+
start: "2022-01-06T14:00:00Z",
|
|
6751
|
+
end: "2022-01-07T18:00:00Z"
|
|
6752
|
+
}
|
|
6753
|
+
})
|
|
6754
|
+
})
|
|
6755
|
+
});
|
|
6756
|
+
|
|
6757
|
+
var fakeTafTac = 'TAF EHAM 0812/0918 20020G35KT 0500 SN BKN040\nBECMG 0814/0816 0700 BKN001=';
|
|
6758
|
+
|
|
6759
|
+
var fakePromise = function fakePromise(withRandomError) {
|
|
6760
|
+
return new Promise(function (resolve, reject) {
|
|
6761
|
+
setTimeout(function () {
|
|
6762
|
+
if (!withRandomError) return resolve();
|
|
6763
|
+
var randomError = Math.floor(Math.random() * 4) + 1;
|
|
6764
|
+
return randomError === 4 ? reject(new Error('something went wrong')) : resolve();
|
|
6765
|
+
}, 300);
|
|
6766
|
+
});
|
|
6767
|
+
};
|
|
6768
|
+
|
|
6769
|
+
var fakeAxiosInstance = {
|
|
6770
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars, @typescript-eslint/explicit-module-boundary-types
|
|
6771
|
+
get: function get(_url, _params) {
|
|
6772
|
+
return fakePromise(false);
|
|
6773
|
+
},
|
|
6774
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars, @typescript-eslint/explicit-module-boundary-types
|
|
6775
|
+
post: function post(_url, _params) {
|
|
6776
|
+
return fakePromise(false);
|
|
6777
|
+
}
|
|
6778
|
+
};
|
|
6779
|
+
var createApi = function createApi() {
|
|
6780
|
+
return {
|
|
6781
|
+
getTafList: function getTafList() {
|
|
6782
|
+
// eslint-disable-next-line no-console
|
|
6783
|
+
console.log('Retrieving new TAF list');
|
|
6784
|
+
return fakeAxiosInstance.get('/taflist').then(function () {
|
|
6785
|
+
return {
|
|
6786
|
+
data: _toConsumableArray(fakeTafList)
|
|
6787
|
+
};
|
|
6788
|
+
});
|
|
6789
|
+
},
|
|
6790
|
+
getTAC: function getTAC() {
|
|
6791
|
+
// eslint-disable-next-line no-console
|
|
6792
|
+
return fakeAxiosInstance.post('/taf2tac').then(function () {
|
|
6793
|
+
return {
|
|
6794
|
+
data: fakeTafTac
|
|
6795
|
+
};
|
|
6796
|
+
});
|
|
6797
|
+
},
|
|
6798
|
+
postTaf: function postTaf(_postTaf) {
|
|
6799
|
+
// eslint-disable-next-line no-console
|
|
6800
|
+
console.log("The new status of the taf will be ".concat(_postTaf.changeStatusTo)); // eslint-disable-next-line no-console
|
|
6801
|
+
|
|
6802
|
+
console.log('form has been posted with following values:', _postTaf.taf);
|
|
6803
|
+
return fakeAxiosInstance.post('/taf', _postTaf);
|
|
6804
|
+
}
|
|
6805
|
+
};
|
|
6806
|
+
};
|
|
6807
|
+
|
|
6808
|
+
export { TafForm, Wrapper as TafModule, createApi$1 as createApi, createApi as createFakeApi };
|