@opengeoweb/taf 2.4.0 → 2.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +1 -0
- package/index.esm.js +1427 -264
- package/index.umd.js +1449 -294
- 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/{TafForm/TafFormWrapper.spec.d.ts → IssuesPane/IssuesPaneWrapper.spec.d.ts} +0 -0
- package/lib/components/IssuesPane/types.d.ts +11 -0
- package/lib/components/IssuesPane/utils.d.ts +10 -0
- package/lib/components/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/{TafFormWrapper.stories.d.ts → TafForm.stories.d.ts} +0 -0
- package/lib/components/TafForm/index.d.ts +1 -1
- package/lib/components/TafLayout/TafLayout.stories.d.ts +10 -2
- package/lib/components/TafLayout/TafPanel/TafPanel.d.ts +4 -0
- package/lib/components/TafLayout/TopTabs/TopTabs.d.ts +0 -2
- package/lib/components/TafWrapper/TafWrapper.d.ts +6 -0
- package/lib/components/TafWrapper/TafWrapper.spec.d.ts +1 -0
- package/lib/components/TafWrapper/index.d.ts +1 -0
- package/lib/utils/mockdata/fakeTafList.d.ts +2 -0
- package/package.json +5 -5
- package/lib/components/TafForm/TafFormWrapper.d.ts +0 -11
package/index.esm.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
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';
|
|
6
|
+
import { getDeepProperty, ReactHookFormHiddenInput, ReactHookFormProvider } from '@opengeoweb/form-fields';
|
|
7
7
|
import { useApiContext, useApi, createApiInstance } from '@opengeoweb/api';
|
|
8
8
|
import { useIsMounted, ToggleMenu, useDraftFormHelpers, ToolContainerDraggable, useConfirmationDialog, usePreventBrowserClose, ToolButton, ToolHeader, AlertBanner, getAxiosErrorMessage, ConfirmationServiceProvider, usePoller } from '@opengeoweb/shared';
|
|
9
9
|
import moment from 'moment';
|
|
@@ -2216,8 +2216,9 @@ var convertTafValuesToObject = function convertTafValuesToObject(formData) {
|
|
|
2216
2216
|
.filter(function (value) {
|
|
2217
2217
|
return Object.keys(value).length;
|
|
2218
2218
|
});
|
|
2219
|
+
var parsedBaseForecast = productToPost.baseForecast && parseFormValues(productToPost.baseForecast, tafStart, tafEnd);
|
|
2219
2220
|
var parsedFormValues = Object.assign(Object.assign({}, productToPost), {
|
|
2220
|
-
baseForecast:
|
|
2221
|
+
baseForecast: parsedBaseForecast,
|
|
2221
2222
|
changeGroups: parsedChangeGroups
|
|
2222
2223
|
});
|
|
2223
2224
|
return Object.keys(parsedFormValues).reduce(function (list, key) {
|
|
@@ -3487,6 +3488,171 @@ var DragHandle = function DragHandle(_ref) {
|
|
|
3487
3488
|
}, /*#__PURE__*/React__default.createElement(DragIndicator, null));
|
|
3488
3489
|
};
|
|
3489
3490
|
|
|
3491
|
+
/* *
|
|
3492
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3493
|
+
* you may not use this file except in compliance with the License.
|
|
3494
|
+
* You may obtain a copy of the License at
|
|
3495
|
+
*
|
|
3496
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3497
|
+
*
|
|
3498
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3499
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3500
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3501
|
+
* See the License for the specific language governing permissions and
|
|
3502
|
+
* limitations under the License.
|
|
3503
|
+
*
|
|
3504
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3505
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
3506
|
+
* */
|
|
3507
|
+
var getCustomError = function getCustomError(error) {
|
|
3508
|
+
var name = error.ref.name;
|
|
3509
|
+
var isChangeGroup = name.includes('changeGroups');
|
|
3510
|
+
var matchRowNumber = name.match(/\[(.*?)\]/);
|
|
3511
|
+
var row = matchRowNumber ? parseInt(matchRowNumber[1], 10) : null;
|
|
3512
|
+
return Object.assign(Object.assign({}, error), {
|
|
3513
|
+
isChangeGroup: isChangeGroup,
|
|
3514
|
+
row: row
|
|
3515
|
+
});
|
|
3516
|
+
};
|
|
3517
|
+
var getIssuesLabel = function getIssuesLabel(sumOfErrors) {
|
|
3518
|
+
switch (sumOfErrors) {
|
|
3519
|
+
case 0:
|
|
3520
|
+
return '0 issues';
|
|
3521
|
+
|
|
3522
|
+
case 1:
|
|
3523
|
+
return '1 issue';
|
|
3524
|
+
|
|
3525
|
+
default:
|
|
3526
|
+
return "".concat(sumOfErrors, " issues");
|
|
3527
|
+
}
|
|
3528
|
+
};
|
|
3529
|
+
|
|
3530
|
+
var getErrorValues = function getErrorValues(fieldErrors) {
|
|
3531
|
+
if (!fieldErrors) return [];
|
|
3532
|
+
return Object.keys(fieldErrors).reduce(function (list, key) {
|
|
3533
|
+
var error = Object.assign({}, fieldErrors[key]);
|
|
3534
|
+
|
|
3535
|
+
if (error.ref) {
|
|
3536
|
+
return list.concat(getCustomError(error));
|
|
3537
|
+
}
|
|
3538
|
+
|
|
3539
|
+
return list.concat(getErrorValues(error));
|
|
3540
|
+
}, []);
|
|
3541
|
+
};
|
|
3542
|
+
|
|
3543
|
+
var filterDuplicateErrors = function filterDuplicateErrors(errors) {
|
|
3544
|
+
return errors.reduce(function (list, error) {
|
|
3545
|
+
// check on type validateRequiredSub and validateRequiredMainOptional since these are giving 'duplicates'
|
|
3546
|
+
if (error.type === 'validateRequiredSub') {
|
|
3547
|
+
var exist = list.find(function (e) {
|
|
3548
|
+
return e.type === 'validateRequiredSub' && e.row === error.row;
|
|
3549
|
+
});
|
|
3550
|
+
return exist ? list : list.concat(error);
|
|
3551
|
+
}
|
|
3552
|
+
|
|
3553
|
+
if (error.type === 'validateRequiredMainOptional') {
|
|
3554
|
+
var _exist = list.find(function (e) {
|
|
3555
|
+
return e.type === 'validateRequiredMainOptional' && e.row === error.row;
|
|
3556
|
+
});
|
|
3557
|
+
|
|
3558
|
+
return _exist ? list : list.concat(error);
|
|
3559
|
+
}
|
|
3560
|
+
|
|
3561
|
+
return list.concat(error);
|
|
3562
|
+
}, []);
|
|
3563
|
+
};
|
|
3564
|
+
var getErrors = function getErrors(errors) {
|
|
3565
|
+
var errorList = Object.keys(errors).reduce(function (list, key) {
|
|
3566
|
+
var errorValue = errors[key];
|
|
3567
|
+
|
|
3568
|
+
if (Array.isArray(errorValue)) {
|
|
3569
|
+
var errorValues = errorValue.reduce(function (l, i) {
|
|
3570
|
+
return l.concat(getErrorValues(i));
|
|
3571
|
+
}, []);
|
|
3572
|
+
return list.concat.apply(list, _toConsumableArray(errorValues));
|
|
3573
|
+
}
|
|
3574
|
+
|
|
3575
|
+
return list.concat(getErrorValues(errorValue));
|
|
3576
|
+
}, []);
|
|
3577
|
+
return errorList;
|
|
3578
|
+
};
|
|
3579
|
+
|
|
3580
|
+
/* *
|
|
3581
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3582
|
+
* you may not use this file except in compliance with the License.
|
|
3583
|
+
* You may obtain a copy of the License at
|
|
3584
|
+
*
|
|
3585
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3586
|
+
*
|
|
3587
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
3588
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3589
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3590
|
+
* See the License for the specific language governing permissions and
|
|
3591
|
+
* limitations under the License.
|
|
3592
|
+
*
|
|
3593
|
+
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
3594
|
+
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
3595
|
+
* */
|
|
3596
|
+
|
|
3597
|
+
var IssuesButton = function IssuesButton(_ref) {
|
|
3598
|
+
var _ref$errors = _ref.errors,
|
|
3599
|
+
errors = _ref$errors === void 0 ? {} : _ref$errors,
|
|
3600
|
+
_ref$isIssuesPaneOpen = _ref.isIssuesPaneOpen,
|
|
3601
|
+
isIssuesPaneOpen = _ref$isIssuesPaneOpen === void 0 ? false : _ref$isIssuesPaneOpen,
|
|
3602
|
+
_ref$setIsIssuesPaneO = _ref.setIsIssuesPaneOpen,
|
|
3603
|
+
setIsIssuesPaneOpen = _ref$setIsIssuesPaneO === void 0 ? function () {
|
|
3604
|
+
return null;
|
|
3605
|
+
} : _ref$setIsIssuesPaneO;
|
|
3606
|
+
var errorList = filterDuplicateErrors(getErrors(errors));
|
|
3607
|
+
var totalErrors = errorList.length;
|
|
3608
|
+
var errorStatus = totalErrors > 0 ? 'error' : 'success';
|
|
3609
|
+
var buttonColor = "geowebColors.functional.".concat(errorStatus);
|
|
3610
|
+
|
|
3611
|
+
var toggleIssuesPane = function toggleIssuesPane(newPosition) {
|
|
3612
|
+
return setIsIssuesPaneOpen(!isIssuesPaneOpen, newPosition);
|
|
3613
|
+
};
|
|
3614
|
+
|
|
3615
|
+
var onClickButton = function onClickButton(event) {
|
|
3616
|
+
var _a;
|
|
3617
|
+
|
|
3618
|
+
var _event$currentTarget$ = event.currentTarget.getBoundingClientRect(),
|
|
3619
|
+
left = _event$currentTarget$.left,
|
|
3620
|
+
top = _event$currentTarget$.top;
|
|
3621
|
+
|
|
3622
|
+
var parentOffset = ((_a = document.getElementById('tafmodule')) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) || {
|
|
3623
|
+
top: 0,
|
|
3624
|
+
left: 0
|
|
3625
|
+
};
|
|
3626
|
+
var newPosition = {
|
|
3627
|
+
left: left - parentOffset.left + 100,
|
|
3628
|
+
top: top - parentOffset.top
|
|
3629
|
+
};
|
|
3630
|
+
toggleIssuesPane(newPosition);
|
|
3631
|
+
};
|
|
3632
|
+
|
|
3633
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
3634
|
+
title: "View details"
|
|
3635
|
+
}, /*#__PURE__*/React.createElement(Chip, {
|
|
3636
|
+
"data-testid": "issuesButton",
|
|
3637
|
+
className: "status-".concat(errorStatus),
|
|
3638
|
+
size: "small",
|
|
3639
|
+
label: getIssuesLabel(totalErrors),
|
|
3640
|
+
onClick: onClickButton,
|
|
3641
|
+
sx: {
|
|
3642
|
+
width: '74px',
|
|
3643
|
+
color: '#ffffff',
|
|
3644
|
+
backgroundColor: buttonColor,
|
|
3645
|
+
'&:hover': {
|
|
3646
|
+
backgroundColor: buttonColor
|
|
3647
|
+
},
|
|
3648
|
+
'&:focus': {
|
|
3649
|
+
backgroundColor: buttonColor
|
|
3650
|
+
},
|
|
3651
|
+
fontSize: 12
|
|
3652
|
+
}
|
|
3653
|
+
}));
|
|
3654
|
+
};
|
|
3655
|
+
|
|
3490
3656
|
/* *
|
|
3491
3657
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3492
3658
|
* you may not use this file except in compliance with the License.
|
|
@@ -3591,12 +3757,42 @@ var getErrorMessage = function getErrorMessage(error, index) {
|
|
|
3591
3757
|
return "".concat(index + 1, ". ").concat(fieldErrorTitle, ": ").concat(getErrorDefaultMessage(error));
|
|
3592
3758
|
};
|
|
3593
3759
|
var MODAL_DIALOG_ELEMENT = 'modal-dialog';
|
|
3760
|
+
var useIssuesPane = function useIssuesPane() {
|
|
3761
|
+
var _React$useState = React.useState(false),
|
|
3762
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3763
|
+
isIssuesPaneOpen = _React$useState2[0],
|
|
3764
|
+
setIsIssuesPaneOpen = _React$useState2[1];
|
|
3765
|
+
|
|
3766
|
+
var _React$useState3 = React.useState(null),
|
|
3767
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3768
|
+
startPosition = _React$useState4[0],
|
|
3769
|
+
setStartPosition = _React$useState4[1];
|
|
3770
|
+
|
|
3771
|
+
var onToggleIssuesPane = function onToggleIssuesPane(isOpen, newPosition) {
|
|
3772
|
+
if (!startPosition) {
|
|
3773
|
+
setStartPosition(newPosition);
|
|
3774
|
+
}
|
|
3775
|
+
|
|
3776
|
+
setIsIssuesPaneOpen(isOpen);
|
|
3777
|
+
};
|
|
3778
|
+
|
|
3779
|
+
var onCloseIssuesPane = function onCloseIssuesPane() {
|
|
3780
|
+
return setIsIssuesPaneOpen(false);
|
|
3781
|
+
};
|
|
3782
|
+
|
|
3783
|
+
return {
|
|
3784
|
+
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
3785
|
+
startPosition: startPosition,
|
|
3786
|
+
onToggleIssuesPane: onToggleIssuesPane,
|
|
3787
|
+
onCloseIssuesPane: onCloseIssuesPane
|
|
3788
|
+
};
|
|
3789
|
+
};
|
|
3594
3790
|
|
|
3595
3791
|
var IssuesPane = function IssuesPane(_ref3) {
|
|
3596
|
-
var
|
|
3597
|
-
handleClose = _ref3.handleClose,
|
|
3598
|
-
_ref3$errorList = _ref3.errorList,
|
|
3792
|
+
var _ref3$errorList = _ref3.errorList,
|
|
3599
3793
|
errorList = _ref3$errorList === void 0 ? [] : _ref3$errorList,
|
|
3794
|
+
isOpen = _ref3.isOpen,
|
|
3795
|
+
handleClose = _ref3.handleClose,
|
|
3600
3796
|
_ref3$startPosition = _ref3.startPosition,
|
|
3601
3797
|
startPosition = _ref3$startPosition === void 0 ? {
|
|
3602
3798
|
left: 20,
|
|
@@ -3639,182 +3835,73 @@ var IssuesPane = function IssuesPane(_ref3) {
|
|
|
3639
3835
|
}))), rootElement);
|
|
3640
3836
|
};
|
|
3641
3837
|
|
|
3642
|
-
var
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
var row = matchRowNumber ? parseInt(matchRowNumber[1], 10) : null;
|
|
3647
|
-
return Object.assign(Object.assign({}, error), {
|
|
3648
|
-
isChangeGroup: isChangeGroup,
|
|
3649
|
-
row: row
|
|
3650
|
-
});
|
|
3651
|
-
};
|
|
3838
|
+
var fromStatusToAction = function fromStatusToAction(tafStatus) {
|
|
3839
|
+
switch (tafStatus) {
|
|
3840
|
+
case 'DRAFT':
|
|
3841
|
+
return 'DRAFT';
|
|
3652
3842
|
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
case 0:
|
|
3656
|
-
return '0 issues';
|
|
3843
|
+
case 'DRAFT_AMENDED':
|
|
3844
|
+
return 'DRAFT_AMEND';
|
|
3657
3845
|
|
|
3658
|
-
case
|
|
3659
|
-
return '
|
|
3846
|
+
case 'DRAFT_CORRECTED':
|
|
3847
|
+
return 'DRAFT_CORRECT';
|
|
3848
|
+
|
|
3849
|
+
case 'PUBLISHED':
|
|
3850
|
+
return 'PUBLISH';
|
|
3851
|
+
|
|
3852
|
+
case 'AMENDED':
|
|
3853
|
+
return 'AMEND';
|
|
3854
|
+
|
|
3855
|
+
case 'CORRECTED':
|
|
3856
|
+
return 'CORRECT';
|
|
3857
|
+
|
|
3858
|
+
case 'CANCELLED':
|
|
3859
|
+
return 'CANCEL';
|
|
3660
3860
|
|
|
3661
3861
|
default:
|
|
3662
|
-
return
|
|
3862
|
+
return 'NEW';
|
|
3663
3863
|
}
|
|
3664
|
-
};
|
|
3864
|
+
}; // prevents default functionality
|
|
3665
3865
|
|
|
3666
|
-
var getErrorValues = function getErrorValues(fieldErrors) {
|
|
3667
|
-
if (!fieldErrors) return [];
|
|
3668
|
-
return Object.keys(fieldErrors).reduce(function (list, key) {
|
|
3669
|
-
var error = Object.assign({}, fieldErrors[key]);
|
|
3670
3866
|
|
|
3671
|
-
|
|
3672
|
-
return list.concat(getCustomError(error));
|
|
3673
|
-
}
|
|
3867
|
+
var noop = function noop() {};
|
|
3674
3868
|
|
|
3675
|
-
|
|
3676
|
-
|
|
3677
|
-
|
|
3869
|
+
var TafForm = function TafForm(_ref) {
|
|
3870
|
+
var _ref$isDisabled = _ref.isDisabled,
|
|
3871
|
+
isDefaultDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
3872
|
+
tafFromBackend = _ref.tafFromBackend,
|
|
3873
|
+
_ref$onFormAction = _ref.onFormAction,
|
|
3874
|
+
onFormAction = _ref$onFormAction === void 0 ? function () {
|
|
3875
|
+
return null;
|
|
3876
|
+
} : _ref$onFormAction,
|
|
3877
|
+
_ref$onFormDirty = _ref.onFormDirty,
|
|
3878
|
+
onFormDirty = _ref$onFormDirty === void 0 ? function () {
|
|
3879
|
+
return null;
|
|
3880
|
+
} : _ref$onFormDirty,
|
|
3881
|
+
_ref$isIssuesPaneOpen = _ref.isIssuesPaneOpen,
|
|
3882
|
+
isIssuesPaneOpen = _ref$isIssuesPaneOpen === void 0 ? false : _ref$isIssuesPaneOpen,
|
|
3883
|
+
_ref$setIsIssuesPaneO = _ref.setIsIssuesPaneOpen,
|
|
3884
|
+
setIsIssuesPaneOpen = _ref$setIsIssuesPaneO === void 0 ? function () {
|
|
3885
|
+
return null;
|
|
3886
|
+
} : _ref$setIsIssuesPaneO;
|
|
3887
|
+
var originalTaf = tafFromBackend.taf;
|
|
3888
|
+
var defaultTafAction = fromStatusToAction(originalTaf.status);
|
|
3678
3889
|
|
|
3679
|
-
var
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
var exist = list.find(function (e) {
|
|
3684
|
-
return e.type === 'validateRequiredSub' && e.row === error.row;
|
|
3685
|
-
});
|
|
3686
|
-
return exist ? list : list.concat(error);
|
|
3687
|
-
}
|
|
3890
|
+
var _React$useState = React__default.useState(defaultTafAction),
|
|
3891
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3892
|
+
tafAction = _React$useState2[0],
|
|
3893
|
+
setTafAction = _React$useState2[1];
|
|
3688
3894
|
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3895
|
+
var _React$useState3 = React__default.useState(isDefaultDisabled),
|
|
3896
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3897
|
+
isDisabled = _React$useState4[0],
|
|
3898
|
+
setIsDisabled = _React$useState4[1];
|
|
3693
3899
|
|
|
3694
|
-
|
|
3695
|
-
}
|
|
3900
|
+
var confirmDialog = useConfirmationDialog();
|
|
3696
3901
|
|
|
3697
|
-
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
|
|
3701
|
-
var getErrors = function getErrors(errors) {
|
|
3702
|
-
var errorList = Object.keys(errors).reduce(function (list, key) {
|
|
3703
|
-
var errorValue = errors[key];
|
|
3704
|
-
|
|
3705
|
-
if (Array.isArray(errorValue)) {
|
|
3706
|
-
var errorValues = errorValue.reduce(function (l, i) {
|
|
3707
|
-
return l.concat(getErrorValues(i));
|
|
3708
|
-
}, []);
|
|
3709
|
-
return list.concat.apply(list, _toConsumableArray(errorValues));
|
|
3710
|
-
}
|
|
3711
|
-
|
|
3712
|
-
return list.concat(getErrorValues(errorValue));
|
|
3713
|
-
}, []);
|
|
3714
|
-
return errorList;
|
|
3715
|
-
};
|
|
3716
|
-
|
|
3717
|
-
var IssuesButton = function IssuesButton(_ref) {
|
|
3718
|
-
var _ref$errors = _ref.errors,
|
|
3719
|
-
errors = _ref$errors === void 0 ? {} : _ref$errors;
|
|
3720
|
-
var errorList = filterDuplicateErrors(getErrors(errors));
|
|
3721
|
-
var totalErrors = errorList.length;
|
|
3722
|
-
var errorStatus = totalErrors > 0 ? 'error' : 'success';
|
|
3723
|
-
var buttonColor = "geowebColors.functional.".concat(errorStatus);
|
|
3724
|
-
|
|
3725
|
-
var _React$useState = React.useState(false),
|
|
3726
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3727
|
-
isIssuesPaneOpen = _React$useState2[0],
|
|
3728
|
-
setIsIssuesPaneOpen = _React$useState2[1];
|
|
3729
|
-
|
|
3730
|
-
var toggleIssuesPane = function toggleIssuesPane() {
|
|
3731
|
-
return setIsIssuesPaneOpen(!isIssuesPaneOpen);
|
|
3732
|
-
};
|
|
3733
|
-
|
|
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
|
-
var onClickButton = function onClickButton(event) {
|
|
3743
|
-
var _a;
|
|
3744
|
-
|
|
3745
|
-
var _event$currentTarget$ = event.currentTarget.getBoundingClientRect(),
|
|
3746
|
-
left = _event$currentTarget$.left,
|
|
3747
|
-
top = _event$currentTarget$.top;
|
|
3748
|
-
|
|
3749
|
-
var parentOffset = ((_a = document.getElementById('tafmodule')) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect()) || {
|
|
3750
|
-
top: 0,
|
|
3751
|
-
left: 0
|
|
3752
|
-
};
|
|
3753
|
-
var newPosition = {
|
|
3754
|
-
left: left - parentOffset.left + 100,
|
|
3755
|
-
top: top - parentOffset.top
|
|
3756
|
-
};
|
|
3757
|
-
setStartPosition(newPosition);
|
|
3758
|
-
toggleIssuesPane();
|
|
3759
|
-
};
|
|
3760
|
-
|
|
3761
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Tooltip, {
|
|
3762
|
-
title: "View details"
|
|
3763
|
-
}, /*#__PURE__*/React.createElement(Chip, {
|
|
3764
|
-
"data-testid": "issuesButton",
|
|
3765
|
-
className: "status-".concat(errorStatus),
|
|
3766
|
-
size: "small",
|
|
3767
|
-
label: getIssuesLabel(totalErrors),
|
|
3768
|
-
onClick: onClickButton,
|
|
3769
|
-
sx: {
|
|
3770
|
-
width: '74px',
|
|
3771
|
-
color: '#ffffff',
|
|
3772
|
-
backgroundColor: buttonColor,
|
|
3773
|
-
'&:hover': {
|
|
3774
|
-
backgroundColor: buttonColor
|
|
3775
|
-
},
|
|
3776
|
-
'&:focus': {
|
|
3777
|
-
backgroundColor: buttonColor
|
|
3778
|
-
},
|
|
3779
|
-
fontSize: 12
|
|
3780
|
-
}
|
|
3781
|
-
})), /*#__PURE__*/React.createElement(IssuesPane, {
|
|
3782
|
-
errorList: errorList,
|
|
3783
|
-
handleClose: toggleIssuesPane,
|
|
3784
|
-
isOpen: isIssuesPaneOpen,
|
|
3785
|
-
startPosition: startPosition
|
|
3786
|
-
}));
|
|
3787
|
-
};
|
|
3788
|
-
|
|
3789
|
-
var noop = function noop() {};
|
|
3790
|
-
|
|
3791
|
-
var TafForm = function TafForm(_ref) {
|
|
3792
|
-
var defaultTafAction = _ref.tafAction,
|
|
3793
|
-
isDefaultDisabled = _ref.isDisabled,
|
|
3794
|
-
_ref$staticTAC = _ref.staticTAC,
|
|
3795
|
-
staticTAC = _ref$staticTAC === void 0 ? '' : _ref$staticTAC,
|
|
3796
|
-
tafFromBackend = _ref.tafFromBackend,
|
|
3797
|
-
_ref$onFormAction = _ref.onFormAction,
|
|
3798
|
-
onFormAction = _ref$onFormAction === void 0 ? function () {
|
|
3799
|
-
return null;
|
|
3800
|
-
} : _ref$onFormAction;
|
|
3801
|
-
var originalTaf = tafFromBackend.taf;
|
|
3802
|
-
|
|
3803
|
-
var _React$useState = React__default.useState(defaultTafAction),
|
|
3804
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3805
|
-
tafAction = _React$useState2[0],
|
|
3806
|
-
setTafAction = _React$useState2[1];
|
|
3807
|
-
|
|
3808
|
-
var _React$useState3 = React__default.useState(isDefaultDisabled),
|
|
3809
|
-
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
3810
|
-
isDisabled = _React$useState4[0],
|
|
3811
|
-
setIsDisabled = _React$useState4[1];
|
|
3812
|
-
|
|
3813
|
-
var confirmDialog = useConfirmationDialog();
|
|
3814
|
-
|
|
3815
|
-
var _useDraftFormHelpers = useDraftFormHelpers(),
|
|
3816
|
-
toggleIsDraft = _useDraftFormHelpers.toggleIsDraft,
|
|
3817
|
-
DraftFieldHelper = _useDraftFormHelpers.DraftFieldHelper;
|
|
3902
|
+
var _useDraftFormHelpers = useDraftFormHelpers(),
|
|
3903
|
+
toggleIsDraft = _useDraftFormHelpers.toggleIsDraft,
|
|
3904
|
+
DraftFieldHelper = _useDraftFormHelpers.DraftFieldHelper;
|
|
3818
3905
|
|
|
3819
3906
|
var _useApiContext = useApiContext(),
|
|
3820
3907
|
api = _useApiContext.api;
|
|
@@ -3825,7 +3912,6 @@ var TafForm = function TafForm(_ref) {
|
|
|
3825
3912
|
var _useFormContext = useFormContext(),
|
|
3826
3913
|
control = _useFormContext.control,
|
|
3827
3914
|
handleSubmit = _useFormContext.handleSubmit,
|
|
3828
|
-
watch = _useFormContext.watch,
|
|
3829
3915
|
trigger = _useFormContext.trigger,
|
|
3830
3916
|
formState = _useFormContext.formState,
|
|
3831
3917
|
getValues = _useFormContext.getValues,
|
|
@@ -3837,12 +3923,12 @@ var TafForm = function TafForm(_ref) {
|
|
|
3837
3923
|
usePreventBrowserClose(isFormDirty && !isDisabled);
|
|
3838
3924
|
var hiddenInputFields = ['baseTime', 'issueDate', 'type', 'uuid', 'validDateStart', 'validDateEnd', 'status', 'previousId', 'previousValidDateStart', 'previousValidDateEnd'];
|
|
3839
3925
|
|
|
3840
|
-
var _React$useState5 = React__default.useState(
|
|
3926
|
+
var _React$useState5 = React__default.useState(getValues()),
|
|
3841
3927
|
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
3842
3928
|
delayedFormValues = _React$useState6[0],
|
|
3843
3929
|
setDelayedFormValues = _React$useState6[1];
|
|
3844
3930
|
|
|
3845
|
-
var _useTACGenerator = useTACGenerator(
|
|
3931
|
+
var _useTACGenerator = useTACGenerator(tafFromBackend.taf, api.getTAC),
|
|
3846
3932
|
_useTACGenerator2 = _slicedToArray(_useTACGenerator, 2),
|
|
3847
3933
|
TAC = _useTACGenerator2[0],
|
|
3848
3934
|
updateTAC = _useTACGenerator2[1];
|
|
@@ -3854,7 +3940,7 @@ var TafForm = function TafForm(_ref) {
|
|
|
3854
3940
|
};
|
|
3855
3941
|
|
|
3856
3942
|
React__default.useEffect(function () {
|
|
3857
|
-
if (
|
|
3943
|
+
if (isMounted.current && isFormDirty) {
|
|
3858
3944
|
var newTAC = hasErrors ? null : convertTafValuesToObject(delayedFormValues);
|
|
3859
3945
|
updateTAC(newTAC);
|
|
3860
3946
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -3866,7 +3952,11 @@ var TafForm = function TafForm(_ref) {
|
|
|
3866
3952
|
updateTAC(convertTafValuesToObject(delayedFormValues));
|
|
3867
3953
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3868
3954
|
|
|
3869
|
-
}, [hasErrors]);
|
|
3955
|
+
}, [hasErrors]); // Needed to be able to show a confirmation dialog on switching tabs when form is edited and not saved
|
|
3956
|
+
|
|
3957
|
+
React__default.useEffect(function () {
|
|
3958
|
+
onFormDirty(isFormDirty);
|
|
3959
|
+
}, [isFormDirty, onFormDirty]);
|
|
3870
3960
|
|
|
3871
3961
|
var onSubmit = function onSubmit(data) {
|
|
3872
3962
|
// eslint-disable-next-line no-console
|
|
@@ -4059,16 +4149,33 @@ var TafForm = function TafForm(_ref) {
|
|
|
4059
4149
|
});
|
|
4060
4150
|
};
|
|
4061
4151
|
|
|
4152
|
+
var _React$useState7 = React__default.useState(false),
|
|
4153
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
4154
|
+
shouldValidate = _React$useState8[0],
|
|
4155
|
+
setShouldValidate = _React$useState8[1];
|
|
4156
|
+
|
|
4062
4157
|
React__default.useEffect(function () {
|
|
4063
|
-
|
|
4158
|
+
var defaultValues = prepareTafValues(tafFromBackend.taf, undefined, !isDisabled && !tafFromBackend.taf.changeGroups); // set initial form values
|
|
4159
|
+
|
|
4160
|
+
reset(defaultValues); // set validate flag to validate after the values have been set
|
|
4161
|
+
|
|
4162
|
+
setShouldValidate(true);
|
|
4163
|
+
return function () {
|
|
4164
|
+
reset();
|
|
4165
|
+
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4166
|
+
}, []);
|
|
4167
|
+
React__default.useEffect(function () {
|
|
4168
|
+
if (shouldValidate && !isDisabled) {
|
|
4064
4169
|
// trigger validation on all changegroup validity times after initial load since they could be outside the new validity period
|
|
4065
|
-
var
|
|
4170
|
+
var _tafFromBackend$taf$c = tafFromBackend.taf.changeGroups,
|
|
4171
|
+
changeGroups = _tafFromBackend$taf$c === void 0 ? [] : _tafFromBackend$taf$c;
|
|
4172
|
+
var validFields = changeGroups.map(function (_field, index) {
|
|
4066
4173
|
return "changeGroups[".concat(index, "].valid");
|
|
4067
4174
|
});
|
|
4068
4175
|
trigger(validFields);
|
|
4069
4176
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4070
4177
|
|
|
4071
|
-
}, []);
|
|
4178
|
+
}, [shouldValidate]);
|
|
4072
4179
|
return /*#__PURE__*/React__default.createElement("form", {
|
|
4073
4180
|
"data-testid": "taf-form",
|
|
4074
4181
|
onSubmit: handleSubmit(onSubmit),
|
|
@@ -4146,7 +4253,9 @@ var TafForm = function TafForm(_ref) {
|
|
|
4146
4253
|
}, /*#__PURE__*/React__default.createElement(Grid, {
|
|
4147
4254
|
item: true
|
|
4148
4255
|
}, /*#__PURE__*/React__default.createElement(IssuesButton, {
|
|
4149
|
-
errors: errors
|
|
4256
|
+
errors: errors,
|
|
4257
|
+
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
4258
|
+
setIsIssuesPaneOpen: setIsIssuesPaneOpen
|
|
4150
4259
|
}))), /*#__PURE__*/React__default.createElement(TafFormButtons, {
|
|
4151
4260
|
isFormDisabled: isDisabled,
|
|
4152
4261
|
tafAction: tafAction,
|
|
@@ -4161,50 +4270,6 @@ var TafForm = function TafForm(_ref) {
|
|
|
4161
4270
|
}), /*#__PURE__*/React__default.createElement(DraftFieldHelper, null));
|
|
4162
4271
|
};
|
|
4163
4272
|
|
|
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
4273
|
/* *
|
|
4209
4274
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4210
4275
|
* you may not use this file except in compliance with the License.
|
|
@@ -4401,15 +4466,9 @@ var muiTabA11yProps = function muiTabA11yProps(index) {
|
|
|
4401
4466
|
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4402
4467
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
4403
4468
|
* */
|
|
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
|
-
};
|
|
4469
|
+
var EditIcon = createSvgIcon( /*#__PURE__*/React.createElement("path", {
|
|
4470
|
+
d: "m8.332 17.09-.005.001-2.652.604.956-2.542.001-.001.001-.001.857-.744 1.69 1.945-.848.738zm.71.815L20.932 7.577 17.823 4 5.933 14.329l-.01.008.005.005L4.173 19l4.857-1.09-.004-.02.019.02-.002-.005z"
|
|
4471
|
+
}), 'Edit');
|
|
4413
4472
|
|
|
4414
4473
|
var StatusIcon = function StatusIcon(_ref) {
|
|
4415
4474
|
var timeSlot = _ref.timeSlot,
|
|
@@ -4420,45 +4479,64 @@ var StatusIcon = function StatusIcon(_ref) {
|
|
|
4420
4479
|
}
|
|
4421
4480
|
|
|
4422
4481
|
if (status === 'EXPIRED') {
|
|
4423
|
-
return /*#__PURE__*/React.createElement(
|
|
4482
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
4483
|
+
title: "Expired",
|
|
4484
|
+
placement: "right"
|
|
4485
|
+
}, /*#__PURE__*/React.createElement(Schedule, {
|
|
4424
4486
|
"data-testid": "status-expired",
|
|
4425
4487
|
fontSize: "small",
|
|
4426
4488
|
sx: {
|
|
4427
4489
|
transform: 'scaleX(-1)',
|
|
4428
4490
|
color: 'geowebColors.buttons.tertiary.disabled.color'
|
|
4429
4491
|
}
|
|
4430
|
-
});
|
|
4492
|
+
}));
|
|
4431
4493
|
}
|
|
4432
4494
|
|
|
4433
4495
|
if (status === 'CANCELLED') {
|
|
4434
|
-
return /*#__PURE__*/React.createElement(
|
|
4496
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
4497
|
+
title: "Cancelled",
|
|
4498
|
+
placement: "right"
|
|
4499
|
+
}, /*#__PURE__*/React.createElement(DoDisturbIcon, {
|
|
4435
4500
|
"data-testid": "status-cancelled",
|
|
4436
4501
|
fontSize: "small",
|
|
4437
4502
|
sx: {
|
|
4438
4503
|
color: 'geowebColors.captions.captionError.rgba'
|
|
4439
4504
|
}
|
|
4440
|
-
});
|
|
4505
|
+
}));
|
|
4441
4506
|
}
|
|
4442
4507
|
|
|
4443
4508
|
if (status === 'DRAFT' || status === 'DRAFT_CORRECTED' || status === 'DRAFT_AMENDED') {
|
|
4444
|
-
return /*#__PURE__*/React.createElement(
|
|
4445
|
-
|
|
4446
|
-
|
|
4509
|
+
return /*#__PURE__*/React.createElement(Tooltip, {
|
|
4510
|
+
title: "Draft",
|
|
4511
|
+
placement: "right"
|
|
4512
|
+
}, /*#__PURE__*/React.createElement(SvgIcon, {
|
|
4513
|
+
component: EditIcon,
|
|
4514
|
+
"data-testid": "status-draft",
|
|
4515
|
+
sx: {
|
|
4516
|
+
color: 'geowebColors.buttons.tertiary.default.color'
|
|
4517
|
+
}
|
|
4518
|
+
}));
|
|
4447
4519
|
}
|
|
4448
4520
|
|
|
4449
|
-
return timeSlot === 'ACTIVE' ? /*#__PURE__*/React.createElement(
|
|
4521
|
+
return timeSlot === 'ACTIVE' ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
4522
|
+
title: "Active",
|
|
4523
|
+
placement: "right"
|
|
4524
|
+
}, /*#__PURE__*/React.createElement(CheckCircle, {
|
|
4450
4525
|
"data-testid": "status-active",
|
|
4451
4526
|
fontSize: "small",
|
|
4452
4527
|
sx: {
|
|
4453
4528
|
color: 'geowebColors.functional.success'
|
|
4454
4529
|
}
|
|
4455
|
-
}) : /*#__PURE__*/React.createElement(
|
|
4530
|
+
})) : /*#__PURE__*/React.createElement(Tooltip, {
|
|
4531
|
+
title: "Upcoming",
|
|
4532
|
+
placement: "right"
|
|
4533
|
+
}, /*#__PURE__*/React.createElement(Schedule, {
|
|
4456
4534
|
"data-testid": "status-upcoming",
|
|
4457
4535
|
fontSize: "small",
|
|
4458
4536
|
sx: {
|
|
4459
4537
|
color: 'geowebColors.functional.success'
|
|
4460
4538
|
}
|
|
4461
|
-
});
|
|
4539
|
+
}));
|
|
4462
4540
|
};
|
|
4463
4541
|
|
|
4464
4542
|
var TacContainer = function TacContainer(_ref) {
|
|
@@ -4744,6 +4822,7 @@ var TacOverviewMobile = function TacOverviewMobile(_ref) {
|
|
|
4744
4822
|
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4745
4823
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
4746
4824
|
* */
|
|
4825
|
+
|
|
4747
4826
|
var formatBaseTime = function formatBaseTime(time) {
|
|
4748
4827
|
return time.format('HH:mm DD MMM');
|
|
4749
4828
|
};
|
|
@@ -4752,7 +4831,13 @@ var TopTabs = function TopTabs(_ref) {
|
|
|
4752
4831
|
var timeSlot = _ref.timeSlot,
|
|
4753
4832
|
_ref$onChangeTimeSlot = _ref.onChangeTimeSlot,
|
|
4754
4833
|
onChangeTimeSlot = _ref$onChangeTimeSlot === void 0 ? function () {} : _ref$onChangeTimeSlot,
|
|
4755
|
-
tafFromBackend = _ref.tafFromBackend
|
|
4834
|
+
_ref$tafFromBackend = _ref.tafFromBackend,
|
|
4835
|
+
tafFromBackend = _ref$tafFromBackend === void 0 ? {
|
|
4836
|
+
taf: {
|
|
4837
|
+
baseTime: '2022-01-06T12:00:00Z',
|
|
4838
|
+
location: 'EHAM'
|
|
4839
|
+
}
|
|
4840
|
+
} : _ref$tafFromBackend;
|
|
4756
4841
|
|
|
4757
4842
|
if (!tafFromBackend) {
|
|
4758
4843
|
return null;
|
|
@@ -4780,12 +4865,13 @@ var TopTabs = function TopTabs(_ref) {
|
|
|
4780
4865
|
value: activeTab,
|
|
4781
4866
|
onChange: onChangeTab,
|
|
4782
4867
|
"aria-label": "timeslot-tabs",
|
|
4868
|
+
"data-testid": "timeslot-tabs",
|
|
4783
4869
|
variant: "fullWidth"
|
|
4784
4870
|
}, tabs.map(function (tab, index) {
|
|
4785
4871
|
return /*#__PURE__*/React__default.createElement(Tab, Object.assign({
|
|
4786
4872
|
key: tab.title,
|
|
4787
4873
|
label: tab.title,
|
|
4788
|
-
"data-testid": "
|
|
4874
|
+
"data-testid": "toptab-".concat(index),
|
|
4789
4875
|
sx: {
|
|
4790
4876
|
fontSize: 16
|
|
4791
4877
|
}
|
|
@@ -4927,7 +5013,17 @@ var TafPanel = function TafPanel(_ref) {
|
|
|
4927
5013
|
activeTafIndex = _ref.activeTafIndex,
|
|
4928
5014
|
index = _ref.index,
|
|
4929
5015
|
_ref$onPostTaf = _ref.onPostTaf,
|
|
4930
|
-
onPostTaf = _ref$onPostTaf === void 0 ? function () {} : _ref$onPostTaf
|
|
5016
|
+
onPostTaf = _ref$onPostTaf === void 0 ? function () {} : _ref$onPostTaf,
|
|
5017
|
+
_ref$onFormDirty = _ref.onFormDirty,
|
|
5018
|
+
onFormDirty = _ref$onFormDirty === void 0 ? function () {
|
|
5019
|
+
return null;
|
|
5020
|
+
} : _ref$onFormDirty,
|
|
5021
|
+
_ref$isIssuesPaneOpen = _ref.isIssuesPaneOpen,
|
|
5022
|
+
isIssuesPaneOpen = _ref$isIssuesPaneOpen === void 0 ? false : _ref$isIssuesPaneOpen,
|
|
5023
|
+
_ref$setIsIssuesPaneO = _ref.setIsIssuesPaneOpen,
|
|
5024
|
+
setIsIssuesPaneOpen = _ref$setIsIssuesPaneO === void 0 ? function () {
|
|
5025
|
+
return null;
|
|
5026
|
+
} : _ref$setIsIssuesPaneO;
|
|
4931
5027
|
|
|
4932
5028
|
var _useApiContext = useApiContext(),
|
|
4933
5029
|
api = _useApiContext.api;
|
|
@@ -4968,14 +5064,15 @@ var TafPanel = function TafPanel(_ref) {
|
|
|
4968
5064
|
|
|
4969
5065
|
case 4:
|
|
4970
5066
|
setLoading(false);
|
|
4971
|
-
setError(null);
|
|
5067
|
+
setError(null);
|
|
5068
|
+
onFormDirty(false); // callback
|
|
4972
5069
|
|
|
4973
5070
|
onPostTaf();
|
|
4974
|
-
_context.next =
|
|
5071
|
+
_context.next = 16;
|
|
4975
5072
|
break;
|
|
4976
5073
|
|
|
4977
|
-
case
|
|
4978
|
-
_context.prev =
|
|
5074
|
+
case 10:
|
|
5075
|
+
_context.prev = 10;
|
|
4979
5076
|
_context.t0 = _context["catch"](0);
|
|
4980
5077
|
newError = data.changeStatusTo === 'CANCELLED' ? {
|
|
4981
5078
|
type: 'CANCELLED',
|
|
@@ -4989,12 +5086,12 @@ var TafPanel = function TafPanel(_ref) {
|
|
|
4989
5086
|
setLoading(false);
|
|
4990
5087
|
throw _context.t0;
|
|
4991
5088
|
|
|
4992
|
-
case
|
|
5089
|
+
case 16:
|
|
4993
5090
|
case "end":
|
|
4994
5091
|
return _context.stop();
|
|
4995
5092
|
}
|
|
4996
5093
|
}
|
|
4997
|
-
}, _callee, null, [[0,
|
|
5094
|
+
}, _callee, null, [[0, 10]]);
|
|
4998
5095
|
}));
|
|
4999
5096
|
};
|
|
5000
5097
|
|
|
@@ -5062,18 +5159,55 @@ var TafPanel = function TafPanel(_ref) {
|
|
|
5062
5159
|
title: error.title,
|
|
5063
5160
|
info: error.message,
|
|
5064
5161
|
dataTestId: "taf-error"
|
|
5065
|
-
}), /*#__PURE__*/React__default.createElement(
|
|
5066
|
-
|
|
5162
|
+
}), /*#__PURE__*/React__default.createElement(TafForm, {
|
|
5163
|
+
isDisabled: getViewMode(tafFromBackend.taf.status) === 'view',
|
|
5067
5164
|
tafFromBackend: tafFromBackend,
|
|
5068
|
-
onFormAction: onTafAction
|
|
5165
|
+
onFormAction: onTafAction,
|
|
5166
|
+
onFormDirty: onFormDirty,
|
|
5167
|
+
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
5168
|
+
setIsIssuesPaneOpen: setIsIssuesPaneOpen
|
|
5069
5169
|
}));
|
|
5070
5170
|
};
|
|
5071
5171
|
|
|
5172
|
+
/* *
|
|
5173
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5174
|
+
* you may not use this file except in compliance with the License.
|
|
5175
|
+
* You may obtain a copy of the License at
|
|
5176
|
+
*
|
|
5177
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5178
|
+
*
|
|
5179
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5180
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5181
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5182
|
+
* See the License for the specific language governing permissions and
|
|
5183
|
+
* limitations under the License.
|
|
5184
|
+
*
|
|
5185
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5186
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
5187
|
+
* */
|
|
5188
|
+
|
|
5189
|
+
var IssuesPaneWrapper = function IssuesPaneWrapper(props) {
|
|
5190
|
+
var _useFormContext = useFormContext(),
|
|
5191
|
+
errors = _useFormContext.formState.errors;
|
|
5192
|
+
|
|
5193
|
+
var errorList = filterDuplicateErrors(getErrors(errors));
|
|
5194
|
+
return /*#__PURE__*/React.createElement(IssuesPane, Object.assign({
|
|
5195
|
+
errorList: errorList
|
|
5196
|
+
}, props));
|
|
5197
|
+
};
|
|
5198
|
+
|
|
5072
5199
|
var TafLayout = function TafLayout(_ref) {
|
|
5073
5200
|
var _ref$tafList = _ref.tafList,
|
|
5074
5201
|
tafList = _ref$tafList === void 0 ? [] : _ref$tafList,
|
|
5075
5202
|
_ref$onPostTaf = _ref.onPostTaf,
|
|
5076
5203
|
onPostTaf = _ref$onPostTaf === void 0 ? function () {} : _ref$onPostTaf;
|
|
5204
|
+
var confirmDialog = useConfirmationDialog();
|
|
5205
|
+
|
|
5206
|
+
var _useIssuesPane = useIssuesPane(),
|
|
5207
|
+
isIssuesPaneOpen = _useIssuesPane.isIssuesPaneOpen,
|
|
5208
|
+
onToggleIssuesPane = _useIssuesPane.onToggleIssuesPane,
|
|
5209
|
+
onCloseIssuesPane = _useIssuesPane.onCloseIssuesPane,
|
|
5210
|
+
startPosition = _useIssuesPane.startPosition;
|
|
5077
5211
|
|
|
5078
5212
|
var _React$useState = React__default.useState(sortTafTimeSlots(tafList)),
|
|
5079
5213
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -5083,9 +5217,9 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5083
5217
|
expired = _React$useState2$.expired,
|
|
5084
5218
|
updateSortedTafs = _React$useState2[1];
|
|
5085
5219
|
|
|
5086
|
-
var
|
|
5087
|
-
|
|
5088
|
-
|
|
5220
|
+
var _current$slice = current.slice(-1),
|
|
5221
|
+
_current$slice2 = _slicedToArray(_current$slice, 1),
|
|
5222
|
+
lastCurrentTaf = _current$slice2[0];
|
|
5089
5223
|
|
|
5090
5224
|
var _React$useState3 = React__default.useState('UPCOMING'),
|
|
5091
5225
|
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
@@ -5102,7 +5236,34 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5102
5236
|
activeTafIndex = _React$useState8[0],
|
|
5103
5237
|
setActiveTafIndex = _React$useState8[1];
|
|
5104
5238
|
|
|
5239
|
+
var _React$useState9 = React__default.useState(false),
|
|
5240
|
+
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
5241
|
+
isFormDirty = _React$useState10[0],
|
|
5242
|
+
setIsFormDirty = _React$useState10[1];
|
|
5243
|
+
|
|
5244
|
+
function onChangeTab(action, value) {
|
|
5245
|
+
if (isFormDirty) {
|
|
5246
|
+
confirmDialog({
|
|
5247
|
+
title: 'Whoops',
|
|
5248
|
+
description: 'Do you want to leave this open TAF without saving it? All changes will be lost.',
|
|
5249
|
+
confirmLabel: 'Exit without saving'
|
|
5250
|
+
}).then(function () {
|
|
5251
|
+
action(value);
|
|
5252
|
+
});
|
|
5253
|
+
} else {
|
|
5254
|
+
action(value);
|
|
5255
|
+
}
|
|
5256
|
+
}
|
|
5257
|
+
|
|
5258
|
+
var onChangeLocationTab = function onChangeLocationTab(index) {
|
|
5259
|
+
onChangeTab(setActiveTafIndex, index);
|
|
5260
|
+
};
|
|
5261
|
+
|
|
5105
5262
|
var onChangeTimeSlot = function onChangeTimeSlot(newTimeSlot) {
|
|
5263
|
+
onChangeTab(changeTimeSlot, newTimeSlot);
|
|
5264
|
+
};
|
|
5265
|
+
|
|
5266
|
+
var changeTimeSlot = function changeTimeSlot(newTimeSlot) {
|
|
5106
5267
|
setTimeSlot(newTimeSlot);
|
|
5107
5268
|
setLocations(newTimeSlot === 'ACTIVE' ? current : upcoming);
|
|
5108
5269
|
setActiveTafIndex(0);
|
|
@@ -5162,7 +5323,7 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5162
5323
|
xs: 12,
|
|
5163
5324
|
sm: 9
|
|
5164
5325
|
}, /*#__PURE__*/React__default.createElement(TopTabs, {
|
|
5165
|
-
tafFromBackend:
|
|
5326
|
+
tafFromBackend: lastCurrentTaf,
|
|
5166
5327
|
timeSlot: timeSlot,
|
|
5167
5328
|
onChangeTimeSlot: onChangeTimeSlot
|
|
5168
5329
|
}))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
@@ -5186,7 +5347,7 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5186
5347
|
}, /*#__PURE__*/React__default.createElement(LocationTabs, {
|
|
5187
5348
|
tafList: locations,
|
|
5188
5349
|
activeIndex: activeTafIndex,
|
|
5189
|
-
onChangeTab:
|
|
5350
|
+
onChangeTab: onChangeLocationTab,
|
|
5190
5351
|
timeSlot: timeSlot
|
|
5191
5352
|
})), /*#__PURE__*/React__default.createElement(Grid, {
|
|
5192
5353
|
item: true,
|
|
@@ -5210,7 +5371,10 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5210
5371
|
activeTafIndex: activeTafIndex,
|
|
5211
5372
|
index: index,
|
|
5212
5373
|
tafFromBackend: tafFromBackend,
|
|
5213
|
-
onPostTaf: onPostTaf
|
|
5374
|
+
onPostTaf: onPostTaf,
|
|
5375
|
+
onFormDirty: setIsFormDirty,
|
|
5376
|
+
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
5377
|
+
setIsIssuesPaneOpen: onToggleIssuesPane
|
|
5214
5378
|
});
|
|
5215
5379
|
}))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
5216
5380
|
item: true,
|
|
@@ -5227,7 +5391,39 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5227
5391
|
currentTafs: current,
|
|
5228
5392
|
expiredTafs: expired,
|
|
5229
5393
|
activeTaf: activeTaf
|
|
5230
|
-
}))))))
|
|
5394
|
+
})))))), /*#__PURE__*/React__default.createElement(IssuesPaneWrapper, {
|
|
5395
|
+
handleClose: onCloseIssuesPane,
|
|
5396
|
+
isOpen: isIssuesPaneOpen,
|
|
5397
|
+
startPosition: startPosition
|
|
5398
|
+
}));
|
|
5399
|
+
};
|
|
5400
|
+
|
|
5401
|
+
/* *
|
|
5402
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5403
|
+
* you may not use this file except in compliance with the License.
|
|
5404
|
+
* You may obtain a copy of the License at
|
|
5405
|
+
*
|
|
5406
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5407
|
+
*
|
|
5408
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
5409
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5410
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5411
|
+
* See the License for the specific language governing permissions and
|
|
5412
|
+
* limitations under the License.
|
|
5413
|
+
*
|
|
5414
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5415
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
5416
|
+
* */
|
|
5417
|
+
|
|
5418
|
+
var TafWrapper = function TafWrapper(_ref) {
|
|
5419
|
+
var children = _ref.children;
|
|
5420
|
+
return /*#__PURE__*/React.createElement(ConfirmationServiceProvider, null, /*#__PURE__*/React.createElement(ReactHookFormProvider, {
|
|
5421
|
+
options: {
|
|
5422
|
+
mode: 'onTouched',
|
|
5423
|
+
reValidateMode: 'onChange',
|
|
5424
|
+
criteriaMode: 'all'
|
|
5425
|
+
}
|
|
5426
|
+
}, children));
|
|
5231
5427
|
};
|
|
5232
5428
|
|
|
5233
5429
|
var TafModule = function TafModule() {
|
|
@@ -5311,7 +5507,7 @@ var TafModule = function TafModule() {
|
|
|
5311
5507
|
};
|
|
5312
5508
|
|
|
5313
5509
|
var Wrapper = function Wrapper() {
|
|
5314
|
-
return /*#__PURE__*/React.createElement(
|
|
5510
|
+
return /*#__PURE__*/React.createElement(TafWrapper, null, /*#__PURE__*/React.createElement(TafModule, null));
|
|
5315
5511
|
};
|
|
5316
5512
|
|
|
5317
5513
|
/* *
|
|
@@ -5330,7 +5526,7 @@ var Wrapper = function Wrapper() {
|
|
|
5330
5526
|
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5331
5527
|
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
5332
5528
|
* */
|
|
5333
|
-
var createApi = function createApi(url, appUrl, auth, setAuth, authTokenUrl, authClientId) {
|
|
5529
|
+
var createApi$1 = function createApi(url, appUrl, auth, setAuth, authTokenUrl, authClientId) {
|
|
5334
5530
|
var axiosInstance = createApiInstance(url, appUrl, auth, setAuth, authTokenUrl, authClientId);
|
|
5335
5531
|
return {
|
|
5336
5532
|
// api data
|
|
@@ -5346,4 +5542,971 @@ var createApi = function createApi(url, appUrl, auth, setAuth, authTokenUrl, aut
|
|
|
5346
5542
|
};
|
|
5347
5543
|
};
|
|
5348
5544
|
|
|
5349
|
-
|
|
5545
|
+
var currentDate = moment.utc().format('YYYY-MM-DD');
|
|
5546
|
+
var tomorrowDate = moment.utc().add(1, 'day').format('YYYY-MM-DD');
|
|
5547
|
+
var airportPeriod = 6;
|
|
5548
|
+
var airportValidity = 40;
|
|
5549
|
+
|
|
5550
|
+
var validDateRange = function validDateRange(refHour, period) {
|
|
5551
|
+
var startHour = period * Math.floor(parseInt(refHour.format('HH'), 10) / period) % 24;
|
|
5552
|
+
var start = refHour.set({
|
|
5553
|
+
hour: startHour,
|
|
5554
|
+
minute: 0,
|
|
5555
|
+
second: 0
|
|
5556
|
+
});
|
|
5557
|
+
var end = start.clone().add(airportValidity, 'hours');
|
|
5558
|
+
return [start.format('YYYY-MM-DDTHH:mm:ss'), end.format('YYYY-MM-DDTHH:mm:ss')];
|
|
5559
|
+
};
|
|
5560
|
+
|
|
5561
|
+
var dateAdd = function dateAdd(refDateAsString, hours) {
|
|
5562
|
+
return moment.utc(refDateAsString).add(hours, 'hours').format('YYYY-MM-DDTHH:mm:ss');
|
|
5563
|
+
};
|
|
5564
|
+
|
|
5565
|
+
var _validDateRange = validDateRange(moment.utc(), airportPeriod),
|
|
5566
|
+
_validDateRange2 = _slicedToArray(_validDateRange, 2),
|
|
5567
|
+
currentValidDateStart = _validDateRange2[0],
|
|
5568
|
+
currentValidDateEnd = _validDateRange2[1];
|
|
5569
|
+
|
|
5570
|
+
var _validDateRange3 = validDateRange(moment.utc().add(6, 'hours'), airportPeriod),
|
|
5571
|
+
_validDateRange4 = _slicedToArray(_validDateRange3, 2),
|
|
5572
|
+
upcomingValidDateStart = _validDateRange4[0],
|
|
5573
|
+
upcomingValidDateEnd = _validDateRange4[1];
|
|
5574
|
+
|
|
5575
|
+
var _validDateRange5 = validDateRange(moment.utc().add(-6, 'hours'), airportPeriod),
|
|
5576
|
+
_validDateRange6 = _slicedToArray(_validDateRange5, 2),
|
|
5577
|
+
expiredValidDateStart = _validDateRange6[0],
|
|
5578
|
+
expiredValidDateEnd = _validDateRange6[1];
|
|
5579
|
+
|
|
5580
|
+
var fakeTafList = [{
|
|
5581
|
+
creationDate: upcomingValidDateStart,
|
|
5582
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
5583
|
+
taf: {
|
|
5584
|
+
uuid: '5f9583fjdf0f337925',
|
|
5585
|
+
baseTime: upcomingValidDateStart,
|
|
5586
|
+
validDateStart: upcomingValidDateStart,
|
|
5587
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5588
|
+
location: 'EHAM',
|
|
5589
|
+
status: 'NEW',
|
|
5590
|
+
type: 'NORMAL',
|
|
5591
|
+
messageType: 'ORG',
|
|
5592
|
+
baseForecast: {
|
|
5593
|
+
valid: {
|
|
5594
|
+
start: upcomingValidDateStart,
|
|
5595
|
+
end: upcomingValidDateEnd
|
|
5596
|
+
}
|
|
5597
|
+
}
|
|
5598
|
+
}
|
|
5599
|
+
}, {
|
|
5600
|
+
creationDate: upcomingValidDateStart,
|
|
5601
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
5602
|
+
taf: {
|
|
5603
|
+
uuid: '5f9583fjd111137925',
|
|
5604
|
+
baseTime: upcomingValidDateStart,
|
|
5605
|
+
validDateStart: upcomingValidDateStart,
|
|
5606
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5607
|
+
location: 'EHRD',
|
|
5608
|
+
status: 'DRAFT',
|
|
5609
|
+
type: 'NORMAL',
|
|
5610
|
+
messageType: 'ORG',
|
|
5611
|
+
baseForecast: {
|
|
5612
|
+
valid: {
|
|
5613
|
+
start: upcomingValidDateStart,
|
|
5614
|
+
end: upcomingValidDateEnd
|
|
5615
|
+
},
|
|
5616
|
+
wind: {
|
|
5617
|
+
direction: 180,
|
|
5618
|
+
speed: 10,
|
|
5619
|
+
unit: 'KT'
|
|
5620
|
+
},
|
|
5621
|
+
cavOK: true
|
|
5622
|
+
}
|
|
5623
|
+
}
|
|
5624
|
+
}, {
|
|
5625
|
+
creationDate: upcomingValidDateStart,
|
|
5626
|
+
canbe: ['CANCELLED', 'AMENDED', 'DISCARDED'],
|
|
5627
|
+
taf: {
|
|
5628
|
+
uuid: '754905485',
|
|
5629
|
+
baseTime: upcomingValidDateStart,
|
|
5630
|
+
previousId: '5f9583fjdf45ff4330f337925',
|
|
5631
|
+
validDateStart: upcomingValidDateStart,
|
|
5632
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5633
|
+
previousValidDateStart: upcomingValidDateStart,
|
|
5634
|
+
previousValidDateEnd: upcomingValidDateEnd,
|
|
5635
|
+
location: 'EHLE',
|
|
5636
|
+
status: 'DRAFT_AMENDED',
|
|
5637
|
+
type: 'NORMAL',
|
|
5638
|
+
messageType: 'AMD',
|
|
5639
|
+
baseForecast: {
|
|
5640
|
+
valid: {
|
|
5641
|
+
start: upcomingValidDateStart,
|
|
5642
|
+
end: upcomingValidDateEnd
|
|
5643
|
+
},
|
|
5644
|
+
visibility: {
|
|
5645
|
+
range: 600,
|
|
5646
|
+
unit: 'M'
|
|
5647
|
+
},
|
|
5648
|
+
wind: {
|
|
5649
|
+
direction: 180,
|
|
5650
|
+
speed: 10,
|
|
5651
|
+
unit: 'KT'
|
|
5652
|
+
},
|
|
5653
|
+
weather: {
|
|
5654
|
+
weather1: 'SN'
|
|
5655
|
+
},
|
|
5656
|
+
cloud: {
|
|
5657
|
+
cloud1: {
|
|
5658
|
+
coverage: 'BKN',
|
|
5659
|
+
height: 35
|
|
5660
|
+
}
|
|
5661
|
+
}
|
|
5662
|
+
},
|
|
5663
|
+
changeGroups: [{
|
|
5664
|
+
change: 'TEMPO',
|
|
5665
|
+
probability: 'PROB30',
|
|
5666
|
+
valid: {
|
|
5667
|
+
start: dateAdd(upcomingValidDateStart, 3),
|
|
5668
|
+
end: dateAdd(upcomingValidDateStart, 4)
|
|
5669
|
+
},
|
|
5670
|
+
visibility: {
|
|
5671
|
+
range: 100,
|
|
5672
|
+
unit: 'M'
|
|
5673
|
+
},
|
|
5674
|
+
cloud: {
|
|
5675
|
+
cloud1: {
|
|
5676
|
+
verticalVisibility: 5
|
|
5677
|
+
}
|
|
5678
|
+
}
|
|
5679
|
+
}]
|
|
5680
|
+
}
|
|
5681
|
+
}, {
|
|
5682
|
+
creationDate: upcomingValidDateStart,
|
|
5683
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
5684
|
+
taf: {
|
|
5685
|
+
uuid: '43545345345',
|
|
5686
|
+
issueDate: upcomingValidDateStart,
|
|
5687
|
+
baseTime: "".concat(currentDate, "T18:00:00Z"),
|
|
5688
|
+
validDateStart: "".concat(currentDate, "T18:00:00Z"),
|
|
5689
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5690
|
+
previousId: 'jkdjkdfjkgdf',
|
|
5691
|
+
previousValidDateStart: upcomingValidDateStart,
|
|
5692
|
+
previousValidDateEnd: upcomingValidDateEnd,
|
|
5693
|
+
location: 'EHLE',
|
|
5694
|
+
status: 'CORRECTED',
|
|
5695
|
+
type: 'NORMAL',
|
|
5696
|
+
messageType: 'COR',
|
|
5697
|
+
baseForecast: {
|
|
5698
|
+
valid: {
|
|
5699
|
+
start: upcomingValidDateStart,
|
|
5700
|
+
end: upcomingValidDateEnd
|
|
5701
|
+
},
|
|
5702
|
+
wind: {
|
|
5703
|
+
direction: 350,
|
|
5704
|
+
speed: 46,
|
|
5705
|
+
gust: 67,
|
|
5706
|
+
unit: 'KT'
|
|
5707
|
+
},
|
|
5708
|
+
cavOK: true
|
|
5709
|
+
},
|
|
5710
|
+
changeGroups: [{
|
|
5711
|
+
change: 'BECMG',
|
|
5712
|
+
valid: {
|
|
5713
|
+
start: dateAdd(upcomingValidDateStart, 1),
|
|
5714
|
+
end: dateAdd(upcomingValidDateStart, 2)
|
|
5715
|
+
},
|
|
5716
|
+
visibility: {
|
|
5717
|
+
range: 1000,
|
|
5718
|
+
unit: 'M'
|
|
5719
|
+
},
|
|
5720
|
+
weather: {
|
|
5721
|
+
weather1: 'MIFG'
|
|
5722
|
+
},
|
|
5723
|
+
cloud: {
|
|
5724
|
+
cloud1: 'NSC'
|
|
5725
|
+
}
|
|
5726
|
+
}, {
|
|
5727
|
+
change: 'FM',
|
|
5728
|
+
valid: {
|
|
5729
|
+
start: dateAdd(upcomingValidDateStart, 2)
|
|
5730
|
+
},
|
|
5731
|
+
visibility: {
|
|
5732
|
+
range: 6000,
|
|
5733
|
+
unit: 'M'
|
|
5734
|
+
},
|
|
5735
|
+
weather: {
|
|
5736
|
+
weather1: '+SHRA'
|
|
5737
|
+
},
|
|
5738
|
+
cloud: {
|
|
5739
|
+
cloud1: {
|
|
5740
|
+
coverage: 'BKN',
|
|
5741
|
+
height: 40
|
|
5742
|
+
},
|
|
5743
|
+
cloud2: {
|
|
5744
|
+
coverage: 'OVC',
|
|
5745
|
+
height: 60,
|
|
5746
|
+
type: 'CB'
|
|
5747
|
+
}
|
|
5748
|
+
}
|
|
5749
|
+
}]
|
|
5750
|
+
}
|
|
5751
|
+
}, {
|
|
5752
|
+
creationDate: upcomingValidDateStart,
|
|
5753
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
5754
|
+
taf: {
|
|
5755
|
+
uuid: '5f9583fjdf45ff4330f337925',
|
|
5756
|
+
issueDate: upcomingValidDateStart,
|
|
5757
|
+
baseTime: upcomingValidDateStart,
|
|
5758
|
+
validDateStart: upcomingValidDateStart,
|
|
5759
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5760
|
+
location: 'EHGG',
|
|
5761
|
+
status: 'PUBLISHED',
|
|
5762
|
+
type: 'NORMAL',
|
|
5763
|
+
messageType: 'ORG',
|
|
5764
|
+
baseForecast: {
|
|
5765
|
+
valid: {
|
|
5766
|
+
start: upcomingValidDateEnd,
|
|
5767
|
+
end: upcomingValidDateEnd
|
|
5768
|
+
},
|
|
5769
|
+
visibility: {
|
|
5770
|
+
range: 600,
|
|
5771
|
+
unit: 'M'
|
|
5772
|
+
},
|
|
5773
|
+
wind: {
|
|
5774
|
+
direction: 180,
|
|
5775
|
+
speed: 10,
|
|
5776
|
+
unit: 'KT'
|
|
5777
|
+
},
|
|
5778
|
+
weather: {
|
|
5779
|
+
weather1: 'SN'
|
|
5780
|
+
},
|
|
5781
|
+
cloud: {
|
|
5782
|
+
cloud1: {
|
|
5783
|
+
coverage: 'BKN',
|
|
5784
|
+
height: 35
|
|
5785
|
+
}
|
|
5786
|
+
}
|
|
5787
|
+
},
|
|
5788
|
+
changeGroups: [{
|
|
5789
|
+
change: 'TEMPO',
|
|
5790
|
+
probability: 'PROB30',
|
|
5791
|
+
valid: {
|
|
5792
|
+
start: dateAdd(upcomingValidDateStart, 1),
|
|
5793
|
+
end: dateAdd(upcomingValidDateStart, 2)
|
|
5794
|
+
},
|
|
5795
|
+
visibility: {
|
|
5796
|
+
range: 200,
|
|
5797
|
+
unit: 'M'
|
|
5798
|
+
},
|
|
5799
|
+
cloud: {
|
|
5800
|
+
cloud1: {
|
|
5801
|
+
verticalVisibility: 5
|
|
5802
|
+
}
|
|
5803
|
+
}
|
|
5804
|
+
}]
|
|
5805
|
+
}
|
|
5806
|
+
}, {
|
|
5807
|
+
creationDate: upcomingValidDateStart,
|
|
5808
|
+
canbe: ['AMENDED'],
|
|
5809
|
+
taf: {
|
|
5810
|
+
uuid: '5464565464',
|
|
5811
|
+
previousId: '5445fghrfg3546456',
|
|
5812
|
+
issueDate: upcomingValidDateStart,
|
|
5813
|
+
baseTime: upcomingValidDateStart,
|
|
5814
|
+
validDateStart: upcomingValidDateStart,
|
|
5815
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5816
|
+
previousValidDateStart: upcomingValidDateStart,
|
|
5817
|
+
previousValidDateEnd: upcomingValidDateEnd,
|
|
5818
|
+
location: 'EHBK',
|
|
5819
|
+
status: 'CANCELLED',
|
|
5820
|
+
type: 'NORMAL',
|
|
5821
|
+
messageType: 'CNL',
|
|
5822
|
+
baseForecast: {
|
|
5823
|
+
valid: {
|
|
5824
|
+
start: upcomingValidDateStart,
|
|
5825
|
+
end: upcomingValidDateEnd
|
|
5826
|
+
},
|
|
5827
|
+
visibility: {
|
|
5828
|
+
range: 600,
|
|
5829
|
+
unit: 'M'
|
|
5830
|
+
},
|
|
5831
|
+
wind: {
|
|
5832
|
+
direction: 180,
|
|
5833
|
+
speed: 10,
|
|
5834
|
+
unit: 'KT'
|
|
5835
|
+
},
|
|
5836
|
+
weather: {
|
|
5837
|
+
weather1: 'SN'
|
|
5838
|
+
},
|
|
5839
|
+
cloud: {
|
|
5840
|
+
cloud1: {
|
|
5841
|
+
coverage: 'BKN',
|
|
5842
|
+
height: 35
|
|
5843
|
+
}
|
|
5844
|
+
}
|
|
5845
|
+
}
|
|
5846
|
+
}
|
|
5847
|
+
}, {
|
|
5848
|
+
creationDate: upcomingValidDateStart,
|
|
5849
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
5850
|
+
taf: {
|
|
5851
|
+
uuid: 'gh56734fghfgh',
|
|
5852
|
+
previousId: '8574jnf93475',
|
|
5853
|
+
issueDate: "".concat(currentDate, "T16:16:00Z"),
|
|
5854
|
+
baseTime: upcomingValidDateStart,
|
|
5855
|
+
validDateStart: upcomingValidDateStart,
|
|
5856
|
+
validDateEnd: upcomingValidDateEnd,
|
|
5857
|
+
previousValidDateStart: upcomingValidDateStart,
|
|
5858
|
+
previousValidDateEnd: upcomingValidDateEnd,
|
|
5859
|
+
location: 'TNCB',
|
|
5860
|
+
status: 'AMENDED',
|
|
5861
|
+
type: 'NORMAL',
|
|
5862
|
+
messageType: 'AMD',
|
|
5863
|
+
baseForecast: {
|
|
5864
|
+
valid: {
|
|
5865
|
+
start: "".concat(currentDate, "T16:12:00Z"),
|
|
5866
|
+
end: upcomingValidDateEnd
|
|
5867
|
+
},
|
|
5868
|
+
visibility: {
|
|
5869
|
+
range: 600,
|
|
5870
|
+
unit: 'M'
|
|
5871
|
+
},
|
|
5872
|
+
wind: {
|
|
5873
|
+
direction: 180,
|
|
5874
|
+
speed: 10,
|
|
5875
|
+
unit: 'KT'
|
|
5876
|
+
},
|
|
5877
|
+
weather: {
|
|
5878
|
+
weather1: 'SN'
|
|
5879
|
+
},
|
|
5880
|
+
cloud: {
|
|
5881
|
+
cloud1: {
|
|
5882
|
+
coverage: 'BKN',
|
|
5883
|
+
height: 35
|
|
5884
|
+
}
|
|
5885
|
+
}
|
|
5886
|
+
}
|
|
5887
|
+
}
|
|
5888
|
+
}, {
|
|
5889
|
+
creationDate: currentValidDateStart,
|
|
5890
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
5891
|
+
taf: {
|
|
5892
|
+
uuid: 'giskdj09845872039',
|
|
5893
|
+
issueDate: currentValidDateStart,
|
|
5894
|
+
baseTime: currentValidDateStart,
|
|
5895
|
+
validDateStart: currentValidDateStart,
|
|
5896
|
+
validDateEnd: currentValidDateEnd,
|
|
5897
|
+
location: 'EHAM',
|
|
5898
|
+
status: 'PUBLISHED',
|
|
5899
|
+
type: 'NORMAL',
|
|
5900
|
+
messageType: 'ORG',
|
|
5901
|
+
baseForecast: {
|
|
5902
|
+
valid: {
|
|
5903
|
+
start: currentValidDateStart,
|
|
5904
|
+
end: currentValidDateEnd
|
|
5905
|
+
},
|
|
5906
|
+
visibility: {
|
|
5907
|
+
range: 500,
|
|
5908
|
+
unit: 'M'
|
|
5909
|
+
},
|
|
5910
|
+
wind: {
|
|
5911
|
+
direction: 200,
|
|
5912
|
+
speed: 20,
|
|
5913
|
+
gust: 35,
|
|
5914
|
+
unit: 'KT'
|
|
5915
|
+
},
|
|
5916
|
+
weather: {
|
|
5917
|
+
weather1: 'SN'
|
|
5918
|
+
},
|
|
5919
|
+
cloud: {
|
|
5920
|
+
cloud1: {
|
|
5921
|
+
coverage: 'BKN',
|
|
5922
|
+
height: 40
|
|
5923
|
+
}
|
|
5924
|
+
}
|
|
5925
|
+
}
|
|
5926
|
+
}
|
|
5927
|
+
}, {
|
|
5928
|
+
creationDate: currentValidDateStart,
|
|
5929
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
5930
|
+
taf: {
|
|
5931
|
+
uuid: 'ghskdj09845872039',
|
|
5932
|
+
baseTime: currentValidDateStart,
|
|
5933
|
+
validDateStart: currentValidDateStart,
|
|
5934
|
+
validDateEnd: currentValidDateEnd,
|
|
5935
|
+
location: 'EHRD',
|
|
5936
|
+
status: 'NEW',
|
|
5937
|
+
type: 'NORMAL',
|
|
5938
|
+
messageType: 'ORG',
|
|
5939
|
+
baseForecast: {
|
|
5940
|
+
valid: {
|
|
5941
|
+
start: currentValidDateStart,
|
|
5942
|
+
end: currentValidDateEnd
|
|
5943
|
+
}
|
|
5944
|
+
}
|
|
5945
|
+
}
|
|
5946
|
+
}, {
|
|
5947
|
+
creationDate: currentValidDateStart,
|
|
5948
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
5949
|
+
taf: {
|
|
5950
|
+
uuid: 'ghskdj09845872040',
|
|
5951
|
+
issueDate: currentValidDateStart,
|
|
5952
|
+
baseTime: currentValidDateStart,
|
|
5953
|
+
validDateStart: currentValidDateStart,
|
|
5954
|
+
validDateEnd: currentValidDateEnd,
|
|
5955
|
+
location: 'EHLE',
|
|
5956
|
+
status: 'NEW',
|
|
5957
|
+
type: 'NORMAL',
|
|
5958
|
+
messageType: 'ORG',
|
|
5959
|
+
baseForecast: {
|
|
5960
|
+
valid: {
|
|
5961
|
+
start: currentValidDateStart,
|
|
5962
|
+
end: currentValidDateEnd
|
|
5963
|
+
}
|
|
5964
|
+
}
|
|
5965
|
+
}
|
|
5966
|
+
}, {
|
|
5967
|
+
creationDate: "".concat(currentDate, "T06:00:00Z"),
|
|
5968
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
5969
|
+
taf: {
|
|
5970
|
+
uuid: 'ghskdj09845872041',
|
|
5971
|
+
issueDate: currentValidDateStart,
|
|
5972
|
+
baseTime: currentValidDateStart,
|
|
5973
|
+
validDateStart: currentValidDateStart,
|
|
5974
|
+
validDateEnd: currentValidDateEnd,
|
|
5975
|
+
location: 'EHGG',
|
|
5976
|
+
status: 'NEW',
|
|
5977
|
+
type: 'NORMAL',
|
|
5978
|
+
messageType: 'ORG',
|
|
5979
|
+
baseForecast: {
|
|
5980
|
+
valid: {
|
|
5981
|
+
start: currentValidDateStart,
|
|
5982
|
+
end: currentValidDateEnd
|
|
5983
|
+
}
|
|
5984
|
+
}
|
|
5985
|
+
}
|
|
5986
|
+
}, {
|
|
5987
|
+
creationDate: "".concat(currentDate, "T06:00:00Z"),
|
|
5988
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
5989
|
+
taf: {
|
|
5990
|
+
uuid: 'ghskdj09845872042',
|
|
5991
|
+
issueDate: currentValidDateStart,
|
|
5992
|
+
baseTime: currentValidDateStart,
|
|
5993
|
+
validDateStart: currentValidDateStart,
|
|
5994
|
+
validDateEnd: currentValidDateEnd,
|
|
5995
|
+
location: 'EHBK',
|
|
5996
|
+
status: 'NEW',
|
|
5997
|
+
type: 'NORMAL',
|
|
5998
|
+
messageType: 'ORG',
|
|
5999
|
+
baseForecast: {
|
|
6000
|
+
valid: {
|
|
6001
|
+
start: currentValidDateStart,
|
|
6002
|
+
end: currentValidDateEnd
|
|
6003
|
+
}
|
|
6004
|
+
}
|
|
6005
|
+
}
|
|
6006
|
+
}, {
|
|
6007
|
+
creationDate: "".concat(currentDate, "T06:00:00Z"),
|
|
6008
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6009
|
+
taf: {
|
|
6010
|
+
uuid: 'ghskdj09845872043',
|
|
6011
|
+
issueDate: currentValidDateStart,
|
|
6012
|
+
baseTime: currentValidDateStart,
|
|
6013
|
+
validDateStart: currentValidDateStart,
|
|
6014
|
+
validDateEnd: currentValidDateEnd,
|
|
6015
|
+
location: 'TNCB',
|
|
6016
|
+
status: 'NEW',
|
|
6017
|
+
type: 'NORMAL',
|
|
6018
|
+
messageType: 'ORG',
|
|
6019
|
+
baseForecast: {
|
|
6020
|
+
valid: {
|
|
6021
|
+
start: currentValidDateStart,
|
|
6022
|
+
end: currentValidDateEnd
|
|
6023
|
+
}
|
|
6024
|
+
}
|
|
6025
|
+
}
|
|
6026
|
+
}, {
|
|
6027
|
+
creationDate: expiredValidDateStart,
|
|
6028
|
+
canbe: [],
|
|
6029
|
+
taf: {
|
|
6030
|
+
uuid: 'sdkjhsdf90845890',
|
|
6031
|
+
issueDate: expiredValidDateStart,
|
|
6032
|
+
baseTime: expiredValidDateStart,
|
|
6033
|
+
validDateStart: expiredValidDateStart,
|
|
6034
|
+
validDateEnd: expiredValidDateEnd,
|
|
6035
|
+
location: 'EHAM',
|
|
6036
|
+
status: 'EXPIRED',
|
|
6037
|
+
type: 'NORMAL',
|
|
6038
|
+
messageType: 'ORG',
|
|
6039
|
+
baseForecast: {
|
|
6040
|
+
valid: {
|
|
6041
|
+
start: expiredValidDateStart,
|
|
6042
|
+
end: expiredValidDateEnd
|
|
6043
|
+
},
|
|
6044
|
+
cavOK: true,
|
|
6045
|
+
wind: {
|
|
6046
|
+
direction: 50,
|
|
6047
|
+
speed: 5,
|
|
6048
|
+
unit: 'KT'
|
|
6049
|
+
}
|
|
6050
|
+
},
|
|
6051
|
+
changeGroups: [{
|
|
6052
|
+
change: 'BECMG',
|
|
6053
|
+
valid: {
|
|
6054
|
+
start: dateAdd(expiredValidDateStart, 1),
|
|
6055
|
+
end: dateAdd(expiredValidDateStart, 4)
|
|
6056
|
+
},
|
|
6057
|
+
visibility: {
|
|
6058
|
+
range: 1000,
|
|
6059
|
+
unit: 'M'
|
|
6060
|
+
},
|
|
6061
|
+
weather: {
|
|
6062
|
+
weather1: 'MIFG'
|
|
6063
|
+
}
|
|
6064
|
+
}, {
|
|
6065
|
+
change: 'FM',
|
|
6066
|
+
valid: {
|
|
6067
|
+
start: dateAdd(expiredValidDateStart, 5)
|
|
6068
|
+
},
|
|
6069
|
+
visibility: {
|
|
6070
|
+
range: 6000,
|
|
6071
|
+
unit: 'M'
|
|
6072
|
+
},
|
|
6073
|
+
weather: {
|
|
6074
|
+
weather1: '+SHRA'
|
|
6075
|
+
},
|
|
6076
|
+
cloud: {
|
|
6077
|
+
cloud1: {
|
|
6078
|
+
coverage: 'BKN',
|
|
6079
|
+
height: 40
|
|
6080
|
+
},
|
|
6081
|
+
cloud2: {
|
|
6082
|
+
coverage: 'OVC',
|
|
6083
|
+
height: 60,
|
|
6084
|
+
type: 'CB'
|
|
6085
|
+
}
|
|
6086
|
+
}
|
|
6087
|
+
}]
|
|
6088
|
+
}
|
|
6089
|
+
}];
|
|
6090
|
+
var fakeNewTaf = {
|
|
6091
|
+
creationDate: "".concat(currentDate, "T12:00:00Z"),
|
|
6092
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6093
|
+
taf: {
|
|
6094
|
+
type: 'NORMAL',
|
|
6095
|
+
messageType: 'ORG',
|
|
6096
|
+
status: 'NEW',
|
|
6097
|
+
uuid: '5f9583fjdf0445332f337925',
|
|
6098
|
+
baseTime: "".concat(currentDate, "T12:00:00Z"),
|
|
6099
|
+
validDateStart: "".concat(currentDate, "T12:00:00Z"),
|
|
6100
|
+
validDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6101
|
+
location: 'EHBK',
|
|
6102
|
+
baseForecast: {
|
|
6103
|
+
valid: {
|
|
6104
|
+
start: "".concat(currentDate, "T12:00:00Z"),
|
|
6105
|
+
end: "".concat(tomorrowDate, "T18:00:00Z")
|
|
6106
|
+
}
|
|
6107
|
+
}
|
|
6108
|
+
}
|
|
6109
|
+
};
|
|
6110
|
+
({
|
|
6111
|
+
creationDate: "2022-01-06T12:00:00Z",
|
|
6112
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6113
|
+
taf: Object.assign(Object.assign({}, fakeNewTaf.taf), {
|
|
6114
|
+
baseTime: "2022-01-06T12:00:00Z",
|
|
6115
|
+
validDateStart: "2022-01-06T12:00:00Z",
|
|
6116
|
+
validDateEnd: "2022-01-07T18:00:00Z",
|
|
6117
|
+
baseForecast: {
|
|
6118
|
+
valid: {
|
|
6119
|
+
start: "2022-01-06T12:00:00Z",
|
|
6120
|
+
end: "2022-01-07T18:00:00Z"
|
|
6121
|
+
}
|
|
6122
|
+
}
|
|
6123
|
+
})
|
|
6124
|
+
});
|
|
6125
|
+
var fakePublishedTaf = {
|
|
6126
|
+
creationDate: "".concat(currentDate, "T12:00:00Z"),
|
|
6127
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
6128
|
+
taf: {
|
|
6129
|
+
uuid: 'slsdkjg-023895',
|
|
6130
|
+
issueDate: "".concat(currentDate, "T12:00:00Z"),
|
|
6131
|
+
baseTime: "".concat(currentDate, "T12:00:00Z"),
|
|
6132
|
+
validDateStart: "".concat(currentDate, "T12:00:00Z"),
|
|
6133
|
+
validDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6134
|
+
location: 'EHLE',
|
|
6135
|
+
status: 'PUBLISHED',
|
|
6136
|
+
type: 'NORMAL',
|
|
6137
|
+
messageType: 'ORG',
|
|
6138
|
+
baseForecast: {
|
|
6139
|
+
valid: {
|
|
6140
|
+
start: "".concat(currentDate, "T12:00:00Z"),
|
|
6141
|
+
end: "".concat(tomorrowDate, "T18:00:00Z")
|
|
6142
|
+
},
|
|
6143
|
+
wind: {
|
|
6144
|
+
direction: 50,
|
|
6145
|
+
speed: 5,
|
|
6146
|
+
unit: 'KT'
|
|
6147
|
+
},
|
|
6148
|
+
cavOK: true
|
|
6149
|
+
},
|
|
6150
|
+
changeGroups: [{
|
|
6151
|
+
change: 'FM',
|
|
6152
|
+
valid: {
|
|
6153
|
+
start: "".concat(currentDate, "T12:00:00Z")
|
|
6154
|
+
},
|
|
6155
|
+
visibility: {
|
|
6156
|
+
range: 6000,
|
|
6157
|
+
unit: 'M'
|
|
6158
|
+
},
|
|
6159
|
+
weather: {
|
|
6160
|
+
weather1: '+SHRA'
|
|
6161
|
+
},
|
|
6162
|
+
wind: {
|
|
6163
|
+
direction: 10,
|
|
6164
|
+
speed: 10,
|
|
6165
|
+
unit: 'KT',
|
|
6166
|
+
gust: 35
|
|
6167
|
+
},
|
|
6168
|
+
cloud: {
|
|
6169
|
+
cloud1: {
|
|
6170
|
+
coverage: 'BKN',
|
|
6171
|
+
height: 40
|
|
6172
|
+
},
|
|
6173
|
+
cloud2: {
|
|
6174
|
+
coverage: 'OVC',
|
|
6175
|
+
height: 60,
|
|
6176
|
+
type: 'CB'
|
|
6177
|
+
}
|
|
6178
|
+
}
|
|
6179
|
+
}, {
|
|
6180
|
+
change: 'BECMG',
|
|
6181
|
+
valid: {
|
|
6182
|
+
start: "".concat(currentDate, "T23:00:00Z"),
|
|
6183
|
+
end: "".concat(tomorrowDate, "T00:00:00Z")
|
|
6184
|
+
},
|
|
6185
|
+
wind: {
|
|
6186
|
+
direction: 150,
|
|
6187
|
+
speed: 5,
|
|
6188
|
+
unit: 'KT'
|
|
6189
|
+
},
|
|
6190
|
+
visibility: {
|
|
6191
|
+
range: 1000,
|
|
6192
|
+
unit: 'M'
|
|
6193
|
+
},
|
|
6194
|
+
weather: {
|
|
6195
|
+
weather1: 'MIFG'
|
|
6196
|
+
}
|
|
6197
|
+
}]
|
|
6198
|
+
}
|
|
6199
|
+
};
|
|
6200
|
+
({
|
|
6201
|
+
creationDate: "2022-01-06T12:00:00Z",
|
|
6202
|
+
canbe: ['CANCELLED', 'AMENDED', 'CORRECTED'],
|
|
6203
|
+
taf: Object.assign(Object.assign({}, fakePublishedTaf.taf), {
|
|
6204
|
+
location: 'EHGG',
|
|
6205
|
+
baseTime: "2022-01-06T12:00:00Z",
|
|
6206
|
+
issueDate: "2022-01-06T12:00:00Z",
|
|
6207
|
+
validDateStart: "2022-01-06T12:00:00Z",
|
|
6208
|
+
validDateEnd: "2022-01-07T18:00:00Z",
|
|
6209
|
+
baseForecast: Object.assign(Object.assign({}, fakePublishedTaf.taf.baseForecast), {
|
|
6210
|
+
valid: {
|
|
6211
|
+
start: "2022-01-06T12:00:00Z",
|
|
6212
|
+
end: "2022-01-07T18:00:00Z"
|
|
6213
|
+
}
|
|
6214
|
+
}),
|
|
6215
|
+
changeGroups: [{
|
|
6216
|
+
change: 'FM',
|
|
6217
|
+
valid: {
|
|
6218
|
+
start: "2022-01-06T12:00:00Z"
|
|
6219
|
+
},
|
|
6220
|
+
visibility: {
|
|
6221
|
+
range: 6000,
|
|
6222
|
+
unit: 'M'
|
|
6223
|
+
},
|
|
6224
|
+
weather: {
|
|
6225
|
+
weather1: '+SHRA'
|
|
6226
|
+
},
|
|
6227
|
+
wind: {
|
|
6228
|
+
direction: 10,
|
|
6229
|
+
speed: 10,
|
|
6230
|
+
unit: 'KT',
|
|
6231
|
+
gust: 35
|
|
6232
|
+
},
|
|
6233
|
+
cloud: {
|
|
6234
|
+
cloud1: {
|
|
6235
|
+
coverage: 'BKN',
|
|
6236
|
+
height: 40
|
|
6237
|
+
},
|
|
6238
|
+
cloud2: {
|
|
6239
|
+
coverage: 'OVC',
|
|
6240
|
+
height: 60,
|
|
6241
|
+
type: 'CB'
|
|
6242
|
+
}
|
|
6243
|
+
}
|
|
6244
|
+
}, {
|
|
6245
|
+
change: 'BECMG',
|
|
6246
|
+
valid: {
|
|
6247
|
+
start: "2022-01-06T23:00:00Z",
|
|
6248
|
+
end: "2022-01-07T00:00:00Z"
|
|
6249
|
+
},
|
|
6250
|
+
wind: {
|
|
6251
|
+
direction: 150,
|
|
6252
|
+
speed: 5,
|
|
6253
|
+
unit: 'KT'
|
|
6254
|
+
},
|
|
6255
|
+
visibility: {
|
|
6256
|
+
range: 1000,
|
|
6257
|
+
unit: 'M'
|
|
6258
|
+
},
|
|
6259
|
+
weather: {
|
|
6260
|
+
weather1: 'MIFG'
|
|
6261
|
+
}
|
|
6262
|
+
}]
|
|
6263
|
+
})
|
|
6264
|
+
});
|
|
6265
|
+
var fakeDraftTaf = {
|
|
6266
|
+
creationDate: "".concat(currentDate, "T18:00:00Z"),
|
|
6267
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6268
|
+
taf: {
|
|
6269
|
+
uuid: '5f9583fjdf0f337925',
|
|
6270
|
+
baseTime: "".concat(currentDate, "T18:00:00Z"),
|
|
6271
|
+
validDateStart: "".concat(currentDate, "T18:00:00Z"),
|
|
6272
|
+
validDateEnd: "".concat(tomorrowDate, "T23:59:00Z"),
|
|
6273
|
+
location: 'EHLE',
|
|
6274
|
+
status: 'DRAFT',
|
|
6275
|
+
type: 'NORMAL',
|
|
6276
|
+
messageType: 'ORG',
|
|
6277
|
+
baseForecast: {
|
|
6278
|
+
valid: {
|
|
6279
|
+
start: "".concat(currentDate, "T18:00:00Z"),
|
|
6280
|
+
end: "".concat(tomorrowDate, "T23:59:00Z")
|
|
6281
|
+
},
|
|
6282
|
+
wind: {
|
|
6283
|
+
direction: 150,
|
|
6284
|
+
speed: 5,
|
|
6285
|
+
unit: 'KT'
|
|
6286
|
+
},
|
|
6287
|
+
visibility: {
|
|
6288
|
+
range: 1000,
|
|
6289
|
+
unit: 'M'
|
|
6290
|
+
},
|
|
6291
|
+
weather: {
|
|
6292
|
+
weather1: 'BCFG'
|
|
6293
|
+
},
|
|
6294
|
+
cloud: {
|
|
6295
|
+
cloud1: {
|
|
6296
|
+
coverage: 'FEW',
|
|
6297
|
+
height: 15
|
|
6298
|
+
}
|
|
6299
|
+
}
|
|
6300
|
+
}
|
|
6301
|
+
}
|
|
6302
|
+
};
|
|
6303
|
+
({
|
|
6304
|
+
creationDate: "2022-01-06T18:00:00Z",
|
|
6305
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6306
|
+
taf: Object.assign(Object.assign({}, fakeDraftTaf.taf), {
|
|
6307
|
+
baseTime: "2022-01-06T18:00:00Z",
|
|
6308
|
+
validDateStart: "2022-01-06T18:00:00Z",
|
|
6309
|
+
validDateEnd: "2022-01-07T23:59:00Z",
|
|
6310
|
+
baseForecast: Object.assign(Object.assign({}, fakeDraftTaf.taf.baseForecast), {
|
|
6311
|
+
valid: {
|
|
6312
|
+
start: "2022-01-06T18:00:00Z",
|
|
6313
|
+
end: "2022-01-07T23:59:00Z"
|
|
6314
|
+
}
|
|
6315
|
+
})
|
|
6316
|
+
})
|
|
6317
|
+
});
|
|
6318
|
+
var fakeDraftAmendmentTaf = {
|
|
6319
|
+
creationDate: "".concat(currentDate, "T14:00:00Z"),
|
|
6320
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6321
|
+
taf: {
|
|
6322
|
+
uuid: '954905487',
|
|
6323
|
+
previousId: '5f9583fjdf45ff4330f337925',
|
|
6324
|
+
issueDate: "".concat(currentDate, "T14:00:00Z"),
|
|
6325
|
+
baseTime: "".concat(currentDate, "T12:00:00Z"),
|
|
6326
|
+
validDateStart: "".concat(currentDate, "T14:00:00Z"),
|
|
6327
|
+
validDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6328
|
+
previousValidDateStart: "".concat(currentDate, "T12:00:00Z"),
|
|
6329
|
+
previousValidDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6330
|
+
location: 'EHAM',
|
|
6331
|
+
status: 'DRAFT_AMENDED',
|
|
6332
|
+
type: 'NORMAL',
|
|
6333
|
+
messageType: 'AMD',
|
|
6334
|
+
baseForecast: {
|
|
6335
|
+
valid: {
|
|
6336
|
+
start: "".concat(currentDate, "T14:00:00Z"),
|
|
6337
|
+
end: "".concat(tomorrowDate, "T18:00:00Z")
|
|
6338
|
+
},
|
|
6339
|
+
visibility: {
|
|
6340
|
+
range: 600,
|
|
6341
|
+
unit: 'M'
|
|
6342
|
+
},
|
|
6343
|
+
wind: {
|
|
6344
|
+
direction: 180,
|
|
6345
|
+
speed: 10,
|
|
6346
|
+
unit: 'KT'
|
|
6347
|
+
},
|
|
6348
|
+
weather: {
|
|
6349
|
+
weather1: 'SN'
|
|
6350
|
+
},
|
|
6351
|
+
cloud: {
|
|
6352
|
+
cloud1: {
|
|
6353
|
+
coverage: 'BKN',
|
|
6354
|
+
height: 35
|
|
6355
|
+
}
|
|
6356
|
+
}
|
|
6357
|
+
},
|
|
6358
|
+
changeGroups: [{
|
|
6359
|
+
change: 'TEMPO',
|
|
6360
|
+
probability: 'PROB30',
|
|
6361
|
+
valid: {
|
|
6362
|
+
start: "".concat(currentDate, "T15:00:00Z"),
|
|
6363
|
+
end: "".concat(currentDate, "T16:00:00Z")
|
|
6364
|
+
},
|
|
6365
|
+
visibility: {
|
|
6366
|
+
range: 100,
|
|
6367
|
+
unit: 'M'
|
|
6368
|
+
},
|
|
6369
|
+
cloud: {
|
|
6370
|
+
cloud1: {
|
|
6371
|
+
verticalVisibility: 5
|
|
6372
|
+
}
|
|
6373
|
+
}
|
|
6374
|
+
}]
|
|
6375
|
+
}
|
|
6376
|
+
};
|
|
6377
|
+
|
|
6378
|
+
({
|
|
6379
|
+
creationDate: "2022-01-06T14:00:00Z",
|
|
6380
|
+
canbe: ['DRAFTED', 'DISCARDED', 'PUBLISHED'],
|
|
6381
|
+
taf: Object.assign(Object.assign({}, fakeDraftAmendmentTaf.taf), {
|
|
6382
|
+
location: 'EHRD',
|
|
6383
|
+
issueDate: "2022-01-06T14:00:00Z",
|
|
6384
|
+
baseTime: "2022-01-06T12:00:00Z",
|
|
6385
|
+
validDateStart: "2022-01-06T14:00:00Z",
|
|
6386
|
+
validDateEnd: "2022-01-07T18:00:00Z",
|
|
6387
|
+
previousValidDateStart: "2022-01-06T12:00:00Z",
|
|
6388
|
+
previousValidDateEnd: "2022-01-07T18:00:00Z",
|
|
6389
|
+
baseForecast: Object.assign(Object.assign({}, fakeDraftAmendmentTaf.taf.baseForecast), {
|
|
6390
|
+
valid: {
|
|
6391
|
+
start: "2022-01-06T14:00:00Z",
|
|
6392
|
+
end: "2022-01-07T18:00:00Z"
|
|
6393
|
+
}
|
|
6394
|
+
}),
|
|
6395
|
+
changeGroups: []
|
|
6396
|
+
})
|
|
6397
|
+
});
|
|
6398
|
+
var fakeAmendmentTaf = {
|
|
6399
|
+
creationDate: "".concat(currentDate, "T14:00:00Z"),
|
|
6400
|
+
canbe: ['CANCELLED', 'CORRECTED', 'AMENDED'],
|
|
6401
|
+
taf: {
|
|
6402
|
+
uuid: '754905486',
|
|
6403
|
+
previousId: '5f9583fjdf45ff4330f337925',
|
|
6404
|
+
issueDate: "".concat(currentDate, "T14:00:00Z"),
|
|
6405
|
+
baseTime: "".concat(currentDate, "T12:00:00Z"),
|
|
6406
|
+
validDateStart: "".concat(currentDate, "T14:00:00Z"),
|
|
6407
|
+
validDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6408
|
+
previousValidDateStart: "".concat(currentDate, "T12:00:00Z"),
|
|
6409
|
+
previousValidDateEnd: "".concat(tomorrowDate, "T18:00:00Z"),
|
|
6410
|
+
location: 'EHAM',
|
|
6411
|
+
status: 'AMENDED',
|
|
6412
|
+
type: 'NORMAL',
|
|
6413
|
+
messageType: 'AMD',
|
|
6414
|
+
baseForecast: {
|
|
6415
|
+
valid: {
|
|
6416
|
+
start: "".concat(currentDate, "T14:00:00Z"),
|
|
6417
|
+
end: "".concat(tomorrowDate, "T18:00:00Z")
|
|
6418
|
+
},
|
|
6419
|
+
visibility: {
|
|
6420
|
+
range: 600,
|
|
6421
|
+
unit: 'M'
|
|
6422
|
+
},
|
|
6423
|
+
wind: {
|
|
6424
|
+
direction: 180,
|
|
6425
|
+
speed: 10,
|
|
6426
|
+
unit: 'KT'
|
|
6427
|
+
},
|
|
6428
|
+
weather: {
|
|
6429
|
+
weather1: 'SN'
|
|
6430
|
+
},
|
|
6431
|
+
cloud: {
|
|
6432
|
+
cloud1: {
|
|
6433
|
+
coverage: 'BKN',
|
|
6434
|
+
height: 35
|
|
6435
|
+
}
|
|
6436
|
+
}
|
|
6437
|
+
}
|
|
6438
|
+
}
|
|
6439
|
+
}; // Only use for display purposes in the list!
|
|
6440
|
+
|
|
6441
|
+
({
|
|
6442
|
+
creationDate: "2022-01-06T14:00:00Z",
|
|
6443
|
+
canbe: ['CANCELLED', 'CORRECTED', 'AMENDED'],
|
|
6444
|
+
taf: Object.assign(Object.assign({}, fakeAmendmentTaf.taf), {
|
|
6445
|
+
uuid: '7549058980',
|
|
6446
|
+
issueDate: "2022-01-06T14:00:00Z",
|
|
6447
|
+
baseTime: "2022-01-06T12:00:00Z",
|
|
6448
|
+
validDateStart: "2022-01-06T14:00:00Z",
|
|
6449
|
+
validDateEnd: "2022-01-07T18:00:00Z",
|
|
6450
|
+
previousValidDateStart: "2022-01-06T12:00:00Z",
|
|
6451
|
+
previousValidDateEnd: "2022-01-07T18:00:00Z",
|
|
6452
|
+
baseForecast: Object.assign(Object.assign({}, fakeAmendmentTaf.taf.baseForecast), {
|
|
6453
|
+
valid: {
|
|
6454
|
+
start: "2022-01-06T14:00:00Z",
|
|
6455
|
+
end: "2022-01-07T18:00:00Z"
|
|
6456
|
+
}
|
|
6457
|
+
})
|
|
6458
|
+
})
|
|
6459
|
+
});
|
|
6460
|
+
|
|
6461
|
+
var fakeTafTac = 'TAF EHAM 0812/0918 20020G35KT 0500 SN BKN040\nBECMG 0814/0816 0700 BKN001=';
|
|
6462
|
+
|
|
6463
|
+
var fakePromise = function fakePromise(withRandomError) {
|
|
6464
|
+
return new Promise(function (resolve, reject) {
|
|
6465
|
+
setTimeout(function () {
|
|
6466
|
+
if (!withRandomError) return resolve();
|
|
6467
|
+
var randomError = Math.floor(Math.random() * 4) + 1;
|
|
6468
|
+
return randomError === 4 ? reject(new Error('something went wrong')) : resolve();
|
|
6469
|
+
}, 300);
|
|
6470
|
+
});
|
|
6471
|
+
};
|
|
6472
|
+
|
|
6473
|
+
var fakeAxiosInstance = {
|
|
6474
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars, @typescript-eslint/explicit-module-boundary-types
|
|
6475
|
+
get: function get(_url, _params) {
|
|
6476
|
+
return fakePromise(false);
|
|
6477
|
+
},
|
|
6478
|
+
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars, @typescript-eslint/explicit-module-boundary-types
|
|
6479
|
+
post: function post(_url, _params) {
|
|
6480
|
+
return fakePromise(false);
|
|
6481
|
+
}
|
|
6482
|
+
};
|
|
6483
|
+
var createApi = function createApi() {
|
|
6484
|
+
return {
|
|
6485
|
+
getTafList: function getTafList() {
|
|
6486
|
+
// eslint-disable-next-line no-console
|
|
6487
|
+
console.log('Retrieving new TAF list');
|
|
6488
|
+
return fakeAxiosInstance.get('/taflist').then(function () {
|
|
6489
|
+
return {
|
|
6490
|
+
data: _toConsumableArray(fakeTafList)
|
|
6491
|
+
};
|
|
6492
|
+
});
|
|
6493
|
+
},
|
|
6494
|
+
getTAC: function getTAC() {
|
|
6495
|
+
// eslint-disable-next-line no-console
|
|
6496
|
+
return fakeAxiosInstance.post('/taf2tac').then(function () {
|
|
6497
|
+
return {
|
|
6498
|
+
data: fakeTafTac
|
|
6499
|
+
};
|
|
6500
|
+
});
|
|
6501
|
+
},
|
|
6502
|
+
postTaf: function postTaf(_postTaf) {
|
|
6503
|
+
// eslint-disable-next-line no-console
|
|
6504
|
+
console.log("The new status of the taf will be ".concat(_postTaf.changeStatusTo)); // eslint-disable-next-line no-console
|
|
6505
|
+
|
|
6506
|
+
console.log('form has been posted with following values:', _postTaf.taf);
|
|
6507
|
+
return fakeAxiosInstance.post('/taf', _postTaf);
|
|
6508
|
+
}
|
|
6509
|
+
};
|
|
6510
|
+
};
|
|
6511
|
+
|
|
6512
|
+
export { TafForm, Wrapper as TafModule, createApi$1 as createApi, createApi as createFakeApi };
|