@opengeoweb/taf 2.4.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +2 -0
- package/index.esm.js +1945 -415
- package/index.umd.js +1962 -433
- package/lib/components/ComponentsLookUp/ComponentsLookUp.d.ts +34 -0
- package/lib/components/{TafForm/TafFormWrapper.spec.d.ts → ComponentsLookUp/ComponentsLookUp.spec.d.ts} +0 -0
- package/lib/components/ComponentsLookUp/index.d.ts +1 -0
- package/lib/components/IssuesPane/IssuesButton.d.ts +3 -6
- package/lib/components/IssuesPane/IssuesPane.d.ts +7 -9
- package/lib/components/IssuesPane/IssuesPaneWrapper.d.ts +4 -0
- package/lib/components/IssuesPane/IssuesPaneWrapper.spec.d.ts +1 -0
- package/lib/components/IssuesPane/types.d.ts +11 -0
- package/lib/components/IssuesPane/utils.d.ts +10 -0
- package/lib/components/IssuesPane/utils.spec.d.ts +1 -0
- package/lib/components/TafForm/TafForm.d.ts +5 -3
- package/lib/components/TafForm/TafForm.spec.d.ts +1 -0
- package/lib/components/TafForm/TafForm.statusChanges.spec.d.ts +1 -0
- package/lib/components/TafForm/{TafFormWrapper.stories.d.ts → TafForm.stories.d.ts} +0 -0
- package/lib/components/TafForm/TafFormButtons/TafFormButtons.d.ts +1 -0
- package/lib/components/TafForm/index.d.ts +1 -1
- package/lib/components/TafForm/utils.d.ts +20 -1
- package/lib/components/TafLayout/TacOverview/ExportButton.d.ts +7 -0
- package/lib/components/TafLayout/TacOverview/ExportButton.spec.d.ts +1 -0
- package/lib/components/TafLayout/TacOverview/TacContainer.d.ts +1 -0
- package/lib/components/TafLayout/TacOverview/TacOverview.d.ts +1 -0
- package/lib/components/TafLayout/TafLayout.d.ts +5 -0
- package/lib/components/TafLayout/TafLayout.stories.d.ts +10 -2
- package/lib/components/TafLayout/TafPanel/TafPanel.d.ts +23 -2
- package/lib/components/TafLayout/TopTabs/TopTabs.d.ts +0 -2
- package/lib/components/TafLayout/utils.d.ts +2 -1
- package/lib/components/TafModule/TafModule.d.ts +2 -1
- package/lib/components/TafModule/TafModule.stories.d.ts +1 -0
- package/lib/components/TafModule/TafModuleProvider.d.ts +29 -0
- package/lib/components/TafWrapper/TafWrapper.d.ts +4 -0
- package/lib/components/TafWrapper/TafWrapper.spec.d.ts +1 -0
- package/lib/components/TafWrapper/index.d.ts +1 -0
- package/lib/types.d.ts +0 -1
- package/lib/utils/mockdata/fakeTafList.d.ts +8 -3
- package/lib/utils/testUtils.d.ts +6 -0
- package/package.json +7 -7
- package/lib/components/Providers/Providers.d.ts +0 -11
- package/lib/components/TafForm/TafFormWrapper.d.ts +0 -11
package/index.esm.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import React__default from 'react';
|
|
3
|
-
import {
|
|
4
|
-
import { TextField, SvgIcon, Grid, Box, Button, IconButton, Typography, Tooltip, Chip, useTheme, Card, Tabs, Tab, Dialog, MenuList, MenuItem, Backdrop, CircularProgress } from '@mui/material';
|
|
3
|
+
import { TextField, SvgIcon, Grid, Box, Button, IconButton, Tooltip, Chip, Typography, createSvgIcon, Card, Tabs, Tab, Dialog, MenuList, MenuItem, Backdrop, CircularProgress } from '@mui/material';
|
|
5
4
|
import { useFormContext, Controller, useFieldArray } from 'react-hook-form';
|
|
6
5
|
import { ReactSortable, Sortable } from 'react-sortablejs';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
6
|
+
import { getDeepProperty, ReactHookFormHiddenInput, ReactHookFormProvider } from '@opengeoweb/form-fields';
|
|
7
|
+
import { useApiContext, useApi, createApiInstance, ApiProvider } from '@opengeoweb/api';
|
|
8
|
+
import { useIsMounted, ToggleMenu, useDraftFormHelpers, ToolContainerDraggable, useConfirmationDialog, usePreventBrowserClose, ToolButton, ToolHeader, getAxiosErrorMessage, AlertBanner, ConfirmationServiceProvider, usePoller, ErrorBoundary } from '@opengeoweb/shared';
|
|
9
9
|
import moment from 'moment';
|
|
10
10
|
import { isEqual } from 'lodash';
|
|
11
11
|
import makeStyles from '@mui/styles/makeStyles';
|
|
@@ -1994,6 +1994,22 @@ var validateFourthCloud = function validateFourthCloud(firstCloudValue, secondCl
|
|
|
1994
1994
|
return true;
|
|
1995
1995
|
};
|
|
1996
1996
|
|
|
1997
|
+
var emptyBaseForecast = {
|
|
1998
|
+
wind: '',
|
|
1999
|
+
visibility: '',
|
|
2000
|
+
weather: {
|
|
2001
|
+
weather1: '',
|
|
2002
|
+
weather2: '',
|
|
2003
|
+
weather3: ''
|
|
2004
|
+
},
|
|
2005
|
+
cloud: {
|
|
2006
|
+
cloud1: '',
|
|
2007
|
+
cloud2: '',
|
|
2008
|
+
cloud3: '',
|
|
2009
|
+
cloud4: ''
|
|
2010
|
+
}
|
|
2011
|
+
}; // formatters
|
|
2012
|
+
|
|
1997
2013
|
var formatIssueTime = function formatIssueTime(issueDate) {
|
|
1998
2014
|
return issueDate ? "".concat(moment(issueDate).utc().format('DDHHmm'), "Z") : 'Not issued';
|
|
1999
2015
|
};
|
|
@@ -2216,8 +2232,9 @@ var convertTafValuesToObject = function convertTafValuesToObject(formData) {
|
|
|
2216
2232
|
.filter(function (value) {
|
|
2217
2233
|
return Object.keys(value).length;
|
|
2218
2234
|
});
|
|
2235
|
+
var parsedBaseForecast = productToPost.baseForecast && parseFormValues(productToPost.baseForecast, tafStart, tafEnd);
|
|
2219
2236
|
var parsedFormValues = Object.assign(Object.assign({}, productToPost), {
|
|
2220
|
-
baseForecast:
|
|
2237
|
+
baseForecast: parsedBaseForecast,
|
|
2221
2238
|
changeGroups: parsedChangeGroups
|
|
2222
2239
|
});
|
|
2223
2240
|
return Object.keys(parsedFormValues).reduce(function (list, key) {
|
|
@@ -2293,9 +2310,11 @@ var getFieldNames = function getFieldNames(isChangeGroup, index) {
|
|
|
2293
2310
|
var TAC_MISSING_DATA = 'Missing data: no TAC can be generated';
|
|
2294
2311
|
var TAC_NOT_AVAILABLE = 'No TAC available';
|
|
2295
2312
|
var TAC_RETRIEVING_DATA = 'Retrieving TAC';
|
|
2313
|
+
var TAC_FAILED = 'Failed to retrieve TAC';
|
|
2314
|
+
var tacHasError = function tacHasError(tac) {
|
|
2315
|
+
return tac === TAC_MISSING_DATA || tac === TAC_NOT_AVAILABLE || tac === TAC_RETRIEVING_DATA || tac === TAC_FAILED;
|
|
2316
|
+
};
|
|
2296
2317
|
var useTACGenerator = function useTACGenerator(taf, requestTAC) {
|
|
2297
|
-
var standardTAC = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
|
|
2298
|
-
|
|
2299
2318
|
var _React$useState = React__default.useState(taf.status === 'NEW' ? TAC_NOT_AVAILABLE : TAC_RETRIEVING_DATA),
|
|
2300
2319
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2301
2320
|
TAC = _React$useState2[0],
|
|
@@ -2304,7 +2323,7 @@ var useTACGenerator = function useTACGenerator(taf, requestTAC) {
|
|
|
2304
2323
|
var _useIsMounted = useIsMounted(),
|
|
2305
2324
|
isMounted = _useIsMounted.isMounted;
|
|
2306
2325
|
|
|
2307
|
-
var retrieveTAC = function
|
|
2326
|
+
var retrieveTAC = React__default.useCallback(function (tafToPost) {
|
|
2308
2327
|
if (shouldRetrieveTAC(tafToPost)) {
|
|
2309
2328
|
requestTAC(tafToPost).then(function (result) {
|
|
2310
2329
|
if (isMounted.current) {
|
|
@@ -2312,25 +2331,19 @@ var useTACGenerator = function useTACGenerator(taf, requestTAC) {
|
|
|
2312
2331
|
}
|
|
2313
2332
|
})["catch"](function () {
|
|
2314
2333
|
if (isMounted.current) {
|
|
2315
|
-
setTAC(
|
|
2334
|
+
setTAC(TAC_FAILED);
|
|
2316
2335
|
}
|
|
2317
2336
|
});
|
|
2318
2337
|
} else {
|
|
2319
2338
|
setTAC(TAC_MISSING_DATA);
|
|
2320
2339
|
}
|
|
2321
|
-
};
|
|
2322
|
-
|
|
2340
|
+
}, [isMounted, requestTAC]);
|
|
2323
2341
|
React__default.useEffect(function () {
|
|
2324
|
-
if (taf.status !== 'NEW'
|
|
2342
|
+
if (taf.status !== 'NEW') {
|
|
2325
2343
|
retrieveTAC(taf);
|
|
2326
2344
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2327
2345
|
|
|
2328
2346
|
}, []);
|
|
2329
|
-
React__default.useEffect(function () {
|
|
2330
|
-
if (standardTAC !== '') {
|
|
2331
|
-
setTAC(standardTAC);
|
|
2332
|
-
}
|
|
2333
|
-
}, [standardTAC]);
|
|
2334
2347
|
return [TAC, retrieveTAC];
|
|
2335
2348
|
};
|
|
2336
2349
|
var useDragOrder = function useDragOrder(trigger, move, onFormBlur) {
|
|
@@ -2482,6 +2495,10 @@ var getMessageType = function getMessageType(taf, tafAction) {
|
|
|
2482
2495
|
return 'AMD';
|
|
2483
2496
|
}
|
|
2484
2497
|
|
|
2498
|
+
if (tafAction === 'CANCEL') {
|
|
2499
|
+
return 'CNL';
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2485
2502
|
return taf.messageType;
|
|
2486
2503
|
}; // For corrections and amendment we need to add the previousValidStart and End for the TAC converter
|
|
2487
2504
|
|
|
@@ -2518,13 +2535,43 @@ var prepareTafValues = function prepareTafValues(_taf, tafAction) {
|
|
|
2518
2535
|
var taf = tafAction === 'AMEND' || tafAction === 'DRAFT_AMEND' || tafAction === 'CORRECT' || tafAction === 'DRAFT_CORRECT' ? getAmendedCorrectedTafTimes(_taf, tafAction) : _taf;
|
|
2519
2536
|
return Object.assign(Object.assign(Object.assign(Object.assign({}, taf), {
|
|
2520
2537
|
messageType: getMessageType(taf, tafAction),
|
|
2521
|
-
baseForecast: formatFormValues(taf.baseForecast)
|
|
2538
|
+
baseForecast: Object.assign(Object.assign({}, emptyBaseForecast), formatFormValues(taf.baseForecast))
|
|
2522
2539
|
}), taf.changeGroups && {
|
|
2523
2540
|
changeGroups: taf.changeGroups.map(formatFormValues)
|
|
2524
2541
|
}), addEmptyChangeGroup && {
|
|
2525
2542
|
changeGroups: [emptyChangegroup]
|
|
2526
2543
|
});
|
|
2527
2544
|
};
|
|
2545
|
+
var getIsFormDefaultDisabled = function getIsFormDefaultDisabled(status) {
|
|
2546
|
+
return !(status === 'NEW' || status === 'DRAFT' || status === 'DRAFT_AMENDED' || status === 'DRAFT_CORRECTED');
|
|
2547
|
+
};
|
|
2548
|
+
var fromStatusToAction = function fromStatusToAction(tafStatus) {
|
|
2549
|
+
switch (tafStatus) {
|
|
2550
|
+
case 'DRAFT':
|
|
2551
|
+
return 'DRAFT';
|
|
2552
|
+
|
|
2553
|
+
case 'DRAFT_AMENDED':
|
|
2554
|
+
return 'DRAFT_AMEND';
|
|
2555
|
+
|
|
2556
|
+
case 'DRAFT_CORRECTED':
|
|
2557
|
+
return 'DRAFT_CORRECT';
|
|
2558
|
+
|
|
2559
|
+
case 'PUBLISHED':
|
|
2560
|
+
return 'PUBLISH';
|
|
2561
|
+
|
|
2562
|
+
case 'AMENDED':
|
|
2563
|
+
return 'AMEND';
|
|
2564
|
+
|
|
2565
|
+
case 'CORRECTED':
|
|
2566
|
+
return 'CORRECT';
|
|
2567
|
+
|
|
2568
|
+
case 'CANCELLED':
|
|
2569
|
+
return 'CANCEL';
|
|
2570
|
+
|
|
2571
|
+
default:
|
|
2572
|
+
return 'NEW';
|
|
2573
|
+
}
|
|
2574
|
+
};
|
|
2528
2575
|
|
|
2529
2576
|
var textFieldStyle = function textFieldStyle(theme) {
|
|
2530
2577
|
return {
|
|
@@ -2875,7 +2922,7 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
2875
2922
|
getValues = _useFormContext.getValues,
|
|
2876
2923
|
trigger = _useFormContext.trigger;
|
|
2877
2924
|
|
|
2878
|
-
var _useDraftFormHelpers = useDraftFormHelpers(),
|
|
2925
|
+
var _useDraftFormHelpers = useDraftFormHelpers(true),
|
|
2879
2926
|
isNotRequiredForAction = _useDraftFormHelpers.isRequired; // cross-field required validation
|
|
2880
2927
|
|
|
2881
2928
|
|
|
@@ -3309,6 +3356,36 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
3309
3356
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3310
3357
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3311
3358
|
* */
|
|
3359
|
+
var tafActionToDraftAction = function tafActionToDraftAction(tafAction) {
|
|
3360
|
+
switch (tafAction) {
|
|
3361
|
+
case 'AMEND':
|
|
3362
|
+
case 'DRAFT_AMEND':
|
|
3363
|
+
return 'DRAFT_AMEND';
|
|
3364
|
+
|
|
3365
|
+
case 'CORRECT':
|
|
3366
|
+
case 'DRAFT_CORRECT':
|
|
3367
|
+
return 'DRAFT_CORRECT';
|
|
3368
|
+
|
|
3369
|
+
default:
|
|
3370
|
+
return 'DRAFT';
|
|
3371
|
+
}
|
|
3372
|
+
};
|
|
3373
|
+
|
|
3374
|
+
var tafActionToPublishAction = function tafActionToPublishAction(tafAction) {
|
|
3375
|
+
switch (tafAction) {
|
|
3376
|
+
case 'AMEND':
|
|
3377
|
+
case 'DRAFT_AMEND':
|
|
3378
|
+
return 'AMEND';
|
|
3379
|
+
|
|
3380
|
+
case 'CORRECT':
|
|
3381
|
+
case 'DRAFT_CORRECT':
|
|
3382
|
+
return 'CORRECT';
|
|
3383
|
+
|
|
3384
|
+
default:
|
|
3385
|
+
return 'PUBLISH';
|
|
3386
|
+
}
|
|
3387
|
+
};
|
|
3388
|
+
|
|
3312
3389
|
var buttonsStyle = {
|
|
3313
3390
|
button: {
|
|
3314
3391
|
minWidth: {
|
|
@@ -3338,7 +3415,7 @@ var ViewModeButtons = function ViewModeButtons(_ref) {
|
|
|
3338
3415
|
return onTafViewModeButtonPress('CANCEL');
|
|
3339
3416
|
}
|
|
3340
3417
|
}, "Cancel"), canBe.includes('CORRECTED') && /*#__PURE__*/React__default.createElement(Button, {
|
|
3341
|
-
"data-testid": "
|
|
3418
|
+
"data-testid": "correcttaf",
|
|
3342
3419
|
variant: "tertiary",
|
|
3343
3420
|
onClick: function onClick() {
|
|
3344
3421
|
return onTafViewModeButtonPress('CORRECT');
|
|
@@ -3392,21 +3469,7 @@ var TafFormButtons = function TafFormButtons(_ref2) {
|
|
|
3392
3469
|
if action DRAFT_AMEND - new status will be DRAFT_AMENDED
|
|
3393
3470
|
if action DRAFT_CORRECT - new status will be DRAFT_CORRECTED
|
|
3394
3471
|
*/
|
|
3395
|
-
|
|
3396
|
-
case 'AMEND':
|
|
3397
|
-
case 'DRAFT_AMEND':
|
|
3398
|
-
onTafEditModeButtonPress('DRAFT_AMEND');
|
|
3399
|
-
break;
|
|
3400
|
-
|
|
3401
|
-
case 'CORRECT':
|
|
3402
|
-
case 'DRAFT_CORRECT':
|
|
3403
|
-
onTafEditModeButtonPress('DRAFT_CORRECT');
|
|
3404
|
-
break;
|
|
3405
|
-
|
|
3406
|
-
default:
|
|
3407
|
-
onTafEditModeButtonPress('DRAFT');
|
|
3408
|
-
break;
|
|
3409
|
-
}
|
|
3472
|
+
onTafEditModeButtonPress(tafActionToDraftAction(tafAction));
|
|
3410
3473
|
}
|
|
3411
3474
|
}, "Save"), /*#__PURE__*/React__default.createElement(Button, {
|
|
3412
3475
|
"data-testid": "publishtaf",
|
|
@@ -3419,21 +3482,7 @@ var TafFormButtons = function TafFormButtons(_ref2) {
|
|
|
3419
3482
|
if action DRAFT_AMEND - new status will be AMENDED
|
|
3420
3483
|
if action DRAFT_CORRECT - new status will be CORRECTED
|
|
3421
3484
|
*/
|
|
3422
|
-
|
|
3423
|
-
case 'AMEND':
|
|
3424
|
-
case 'DRAFT_AMEND':
|
|
3425
|
-
onTafEditModeButtonPress('AMEND');
|
|
3426
|
-
break;
|
|
3427
|
-
|
|
3428
|
-
case 'CORRECT':
|
|
3429
|
-
case 'DRAFT_CORRECT':
|
|
3430
|
-
onTafEditModeButtonPress('CORRECT');
|
|
3431
|
-
break;
|
|
3432
|
-
|
|
3433
|
-
default:
|
|
3434
|
-
onTafEditModeButtonPress('PUBLISH');
|
|
3435
|
-
break;
|
|
3436
|
-
}
|
|
3485
|
+
onTafEditModeButtonPress(tafActionToPublishAction(tafAction));
|
|
3437
3486
|
}
|
|
3438
3487
|
}, "Publish"))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
3439
3488
|
item: true,
|
|
@@ -3500,145 +3549,9 @@ var DragHandle = function DragHandle(_ref) {
|
|
|
3500
3549
|
* See the License for the specific language governing permissions and
|
|
3501
3550
|
* limitations under the License.
|
|
3502
3551
|
*
|
|
3503
|
-
* Copyright
|
|
3504
|
-
* Copyright
|
|
3552
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3553
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3505
3554
|
* */
|
|
3506
|
-
var ThumbsUp = function ThumbsUp(props) {
|
|
3507
|
-
return /*#__PURE__*/React__default.createElement(SvgIcon, Object.assign({
|
|
3508
|
-
fontSize: "inherit",
|
|
3509
|
-
viewBox: "0 0 58 69"
|
|
3510
|
-
}, props), /*#__PURE__*/React__default.createElement("title", null, "Thumbs up"), /*#__PURE__*/React__default.createElement("g", {
|
|
3511
|
-
id: "Thumbs-up",
|
|
3512
|
-
stroke: "none",
|
|
3513
|
-
strokeWidth: "1",
|
|
3514
|
-
fill: "none",
|
|
3515
|
-
fillRule: "evenodd"
|
|
3516
|
-
}, /*#__PURE__*/React__default.createElement("path", {
|
|
3517
|
-
d: "M3.99883665,31.7843145 C7.41834232,30.0745617 7.39773108,30.3805485 10.9988366,28.8843145 C14.5999422,27.3880805 16.06167,27.0500418 18.1988366,25.8843145 C19.0904815,25.3979628 19.820202,24.8243341 20.5488366,24.1634286 C20.9845024,23.7682595 22.8819728,21.7794437 23.5488366,20.8277879 C24.2586546,19.8148341 25.1756722,18.5003429 25.9988366,16.8843145 C28.3936103,12.1829184 28.889513,9.4076237 29.8988366,6.88431453 C30.4506375,5.50481234 31.0206747,4.13576029 31.6089482,2.77715837 C31.8562473,2.20602771 32.1648239,1.47549588 32.9988366,0.88431453 C33.2365758,0.715795602 34.0556054,0.253858312 35.0144255,0.0843145301 C36.0262338,-0.0945989315 37.1937102,0.0296108539 37.9980376,0.28431453 C38.7449403,0.520833719 39.4692925,0.860990256 40.1710941,1.30478414 C40.2879689,1.37869154 41.2393256,2.13799569 41.8988366,3.58269657 C42.290748,4.4412034 42.5040976,4.92788584 42.7988366,6.88431453 C42.9953293,8.18860032 43.0453293,9.52193365 42.9488366,10.8843145 C42.947848,11.8251839 42.6645146,13.1585172 42.0988366,14.8843145 C41.9160014,15.4421169 41.6403041,16.2990156 41.2988366,17.1941099 C40.9325633,18.1542284 40.4965053,19.1582935 40.1988366,19.8843145 C39.1594737,22.4193462 37.7498356,25.6900566 37.4561402,26.5124038 C37.2603433,27.0606352 37.1745754,27.6512721 37.1988366,28.2843145 C37.21217,28.4109812 37.2455033,28.5187344 37.2988366,28.6075742 C37.35217,28.6964139 37.45217,28.821994 37.5988366,28.9843145 C38.7401033,28.7100145 39.6802034,28.5266812 40.4191367,28.4343145 C41.6262088,28.2834305 44.7342553,28.0975232 47.4943878,28.1962584 C50.2545202,28.2949937 51.7465936,28.4428269 52.9988366,28.8843145 C53.8336653,29.1786396 54.540332,29.8453063 55.1188366,30.8843145 C55.3507184,31.5616882 55.477385,32.2303996 55.4988366,32.8904489 C55.5202882,33.5504981 55.4369549,34.21512 55.2488366,34.8843145 C54.956044,35.585751 54.5393773,36.1190843 53.9988366,36.4843145 C53.4582959,36.8495447 52.6416293,37.1495447 51.5488366,37.3843145 C51.46217,37.6709812 51.4455033,37.9376479 51.4988366,38.1843145 C51.55217,38.4309812 51.7188366,38.5976479 51.9988366,38.6843145 C53.0027645,38.7154727 53.6750204,38.7821393 54.0156044,38.8843145 C54.7031375,39.0905745 55.3642149,39.4239078 55.9988366,39.8843145 C56.4980387,40.3674862 56.831372,40.7202741 56.9988366,40.9426784 C57.2459451,41.2708552 57.8988366,42.3863253 57.8988366,43.8843145 C57.8988366,44.882974 57.53217,45.882974 56.7988366,46.8843145 C56.4100652,47.2645006 55.9767318,47.5818962 55.4988366,47.8365013 C55.0209415,48.0911064 54.5157721,48.2737108 53.9833285,48.3843145 L52.6988366,48.3843145 C52.2988366,48.6576479 52.0988366,48.9643145 52.0988366,49.3043145 C52.0988366,49.6443145 52.1655033,49.9376479 52.2988366,50.1843145 L53.4440689,50.6343145 C54.0486381,50.9097065 54.566894,51.3263732 54.9988366,51.8843145 C55.2403033,52.1962176 55.7126861,53.1830494 55.7488366,53.8843145 C55.7849872,54.5855797 55.7892838,54.8412841 55.675362,55.3021772 C55.5409724,55.8458769 55.3321306,56.373256 54.9488366,56.8843145 C54.6880408,57.2320423 54.3421972,57.542124 54.0113058,57.8145598 C53.720974,58.0536013 53.0623839,58.3923099 52.0355354,58.6843145 C51.8426264,58.739172 51.4970601,58.8058387 50.9988366,58.8843145 L49.2488366,58.9843145 C48.96217,59.1509812 48.7955033,59.3509812 48.7488366,59.5843145 C48.70217,59.8176479 48.7855033,60.0643145 48.9988366,60.3243145 L50.0168579,60.6843145 C51.0110333,61.2176479 51.5216929,61.9496429 51.5488366,62.8802998 C51.5895523,64.276285 51.475285,65.4556464 50.0016466,66.7843145 C49.4876586,67.2477386 48.8545536,67.4912052 48.1023318,67.7343145 C47.6452927,67.8820242 46.8607943,68.0486909 45.7488366,68.2343145 L40.0010327,68.6843145 C38.1462353,68.7443145 36.81217,68.7776479 35.9988366,68.7843145 C34.7788366,68.7943145 28.6377735,68.7414839 25.3910307,68.5132824 C22.1442879,68.2850808 21.4236621,68.1168902 18.9258088,67.5843145 C16.4279556,67.0517389 16.0894589,66.9976619 13.9988366,66.0843145 C12.6050885,65.4754163 11.2717551,64.6754163 9.99883665,63.6843145 L5.99912679,59.8445931 C5.6005732,59.505994 5.13964906,59.1744645 4.61635438,58.8500046 C3.83141237,58.3633147 3.44878136,58.2942773 2.99883665,57.9843145 C2.44718062,57.6042838 2.05635486,57.1737105 1.71932092,56.7662516 C1.30382099,56.2639309 0.723401214,54.7703696 0.498836646,53.8721113 C0.239479861,52.8346842 0.182966814,51.4491222 0.134208514,50.425802 C0.00166588165,47.644049 0.0975252306,47.2982714 0.0687602378,44.8458357 C0.0452570713,42.8420109 -0.0277106081,40.4082829 0.0112302522,39.9409643 C0.224109489,37.3862585 0.450803729,36.3915418 0.898836646,34.8843145 C1.09883665,34.2114947 1.78104521,33.1945675 2.17275045,32.889441 C2.5644557,32.5843145 3.13875358,32.2143561 3.99883665,31.7843145 Z",
|
|
3518
|
-
id: "Path-2",
|
|
3519
|
-
fill: "#FFBF00"
|
|
3520
|
-
}), /*#__PURE__*/React__default.createElement("path", {
|
|
3521
|
-
d: "M37.1988366,28.2843145 C36.6491114,28.3570112 36.2566531,28.4236779 36.0214618,28.4843145 C35.0603746,28.7321005 34.3937143,29.0314706 34.021481,29.207818 C33.777778,29.3232735 32.5285093,30.04554 31.6988366,30.8956082 C31.0356177,31.5751308 30.7670551,32.3363186 30.5620165,32.9344937 C29.9561734,34.7019667 30.4904911,36.5989836 30.5988366,36.8981554 C30.8174274,37.5017447 31.0945063,37.9694877 31.2988366,38.4843145 C31.4064264,38.7553957 31.4498365,39.7521385 31.3985954,40.9130014 C31.388536,41.1408948 31.3995111,42.8738523 30.5816296,45.1307691 C30.125032,46.3907349 29.4940749,47.743868 28.6988366,48.906031 C27.6082165,50.4998658 26.3589437,51.7345157 26.1988366,51.8770596 C25.2520649,52.7199732 23.8988366,53.516454 23.3777374,54.1031009 C22.8566381,54.6897478 22.8988366,54.7174426 22.8988366,54.8843145 C22.8988366,55.0643438 22.9342857,55.2139882 23.0063234,55.32641 C23.2544011,55.7135594 23.9363916,55.6592779 25.0988366,54.8843145 C25.8683088,54.3713331 26.8213311,53.5952018 27.5988366,52.8259025 C28.3369913,52.0955388 28.9092218,51.3713331 29.2988366,50.8843145 C29.6096134,50.4958436 30.1890589,49.8244169 30.7488366,48.8700346 C31.0160857,48.4143934 31.4327524,47.5858201 31.9988366,46.3843145 C31.9988366,46.7176479 32.33217,47.2176479 32.9988366,47.8843145 C33.1686748,48.0541527 33.5020081,48.3041527 33.9988366,48.6343145 C33.535822,48.6343145 33.2024887,48.6676479 32.9988366,48.7343145 C31.9774176,49.1343145 31.4345654,49.3440777 30.8488366,49.8843145 C30.1709576,50.5095446 29.6310297,51.1756019 29.3988366,52.3843145 C29.1722814,53.5636787 29.3142136,54.632966 29.6488366,55.5921767 C29.928312,56.3933044 30.3156141,57.1176481 30.9865396,57.7652076 C31.1856402,57.9573742 31.5230725,58.2304098 31.9988366,58.5843145 C30.2988366,59.4509812 29.4488366,60.8843145 29.4488366,62.8843145 C29.4488366,65.8843145 31.4988366,68.7843145 35.9988366,68.7843145 C37.2162866,68.7843145 38.5382158,68.7607397 39.9988366,68.6843145 C41.1579568,68.623665 43.0746234,68.473665 45.7488366,68.2343145 C42.81999,68.0652276 40.9033233,67.948561 39.9988366,67.8843145 C38.4397862,67.7735739 34.9576244,67.4218793 34.5109642,67.2843145 C33.8898949,67.0930342 33.3876529,66.66767 32.9988366,66.3843145 C31.7988366,65.509797 31.6488366,63.8668327 31.6488366,63.3843145 C31.6488366,62.6767971 32.115551,61.4820497 32.7124803,60.9291427 C33.2967248,60.387985 34.101504,59.9827037 34.9988366,59.8343145 C36.8129843,59.5343145 37.8279851,59.6343145 38.9968712,59.6343145 C41.8836014,59.6343145 46.4559662,59.9063364 47.0327603,59.9503801 C47.6352731,59.9963876 48.2906319,60.1194654 48.9988366,60.3196132 C48.7881139,60.0647262 48.7047806,59.8196266 48.7488366,59.5843145 C48.7928927,59.3490025 48.9595594,59.1490025 49.2488366,58.9843145 C41.7042463,58.5910176 37.2875796,58.2576842 35.9988366,57.9843145 C34.0657222,57.57426 33.0783849,56.5232188 32.4988366,55.3843145 C32.1808463,54.7594131 31.9988366,54.0680377 32.1988366,52.8843145 C32.4054546,51.661422 33.0758788,51.154421 33.9988366,50.7343145 C35.0343809,50.2629616 36.2160776,50.213626 38.0168693,50.1343145 C41.4226671,49.9843145 41.9988366,49.8715355 44.9988366,49.8843145 C47.4322993,49.8928339 49.8656327,49.9928339 52.2988366,50.1843145 C52.1655033,49.9452767 52.0988366,49.6535253 52.0988366,49.3090604 C52.0988366,48.9645954 52.2988366,48.6563468 52.6988366,48.3843145 C49.4970675,48.4374708 47.2644784,48.4840975 46.0010696,48.5241946 C42.8267531,48.6249387 40.1650305,48.7843145 38.0159019,48.6090596 C36.5073153,48.3843145 35.5349602,47.7454709 35.0988366,47.3586886 C33.5267511,45.9644623 33.6909724,44.1458838 33.6988366,43.902953 C33.7490538,42.3517256 34.2594453,41.6540102 34.9988366,41.2843145 C36.9988366,40.2843145 38.521019,40.3843145 40.9988366,39.8843145 L51.9988366,38.6843145 C51.7847588,38.5992008 51.6347588,38.4325341 51.5488366,38.1843145 C51.4629145,37.9360949 51.4629145,37.6694283 51.5488366,37.3843145 C48.6830402,37.6590904 46.693269,37.8590904 45.579523,37.9843145 C44.2653604,38.1320725 42.7384649,38.3154059 40.9988366,38.5343145 C38.9988366,38.6009812 37.6749072,38.5733169 37.0270482,38.4513217 C35.0988366,38.2216852 33.4888366,37.4843145 33.4388366,34.8545872 C33.3888366,32.7744565 33.7430954,32.2207578 33.8988366,31.9295788 C34.3117653,31.1575537 34.9128559,30.575799 35.3988366,30.1843145 C36.0681111,29.6451768 36.8014444,29.2451768 37.5988366,28.9843145 C37.4503711,28.8228789 37.3503711,28.6970685 37.2988366,28.6068833 C37.2473022,28.516698 37.2139689,28.4091751 37.1988366,28.2843145 Z",
|
|
3522
|
-
id: "Path",
|
|
3523
|
-
fill: "#F28700"
|
|
3524
|
-
})));
|
|
3525
|
-
};
|
|
3526
|
-
|
|
3527
|
-
var getPaneTitle = function getPaneTitle(sumOfErrors) {
|
|
3528
|
-
switch (sumOfErrors) {
|
|
3529
|
-
case 0:
|
|
3530
|
-
return 'Looks good';
|
|
3531
|
-
|
|
3532
|
-
case 1:
|
|
3533
|
-
return 'There is an issue to address';
|
|
3534
|
-
|
|
3535
|
-
default:
|
|
3536
|
-
return 'There are a few issues to address';
|
|
3537
|
-
}
|
|
3538
|
-
};
|
|
3539
|
-
|
|
3540
|
-
var getErrorDefaultMessage = function getErrorDefaultMessage(error) {
|
|
3541
|
-
switch (error.type) {
|
|
3542
|
-
case 'required':
|
|
3543
|
-
{
|
|
3544
|
-
return 'this field is required';
|
|
3545
|
-
}
|
|
3546
|
-
|
|
3547
|
-
default:
|
|
3548
|
-
{
|
|
3549
|
-
return error.message;
|
|
3550
|
-
}
|
|
3551
|
-
}
|
|
3552
|
-
};
|
|
3553
|
-
|
|
3554
|
-
var capitalizeWord = function capitalizeWord(_ref) {
|
|
3555
|
-
var _ref2 = _toArray(_ref),
|
|
3556
|
-
firstLetter = _ref2[0],
|
|
3557
|
-
restOfWord = _ref2.slice(1);
|
|
3558
|
-
|
|
3559
|
-
return firstLetter.toUpperCase() + restOfWord.join('');
|
|
3560
|
-
};
|
|
3561
|
-
var humanizeErrorMessage = function humanizeErrorMessage(nameAsString) {
|
|
3562
|
-
var nameWithoutBrackets = nameAsString.replace(/[[\]']+/g, '');
|
|
3563
|
-
var nameLowerCase = nameWithoutBrackets.toLowerCase();
|
|
3564
|
-
|
|
3565
|
-
var _nameLowerCase$split$ = nameLowerCase.split(/([0-9]+)/) // split num bers from field and build array
|
|
3566
|
-
.filter(function (s) {
|
|
3567
|
-
return s.length;
|
|
3568
|
-
}),
|
|
3569
|
-
_nameLowerCase$split$2 = _slicedToArray(_nameLowerCase$split$, 2),
|
|
3570
|
-
fieldName = _nameLowerCase$split$2[0],
|
|
3571
|
-
fieldNumberedValue = _nameLowerCase$split$2[1];
|
|
3572
|
-
|
|
3573
|
-
var nameCapitalized = capitalizeWord(fieldName);
|
|
3574
|
-
|
|
3575
|
-
if (fieldNumberedValue) {
|
|
3576
|
-
// when name contains a number we assume it's a formgroup and we add a index +1 for human readability
|
|
3577
|
-
var fieldNumber = parseInt(fieldNumberedValue, 10) + 1;
|
|
3578
|
-
return "".concat(nameCapitalized, " ").concat(fieldNumber);
|
|
3579
|
-
}
|
|
3580
|
-
|
|
3581
|
-
return nameCapitalized;
|
|
3582
|
-
};
|
|
3583
|
-
var getErrorMessage = function getErrorMessage(error, index) {
|
|
3584
|
-
var name = error.ref.name;
|
|
3585
|
-
|
|
3586
|
-
var _name$split = name.split('.'),
|
|
3587
|
-
_name$split2 = _slicedToArray(_name$split, 1),
|
|
3588
|
-
firstNamePart = _name$split2[0];
|
|
3589
|
-
|
|
3590
|
-
var fieldErrorTitle = humanizeErrorMessage(firstNamePart);
|
|
3591
|
-
return "".concat(index + 1, ". ").concat(fieldErrorTitle, ": ").concat(getErrorDefaultMessage(error));
|
|
3592
|
-
};
|
|
3593
|
-
var MODAL_DIALOG_ELEMENT = 'modal-dialog';
|
|
3594
|
-
|
|
3595
|
-
var IssuesPane = function IssuesPane(_ref3) {
|
|
3596
|
-
var isOpen = _ref3.isOpen,
|
|
3597
|
-
handleClose = _ref3.handleClose,
|
|
3598
|
-
_ref3$errorList = _ref3.errorList,
|
|
3599
|
-
errorList = _ref3$errorList === void 0 ? [] : _ref3$errorList,
|
|
3600
|
-
_ref3$startPosition = _ref3.startPosition,
|
|
3601
|
-
startPosition = _ref3$startPosition === void 0 ? {
|
|
3602
|
-
left: 20,
|
|
3603
|
-
top: 50
|
|
3604
|
-
} : _ref3$startPosition;
|
|
3605
|
-
var rootElement = document.getElementById(MODAL_DIALOG_ELEMENT) || document.body;
|
|
3606
|
-
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(ToolContainerDraggable, {
|
|
3607
|
-
startSize: {
|
|
3608
|
-
width: '577px',
|
|
3609
|
-
height: '200px'
|
|
3610
|
-
},
|
|
3611
|
-
startPosition: startPosition,
|
|
3612
|
-
minWidth: 300,
|
|
3613
|
-
onClose: handleClose,
|
|
3614
|
-
title: getPaneTitle(errorList.length),
|
|
3615
|
-
headerSize: "xs",
|
|
3616
|
-
isOpen: isOpen,
|
|
3617
|
-
"data-testid": "moveable-issues-pane",
|
|
3618
|
-
bounds: "parent"
|
|
3619
|
-
}, /*#__PURE__*/React.createElement(Box, {
|
|
3620
|
-
component: "div",
|
|
3621
|
-
sx: {
|
|
3622
|
-
marginTop: '16px',
|
|
3623
|
-
marginLeft: '24px'
|
|
3624
|
-
}
|
|
3625
|
-
}, errorList.length === 0 && /*#__PURE__*/React.createElement(Box, {
|
|
3626
|
-
component: "div",
|
|
3627
|
-
sx: {
|
|
3628
|
-
fontSize: '4rem'
|
|
3629
|
-
},
|
|
3630
|
-
"data-testid": "zeroIssuesImage"
|
|
3631
|
-
}, /*#__PURE__*/React.createElement(ThumbsUp, null)), errorList.length > 0 && errorList.map(function (error, index) {
|
|
3632
|
-
return /*#__PURE__*/React.createElement(Typography // eslint-disable-next-line react/no-array-index-key
|
|
3633
|
-
, {
|
|
3634
|
-
// eslint-disable-next-line react/no-array-index-key
|
|
3635
|
-
key: "message-".concat(index),
|
|
3636
|
-
variant: "body1",
|
|
3637
|
-
"data-testid": "errorMessage"
|
|
3638
|
-
}, getErrorMessage(error, index));
|
|
3639
|
-
}))), rootElement);
|
|
3640
|
-
};
|
|
3641
|
-
|
|
3642
3555
|
var getCustomError = function getCustomError(error) {
|
|
3643
3556
|
var name = error.ref.name;
|
|
3644
3557
|
var isChangeGroup = name.includes('changeGroups');
|
|
@@ -3649,7 +3562,6 @@ var getCustomError = function getCustomError(error) {
|
|
|
3649
3562
|
row: row
|
|
3650
3563
|
});
|
|
3651
3564
|
};
|
|
3652
|
-
|
|
3653
3565
|
var getIssuesLabel = function getIssuesLabel(sumOfErrors) {
|
|
3654
3566
|
switch (sumOfErrors) {
|
|
3655
3567
|
case 0:
|
|
@@ -3697,7 +3609,6 @@ var filterDuplicateErrors = function filterDuplicateErrors(errors) {
|
|
|
3697
3609
|
return list.concat(error);
|
|
3698
3610
|
}, []);
|
|
3699
3611
|
};
|
|
3700
|
-
|
|
3701
3612
|
var getErrors = function getErrors(errors) {
|
|
3702
3613
|
var errorList = Object.keys(errors).reduce(function (list, key) {
|
|
3703
3614
|
var errorValue = errors[key];
|
|
@@ -3714,31 +3625,41 @@ var getErrors = function getErrors(errors) {
|
|
|
3714
3625
|
return errorList;
|
|
3715
3626
|
};
|
|
3716
3627
|
|
|
3628
|
+
/* *
|
|
3629
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3630
|
+
* you may not use this file except in compliance with the License.
|
|
3631
|
+
* You may obtain a copy of the License at
|
|
3632
|
+
*
|
|
3633
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3634
|
+
*
|
|
3635
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3636
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3637
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3638
|
+
* See the License for the specific language governing permissions and
|
|
3639
|
+
* limitations under the License.
|
|
3640
|
+
*
|
|
3641
|
+
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3642
|
+
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3643
|
+
* */
|
|
3644
|
+
|
|
3717
3645
|
var IssuesButton = function IssuesButton(_ref) {
|
|
3718
3646
|
var _ref$errors = _ref.errors,
|
|
3719
|
-
errors = _ref$errors === void 0 ? {} : _ref$errors
|
|
3647
|
+
errors = _ref$errors === void 0 ? {} : _ref$errors,
|
|
3648
|
+
_ref$isIssuesPaneOpen = _ref.isIssuesPaneOpen,
|
|
3649
|
+
isIssuesPaneOpen = _ref$isIssuesPaneOpen === void 0 ? false : _ref$isIssuesPaneOpen,
|
|
3650
|
+
_ref$setIsIssuesPaneO = _ref.setIsIssuesPaneOpen,
|
|
3651
|
+
setIsIssuesPaneOpen = _ref$setIsIssuesPaneO === void 0 ? function () {
|
|
3652
|
+
return null;
|
|
3653
|
+
} : _ref$setIsIssuesPaneO;
|
|
3720
3654
|
var errorList = filterDuplicateErrors(getErrors(errors));
|
|
3721
3655
|
var totalErrors = errorList.length;
|
|
3722
3656
|
var errorStatus = totalErrors > 0 ? 'error' : 'success';
|
|
3723
3657
|
var buttonColor = "geowebColors.functional.".concat(errorStatus);
|
|
3724
3658
|
|
|
3725
|
-
var
|
|
3726
|
-
|
|
3727
|
-
isIssuesPaneOpen = _React$useState2[0],
|
|
3728
|
-
setIsIssuesPaneOpen = _React$useState2[1];
|
|
3729
|
-
|
|
3730
|
-
var toggleIssuesPane = function toggleIssuesPane() {
|
|
3731
|
-
return setIsIssuesPaneOpen(!isIssuesPaneOpen);
|
|
3659
|
+
var toggleIssuesPane = function toggleIssuesPane(newPosition) {
|
|
3660
|
+
return setIsIssuesPaneOpen(!isIssuesPaneOpen, newPosition);
|
|
3732
3661
|
};
|
|
3733
3662
|
|
|
3734
|
-
var _React$useState3 = React.useState({
|
|
3735
|
-
left: 0,
|
|
3736
|
-
top: 0
|
|
3737
|
-
}),
|
|
3738
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3739
|
-
startPosition = _React$useState4[0],
|
|
3740
|
-
setStartPosition = _React$useState4[1];
|
|
3741
|
-
|
|
3742
3663
|
var onClickButton = function onClickButton(event) {
|
|
3743
3664
|
var _a;
|
|
3744
3665
|
|
|
@@ -3754,11 +3675,10 @@ var IssuesButton = function IssuesButton(_ref) {
|
|
|
3754
3675
|
left: left - parentOffset.left + 100,
|
|
3755
3676
|
top: top - parentOffset.top
|
|
3756
3677
|
};
|
|
3757
|
-
|
|
3758
|
-
toggleIssuesPane();
|
|
3678
|
+
toggleIssuesPane(newPosition);
|
|
3759
3679
|
};
|
|
3760
3680
|
|
|
3761
|
-
return /*#__PURE__*/React.createElement(
|
|
3681
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
3762
3682
|
title: "View details"
|
|
3763
3683
|
}, /*#__PURE__*/React.createElement(Chip, {
|
|
3764
3684
|
"data-testid": "issuesButton",
|
|
@@ -3778,56 +3698,289 @@ var IssuesButton = function IssuesButton(_ref) {
|
|
|
3778
3698
|
},
|
|
3779
3699
|
fontSize: 12
|
|
3780
3700
|
}
|
|
3781
|
-
})), /*#__PURE__*/React.createElement(IssuesPane, {
|
|
3782
|
-
errorList: errorList,
|
|
3783
|
-
handleClose: toggleIssuesPane,
|
|
3784
|
-
isOpen: isIssuesPaneOpen,
|
|
3785
|
-
startPosition: startPosition
|
|
3786
3701
|
}));
|
|
3787
3702
|
};
|
|
3788
3703
|
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3795
|
-
|
|
3796
|
-
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3828
|
-
|
|
3829
|
-
|
|
3830
|
-
|
|
3704
|
+
/* *
|
|
3705
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3706
|
+
* you may not use this file except in compliance with the License.
|
|
3707
|
+
* You may obtain a copy of the License at
|
|
3708
|
+
*
|
|
3709
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3710
|
+
*
|
|
3711
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3712
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3713
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3714
|
+
* See the License for the specific language governing permissions and
|
|
3715
|
+
* limitations under the License.
|
|
3716
|
+
*
|
|
3717
|
+
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3718
|
+
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3719
|
+
* */
|
|
3720
|
+
var ThumbsUp = function ThumbsUp(props) {
|
|
3721
|
+
return /*#__PURE__*/React__default.createElement(SvgIcon, Object.assign({
|
|
3722
|
+
fontSize: "inherit",
|
|
3723
|
+
viewBox: "0 0 58 69"
|
|
3724
|
+
}, props), /*#__PURE__*/React__default.createElement("title", null, "Thumbs up"), /*#__PURE__*/React__default.createElement("g", {
|
|
3725
|
+
id: "Thumbs-up",
|
|
3726
|
+
stroke: "none",
|
|
3727
|
+
strokeWidth: "1",
|
|
3728
|
+
fill: "none",
|
|
3729
|
+
fillRule: "evenodd"
|
|
3730
|
+
}, /*#__PURE__*/React__default.createElement("path", {
|
|
3731
|
+
d: "M3.99883665,31.7843145 C7.41834232,30.0745617 7.39773108,30.3805485 10.9988366,28.8843145 C14.5999422,27.3880805 16.06167,27.0500418 18.1988366,25.8843145 C19.0904815,25.3979628 19.820202,24.8243341 20.5488366,24.1634286 C20.9845024,23.7682595 22.8819728,21.7794437 23.5488366,20.8277879 C24.2586546,19.8148341 25.1756722,18.5003429 25.9988366,16.8843145 C28.3936103,12.1829184 28.889513,9.4076237 29.8988366,6.88431453 C30.4506375,5.50481234 31.0206747,4.13576029 31.6089482,2.77715837 C31.8562473,2.20602771 32.1648239,1.47549588 32.9988366,0.88431453 C33.2365758,0.715795602 34.0556054,0.253858312 35.0144255,0.0843145301 C36.0262338,-0.0945989315 37.1937102,0.0296108539 37.9980376,0.28431453 C38.7449403,0.520833719 39.4692925,0.860990256 40.1710941,1.30478414 C40.2879689,1.37869154 41.2393256,2.13799569 41.8988366,3.58269657 C42.290748,4.4412034 42.5040976,4.92788584 42.7988366,6.88431453 C42.9953293,8.18860032 43.0453293,9.52193365 42.9488366,10.8843145 C42.947848,11.8251839 42.6645146,13.1585172 42.0988366,14.8843145 C41.9160014,15.4421169 41.6403041,16.2990156 41.2988366,17.1941099 C40.9325633,18.1542284 40.4965053,19.1582935 40.1988366,19.8843145 C39.1594737,22.4193462 37.7498356,25.6900566 37.4561402,26.5124038 C37.2603433,27.0606352 37.1745754,27.6512721 37.1988366,28.2843145 C37.21217,28.4109812 37.2455033,28.5187344 37.2988366,28.6075742 C37.35217,28.6964139 37.45217,28.821994 37.5988366,28.9843145 C38.7401033,28.7100145 39.6802034,28.5266812 40.4191367,28.4343145 C41.6262088,28.2834305 44.7342553,28.0975232 47.4943878,28.1962584 C50.2545202,28.2949937 51.7465936,28.4428269 52.9988366,28.8843145 C53.8336653,29.1786396 54.540332,29.8453063 55.1188366,30.8843145 C55.3507184,31.5616882 55.477385,32.2303996 55.4988366,32.8904489 C55.5202882,33.5504981 55.4369549,34.21512 55.2488366,34.8843145 C54.956044,35.585751 54.5393773,36.1190843 53.9988366,36.4843145 C53.4582959,36.8495447 52.6416293,37.1495447 51.5488366,37.3843145 C51.46217,37.6709812 51.4455033,37.9376479 51.4988366,38.1843145 C51.55217,38.4309812 51.7188366,38.5976479 51.9988366,38.6843145 C53.0027645,38.7154727 53.6750204,38.7821393 54.0156044,38.8843145 C54.7031375,39.0905745 55.3642149,39.4239078 55.9988366,39.8843145 C56.4980387,40.3674862 56.831372,40.7202741 56.9988366,40.9426784 C57.2459451,41.2708552 57.8988366,42.3863253 57.8988366,43.8843145 C57.8988366,44.882974 57.53217,45.882974 56.7988366,46.8843145 C56.4100652,47.2645006 55.9767318,47.5818962 55.4988366,47.8365013 C55.0209415,48.0911064 54.5157721,48.2737108 53.9833285,48.3843145 L52.6988366,48.3843145 C52.2988366,48.6576479 52.0988366,48.9643145 52.0988366,49.3043145 C52.0988366,49.6443145 52.1655033,49.9376479 52.2988366,50.1843145 L53.4440689,50.6343145 C54.0486381,50.9097065 54.566894,51.3263732 54.9988366,51.8843145 C55.2403033,52.1962176 55.7126861,53.1830494 55.7488366,53.8843145 C55.7849872,54.5855797 55.7892838,54.8412841 55.675362,55.3021772 C55.5409724,55.8458769 55.3321306,56.373256 54.9488366,56.8843145 C54.6880408,57.2320423 54.3421972,57.542124 54.0113058,57.8145598 C53.720974,58.0536013 53.0623839,58.3923099 52.0355354,58.6843145 C51.8426264,58.739172 51.4970601,58.8058387 50.9988366,58.8843145 L49.2488366,58.9843145 C48.96217,59.1509812 48.7955033,59.3509812 48.7488366,59.5843145 C48.70217,59.8176479 48.7855033,60.0643145 48.9988366,60.3243145 L50.0168579,60.6843145 C51.0110333,61.2176479 51.5216929,61.9496429 51.5488366,62.8802998 C51.5895523,64.276285 51.475285,65.4556464 50.0016466,66.7843145 C49.4876586,67.2477386 48.8545536,67.4912052 48.1023318,67.7343145 C47.6452927,67.8820242 46.8607943,68.0486909 45.7488366,68.2343145 L40.0010327,68.6843145 C38.1462353,68.7443145 36.81217,68.7776479 35.9988366,68.7843145 C34.7788366,68.7943145 28.6377735,68.7414839 25.3910307,68.5132824 C22.1442879,68.2850808 21.4236621,68.1168902 18.9258088,67.5843145 C16.4279556,67.0517389 16.0894589,66.9976619 13.9988366,66.0843145 C12.6050885,65.4754163 11.2717551,64.6754163 9.99883665,63.6843145 L5.99912679,59.8445931 C5.6005732,59.505994 5.13964906,59.1744645 4.61635438,58.8500046 C3.83141237,58.3633147 3.44878136,58.2942773 2.99883665,57.9843145 C2.44718062,57.6042838 2.05635486,57.1737105 1.71932092,56.7662516 C1.30382099,56.2639309 0.723401214,54.7703696 0.498836646,53.8721113 C0.239479861,52.8346842 0.182966814,51.4491222 0.134208514,50.425802 C0.00166588165,47.644049 0.0975252306,47.2982714 0.0687602378,44.8458357 C0.0452570713,42.8420109 -0.0277106081,40.4082829 0.0112302522,39.9409643 C0.224109489,37.3862585 0.450803729,36.3915418 0.898836646,34.8843145 C1.09883665,34.2114947 1.78104521,33.1945675 2.17275045,32.889441 C2.5644557,32.5843145 3.13875358,32.2143561 3.99883665,31.7843145 Z",
|
|
3732
|
+
id: "Path-2",
|
|
3733
|
+
fill: "#FFBF00"
|
|
3734
|
+
}), /*#__PURE__*/React__default.createElement("path", {
|
|
3735
|
+
d: "M37.1988366,28.2843145 C36.6491114,28.3570112 36.2566531,28.4236779 36.0214618,28.4843145 C35.0603746,28.7321005 34.3937143,29.0314706 34.021481,29.207818 C33.777778,29.3232735 32.5285093,30.04554 31.6988366,30.8956082 C31.0356177,31.5751308 30.7670551,32.3363186 30.5620165,32.9344937 C29.9561734,34.7019667 30.4904911,36.5989836 30.5988366,36.8981554 C30.8174274,37.5017447 31.0945063,37.9694877 31.2988366,38.4843145 C31.4064264,38.7553957 31.4498365,39.7521385 31.3985954,40.9130014 C31.388536,41.1408948 31.3995111,42.8738523 30.5816296,45.1307691 C30.125032,46.3907349 29.4940749,47.743868 28.6988366,48.906031 C27.6082165,50.4998658 26.3589437,51.7345157 26.1988366,51.8770596 C25.2520649,52.7199732 23.8988366,53.516454 23.3777374,54.1031009 C22.8566381,54.6897478 22.8988366,54.7174426 22.8988366,54.8843145 C22.8988366,55.0643438 22.9342857,55.2139882 23.0063234,55.32641 C23.2544011,55.7135594 23.9363916,55.6592779 25.0988366,54.8843145 C25.8683088,54.3713331 26.8213311,53.5952018 27.5988366,52.8259025 C28.3369913,52.0955388 28.9092218,51.3713331 29.2988366,50.8843145 C29.6096134,50.4958436 30.1890589,49.8244169 30.7488366,48.8700346 C31.0160857,48.4143934 31.4327524,47.5858201 31.9988366,46.3843145 C31.9988366,46.7176479 32.33217,47.2176479 32.9988366,47.8843145 C33.1686748,48.0541527 33.5020081,48.3041527 33.9988366,48.6343145 C33.535822,48.6343145 33.2024887,48.6676479 32.9988366,48.7343145 C31.9774176,49.1343145 31.4345654,49.3440777 30.8488366,49.8843145 C30.1709576,50.5095446 29.6310297,51.1756019 29.3988366,52.3843145 C29.1722814,53.5636787 29.3142136,54.632966 29.6488366,55.5921767 C29.928312,56.3933044 30.3156141,57.1176481 30.9865396,57.7652076 C31.1856402,57.9573742 31.5230725,58.2304098 31.9988366,58.5843145 C30.2988366,59.4509812 29.4488366,60.8843145 29.4488366,62.8843145 C29.4488366,65.8843145 31.4988366,68.7843145 35.9988366,68.7843145 C37.2162866,68.7843145 38.5382158,68.7607397 39.9988366,68.6843145 C41.1579568,68.623665 43.0746234,68.473665 45.7488366,68.2343145 C42.81999,68.0652276 40.9033233,67.948561 39.9988366,67.8843145 C38.4397862,67.7735739 34.9576244,67.4218793 34.5109642,67.2843145 C33.8898949,67.0930342 33.3876529,66.66767 32.9988366,66.3843145 C31.7988366,65.509797 31.6488366,63.8668327 31.6488366,63.3843145 C31.6488366,62.6767971 32.115551,61.4820497 32.7124803,60.9291427 C33.2967248,60.387985 34.101504,59.9827037 34.9988366,59.8343145 C36.8129843,59.5343145 37.8279851,59.6343145 38.9968712,59.6343145 C41.8836014,59.6343145 46.4559662,59.9063364 47.0327603,59.9503801 C47.6352731,59.9963876 48.2906319,60.1194654 48.9988366,60.3196132 C48.7881139,60.0647262 48.7047806,59.8196266 48.7488366,59.5843145 C48.7928927,59.3490025 48.9595594,59.1490025 49.2488366,58.9843145 C41.7042463,58.5910176 37.2875796,58.2576842 35.9988366,57.9843145 C34.0657222,57.57426 33.0783849,56.5232188 32.4988366,55.3843145 C32.1808463,54.7594131 31.9988366,54.0680377 32.1988366,52.8843145 C32.4054546,51.661422 33.0758788,51.154421 33.9988366,50.7343145 C35.0343809,50.2629616 36.2160776,50.213626 38.0168693,50.1343145 C41.4226671,49.9843145 41.9988366,49.8715355 44.9988366,49.8843145 C47.4322993,49.8928339 49.8656327,49.9928339 52.2988366,50.1843145 C52.1655033,49.9452767 52.0988366,49.6535253 52.0988366,49.3090604 C52.0988366,48.9645954 52.2988366,48.6563468 52.6988366,48.3843145 C49.4970675,48.4374708 47.2644784,48.4840975 46.0010696,48.5241946 C42.8267531,48.6249387 40.1650305,48.7843145 38.0159019,48.6090596 C36.5073153,48.3843145 35.5349602,47.7454709 35.0988366,47.3586886 C33.5267511,45.9644623 33.6909724,44.1458838 33.6988366,43.902953 C33.7490538,42.3517256 34.2594453,41.6540102 34.9988366,41.2843145 C36.9988366,40.2843145 38.521019,40.3843145 40.9988366,39.8843145 L51.9988366,38.6843145 C51.7847588,38.5992008 51.6347588,38.4325341 51.5488366,38.1843145 C51.4629145,37.9360949 51.4629145,37.6694283 51.5488366,37.3843145 C48.6830402,37.6590904 46.693269,37.8590904 45.579523,37.9843145 C44.2653604,38.1320725 42.7384649,38.3154059 40.9988366,38.5343145 C38.9988366,38.6009812 37.6749072,38.5733169 37.0270482,38.4513217 C35.0988366,38.2216852 33.4888366,37.4843145 33.4388366,34.8545872 C33.3888366,32.7744565 33.7430954,32.2207578 33.8988366,31.9295788 C34.3117653,31.1575537 34.9128559,30.575799 35.3988366,30.1843145 C36.0681111,29.6451768 36.8014444,29.2451768 37.5988366,28.9843145 C37.4503711,28.8228789 37.3503711,28.6970685 37.2988366,28.6068833 C37.2473022,28.516698 37.2139689,28.4091751 37.1988366,28.2843145 Z",
|
|
3736
|
+
id: "Path",
|
|
3737
|
+
fill: "#F28700"
|
|
3738
|
+
})));
|
|
3739
|
+
};
|
|
3740
|
+
|
|
3741
|
+
var getPaneTitle = function getPaneTitle(sumOfErrors) {
|
|
3742
|
+
switch (sumOfErrors) {
|
|
3743
|
+
case 0:
|
|
3744
|
+
return 'Looks good';
|
|
3745
|
+
|
|
3746
|
+
case 1:
|
|
3747
|
+
return 'There is an issue to address';
|
|
3748
|
+
|
|
3749
|
+
default:
|
|
3750
|
+
return 'There are a few issues to address';
|
|
3751
|
+
}
|
|
3752
|
+
};
|
|
3753
|
+
|
|
3754
|
+
var capitalizeWord = function capitalizeWord(_ref) {
|
|
3755
|
+
var _ref2 = _toArray(_ref),
|
|
3756
|
+
firstLetter = _ref2[0],
|
|
3757
|
+
restOfWord = _ref2.slice(1);
|
|
3758
|
+
|
|
3759
|
+
return firstLetter.toUpperCase() + restOfWord.join('');
|
|
3760
|
+
};
|
|
3761
|
+
var humanizeErrorMessage = function humanizeErrorMessage(nameAsString) {
|
|
3762
|
+
var nameWithoutBrackets = nameAsString.replace(/[[\]']+/g, '');
|
|
3763
|
+
var nameLowerCase = nameWithoutBrackets.toLowerCase();
|
|
3764
|
+
|
|
3765
|
+
var _nameLowerCase$split$ = nameLowerCase.split(/([0-9]+)/) // split num bers from field and build array
|
|
3766
|
+
.filter(function (s) {
|
|
3767
|
+
return s.length;
|
|
3768
|
+
}),
|
|
3769
|
+
_nameLowerCase$split$2 = _slicedToArray(_nameLowerCase$split$, 2),
|
|
3770
|
+
fieldName = _nameLowerCase$split$2[0],
|
|
3771
|
+
fieldNumberedValue = _nameLowerCase$split$2[1];
|
|
3772
|
+
|
|
3773
|
+
var nameCapitalized = capitalizeWord(fieldName);
|
|
3774
|
+
|
|
3775
|
+
if (fieldNumberedValue) {
|
|
3776
|
+
// when name contains a number we assume it's a formgroup and we add a index +1 for human readability
|
|
3777
|
+
var fieldNumber = parseInt(fieldNumberedValue, 10) + 1;
|
|
3778
|
+
return "".concat(nameCapitalized, " ").concat(fieldNumber);
|
|
3779
|
+
}
|
|
3780
|
+
|
|
3781
|
+
return nameCapitalized;
|
|
3782
|
+
};
|
|
3783
|
+
var getErrorMessage = function getErrorMessage(error, index) {
|
|
3784
|
+
var name = error.ref.name;
|
|
3785
|
+
|
|
3786
|
+
var _name$split = name.split('.'),
|
|
3787
|
+
_name$split2 = _slicedToArray(_name$split, 1),
|
|
3788
|
+
firstNamePart = _name$split2[0];
|
|
3789
|
+
|
|
3790
|
+
var fieldErrorTitle = humanizeErrorMessage(firstNamePart);
|
|
3791
|
+
return "".concat(index + 1, ". ").concat(fieldErrorTitle, ": ").concat(error.message);
|
|
3792
|
+
};
|
|
3793
|
+
var MODAL_DIALOG_ELEMENT = 'modal-dialog';
|
|
3794
|
+
var useIssuesPane = function useIssuesPane() {
|
|
3795
|
+
var _React$useState = React.useState(false),
|
|
3796
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3797
|
+
isIssuesPaneOpen = _React$useState2[0],
|
|
3798
|
+
setIsIssuesPaneOpen = _React$useState2[1];
|
|
3799
|
+
|
|
3800
|
+
var _React$useState3 = React.useState(null),
|
|
3801
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3802
|
+
startPosition = _React$useState4[0],
|
|
3803
|
+
setStartPosition = _React$useState4[1];
|
|
3804
|
+
|
|
3805
|
+
var onToggleIssuesPane = function onToggleIssuesPane(isOpen, newPosition) {
|
|
3806
|
+
if (!startPosition) {
|
|
3807
|
+
setStartPosition(newPosition);
|
|
3808
|
+
}
|
|
3809
|
+
|
|
3810
|
+
setIsIssuesPaneOpen(isOpen);
|
|
3811
|
+
};
|
|
3812
|
+
|
|
3813
|
+
var onCloseIssuesPane = function onCloseIssuesPane() {
|
|
3814
|
+
return setIsIssuesPaneOpen(false);
|
|
3815
|
+
};
|
|
3816
|
+
|
|
3817
|
+
return {
|
|
3818
|
+
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
3819
|
+
startPosition: startPosition,
|
|
3820
|
+
onToggleIssuesPane: onToggleIssuesPane,
|
|
3821
|
+
onCloseIssuesPane: onCloseIssuesPane
|
|
3822
|
+
};
|
|
3823
|
+
};
|
|
3824
|
+
|
|
3825
|
+
var IssuesPane = function IssuesPane(_ref3) {
|
|
3826
|
+
var _ref3$errorList = _ref3.errorList,
|
|
3827
|
+
errorList = _ref3$errorList === void 0 ? [] : _ref3$errorList,
|
|
3828
|
+
isOpen = _ref3.isOpen,
|
|
3829
|
+
handleClose = _ref3.handleClose,
|
|
3830
|
+
_ref3$startPosition = _ref3.startPosition,
|
|
3831
|
+
startPosition = _ref3$startPosition === void 0 ? {
|
|
3832
|
+
left: 20,
|
|
3833
|
+
top: 50
|
|
3834
|
+
} : _ref3$startPosition;
|
|
3835
|
+
var rootElement = document.getElementById(MODAL_DIALOG_ELEMENT) || document.body;
|
|
3836
|
+
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement(ToolContainerDraggable, {
|
|
3837
|
+
startSize: {
|
|
3838
|
+
width: '577px',
|
|
3839
|
+
height: '200px'
|
|
3840
|
+
},
|
|
3841
|
+
startPosition: startPosition,
|
|
3842
|
+
minWidth: 300,
|
|
3843
|
+
onClose: handleClose,
|
|
3844
|
+
title: getPaneTitle(errorList.length),
|
|
3845
|
+
headerSize: "xs",
|
|
3846
|
+
isOpen: isOpen,
|
|
3847
|
+
"data-testid": "moveable-issues-pane",
|
|
3848
|
+
bounds: "parent"
|
|
3849
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
3850
|
+
component: "div",
|
|
3851
|
+
sx: {
|
|
3852
|
+
marginTop: '16px',
|
|
3853
|
+
marginLeft: '24px'
|
|
3854
|
+
}
|
|
3855
|
+
}, errorList.length === 0 && /*#__PURE__*/React.createElement(Box, {
|
|
3856
|
+
component: "div",
|
|
3857
|
+
sx: {
|
|
3858
|
+
fontSize: '4rem'
|
|
3859
|
+
},
|
|
3860
|
+
"data-testid": "zeroIssuesImage"
|
|
3861
|
+
}, /*#__PURE__*/React.createElement(ThumbsUp, null)), errorList.length > 0 && errorList.map(function (error, index) {
|
|
3862
|
+
return /*#__PURE__*/React.createElement(Typography // eslint-disable-next-line react/no-array-index-key
|
|
3863
|
+
, {
|
|
3864
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
3865
|
+
key: "message-".concat(index),
|
|
3866
|
+
variant: "body1",
|
|
3867
|
+
"data-testid": "errorMessage"
|
|
3868
|
+
}, getErrorMessage(error, index));
|
|
3869
|
+
}))), rootElement);
|
|
3870
|
+
};
|
|
3871
|
+
|
|
3872
|
+
var TafModuleContext = /*#__PURE__*/React.createContext({
|
|
3873
|
+
onValidateForm: null,
|
|
3874
|
+
registerValidateForm: null,
|
|
3875
|
+
tafAction: null,
|
|
3876
|
+
setTafAction: null,
|
|
3877
|
+
isFormDirty: null,
|
|
3878
|
+
setIsFormDirty: null
|
|
3879
|
+
});
|
|
3880
|
+
var useTafModuleContext = function useTafModuleContext() {
|
|
3881
|
+
return React.useContext(TafModuleContext);
|
|
3882
|
+
};
|
|
3883
|
+
var useTafModuleState = function useTafModuleState(_ref) {
|
|
3884
|
+
var onPreventCloseView = _ref.onPreventCloseView;
|
|
3885
|
+
|
|
3886
|
+
var _React$useState = React.useState(function () {
|
|
3887
|
+
return new Promise(function () {
|
|
3888
|
+
return true;
|
|
3889
|
+
});
|
|
3890
|
+
}),
|
|
3891
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3892
|
+
onValidateForm = _React$useState2[0],
|
|
3893
|
+
registerValidateForm = _React$useState2[1];
|
|
3894
|
+
|
|
3895
|
+
var _React$useState3 = React.useState(),
|
|
3896
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3897
|
+
tafAction = _React$useState4[0],
|
|
3898
|
+
setTafAction = _React$useState4[1];
|
|
3899
|
+
|
|
3900
|
+
var _React$useState5 = React.useState(false),
|
|
3901
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
3902
|
+
isFormDirty = _React$useState6[0],
|
|
3903
|
+
setIsFormDirty = _React$useState6[1];
|
|
3904
|
+
|
|
3905
|
+
var onRegisterValidateForm = function onRegisterValidateForm(promiseToRegister) {
|
|
3906
|
+
registerValidateForm(function () {
|
|
3907
|
+
return promiseToRegister;
|
|
3908
|
+
});
|
|
3909
|
+
};
|
|
3910
|
+
|
|
3911
|
+
var onChangeFormDirty = function onChangeFormDirty(isDirty) {
|
|
3912
|
+
if (isDirty !== isFormDirty) {
|
|
3913
|
+
setIsFormDirty(isDirty);
|
|
3914
|
+
onPreventCloseView(isDirty);
|
|
3915
|
+
}
|
|
3916
|
+
};
|
|
3917
|
+
|
|
3918
|
+
return {
|
|
3919
|
+
onValidateForm: onValidateForm,
|
|
3920
|
+
registerValidateForm: onRegisterValidateForm,
|
|
3921
|
+
tafAction: tafAction,
|
|
3922
|
+
setTafAction: setTafAction,
|
|
3923
|
+
isFormDirty: isFormDirty,
|
|
3924
|
+
setIsFormDirty: onChangeFormDirty
|
|
3925
|
+
};
|
|
3926
|
+
};
|
|
3927
|
+
var TafModuleProvider = function TafModuleProvider(_ref2) {
|
|
3928
|
+
var children = _ref2.children,
|
|
3929
|
+
_ref2$onPreventCloseV = _ref2.onPreventCloseView,
|
|
3930
|
+
onPreventCloseView = _ref2$onPreventCloseV === void 0 ? function () {} : _ref2$onPreventCloseV;
|
|
3931
|
+
var contextState = useTafModuleState({
|
|
3932
|
+
onPreventCloseView: onPreventCloseView
|
|
3933
|
+
});
|
|
3934
|
+
return /*#__PURE__*/React.createElement(TafModuleContext.Provider, {
|
|
3935
|
+
value: contextState
|
|
3936
|
+
}, children);
|
|
3937
|
+
};
|
|
3938
|
+
|
|
3939
|
+
var noop = function noop() {};
|
|
3940
|
+
|
|
3941
|
+
var TafForm = function TafForm(_ref) {
|
|
3942
|
+
var tafFromBackend = _ref.tafFromBackend,
|
|
3943
|
+
_ref$onFormAction = _ref.onFormAction,
|
|
3944
|
+
onFormAction = _ref$onFormAction === void 0 ? function () {
|
|
3945
|
+
return null;
|
|
3946
|
+
} : _ref$onFormAction,
|
|
3947
|
+
_ref$isIssuesPaneOpen = _ref.isIssuesPaneOpen,
|
|
3948
|
+
isIssuesPaneOpen = _ref$isIssuesPaneOpen === void 0 ? false : _ref$isIssuesPaneOpen,
|
|
3949
|
+
_ref$setIsIssuesPaneO = _ref.setIsIssuesPaneOpen,
|
|
3950
|
+
setIsIssuesPaneOpen = _ref$setIsIssuesPaneO === void 0 ? function () {
|
|
3951
|
+
return null;
|
|
3952
|
+
} : _ref$setIsIssuesPaneO,
|
|
3953
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
3954
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
3955
|
+
_ref$setIsDisabled = _ref.setIsDisabled,
|
|
3956
|
+
setIsDisabled = _ref$setIsDisabled === void 0 ? function () {
|
|
3957
|
+
return null;
|
|
3958
|
+
} : _ref$setIsDisabled;
|
|
3959
|
+
var originalTaf = tafFromBackend.taf;
|
|
3960
|
+
var isDefaultDisabled = getIsFormDefaultDisabled(tafFromBackend.taf.status);
|
|
3961
|
+
var confirmDialog = useConfirmationDialog();
|
|
3962
|
+
|
|
3963
|
+
var _useDraftFormHelpers = useDraftFormHelpers(true),
|
|
3964
|
+
toggleIsDraft = _useDraftFormHelpers.toggleIsDraft,
|
|
3965
|
+
DraftFieldHelper = _useDraftFormHelpers.DraftFieldHelper;
|
|
3966
|
+
|
|
3967
|
+
var _useTafModuleContext = useTafModuleContext(),
|
|
3968
|
+
registerValidateForm = _useTafModuleContext.registerValidateForm,
|
|
3969
|
+
tafAction = _useTafModuleContext.tafAction,
|
|
3970
|
+
setTafAction = _useTafModuleContext.setTafAction,
|
|
3971
|
+
setIsFormDirty = _useTafModuleContext.setIsFormDirty;
|
|
3972
|
+
|
|
3973
|
+
var _useApiContext = useApiContext(),
|
|
3974
|
+
api = _useApiContext.api;
|
|
3975
|
+
|
|
3976
|
+
var _useIsMounted = useIsMounted(),
|
|
3977
|
+
isMounted = _useIsMounted.isMounted;
|
|
3978
|
+
|
|
3979
|
+
var _useFormContext = useFormContext(),
|
|
3980
|
+
control = _useFormContext.control,
|
|
3981
|
+
handleSubmit = _useFormContext.handleSubmit,
|
|
3982
|
+
trigger = _useFormContext.trigger,
|
|
3983
|
+
formState = _useFormContext.formState,
|
|
3831
3984
|
getValues = _useFormContext.getValues,
|
|
3832
3985
|
setValue = _useFormContext.setValue,
|
|
3833
3986
|
reset = _useFormContext.reset;
|
|
@@ -3837,12 +3990,12 @@ var TafForm = function TafForm(_ref) {
|
|
|
3837
3990
|
usePreventBrowserClose(isFormDirty && !isDisabled);
|
|
3838
3991
|
var hiddenInputFields = ['baseTime', 'issueDate', 'type', 'uuid', 'validDateStart', 'validDateEnd', 'status', 'previousId', 'previousValidDateStart', 'previousValidDateEnd'];
|
|
3839
3992
|
|
|
3840
|
-
var _React$
|
|
3841
|
-
_React$
|
|
3842
|
-
delayedFormValues = _React$
|
|
3843
|
-
setDelayedFormValues = _React$
|
|
3993
|
+
var _React$useState = React__default.useState(getValues()),
|
|
3994
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3995
|
+
delayedFormValues = _React$useState2[0],
|
|
3996
|
+
setDelayedFormValues = _React$useState2[1];
|
|
3844
3997
|
|
|
3845
|
-
var _useTACGenerator = useTACGenerator(
|
|
3998
|
+
var _useTACGenerator = useTACGenerator(tafFromBackend.taf, api.getTAC),
|
|
3846
3999
|
_useTACGenerator2 = _slicedToArray(_useTACGenerator, 2),
|
|
3847
4000
|
TAC = _useTACGenerator2[0],
|
|
3848
4001
|
updateTAC = _useTACGenerator2[1];
|
|
@@ -3854,7 +4007,7 @@ var TafForm = function TafForm(_ref) {
|
|
|
3854
4007
|
};
|
|
3855
4008
|
|
|
3856
4009
|
React__default.useEffect(function () {
|
|
3857
|
-
if (
|
|
4010
|
+
if (isMounted.current && isFormDirty) {
|
|
3858
4011
|
var newTAC = hasErrors ? null : convertTafValuesToObject(delayedFormValues);
|
|
3859
4012
|
updateTAC(newTAC);
|
|
3860
4013
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -3866,7 +4019,11 @@ var TafForm = function TafForm(_ref) {
|
|
|
3866
4019
|
updateTAC(convertTafValuesToObject(delayedFormValues));
|
|
3867
4020
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3868
4021
|
|
|
3869
|
-
}, [hasErrors]);
|
|
4022
|
+
}, [hasErrors]); // Needed to be able to show a confirmation dialog on switching tabs when form is edited and not saved
|
|
4023
|
+
|
|
4024
|
+
React__default.useEffect(function () {
|
|
4025
|
+
setIsFormDirty(isFormDirty);
|
|
4026
|
+
}, [isFormDirty, setIsFormDirty]);
|
|
3870
4027
|
|
|
3871
4028
|
var onSubmit = function onSubmit(data) {
|
|
3872
4029
|
// eslint-disable-next-line no-console
|
|
@@ -3907,6 +4064,7 @@ var TafForm = function TafForm(_ref) {
|
|
|
3907
4064
|
toggleIsDraft(true);
|
|
3908
4065
|
handleSubmit(function (data) {
|
|
3909
4066
|
onFormAction(action, convertTafValuesToObject(data));
|
|
4067
|
+
reset(getValues());
|
|
3910
4068
|
})();
|
|
3911
4069
|
break;
|
|
3912
4070
|
|
|
@@ -3968,7 +4126,7 @@ var TafForm = function TafForm(_ref) {
|
|
|
3968
4126
|
switch (action) {
|
|
3969
4127
|
case 'CANCEL':
|
|
3970
4128
|
showConfirmDialog(action).then(function () {
|
|
3971
|
-
onFormAction(action, tafFromBackend.taf);
|
|
4129
|
+
onFormAction(action, convertTafValuesToObject(prepareTafValues(tafFromBackend.taf, action)));
|
|
3972
4130
|
});
|
|
3973
4131
|
break;
|
|
3974
4132
|
|
|
@@ -4059,16 +4217,58 @@ var TafForm = function TafForm(_ref) {
|
|
|
4059
4217
|
});
|
|
4060
4218
|
};
|
|
4061
4219
|
|
|
4220
|
+
var _React$useState3 = React__default.useState(false),
|
|
4221
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
4222
|
+
shouldValidate = _React$useState4[0],
|
|
4223
|
+
setShouldValidate = _React$useState4[1];
|
|
4224
|
+
|
|
4225
|
+
React__default.useEffect(function () {
|
|
4226
|
+
setIsDisabled(isDefaultDisabled);
|
|
4227
|
+
var defaultValues = prepareTafValues(tafFromBackend.taf, undefined, !isDefaultDisabled && !tafFromBackend.taf.changeGroups); // set initial form values
|
|
4228
|
+
|
|
4229
|
+
reset(defaultValues); // set validate flag to validate after the values have been set
|
|
4230
|
+
|
|
4231
|
+
setShouldValidate(true); // register validate method to use in parent components
|
|
4232
|
+
|
|
4233
|
+
var onValidateFormPromise = function onValidateFormPromise() {
|
|
4234
|
+
return new Promise(function (resolve, reject) {
|
|
4235
|
+
toggleIsDraft(true);
|
|
4236
|
+
handleSubmit(function (formData) {
|
|
4237
|
+
resolve(convertTafValuesToObject(formData));
|
|
4238
|
+
})().then(function (formData) {
|
|
4239
|
+
if (formData === undefined) {
|
|
4240
|
+
reject();
|
|
4241
|
+
}
|
|
4242
|
+
|
|
4243
|
+
resolve(formData);
|
|
4244
|
+
});
|
|
4245
|
+
});
|
|
4246
|
+
};
|
|
4247
|
+
|
|
4248
|
+
registerValidateForm(onValidateFormPromise); // set default taf action
|
|
4249
|
+
|
|
4250
|
+
setTafAction(fromStatusToAction(originalTaf.status));
|
|
4251
|
+
return function () {
|
|
4252
|
+
reset({});
|
|
4253
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4254
|
+
}, []);
|
|
4255
|
+
React__default.useEffect(function () {
|
|
4256
|
+
var newValues = prepareTafValues(tafFromBackend.taf, undefined, !isDefaultDisabled && !tafFromBackend.taf.changeGroups); // set new form values when tafFromBackend changed
|
|
4257
|
+
|
|
4258
|
+
reset(newValues); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4259
|
+
}, [tafFromBackend]);
|
|
4062
4260
|
React__default.useEffect(function () {
|
|
4063
|
-
if (!isDisabled) {
|
|
4261
|
+
if (shouldValidate && !isDisabled) {
|
|
4064
4262
|
// trigger validation on all changegroup validity times after initial load since they could be outside the new validity period
|
|
4065
|
-
var
|
|
4263
|
+
var _tafFromBackend$taf$c = tafFromBackend.taf.changeGroups,
|
|
4264
|
+
changeGroups = _tafFromBackend$taf$c === void 0 ? [] : _tafFromBackend$taf$c;
|
|
4265
|
+
var validFields = changeGroups.map(function (_field, index) {
|
|
4066
4266
|
return "changeGroups[".concat(index, "].valid");
|
|
4067
4267
|
});
|
|
4068
4268
|
trigger(validFields);
|
|
4069
4269
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4070
4270
|
|
|
4071
|
-
}, []);
|
|
4271
|
+
}, [shouldValidate]);
|
|
4072
4272
|
return /*#__PURE__*/React__default.createElement("form", {
|
|
4073
4273
|
"data-testid": "taf-form",
|
|
4074
4274
|
onSubmit: handleSubmit(onSubmit),
|
|
@@ -4146,7 +4346,9 @@ var TafForm = function TafForm(_ref) {
|
|
|
4146
4346
|
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4147
4347
|
item: true
|
|
4148
4348
|
}, /*#__PURE__*/React__default.createElement(IssuesButton, {
|
|
4149
|
-
errors: errors
|
|
4349
|
+
errors: errors,
|
|
4350
|
+
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
4351
|
+
setIsIssuesPaneOpen: setIsIssuesPaneOpen
|
|
4150
4352
|
}))), /*#__PURE__*/React__default.createElement(TafFormButtons, {
|
|
4151
4353
|
isFormDisabled: isDisabled,
|
|
4152
4354
|
tafAction: tafAction,
|
|
@@ -4161,50 +4363,6 @@ var TafForm = function TafForm(_ref) {
|
|
|
4161
4363
|
}), /*#__PURE__*/React__default.createElement(DraftFieldHelper, null));
|
|
4162
4364
|
};
|
|
4163
4365
|
|
|
4164
|
-
/* *
|
|
4165
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4166
|
-
* you may not use this file except in compliance with the License.
|
|
4167
|
-
* You may obtain a copy of the License at
|
|
4168
|
-
*
|
|
4169
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4170
|
-
*
|
|
4171
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
4172
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4173
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4174
|
-
* See the License for the specific language governing permissions and
|
|
4175
|
-
* limitations under the License.
|
|
4176
|
-
*
|
|
4177
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4178
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
4179
|
-
* */
|
|
4180
|
-
|
|
4181
|
-
var TafFormWrapper = function TafFormWrapper(_ref) {
|
|
4182
|
-
var tafFromBackend = _ref.tafFromBackend,
|
|
4183
|
-
mode = _ref.mode,
|
|
4184
|
-
_ref$TAC = _ref.TAC,
|
|
4185
|
-
TAC = _ref$TAC === void 0 ? '' : _ref$TAC,
|
|
4186
|
-
onFormAction = _ref.onFormAction,
|
|
4187
|
-
tafAction = _ref.tafAction;
|
|
4188
|
-
var taf = tafFromBackend.taf;
|
|
4189
|
-
var isDisabled = mode === 'view';
|
|
4190
|
-
var defaultValues = prepareTafValues(taf, undefined, !isDisabled && !taf.changeGroups);
|
|
4191
|
-
var options = {
|
|
4192
|
-
defaultValues: defaultValues,
|
|
4193
|
-
mode: 'onTouched',
|
|
4194
|
-
reValidateMode: 'onChange',
|
|
4195
|
-
criteriaMode: 'all'
|
|
4196
|
-
};
|
|
4197
|
-
return /*#__PURE__*/React__default.createElement(ReactHookFormProvider, {
|
|
4198
|
-
options: options
|
|
4199
|
-
}, /*#__PURE__*/React__default.createElement(TafForm, {
|
|
4200
|
-
isDisabled: isDisabled,
|
|
4201
|
-
staticTAC: TAC,
|
|
4202
|
-
onFormAction: onFormAction,
|
|
4203
|
-
tafFromBackend: tafFromBackend,
|
|
4204
|
-
tafAction: tafAction
|
|
4205
|
-
}));
|
|
4206
|
-
};
|
|
4207
|
-
|
|
4208
4366
|
/* *
|
|
4209
4367
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4210
4368
|
* you may not use this file except in compliance with the License.
|
|
@@ -4384,6 +4542,20 @@ var muiTabA11yProps = function muiTabA11yProps(index) {
|
|
|
4384
4542
|
'aria-controls': "simple-tabpanel-".concat(index)
|
|
4385
4543
|
};
|
|
4386
4544
|
};
|
|
4545
|
+
var prepareTafExportValues = function prepareTafExportValues(tafToCopy, currentTaf) {
|
|
4546
|
+
var _a;
|
|
4547
|
+
|
|
4548
|
+
var convertedCopy = prepareTafValues(tafToCopy, undefined, false);
|
|
4549
|
+
var baseForecast = convertedCopy.baseForecast,
|
|
4550
|
+
_convertedCopy$change = convertedCopy.changeGroups,
|
|
4551
|
+
changeGroups = _convertedCopy$change === void 0 ? [] : _convertedCopy$change;
|
|
4552
|
+
return Object.assign(Object.assign({}, currentTaf), {
|
|
4553
|
+
baseForecast: Object.assign(Object.assign(Object.assign({}, emptyBaseForecast), baseForecast), {
|
|
4554
|
+
valid: (_a = currentTaf === null || currentTaf === void 0 ? void 0 : currentTaf.baseForecast) === null || _a === void 0 ? void 0 : _a.valid
|
|
4555
|
+
}),
|
|
4556
|
+
changeGroups: changeGroups
|
|
4557
|
+
});
|
|
4558
|
+
};
|
|
4387
4559
|
|
|
4388
4560
|
/* *
|
|
4389
4561
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -4401,15 +4573,9 @@ var muiTabA11yProps = function muiTabA11yProps(index) {
|
|
|
4401
4573
|
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4402
4574
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
4403
4575
|
* */
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
return /*#__PURE__*/React.createElement(SvgIcon, Object.assign({}, props), /*#__PURE__*/React.createElement("g", null, /*#__PURE__*/React.createElement("path", {
|
|
4408
|
-
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",
|
|
4409
|
-
fillRule: "evenodd",
|
|
4410
|
-
fill: "".concat(theme.palette.geowebColors.buttons.tertiary["default"].color)
|
|
4411
|
-
})));
|
|
4412
|
-
};
|
|
4576
|
+
var EditIcon = createSvgIcon( /*#__PURE__*/React.createElement("path", {
|
|
4577
|
+
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"
|
|
4578
|
+
}), 'Edit');
|
|
4413
4579
|
|
|
4414
4580
|
var StatusIcon = function StatusIcon(_ref) {
|
|
4415
4581
|
var timeSlot = _ref.timeSlot,
|
|
@@ -4420,51 +4586,104 @@ var StatusIcon = function StatusIcon(_ref) {
|
|
|
4420
4586
|
}
|
|
4421
4587
|
|
|
4422
4588
|
if (status === 'EXPIRED') {
|
|
4423
|
-
return /*#__PURE__*/React.createElement(
|
|
4589
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
4590
|
+
title: "Expired",
|
|
4591
|
+
placement: "right"
|
|
4592
|
+
}, /*#__PURE__*/React.createElement(Schedule, {
|
|
4424
4593
|
"data-testid": "status-expired",
|
|
4425
4594
|
fontSize: "small",
|
|
4426
4595
|
sx: {
|
|
4427
4596
|
transform: 'scaleX(-1)',
|
|
4428
4597
|
color: 'geowebColors.buttons.tertiary.disabled.color'
|
|
4429
4598
|
}
|
|
4430
|
-
});
|
|
4599
|
+
}));
|
|
4431
4600
|
}
|
|
4432
4601
|
|
|
4433
4602
|
if (status === 'CANCELLED') {
|
|
4434
|
-
return /*#__PURE__*/React.createElement(
|
|
4603
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
4604
|
+
title: "Cancelled",
|
|
4605
|
+
placement: "right"
|
|
4606
|
+
}, /*#__PURE__*/React.createElement(DoDisturbIcon, {
|
|
4435
4607
|
"data-testid": "status-cancelled",
|
|
4436
4608
|
fontSize: "small",
|
|
4437
4609
|
sx: {
|
|
4438
4610
|
color: 'geowebColors.captions.captionError.rgba'
|
|
4439
4611
|
}
|
|
4440
|
-
});
|
|
4612
|
+
}));
|
|
4441
4613
|
}
|
|
4442
4614
|
|
|
4443
4615
|
if (status === 'DRAFT' || status === 'DRAFT_CORRECTED' || status === 'DRAFT_AMENDED') {
|
|
4444
|
-
return /*#__PURE__*/React.createElement(
|
|
4445
|
-
|
|
4446
|
-
|
|
4616
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
4617
|
+
title: "Draft",
|
|
4618
|
+
placement: "right"
|
|
4619
|
+
}, /*#__PURE__*/React.createElement(SvgIcon, {
|
|
4620
|
+
component: EditIcon,
|
|
4621
|
+
"data-testid": "status-draft",
|
|
4622
|
+
sx: {
|
|
4623
|
+
color: 'geowebColors.buttons.tertiary.default.color'
|
|
4624
|
+
}
|
|
4625
|
+
}));
|
|
4447
4626
|
}
|
|
4448
4627
|
|
|
4449
|
-
return timeSlot === 'ACTIVE' ? /*#__PURE__*/React.createElement(
|
|
4628
|
+
return timeSlot === 'ACTIVE' ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
4629
|
+
title: "Active",
|
|
4630
|
+
placement: "right"
|
|
4631
|
+
}, /*#__PURE__*/React.createElement(CheckCircle, {
|
|
4450
4632
|
"data-testid": "status-active",
|
|
4451
4633
|
fontSize: "small",
|
|
4452
4634
|
sx: {
|
|
4453
4635
|
color: 'geowebColors.functional.success'
|
|
4454
4636
|
}
|
|
4455
|
-
}) : /*#__PURE__*/React.createElement(
|
|
4637
|
+
})) : /*#__PURE__*/React.createElement(Tooltip, {
|
|
4638
|
+
title: "Upcoming",
|
|
4639
|
+
placement: "right"
|
|
4640
|
+
}, /*#__PURE__*/React.createElement(Schedule, {
|
|
4456
4641
|
"data-testid": "status-upcoming",
|
|
4457
4642
|
fontSize: "small",
|
|
4458
4643
|
sx: {
|
|
4459
4644
|
color: 'geowebColors.functional.success'
|
|
4460
4645
|
}
|
|
4461
|
-
});
|
|
4646
|
+
}));
|
|
4647
|
+
};
|
|
4648
|
+
|
|
4649
|
+
/* *
|
|
4650
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4651
|
+
* you may not use this file except in compliance with the License.
|
|
4652
|
+
* You may obtain a copy of the License at
|
|
4653
|
+
*
|
|
4654
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4655
|
+
*
|
|
4656
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
4657
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4658
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4659
|
+
* See the License for the specific language governing permissions and
|
|
4660
|
+
* limitations under the License.
|
|
4661
|
+
*
|
|
4662
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4663
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
4664
|
+
* */
|
|
4665
|
+
var ExportIcon = /*#__PURE__*/React__default.createElement(SvgIcon, null, /*#__PURE__*/React__default.createElement("path", {
|
|
4666
|
+
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"
|
|
4667
|
+
}));
|
|
4668
|
+
|
|
4669
|
+
var ExportButton = function ExportButton(_ref) {
|
|
4670
|
+
var onClick = _ref.onClick,
|
|
4671
|
+
isHidden = _ref.isHidden;
|
|
4672
|
+
return isHidden ? null : /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
4673
|
+
title: "Import TAC",
|
|
4674
|
+
placement: "left"
|
|
4675
|
+
}, /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement(ToolButton, {
|
|
4676
|
+
onClick: onClick,
|
|
4677
|
+
"data-testid": "export-tac-button"
|
|
4678
|
+
}, ExportIcon)));
|
|
4462
4679
|
};
|
|
4463
4680
|
|
|
4464
4681
|
var TacContainer = function TacContainer(_ref) {
|
|
4465
4682
|
var taf = _ref.taf,
|
|
4466
4683
|
_ref$isActive = _ref.isActive,
|
|
4467
|
-
isActive = _ref$isActive === void 0 ? false : _ref$isActive
|
|
4684
|
+
isActive = _ref$isActive === void 0 ? false : _ref$isActive,
|
|
4685
|
+
_ref$isFormDisabled = _ref.isFormDisabled,
|
|
4686
|
+
isFormDisabled = _ref$isFormDisabled === void 0 ? false : _ref$isFormDisabled;
|
|
4468
4687
|
|
|
4469
4688
|
var _useApiContext = useApiContext(),
|
|
4470
4689
|
api = _useApiContext.api;
|
|
@@ -4479,6 +4698,26 @@ var TacContainer = function TacContainer(_ref) {
|
|
|
4479
4698
|
baseTime = taf.baseTime;
|
|
4480
4699
|
var locationLabel = getLocationSetting(location).label;
|
|
4481
4700
|
var timeSlot = getTafTimeSlot(baseTime, location, status);
|
|
4701
|
+
|
|
4702
|
+
var _useFormContext = useFormContext(),
|
|
4703
|
+
getValues = _useFormContext.getValues,
|
|
4704
|
+
trigger = _useFormContext.trigger,
|
|
4705
|
+
setValue = _useFormContext.setValue;
|
|
4706
|
+
|
|
4707
|
+
var handleExport = function handleExport() {
|
|
4708
|
+
var currentTaf = getValues();
|
|
4709
|
+
var newTaf = prepareTafExportValues(taf, currentTaf);
|
|
4710
|
+
setValue('baseForecast', newTaf.baseForecast, {
|
|
4711
|
+
shouldDirty: true
|
|
4712
|
+
});
|
|
4713
|
+
setValue('changeGroups', newTaf.changeGroups, {
|
|
4714
|
+
shouldDirty: true
|
|
4715
|
+
});
|
|
4716
|
+
setTimeout(function () {
|
|
4717
|
+
trigger(); // trigger all fields validation
|
|
4718
|
+
}, 0);
|
|
4719
|
+
};
|
|
4720
|
+
|
|
4482
4721
|
React__default.useEffect(function () {
|
|
4483
4722
|
if (isActive) {
|
|
4484
4723
|
retrieveTAC(taf);
|
|
@@ -4494,14 +4733,22 @@ var TacContainer = function TacContainer(_ref) {
|
|
|
4494
4733
|
sx: {
|
|
4495
4734
|
display: 'flex',
|
|
4496
4735
|
alignItems: 'center',
|
|
4497
|
-
|
|
4736
|
+
justifyContent: 'space-between',
|
|
4737
|
+
height: 24
|
|
4498
4738
|
}
|
|
4499
4739
|
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
4500
4740
|
sx: {
|
|
4501
|
-
width: 20,
|
|
4502
|
-
height: 20,
|
|
4503
4741
|
display: 'flex',
|
|
4504
|
-
|
|
4742
|
+
alignItems: 'center'
|
|
4743
|
+
}
|
|
4744
|
+
}, /*#__PURE__*/React__default.createElement(Box, {
|
|
4745
|
+
sx: {
|
|
4746
|
+
width: 24,
|
|
4747
|
+
height: 24,
|
|
4748
|
+
display: 'flex',
|
|
4749
|
+
marginRight: '2px',
|
|
4750
|
+
alignItems: 'center',
|
|
4751
|
+
justifyContent: 'center'
|
|
4505
4752
|
}
|
|
4506
4753
|
}, /*#__PURE__*/React__default.createElement(StatusIcon, {
|
|
4507
4754
|
timeSlot: timeSlot,
|
|
@@ -4528,7 +4775,10 @@ var TacContainer = function TacContainer(_ref) {
|
|
|
4528
4775
|
},
|
|
4529
4776
|
"data-testid": "tafLocationLabel",
|
|
4530
4777
|
component: "span"
|
|
4531
|
-
}, locationLabel))), /*#__PURE__*/React__default.createElement(
|
|
4778
|
+
}, locationLabel))), /*#__PURE__*/React__default.createElement(ExportButton, {
|
|
4779
|
+
onClick: handleExport,
|
|
4780
|
+
isHidden: isFormDisabled || tacHasError(TAC)
|
|
4781
|
+
})), /*#__PURE__*/React__default.createElement(Box, {
|
|
4532
4782
|
sx: {
|
|
4533
4783
|
fontSize: '12px',
|
|
4534
4784
|
letterSpacing: '0.4px',
|
|
@@ -4564,7 +4814,9 @@ var TacOverview = function TacOverview(_ref) {
|
|
|
4564
4814
|
_ref$hideTitle = _ref.hideTitle,
|
|
4565
4815
|
hideTitle = _ref$hideTitle === void 0 ? false : _ref$hideTitle,
|
|
4566
4816
|
_ref$activeTaf = _ref.activeTaf,
|
|
4567
|
-
activeTaf = _ref$activeTaf === void 0 ? null : _ref$activeTaf
|
|
4817
|
+
activeTaf = _ref$activeTaf === void 0 ? null : _ref$activeTaf,
|
|
4818
|
+
_ref$isFormDisabled = _ref.isFormDisabled,
|
|
4819
|
+
isFormDisabled = _ref$isFormDisabled === void 0 ? false : _ref$isFormDisabled;
|
|
4568
4820
|
|
|
4569
4821
|
var _React$useState = React__default.useState(0),
|
|
4570
4822
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -4661,7 +4913,8 @@ var TacOverview = function TacOverview(_ref) {
|
|
|
4661
4913
|
return /*#__PURE__*/React__default.createElement(TacContainer, {
|
|
4662
4914
|
key: taf.uuid,
|
|
4663
4915
|
taf: taf,
|
|
4664
|
-
isActive: isActiveLocation(taf.location)
|
|
4916
|
+
isActive: isActiveLocation(taf.location),
|
|
4917
|
+
isFormDisabled: isFormDisabled
|
|
4665
4918
|
});
|
|
4666
4919
|
}));
|
|
4667
4920
|
})));
|
|
@@ -4744,6 +4997,7 @@ var TacOverviewMobile = function TacOverviewMobile(_ref) {
|
|
|
4744
4997
|
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4745
4998
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
4746
4999
|
* */
|
|
5000
|
+
|
|
4747
5001
|
var formatBaseTime = function formatBaseTime(time) {
|
|
4748
5002
|
return time.format('HH:mm DD MMM');
|
|
4749
5003
|
};
|
|
@@ -4752,7 +5006,13 @@ var TopTabs = function TopTabs(_ref) {
|
|
|
4752
5006
|
var timeSlot = _ref.timeSlot,
|
|
4753
5007
|
_ref$onChangeTimeSlot = _ref.onChangeTimeSlot,
|
|
4754
5008
|
onChangeTimeSlot = _ref$onChangeTimeSlot === void 0 ? function () {} : _ref$onChangeTimeSlot,
|
|
4755
|
-
tafFromBackend = _ref.tafFromBackend
|
|
5009
|
+
_ref$tafFromBackend = _ref.tafFromBackend,
|
|
5010
|
+
tafFromBackend = _ref$tafFromBackend === void 0 ? {
|
|
5011
|
+
taf: {
|
|
5012
|
+
baseTime: '2022-01-06T12:00:00Z',
|
|
5013
|
+
location: 'EHAM'
|
|
5014
|
+
}
|
|
5015
|
+
} : _ref$tafFromBackend;
|
|
4756
5016
|
|
|
4757
5017
|
if (!tafFromBackend) {
|
|
4758
5018
|
return null;
|
|
@@ -4780,12 +5040,13 @@ var TopTabs = function TopTabs(_ref) {
|
|
|
4780
5040
|
value: activeTab,
|
|
4781
5041
|
onChange: onChangeTab,
|
|
4782
5042
|
"aria-label": "timeslot-tabs",
|
|
5043
|
+
"data-testid": "timeslot-tabs",
|
|
4783
5044
|
variant: "fullWidth"
|
|
4784
5045
|
}, tabs.map(function (tab, index) {
|
|
4785
5046
|
return /*#__PURE__*/React__default.createElement(Tab, Object.assign({
|
|
4786
5047
|
key: tab.title,
|
|
4787
5048
|
label: tab.title,
|
|
4788
|
-
"data-testid": "
|
|
5049
|
+
"data-testid": "toptab-".concat(index),
|
|
4789
5050
|
sx: {
|
|
4790
5051
|
fontSize: 16
|
|
4791
5052
|
}
|
|
@@ -4922,15 +5183,22 @@ var fromActionToStatus = function fromActionToStatus(tafAction) {
|
|
|
4922
5183
|
}
|
|
4923
5184
|
};
|
|
4924
5185
|
|
|
4925
|
-
var
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
5186
|
+
var parseErrorMessage = function parseErrorMessage(error, params) {
|
|
5187
|
+
return params.changeStatusTo === 'CANCELLED' ? {
|
|
5188
|
+
type: 'CANCELLED',
|
|
5189
|
+
title: 'Cancelling this TAF failed, please try again'
|
|
5190
|
+
} : {
|
|
5191
|
+
type: 'SERVER',
|
|
5192
|
+
title: 'An error has occurred while saving, please try again',
|
|
5193
|
+
message: getAxiosErrorMessage(error)
|
|
5194
|
+
};
|
|
5195
|
+
};
|
|
4931
5196
|
|
|
4932
|
-
|
|
4933
|
-
|
|
5197
|
+
var usePostTafRequest = function usePostTafRequest(request) {
|
|
5198
|
+
var errorParser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : parseErrorMessage;
|
|
5199
|
+
|
|
5200
|
+
var _useIsMounted = useIsMounted(),
|
|
5201
|
+
isMounted = _useIsMounted.isMounted;
|
|
4934
5202
|
|
|
4935
5203
|
var _React$useState = React__default.useState(false),
|
|
4936
5204
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -4940,67 +5208,92 @@ var TafPanel = function TafPanel(_ref) {
|
|
|
4940
5208
|
var _React$useState3 = React__default.useState(null),
|
|
4941
5209
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
4942
5210
|
error = _React$useState4[0],
|
|
4943
|
-
setError = _React$useState4[1];
|
|
4944
|
-
|
|
5211
|
+
setError = _React$useState4[1];
|
|
4945
5212
|
|
|
4946
|
-
|
|
4947
|
-
var cancelErrorTimeout = error && error.type === 'CANCELLED' ? setTimeout(function () {
|
|
4948
|
-
setError(null);
|
|
4949
|
-
}, 10000) : null;
|
|
4950
|
-
return function () {
|
|
4951
|
-
if (cancelErrorTimeout !== null) {
|
|
4952
|
-
clearTimeout(cancelErrorTimeout);
|
|
4953
|
-
}
|
|
4954
|
-
};
|
|
4955
|
-
}, [error]);
|
|
4956
|
-
|
|
4957
|
-
var postTaf = function postTaf(data) {
|
|
5213
|
+
var doRequest = function doRequest(params) {
|
|
4958
5214
|
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
4959
|
-
var
|
|
5215
|
+
var newErrorr;
|
|
4960
5216
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
4961
5217
|
while (1) {
|
|
4962
5218
|
switch (_context.prev = _context.next) {
|
|
4963
5219
|
case 0:
|
|
4964
|
-
_context.prev = 0;
|
|
4965
5220
|
setLoading(true);
|
|
4966
|
-
|
|
4967
|
-
|
|
5221
|
+
setError(null);
|
|
5222
|
+
_context.prev = 2;
|
|
5223
|
+
_context.next = 5;
|
|
5224
|
+
return request(params);
|
|
5225
|
+
|
|
5226
|
+
case 5:
|
|
5227
|
+
if (isMounted.current) {
|
|
5228
|
+
_context.next = 7;
|
|
5229
|
+
break;
|
|
5230
|
+
}
|
|
4968
5231
|
|
|
4969
|
-
|
|
4970
|
-
setLoading(false);
|
|
4971
|
-
setError(null); // callback
|
|
5232
|
+
return _context.abrupt("return");
|
|
4972
5233
|
|
|
4973
|
-
|
|
4974
|
-
|
|
5234
|
+
case 7:
|
|
5235
|
+
setLoading(false);
|
|
5236
|
+
setError(null);
|
|
5237
|
+
_context.next = 19;
|
|
4975
5238
|
break;
|
|
4976
5239
|
|
|
4977
|
-
case
|
|
4978
|
-
_context.prev =
|
|
4979
|
-
_context.t0 = _context["catch"](
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
};
|
|
4988
|
-
setError(newError);
|
|
4989
|
-
setLoading(false);
|
|
4990
|
-
throw _context.t0;
|
|
5240
|
+
case 11:
|
|
5241
|
+
_context.prev = 11;
|
|
5242
|
+
_context.t0 = _context["catch"](2);
|
|
5243
|
+
|
|
5244
|
+
if (isMounted.current) {
|
|
5245
|
+
_context.next = 15;
|
|
5246
|
+
break;
|
|
5247
|
+
}
|
|
5248
|
+
|
|
5249
|
+
return _context.abrupt("return");
|
|
4991
5250
|
|
|
4992
5251
|
case 15:
|
|
5252
|
+
newErrorr = errorParser ? errorParser(_context.t0, params) : _context.t0;
|
|
5253
|
+
setLoading(false);
|
|
5254
|
+
setError(newErrorr);
|
|
5255
|
+
throw newErrorr;
|
|
5256
|
+
|
|
5257
|
+
case 19:
|
|
4993
5258
|
case "end":
|
|
4994
5259
|
return _context.stop();
|
|
4995
5260
|
}
|
|
4996
5261
|
}
|
|
4997
|
-
}, _callee, null, [[
|
|
5262
|
+
}, _callee, null, [[2, 11]]);
|
|
4998
5263
|
}));
|
|
4999
5264
|
};
|
|
5000
5265
|
|
|
5001
|
-
|
|
5002
|
-
|
|
5266
|
+
return {
|
|
5267
|
+
isLoading: isLoading,
|
|
5268
|
+
error: error,
|
|
5269
|
+
setError: setError,
|
|
5270
|
+
doRequest: doRequest
|
|
5003
5271
|
};
|
|
5272
|
+
};
|
|
5273
|
+
|
|
5274
|
+
var TafPanel = function TafPanel(_ref) {
|
|
5275
|
+
var tafFromBackend = _ref.tafFromBackend,
|
|
5276
|
+
activeTafIndex = _ref.activeTafIndex,
|
|
5277
|
+
index = _ref.index,
|
|
5278
|
+
_ref$isLoading = _ref.isLoading,
|
|
5279
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
5280
|
+
_ref$postTaf = _ref.postTaf,
|
|
5281
|
+
postTaf = _ref$postTaf === void 0 ? function () {
|
|
5282
|
+
return null;
|
|
5283
|
+
} : _ref$postTaf,
|
|
5284
|
+
_ref$isIssuesPaneOpen = _ref.isIssuesPaneOpen,
|
|
5285
|
+
isIssuesPaneOpen = _ref$isIssuesPaneOpen === void 0 ? false : _ref$isIssuesPaneOpen,
|
|
5286
|
+
_ref$setIsIssuesPaneO = _ref.setIsIssuesPaneOpen,
|
|
5287
|
+
setIsIssuesPaneOpen = _ref$setIsIssuesPaneO === void 0 ? function () {
|
|
5288
|
+
return null;
|
|
5289
|
+
} : _ref$setIsIssuesPaneO,
|
|
5290
|
+
_ref$isFormDisabled = _ref.isFormDisabled,
|
|
5291
|
+
isFormDisabled = _ref$isFormDisabled === void 0 ? false : _ref$isFormDisabled,
|
|
5292
|
+
_ref$setIsFormDisable = _ref.setIsFormDisabled,
|
|
5293
|
+
setIsFormDisabled = _ref$setIsFormDisable === void 0 ? function () {
|
|
5294
|
+
return null;
|
|
5295
|
+
} : _ref$setIsFormDisable,
|
|
5296
|
+
error = _ref.error;
|
|
5004
5297
|
|
|
5005
5298
|
var onTafAction = function onTafAction(action, taf) {
|
|
5006
5299
|
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
@@ -5061,12 +5354,54 @@ var TafPanel = function TafPanel(_ref) {
|
|
|
5061
5354
|
severity: "error",
|
|
5062
5355
|
title: error.title,
|
|
5063
5356
|
info: error.message,
|
|
5064
|
-
dataTestId: "taf-error"
|
|
5065
|
-
|
|
5066
|
-
|
|
5357
|
+
dataTestId: "taf-error",
|
|
5358
|
+
shouldClose: true
|
|
5359
|
+
}), /*#__PURE__*/React__default.createElement(Box, {
|
|
5360
|
+
sx: {
|
|
5361
|
+
marginTop: '10px',
|
|
5362
|
+
padding: 1
|
|
5363
|
+
}
|
|
5364
|
+
}, /*#__PURE__*/React__default.createElement(TafForm, {
|
|
5067
5365
|
tafFromBackend: tafFromBackend,
|
|
5068
|
-
onFormAction: onTafAction
|
|
5069
|
-
|
|
5366
|
+
onFormAction: onTafAction,
|
|
5367
|
+
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
5368
|
+
setIsIssuesPaneOpen: setIsIssuesPaneOpen,
|
|
5369
|
+
isDisabled: isFormDisabled,
|
|
5370
|
+
setIsDisabled: setIsFormDisabled
|
|
5371
|
+
})));
|
|
5372
|
+
};
|
|
5373
|
+
|
|
5374
|
+
/* *
|
|
5375
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5376
|
+
* you may not use this file except in compliance with the License.
|
|
5377
|
+
* You may obtain a copy of the License at
|
|
5378
|
+
*
|
|
5379
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5380
|
+
*
|
|
5381
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5382
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5383
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5384
|
+
* See the License for the specific language governing permissions and
|
|
5385
|
+
* limitations under the License.
|
|
5386
|
+
*
|
|
5387
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5388
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
5389
|
+
* */
|
|
5390
|
+
|
|
5391
|
+
var IssuesPaneWrapper = function IssuesPaneWrapper(props) {
|
|
5392
|
+
var _useFormContext = useFormContext(),
|
|
5393
|
+
errors = _useFormContext.formState.errors;
|
|
5394
|
+
|
|
5395
|
+
var errorList = filterDuplicateErrors(getErrors(errors));
|
|
5396
|
+
return /*#__PURE__*/React.createElement(IssuesPane, Object.assign({
|
|
5397
|
+
errorList: errorList
|
|
5398
|
+
}, props));
|
|
5399
|
+
};
|
|
5400
|
+
|
|
5401
|
+
var CONFIRM_DIALOG_OPTIONS = {
|
|
5402
|
+
title: 'Whoops',
|
|
5403
|
+
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.",
|
|
5404
|
+
confirmLabel: 'Exit without saving'
|
|
5070
5405
|
};
|
|
5071
5406
|
|
|
5072
5407
|
var TafLayout = function TafLayout(_ref) {
|
|
@@ -5075,6 +5410,28 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5075
5410
|
_ref$onPostTaf = _ref.onPostTaf,
|
|
5076
5411
|
onPostTaf = _ref$onPostTaf === void 0 ? function () {} : _ref$onPostTaf;
|
|
5077
5412
|
|
|
5413
|
+
var _useApiContext = useApiContext(),
|
|
5414
|
+
api = _useApiContext.api;
|
|
5415
|
+
|
|
5416
|
+
var confirmDialog = useConfirmationDialog();
|
|
5417
|
+
|
|
5418
|
+
var _useIssuesPane = useIssuesPane(),
|
|
5419
|
+
isIssuesPaneOpen = _useIssuesPane.isIssuesPaneOpen,
|
|
5420
|
+
onToggleIssuesPane = _useIssuesPane.onToggleIssuesPane,
|
|
5421
|
+
onCloseIssuesPane = _useIssuesPane.onCloseIssuesPane,
|
|
5422
|
+
startPosition = _useIssuesPane.startPosition;
|
|
5423
|
+
|
|
5424
|
+
var _usePostTafRequest = usePostTafRequest(api.postTaf),
|
|
5425
|
+
isLoading = _usePostTafRequest.isLoading,
|
|
5426
|
+
postTafRequest = _usePostTafRequest.doRequest,
|
|
5427
|
+
error = _usePostTafRequest.error,
|
|
5428
|
+
setError = _usePostTafRequest.setError;
|
|
5429
|
+
|
|
5430
|
+
var _useTafModuleContext = useTafModuleContext(),
|
|
5431
|
+
onValidateForm = _useTafModuleContext.onValidateForm,
|
|
5432
|
+
tafAction = _useTafModuleContext.tafAction,
|
|
5433
|
+
isFormDirty = _useTafModuleContext.isFormDirty;
|
|
5434
|
+
|
|
5078
5435
|
var _React$useState = React__default.useState(sortTafTimeSlots(tafList)),
|
|
5079
5436
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
5080
5437
|
_React$useState2$ = _React$useState2[0],
|
|
@@ -5083,9 +5440,9 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5083
5440
|
expired = _React$useState2$.expired,
|
|
5084
5441
|
updateSortedTafs = _React$useState2[1];
|
|
5085
5442
|
|
|
5086
|
-
var
|
|
5087
|
-
|
|
5088
|
-
|
|
5443
|
+
var _current$slice = current.slice(-1),
|
|
5444
|
+
_current$slice2 = _slicedToArray(_current$slice, 1),
|
|
5445
|
+
lastCurrentTaf = _current$slice2[0];
|
|
5089
5446
|
|
|
5090
5447
|
var _React$useState3 = React__default.useState('UPCOMING'),
|
|
5091
5448
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
@@ -5102,7 +5459,96 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5102
5459
|
activeTafIndex = _React$useState8[0],
|
|
5103
5460
|
setActiveTafIndex = _React$useState8[1];
|
|
5104
5461
|
|
|
5462
|
+
var _React$useState9 = React__default.useState(false),
|
|
5463
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
5464
|
+
isFormDisabled = _React$useState10[0],
|
|
5465
|
+
setIsFormDisabled = _React$useState10[1];
|
|
5466
|
+
|
|
5467
|
+
var postTaf = function postTaf(data) {
|
|
5468
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
5469
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
5470
|
+
while (1) {
|
|
5471
|
+
switch (_context.prev = _context.next) {
|
|
5472
|
+
case 0:
|
|
5473
|
+
_context.next = 2;
|
|
5474
|
+
return postTafRequest(data);
|
|
5475
|
+
|
|
5476
|
+
case 2:
|
|
5477
|
+
// callback
|
|
5478
|
+
onPostTaf();
|
|
5479
|
+
|
|
5480
|
+
case 3:
|
|
5481
|
+
case "end":
|
|
5482
|
+
return _context.stop();
|
|
5483
|
+
}
|
|
5484
|
+
}
|
|
5485
|
+
}, _callee);
|
|
5486
|
+
}));
|
|
5487
|
+
};
|
|
5488
|
+
|
|
5489
|
+
function onChangeTab(action, value) {
|
|
5490
|
+
return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
5491
|
+
var taf;
|
|
5492
|
+
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
5493
|
+
while (1) {
|
|
5494
|
+
switch (_context2.prev = _context2.next) {
|
|
5495
|
+
case 0:
|
|
5496
|
+
if (!isFormDirty) {
|
|
5497
|
+
_context2.next = 15;
|
|
5498
|
+
break;
|
|
5499
|
+
}
|
|
5500
|
+
|
|
5501
|
+
_context2.prev = 1;
|
|
5502
|
+
_context2.next = 4;
|
|
5503
|
+
return onValidateForm();
|
|
5504
|
+
|
|
5505
|
+
case 4:
|
|
5506
|
+
taf = _context2.sent;
|
|
5507
|
+
_context2.next = 7;
|
|
5508
|
+
return postTaf({
|
|
5509
|
+
taf: taf,
|
|
5510
|
+
changeStatusTo: fromActionToStatus(tafActionToDraftAction(tafAction))
|
|
5511
|
+
});
|
|
5512
|
+
|
|
5513
|
+
case 7:
|
|
5514
|
+
action(value);
|
|
5515
|
+
_context2.next = 13;
|
|
5516
|
+
break;
|
|
5517
|
+
|
|
5518
|
+
case 10:
|
|
5519
|
+
_context2.prev = 10;
|
|
5520
|
+
_context2.t0 = _context2["catch"](1);
|
|
5521
|
+
confirmDialog(CONFIRM_DIALOG_OPTIONS).then(function () {
|
|
5522
|
+
action(value);
|
|
5523
|
+
setError(null);
|
|
5524
|
+
});
|
|
5525
|
+
|
|
5526
|
+
case 13:
|
|
5527
|
+
_context2.next = 17;
|
|
5528
|
+
break;
|
|
5529
|
+
|
|
5530
|
+
case 15:
|
|
5531
|
+
action(value);
|
|
5532
|
+
setError(null);
|
|
5533
|
+
|
|
5534
|
+
case 17:
|
|
5535
|
+
case "end":
|
|
5536
|
+
return _context2.stop();
|
|
5537
|
+
}
|
|
5538
|
+
}
|
|
5539
|
+
}, _callee2, null, [[1, 10]]);
|
|
5540
|
+
}));
|
|
5541
|
+
}
|
|
5542
|
+
|
|
5543
|
+
var onChangeLocationTab = function onChangeLocationTab(index) {
|
|
5544
|
+
onChangeTab(setActiveTafIndex, index);
|
|
5545
|
+
};
|
|
5546
|
+
|
|
5105
5547
|
var onChangeTimeSlot = function onChangeTimeSlot(newTimeSlot) {
|
|
5548
|
+
onChangeTab(changeTimeSlot, newTimeSlot);
|
|
5549
|
+
};
|
|
5550
|
+
|
|
5551
|
+
var changeTimeSlot = function changeTimeSlot(newTimeSlot) {
|
|
5106
5552
|
setTimeSlot(newTimeSlot);
|
|
5107
5553
|
setLocations(newTimeSlot === 'ACTIVE' ? current : upcoming);
|
|
5108
5554
|
setActiveTafIndex(0);
|
|
@@ -5120,6 +5566,16 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5120
5566
|
var newIndex = newActiveIndex !== -1 ? newActiveIndex : activeTafIndex;
|
|
5121
5567
|
setActiveTafIndex(newIndex); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5122
5568
|
}, [tafList, setLocations]);
|
|
5569
|
+
React__default.useEffect(function () {
|
|
5570
|
+
var cancelErrorTimeout = error && error.type === 'CANCELLED' ? setTimeout(function () {
|
|
5571
|
+
setError(null);
|
|
5572
|
+
}, 10000) : null;
|
|
5573
|
+
return function () {
|
|
5574
|
+
if (cancelErrorTimeout !== null) {
|
|
5575
|
+
clearTimeout(cancelErrorTimeout);
|
|
5576
|
+
}
|
|
5577
|
+
};
|
|
5578
|
+
}, [error, setError]);
|
|
5123
5579
|
|
|
5124
5580
|
if (!tafList) {
|
|
5125
5581
|
return null;
|
|
@@ -5162,7 +5618,7 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5162
5618
|
xs: 12,
|
|
5163
5619
|
sm: 9
|
|
5164
5620
|
}, /*#__PURE__*/React__default.createElement(TopTabs, {
|
|
5165
|
-
tafFromBackend:
|
|
5621
|
+
tafFromBackend: lastCurrentTaf,
|
|
5166
5622
|
timeSlot: timeSlot,
|
|
5167
5623
|
onChangeTimeSlot: onChangeTimeSlot
|
|
5168
5624
|
}))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
@@ -5186,7 +5642,7 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5186
5642
|
}, /*#__PURE__*/React__default.createElement(LocationTabs, {
|
|
5187
5643
|
tafList: locations,
|
|
5188
5644
|
activeIndex: activeTafIndex,
|
|
5189
|
-
onChangeTab:
|
|
5645
|
+
onChangeTab: onChangeLocationTab,
|
|
5190
5646
|
timeSlot: timeSlot
|
|
5191
5647
|
})), /*#__PURE__*/React__default.createElement(Grid, {
|
|
5192
5648
|
item: true,
|
|
@@ -5194,8 +5650,6 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5194
5650
|
}, /*#__PURE__*/React__default.createElement(Card, {
|
|
5195
5651
|
variant: "outlined",
|
|
5196
5652
|
sx: {
|
|
5197
|
-
padding: 1,
|
|
5198
|
-
paddingTop: 0,
|
|
5199
5653
|
marginBottom: '12px',
|
|
5200
5654
|
position: 'relative'
|
|
5201
5655
|
}
|
|
@@ -5210,24 +5664,50 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5210
5664
|
activeTafIndex: activeTafIndex,
|
|
5211
5665
|
index: index,
|
|
5212
5666
|
tafFromBackend: tafFromBackend,
|
|
5213
|
-
|
|
5667
|
+
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
5668
|
+
setIsIssuesPaneOpen: onToggleIssuesPane,
|
|
5669
|
+
isFormDisabled: isFormDisabled,
|
|
5670
|
+
setIsFormDisabled: setIsFormDisabled,
|
|
5671
|
+
postTaf: postTaf,
|
|
5672
|
+
isLoading: isLoading,
|
|
5673
|
+
error: error
|
|
5214
5674
|
});
|
|
5215
5675
|
}))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
5216
5676
|
item: true,
|
|
5217
|
-
xs:
|
|
5218
|
-
|
|
5219
|
-
|
|
5677
|
+
xs: 0,
|
|
5678
|
+
sm: 3,
|
|
5679
|
+
height: {
|
|
5680
|
+
xs: 0,
|
|
5681
|
+
sm: '100%'
|
|
5220
5682
|
},
|
|
5221
|
-
|
|
5222
|
-
xs:
|
|
5223
|
-
sm: '
|
|
5683
|
+
width: {
|
|
5684
|
+
xs: 0,
|
|
5685
|
+
sm: '100%'
|
|
5224
5686
|
}
|
|
5225
5687
|
}, /*#__PURE__*/React__default.createElement(TacOverview, {
|
|
5226
5688
|
upcomingTafs: upcoming,
|
|
5227
5689
|
currentTafs: current,
|
|
5228
5690
|
expiredTafs: expired,
|
|
5229
|
-
activeTaf: activeTaf
|
|
5230
|
-
|
|
5691
|
+
activeTaf: activeTaf,
|
|
5692
|
+
isFormDisabled: isFormDisabled
|
|
5693
|
+
})))))), /*#__PURE__*/React__default.createElement(IssuesPaneWrapper, {
|
|
5694
|
+
handleClose: onCloseIssuesPane,
|
|
5695
|
+
isOpen: isIssuesPaneOpen,
|
|
5696
|
+
startPosition: startPosition
|
|
5697
|
+
}));
|
|
5698
|
+
};
|
|
5699
|
+
|
|
5700
|
+
var TafWrapper = function TafWrapper(_a) {
|
|
5701
|
+
var children = _a.children,
|
|
5702
|
+
props = __rest(_a, ["children"]);
|
|
5703
|
+
|
|
5704
|
+
return /*#__PURE__*/React.createElement(TafModuleProvider, Object.assign({}, props), /*#__PURE__*/React.createElement(ConfirmationServiceProvider, null, /*#__PURE__*/React.createElement(ReactHookFormProvider, {
|
|
5705
|
+
options: {
|
|
5706
|
+
mode: 'onTouched',
|
|
5707
|
+
reValidateMode: 'onChange',
|
|
5708
|
+
criteriaMode: 'all'
|
|
5709
|
+
}
|
|
5710
|
+
}, children)));
|
|
5231
5711
|
};
|
|
5232
5712
|
|
|
5233
5713
|
var TafModule = function TafModule() {
|
|
@@ -5303,15 +5783,17 @@ var TafModule = function TafModule() {
|
|
|
5303
5783
|
}), hasTafListError && /*#__PURE__*/React.createElement(AlertBanner, {
|
|
5304
5784
|
severity: "error",
|
|
5305
5785
|
title: "An error has occurred while retrieving the list",
|
|
5306
|
-
info: getTafListError.message
|
|
5786
|
+
info: getTafListError.message,
|
|
5787
|
+
dataTestId: "taf-list-error",
|
|
5788
|
+
shouldClose: true
|
|
5307
5789
|
}), /*#__PURE__*/React.createElement(TafLayout, {
|
|
5308
5790
|
tafList: tafList,
|
|
5309
5791
|
onPostTaf: reFetchNewTafList
|
|
5310
5792
|
}));
|
|
5311
5793
|
};
|
|
5312
5794
|
|
|
5313
|
-
var Wrapper = function Wrapper() {
|
|
5314
|
-
return /*#__PURE__*/React.createElement(
|
|
5795
|
+
var Wrapper = function Wrapper(props) {
|
|
5796
|
+
return /*#__PURE__*/React.createElement(TafWrapper, Object.assign({}, props), /*#__PURE__*/React.createElement(TafModule, null));
|
|
5315
5797
|
};
|
|
5316
5798
|
|
|
5317
5799
|
/* *
|
|
@@ -5330,7 +5812,7 @@ var Wrapper = function Wrapper() {
|
|
|
5330
5812
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5331
5813
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
5332
5814
|
* */
|
|
5333
|
-
var createApi = function createApi(url, appUrl, auth, setAuth, authTokenUrl, authClientId) {
|
|
5815
|
+
var createApi$1 = function createApi(url, appUrl, auth, setAuth, authTokenUrl, authClientId) {
|
|
5334
5816
|
var axiosInstance = createApiInstance(url, appUrl, auth, setAuth, authTokenUrl, authClientId);
|
|
5335
5817
|
return {
|
|
5336
5818
|
// api data
|
|
@@ -5346,4 +5828,1052 @@ var createApi = function createApi(url, appUrl, auth, setAuth, authTokenUrl, aut
|
|
|
5346
5828
|
};
|
|
5347
5829
|
};
|
|
5348
5830
|
|
|
5349
|
-
|
|
5831
|
+
var currentDate = moment.utc().format('YYYY-MM-DD');
|
|
5832
|
+
var tomorrowDate = moment.utc().add(1, 'day').format('YYYY-MM-DD');
|
|
5833
|
+
var airportPeriod = 6;
|
|
5834
|
+
var airportValidity = 40;
|
|
5835
|
+
|
|
5836
|
+
var validDateRange = function validDateRange(refHour, period) {
|
|
5837
|
+
var startHour = period * Math.floor(parseInt(refHour.format('HH'), 10) / period) % 24;
|
|
5838
|
+
var start = refHour.set({
|
|
5839
|
+
hour: startHour,
|
|
5840
|
+
minute: 0,
|
|
5841
|
+
second: 0
|
|
5842
|
+
});
|
|
5843
|
+
var end = start.clone().add(airportValidity, 'hours');
|
|
5844
|
+
return [start.format('YYYY-MM-DDTHH:mm:ss'), end.format('YYYY-MM-DDTHH:mm:ss')];
|
|
5845
|
+
};
|
|
5846
|
+
|
|
5847
|
+
var dateAdd = function dateAdd(refDateAsString, hours) {
|
|
5848
|
+
return moment.utc(refDateAsString).add(hours, 'hours').format('YYYY-MM-DDTHH:mm:ss');
|
|
5849
|
+
};
|
|
5850
|
+
|
|
5851
|
+
var _validDateRange = validDateRange(moment.utc(), airportPeriod),
|
|
5852
|
+
_validDateRange2 = _slicedToArray(_validDateRange, 2),
|
|
5853
|
+
currentValidDateStart = _validDateRange2[0],
|
|
5854
|
+
currentValidDateEnd = _validDateRange2[1];
|
|
5855
|
+
|
|
5856
|
+
var _validDateRange3 = validDateRange(moment.utc().add(6, 'hours'), airportPeriod),
|
|
5857
|
+
_validDateRange4 = _slicedToArray(_validDateRange3, 2),
|
|
5858
|
+
upcomingValidDateStart = _validDateRange4[0],
|
|
5859
|
+
upcomingValidDateEnd = _validDateRange4[1];
|
|
5860
|
+
|
|
5861
|
+
var _validDateRange5 = validDateRange(moment.utc().add(-6, 'hours'), airportPeriod),
|
|
5862
|
+
_validDateRange6 = _slicedToArray(_validDateRange5, 2),
|
|
5863
|
+
expiredValidDateStart = _validDateRange6[0],
|
|
5864
|
+
expiredValidDateEnd = _validDateRange6[1];
|
|
5865
|
+
|
|
5866
|
+
var fakeTafList = [{
|
|
5867
|
+
creationDate: upcomingValidDateStart,
|
|
5868
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
5869
|
+
taf: {
|
|
5870
|
+
uuid: '5f9583fjdf0f337925',
|
|
5871
|
+
baseTime: upcomingValidDateStart,
|
|
5872
|
+
validDateStart: upcomingValidDateStart,
|
|
5873
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5874
|
+
location: 'EHAM',
|
|
5875
|
+
status: 'NEW',
|
|
5876
|
+
type: 'NORMAL',
|
|
5877
|
+
messageType: 'ORG',
|
|
5878
|
+
baseForecast: {
|
|
5879
|
+
valid: {
|
|
5880
|
+
start: upcomingValidDateStart,
|
|
5881
|
+
end: upcomingValidDateEnd
|
|
5882
|
+
}
|
|
5883
|
+
}
|
|
5884
|
+
}
|
|
5885
|
+
}, {
|
|
5886
|
+
creationDate: upcomingValidDateStart,
|
|
5887
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
5888
|
+
taf: {
|
|
5889
|
+
uuid: '5f9583fjd111137925',
|
|
5890
|
+
baseTime: upcomingValidDateStart,
|
|
5891
|
+
validDateStart: upcomingValidDateStart,
|
|
5892
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5893
|
+
location: 'EHRD',
|
|
5894
|
+
status: 'DRAFT',
|
|
5895
|
+
type: 'NORMAL',
|
|
5896
|
+
messageType: 'ORG',
|
|
5897
|
+
baseForecast: {
|
|
5898
|
+
valid: {
|
|
5899
|
+
start: upcomingValidDateStart,
|
|
5900
|
+
end: upcomingValidDateEnd
|
|
5901
|
+
},
|
|
5902
|
+
wind: {
|
|
5903
|
+
direction: 180,
|
|
5904
|
+
speed: 10,
|
|
5905
|
+
unit: 'KT'
|
|
5906
|
+
},
|
|
5907
|
+
cavOK: true
|
|
5908
|
+
}
|
|
5909
|
+
}
|
|
5910
|
+
}, {
|
|
5911
|
+
creationDate: upcomingValidDateStart,
|
|
5912
|
+
canbe: ['CANCELLED', 'AMENDED', 'DISCARDED'],
|
|
5913
|
+
taf: {
|
|
5914
|
+
uuid: '754905485',
|
|
5915
|
+
baseTime: upcomingValidDateStart,
|
|
5916
|
+
previousId: '5f9583fjdf45ff4330f337925',
|
|
5917
|
+
validDateStart: upcomingValidDateStart,
|
|
5918
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5919
|
+
previousValidDateStart: upcomingValidDateStart,
|
|
5920
|
+
previousValidDateEnd: upcomingValidDateEnd,
|
|
5921
|
+
location: 'EHLE',
|
|
5922
|
+
status: 'DRAFT_AMENDED',
|
|
5923
|
+
type: 'NORMAL',
|
|
5924
|
+
messageType: 'AMD',
|
|
5925
|
+
baseForecast: {
|
|
5926
|
+
valid: {
|
|
5927
|
+
start: upcomingValidDateStart,
|
|
5928
|
+
end: upcomingValidDateEnd
|
|
5929
|
+
},
|
|
5930
|
+
visibility: {
|
|
5931
|
+
range: 600,
|
|
5932
|
+
unit: 'M'
|
|
5933
|
+
},
|
|
5934
|
+
wind: {
|
|
5935
|
+
direction: 180,
|
|
5936
|
+
speed: 10,
|
|
5937
|
+
unit: 'KT'
|
|
5938
|
+
},
|
|
5939
|
+
weather: {
|
|
5940
|
+
weather1: 'SN'
|
|
5941
|
+
},
|
|
5942
|
+
cloud: {
|
|
5943
|
+
cloud1: {
|
|
5944
|
+
coverage: 'BKN',
|
|
5945
|
+
height: 35
|
|
5946
|
+
}
|
|
5947
|
+
}
|
|
5948
|
+
},
|
|
5949
|
+
changeGroups: [{
|
|
5950
|
+
change: 'TEMPO',
|
|
5951
|
+
probability: 'PROB30',
|
|
5952
|
+
valid: {
|
|
5953
|
+
start: dateAdd(upcomingValidDateStart, 3),
|
|
5954
|
+
end: dateAdd(upcomingValidDateStart, 4)
|
|
5955
|
+
},
|
|
5956
|
+
visibility: {
|
|
5957
|
+
range: 100,
|
|
5958
|
+
unit: 'M'
|
|
5959
|
+
},
|
|
5960
|
+
cloud: {
|
|
5961
|
+
cloud1: {
|
|
5962
|
+
verticalVisibility: 5
|
|
5963
|
+
}
|
|
5964
|
+
}
|
|
5965
|
+
}]
|
|
5966
|
+
}
|
|
5967
|
+
}, {
|
|
5968
|
+
creationDate: upcomingValidDateStart,
|
|
5969
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
5970
|
+
taf: {
|
|
5971
|
+
uuid: '43545345345',
|
|
5972
|
+
issueDate: upcomingValidDateStart,
|
|
5973
|
+
baseTime: "".concat(currentDate, "T18:00:00Z"),
|
|
5974
|
+
validDateStart: "".concat(currentDate, "T18:00:00Z"),
|
|
5975
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5976
|
+
previousId: 'jkdjkdfjkgdf',
|
|
5977
|
+
previousValidDateStart: upcomingValidDateStart,
|
|
5978
|
+
previousValidDateEnd: upcomingValidDateEnd,
|
|
5979
|
+
location: 'EHLE',
|
|
5980
|
+
status: 'CORRECTED',
|
|
5981
|
+
type: 'NORMAL',
|
|
5982
|
+
messageType: 'COR',
|
|
5983
|
+
baseForecast: {
|
|
5984
|
+
valid: {
|
|
5985
|
+
start: upcomingValidDateStart,
|
|
5986
|
+
end: upcomingValidDateEnd
|
|
5987
|
+
},
|
|
5988
|
+
wind: {
|
|
5989
|
+
direction: 350,
|
|
5990
|
+
speed: 46,
|
|
5991
|
+
gust: 67,
|
|
5992
|
+
unit: 'KT'
|
|
5993
|
+
},
|
|
5994
|
+
cavOK: true
|
|
5995
|
+
},
|
|
5996
|
+
changeGroups: [{
|
|
5997
|
+
change: 'BECMG',
|
|
5998
|
+
valid: {
|
|
5999
|
+
start: dateAdd(upcomingValidDateStart, 1),
|
|
6000
|
+
end: dateAdd(upcomingValidDateStart, 2)
|
|
6001
|
+
},
|
|
6002
|
+
visibility: {
|
|
6003
|
+
range: 1000,
|
|
6004
|
+
unit: 'M'
|
|
6005
|
+
},
|
|
6006
|
+
weather: {
|
|
6007
|
+
weather1: 'MIFG'
|
|
6008
|
+
},
|
|
6009
|
+
cloud: {
|
|
6010
|
+
cloud1: 'NSC'
|
|
6011
|
+
}
|
|
6012
|
+
}, {
|
|
6013
|
+
change: 'FM',
|
|
6014
|
+
valid: {
|
|
6015
|
+
start: dateAdd(upcomingValidDateStart, 2)
|
|
6016
|
+
},
|
|
6017
|
+
visibility: {
|
|
6018
|
+
range: 6000,
|
|
6019
|
+
unit: 'M'
|
|
6020
|
+
},
|
|
6021
|
+
weather: {
|
|
6022
|
+
weather1: '+SHRA'
|
|
6023
|
+
},
|
|
6024
|
+
cloud: {
|
|
6025
|
+
cloud1: {
|
|
6026
|
+
coverage: 'BKN',
|
|
6027
|
+
height: 40
|
|
6028
|
+
},
|
|
6029
|
+
cloud2: {
|
|
6030
|
+
coverage: 'OVC',
|
|
6031
|
+
height: 60,
|
|
6032
|
+
type: 'CB'
|
|
6033
|
+
}
|
|
6034
|
+
}
|
|
6035
|
+
}]
|
|
6036
|
+
}
|
|
6037
|
+
}, {
|
|
6038
|
+
creationDate: upcomingValidDateStart,
|
|
6039
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
6040
|
+
taf: {
|
|
6041
|
+
uuid: '5f9583fjdf45ff4330f337925',
|
|
6042
|
+
issueDate: upcomingValidDateStart,
|
|
6043
|
+
baseTime: upcomingValidDateStart,
|
|
6044
|
+
validDateStart: upcomingValidDateStart,
|
|
6045
|
+
validDateEnd: upcomingValidDateEnd,
|
|
6046
|
+
location: 'EHGG',
|
|
6047
|
+
status: 'PUBLISHED',
|
|
6048
|
+
type: 'NORMAL',
|
|
6049
|
+
messageType: 'ORG',
|
|
6050
|
+
baseForecast: {
|
|
6051
|
+
valid: {
|
|
6052
|
+
start: upcomingValidDateEnd,
|
|
6053
|
+
end: upcomingValidDateEnd
|
|
6054
|
+
},
|
|
6055
|
+
visibility: {
|
|
6056
|
+
range: 600,
|
|
6057
|
+
unit: 'M'
|
|
6058
|
+
},
|
|
6059
|
+
wind: {
|
|
6060
|
+
direction: 180,
|
|
6061
|
+
speed: 10,
|
|
6062
|
+
unit: 'KT'
|
|
6063
|
+
},
|
|
6064
|
+
weather: {
|
|
6065
|
+
weather1: 'SN'
|
|
6066
|
+
},
|
|
6067
|
+
cloud: {
|
|
6068
|
+
cloud1: {
|
|
6069
|
+
coverage: 'BKN',
|
|
6070
|
+
height: 35
|
|
6071
|
+
}
|
|
6072
|
+
}
|
|
6073
|
+
},
|
|
6074
|
+
changeGroups: [{
|
|
6075
|
+
change: 'TEMPO',
|
|
6076
|
+
probability: 'PROB30',
|
|
6077
|
+
valid: {
|
|
6078
|
+
start: dateAdd(upcomingValidDateStart, 1),
|
|
6079
|
+
end: dateAdd(upcomingValidDateStart, 2)
|
|
6080
|
+
},
|
|
6081
|
+
visibility: {
|
|
6082
|
+
range: 200,
|
|
6083
|
+
unit: 'M'
|
|
6084
|
+
},
|
|
6085
|
+
cloud: {
|
|
6086
|
+
cloud1: {
|
|
6087
|
+
verticalVisibility: 5
|
|
6088
|
+
}
|
|
6089
|
+
}
|
|
6090
|
+
}]
|
|
6091
|
+
}
|
|
6092
|
+
}, {
|
|
6093
|
+
creationDate: upcomingValidDateStart,
|
|
6094
|
+
canbe: ['AMENDED'],
|
|
6095
|
+
taf: {
|
|
6096
|
+
uuid: '5464565464',
|
|
6097
|
+
previousId: '5445fghrfg3546456',
|
|
6098
|
+
issueDate: upcomingValidDateStart,
|
|
6099
|
+
baseTime: upcomingValidDateStart,
|
|
6100
|
+
validDateStart: upcomingValidDateStart,
|
|
6101
|
+
validDateEnd: upcomingValidDateEnd,
|
|
6102
|
+
previousValidDateStart: upcomingValidDateStart,
|
|
6103
|
+
previousValidDateEnd: upcomingValidDateEnd,
|
|
6104
|
+
location: 'EHBK',
|
|
6105
|
+
status: 'CANCELLED',
|
|
6106
|
+
type: 'NORMAL',
|
|
6107
|
+
messageType: 'CNL',
|
|
6108
|
+
baseForecast: {
|
|
6109
|
+
valid: {
|
|
6110
|
+
start: upcomingValidDateStart,
|
|
6111
|
+
end: upcomingValidDateEnd
|
|
6112
|
+
},
|
|
6113
|
+
visibility: {
|
|
6114
|
+
range: 600,
|
|
6115
|
+
unit: 'M'
|
|
6116
|
+
},
|
|
6117
|
+
wind: {
|
|
6118
|
+
direction: 180,
|
|
6119
|
+
speed: 10,
|
|
6120
|
+
unit: 'KT'
|
|
6121
|
+
},
|
|
6122
|
+
weather: {
|
|
6123
|
+
weather1: 'SN'
|
|
6124
|
+
},
|
|
6125
|
+
cloud: {
|
|
6126
|
+
cloud1: {
|
|
6127
|
+
coverage: 'BKN',
|
|
6128
|
+
height: 35
|
|
6129
|
+
}
|
|
6130
|
+
}
|
|
6131
|
+
}
|
|
6132
|
+
}
|
|
6133
|
+
}, {
|
|
6134
|
+
creationDate: upcomingValidDateStart,
|
|
6135
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
6136
|
+
taf: {
|
|
6137
|
+
uuid: 'gh56734fghfgh',
|
|
6138
|
+
previousId: '8574jnf93475',
|
|
6139
|
+
issueDate: "".concat(currentDate, "T16:16:00Z"),
|
|
6140
|
+
baseTime: upcomingValidDateStart,
|
|
6141
|
+
validDateStart: upcomingValidDateStart,
|
|
6142
|
+
validDateEnd: upcomingValidDateEnd,
|
|
6143
|
+
previousValidDateStart: upcomingValidDateStart,
|
|
6144
|
+
previousValidDateEnd: upcomingValidDateEnd,
|
|
6145
|
+
location: 'TNCB',
|
|
6146
|
+
status: 'AMENDED',
|
|
6147
|
+
type: 'NORMAL',
|
|
6148
|
+
messageType: 'AMD',
|
|
6149
|
+
baseForecast: {
|
|
6150
|
+
valid: {
|
|
6151
|
+
start: "".concat(currentDate, "T16:12:00Z"),
|
|
6152
|
+
end: upcomingValidDateEnd
|
|
6153
|
+
},
|
|
6154
|
+
visibility: {
|
|
6155
|
+
range: 600,
|
|
6156
|
+
unit: 'M'
|
|
6157
|
+
},
|
|
6158
|
+
wind: {
|
|
6159
|
+
direction: 180,
|
|
6160
|
+
speed: 10,
|
|
6161
|
+
unit: 'KT'
|
|
6162
|
+
},
|
|
6163
|
+
weather: {
|
|
6164
|
+
weather1: 'SN'
|
|
6165
|
+
},
|
|
6166
|
+
cloud: {
|
|
6167
|
+
cloud1: {
|
|
6168
|
+
coverage: 'BKN',
|
|
6169
|
+
height: 35
|
|
6170
|
+
}
|
|
6171
|
+
}
|
|
6172
|
+
}
|
|
6173
|
+
}
|
|
6174
|
+
}, {
|
|
6175
|
+
creationDate: currentValidDateStart,
|
|
6176
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
6177
|
+
taf: {
|
|
6178
|
+
uuid: 'giskdj09845872039',
|
|
6179
|
+
issueDate: currentValidDateStart,
|
|
6180
|
+
baseTime: currentValidDateStart,
|
|
6181
|
+
validDateStart: currentValidDateStart,
|
|
6182
|
+
validDateEnd: currentValidDateEnd,
|
|
6183
|
+
location: 'EHAM',
|
|
6184
|
+
status: 'PUBLISHED',
|
|
6185
|
+
type: 'NORMAL',
|
|
6186
|
+
messageType: 'ORG',
|
|
6187
|
+
baseForecast: {
|
|
6188
|
+
valid: {
|
|
6189
|
+
start: currentValidDateStart,
|
|
6190
|
+
end: currentValidDateEnd
|
|
6191
|
+
},
|
|
6192
|
+
visibility: {
|
|
6193
|
+
range: 500,
|
|
6194
|
+
unit: 'M'
|
|
6195
|
+
},
|
|
6196
|
+
wind: {
|
|
6197
|
+
direction: 200,
|
|
6198
|
+
speed: 20,
|
|
6199
|
+
gust: 35,
|
|
6200
|
+
unit: 'KT'
|
|
6201
|
+
},
|
|
6202
|
+
weather: {
|
|
6203
|
+
weather1: 'SN'
|
|
6204
|
+
},
|
|
6205
|
+
cloud: {
|
|
6206
|
+
cloud1: {
|
|
6207
|
+
coverage: 'BKN',
|
|
6208
|
+
height: 40
|
|
6209
|
+
}
|
|
6210
|
+
}
|
|
6211
|
+
}
|
|
6212
|
+
}
|
|
6213
|
+
}, {
|
|
6214
|
+
creationDate: currentValidDateStart,
|
|
6215
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6216
|
+
taf: {
|
|
6217
|
+
uuid: 'ghskdj09845872039',
|
|
6218
|
+
baseTime: currentValidDateStart,
|
|
6219
|
+
validDateStart: currentValidDateStart,
|
|
6220
|
+
validDateEnd: currentValidDateEnd,
|
|
6221
|
+
location: 'EHRD',
|
|
6222
|
+
status: 'NEW',
|
|
6223
|
+
type: 'NORMAL',
|
|
6224
|
+
messageType: 'ORG',
|
|
6225
|
+
baseForecast: {
|
|
6226
|
+
valid: {
|
|
6227
|
+
start: currentValidDateStart,
|
|
6228
|
+
end: currentValidDateEnd
|
|
6229
|
+
}
|
|
6230
|
+
}
|
|
6231
|
+
}
|
|
6232
|
+
}, {
|
|
6233
|
+
creationDate: currentValidDateStart,
|
|
6234
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6235
|
+
taf: {
|
|
6236
|
+
uuid: 'ghskdj09845872040',
|
|
6237
|
+
issueDate: currentValidDateStart,
|
|
6238
|
+
baseTime: currentValidDateStart,
|
|
6239
|
+
validDateStart: currentValidDateStart,
|
|
6240
|
+
validDateEnd: currentValidDateEnd,
|
|
6241
|
+
location: 'EHLE',
|
|
6242
|
+
status: 'NEW',
|
|
6243
|
+
type: 'NORMAL',
|
|
6244
|
+
messageType: 'ORG',
|
|
6245
|
+
baseForecast: {
|
|
6246
|
+
valid: {
|
|
6247
|
+
start: currentValidDateStart,
|
|
6248
|
+
end: currentValidDateEnd
|
|
6249
|
+
}
|
|
6250
|
+
}
|
|
6251
|
+
}
|
|
6252
|
+
}, {
|
|
6253
|
+
creationDate: "".concat(currentDate, "T06:00:00Z"),
|
|
6254
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6255
|
+
taf: {
|
|
6256
|
+
uuid: 'ghskdj09845872041',
|
|
6257
|
+
issueDate: currentValidDateStart,
|
|
6258
|
+
baseTime: currentValidDateStart,
|
|
6259
|
+
validDateStart: currentValidDateStart,
|
|
6260
|
+
validDateEnd: currentValidDateEnd,
|
|
6261
|
+
location: 'EHGG',
|
|
6262
|
+
status: 'NEW',
|
|
6263
|
+
type: 'NORMAL',
|
|
6264
|
+
messageType: 'ORG',
|
|
6265
|
+
baseForecast: {
|
|
6266
|
+
valid: {
|
|
6267
|
+
start: currentValidDateStart,
|
|
6268
|
+
end: currentValidDateEnd
|
|
6269
|
+
}
|
|
6270
|
+
}
|
|
6271
|
+
}
|
|
6272
|
+
}, {
|
|
6273
|
+
creationDate: "".concat(currentDate, "T06:00:00Z"),
|
|
6274
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6275
|
+
taf: {
|
|
6276
|
+
uuid: 'ghskdj09845872042',
|
|
6277
|
+
issueDate: currentValidDateStart,
|
|
6278
|
+
baseTime: currentValidDateStart,
|
|
6279
|
+
validDateStart: currentValidDateStart,
|
|
6280
|
+
validDateEnd: currentValidDateEnd,
|
|
6281
|
+
location: 'EHBK',
|
|
6282
|
+
status: 'NEW',
|
|
6283
|
+
type: 'NORMAL',
|
|
6284
|
+
messageType: 'ORG',
|
|
6285
|
+
baseForecast: {
|
|
6286
|
+
valid: {
|
|
6287
|
+
start: currentValidDateStart,
|
|
6288
|
+
end: currentValidDateEnd
|
|
6289
|
+
}
|
|
6290
|
+
}
|
|
6291
|
+
}
|
|
6292
|
+
}, {
|
|
6293
|
+
creationDate: "".concat(currentDate, "T06:00:00Z"),
|
|
6294
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6295
|
+
taf: {
|
|
6296
|
+
uuid: 'ghskdj09845872043',
|
|
6297
|
+
issueDate: currentValidDateStart,
|
|
6298
|
+
baseTime: currentValidDateStart,
|
|
6299
|
+
validDateStart: currentValidDateStart,
|
|
6300
|
+
validDateEnd: currentValidDateEnd,
|
|
6301
|
+
location: 'TNCB',
|
|
6302
|
+
status: 'NEW',
|
|
6303
|
+
type: 'NORMAL',
|
|
6304
|
+
messageType: 'ORG',
|
|
6305
|
+
baseForecast: {
|
|
6306
|
+
valid: {
|
|
6307
|
+
start: currentValidDateStart,
|
|
6308
|
+
end: currentValidDateEnd
|
|
6309
|
+
}
|
|
6310
|
+
}
|
|
6311
|
+
}
|
|
6312
|
+
}, {
|
|
6313
|
+
creationDate: expiredValidDateStart,
|
|
6314
|
+
canbe: [],
|
|
6315
|
+
taf: {
|
|
6316
|
+
uuid: 'sdkjhsdf90845890',
|
|
6317
|
+
issueDate: expiredValidDateStart,
|
|
6318
|
+
baseTime: expiredValidDateStart,
|
|
6319
|
+
validDateStart: expiredValidDateStart,
|
|
6320
|
+
validDateEnd: expiredValidDateEnd,
|
|
6321
|
+
location: 'EHAM',
|
|
6322
|
+
status: 'EXPIRED',
|
|
6323
|
+
type: 'NORMAL',
|
|
6324
|
+
messageType: 'ORG',
|
|
6325
|
+
baseForecast: {
|
|
6326
|
+
valid: {
|
|
6327
|
+
start: expiredValidDateStart,
|
|
6328
|
+
end: expiredValidDateEnd
|
|
6329
|
+
},
|
|
6330
|
+
cavOK: true,
|
|
6331
|
+
wind: {
|
|
6332
|
+
direction: 50,
|
|
6333
|
+
speed: 5,
|
|
6334
|
+
unit: 'KT'
|
|
6335
|
+
}
|
|
6336
|
+
},
|
|
6337
|
+
changeGroups: [{
|
|
6338
|
+
change: 'BECMG',
|
|
6339
|
+
valid: {
|
|
6340
|
+
start: dateAdd(expiredValidDateStart, 1),
|
|
6341
|
+
end: dateAdd(expiredValidDateStart, 4)
|
|
6342
|
+
},
|
|
6343
|
+
visibility: {
|
|
6344
|
+
range: 1000,
|
|
6345
|
+
unit: 'M'
|
|
6346
|
+
},
|
|
6347
|
+
weather: {
|
|
6348
|
+
weather1: 'MIFG'
|
|
6349
|
+
}
|
|
6350
|
+
}, {
|
|
6351
|
+
change: 'FM',
|
|
6352
|
+
valid: {
|
|
6353
|
+
start: dateAdd(expiredValidDateStart, 5)
|
|
6354
|
+
},
|
|
6355
|
+
visibility: {
|
|
6356
|
+
range: 6000,
|
|
6357
|
+
unit: 'M'
|
|
6358
|
+
},
|
|
6359
|
+
weather: {
|
|
6360
|
+
weather1: '+SHRA'
|
|
6361
|
+
},
|
|
6362
|
+
cloud: {
|
|
6363
|
+
cloud1: {
|
|
6364
|
+
coverage: 'BKN',
|
|
6365
|
+
height: 40
|
|
6366
|
+
},
|
|
6367
|
+
cloud2: {
|
|
6368
|
+
coverage: 'OVC',
|
|
6369
|
+
height: 60,
|
|
6370
|
+
type: 'CB'
|
|
6371
|
+
}
|
|
6372
|
+
}
|
|
6373
|
+
}]
|
|
6374
|
+
}
|
|
6375
|
+
}];
|
|
6376
|
+
var fakeNewTaf = {
|
|
6377
|
+
creationDate: "".concat(currentDate, "T12:00:00Z"),
|
|
6378
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6379
|
+
taf: {
|
|
6380
|
+
type: 'NORMAL',
|
|
6381
|
+
messageType: 'ORG',
|
|
6382
|
+
status: 'NEW',
|
|
6383
|
+
uuid: '5f9583fjdf0445332f337925',
|
|
6384
|
+
baseTime: "".concat(currentDate, "T12:00:00Z"),
|
|
6385
|
+
validDateStart: "".concat(currentDate, "T12:00:00Z"),
|
|
6386
|
+
validDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6387
|
+
location: 'EHBK',
|
|
6388
|
+
baseForecast: {
|
|
6389
|
+
valid: {
|
|
6390
|
+
start: "".concat(currentDate, "T12:00:00Z"),
|
|
6391
|
+
end: "".concat(tomorrowDate, "T18:00:00Z")
|
|
6392
|
+
}
|
|
6393
|
+
}
|
|
6394
|
+
}
|
|
6395
|
+
};
|
|
6396
|
+
({
|
|
6397
|
+
creationDate: "2022-01-06T12:00:00Z",
|
|
6398
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6399
|
+
taf: Object.assign(Object.assign({}, fakeNewTaf.taf), {
|
|
6400
|
+
baseTime: "2022-01-06T12:00:00Z",
|
|
6401
|
+
validDateStart: "2022-01-06T12:00:00Z",
|
|
6402
|
+
validDateEnd: "2022-01-07T18:00:00Z",
|
|
6403
|
+
baseForecast: {
|
|
6404
|
+
valid: {
|
|
6405
|
+
start: "2022-01-06T12:00:00Z",
|
|
6406
|
+
end: "2022-01-07T18:00:00Z"
|
|
6407
|
+
}
|
|
6408
|
+
}
|
|
6409
|
+
})
|
|
6410
|
+
});
|
|
6411
|
+
var fakePublishedTaf = {
|
|
6412
|
+
creationDate: "".concat(currentDate, "T12:00:00Z"),
|
|
6413
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
6414
|
+
taf: {
|
|
6415
|
+
uuid: 'slsdkjg-023895',
|
|
6416
|
+
issueDate: "".concat(currentDate, "T12:00:00Z"),
|
|
6417
|
+
baseTime: "".concat(currentDate, "T12:00:00Z"),
|
|
6418
|
+
validDateStart: "".concat(currentDate, "T12:00:00Z"),
|
|
6419
|
+
validDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6420
|
+
location: 'EHLE',
|
|
6421
|
+
status: 'PUBLISHED',
|
|
6422
|
+
type: 'NORMAL',
|
|
6423
|
+
messageType: 'ORG',
|
|
6424
|
+
baseForecast: {
|
|
6425
|
+
valid: {
|
|
6426
|
+
start: "".concat(currentDate, "T12:00:00Z"),
|
|
6427
|
+
end: "".concat(tomorrowDate, "T18:00:00Z")
|
|
6428
|
+
},
|
|
6429
|
+
wind: {
|
|
6430
|
+
direction: 50,
|
|
6431
|
+
speed: 5,
|
|
6432
|
+
unit: 'KT'
|
|
6433
|
+
},
|
|
6434
|
+
cavOK: true
|
|
6435
|
+
},
|
|
6436
|
+
changeGroups: [{
|
|
6437
|
+
change: 'FM',
|
|
6438
|
+
valid: {
|
|
6439
|
+
start: "".concat(currentDate, "T12:00:00Z")
|
|
6440
|
+
},
|
|
6441
|
+
visibility: {
|
|
6442
|
+
range: 6000,
|
|
6443
|
+
unit: 'M'
|
|
6444
|
+
},
|
|
6445
|
+
weather: {
|
|
6446
|
+
weather1: '+SHRA'
|
|
6447
|
+
},
|
|
6448
|
+
wind: {
|
|
6449
|
+
direction: 10,
|
|
6450
|
+
speed: 10,
|
|
6451
|
+
unit: 'KT',
|
|
6452
|
+
gust: 35
|
|
6453
|
+
},
|
|
6454
|
+
cloud: {
|
|
6455
|
+
cloud1: {
|
|
6456
|
+
coverage: 'BKN',
|
|
6457
|
+
height: 40
|
|
6458
|
+
},
|
|
6459
|
+
cloud2: {
|
|
6460
|
+
coverage: 'OVC',
|
|
6461
|
+
height: 60,
|
|
6462
|
+
type: 'CB'
|
|
6463
|
+
}
|
|
6464
|
+
}
|
|
6465
|
+
}, {
|
|
6466
|
+
change: 'BECMG',
|
|
6467
|
+
valid: {
|
|
6468
|
+
start: "".concat(currentDate, "T23:00:00Z"),
|
|
6469
|
+
end: "".concat(tomorrowDate, "T01:00:00Z")
|
|
6470
|
+
},
|
|
6471
|
+
wind: {
|
|
6472
|
+
direction: 150,
|
|
6473
|
+
speed: 5,
|
|
6474
|
+
unit: 'KT'
|
|
6475
|
+
},
|
|
6476
|
+
visibility: {
|
|
6477
|
+
range: 1000,
|
|
6478
|
+
unit: 'M'
|
|
6479
|
+
},
|
|
6480
|
+
weather: {
|
|
6481
|
+
weather1: 'MIFG'
|
|
6482
|
+
}
|
|
6483
|
+
}]
|
|
6484
|
+
}
|
|
6485
|
+
};
|
|
6486
|
+
({
|
|
6487
|
+
creationDate: "2022-01-06T12:00:00Z",
|
|
6488
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
6489
|
+
taf: Object.assign(Object.assign({}, fakePublishedTaf.taf), {
|
|
6490
|
+
location: 'EHGG',
|
|
6491
|
+
baseTime: "2022-01-06T12:00:00Z",
|
|
6492
|
+
issueDate: "2022-01-06T12:00:00Z",
|
|
6493
|
+
validDateStart: "2022-01-06T12:00:00Z",
|
|
6494
|
+
validDateEnd: "2022-01-07T18:00:00Z",
|
|
6495
|
+
baseForecast: Object.assign(Object.assign({}, fakePublishedTaf.taf.baseForecast), {
|
|
6496
|
+
valid: {
|
|
6497
|
+
start: "2022-01-06T12:00:00Z",
|
|
6498
|
+
end: "2022-01-07T18:00:00Z"
|
|
6499
|
+
}
|
|
6500
|
+
}),
|
|
6501
|
+
changeGroups: [{
|
|
6502
|
+
change: 'FM',
|
|
6503
|
+
valid: {
|
|
6504
|
+
start: "2022-01-06T12:00:00Z"
|
|
6505
|
+
},
|
|
6506
|
+
visibility: {
|
|
6507
|
+
range: 6000,
|
|
6508
|
+
unit: 'M'
|
|
6509
|
+
},
|
|
6510
|
+
weather: {
|
|
6511
|
+
weather1: '+SHRA'
|
|
6512
|
+
},
|
|
6513
|
+
wind: {
|
|
6514
|
+
direction: 10,
|
|
6515
|
+
speed: 10,
|
|
6516
|
+
unit: 'KT',
|
|
6517
|
+
gust: 35
|
|
6518
|
+
},
|
|
6519
|
+
cloud: {
|
|
6520
|
+
cloud1: {
|
|
6521
|
+
coverage: 'BKN',
|
|
6522
|
+
height: 40
|
|
6523
|
+
},
|
|
6524
|
+
cloud2: {
|
|
6525
|
+
coverage: 'OVC',
|
|
6526
|
+
height: 60,
|
|
6527
|
+
type: 'CB'
|
|
6528
|
+
}
|
|
6529
|
+
}
|
|
6530
|
+
}, {
|
|
6531
|
+
change: 'BECMG',
|
|
6532
|
+
valid: {
|
|
6533
|
+
start: "2022-01-06T23:00:00Z",
|
|
6534
|
+
end: "2022-01-07T00:00:00Z"
|
|
6535
|
+
},
|
|
6536
|
+
wind: {
|
|
6537
|
+
direction: 150,
|
|
6538
|
+
speed: 5,
|
|
6539
|
+
unit: 'KT'
|
|
6540
|
+
},
|
|
6541
|
+
visibility: {
|
|
6542
|
+
range: 1000,
|
|
6543
|
+
unit: 'M'
|
|
6544
|
+
},
|
|
6545
|
+
weather: {
|
|
6546
|
+
weather1: 'MIFG'
|
|
6547
|
+
}
|
|
6548
|
+
}]
|
|
6549
|
+
})
|
|
6550
|
+
});
|
|
6551
|
+
var fakeDraftTaf = {
|
|
6552
|
+
creationDate: "".concat(currentDate, "T18:00:00Z"),
|
|
6553
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6554
|
+
taf: {
|
|
6555
|
+
uuid: '5f9583fjdf0f337925',
|
|
6556
|
+
baseTime: "".concat(currentDate, "T18:00:00Z"),
|
|
6557
|
+
validDateStart: "".concat(currentDate, "T18:00:00Z"),
|
|
6558
|
+
validDateEnd: "".concat(tomorrowDate, "T23:59:00Z"),
|
|
6559
|
+
location: 'EHLE',
|
|
6560
|
+
status: 'DRAFT',
|
|
6561
|
+
type: 'NORMAL',
|
|
6562
|
+
messageType: 'ORG',
|
|
6563
|
+
baseForecast: {
|
|
6564
|
+
valid: {
|
|
6565
|
+
start: "".concat(currentDate, "T18:00:00Z"),
|
|
6566
|
+
end: "".concat(tomorrowDate, "T23:59:00Z")
|
|
6567
|
+
},
|
|
6568
|
+
wind: {
|
|
6569
|
+
direction: 150,
|
|
6570
|
+
speed: 5,
|
|
6571
|
+
unit: 'KT'
|
|
6572
|
+
},
|
|
6573
|
+
visibility: {
|
|
6574
|
+
range: 1000,
|
|
6575
|
+
unit: 'M'
|
|
6576
|
+
},
|
|
6577
|
+
weather: {
|
|
6578
|
+
weather1: 'BCFG'
|
|
6579
|
+
},
|
|
6580
|
+
cloud: {
|
|
6581
|
+
cloud1: {
|
|
6582
|
+
coverage: 'FEW',
|
|
6583
|
+
height: 15
|
|
6584
|
+
}
|
|
6585
|
+
}
|
|
6586
|
+
}
|
|
6587
|
+
}
|
|
6588
|
+
};
|
|
6589
|
+
({
|
|
6590
|
+
creationDate: "2022-01-06T18:00:00Z",
|
|
6591
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6592
|
+
taf: Object.assign(Object.assign({}, fakeDraftTaf.taf), {
|
|
6593
|
+
baseTime: "2022-01-06T18:00:00Z",
|
|
6594
|
+
validDateStart: "2022-01-06T18:00:00Z",
|
|
6595
|
+
validDateEnd: "2022-01-07T23:59:00Z",
|
|
6596
|
+
baseForecast: Object.assign(Object.assign({}, fakeDraftTaf.taf.baseForecast), {
|
|
6597
|
+
valid: {
|
|
6598
|
+
start: "2022-01-06T18:00:00Z",
|
|
6599
|
+
end: "2022-01-07T23:59:00Z"
|
|
6600
|
+
}
|
|
6601
|
+
})
|
|
6602
|
+
})
|
|
6603
|
+
});
|
|
6604
|
+
var fakeDraftAmendmentTaf = {
|
|
6605
|
+
creationDate: "".concat(currentDate, "T14:00:00Z"),
|
|
6606
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6607
|
+
taf: {
|
|
6608
|
+
uuid: '954905487',
|
|
6609
|
+
previousId: '5f9583fjdf45ff4330f337925',
|
|
6610
|
+
issueDate: "".concat(currentDate, "T14:00:00Z"),
|
|
6611
|
+
baseTime: "".concat(currentDate, "T12:00:00Z"),
|
|
6612
|
+
validDateStart: "".concat(currentDate, "T14:00:00Z"),
|
|
6613
|
+
validDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6614
|
+
previousValidDateStart: "".concat(currentDate, "T12:00:00Z"),
|
|
6615
|
+
previousValidDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6616
|
+
location: 'EHAM',
|
|
6617
|
+
status: 'DRAFT_AMENDED',
|
|
6618
|
+
type: 'NORMAL',
|
|
6619
|
+
messageType: 'AMD',
|
|
6620
|
+
baseForecast: {
|
|
6621
|
+
valid: {
|
|
6622
|
+
start: "".concat(currentDate, "T14:00:00Z"),
|
|
6623
|
+
end: "".concat(tomorrowDate, "T18:00:00Z")
|
|
6624
|
+
},
|
|
6625
|
+
visibility: {
|
|
6626
|
+
range: 600,
|
|
6627
|
+
unit: 'M'
|
|
6628
|
+
},
|
|
6629
|
+
wind: {
|
|
6630
|
+
direction: 180,
|
|
6631
|
+
speed: 10,
|
|
6632
|
+
unit: 'KT'
|
|
6633
|
+
},
|
|
6634
|
+
weather: {
|
|
6635
|
+
weather1: 'SN'
|
|
6636
|
+
},
|
|
6637
|
+
cloud: {
|
|
6638
|
+
cloud1: {
|
|
6639
|
+
coverage: 'BKN',
|
|
6640
|
+
height: 35
|
|
6641
|
+
}
|
|
6642
|
+
}
|
|
6643
|
+
},
|
|
6644
|
+
changeGroups: [{
|
|
6645
|
+
change: 'TEMPO',
|
|
6646
|
+
probability: 'PROB30',
|
|
6647
|
+
valid: {
|
|
6648
|
+
start: "".concat(currentDate, "T15:00:00Z"),
|
|
6649
|
+
end: "".concat(currentDate, "T16:00:00Z")
|
|
6650
|
+
},
|
|
6651
|
+
visibility: {
|
|
6652
|
+
range: 100,
|
|
6653
|
+
unit: 'M'
|
|
6654
|
+
},
|
|
6655
|
+
cloud: {
|
|
6656
|
+
cloud1: {
|
|
6657
|
+
verticalVisibility: 5
|
|
6658
|
+
}
|
|
6659
|
+
}
|
|
6660
|
+
}]
|
|
6661
|
+
}
|
|
6662
|
+
};
|
|
6663
|
+
|
|
6664
|
+
({
|
|
6665
|
+
creationDate: "2022-01-06T14:00:00Z",
|
|
6666
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6667
|
+
taf: Object.assign(Object.assign({}, fakeDraftAmendmentTaf.taf), {
|
|
6668
|
+
location: 'EHRD',
|
|
6669
|
+
issueDate: "2022-01-06T14:00:00Z",
|
|
6670
|
+
baseTime: "2022-01-06T12:00:00Z",
|
|
6671
|
+
validDateStart: "2022-01-06T14:00:00Z",
|
|
6672
|
+
validDateEnd: "2022-01-07T18:00:00Z",
|
|
6673
|
+
previousValidDateStart: "2022-01-06T12:00:00Z",
|
|
6674
|
+
previousValidDateEnd: "2022-01-07T18:00:00Z",
|
|
6675
|
+
baseForecast: Object.assign(Object.assign({}, fakeDraftAmendmentTaf.taf.baseForecast), {
|
|
6676
|
+
valid: {
|
|
6677
|
+
start: "2022-01-06T14:00:00Z",
|
|
6678
|
+
end: "2022-01-07T18:00:00Z"
|
|
6679
|
+
}
|
|
6680
|
+
}),
|
|
6681
|
+
changeGroups: []
|
|
6682
|
+
})
|
|
6683
|
+
});
|
|
6684
|
+
var fakeAmendmentTaf = {
|
|
6685
|
+
creationDate: "".concat(currentDate, "T14:00:00Z"),
|
|
6686
|
+
canbe: ['CANCELLED', 'CORRECTED', 'AMENDED'],
|
|
6687
|
+
taf: {
|
|
6688
|
+
uuid: '754905486',
|
|
6689
|
+
previousId: '5f9583fjdf45ff4330f337925',
|
|
6690
|
+
issueDate: "".concat(currentDate, "T14:00:00Z"),
|
|
6691
|
+
baseTime: "".concat(currentDate, "T12:00:00Z"),
|
|
6692
|
+
validDateStart: "".concat(currentDate, "T14:00:00Z"),
|
|
6693
|
+
validDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6694
|
+
previousValidDateStart: "".concat(currentDate, "T12:00:00Z"),
|
|
6695
|
+
previousValidDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6696
|
+
location: 'EHAM',
|
|
6697
|
+
status: 'AMENDED',
|
|
6698
|
+
type: 'NORMAL',
|
|
6699
|
+
messageType: 'AMD',
|
|
6700
|
+
baseForecast: {
|
|
6701
|
+
valid: {
|
|
6702
|
+
start: "".concat(currentDate, "T14:00:00Z"),
|
|
6703
|
+
end: "".concat(tomorrowDate, "T18:00:00Z")
|
|
6704
|
+
},
|
|
6705
|
+
visibility: {
|
|
6706
|
+
range: 600,
|
|
6707
|
+
unit: 'M'
|
|
6708
|
+
},
|
|
6709
|
+
wind: {
|
|
6710
|
+
direction: 180,
|
|
6711
|
+
speed: 10,
|
|
6712
|
+
unit: 'KT'
|
|
6713
|
+
},
|
|
6714
|
+
weather: {
|
|
6715
|
+
weather1: 'SN'
|
|
6716
|
+
},
|
|
6717
|
+
cloud: {
|
|
6718
|
+
cloud1: {
|
|
6719
|
+
coverage: 'BKN',
|
|
6720
|
+
height: 35
|
|
6721
|
+
}
|
|
6722
|
+
}
|
|
6723
|
+
}
|
|
6724
|
+
}
|
|
6725
|
+
};
|
|
6726
|
+
|
|
6727
|
+
({
|
|
6728
|
+
creationDate: "2022-01-06T14:00:00Z",
|
|
6729
|
+
canbe: ['CANCELLED', 'CORRECTED', 'AMENDED'],
|
|
6730
|
+
taf: Object.assign(Object.assign({}, fakeAmendmentTaf.taf), {
|
|
6731
|
+
uuid: '7549058980',
|
|
6732
|
+
issueDate: "2022-01-06T14:00:00Z",
|
|
6733
|
+
baseTime: "2022-01-06T12:00:00Z",
|
|
6734
|
+
validDateStart: "2022-01-06T14:00:00Z",
|
|
6735
|
+
validDateEnd: "2022-01-07T18:00:00Z",
|
|
6736
|
+
previousValidDateStart: "2022-01-06T12:00:00Z",
|
|
6737
|
+
previousValidDateEnd: "2022-01-07T18:00:00Z",
|
|
6738
|
+
baseForecast: Object.assign(Object.assign({}, fakeAmendmentTaf.taf.baseForecast), {
|
|
6739
|
+
valid: {
|
|
6740
|
+
start: "2022-01-06T14:00:00Z",
|
|
6741
|
+
end: "2022-01-07T18:00:00Z"
|
|
6742
|
+
}
|
|
6743
|
+
})
|
|
6744
|
+
})
|
|
6745
|
+
});
|
|
6746
|
+
|
|
6747
|
+
var fakeTafTac = 'TAF EHAM 0812/0918 20020G35KT 0500 SN BKN040\nBECMG 0814/0816 0700 BKN001=';
|
|
6748
|
+
|
|
6749
|
+
var fakePromise = function fakePromise(withRandomError) {
|
|
6750
|
+
return new Promise(function (resolve, reject) {
|
|
6751
|
+
setTimeout(function () {
|
|
6752
|
+
if (!withRandomError) return resolve();
|
|
6753
|
+
var randomError = Math.floor(Math.random() * 4) + 1;
|
|
6754
|
+
return randomError === 4 ? reject(new Error('something went wrong')) : resolve();
|
|
6755
|
+
}, 300);
|
|
6756
|
+
});
|
|
6757
|
+
};
|
|
6758
|
+
|
|
6759
|
+
var fakeAxiosInstance = {
|
|
6760
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars, @typescript-eslint/explicit-module-boundary-types
|
|
6761
|
+
get: function get(_url, _params) {
|
|
6762
|
+
return fakePromise(false);
|
|
6763
|
+
},
|
|
6764
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars, @typescript-eslint/explicit-module-boundary-types
|
|
6765
|
+
post: function post(_url, _params) {
|
|
6766
|
+
return fakePromise(false);
|
|
6767
|
+
}
|
|
6768
|
+
};
|
|
6769
|
+
var createApi = function createApi() {
|
|
6770
|
+
return {
|
|
6771
|
+
getTafList: function getTafList() {
|
|
6772
|
+
// eslint-disable-next-line no-console
|
|
6773
|
+
console.log('Retrieving new TAF list');
|
|
6774
|
+
return fakeAxiosInstance.get('/taflist').then(function () {
|
|
6775
|
+
return {
|
|
6776
|
+
data: _toConsumableArray(fakeTafList)
|
|
6777
|
+
};
|
|
6778
|
+
});
|
|
6779
|
+
},
|
|
6780
|
+
getTAC: function getTAC() {
|
|
6781
|
+
// eslint-disable-next-line no-console
|
|
6782
|
+
return fakeAxiosInstance.post('/taf2tac').then(function () {
|
|
6783
|
+
return {
|
|
6784
|
+
data: fakeTafTac
|
|
6785
|
+
};
|
|
6786
|
+
});
|
|
6787
|
+
},
|
|
6788
|
+
postTaf: function postTaf(_postTaf) {
|
|
6789
|
+
// eslint-disable-next-line no-console
|
|
6790
|
+
console.log("The new status of the taf will be ".concat(_postTaf.changeStatusTo)); // eslint-disable-next-line no-console
|
|
6791
|
+
|
|
6792
|
+
console.log('form has been posted with following values:', _postTaf.taf);
|
|
6793
|
+
return fakeAxiosInstance.post('/taf', _postTaf);
|
|
6794
|
+
}
|
|
6795
|
+
};
|
|
6796
|
+
};
|
|
6797
|
+
|
|
6798
|
+
/* *
|
|
6799
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6800
|
+
* you may not use this file except in compliance with the License.
|
|
6801
|
+
* You may obtain a copy of the License at
|
|
6802
|
+
*
|
|
6803
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6804
|
+
*
|
|
6805
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6806
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6807
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6808
|
+
* See the License for the specific language governing permissions and
|
|
6809
|
+
* limitations under the License.
|
|
6810
|
+
*
|
|
6811
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
6812
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
6813
|
+
* */
|
|
6814
|
+
var tafScreenPreset = {
|
|
6815
|
+
id: 'screenConfigTaf',
|
|
6816
|
+
title: 'TAF',
|
|
6817
|
+
views: {
|
|
6818
|
+
byId: {
|
|
6819
|
+
taf: {
|
|
6820
|
+
title: 'TAF',
|
|
6821
|
+
componentType: 'TafModule',
|
|
6822
|
+
initialProps: {}
|
|
6823
|
+
}
|
|
6824
|
+
},
|
|
6825
|
+
allIds: ['taf']
|
|
6826
|
+
},
|
|
6827
|
+
syncGroups: [],
|
|
6828
|
+
mosaicNode: 'taf'
|
|
6829
|
+
};
|
|
6830
|
+
var TafApiWrapper = function TafApiWrapper(_ref) {
|
|
6831
|
+
var config = _ref.config,
|
|
6832
|
+
auth = _ref.auth,
|
|
6833
|
+
onSetAuth = _ref.onSetAuth,
|
|
6834
|
+
onPreventCloseView = _ref.onPreventCloseView;
|
|
6835
|
+
return config ? /*#__PURE__*/React.createElement(ApiProvider, {
|
|
6836
|
+
baseURL: config.baseUrl,
|
|
6837
|
+
appURL: config.appUrl,
|
|
6838
|
+
auth: auth,
|
|
6839
|
+
onSetAuth: onSetAuth,
|
|
6840
|
+
createApi: createApi$1,
|
|
6841
|
+
authTokenUrl: config.authTokenUrl,
|
|
6842
|
+
authClientId: config.authClientId
|
|
6843
|
+
}, /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(Wrapper, {
|
|
6844
|
+
onPreventCloseView: onPreventCloseView
|
|
6845
|
+
}))) : null;
|
|
6846
|
+
};
|
|
6847
|
+
var componentsLookUp = function componentsLookUp(payload, _ref2) {
|
|
6848
|
+
var config = _ref2.config,
|
|
6849
|
+
auth = _ref2.auth,
|
|
6850
|
+
onSetAuth = _ref2.onSetAuth;
|
|
6851
|
+
var ConnectedModuleWrapper = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
6852
|
+
var componentType = payload.componentType;
|
|
6853
|
+
|
|
6854
|
+
switch (componentType) {
|
|
6855
|
+
case 'TafModule':
|
|
6856
|
+
if (ConnectedModuleWrapper) {
|
|
6857
|
+
return /*#__PURE__*/React.createElement(ConnectedModuleWrapper, {
|
|
6858
|
+
component: TafApiWrapper,
|
|
6859
|
+
payload: payload,
|
|
6860
|
+
"data-testid": "tafmodule",
|
|
6861
|
+
config: config,
|
|
6862
|
+
auth: auth,
|
|
6863
|
+
onSetAuth: onSetAuth
|
|
6864
|
+
});
|
|
6865
|
+
}
|
|
6866
|
+
|
|
6867
|
+
return /*#__PURE__*/React.createElement(TafApiWrapper, {
|
|
6868
|
+
"data-testid": "tafmodule",
|
|
6869
|
+
config: config,
|
|
6870
|
+
auth: auth,
|
|
6871
|
+
onSetAuth: onSetAuth
|
|
6872
|
+
});
|
|
6873
|
+
|
|
6874
|
+
default:
|
|
6875
|
+
return null;
|
|
6876
|
+
}
|
|
6877
|
+
};
|
|
6878
|
+
|
|
6879
|
+
export { TafApiWrapper, TafForm, Wrapper as TafModule, componentsLookUp, createApi$1 as createApi, createApi as createFakeApi, tafScreenPreset };
|