@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.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@mui/material'), require('react-hook-form'), require('react-sortablejs'), require('@opengeoweb/form-fields'), require('@opengeoweb/
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', 'react', '@mui/material', 'react-hook-form', 'react-sortablejs', '@opengeoweb/form-fields', '@opengeoweb/
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Taf = {}, global.React, global.material, global.reactHookForm, global.reactSortablejs, global.formFields, global.
|
|
5
|
-
})(this, (function (exports, React, material, reactHookForm, reactSortablejs, formFields,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('@mui/material'), require('react-hook-form'), require('react-sortablejs'), require('@opengeoweb/form-fields'), require('@opengeoweb/shared'), require('lodash'), require('moment'), require('@mui/styles/makeStyles'), require('@mui/icons-material'), require('react-dom'), require('@opengeoweb/api'), require('@mui/material/LinearProgress'), require('@mui/icons-material/DoDisturb'), require('@mui/material/Box')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'react', '@mui/material', 'react-hook-form', 'react-sortablejs', '@opengeoweb/form-fields', '@opengeoweb/shared', 'lodash', 'moment', '@mui/styles/makeStyles', '@mui/icons-material', 'react-dom', '@opengeoweb/api', '@mui/material/LinearProgress', '@mui/icons-material/DoDisturb', '@mui/material/Box'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.Taf = {}, global.React, global.material, global.reactHookForm, global.reactSortablejs, global.formFields, global.shared, global.lodash, global.moment, global.makeStyles, global.iconsMaterial, global.ReactDOM, global.api, global.LinearProgress, global.DoDisturbIcon, global.Box));
|
|
5
|
+
})(this, (function (exports, React, material, reactHookForm, reactSortablejs, formFields, shared, lodash, moment, makeStyles, iconsMaterial, ReactDOM, api, LinearProgress, DoDisturbIcon, Box) { 'use strict';
|
|
6
6
|
|
|
7
7
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
@@ -1994,6 +1994,22 @@
|
|
|
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 ? moment__default["default"](issueDate).utc().format('DDHHmm') + "Z" : 'Not issued';
|
|
1999
2015
|
};
|
|
@@ -2302,24 +2318,36 @@
|
|
|
2302
2318
|
var tacHasError = function tacHasError(tac) {
|
|
2303
2319
|
return tac === TAC_MISSING_DATA || tac === TAC_NOT_AVAILABLE || tac === TAC_RETRIEVING_DATA || tac === TAC_FAILED;
|
|
2304
2320
|
};
|
|
2305
|
-
var useTACGenerator = function useTACGenerator(taf, requestTAC
|
|
2306
|
-
|
|
2307
|
-
standardTAC = '';
|
|
2308
|
-
}
|
|
2309
|
-
|
|
2310
|
-
var _a = __read(React__default["default"].useState(taf.status === 'NEW' ? TAC_NOT_AVAILABLE : TAC_RETRIEVING_DATA), 2),
|
|
2321
|
+
var useTACGenerator = function useTACGenerator(taf, requestTAC) {
|
|
2322
|
+
var _a = __read(React__default["default"].useState(!taf || taf.status === 'NEW' ? TAC_NOT_AVAILABLE : TAC_RETRIEVING_DATA), 2),
|
|
2311
2323
|
TAC = _a[0],
|
|
2312
2324
|
setTAC = _a[1];
|
|
2313
2325
|
|
|
2314
2326
|
var isMounted = shared.useIsMounted().isMounted;
|
|
2327
|
+
var controller = React__default["default"].useRef(null);
|
|
2328
|
+
|
|
2329
|
+
var onSetTac = function onSetTac(newTAC) {
|
|
2330
|
+
if (controller.current) {
|
|
2331
|
+
controller.current.abort();
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
setTAC(newTAC);
|
|
2335
|
+
};
|
|
2336
|
+
|
|
2315
2337
|
var retrieveTAC = React__default["default"].useCallback(function (tafToPost) {
|
|
2316
2338
|
if (shouldRetrieveTAC(tafToPost)) {
|
|
2317
|
-
|
|
2339
|
+
if (controller.current) {
|
|
2340
|
+
controller.current.abort();
|
|
2341
|
+
}
|
|
2342
|
+
|
|
2343
|
+
controller.current = new AbortController();
|
|
2344
|
+
setTAC(TAC_RETRIEVING_DATA);
|
|
2345
|
+
requestTAC(tafToPost, controller.current.signal).then(function (result) {
|
|
2318
2346
|
if (isMounted.current) {
|
|
2319
2347
|
setTAC(result.data);
|
|
2320
2348
|
}
|
|
2321
|
-
})["catch"](function () {
|
|
2322
|
-
if (isMounted.
|
|
2349
|
+
})["catch"](function (error) {
|
|
2350
|
+
if (isMounted && error.message !== 'canceled') {
|
|
2323
2351
|
setTAC(TAC_FAILED);
|
|
2324
2352
|
}
|
|
2325
2353
|
});
|
|
@@ -2328,17 +2356,12 @@
|
|
|
2328
2356
|
}
|
|
2329
2357
|
}, [isMounted, requestTAC]);
|
|
2330
2358
|
React__default["default"].useEffect(function () {
|
|
2331
|
-
if (taf.status !== 'NEW'
|
|
2359
|
+
if (taf && taf.status !== 'NEW') {
|
|
2332
2360
|
retrieveTAC(taf);
|
|
2333
2361
|
} // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2334
2362
|
|
|
2335
2363
|
}, []);
|
|
2336
|
-
|
|
2337
|
-
if (standardTAC !== '') {
|
|
2338
|
-
setTAC(standardTAC);
|
|
2339
|
-
}
|
|
2340
|
-
}, [standardTAC]);
|
|
2341
|
-
return [TAC, retrieveTAC];
|
|
2364
|
+
return [TAC, retrieveTAC, onSetTac];
|
|
2342
2365
|
};
|
|
2343
2366
|
var useDragOrder = function useDragOrder(trigger, move, onFormBlur) {
|
|
2344
2367
|
var _a = __read(React__default["default"].useState(null), 2),
|
|
@@ -2528,9 +2551,16 @@
|
|
|
2528
2551
|
|
|
2529
2552
|
|
|
2530
2553
|
var taf = tafAction === 'AMEND' || tafAction === 'DRAFT_AMEND' || tafAction === 'CORRECT' || tafAction === 'DRAFT_CORRECT' ? getAmendedCorrectedTafTimes(_taf, tafAction) : _taf;
|
|
2554
|
+
var formattedBaseForecast = formatFormValues(taf.baseForecast);
|
|
2555
|
+
|
|
2556
|
+
var baseForecast = __assign(__assign(__assign({}, emptyBaseForecast), formattedBaseForecast), {
|
|
2557
|
+
weather: __assign(__assign({}, emptyBaseForecast.weather), formattedBaseForecast.weather),
|
|
2558
|
+
cloud: __assign(__assign({}, emptyBaseForecast.cloud), formattedBaseForecast.cloud)
|
|
2559
|
+
});
|
|
2560
|
+
|
|
2531
2561
|
return __assign(__assign(__assign(__assign({}, taf), {
|
|
2532
2562
|
messageType: getMessageType(taf, tafAction),
|
|
2533
|
-
baseForecast:
|
|
2563
|
+
baseForecast: baseForecast
|
|
2534
2564
|
}), taf.changeGroups && {
|
|
2535
2565
|
changeGroups: taf.changeGroups.map(formatFormValues)
|
|
2536
2566
|
}), addEmptyChangeGroup && {
|
|
@@ -2916,7 +2946,7 @@
|
|
|
2916
2946
|
getValues = _g.getValues,
|
|
2917
2947
|
trigger = _g.trigger;
|
|
2918
2948
|
|
|
2919
|
-
var isNotRequiredForAction = shared.useDraftFormHelpers().isRequired; // cross-field required validation
|
|
2949
|
+
var isNotRequiredForAction = shared.useDraftFormHelpers(true).isRequired; // cross-field required validation
|
|
2920
2950
|
|
|
2921
2951
|
var _h = __read(getRequiredCrossFields(fieldNames), 3),
|
|
2922
2952
|
mainFields = _h[0],
|
|
@@ -3723,20 +3753,6 @@
|
|
|
3723
3753
|
}
|
|
3724
3754
|
};
|
|
3725
3755
|
|
|
3726
|
-
var getErrorDefaultMessage = function getErrorDefaultMessage(error) {
|
|
3727
|
-
switch (error.type) {
|
|
3728
|
-
case 'required':
|
|
3729
|
-
{
|
|
3730
|
-
return 'this field is required';
|
|
3731
|
-
}
|
|
3732
|
-
|
|
3733
|
-
default:
|
|
3734
|
-
{
|
|
3735
|
-
return error.message;
|
|
3736
|
-
}
|
|
3737
|
-
}
|
|
3738
|
-
};
|
|
3739
|
-
|
|
3740
3756
|
var capitalizeWord = function capitalizeWord(_a) {
|
|
3741
3757
|
var _b = __read(_a),
|
|
3742
3758
|
firstLetter = _b[0],
|
|
@@ -3772,7 +3788,7 @@
|
|
|
3772
3788
|
firstNamePart = _a[0];
|
|
3773
3789
|
|
|
3774
3790
|
var fieldErrorTitle = humanizeErrorMessage(firstNamePart);
|
|
3775
|
-
return index + 1 + ". " + fieldErrorTitle + ": " +
|
|
3791
|
+
return index + 1 + ". " + fieldErrorTitle + ": " + error.message;
|
|
3776
3792
|
};
|
|
3777
3793
|
var MODAL_DIALOG_ELEMENT = 'modal-dialog';
|
|
3778
3794
|
var useIssuesPane = function useIssuesPane() {
|
|
@@ -3855,23 +3871,37 @@
|
|
|
3855
3871
|
onValidateForm: null,
|
|
3856
3872
|
registerValidateForm: null,
|
|
3857
3873
|
tafAction: null,
|
|
3858
|
-
setTafAction: null
|
|
3874
|
+
setTafAction: null,
|
|
3875
|
+
isFormDirty: null,
|
|
3876
|
+
setIsFormDirty: null
|
|
3859
3877
|
});
|
|
3860
3878
|
var useTafModuleContext = function useTafModuleContext() {
|
|
3861
3879
|
return React__namespace.useContext(TafModuleContext);
|
|
3862
3880
|
};
|
|
3863
|
-
var useTafModuleState = function useTafModuleState() {
|
|
3864
|
-
var
|
|
3881
|
+
var useTafModuleState = function useTafModuleState(_a) {
|
|
3882
|
+
var onPreventCloseView = _a.onPreventCloseView;
|
|
3883
|
+
var api$1 = api.useApiContext().api;
|
|
3884
|
+
|
|
3885
|
+
var _b = __read(React__namespace.useState(function () {
|
|
3865
3886
|
return new Promise(function () {
|
|
3866
3887
|
return true;
|
|
3867
3888
|
});
|
|
3868
3889
|
}), 2),
|
|
3869
|
-
onValidateForm =
|
|
3870
|
-
registerValidateForm =
|
|
3890
|
+
onValidateForm = _b[0],
|
|
3891
|
+
registerValidateForm = _b[1];
|
|
3892
|
+
|
|
3893
|
+
var _c = __read(React__namespace.useState(), 2),
|
|
3894
|
+
tafAction = _c[0],
|
|
3895
|
+
setTafAction = _c[1];
|
|
3871
3896
|
|
|
3872
|
-
var
|
|
3873
|
-
|
|
3874
|
-
|
|
3897
|
+
var _d = __read(React__namespace.useState(false), 2),
|
|
3898
|
+
isFormDirty = _d[0],
|
|
3899
|
+
setIsFormDirty = _d[1];
|
|
3900
|
+
|
|
3901
|
+
var _e = __read(useTACGenerator(undefined, api$1.getTAC), 3),
|
|
3902
|
+
TAC = _e[0],
|
|
3903
|
+
updateTAC = _e[1],
|
|
3904
|
+
setTAC = _e[2];
|
|
3875
3905
|
|
|
3876
3906
|
var onRegisterValidateForm = function onRegisterValidateForm(promiseToRegister) {
|
|
3877
3907
|
registerValidateForm(function () {
|
|
@@ -3879,16 +3909,32 @@
|
|
|
3879
3909
|
});
|
|
3880
3910
|
};
|
|
3881
3911
|
|
|
3912
|
+
var onChangeFormDirty = function onChangeFormDirty(isDirty) {
|
|
3913
|
+
if (isDirty !== isFormDirty) {
|
|
3914
|
+
setIsFormDirty(isDirty);
|
|
3915
|
+
onPreventCloseView(isDirty);
|
|
3916
|
+
}
|
|
3917
|
+
};
|
|
3918
|
+
|
|
3882
3919
|
return {
|
|
3883
3920
|
onValidateForm: onValidateForm,
|
|
3884
3921
|
registerValidateForm: onRegisterValidateForm,
|
|
3885
3922
|
tafAction: tafAction,
|
|
3886
|
-
setTafAction: setTafAction
|
|
3923
|
+
setTafAction: setTafAction,
|
|
3924
|
+
TAC: TAC,
|
|
3925
|
+
updateTAC: updateTAC,
|
|
3926
|
+
setTAC: setTAC,
|
|
3927
|
+
isFormDirty: isFormDirty,
|
|
3928
|
+
setIsFormDirty: onChangeFormDirty
|
|
3887
3929
|
};
|
|
3888
3930
|
};
|
|
3889
3931
|
var TafModuleProvider = function TafModuleProvider(_a) {
|
|
3890
|
-
var children = _a.children
|
|
3891
|
-
|
|
3932
|
+
var children = _a.children,
|
|
3933
|
+
_b = _a.onPreventCloseView,
|
|
3934
|
+
onPreventCloseView = _b === void 0 ? function () {} : _b;
|
|
3935
|
+
var contextState = useTafModuleState({
|
|
3936
|
+
onPreventCloseView: onPreventCloseView
|
|
3937
|
+
});
|
|
3892
3938
|
return /*#__PURE__*/React__namespace.createElement(TafModuleContext.Provider, {
|
|
3893
3939
|
value: contextState
|
|
3894
3940
|
}, children);
|
|
@@ -3902,64 +3948,69 @@
|
|
|
3902
3948
|
onFormAction = _b === void 0 ? function () {
|
|
3903
3949
|
return null;
|
|
3904
3950
|
} : _b,
|
|
3905
|
-
_c = _a.
|
|
3906
|
-
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
_d = _a.isIssuesPaneOpen,
|
|
3910
|
-
isIssuesPaneOpen = _d === void 0 ? false : _d,
|
|
3911
|
-
_e = _a.setIsIssuesPaneOpen,
|
|
3912
|
-
setIsIssuesPaneOpen = _e === void 0 ? function () {
|
|
3951
|
+
_c = _a.isIssuesPaneOpen,
|
|
3952
|
+
isIssuesPaneOpen = _c === void 0 ? false : _c,
|
|
3953
|
+
_d = _a.setIsIssuesPaneOpen,
|
|
3954
|
+
setIsIssuesPaneOpen = _d === void 0 ? function () {
|
|
3913
3955
|
return null;
|
|
3914
|
-
} :
|
|
3915
|
-
|
|
3916
|
-
isDisabled =
|
|
3917
|
-
|
|
3918
|
-
setIsDisabled =
|
|
3956
|
+
} : _d,
|
|
3957
|
+
_e = _a.isDisabled,
|
|
3958
|
+
isDisabled = _e === void 0 ? false : _e,
|
|
3959
|
+
_f = _a.setIsDisabled,
|
|
3960
|
+
setIsDisabled = _f === void 0 ? function () {
|
|
3919
3961
|
return null;
|
|
3920
|
-
} :
|
|
3962
|
+
} : _f;
|
|
3921
3963
|
var originalTaf = tafFromBackend.taf;
|
|
3922
3964
|
var isDefaultDisabled = getIsFormDefaultDisabled(tafFromBackend.taf.status);
|
|
3923
3965
|
var confirmDialog = shared.useConfirmationDialog();
|
|
3924
3966
|
|
|
3925
|
-
var
|
|
3926
|
-
toggleIsDraft =
|
|
3927
|
-
DraftFieldHelper =
|
|
3967
|
+
var _g = shared.useDraftFormHelpers(true),
|
|
3968
|
+
toggleIsDraft = _g.toggleIsDraft,
|
|
3969
|
+
DraftFieldHelper = _g.DraftFieldHelper;
|
|
3928
3970
|
|
|
3929
|
-
var
|
|
3930
|
-
registerValidateForm =
|
|
3931
|
-
tafAction =
|
|
3932
|
-
|
|
3971
|
+
var _h = useTafModuleContext(),
|
|
3972
|
+
registerValidateForm = _h.registerValidateForm,
|
|
3973
|
+
tafAction = _h.tafAction,
|
|
3974
|
+
setIsFormDirty = _h.setIsFormDirty,
|
|
3975
|
+
setTafAction = _h.setTafAction,
|
|
3976
|
+
TAC = _h.TAC,
|
|
3977
|
+
updateTAC = _h.updateTAC,
|
|
3978
|
+
setTAC = _h.setTAC;
|
|
3933
3979
|
|
|
3934
|
-
var api$1 = api.useApiContext().api;
|
|
3935
3980
|
var isMounted = shared.useIsMounted().isMounted;
|
|
3936
3981
|
|
|
3937
|
-
var
|
|
3938
|
-
control =
|
|
3939
|
-
handleSubmit =
|
|
3940
|
-
trigger =
|
|
3941
|
-
formState =
|
|
3942
|
-
getValues =
|
|
3943
|
-
setValue =
|
|
3944
|
-
reset =
|
|
3982
|
+
var _j = reactHookForm.useFormContext(),
|
|
3983
|
+
control = _j.control,
|
|
3984
|
+
handleSubmit = _j.handleSubmit,
|
|
3985
|
+
trigger = _j.trigger,
|
|
3986
|
+
formState = _j.formState,
|
|
3987
|
+
getValues = _j.getValues,
|
|
3988
|
+
setValue = _j.setValue,
|
|
3989
|
+
reset = _j.reset;
|
|
3945
3990
|
|
|
3946
3991
|
var isFormDirty = formState.isDirty,
|
|
3947
3992
|
errors = formState.errors;
|
|
3948
3993
|
shared.usePreventBrowserClose(isFormDirty && !isDisabled);
|
|
3949
3994
|
var hiddenInputFields = ['baseTime', 'issueDate', 'type', 'uuid', 'validDateStart', 'validDateEnd', 'status', 'previousId', 'previousValidDateStart', 'previousValidDateEnd'];
|
|
3950
3995
|
|
|
3951
|
-
var
|
|
3952
|
-
delayedFormValues =
|
|
3953
|
-
setDelayedFormValues =
|
|
3954
|
-
|
|
3955
|
-
var _m = __read(useTACGenerator(tafFromBackend.taf, api$1.getTAC), 2),
|
|
3956
|
-
TAC = _m[0],
|
|
3957
|
-
updateTAC = _m[1];
|
|
3996
|
+
var _k = __read(React__default["default"].useState(getValues()), 2),
|
|
3997
|
+
delayedFormValues = _k[0],
|
|
3998
|
+
setDelayedFormValues = _k[1];
|
|
3958
3999
|
|
|
3959
4000
|
var hasErrors = Object.keys(errors).length;
|
|
3960
4001
|
|
|
3961
4002
|
var onFormBlur = function onFormBlur() {
|
|
3962
|
-
|
|
4003
|
+
if (!lodash.isEqual(getValues(), delayedFormValues)) {
|
|
4004
|
+
setDelayedFormValues(getValues());
|
|
4005
|
+
}
|
|
4006
|
+
};
|
|
4007
|
+
|
|
4008
|
+
var resetTAC = function resetTAC() {
|
|
4009
|
+
if (originalTaf.status !== 'NEW') {
|
|
4010
|
+
updateTAC(originalTaf);
|
|
4011
|
+
} else {
|
|
4012
|
+
setTAC(TAC_NOT_AVAILABLE);
|
|
4013
|
+
}
|
|
3963
4014
|
};
|
|
3964
4015
|
|
|
3965
4016
|
React__default["default"].useEffect(function () {
|
|
@@ -3978,8 +4029,8 @@
|
|
|
3978
4029
|
}, [hasErrors]); // Needed to be able to show a confirmation dialog on switching tabs when form is edited and not saved
|
|
3979
4030
|
|
|
3980
4031
|
React__default["default"].useEffect(function () {
|
|
3981
|
-
|
|
3982
|
-
}, [isFormDirty,
|
|
4032
|
+
setIsFormDirty(isFormDirty);
|
|
4033
|
+
}, [isFormDirty, setIsFormDirty]);
|
|
3983
4034
|
|
|
3984
4035
|
var onSubmit = function onSubmit(data) {
|
|
3985
4036
|
// eslint-disable-next-line no-console
|
|
@@ -4032,6 +4083,7 @@
|
|
|
4032
4083
|
if (isFormDirty) {
|
|
4033
4084
|
showConfirmDialog(action).then(function () {
|
|
4034
4085
|
resetForm(undefined, isDefaultDisabled);
|
|
4086
|
+
resetTAC();
|
|
4035
4087
|
});
|
|
4036
4088
|
} else {
|
|
4037
4089
|
resetForm(undefined, isDefaultDisabled);
|
|
@@ -4098,19 +4150,19 @@
|
|
|
4098
4150
|
}
|
|
4099
4151
|
};
|
|
4100
4152
|
|
|
4101
|
-
var
|
|
4153
|
+
var _l = reactHookForm.useFieldArray({
|
|
4102
4154
|
control: control,
|
|
4103
4155
|
name: 'changeGroups'
|
|
4104
4156
|
}),
|
|
4105
|
-
fields =
|
|
4106
|
-
insert =
|
|
4107
|
-
remove =
|
|
4108
|
-
move =
|
|
4157
|
+
fields = _l.fields,
|
|
4158
|
+
insert = _l.insert,
|
|
4159
|
+
remove = _l.remove,
|
|
4160
|
+
move = _l.move;
|
|
4109
4161
|
|
|
4110
|
-
var
|
|
4111
|
-
onChangeOrder =
|
|
4112
|
-
onStartDrag =
|
|
4113
|
-
activeDraggingIndex =
|
|
4162
|
+
var _m = useDragOrder(trigger, move, onFormBlur),
|
|
4163
|
+
onChangeOrder = _m.onChangeOrder,
|
|
4164
|
+
onStartDrag = _m.onStartDrag,
|
|
4165
|
+
activeDraggingIndex = _m.activeDraggingIndex;
|
|
4114
4166
|
|
|
4115
4167
|
var onRemoverow = function onRemoverow(index) {
|
|
4116
4168
|
confirmDialog({
|
|
@@ -4191,9 +4243,9 @@
|
|
|
4191
4243
|
});
|
|
4192
4244
|
};
|
|
4193
4245
|
|
|
4194
|
-
var
|
|
4195
|
-
shouldValidate =
|
|
4196
|
-
setShouldValidate =
|
|
4246
|
+
var _o = __read(React__default["default"].useState(false), 2),
|
|
4247
|
+
shouldValidate = _o[0],
|
|
4248
|
+
setShouldValidate = _o[1];
|
|
4197
4249
|
|
|
4198
4250
|
React__default["default"].useEffect(function () {
|
|
4199
4251
|
setIsDisabled(isDefaultDisabled);
|
|
@@ -4221,10 +4273,16 @@
|
|
|
4221
4273
|
registerValidateForm(onValidateFormPromise); // set default taf action
|
|
4222
4274
|
|
|
4223
4275
|
setTafAction(fromStatusToAction(originalTaf.status));
|
|
4276
|
+
resetTAC();
|
|
4224
4277
|
return function () {
|
|
4225
4278
|
reset({});
|
|
4226
4279
|
}; // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4227
4280
|
}, []);
|
|
4281
|
+
React__default["default"].useEffect(function () {
|
|
4282
|
+
var newValues = prepareTafValues(tafFromBackend.taf, undefined, !isDefaultDisabled && !tafFromBackend.taf.changeGroups); // set new form values when tafFromBackend changed
|
|
4283
|
+
|
|
4284
|
+
reset(newValues); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
4285
|
+
}, [tafFromBackend]);
|
|
4228
4286
|
React__default["default"].useEffect(function () {
|
|
4229
4287
|
if (shouldValidate && !isDisabled) {
|
|
4230
4288
|
// trigger validation on all changegroup validity times after initial load since they could be outside the new validity period
|
|
@@ -4516,21 +4574,6 @@
|
|
|
4516
4574
|
'aria-controls': "simple-tabpanel-" + index
|
|
4517
4575
|
};
|
|
4518
4576
|
};
|
|
4519
|
-
var emptyBaseForecast = {
|
|
4520
|
-
wind: '',
|
|
4521
|
-
visibility: '',
|
|
4522
|
-
weather: {
|
|
4523
|
-
weather1: '',
|
|
4524
|
-
weather2: '',
|
|
4525
|
-
weather3: ''
|
|
4526
|
-
},
|
|
4527
|
-
cloud: {
|
|
4528
|
-
cloud1: '',
|
|
4529
|
-
cloud2: '',
|
|
4530
|
-
cloud3: '',
|
|
4531
|
-
cloud4: ''
|
|
4532
|
-
}
|
|
4533
|
-
};
|
|
4534
4577
|
var prepareTafExportValues = function prepareTafExportValues(tafToCopy, currentTaf) {
|
|
4535
4578
|
var _a;
|
|
4536
4579
|
|
|
@@ -4539,7 +4582,7 @@
|
|
|
4539
4582
|
_b = convertedCopy.changeGroups,
|
|
4540
4583
|
changeGroups = _b === void 0 ? [] : _b;
|
|
4541
4584
|
return __assign(__assign({}, currentTaf), {
|
|
4542
|
-
baseForecast: __assign(__assign(
|
|
4585
|
+
baseForecast: __assign(__assign({}, baseForecast), {
|
|
4543
4586
|
valid: (_a = currentTaf === null || currentTaf === void 0 ? void 0 : currentTaf.baseForecast) === null || _a === void 0 ? void 0 : _a.valid
|
|
4544
4587
|
}),
|
|
4545
4588
|
changeGroups: changeGroups
|
|
@@ -4707,6 +4750,8 @@
|
|
|
4707
4750
|
trigger = _e.trigger,
|
|
4708
4751
|
setValue = _e.setValue;
|
|
4709
4752
|
|
|
4753
|
+
var updateTAC = useTafModuleContext().updateTAC;
|
|
4754
|
+
|
|
4710
4755
|
var handleExport = function handleExport() {
|
|
4711
4756
|
var currentTaf = getValues();
|
|
4712
4757
|
var newTaf = prepareTafExportValues(taf, currentTaf);
|
|
@@ -4719,6 +4764,7 @@
|
|
|
4719
4764
|
setTimeout(function () {
|
|
4720
4765
|
trigger(); // trigger all fields validation
|
|
4721
4766
|
}, 0);
|
|
4767
|
+
updateTAC(convertTafValuesToObject(newTaf));
|
|
4722
4768
|
};
|
|
4723
4769
|
|
|
4724
4770
|
React__default["default"].useEffect(function () {
|
|
@@ -5157,7 +5203,7 @@
|
|
|
5157
5203
|
} : {
|
|
5158
5204
|
type: 'SERVER',
|
|
5159
5205
|
title: 'An error has occurred while saving, please try again',
|
|
5160
|
-
message: shared.getAxiosErrorMessage(error)
|
|
5206
|
+
message: shared.isAxiosError(error) ? shared.getAxiosErrorMessage(error) : error.message
|
|
5161
5207
|
};
|
|
5162
5208
|
};
|
|
5163
5209
|
|
|
@@ -5183,6 +5229,7 @@
|
|
|
5183
5229
|
switch (_a.label) {
|
|
5184
5230
|
case 0:
|
|
5185
5231
|
setLoading(true);
|
|
5232
|
+
setError(null);
|
|
5186
5233
|
_a.label = 1;
|
|
5187
5234
|
|
|
5188
5235
|
case 1:
|
|
@@ -5241,22 +5288,18 @@
|
|
|
5241
5288
|
postTaf = _c === void 0 ? function () {
|
|
5242
5289
|
return null;
|
|
5243
5290
|
} : _c,
|
|
5244
|
-
_d = _a.
|
|
5245
|
-
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
_e = _a.isIssuesPaneOpen,
|
|
5249
|
-
isIssuesPaneOpen = _e === void 0 ? false : _e,
|
|
5250
|
-
_f = _a.setIsIssuesPaneOpen,
|
|
5251
|
-
setIsIssuesPaneOpen = _f === void 0 ? function () {
|
|
5291
|
+
_d = _a.isIssuesPaneOpen,
|
|
5292
|
+
isIssuesPaneOpen = _d === void 0 ? false : _d,
|
|
5293
|
+
_e = _a.setIsIssuesPaneOpen,
|
|
5294
|
+
setIsIssuesPaneOpen = _e === void 0 ? function () {
|
|
5252
5295
|
return null;
|
|
5253
|
-
} :
|
|
5254
|
-
|
|
5255
|
-
isFormDisabled =
|
|
5256
|
-
|
|
5257
|
-
setIsFormDisabled =
|
|
5296
|
+
} : _e,
|
|
5297
|
+
_f = _a.isFormDisabled,
|
|
5298
|
+
isFormDisabled = _f === void 0 ? false : _f,
|
|
5299
|
+
_g = _a.setIsFormDisabled,
|
|
5300
|
+
setIsFormDisabled = _g === void 0 ? function () {
|
|
5258
5301
|
return null;
|
|
5259
|
-
} :
|
|
5302
|
+
} : _g,
|
|
5260
5303
|
error = _a.error;
|
|
5261
5304
|
|
|
5262
5305
|
var onTafAction = function onTafAction(action, taf) {
|
|
@@ -5370,16 +5413,21 @@
|
|
|
5370
5413
|
severity: "error",
|
|
5371
5414
|
title: error.title,
|
|
5372
5415
|
info: error.message,
|
|
5373
|
-
dataTestId: "taf-error"
|
|
5374
|
-
|
|
5416
|
+
dataTestId: "taf-error",
|
|
5417
|
+
shouldClose: true
|
|
5418
|
+
}), /*#__PURE__*/React__default["default"].createElement(material.Box, {
|
|
5419
|
+
sx: {
|
|
5420
|
+
marginTop: '10px',
|
|
5421
|
+
padding: 1
|
|
5422
|
+
}
|
|
5423
|
+
}, /*#__PURE__*/React__default["default"].createElement(TafForm, {
|
|
5375
5424
|
tafFromBackend: tafFromBackend,
|
|
5376
5425
|
onFormAction: onTafAction,
|
|
5377
|
-
onFormDirty: onFormDirty,
|
|
5378
5426
|
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
5379
5427
|
setIsIssuesPaneOpen: setIsIssuesPaneOpen,
|
|
5380
5428
|
isDisabled: isFormDisabled,
|
|
5381
5429
|
setIsDisabled: setIsFormDisabled
|
|
5382
|
-
}));
|
|
5430
|
+
})));
|
|
5383
5431
|
};
|
|
5384
5432
|
|
|
5385
5433
|
var IssuesPaneWrapper = function IssuesPaneWrapper(props) {
|
|
@@ -5418,7 +5466,8 @@
|
|
|
5418
5466
|
|
|
5419
5467
|
var _f = useTafModuleContext(),
|
|
5420
5468
|
onValidateForm = _f.onValidateForm,
|
|
5421
|
-
tafAction = _f.tafAction
|
|
5469
|
+
tafAction = _f.tafAction,
|
|
5470
|
+
isFormDirty = _f.isFormDirty;
|
|
5422
5471
|
|
|
5423
5472
|
var _g = __read(React__default["default"].useState(sortTafTimeSlots(tafList)), 2),
|
|
5424
5473
|
_h = _g[0],
|
|
@@ -5443,12 +5492,8 @@
|
|
|
5443
5492
|
setActiveTafIndex = _m[1];
|
|
5444
5493
|
|
|
5445
5494
|
var _o = __read(React__default["default"].useState(false), 2),
|
|
5446
|
-
|
|
5447
|
-
|
|
5448
|
-
|
|
5449
|
-
var _p = __read(React__default["default"].useState(false), 2),
|
|
5450
|
-
isFormDisabled = _p[0],
|
|
5451
|
-
setIsFormDisabled = _p[1];
|
|
5495
|
+
isFormDisabled = _o[0],
|
|
5496
|
+
setIsFormDisabled = _o[1];
|
|
5452
5497
|
|
|
5453
5498
|
var postTaf = function postTaf(data) {
|
|
5454
5499
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -5511,6 +5556,7 @@
|
|
|
5511
5556
|
_a.sent();
|
|
5512
5557
|
confirmDialog(CONFIRM_DIALOG_OPTIONS).then(function () {
|
|
5513
5558
|
action(value);
|
|
5559
|
+
setError(null);
|
|
5514
5560
|
});
|
|
5515
5561
|
return [3
|
|
5516
5562
|
/*break*/
|
|
@@ -5523,6 +5569,7 @@
|
|
|
5523
5569
|
|
|
5524
5570
|
case 6:
|
|
5525
5571
|
action(value);
|
|
5572
|
+
setError(null);
|
|
5526
5573
|
_a.label = 7;
|
|
5527
5574
|
|
|
5528
5575
|
case 7:
|
|
@@ -5555,7 +5602,9 @@
|
|
|
5555
5602
|
setLocations(updatedLocations); // update active index
|
|
5556
5603
|
|
|
5557
5604
|
var newActiveIndex = updatedLocations.findIndex(function (location) {
|
|
5558
|
-
|
|
5605
|
+
var _a, _b, _c;
|
|
5606
|
+
|
|
5607
|
+
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);
|
|
5559
5608
|
});
|
|
5560
5609
|
var newIndex = newActiveIndex !== -1 ? newActiveIndex : activeTafIndex;
|
|
5561
5610
|
setActiveTafIndex(newIndex); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -5644,10 +5693,9 @@
|
|
|
5644
5693
|
}, /*#__PURE__*/React__default["default"].createElement(material.Card, {
|
|
5645
5694
|
variant: "outlined",
|
|
5646
5695
|
sx: {
|
|
5647
|
-
padding: 1,
|
|
5648
|
-
paddingTop: 0,
|
|
5649
5696
|
marginBottom: '12px',
|
|
5650
|
-
position: 'relative'
|
|
5697
|
+
position: 'relative',
|
|
5698
|
+
minHeight: locations.length * 62 + 32
|
|
5651
5699
|
}
|
|
5652
5700
|
}, /*#__PURE__*/React__default["default"].createElement(TacOverviewMobile, {
|
|
5653
5701
|
upcomingTafs: upcoming,
|
|
@@ -5660,7 +5708,6 @@
|
|
|
5660
5708
|
activeTafIndex: activeTafIndex,
|
|
5661
5709
|
index: index,
|
|
5662
5710
|
tafFromBackend: tafFromBackend,
|
|
5663
|
-
onFormDirty: setIsFormDirty,
|
|
5664
5711
|
isIssuesPaneOpen: isIssuesPaneOpen,
|
|
5665
5712
|
setIsIssuesPaneOpen: onToggleIssuesPane,
|
|
5666
5713
|
isFormDisabled: isFormDisabled,
|
|
@@ -5671,13 +5718,15 @@
|
|
|
5671
5718
|
});
|
|
5672
5719
|
}))), /*#__PURE__*/React__default["default"].createElement(material.Grid, {
|
|
5673
5720
|
item: true,
|
|
5674
|
-
xs:
|
|
5675
|
-
|
|
5676
|
-
|
|
5721
|
+
xs: 0,
|
|
5722
|
+
sm: 3,
|
|
5723
|
+
height: {
|
|
5724
|
+
xs: 0,
|
|
5725
|
+
sm: '100%'
|
|
5677
5726
|
},
|
|
5678
|
-
|
|
5679
|
-
xs:
|
|
5680
|
-
sm: '
|
|
5727
|
+
width: {
|
|
5728
|
+
xs: 0,
|
|
5729
|
+
sm: '100%'
|
|
5681
5730
|
}
|
|
5682
5731
|
}, /*#__PURE__*/React__default["default"].createElement(TacOverview, {
|
|
5683
5732
|
upcomingTafs: upcoming,
|
|
@@ -5692,26 +5741,11 @@
|
|
|
5692
5741
|
}));
|
|
5693
5742
|
};
|
|
5694
5743
|
|
|
5695
|
-
/* *
|
|
5696
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5697
|
-
* you may not use this file except in compliance with the License.
|
|
5698
|
-
* You may obtain a copy of the License at
|
|
5699
|
-
*
|
|
5700
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
5701
|
-
*
|
|
5702
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
5703
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
5704
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
5705
|
-
* See the License for the specific language governing permissions and
|
|
5706
|
-
* limitations under the License.
|
|
5707
|
-
*
|
|
5708
|
-
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
5709
|
-
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
5710
|
-
* */
|
|
5711
|
-
|
|
5712
5744
|
var TafWrapper = function TafWrapper(_a) {
|
|
5713
|
-
var children = _a.children
|
|
5714
|
-
|
|
5745
|
+
var children = _a.children,
|
|
5746
|
+
props = __rest(_a, ["children"]);
|
|
5747
|
+
|
|
5748
|
+
return /*#__PURE__*/React__namespace.createElement(TafModuleProvider, __assign({}, props), /*#__PURE__*/React__namespace.createElement(shared.ConfirmationServiceProvider, null, /*#__PURE__*/React__namespace.createElement(formFields.ReactHookFormProvider, {
|
|
5715
5749
|
options: {
|
|
5716
5750
|
mode: 'onTouched',
|
|
5717
5751
|
reValidateMode: 'onChange',
|
|
@@ -5723,65 +5757,21 @@
|
|
|
5723
5757
|
var TafModule = function TafModule() {
|
|
5724
5758
|
var api$1 = api.useApiContext().api;
|
|
5725
5759
|
|
|
5726
|
-
var _a =
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
getTafListError = _b.error,
|
|
5732
|
-
isFetchingInitial = _b.isLoading,
|
|
5733
|
-
tafList = _b.result,
|
|
5734
|
-
fetchNewTafList = _b.fetchApiData;
|
|
5760
|
+
var _a = api.useApi(api$1.getTafList),
|
|
5761
|
+
getTafListError = _a.error,
|
|
5762
|
+
isLoading = _a.isLoading,
|
|
5763
|
+
tafList = _a.result,
|
|
5764
|
+
fetchNewTafList = _a.fetchApiData;
|
|
5735
5765
|
|
|
5736
5766
|
shared.usePoller([tafList, getTafListError], function () {
|
|
5737
5767
|
return fetchNewTafList({});
|
|
5738
5768
|
});
|
|
5739
5769
|
|
|
5740
|
-
var
|
|
5741
|
-
|
|
5742
|
-
return __generator(this, function (_a) {
|
|
5743
|
-
switch (_a.label) {
|
|
5744
|
-
case 0:
|
|
5745
|
-
_a.trys.push([0, 2,, 3]);
|
|
5746
|
-
|
|
5747
|
-
setLoading(true);
|
|
5748
|
-
return [4
|
|
5749
|
-
/*yield*/
|
|
5750
|
-
, fetchNewTafList({})];
|
|
5751
|
-
|
|
5752
|
-
case 1:
|
|
5753
|
-
_a.sent();
|
|
5754
|
-
|
|
5755
|
-
setLoading(false);
|
|
5756
|
-
return [3
|
|
5757
|
-
/*break*/
|
|
5758
|
-
, 3];
|
|
5759
|
-
|
|
5760
|
-
case 2:
|
|
5761
|
-
_a.sent();
|
|
5762
|
-
setLoading(false);
|
|
5763
|
-
return [3
|
|
5764
|
-
/*break*/
|
|
5765
|
-
, 3];
|
|
5766
|
-
|
|
5767
|
-
case 3:
|
|
5768
|
-
return [2
|
|
5769
|
-
/*return*/
|
|
5770
|
-
];
|
|
5771
|
-
}
|
|
5772
|
-
});
|
|
5773
|
-
});
|
|
5770
|
+
var onPostTaf = function onPostTaf() {
|
|
5771
|
+
fetchNewTafList({});
|
|
5774
5772
|
};
|
|
5775
5773
|
|
|
5776
5774
|
var hasTafListError = getTafListError !== null;
|
|
5777
|
-
|
|
5778
|
-
if (isFetchingInitial) {
|
|
5779
|
-
return /*#__PURE__*/React__namespace.createElement(LinearProgress__default["default"], {
|
|
5780
|
-
color: "secondary",
|
|
5781
|
-
"data-testid": "loading-bar"
|
|
5782
|
-
});
|
|
5783
|
-
}
|
|
5784
|
-
|
|
5785
5775
|
return /*#__PURE__*/React__namespace.createElement(material.Box, {
|
|
5786
5776
|
component: "div",
|
|
5787
5777
|
id: "tafmodule",
|
|
@@ -5797,15 +5787,20 @@
|
|
|
5797
5787
|
}), hasTafListError && /*#__PURE__*/React__namespace.createElement(shared.AlertBanner, {
|
|
5798
5788
|
severity: "error",
|
|
5799
5789
|
title: "An error has occurred while retrieving the list",
|
|
5800
|
-
info: getTafListError.message
|
|
5790
|
+
info: getTafListError.message,
|
|
5791
|
+
dataTestId: "taf-list-error",
|
|
5792
|
+
actionButtonProps: {
|
|
5793
|
+
title: 'Try again',
|
|
5794
|
+
onClick: fetchNewTafList
|
|
5795
|
+
}
|
|
5801
5796
|
}), /*#__PURE__*/React__namespace.createElement(TafLayout, {
|
|
5802
5797
|
tafList: tafList,
|
|
5803
|
-
onPostTaf:
|
|
5798
|
+
onPostTaf: onPostTaf
|
|
5804
5799
|
}));
|
|
5805
5800
|
};
|
|
5806
5801
|
|
|
5807
|
-
var Wrapper = function Wrapper() {
|
|
5808
|
-
return /*#__PURE__*/React__namespace.createElement(TafWrapper,
|
|
5802
|
+
var Wrapper = function Wrapper(props) {
|
|
5803
|
+
return /*#__PURE__*/React__namespace.createElement(TafWrapper, __assign({}, props), /*#__PURE__*/React__namespace.createElement(TafModule, null));
|
|
5809
5804
|
};
|
|
5810
5805
|
|
|
5811
5806
|
var createApi$1 = function createApi(url, appUrl, auth, setAuth, authTokenUrl, authClientId) {
|
|
@@ -5818,8 +5813,10 @@
|
|
|
5818
5813
|
postTaf: function postTaf(formData) {
|
|
5819
5814
|
return axiosInstance.post('/taf', __assign({}, formData));
|
|
5820
5815
|
},
|
|
5821
|
-
getTAC: function getTAC(tafData) {
|
|
5822
|
-
return axiosInstance.post('/taf2tac', __assign({}, tafData)
|
|
5816
|
+
getTAC: function getTAC(tafData, signal) {
|
|
5817
|
+
return axiosInstance.post.apply(axiosInstance, __spreadArray(['/taf2tac'], __read(__spreadArray([__assign({}, tafData)], __read(signal ? [{
|
|
5818
|
+
signal: signal
|
|
5819
|
+
}] : [])))));
|
|
5823
5820
|
}
|
|
5824
5821
|
};
|
|
5825
5822
|
};
|
|
@@ -6739,13 +6736,21 @@
|
|
|
6739
6736
|
|
|
6740
6737
|
var fakeTafTac = 'TAF EHAM 0812/0918 20020G35KT 0500 SN BKN040\nBECMG 0814/0816 0700 BKN001=';
|
|
6741
6738
|
|
|
6742
|
-
var fakePromise = function fakePromise(withRandomError) {
|
|
6739
|
+
var fakePromise = function fakePromise(withRandomError, signal) {
|
|
6740
|
+
if (signal === void 0) {
|
|
6741
|
+
signal = null;
|
|
6742
|
+
}
|
|
6743
|
+
|
|
6743
6744
|
return new Promise(function (resolve, reject) {
|
|
6744
|
-
setTimeout(function () {
|
|
6745
|
+
var timer = setTimeout(function () {
|
|
6745
6746
|
if (!withRandomError) return resolve();
|
|
6746
6747
|
var randomError = Math.floor(Math.random() * 4) + 1;
|
|
6747
6748
|
return randomError === 4 ? reject(new Error('something went wrong')) : resolve();
|
|
6748
6749
|
}, 300);
|
|
6750
|
+
signal === null || signal === void 0 ? void 0 : signal.signal.addEventListener('abort', function () {
|
|
6751
|
+
clearTimeout(timer);
|
|
6752
|
+
reject(new Error('canceled'));
|
|
6753
|
+
});
|
|
6749
6754
|
});
|
|
6750
6755
|
};
|
|
6751
6756
|
|
|
@@ -6755,8 +6760,8 @@
|
|
|
6755
6760
|
return fakePromise(false);
|
|
6756
6761
|
},
|
|
6757
6762
|
// eslint-disable-next-line no-unused-vars, @typescript-eslint/no-unused-vars, @typescript-eslint/explicit-module-boundary-types
|
|
6758
|
-
post: function post(_url, _params) {
|
|
6759
|
-
return fakePromise(false);
|
|
6763
|
+
post: function post(_url, _params, _signal) {
|
|
6764
|
+
return fakePromise(false, _signal);
|
|
6760
6765
|
}
|
|
6761
6766
|
};
|
|
6762
6767
|
var createApi = function createApi() {
|
|
@@ -6770,28 +6775,119 @@
|
|
|
6770
6775
|
};
|
|
6771
6776
|
});
|
|
6772
6777
|
},
|
|
6773
|
-
getTAC: function getTAC() {
|
|
6774
|
-
// eslint-disable-next-line no-console
|
|
6775
|
-
return fakeAxiosInstance.post('/taf2tac').then(function () {
|
|
6776
|
-
return {
|
|
6777
|
-
data: fakeTafTac
|
|
6778
|
-
};
|
|
6779
|
-
});
|
|
6780
|
-
},
|
|
6781
6778
|
postTaf: function postTaf(_postTaf) {
|
|
6782
6779
|
// eslint-disable-next-line no-console
|
|
6783
6780
|
console.log("The new status of the taf will be " + _postTaf.changeStatusTo); // eslint-disable-next-line no-console
|
|
6784
6781
|
|
|
6785
6782
|
console.log('form has been posted with following values:', _postTaf.taf);
|
|
6786
6783
|
return fakeAxiosInstance.post('/taf', _postTaf);
|
|
6784
|
+
},
|
|
6785
|
+
getTAC: function getTAC(tafData, signal) {
|
|
6786
|
+
return fakeAxiosInstance.post.apply(fakeAxiosInstance, __spreadArray(['/taf2tac'], __read(__spreadArray([__assign({}, tafData)], __read(signal ? [{
|
|
6787
|
+
signal: signal
|
|
6788
|
+
}] : []))))).then(function () {
|
|
6789
|
+
return {
|
|
6790
|
+
data: fakeTafTac
|
|
6791
|
+
};
|
|
6792
|
+
});
|
|
6787
6793
|
}
|
|
6788
6794
|
};
|
|
6789
6795
|
};
|
|
6790
6796
|
|
|
6797
|
+
/* *
|
|
6798
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6799
|
+
* you may not use this file except in compliance with the License.
|
|
6800
|
+
* You may obtain a copy of the License at
|
|
6801
|
+
*
|
|
6802
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
6803
|
+
*
|
|
6804
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
6805
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
6806
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
6807
|
+
* See the License for the specific language governing permissions and
|
|
6808
|
+
* limitations under the License.
|
|
6809
|
+
*
|
|
6810
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
6811
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
6812
|
+
* */
|
|
6813
|
+
var tafScreenPreset = {
|
|
6814
|
+
id: 'screenConfigTaf',
|
|
6815
|
+
title: 'TAF',
|
|
6816
|
+
views: {
|
|
6817
|
+
byId: {
|
|
6818
|
+
taf: {
|
|
6819
|
+
title: 'TAF',
|
|
6820
|
+
componentType: 'TafModule',
|
|
6821
|
+
initialProps: {}
|
|
6822
|
+
}
|
|
6823
|
+
},
|
|
6824
|
+
allIds: ['taf']
|
|
6825
|
+
},
|
|
6826
|
+
syncGroups: [],
|
|
6827
|
+
mosaicNode: 'taf'
|
|
6828
|
+
};
|
|
6829
|
+
var TafApiWrapper = function TafApiWrapper(_a) {
|
|
6830
|
+
var config = _a.config,
|
|
6831
|
+
auth = _a.auth,
|
|
6832
|
+
onSetAuth = _a.onSetAuth,
|
|
6833
|
+
onPreventCloseView = _a.onPreventCloseView;
|
|
6834
|
+
return config ? /*#__PURE__*/React__namespace.createElement(api.ApiProvider, {
|
|
6835
|
+
baseURL: config.baseUrl,
|
|
6836
|
+
appURL: config.appUrl,
|
|
6837
|
+
auth: auth,
|
|
6838
|
+
onSetAuth: onSetAuth,
|
|
6839
|
+
createApi: createApi$1,
|
|
6840
|
+
authTokenUrl: config.authTokenUrl,
|
|
6841
|
+
authClientId: config.authClientId
|
|
6842
|
+
}, /*#__PURE__*/React__namespace.createElement(shared.ErrorBoundary, null, /*#__PURE__*/React__namespace.createElement(Wrapper, {
|
|
6843
|
+
onPreventCloseView: onPreventCloseView
|
|
6844
|
+
}))) : null;
|
|
6845
|
+
};
|
|
6846
|
+
var componentsLookUp = function componentsLookUp(payload, _a, // TODO: find a good way to type this module without the apps complaining
|
|
6847
|
+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
6848
|
+
ConnectedModuleWrapper) {
|
|
6849
|
+
var config = _a.config,
|
|
6850
|
+
auth = _a.auth,
|
|
6851
|
+
onSetAuth = _a.onSetAuth;
|
|
6852
|
+
|
|
6853
|
+
if (ConnectedModuleWrapper === void 0) {
|
|
6854
|
+
ConnectedModuleWrapper = null;
|
|
6855
|
+
}
|
|
6856
|
+
|
|
6857
|
+
var componentType = payload.componentType;
|
|
6858
|
+
|
|
6859
|
+
switch (componentType) {
|
|
6860
|
+
case 'TafModule':
|
|
6861
|
+
if (ConnectedModuleWrapper) {
|
|
6862
|
+
return /*#__PURE__*/React__namespace.createElement(ConnectedModuleWrapper, {
|
|
6863
|
+
component: TafApiWrapper,
|
|
6864
|
+
payload: payload,
|
|
6865
|
+
"data-testid": "tafmodule",
|
|
6866
|
+
config: config,
|
|
6867
|
+
auth: auth,
|
|
6868
|
+
onSetAuth: onSetAuth
|
|
6869
|
+
});
|
|
6870
|
+
}
|
|
6871
|
+
|
|
6872
|
+
return /*#__PURE__*/React__namespace.createElement(TafApiWrapper, {
|
|
6873
|
+
"data-testid": "tafmodule",
|
|
6874
|
+
config: config,
|
|
6875
|
+
auth: auth,
|
|
6876
|
+
onSetAuth: onSetAuth
|
|
6877
|
+
});
|
|
6878
|
+
|
|
6879
|
+
default:
|
|
6880
|
+
return null;
|
|
6881
|
+
}
|
|
6882
|
+
};
|
|
6883
|
+
|
|
6884
|
+
exports.TafApiWrapper = TafApiWrapper;
|
|
6791
6885
|
exports.TafForm = TafForm;
|
|
6792
6886
|
exports.TafModule = Wrapper;
|
|
6887
|
+
exports.componentsLookUp = componentsLookUp;
|
|
6793
6888
|
exports.createApi = createApi$1;
|
|
6794
6889
|
exports.createFakeApi = createApi;
|
|
6890
|
+
exports.tafScreenPreset = tafScreenPreset;
|
|
6795
6891
|
|
|
6796
6892
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
6797
6893
|
|