@opengeoweb/taf 2.5.0 → 2.8.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 +1 -0
- package/index.esm.js +293 -202
- package/index.umd.js +337 -241
- package/lib/components/ComponentsLookUp/ComponentsLookUp.d.ts +34 -0
- package/lib/components/ComponentsLookUp/ComponentsLookUp.spec.d.ts +1 -0
- package/lib/components/ComponentsLookUp/index.d.ts +1 -0
- package/lib/components/Providers/Providers.d.ts +16 -0
- package/lib/components/Providers/index.d.ts +1 -0
- package/lib/components/TafForm/TafForm.d.ts +0 -1
- package/lib/components/TafForm/utils.d.ts +17 -2
- package/lib/components/TafLayout/LocationTabs/LocationTabs.stories.d.ts +2 -2
- package/lib/components/TafLayout/TacOverview/ExportButton.d.ts +1 -1
- package/lib/components/TafLayout/TafPanel/TafPanel.d.ts +1 -2
- package/lib/components/TafLayout/utils.d.ts +0 -15
- package/lib/components/TafModule/TafModule.d.ts +2 -1
- package/lib/components/TafModule/TafModuleProvider.d.ts +14 -4
- package/lib/components/TafWrapper/TafWrapper.d.ts +2 -4
- package/lib/utils/fakeApi.d.ts +1 -1
- package/package.json +7 -7
- package/lib/utils/testUtils.d.ts +0 -25
package/index.esm.js
CHANGED
|
@@ -4,13 +4,13 @@ import { TextField, SvgIcon, Grid, Box, Button, IconButton, Tooltip, Chip, Typog
|
|
|
4
4
|
import { useFormContext, Controller, useFieldArray } from 'react-hook-form';
|
|
5
5
|
import { ReactSortable, Sortable } from 'react-sortablejs';
|
|
6
6
|
import { getDeepProperty, ReactHookFormHiddenInput, ReactHookFormProvider } from '@opengeoweb/form-fields';
|
|
7
|
-
import {
|
|
8
|
-
import { useIsMounted, ToggleMenu, useDraftFormHelpers, ToolContainerDraggable, useConfirmationDialog, usePreventBrowserClose, ToolButton, ToolHeader, getAxiosErrorMessage, AlertBanner, ConfirmationServiceProvider, usePoller } from '@opengeoweb/shared';
|
|
9
|
-
import moment from 'moment';
|
|
7
|
+
import { useIsMounted, ToggleMenu, useDraftFormHelpers, ToolContainerDraggable, useConfirmationDialog, usePreventBrowserClose, ToolButton, ToolHeader, isAxiosError, getAxiosErrorMessage, AlertBanner, ConfirmationServiceProvider, usePoller, ErrorBoundary } from '@opengeoweb/shared';
|
|
10
8
|
import { isEqual } from 'lodash';
|
|
9
|
+
import moment from 'moment';
|
|
11
10
|
import makeStyles from '@mui/styles/makeStyles';
|
|
12
11
|
import { DragIndicator, Schedule, CheckCircle } from '@mui/icons-material';
|
|
13
12
|
import ReactDOM from 'react-dom';
|
|
13
|
+
import { useApiContext, useApi, createApiInstance, ApiProvider } from '@opengeoweb/api';
|
|
14
14
|
import LinearProgress from '@mui/material/LinearProgress';
|
|
15
15
|
import DoDisturbIcon from '@mui/icons-material/DoDisturb';
|
|
16
16
|
import Box$1 from '@mui/material/Box';
|
|
@@ -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
|
};
|
|
@@ -2299,9 +2315,7 @@ var tacHasError = function tacHasError(tac) {
|
|
|
2299
2315
|
return tac === TAC_MISSING_DATA || tac === TAC_NOT_AVAILABLE || tac === TAC_RETRIEVING_DATA || tac === TAC_FAILED;
|
|
2300
2316
|
};
|
|
2301
2317
|
var useTACGenerator = function useTACGenerator(taf, requestTAC) {
|
|
2302
|
-
var
|
|
2303
|
-
|
|
2304
|
-
var _React$useState = React__default.useState(taf.status === 'NEW' ? TAC_NOT_AVAILABLE : TAC_RETRIEVING_DATA),
|
|
2318
|
+
var _React$useState = React__default.useState(!taf || taf.status === 'NEW' ? TAC_NOT_AVAILABLE : TAC_RETRIEVING_DATA),
|
|
2305
2319
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2306
2320
|
TAC = _React$useState2[0],
|
|
2307
2321
|
setTAC = _React$useState2[1];
|
|
@@ -2309,14 +2323,30 @@ var useTACGenerator = function useTACGenerator(taf, requestTAC) {
|
|
|
2309
2323
|
var _useIsMounted = useIsMounted(),
|
|
2310
2324
|
isMounted = _useIsMounted.isMounted;
|
|
2311
2325
|
|
|
2326
|
+
var controller = React__default.useRef(null);
|
|
2327
|
+
|
|
2328
|
+
var onSetTac = function onSetTac(newTAC) {
|
|
2329
|
+
if (controller.current) {
|
|
2330
|
+
controller.current.abort();
|
|
2331
|
+
}
|
|
2332
|
+
|
|
2333
|
+
setTAC(newTAC);
|
|
2334
|
+
};
|
|
2335
|
+
|
|
2312
2336
|
var retrieveTAC = React__default.useCallback(function (tafToPost) {
|
|
2313
2337
|
if (shouldRetrieveTAC(tafToPost)) {
|
|
2314
|
-
|
|
2338
|
+
if (controller.current) {
|
|
2339
|
+
controller.current.abort();
|
|
2340
|
+
}
|
|
2341
|
+
|
|
2342
|
+
controller.current = new AbortController();
|
|
2343
|
+
setTAC(TAC_RETRIEVING_DATA);
|
|
2344
|
+
requestTAC(tafToPost, controller.current.signal).then(function (result) {
|
|
2315
2345
|
if (isMounted.current) {
|
|
2316
2346
|
setTAC(result.data);
|
|
2317
2347
|
}
|
|
2318
|
-
})["catch"](function () {
|
|
2319
|
-
if (isMounted.
|
|
2348
|
+
})["catch"](function (error) {
|
|
2349
|
+
if (isMounted && error.message !== 'canceled') {
|
|
2320
2350
|
setTAC(TAC_FAILED);
|
|
2321
2351
|
}
|
|
2322
2352
|
});
|
|
@@ -2325,17 +2355,12 @@ var useTACGenerator = function useTACGenerator(taf, requestTAC) {
|
|
|
2325
2355
|
}
|
|
2326
2356
|
}, [isMounted, requestTAC]);
|
|
2327
2357
|
React__default.useEffect(function () {
|
|
2328
|
-
if (taf.status !== 'NEW'
|
|
2358
|
+
if (taf && taf.status !== 'NEW') {
|
|
2329
2359
|
retrieveTAC(taf);
|
|
2330
2360
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2331
2361
|
|
|
2332
2362
|
}, []);
|
|
2333
|
-
|
|
2334
|
-
if (standardTAC !== '') {
|
|
2335
|
-
setTAC(standardTAC);
|
|
2336
|
-
}
|
|
2337
|
-
}, [standardTAC]);
|
|
2338
|
-
return [TAC, retrieveTAC];
|
|
2363
|
+
return [TAC, retrieveTAC, onSetTac];
|
|
2339
2364
|
};
|
|
2340
2365
|
var useDragOrder = function useDragOrder(trigger, move, onFormBlur) {
|
|
2341
2366
|
var _React$useState3 = React__default.useState(null),
|
|
@@ -2524,9 +2549,14 @@ var prepareTafValues = function prepareTafValues(_taf, tafAction) {
|
|
|
2524
2549
|
// If action is AMEND/CORRECT/DRAFT_AMEND/DRAFT_CORRECTION - add previous valid start and end
|
|
2525
2550
|
// If action is AMEND/DRAFT_AMEND - update validity start time to current time
|
|
2526
2551
|
var taf = tafAction === 'AMEND' || tafAction === 'DRAFT_AMEND' || tafAction === 'CORRECT' || tafAction === 'DRAFT_CORRECT' ? getAmendedCorrectedTafTimes(_taf, tafAction) : _taf;
|
|
2552
|
+
var formattedBaseForecast = formatFormValues(taf.baseForecast);
|
|
2553
|
+
var baseForecast = Object.assign(Object.assign(Object.assign({}, emptyBaseForecast), formattedBaseForecast), {
|
|
2554
|
+
weather: Object.assign(Object.assign({}, emptyBaseForecast.weather), formattedBaseForecast.weather),
|
|
2555
|
+
cloud: Object.assign(Object.assign({}, emptyBaseForecast.cloud), formattedBaseForecast.cloud)
|
|
2556
|
+
});
|
|
2527
2557
|
return Object.assign(Object.assign(Object.assign(Object.assign({}, taf), {
|
|
2528
2558
|
messageType: getMessageType(taf, tafAction),
|
|
2529
|
-
baseForecast:
|
|
2559
|
+
baseForecast: baseForecast
|
|
2530
2560
|
}), taf.changeGroups && {
|
|
2531
2561
|
changeGroups: taf.changeGroups.map(formatFormValues)
|
|
2532
2562
|
}), addEmptyChangeGroup && {
|
|
@@ -2913,7 +2943,7 @@ var TafFormRow = /*#__PURE__*/React__default.forwardRef(function (_a, ref) {
|
|
|
2913
2943
|
getValues = _useFormContext.getValues,
|
|
2914
2944
|
trigger = _useFormContext.trigger;
|
|
2915
2945
|
|
|
2916
|
-
var _useDraftFormHelpers = useDraftFormHelpers(),
|
|
2946
|
+
var _useDraftFormHelpers = useDraftFormHelpers(true),
|
|
2917
2947
|
isNotRequiredForAction = _useDraftFormHelpers.isRequired; // cross-field required validation
|
|
2918
2948
|
|
|
2919
2949
|
|
|
@@ -3742,20 +3772,6 @@ var getPaneTitle = function getPaneTitle(sumOfErrors) {
|
|
|
3742
3772
|
}
|
|
3743
3773
|
};
|
|
3744
3774
|
|
|
3745
|
-
var getErrorDefaultMessage = function getErrorDefaultMessage(error) {
|
|
3746
|
-
switch (error.type) {
|
|
3747
|
-
case 'required':
|
|
3748
|
-
{
|
|
3749
|
-
return 'this field is required';
|
|
3750
|
-
}
|
|
3751
|
-
|
|
3752
|
-
default:
|
|
3753
|
-
{
|
|
3754
|
-
return error.message;
|
|
3755
|
-
}
|
|
3756
|
-
}
|
|
3757
|
-
};
|
|
3758
|
-
|
|
3759
3775
|
var capitalizeWord = function capitalizeWord(_ref) {
|
|
3760
3776
|
var _ref2 = _toArray(_ref),
|
|
3761
3777
|
firstLetter = _ref2[0],
|
|
@@ -3793,7 +3809,7 @@ var getErrorMessage = function getErrorMessage(error, index) {
|
|
|
3793
3809
|
firstNamePart = _name$split2[0];
|
|
3794
3810
|
|
|
3795
3811
|
var fieldErrorTitle = humanizeErrorMessage(firstNamePart);
|
|
3796
|
-
return "".concat(index + 1, ". ").concat(fieldErrorTitle, ": ").concat(
|
|
3812
|
+
return "".concat(index + 1, ". ").concat(fieldErrorTitle, ": ").concat(error.message);
|
|
3797
3813
|
};
|
|
3798
3814
|
var MODAL_DIALOG_ELEMENT = 'modal-dialog';
|
|
3799
3815
|
var useIssuesPane = function useIssuesPane() {
|
|
@@ -3878,12 +3894,19 @@ var TafModuleContext = /*#__PURE__*/React.createContext({
|
|
|
3878
3894
|
onValidateForm: null,
|
|
3879
3895
|
registerValidateForm: null,
|
|
3880
3896
|
tafAction: null,
|
|
3881
|
-
setTafAction: null
|
|
3897
|
+
setTafAction: null,
|
|
3898
|
+
isFormDirty: null,
|
|
3899
|
+
setIsFormDirty: null
|
|
3882
3900
|
});
|
|
3883
3901
|
var useTafModuleContext = function useTafModuleContext() {
|
|
3884
3902
|
return React.useContext(TafModuleContext);
|
|
3885
3903
|
};
|
|
3886
|
-
var useTafModuleState = function useTafModuleState() {
|
|
3904
|
+
var useTafModuleState = function useTafModuleState(_ref) {
|
|
3905
|
+
var onPreventCloseView = _ref.onPreventCloseView;
|
|
3906
|
+
|
|
3907
|
+
var _useApiContext = useApiContext(),
|
|
3908
|
+
api = _useApiContext.api;
|
|
3909
|
+
|
|
3887
3910
|
var _React$useState = React.useState(function () {
|
|
3888
3911
|
return new Promise(function () {
|
|
3889
3912
|
return true;
|
|
@@ -3898,22 +3921,49 @@ var useTafModuleState = function useTafModuleState() {
|
|
|
3898
3921
|
tafAction = _React$useState4[0],
|
|
3899
3922
|
setTafAction = _React$useState4[1];
|
|
3900
3923
|
|
|
3924
|
+
var _React$useState5 = React.useState(false),
|
|
3925
|
+
_React$useState6 = _slicedToArray(_React$useState5, 2),
|
|
3926
|
+
isFormDirty = _React$useState6[0],
|
|
3927
|
+
setIsFormDirty = _React$useState6[1];
|
|
3928
|
+
|
|
3929
|
+
var _useTACGenerator = useTACGenerator(undefined, api.getTAC),
|
|
3930
|
+
_useTACGenerator2 = _slicedToArray(_useTACGenerator, 3),
|
|
3931
|
+
TAC = _useTACGenerator2[0],
|
|
3932
|
+
updateTAC = _useTACGenerator2[1],
|
|
3933
|
+
setTAC = _useTACGenerator2[2];
|
|
3934
|
+
|
|
3901
3935
|
var onRegisterValidateForm = function onRegisterValidateForm(promiseToRegister) {
|
|
3902
3936
|
registerValidateForm(function () {
|
|
3903
3937
|
return promiseToRegister;
|
|
3904
3938
|
});
|
|
3905
3939
|
};
|
|
3906
3940
|
|
|
3941
|
+
var onChangeFormDirty = function onChangeFormDirty(isDirty) {
|
|
3942
|
+
if (isDirty !== isFormDirty) {
|
|
3943
|
+
setIsFormDirty(isDirty);
|
|
3944
|
+
onPreventCloseView(isDirty);
|
|
3945
|
+
}
|
|
3946
|
+
};
|
|
3947
|
+
|
|
3907
3948
|
return {
|
|
3908
3949
|
onValidateForm: onValidateForm,
|
|
3909
3950
|
registerValidateForm: onRegisterValidateForm,
|
|
3910
3951
|
tafAction: tafAction,
|
|
3911
|
-
setTafAction: setTafAction
|
|
3952
|
+
setTafAction: setTafAction,
|
|
3953
|
+
TAC: TAC,
|
|
3954
|
+
updateTAC: updateTAC,
|
|
3955
|
+
setTAC: setTAC,
|
|
3956
|
+
isFormDirty: isFormDirty,
|
|
3957
|
+
setIsFormDirty: onChangeFormDirty
|
|
3912
3958
|
};
|
|
3913
3959
|
};
|
|
3914
|
-
var TafModuleProvider = function TafModuleProvider(
|
|
3915
|
-
var children =
|
|
3916
|
-
|
|
3960
|
+
var TafModuleProvider = function TafModuleProvider(_ref2) {
|
|
3961
|
+
var children = _ref2.children,
|
|
3962
|
+
_ref2$onPreventCloseV = _ref2.onPreventCloseView,
|
|
3963
|
+
onPreventCloseView = _ref2$onPreventCloseV === void 0 ? function () {} : _ref2$onPreventCloseV;
|
|
3964
|
+
var contextState = useTafModuleState({
|
|
3965
|
+
onPreventCloseView: onPreventCloseView
|
|
3966
|
+
});
|
|
3917
3967
|
return /*#__PURE__*/React.createElement(TafModuleContext.Provider, {
|
|
3918
3968
|
value: contextState
|
|
3919
3969
|
}, children);
|
|
@@ -3927,10 +3977,6 @@ var TafForm = function TafForm(_ref) {
|
|
|
3927
3977
|
onFormAction = _ref$onFormAction === void 0 ? function () {
|
|
3928
3978
|
return null;
|
|
3929
3979
|
} : _ref$onFormAction,
|
|
3930
|
-
_ref$onFormDirty = _ref.onFormDirty,
|
|
3931
|
-
onFormDirty = _ref$onFormDirty === void 0 ? function () {
|
|
3932
|
-
return null;
|
|
3933
|
-
} : _ref$onFormDirty,
|
|
3934
3980
|
_ref$isIssuesPaneOpen = _ref.isIssuesPaneOpen,
|
|
3935
3981
|
isIssuesPaneOpen = _ref$isIssuesPaneOpen === void 0 ? false : _ref$isIssuesPaneOpen,
|
|
3936
3982
|
_ref$setIsIssuesPaneO = _ref.setIsIssuesPaneOpen,
|
|
@@ -3947,17 +3993,18 @@ var TafForm = function TafForm(_ref) {
|
|
|
3947
3993
|
var isDefaultDisabled = getIsFormDefaultDisabled(tafFromBackend.taf.status);
|
|
3948
3994
|
var confirmDialog = useConfirmationDialog();
|
|
3949
3995
|
|
|
3950
|
-
var _useDraftFormHelpers = useDraftFormHelpers(),
|
|
3996
|
+
var _useDraftFormHelpers = useDraftFormHelpers(true),
|
|
3951
3997
|
toggleIsDraft = _useDraftFormHelpers.toggleIsDraft,
|
|
3952
3998
|
DraftFieldHelper = _useDraftFormHelpers.DraftFieldHelper;
|
|
3953
3999
|
|
|
3954
4000
|
var _useTafModuleContext = useTafModuleContext(),
|
|
3955
4001
|
registerValidateForm = _useTafModuleContext.registerValidateForm,
|
|
3956
4002
|
tafAction = _useTafModuleContext.tafAction,
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
4003
|
+
setIsFormDirty = _useTafModuleContext.setIsFormDirty,
|
|
4004
|
+
setTafAction = _useTafModuleContext.setTafAction,
|
|
4005
|
+
TAC = _useTafModuleContext.TAC,
|
|
4006
|
+
updateTAC = _useTafModuleContext.updateTAC,
|
|
4007
|
+
setTAC = _useTafModuleContext.setTAC;
|
|
3961
4008
|
|
|
3962
4009
|
var _useIsMounted = useIsMounted(),
|
|
3963
4010
|
isMounted = _useIsMounted.isMounted;
|
|
@@ -3981,15 +4028,20 @@ var TafForm = function TafForm(_ref) {
|
|
|
3981
4028
|
delayedFormValues = _React$useState2[0],
|
|
3982
4029
|
setDelayedFormValues = _React$useState2[1];
|
|
3983
4030
|
|
|
3984
|
-
var _useTACGenerator = useTACGenerator(tafFromBackend.taf, api.getTAC),
|
|
3985
|
-
_useTACGenerator2 = _slicedToArray(_useTACGenerator, 2),
|
|
3986
|
-
TAC = _useTACGenerator2[0],
|
|
3987
|
-
updateTAC = _useTACGenerator2[1];
|
|
3988
|
-
|
|
3989
4031
|
var hasErrors = Object.keys(errors).length;
|
|
3990
4032
|
|
|
3991
4033
|
var onFormBlur = function onFormBlur() {
|
|
3992
|
-
|
|
4034
|
+
if (!isEqual(getValues(), delayedFormValues)) {
|
|
4035
|
+
setDelayedFormValues(getValues());
|
|
4036
|
+
}
|
|
4037
|
+
};
|
|
4038
|
+
|
|
4039
|
+
var resetTAC = function resetTAC() {
|
|
4040
|
+
if (originalTaf.status !== 'NEW') {
|
|
4041
|
+
updateTAC(originalTaf);
|
|
4042
|
+
} else {
|
|
4043
|
+
setTAC(TAC_NOT_AVAILABLE);
|
|
4044
|
+
}
|
|
3993
4045
|
};
|
|
3994
4046
|
|
|
3995
4047
|
React__default.useEffect(function () {
|
|
@@ -4008,8 +4060,8 @@ var TafForm = function TafForm(_ref) {
|
|
|
4008
4060
|
}, [hasErrors]); // Needed to be able to show a confirmation dialog on switching tabs when form is edited and not saved
|
|
4009
4061
|
|
|
4010
4062
|
React__default.useEffect(function () {
|
|
4011
|
-
|
|
4012
|
-
}, [isFormDirty,
|
|
4063
|
+
setIsFormDirty(isFormDirty);
|
|
4064
|
+
}, [isFormDirty, setIsFormDirty]);
|
|
4013
4065
|
|
|
4014
4066
|
var onSubmit = function onSubmit(data) {
|
|
4015
4067
|
// eslint-disable-next-line no-console
|
|
@@ -4058,6 +4110,7 @@ var TafForm = function TafForm(_ref) {
|
|
|
4058
4110
|
if (isFormDirty) {
|
|
4059
4111
|
showConfirmDialog(action).then(function () {
|
|
4060
4112
|
resetForm(undefined, isDefaultDisabled);
|
|
4113
|
+
resetTAC();
|
|
4061
4114
|
});
|
|
4062
4115
|
} else {
|
|
4063
4116
|
resetForm(undefined, isDefaultDisabled);
|
|
@@ -4234,10 +4287,16 @@ var TafForm = function TafForm(_ref) {
|
|
|
4234
4287
|
registerValidateForm(onValidateFormPromise); // set default taf action
|
|
4235
4288
|
|
|
4236
4289
|
setTafAction(fromStatusToAction(originalTaf.status));
|
|
4290
|
+
resetTAC();
|
|
4237
4291
|
return function () {
|
|
4238
4292
|
reset({});
|
|
4239
4293
|
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4240
4294
|
}, []);
|
|
4295
|
+
React__default.useEffect(function () {
|
|
4296
|
+
var newValues = prepareTafValues(tafFromBackend.taf, undefined, !isDefaultDisabled && !tafFromBackend.taf.changeGroups); // set new form values when tafFromBackend changed
|
|
4297
|
+
|
|
4298
|
+
reset(newValues); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4299
|
+
}, [tafFromBackend]);
|
|
4241
4300
|
React__default.useEffect(function () {
|
|
4242
4301
|
if (shouldValidate && !isDisabled) {
|
|
4243
4302
|
// trigger validation on all changegroup validity times after initial load since they could be outside the new validity period
|
|
@@ -4523,21 +4582,6 @@ var muiTabA11yProps = function muiTabA11yProps(index) {
|
|
|
4523
4582
|
'aria-controls': "simple-tabpanel-".concat(index)
|
|
4524
4583
|
};
|
|
4525
4584
|
};
|
|
4526
|
-
var emptyBaseForecast = {
|
|
4527
|
-
wind: '',
|
|
4528
|
-
visibility: '',
|
|
4529
|
-
weather: {
|
|
4530
|
-
weather1: '',
|
|
4531
|
-
weather2: '',
|
|
4532
|
-
weather3: ''
|
|
4533
|
-
},
|
|
4534
|
-
cloud: {
|
|
4535
|
-
cloud1: '',
|
|
4536
|
-
cloud2: '',
|
|
4537
|
-
cloud3: '',
|
|
4538
|
-
cloud4: ''
|
|
4539
|
-
}
|
|
4540
|
-
};
|
|
4541
4585
|
var prepareTafExportValues = function prepareTafExportValues(tafToCopy, currentTaf) {
|
|
4542
4586
|
var _a;
|
|
4543
4587
|
|
|
@@ -4546,7 +4590,7 @@ var prepareTafExportValues = function prepareTafExportValues(tafToCopy, currentT
|
|
|
4546
4590
|
_convertedCopy$change = convertedCopy.changeGroups,
|
|
4547
4591
|
changeGroups = _convertedCopy$change === void 0 ? [] : _convertedCopy$change;
|
|
4548
4592
|
return Object.assign(Object.assign({}, currentTaf), {
|
|
4549
|
-
baseForecast: Object.assign(Object.assign(
|
|
4593
|
+
baseForecast: Object.assign(Object.assign({}, baseForecast), {
|
|
4550
4594
|
valid: (_a = currentTaf === null || currentTaf === void 0 ? void 0 : currentTaf.baseForecast) === null || _a === void 0 ? void 0 : _a.valid
|
|
4551
4595
|
}),
|
|
4552
4596
|
changeGroups: changeGroups
|
|
@@ -4700,6 +4744,9 @@ var TacContainer = function TacContainer(_ref) {
|
|
|
4700
4744
|
trigger = _useFormContext.trigger,
|
|
4701
4745
|
setValue = _useFormContext.setValue;
|
|
4702
4746
|
|
|
4747
|
+
var _useTafModuleContext = useTafModuleContext(),
|
|
4748
|
+
updateTAC = _useTafModuleContext.updateTAC;
|
|
4749
|
+
|
|
4703
4750
|
var handleExport = function handleExport() {
|
|
4704
4751
|
var currentTaf = getValues();
|
|
4705
4752
|
var newTaf = prepareTafExportValues(taf, currentTaf);
|
|
@@ -4712,6 +4759,7 @@ var TacContainer = function TacContainer(_ref) {
|
|
|
4712
4759
|
setTimeout(function () {
|
|
4713
4760
|
trigger(); // trigger all fields validation
|
|
4714
4761
|
}, 0);
|
|
4762
|
+
updateTAC(convertTafValuesToObject(newTaf));
|
|
4715
4763
|
};
|
|
4716
4764
|
|
|
4717
4765
|
React__default.useEffect(function () {
|
|
@@ -5186,7 +5234,7 @@ var parseErrorMessage = function parseErrorMessage(error, params) {
|
|
|
5186
5234
|
} : {
|
|
5187
5235
|
type: 'SERVER',
|
|
5188
5236
|
title: 'An error has occurred while saving, please try again',
|
|
5189
|
-
message: getAxiosErrorMessage(error)
|
|
5237
|
+
message: isAxiosError(error) ? getAxiosErrorMessage(error) : error.message
|
|
5190
5238
|
};
|
|
5191
5239
|
};
|
|
5192
5240
|
|
|
@@ -5214,47 +5262,48 @@ var usePostTafRequest = function usePostTafRequest(request) {
|
|
|
5214
5262
|
switch (_context.prev = _context.next) {
|
|
5215
5263
|
case 0:
|
|
5216
5264
|
setLoading(true);
|
|
5217
|
-
|
|
5218
|
-
_context.
|
|
5265
|
+
setError(null);
|
|
5266
|
+
_context.prev = 2;
|
|
5267
|
+
_context.next = 5;
|
|
5219
5268
|
return request(params);
|
|
5220
5269
|
|
|
5221
|
-
case
|
|
5270
|
+
case 5:
|
|
5222
5271
|
if (isMounted.current) {
|
|
5223
|
-
_context.next =
|
|
5272
|
+
_context.next = 7;
|
|
5224
5273
|
break;
|
|
5225
5274
|
}
|
|
5226
5275
|
|
|
5227
5276
|
return _context.abrupt("return");
|
|
5228
5277
|
|
|
5229
|
-
case
|
|
5278
|
+
case 7:
|
|
5230
5279
|
setLoading(false);
|
|
5231
5280
|
setError(null);
|
|
5232
|
-
_context.next =
|
|
5281
|
+
_context.next = 19;
|
|
5233
5282
|
break;
|
|
5234
5283
|
|
|
5235
|
-
case
|
|
5236
|
-
_context.prev =
|
|
5237
|
-
_context.t0 = _context["catch"](
|
|
5284
|
+
case 11:
|
|
5285
|
+
_context.prev = 11;
|
|
5286
|
+
_context.t0 = _context["catch"](2);
|
|
5238
5287
|
|
|
5239
5288
|
if (isMounted.current) {
|
|
5240
|
-
_context.next =
|
|
5289
|
+
_context.next = 15;
|
|
5241
5290
|
break;
|
|
5242
5291
|
}
|
|
5243
5292
|
|
|
5244
5293
|
return _context.abrupt("return");
|
|
5245
5294
|
|
|
5246
|
-
case
|
|
5295
|
+
case 15:
|
|
5247
5296
|
newErrorr = errorParser ? errorParser(_context.t0, params) : _context.t0;
|
|
5248
5297
|
setLoading(false);
|
|
5249
5298
|
setError(newErrorr);
|
|
5250
5299
|
throw newErrorr;
|
|
5251
5300
|
|
|
5252
|
-
case
|
|
5301
|
+
case 19:
|
|
5253
5302
|
case "end":
|
|
5254
5303
|
return _context.stop();
|
|
5255
5304
|
}
|
|
5256
5305
|
}
|
|
5257
|
-
}, _callee, null, [[
|
|
5306
|
+
}, _callee, null, [[2, 11]]);
|
|
5258
5307
|
}));
|
|
5259
5308
|
};
|
|
5260
5309
|
|
|
@@ -5276,10 +5325,6 @@ var TafPanel = function TafPanel(_ref) {
|
|
|
5276
5325
|
postTaf = _ref$postTaf === void 0 ? function () {
|
|
5277
5326
|
return null;
|
|
5278
5327
|
} : _ref$postTaf,
|
|
5279
|
-
_ref$onFormDirty = _ref.onFormDirty,
|
|
5280
|
-
onFormDirty = _ref$onFormDirty === void 0 ? function () {
|
|
5281
|
-
return null;
|
|
5282
|
-
} : _ref$onFormDirty,
|
|
5283
5328
|
_ref$isIssuesPaneOpen = _ref.isIssuesPaneOpen,
|
|
5284
5329
|
isIssuesPaneOpen = _ref$isIssuesPaneOpen === void 0 ? false : _ref$isIssuesPaneOpen,
|
|
5285
5330
|
_ref$setIsIssuesPaneO = _ref.setIsIssuesPaneOpen,
|
|
@@ -5353,16 +5398,21 @@ var TafPanel = function TafPanel(_ref) {
|
|
|
5353
5398
|
severity: "error",
|
|
5354
5399
|
title: error.title,
|
|
5355
5400
|
info: error.message,
|
|
5356
|
-
dataTestId: "taf-error"
|
|
5357
|
-
|
|
5401
|
+
dataTestId: "taf-error",
|
|
5402
|
+
shouldClose: true
|
|
5403
|
+
}), /*#__PURE__*/React__default.createElement(Box, {
|
|
5404
|
+
sx: {
|
|
5405
|
+
marginTop: '10px',
|
|
5406
|
+
padding: 1
|
|
5407
|
+
}
|
|
5408
|
+
}, /*#__PURE__*/React__default.createElement(TafForm, {
|
|
5358
5409
|
tafFromBackend: tafFromBackend,
|
|
5359
5410
|
onFormAction: onTafAction,
|
|
5360
|
-
onFormDirty: onFormDirty,
|
|
5361
5411
|
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
5362
5412
|
setIsIssuesPaneOpen: setIsIssuesPaneOpen,
|
|
5363
5413
|
isDisabled: isFormDisabled,
|
|
5364
5414
|
setIsDisabled: setIsFormDisabled
|
|
5365
|
-
}));
|
|
5415
|
+
})));
|
|
5366
5416
|
};
|
|
5367
5417
|
|
|
5368
5418
|
/* *
|
|
@@ -5423,7 +5473,8 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5423
5473
|
|
|
5424
5474
|
var _useTafModuleContext = useTafModuleContext(),
|
|
5425
5475
|
onValidateForm = _useTafModuleContext.onValidateForm,
|
|
5426
|
-
tafAction = _useTafModuleContext.tafAction
|
|
5476
|
+
tafAction = _useTafModuleContext.tafAction,
|
|
5477
|
+
isFormDirty = _useTafModuleContext.isFormDirty;
|
|
5427
5478
|
|
|
5428
5479
|
var _React$useState = React__default.useState(sortTafTimeSlots(tafList)),
|
|
5429
5480
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -5454,13 +5505,8 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5454
5505
|
|
|
5455
5506
|
var _React$useState9 = React__default.useState(false),
|
|
5456
5507
|
_React$useState10 = _slicedToArray(_React$useState9, 2),
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
var _React$useState11 = React__default.useState(false),
|
|
5461
|
-
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
5462
|
-
isFormDisabled = _React$useState12[0],
|
|
5463
|
-
setIsFormDisabled = _React$useState12[1];
|
|
5508
|
+
isFormDisabled = _React$useState10[0],
|
|
5509
|
+
setIsFormDisabled = _React$useState10[1];
|
|
5464
5510
|
|
|
5465
5511
|
var postTaf = function postTaf(data) {
|
|
5466
5512
|
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
@@ -5518,16 +5564,18 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5518
5564
|
_context2.t0 = _context2["catch"](1);
|
|
5519
5565
|
confirmDialog(CONFIRM_DIALOG_OPTIONS).then(function () {
|
|
5520
5566
|
action(value);
|
|
5567
|
+
setError(null);
|
|
5521
5568
|
});
|
|
5522
5569
|
|
|
5523
5570
|
case 13:
|
|
5524
|
-
_context2.next =
|
|
5571
|
+
_context2.next = 17;
|
|
5525
5572
|
break;
|
|
5526
5573
|
|
|
5527
5574
|
case 15:
|
|
5528
5575
|
action(value);
|
|
5576
|
+
setError(null);
|
|
5529
5577
|
|
|
5530
|
-
case
|
|
5578
|
+
case 17:
|
|
5531
5579
|
case "end":
|
|
5532
5580
|
return _context2.stop();
|
|
5533
5581
|
}
|
|
@@ -5557,7 +5605,9 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5557
5605
|
setLocations(updatedLocations); // update active index
|
|
5558
5606
|
|
|
5559
5607
|
var newActiveIndex = updatedLocations.findIndex(function (location) {
|
|
5560
|
-
|
|
5608
|
+
var _a, _b, _c;
|
|
5609
|
+
|
|
5610
|
+
return ((_a = location === null || location === void 0 ? void 0 : location.taf) === null || _a === void 0 ? void 0 : _a.previousId) === ((_c = (_b = locations[activeTafIndex]) === null || _b === void 0 ? void 0 : _b.taf) === null || _c === void 0 ? void 0 : _c.uuid);
|
|
5561
5611
|
});
|
|
5562
5612
|
var newIndex = newActiveIndex !== -1 ? newActiveIndex : activeTafIndex;
|
|
5563
5613
|
setActiveTafIndex(newIndex); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -5646,10 +5696,9 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5646
5696
|
}, /*#__PURE__*/React__default.createElement(Card, {
|
|
5647
5697
|
variant: "outlined",
|
|
5648
5698
|
sx: {
|
|
5649
|
-
padding: 1,
|
|
5650
|
-
paddingTop: 0,
|
|
5651
5699
|
marginBottom: '12px',
|
|
5652
|
-
position: 'relative'
|
|
5700
|
+
position: 'relative',
|
|
5701
|
+
minHeight: locations.length * 62 + 32
|
|
5653
5702
|
}
|
|
5654
5703
|
}, /*#__PURE__*/React__default.createElement(TacOverviewMobile, {
|
|
5655
5704
|
upcomingTafs: upcoming,
|
|
@@ -5662,7 +5711,6 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5662
5711
|
activeTafIndex: activeTafIndex,
|
|
5663
5712
|
index: index,
|
|
5664
5713
|
tafFromBackend: tafFromBackend,
|
|
5665
|
-
onFormDirty: setIsFormDirty,
|
|
5666
5714
|
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
5667
5715
|
setIsIssuesPaneOpen: onToggleIssuesPane,
|
|
5668
5716
|
isFormDisabled: isFormDisabled,
|
|
@@ -5673,13 +5721,15 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5673
5721
|
});
|
|
5674
5722
|
}))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
5675
5723
|
item: true,
|
|
5676
|
-
xs:
|
|
5677
|
-
|
|
5678
|
-
|
|
5724
|
+
xs: 0,
|
|
5725
|
+
sm: 3,
|
|
5726
|
+
height: {
|
|
5727
|
+
xs: 0,
|
|
5728
|
+
sm: '100%'
|
|
5679
5729
|
},
|
|
5680
|
-
|
|
5681
|
-
xs:
|
|
5682
|
-
sm: '
|
|
5730
|
+
width: {
|
|
5731
|
+
xs: 0,
|
|
5732
|
+
sm: '100%'
|
|
5683
5733
|
}
|
|
5684
5734
|
}, /*#__PURE__*/React__default.createElement(TacOverview, {
|
|
5685
5735
|
upcomingTafs: upcoming,
|
|
@@ -5694,6 +5744,19 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5694
5744
|
}));
|
|
5695
5745
|
};
|
|
5696
5746
|
|
|
5747
|
+
var TafWrapper = function TafWrapper(_a) {
|
|
5748
|
+
var children = _a.children,
|
|
5749
|
+
props = __rest(_a, ["children"]);
|
|
5750
|
+
|
|
5751
|
+
return /*#__PURE__*/React.createElement(TafModuleProvider, Object.assign({}, props), /*#__PURE__*/React.createElement(ConfirmationServiceProvider, null, /*#__PURE__*/React.createElement(ReactHookFormProvider, {
|
|
5752
|
+
options: {
|
|
5753
|
+
mode: 'onTouched',
|
|
5754
|
+
reValidateMode: 'onChange',
|
|
5755
|
+
criteriaMode: 'all'
|
|
5756
|
+
}
|
|
5757
|
+
}, children)));
|
|
5758
|
+
};
|
|
5759
|
+
|
|
5697
5760
|
/* *
|
|
5698
5761
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5699
5762
|
* you may not use this file except in compliance with the License.
|
|
@@ -5711,29 +5774,13 @@ var TafLayout = function TafLayout(_ref) {
|
|
|
5711
5774
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
5712
5775
|
* */
|
|
5713
5776
|
|
|
5714
|
-
var TafWrapper = function TafWrapper(_ref) {
|
|
5715
|
-
var children = _ref.children;
|
|
5716
|
-
return /*#__PURE__*/React.createElement(TafModuleProvider, null, /*#__PURE__*/React.createElement(ConfirmationServiceProvider, null, /*#__PURE__*/React.createElement(ReactHookFormProvider, {
|
|
5717
|
-
options: {
|
|
5718
|
-
mode: 'onTouched',
|
|
5719
|
-
reValidateMode: 'onChange',
|
|
5720
|
-
criteriaMode: 'all'
|
|
5721
|
-
}
|
|
5722
|
-
}, children)));
|
|
5723
|
-
};
|
|
5724
|
-
|
|
5725
5777
|
var TafModule = function TafModule() {
|
|
5726
5778
|
var _useApiContext = useApiContext(),
|
|
5727
5779
|
api = _useApiContext.api;
|
|
5728
5780
|
|
|
5729
|
-
var _React$useState = React.useState(false),
|
|
5730
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
5731
|
-
isLoading = _React$useState2[0],
|
|
5732
|
-
setLoading = _React$useState2[1];
|
|
5733
|
-
|
|
5734
5781
|
var _useApi = useApi(api.getTafList),
|
|
5735
5782
|
getTafListError = _useApi.error,
|
|
5736
|
-
|
|
5783
|
+
isLoading = _useApi.isLoading,
|
|
5737
5784
|
tafList = _useApi.result,
|
|
5738
5785
|
fetchNewTafList = _useApi.fetchApiData;
|
|
5739
5786
|
|
|
@@ -5741,45 +5788,11 @@ var TafModule = function TafModule() {
|
|
|
5741
5788
|
return fetchNewTafList({});
|
|
5742
5789
|
});
|
|
5743
5790
|
|
|
5744
|
-
var
|
|
5745
|
-
|
|
5746
|
-
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
5747
|
-
while (1) {
|
|
5748
|
-
switch (_context.prev = _context.next) {
|
|
5749
|
-
case 0:
|
|
5750
|
-
_context.prev = 0;
|
|
5751
|
-
setLoading(true);
|
|
5752
|
-
_context.next = 4;
|
|
5753
|
-
return fetchNewTafList({});
|
|
5754
|
-
|
|
5755
|
-
case 4:
|
|
5756
|
-
setLoading(false);
|
|
5757
|
-
_context.next = 10;
|
|
5758
|
-
break;
|
|
5759
|
-
|
|
5760
|
-
case 7:
|
|
5761
|
-
_context.prev = 7;
|
|
5762
|
-
_context.t0 = _context["catch"](0);
|
|
5763
|
-
setLoading(false);
|
|
5764
|
-
|
|
5765
|
-
case 10:
|
|
5766
|
-
case "end":
|
|
5767
|
-
return _context.stop();
|
|
5768
|
-
}
|
|
5769
|
-
}
|
|
5770
|
-
}, _callee, null, [[0, 7]]);
|
|
5771
|
-
}));
|
|
5791
|
+
var onPostTaf = function onPostTaf() {
|
|
5792
|
+
fetchNewTafList({});
|
|
5772
5793
|
};
|
|
5773
5794
|
|
|
5774
5795
|
var hasTafListError = getTafListError !== null;
|
|
5775
|
-
|
|
5776
|
-
if (isFetchingInitial) {
|
|
5777
|
-
return /*#__PURE__*/React.createElement(LinearProgress, {
|
|
5778
|
-
color: "secondary",
|
|
5779
|
-
"data-testid": "loading-bar"
|
|
5780
|
-
});
|
|
5781
|
-
}
|
|
5782
|
-
|
|
5783
5796
|
return /*#__PURE__*/React.createElement(Box, {
|
|
5784
5797
|
component: "div",
|
|
5785
5798
|
id: "tafmodule",
|
|
@@ -5795,33 +5808,22 @@ var TafModule = function TafModule() {
|
|
|
5795
5808
|
}), hasTafListError && /*#__PURE__*/React.createElement(AlertBanner, {
|
|
5796
5809
|
severity: "error",
|
|
5797
5810
|
title: "An error has occurred while retrieving the list",
|
|
5798
|
-
info: getTafListError.message
|
|
5811
|
+
info: getTafListError.message,
|
|
5812
|
+
dataTestId: "taf-list-error",
|
|
5813
|
+
actionButtonProps: {
|
|
5814
|
+
title: 'Try again',
|
|
5815
|
+
onClick: fetchNewTafList
|
|
5816
|
+
}
|
|
5799
5817
|
}), /*#__PURE__*/React.createElement(TafLayout, {
|
|
5800
5818
|
tafList: tafList,
|
|
5801
|
-
onPostTaf:
|
|
5819
|
+
onPostTaf: onPostTaf
|
|
5802
5820
|
}));
|
|
5803
5821
|
};
|
|
5804
5822
|
|
|
5805
|
-
var Wrapper = function Wrapper() {
|
|
5806
|
-
return /*#__PURE__*/React.createElement(TafWrapper,
|
|
5823
|
+
var Wrapper = function Wrapper(props) {
|
|
5824
|
+
return /*#__PURE__*/React.createElement(TafWrapper, Object.assign({}, props), /*#__PURE__*/React.createElement(TafModule, null));
|
|
5807
5825
|
};
|
|
5808
5826
|
|
|
5809
|
-
/* *
|
|
5810
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5811
|
-
* you may not use this file except in compliance with the License.
|
|
5812
|
-
* You may obtain a copy of the License at
|
|
5813
|
-
*
|
|
5814
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5815
|
-
*
|
|
5816
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
5817
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5818
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5819
|
-
* See the License for the specific language governing permissions and
|
|
5820
|
-
* limitations under the License.
|
|
5821
|
-
*
|
|
5822
|
-
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5823
|
-
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
5824
|
-
* */
|
|
5825
5827
|
var createApi$1 = function createApi(url, appUrl, auth, setAuth, authTokenUrl, authClientId) {
|
|
5826
5828
|
var axiosInstance = createApiInstance(url, appUrl, auth, setAuth, authTokenUrl, authClientId);
|
|
5827
5829
|
return {
|
|
@@ -5832,8 +5834,10 @@ var createApi$1 = function createApi(url, appUrl, auth, setAuth, authTokenUrl, a
|
|
|
5832
5834
|
postTaf: function postTaf(formData) {
|
|
5833
5835
|
return axiosInstance.post('/taf', Object.assign({}, formData));
|
|
5834
5836
|
},
|
|
5835
|
-
getTAC: function getTAC(tafData) {
|
|
5836
|
-
return axiosInstance.post('/taf2tac'
|
|
5837
|
+
getTAC: function getTAC(tafData, signal) {
|
|
5838
|
+
return axiosInstance.post.apply(axiosInstance, ['/taf2tac'].concat([Object.assign({}, tafData)].concat(_toConsumableArray(signal ? [{
|
|
5839
|
+
signal: signal
|
|
5840
|
+
}] : []))));
|
|
5837
5841
|
}
|
|
5838
5842
|
};
|
|
5839
5843
|
};
|
|
@@ -6757,12 +6761,17 @@ var fakeAmendmentTaf = {
|
|
|
6757
6761
|
var fakeTafTac = 'TAF EHAM 0812/0918 20020G35KT 0500 SN BKN040\nBECMG 0814/0816 0700 BKN001=';
|
|
6758
6762
|
|
|
6759
6763
|
var fakePromise = function fakePromise(withRandomError) {
|
|
6764
|
+
var signal = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
6760
6765
|
return new Promise(function (resolve, reject) {
|
|
6761
|
-
setTimeout(function () {
|
|
6766
|
+
var timer = setTimeout(function () {
|
|
6762
6767
|
if (!withRandomError) return resolve();
|
|
6763
6768
|
var randomError = Math.floor(Math.random() * 4) + 1;
|
|
6764
6769
|
return randomError === 4 ? reject(new Error('something went wrong')) : resolve();
|
|
6765
6770
|
}, 300);
|
|
6771
|
+
signal === null || signal === void 0 ? void 0 : signal.signal.addEventListener('abort', function () {
|
|
6772
|
+
clearTimeout(timer);
|
|
6773
|
+
reject(new Error('canceled'));
|
|
6774
|
+
});
|
|
6766
6775
|
});
|
|
6767
6776
|
};
|
|
6768
6777
|
|
|
@@ -6772,8 +6781,8 @@ var fakeAxiosInstance = {
|
|
|
6772
6781
|
return fakePromise(false);
|
|
6773
6782
|
},
|
|
6774
6783
|
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars, @typescript-eslint/explicit-module-boundary-types
|
|
6775
|
-
post: function post(_url, _params) {
|
|
6776
|
-
return fakePromise(false);
|
|
6784
|
+
post: function post(_url, _params, _signal) {
|
|
6785
|
+
return fakePromise(false, _signal);
|
|
6777
6786
|
}
|
|
6778
6787
|
};
|
|
6779
6788
|
var createApi = function createApi() {
|
|
@@ -6787,22 +6796,104 @@ var createApi = function createApi() {
|
|
|
6787
6796
|
};
|
|
6788
6797
|
});
|
|
6789
6798
|
},
|
|
6790
|
-
getTAC: function getTAC() {
|
|
6791
|
-
// eslint-disable-next-line no-console
|
|
6792
|
-
return fakeAxiosInstance.post('/taf2tac').then(function () {
|
|
6793
|
-
return {
|
|
6794
|
-
data: fakeTafTac
|
|
6795
|
-
};
|
|
6796
|
-
});
|
|
6797
|
-
},
|
|
6798
6799
|
postTaf: function postTaf(_postTaf) {
|
|
6799
6800
|
// eslint-disable-next-line no-console
|
|
6800
6801
|
console.log("The new status of the taf will be ".concat(_postTaf.changeStatusTo)); // eslint-disable-next-line no-console
|
|
6801
6802
|
|
|
6802
6803
|
console.log('form has been posted with following values:', _postTaf.taf);
|
|
6803
6804
|
return fakeAxiosInstance.post('/taf', _postTaf);
|
|
6805
|
+
},
|
|
6806
|
+
getTAC: function getTAC(tafData, signal) {
|
|
6807
|
+
return fakeAxiosInstance.post.apply(fakeAxiosInstance, ['/taf2tac'].concat([Object.assign({}, tafData)].concat(_toConsumableArray(signal ? [{
|
|
6808
|
+
signal: signal
|
|
6809
|
+
}] : [])))).then(function () {
|
|
6810
|
+
return {
|
|
6811
|
+
data: fakeTafTac
|
|
6812
|
+
};
|
|
6813
|
+
});
|
|
6804
6814
|
}
|
|
6805
6815
|
};
|
|
6806
6816
|
};
|
|
6807
6817
|
|
|
6808
|
-
|
|
6818
|
+
/* *
|
|
6819
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6820
|
+
* you may not use this file except in compliance with the License.
|
|
6821
|
+
* You may obtain a copy of the License at
|
|
6822
|
+
*
|
|
6823
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6824
|
+
*
|
|
6825
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6826
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6827
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6828
|
+
* See the License for the specific language governing permissions and
|
|
6829
|
+
* limitations under the License.
|
|
6830
|
+
*
|
|
6831
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
6832
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
6833
|
+
* */
|
|
6834
|
+
var tafScreenPreset = {
|
|
6835
|
+
id: 'screenConfigTaf',
|
|
6836
|
+
title: 'TAF',
|
|
6837
|
+
views: {
|
|
6838
|
+
byId: {
|
|
6839
|
+
taf: {
|
|
6840
|
+
title: 'TAF',
|
|
6841
|
+
componentType: 'TafModule',
|
|
6842
|
+
initialProps: {}
|
|
6843
|
+
}
|
|
6844
|
+
},
|
|
6845
|
+
allIds: ['taf']
|
|
6846
|
+
},
|
|
6847
|
+
syncGroups: [],
|
|
6848
|
+
mosaicNode: 'taf'
|
|
6849
|
+
};
|
|
6850
|
+
var TafApiWrapper = function TafApiWrapper(_ref) {
|
|
6851
|
+
var config = _ref.config,
|
|
6852
|
+
auth = _ref.auth,
|
|
6853
|
+
onSetAuth = _ref.onSetAuth,
|
|
6854
|
+
onPreventCloseView = _ref.onPreventCloseView;
|
|
6855
|
+
return config ? /*#__PURE__*/React.createElement(ApiProvider, {
|
|
6856
|
+
baseURL: config.baseUrl,
|
|
6857
|
+
appURL: config.appUrl,
|
|
6858
|
+
auth: auth,
|
|
6859
|
+
onSetAuth: onSetAuth,
|
|
6860
|
+
createApi: createApi$1,
|
|
6861
|
+
authTokenUrl: config.authTokenUrl,
|
|
6862
|
+
authClientId: config.authClientId
|
|
6863
|
+
}, /*#__PURE__*/React.createElement(ErrorBoundary, null, /*#__PURE__*/React.createElement(Wrapper, {
|
|
6864
|
+
onPreventCloseView: onPreventCloseView
|
|
6865
|
+
}))) : null;
|
|
6866
|
+
};
|
|
6867
|
+
var componentsLookUp = function componentsLookUp(payload, _ref2) {
|
|
6868
|
+
var config = _ref2.config,
|
|
6869
|
+
auth = _ref2.auth,
|
|
6870
|
+
onSetAuth = _ref2.onSetAuth;
|
|
6871
|
+
var ConnectedModuleWrapper = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
6872
|
+
var componentType = payload.componentType;
|
|
6873
|
+
|
|
6874
|
+
switch (componentType) {
|
|
6875
|
+
case 'TafModule':
|
|
6876
|
+
if (ConnectedModuleWrapper) {
|
|
6877
|
+
return /*#__PURE__*/React.createElement(ConnectedModuleWrapper, {
|
|
6878
|
+
component: TafApiWrapper,
|
|
6879
|
+
payload: payload,
|
|
6880
|
+
"data-testid": "tafmodule",
|
|
6881
|
+
config: config,
|
|
6882
|
+
auth: auth,
|
|
6883
|
+
onSetAuth: onSetAuth
|
|
6884
|
+
});
|
|
6885
|
+
}
|
|
6886
|
+
|
|
6887
|
+
return /*#__PURE__*/React.createElement(TafApiWrapper, {
|
|
6888
|
+
"data-testid": "tafmodule",
|
|
6889
|
+
config: config,
|
|
6890
|
+
auth: auth,
|
|
6891
|
+
onSetAuth: onSetAuth
|
|
6892
|
+
});
|
|
6893
|
+
|
|
6894
|
+
default:
|
|
6895
|
+
return null;
|
|
6896
|
+
}
|
|
6897
|
+
};
|
|
6898
|
+
|
|
6899
|
+
export { TafApiWrapper, TafForm, Wrapper as TafModule, componentsLookUp, createApi$1 as createApi, createApi as createFakeApi, tafScreenPreset };
|