@opengeoweb/sigmet-airmet 14.0.1 → 14.1.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.esm.js +480 -486
- package/package.json +12 -11
- package/src/index.d.ts +1 -2
- package/src/lib/api/api.d.ts +17 -0
- package/src/lib/api/hooks.d.ts +16 -0
- package/src/lib/api/testApi.d.ts +20 -0
- package/src/lib/components/ConfigurationDemo/ConfigrationDemo.stories.d.ts +40 -5
- package/src/lib/components/MetInfoWrapper/MetInfoWrapper.d.ts +0 -2
- package/src/lib/components/ProductForms/AirmetForm/AirmetForm.d.ts +1 -1
- package/src/lib/components/ProductForms/AirmetForm/AirmetForm.stories.d.ts +5 -0
- package/src/lib/components/ProductForms/SigmetForm/SigmetForm.d.ts +1 -1
- package/src/lib/components/ProductForms/SigmetForm/SigmetForm.stories.d.ts +5 -0
- package/src/lib/components/ProductForms/utils.d.ts +0 -2
- package/src/lib/components/Providers/Providers.d.ts +2 -2
- package/src/lib/utils/mockdata/index.d.ts +3 -0
- package/src/lib/utils/testUtils.d.ts +0 -1
- package/src/lib/components/ProductForms/ProductFormFields/DegreesMinutesField.d.ts +0 -11
- package/src/lib/utils/api.d.ts +0 -25
- package/src/lib/utils/api.spec.d.ts +0 -1
- package/src/lib/utils/fakeApi.d.ts +0 -7
- package/src/lib/utils/fakeApi.spec.d.ts +0 -1
- /package/src/lib/{components/ProductForms/ProductFormFields/DegreesMinutesField.spec.d.ts → api/hooks.spec.d.ts} +0 -0
package/index.esm.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
-
import {
|
|
3
|
-
import { PROJECTION, useIsMounted, dateUtils, CustomTooltip, usePrevious, ConfirmationServiceProvider, usePreventBrowserClose, useConfirmationDialog, CustomDialog, AlertBanner, isAxiosError, getAxiosErrorMessage, StatusTag, usePoller, ErrorBoundary } from '@opengeoweb/shared';
|
|
2
|
+
import { sessionStorageProvider, PROJECTION, useIsMounted, dateUtils, usePreventBrowserClose, CustomTooltip, usePrevious, ConfirmationServiceProvider, useConfirmationDialog, CustomDialog, AlertBanner, StatusTag, usePoller, ErrorBoundary } from '@opengeoweb/shared';
|
|
4
3
|
import { Box as Box$1 } from '@mui/system';
|
|
5
4
|
import * as React from 'react';
|
|
6
|
-
import React__default, {
|
|
7
|
-
import { FormControlLabel, Radio, Grid, Typography, Box, Checkbox, MenuItem, FormHelperText,
|
|
8
|
-
import { useFormContext
|
|
9
|
-
import { FORM_FIELDS_NAMESPACE, useDraftFormHelpers, ReactHookFormRadioGroup, hasValidGeometry, ReactHookFormSelect, ReactHookFormNumberField, isInteger, isValidMin, isValidMax, isEmpty, ReactHookFormDateTime, countIntersectionPoints, hasMulitpleIntersections, ReactHookFormHiddenInput, hasIntersectionWithFIR, isValidGeoJsonCoordinates, isMaximumOneDrawing, isXHoursBefore, isXHoursAfter, ReactHookFormTextField, isLatitude, isNonOrBothCoordinates, isLongitude, ReactHookFormFormControl, isGeometryDirty, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
|
|
5
|
+
import React__default, { useRef, useEffect, useCallback } from 'react';
|
|
6
|
+
import { FormControlLabel, Radio, Grid, Typography, Box, Checkbox, MenuItem, FormHelperText, useTheme, Backdrop, CircularProgress, Card, Button, LinearProgress, List, ListItemButton } from '@mui/material';
|
|
7
|
+
import { useFormContext } from 'react-hook-form';
|
|
8
|
+
import { FORM_FIELDS_NAMESPACE, useDraftFormHelpers, ReactHookFormRadioGroup, hasValidGeometry, ReactHookFormSelect, ReactHookFormNumberField, isInteger, isValidMin, isValidMax, isEmpty, ReactHookFormDateTime, countIntersectionPoints, hasMulitpleIntersections, ReactHookFormHiddenInput, hasIntersectionWithFIR, isValidGeoJsonCoordinates, isMaximumOneDrawing, isXHoursBefore, isXHoursAfter, ReactHookFormTextField, DegreesMinutesField, isLatitude, isNonOrBothCoordinates, isLongitude, ReactHookFormFormControl, isGeometryDirty, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
|
|
9
|
+
import { useSelector, useDispatch, shallowEqual } from 'react-redux';
|
|
10
|
+
import { uiSelectors, useUpdateSharedData, mapSelectors, syncGroupsActions, layerActions, mapActions, defaultLayers, syncConstants, uiActions, uiTypes, genericSelectors, drawingToolActions } from '@opengeoweb/store';
|
|
10
11
|
import { defaultIntersectionStyleProperties, defaultGeoJSONStyleProperties, addSelectionTypeToGeoJSON, DRAWMODE, defaultPoint, addGeoJSONProperties, defaultBox, defaultPolygon, defaultDelete, getIcon, addFeatureProperties, OpenLayersFeatureLayer, genericOpenLayersFeatureStyle, OpenLayersMapDraw, useMapDrawTool, rewindGeometry } from '@opengeoweb/webmap-react';
|
|
12
|
+
import { getHeaders, handleResponse, useAuthQuery, useAuthenticationContext } from '@opengeoweb/api';
|
|
13
|
+
import { useQueryClient, useMutation } from '@tanstack/react-query';
|
|
11
14
|
import i18n from 'i18next';
|
|
12
15
|
import { useTranslation } from 'react-i18next';
|
|
13
16
|
import { LegendConnect, OlMapViewConnect, TimeSliderConnect } from '@opengeoweb/core';
|
|
14
|
-
import { uiSelectors, useUpdateSharedData, mapSelectors, syncGroupsActions, layerActions, mapActions, defaultLayers, syncConstants, uiActions, uiTypes, genericSelectors, drawingToolActions } from '@opengeoweb/store';
|
|
15
17
|
import { DrawFIRLand, Edit, Success, Clock } from '@opengeoweb/theme';
|
|
16
18
|
import { LayerType, webmapUtils } from '@opengeoweb/webmap';
|
|
17
|
-
import { useSelector, useDispatch, shallowEqual } from 'react-redux';
|
|
18
19
|
import { debounce } from 'lodash';
|
|
19
|
-
import { useAuthenticationContext } from '@opengeoweb/authentication';
|
|
20
|
+
import { useAuthenticationContext as useAuthenticationContext$1 } from '@opengeoweb/authentication';
|
|
20
21
|
|
|
21
22
|
var en = {
|
|
22
23
|
"sigmet-airmet": "sigmet",
|
|
@@ -529,56 +530,6 @@ var sigmetAirmetTranslations = {
|
|
|
529
530
|
nl: nl
|
|
530
531
|
};
|
|
531
532
|
|
|
532
|
-
/* *
|
|
533
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
534
|
-
* you may not use this file except in compliance with the License.
|
|
535
|
-
* You may obtain a copy of the License at
|
|
536
|
-
*
|
|
537
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
538
|
-
*
|
|
539
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
540
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
541
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
542
|
-
* See the License for the specific language governing permissions and
|
|
543
|
-
* limitations under the License.
|
|
544
|
-
*
|
|
545
|
-
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
546
|
-
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
547
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
548
|
-
* */
|
|
549
|
-
var getApiRoutes$1 = function getApiRoutes(axiosInstance) {
|
|
550
|
-
return {
|
|
551
|
-
getSigmetConfiguration: function getSigmetConfiguration() {
|
|
552
|
-
return axiosInstance.get('/sigmet-config');
|
|
553
|
-
},
|
|
554
|
-
getSigmetList: function getSigmetList() {
|
|
555
|
-
return axiosInstance.get('/sigmetlist');
|
|
556
|
-
},
|
|
557
|
-
postSigmet: function postSigmet(formData) {
|
|
558
|
-
return axiosInstance.post('/sigmet', Object.assign({}, formData));
|
|
559
|
-
},
|
|
560
|
-
getSigmetTAC: function getSigmetTAC(sigmetData) {
|
|
561
|
-
return axiosInstance.post('/sigmet2tac', Object.assign({}, sigmetData));
|
|
562
|
-
},
|
|
563
|
-
getAirmetConfiguration: function getAirmetConfiguration() {
|
|
564
|
-
return axiosInstance.get('/airmet-config');
|
|
565
|
-
},
|
|
566
|
-
getAirmetList: function getAirmetList() {
|
|
567
|
-
return axiosInstance.get('/airmetlist');
|
|
568
|
-
},
|
|
569
|
-
postAirmet: function postAirmet(formData) {
|
|
570
|
-
return axiosInstance.post('/airmet', Object.assign({}, formData));
|
|
571
|
-
},
|
|
572
|
-
getAirmetTAC: function getAirmetTAC(sigmetData) {
|
|
573
|
-
return axiosInstance.post('/airmet2tac', Object.assign({}, sigmetData));
|
|
574
|
-
}
|
|
575
|
-
};
|
|
576
|
-
};
|
|
577
|
-
var createApi$1 = function createApi(props) {
|
|
578
|
-
var axiosInstance = createApiInstance(props);
|
|
579
|
-
return getApiRoutes$1(axiosInstance);
|
|
580
|
-
};
|
|
581
|
-
|
|
582
533
|
/**
|
|
583
534
|
* The possible type for the airmet
|
|
584
535
|
*/
|
|
@@ -990,6 +941,289 @@ function _regeneratorRuntime() {
|
|
|
990
941
|
})();
|
|
991
942
|
}
|
|
992
943
|
|
|
944
|
+
/* *
|
|
945
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
946
|
+
* you may not use this file except in compliance with the License.
|
|
947
|
+
* You may obtain a copy of the License at
|
|
948
|
+
*
|
|
949
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
950
|
+
*
|
|
951
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
952
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
953
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
954
|
+
* See the License for the specific language governing permissions and
|
|
955
|
+
* limitations under the License.
|
|
956
|
+
*
|
|
957
|
+
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
958
|
+
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
959
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
960
|
+
* */
|
|
961
|
+
var SA_NAMESPACE = 'sigmetairmet';
|
|
962
|
+
var ns = [SA_NAMESPACE, FORM_FIELDS_NAMESPACE];
|
|
963
|
+
var translateKeyOutsideComponents = function translateKeyOutsideComponents(key, params) {
|
|
964
|
+
if (params === void 0) {
|
|
965
|
+
params = undefined;
|
|
966
|
+
}
|
|
967
|
+
return i18n.t(key, Object.assign({
|
|
968
|
+
ns: ns
|
|
969
|
+
}, params));
|
|
970
|
+
};
|
|
971
|
+
var useSigmetAirmetTranslation = function useSigmetAirmetTranslation() {
|
|
972
|
+
return useTranslation(ns);
|
|
973
|
+
};
|
|
974
|
+
|
|
975
|
+
var config = sessionStorageProvider.getConfig();
|
|
976
|
+
var airmetBaseUrl = config.GW_AIRMET_BASE_URL || '';
|
|
977
|
+
var sigmetBaseUrl = config.GW_SIGMET_BASE_URL || '';
|
|
978
|
+
var safeFetch = /*#__PURE__*/function () {
|
|
979
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, options, timeoutMs) {
|
|
980
|
+
var controller, timeout, response, newError;
|
|
981
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
982
|
+
while (1) switch (_context.prev = _context.next) {
|
|
983
|
+
case 0:
|
|
984
|
+
if (timeoutMs === void 0) {
|
|
985
|
+
timeoutMs = 5000;
|
|
986
|
+
}
|
|
987
|
+
controller = new AbortController();
|
|
988
|
+
timeout = setTimeout(function () {
|
|
989
|
+
return controller.abort();
|
|
990
|
+
}, timeoutMs);
|
|
991
|
+
_context.prev = 3;
|
|
992
|
+
_context.next = 6;
|
|
993
|
+
return fetch(url, Object.assign({}, options, {
|
|
994
|
+
signal: controller.signal
|
|
995
|
+
}));
|
|
996
|
+
case 6:
|
|
997
|
+
response = _context.sent;
|
|
998
|
+
_context.next = 9;
|
|
999
|
+
return handleResponse(response);
|
|
1000
|
+
case 9:
|
|
1001
|
+
return _context.abrupt("return", _context.sent);
|
|
1002
|
+
case 12:
|
|
1003
|
+
_context.prev = 12;
|
|
1004
|
+
_context.t0 = _context["catch"](3);
|
|
1005
|
+
newError = Object.assign({}, _context.t0, {
|
|
1006
|
+
name: translateKeyOutsideComponents('error-backend')
|
|
1007
|
+
});
|
|
1008
|
+
throw newError;
|
|
1009
|
+
case 16:
|
|
1010
|
+
_context.prev = 16;
|
|
1011
|
+
clearTimeout(timeout);
|
|
1012
|
+
return _context.finish(16);
|
|
1013
|
+
case 19:
|
|
1014
|
+
case "end":
|
|
1015
|
+
return _context.stop();
|
|
1016
|
+
}
|
|
1017
|
+
}, _callee, null, [[3, 12, 16, 19]]);
|
|
1018
|
+
}));
|
|
1019
|
+
return function safeFetch(_x, _x2, _x3) {
|
|
1020
|
+
return _ref.apply(this, arguments);
|
|
1021
|
+
};
|
|
1022
|
+
}();
|
|
1023
|
+
// API
|
|
1024
|
+
var getAirmetList = function getAirmetList(auth) {
|
|
1025
|
+
return safeFetch(airmetBaseUrl + "/airmetlist", {
|
|
1026
|
+
headers: getHeaders(auth)
|
|
1027
|
+
});
|
|
1028
|
+
};
|
|
1029
|
+
var getSigmetList = function getSigmetList(auth) {
|
|
1030
|
+
return safeFetch(sigmetBaseUrl + "/sigmetlist", {
|
|
1031
|
+
headers: getHeaders(auth)
|
|
1032
|
+
});
|
|
1033
|
+
};
|
|
1034
|
+
var getAirmetConfig = function getAirmetConfig(auth) {
|
|
1035
|
+
return fetch(airmetBaseUrl + "/airmet-config", {
|
|
1036
|
+
headers: getHeaders(auth)
|
|
1037
|
+
}).then(function (result) {
|
|
1038
|
+
return result.json();
|
|
1039
|
+
});
|
|
1040
|
+
};
|
|
1041
|
+
var getSigmetConfig = function getSigmetConfig(auth) {
|
|
1042
|
+
return fetch(sigmetBaseUrl + "/sigmet-config", {
|
|
1043
|
+
headers: getHeaders(auth)
|
|
1044
|
+
}).then(function (result) {
|
|
1045
|
+
return result.json();
|
|
1046
|
+
});
|
|
1047
|
+
};
|
|
1048
|
+
var postTAC = /*#__PURE__*/function () {
|
|
1049
|
+
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(url, auth, product) {
|
|
1050
|
+
var result, textData;
|
|
1051
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1052
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1053
|
+
case 0:
|
|
1054
|
+
_context2.next = 2;
|
|
1055
|
+
return fetch(url, {
|
|
1056
|
+
method: 'POST',
|
|
1057
|
+
body: JSON.stringify(product),
|
|
1058
|
+
headers: getHeaders(auth)
|
|
1059
|
+
});
|
|
1060
|
+
case 2:
|
|
1061
|
+
result = _context2.sent;
|
|
1062
|
+
if (result.ok) {
|
|
1063
|
+
_context2.next = 5;
|
|
1064
|
+
break;
|
|
1065
|
+
}
|
|
1066
|
+
throw new Error("Failed to fetch TAC data: " + result.statusText);
|
|
1067
|
+
case 5:
|
|
1068
|
+
_context2.next = 7;
|
|
1069
|
+
return result.text();
|
|
1070
|
+
case 7:
|
|
1071
|
+
textData = _context2.sent;
|
|
1072
|
+
return _context2.abrupt("return", {
|
|
1073
|
+
data: textData
|
|
1074
|
+
});
|
|
1075
|
+
case 9:
|
|
1076
|
+
case "end":
|
|
1077
|
+
return _context2.stop();
|
|
1078
|
+
}
|
|
1079
|
+
}, _callee2);
|
|
1080
|
+
}));
|
|
1081
|
+
return function postTAC(_x4, _x5, _x6) {
|
|
1082
|
+
return _ref2.apply(this, arguments);
|
|
1083
|
+
};
|
|
1084
|
+
}();
|
|
1085
|
+
var getSigmetTAC = function getSigmetTAC(auth, product) {
|
|
1086
|
+
return postTAC(sigmetBaseUrl + "/sigmet2tac", auth, product);
|
|
1087
|
+
};
|
|
1088
|
+
var getAirmetTAC = function getAirmetTAC(auth, product) {
|
|
1089
|
+
return postTAC(airmetBaseUrl + "/airmet2tac", auth, product);
|
|
1090
|
+
};
|
|
1091
|
+
var postSigmet = function postSigmet(auth, data) {
|
|
1092
|
+
return fetch(sigmetBaseUrl + "/sigmet", {
|
|
1093
|
+
headers: getHeaders(auth),
|
|
1094
|
+
method: 'POST',
|
|
1095
|
+
body: JSON.stringify(data)
|
|
1096
|
+
}).then(handleResponse);
|
|
1097
|
+
};
|
|
1098
|
+
var postAirmet = function postAirmet(auth, data) {
|
|
1099
|
+
return fetch(airmetBaseUrl + "/airmet", {
|
|
1100
|
+
headers: getHeaders(auth),
|
|
1101
|
+
method: 'POST',
|
|
1102
|
+
body: JSON.stringify(data)
|
|
1103
|
+
}).then(handleResponse);
|
|
1104
|
+
};
|
|
1105
|
+
|
|
1106
|
+
var useAirmetList = function useAirmetList(disabled) {
|
|
1107
|
+
if (disabled === void 0) {
|
|
1108
|
+
disabled = false;
|
|
1109
|
+
}
|
|
1110
|
+
return useAuthQuery(['airmet-list'], getAirmetList, disabled, false);
|
|
1111
|
+
};
|
|
1112
|
+
var useSigmetList = function useSigmetList(disabled) {
|
|
1113
|
+
if (disabled === void 0) {
|
|
1114
|
+
disabled = false;
|
|
1115
|
+
}
|
|
1116
|
+
return useAuthQuery(['sigmet-list'], getSigmetList, disabled, false);
|
|
1117
|
+
};
|
|
1118
|
+
var useProductConfig = function useProductConfig(productType) {
|
|
1119
|
+
var airmetQuery = useAuthQuery(['airmet-config'], getAirmetConfig, productType !== 'airmet');
|
|
1120
|
+
var sigmetQuery = useAuthQuery(['sigmet-config'], getSigmetConfig, productType !== 'sigmet');
|
|
1121
|
+
return productType === 'airmet' ? airmetQuery : sigmetQuery;
|
|
1122
|
+
};
|
|
1123
|
+
var useTACApi = function useTACApi() {
|
|
1124
|
+
var _useAuthenticationCon = useAuthenticationContext(),
|
|
1125
|
+
auth = _useAuthenticationCon.auth;
|
|
1126
|
+
var queryClient = useQueryClient();
|
|
1127
|
+
var fetchSigmetTAC = function fetchSigmetTAC(product) {
|
|
1128
|
+
return queryClient.fetchQuery({
|
|
1129
|
+
queryKey: ['sigmet-tac', product],
|
|
1130
|
+
queryFn: function queryFn() {
|
|
1131
|
+
return getSigmetTAC(auth, product);
|
|
1132
|
+
},
|
|
1133
|
+
staleTime: 1000 * 15
|
|
1134
|
+
});
|
|
1135
|
+
};
|
|
1136
|
+
var fetchAirmetTAC = function fetchAirmetTAC(product) {
|
|
1137
|
+
return queryClient.fetchQuery({
|
|
1138
|
+
queryKey: ['airmet-tac', product],
|
|
1139
|
+
queryFn: function queryFn() {
|
|
1140
|
+
return getAirmetTAC(auth, product);
|
|
1141
|
+
},
|
|
1142
|
+
staleTime: 1000 * 15
|
|
1143
|
+
});
|
|
1144
|
+
};
|
|
1145
|
+
return {
|
|
1146
|
+
fetchSigmetTAC: fetchSigmetTAC,
|
|
1147
|
+
fetchAirmetTAC: fetchAirmetTAC
|
|
1148
|
+
};
|
|
1149
|
+
};
|
|
1150
|
+
var usePostSigmet = function usePostSigmet() {
|
|
1151
|
+
var _useAuthenticationCon2 = useAuthenticationContext(),
|
|
1152
|
+
auth = _useAuthenticationCon2.auth;
|
|
1153
|
+
var queryClient = useQueryClient();
|
|
1154
|
+
return useMutation({
|
|
1155
|
+
mutationFn: function mutationFn(formData) {
|
|
1156
|
+
if (!auth) {
|
|
1157
|
+
throw new Error('Authentication context not found');
|
|
1158
|
+
}
|
|
1159
|
+
return postSigmet(auth, formData);
|
|
1160
|
+
},
|
|
1161
|
+
onError: function onError() {
|
|
1162
|
+
void queryClient.invalidateQueries({
|
|
1163
|
+
queryKey: ['sigmet']
|
|
1164
|
+
});
|
|
1165
|
+
},
|
|
1166
|
+
onSuccess: function () {
|
|
1167
|
+
var _onSuccess = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
1168
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
1169
|
+
while (1) switch (_context.prev = _context.next) {
|
|
1170
|
+
case 0:
|
|
1171
|
+
_context.next = 2;
|
|
1172
|
+
return queryClient.invalidateQueries({
|
|
1173
|
+
queryKey: ['sigmet-list']
|
|
1174
|
+
});
|
|
1175
|
+
case 2:
|
|
1176
|
+
case "end":
|
|
1177
|
+
return _context.stop();
|
|
1178
|
+
}
|
|
1179
|
+
}, _callee);
|
|
1180
|
+
}));
|
|
1181
|
+
function onSuccess() {
|
|
1182
|
+
return _onSuccess.apply(this, arguments);
|
|
1183
|
+
}
|
|
1184
|
+
return onSuccess;
|
|
1185
|
+
}()
|
|
1186
|
+
});
|
|
1187
|
+
};
|
|
1188
|
+
var usePostAirmet = function usePostAirmet() {
|
|
1189
|
+
var _useAuthenticationCon3 = useAuthenticationContext(),
|
|
1190
|
+
auth = _useAuthenticationCon3.auth;
|
|
1191
|
+
var queryClient = useQueryClient();
|
|
1192
|
+
return useMutation({
|
|
1193
|
+
mutationFn: function mutationFn(formData) {
|
|
1194
|
+
if (!auth) {
|
|
1195
|
+
throw new Error('Authentication context not found');
|
|
1196
|
+
}
|
|
1197
|
+
return postAirmet(auth, formData);
|
|
1198
|
+
},
|
|
1199
|
+
onError: function onError() {
|
|
1200
|
+
void queryClient.invalidateQueries({
|
|
1201
|
+
queryKey: ['airmet']
|
|
1202
|
+
});
|
|
1203
|
+
},
|
|
1204
|
+
onSuccess: function () {
|
|
1205
|
+
var _onSuccess2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
1206
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
1207
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
1208
|
+
case 0:
|
|
1209
|
+
_context2.next = 2;
|
|
1210
|
+
return queryClient.invalidateQueries({
|
|
1211
|
+
queryKey: ['airmet-list']
|
|
1212
|
+
});
|
|
1213
|
+
case 2:
|
|
1214
|
+
case "end":
|
|
1215
|
+
return _context2.stop();
|
|
1216
|
+
}
|
|
1217
|
+
}, _callee2);
|
|
1218
|
+
}));
|
|
1219
|
+
function onSuccess() {
|
|
1220
|
+
return _onSuccess2.apply(this, arguments);
|
|
1221
|
+
}
|
|
1222
|
+
return onSuccess;
|
|
1223
|
+
}()
|
|
1224
|
+
});
|
|
1225
|
+
};
|
|
1226
|
+
|
|
993
1227
|
/* *
|
|
994
1228
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
995
1229
|
* you may not use this file except in compliance with the License.
|
|
@@ -4392,37 +4626,6 @@ var airmetDefaultConfig = {
|
|
|
4392
4626
|
var sigmetConfig = sigmetDefaultConfig;
|
|
4393
4627
|
var airmetConfig = airmetDefaultConfig;
|
|
4394
4628
|
|
|
4395
|
-
/* *
|
|
4396
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4397
|
-
* you may not use this file except in compliance with the License.
|
|
4398
|
-
* You may obtain a copy of the License at
|
|
4399
|
-
*
|
|
4400
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4401
|
-
*
|
|
4402
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
4403
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4404
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4405
|
-
* See the License for the specific language governing permissions and
|
|
4406
|
-
* limitations under the License.
|
|
4407
|
-
*
|
|
4408
|
-
* Copyright 2024 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
4409
|
-
* Copyright 2024 - Finnish Meteorological Institute (FMI)
|
|
4410
|
-
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
4411
|
-
* */
|
|
4412
|
-
var SA_NAMESPACE = 'sigmetairmet';
|
|
4413
|
-
var ns = [SA_NAMESPACE, FORM_FIELDS_NAMESPACE];
|
|
4414
|
-
var translateKeyOutsideComponents = function translateKeyOutsideComponents(key, params) {
|
|
4415
|
-
if (params === void 0) {
|
|
4416
|
-
params = undefined;
|
|
4417
|
-
}
|
|
4418
|
-
return i18n.t(key, Object.assign({
|
|
4419
|
-
ns: ns
|
|
4420
|
-
}, params));
|
|
4421
|
-
};
|
|
4422
|
-
var useSigmetAirmetTranslation = function useSigmetAirmetTranslation() {
|
|
4423
|
-
return useTranslation(ns);
|
|
4424
|
-
};
|
|
4425
|
-
|
|
4426
4629
|
/* *
|
|
4427
4630
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4428
4631
|
* you may not use this file except in compliance with the License.
|
|
@@ -5321,35 +5524,6 @@ var useFormLayers = function useFormLayers(layers) {
|
|
|
5321
5524
|
formFeatures: formLayers
|
|
5322
5525
|
}, sourcePanelId);
|
|
5323
5526
|
};
|
|
5324
|
-
function degreesMinutesToDecimal(input) {
|
|
5325
|
-
var raw = input.toString().trim();
|
|
5326
|
-
var negative = raw.startsWith('-');
|
|
5327
|
-
var digits = raw.replace(/[^0-9]/g, '');
|
|
5328
|
-
var sign = negative ? -1 : 1;
|
|
5329
|
-
if (digits.length <= 2) {
|
|
5330
|
-
var _deg = parseInt(digits || '0', 10);
|
|
5331
|
-
return sign * _deg;
|
|
5332
|
-
}
|
|
5333
|
-
// split into degrees + minutes
|
|
5334
|
-
var deg = parseInt(digits.slice(0, digits.length - 2), 10);
|
|
5335
|
-
var min = parseInt(digits.slice(-2), 10);
|
|
5336
|
-
// normalize minutes overflow (e.g. 65 → 1°05′)
|
|
5337
|
-
var extraDeg = Math.floor(min / 60);
|
|
5338
|
-
min %= 60;
|
|
5339
|
-
return sign * (deg + extraDeg + min / 60);
|
|
5340
|
-
}
|
|
5341
|
-
function decimalToDegreesMinutes(value) {
|
|
5342
|
-
var sign = value < 0 ? '-' : '';
|
|
5343
|
-
var abs = Math.abs(value);
|
|
5344
|
-
var degrees = Math.floor(abs);
|
|
5345
|
-
var minutes = Math.round((abs - degrees) * 60);
|
|
5346
|
-
// normalize rounding overflow (e.g. 59.9 min → +1 degree)
|
|
5347
|
-
if (minutes === 60) {
|
|
5348
|
-
abs += 1;
|
|
5349
|
-
return decimalToDegreesMinutes(sign === '-' ? -abs : abs);
|
|
5350
|
-
}
|
|
5351
|
-
return "" + sign + degrees + "\xB0" + minutes.toString().padStart(2, '0') + "\u2032";
|
|
5352
|
-
}
|
|
5353
5527
|
var getSequenceStyling = function getSequenceStyling(product, hasTac) {
|
|
5354
5528
|
if (hasTac === void 0) {
|
|
5355
5529
|
hasTac = false;
|
|
@@ -5390,6 +5564,7 @@ var DrawTools = function DrawTools(_ref) {
|
|
|
5390
5564
|
onChangeTool = _ref.onChangeTool,
|
|
5391
5565
|
_ref$isDisabled = _ref.isDisabled,
|
|
5392
5566
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled;
|
|
5567
|
+
usePreventBrowserClose(activeTool !== '');
|
|
5393
5568
|
return jsx(Box, {
|
|
5394
5569
|
"data-testid": "drawtools",
|
|
5395
5570
|
sx: {
|
|
@@ -6944,103 +7119,6 @@ var ValidUntil = function ValidUntil(_ref) {
|
|
|
6944
7119
|
});
|
|
6945
7120
|
};
|
|
6946
7121
|
|
|
6947
|
-
var DegreesMinutesField = function DegreesMinutesField(_ref) {
|
|
6948
|
-
var name = _ref.name,
|
|
6949
|
-
label = _ref.label,
|
|
6950
|
-
_ref$disabled = _ref.disabled,
|
|
6951
|
-
disabled = _ref$disabled === void 0 ? false : _ref$disabled,
|
|
6952
|
-
_ref$isReadOnly = _ref.isReadOnly,
|
|
6953
|
-
isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
|
|
6954
|
-
_ref$size = _ref.size,
|
|
6955
|
-
size = _ref$size === void 0 ? 'small' : _ref$size,
|
|
6956
|
-
_ref$isLongitude = _ref.isLongitude,
|
|
6957
|
-
isLongitude = _ref$isLongitude === void 0 ? false : _ref$isLongitude;
|
|
6958
|
-
var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
|
|
6959
|
-
t = _useSigmetAirmetTrans.t;
|
|
6960
|
-
var _useFormContext = useFormContext(),
|
|
6961
|
-
control = _useFormContext.control;
|
|
6962
|
-
var _useState = useState(null),
|
|
6963
|
-
localInput = _useState[0],
|
|
6964
|
-
setLocalInput = _useState[1];
|
|
6965
|
-
var _useState2 = useState(false),
|
|
6966
|
-
isEditing = _useState2[0],
|
|
6967
|
-
setIsEditing = _useState2[1];
|
|
6968
|
-
return jsx(Controller, {
|
|
6969
|
-
name: name,
|
|
6970
|
-
control: control,
|
|
6971
|
-
rules: {
|
|
6972
|
-
validate: function validate(value) {
|
|
6973
|
-
if (value == null || isNaN(value)) {
|
|
6974
|
-
return true;
|
|
6975
|
-
} // let empty pass
|
|
6976
|
-
if (!isLongitude && (value < -90 || value > 90)) {
|
|
6977
|
-
return t('form-fields-error-latitude-minutes');
|
|
6978
|
-
}
|
|
6979
|
-
if (isLongitude && (value < -180 || value > 180)) {
|
|
6980
|
-
return t('form-fields-error-longitude-minutes');
|
|
6981
|
-
}
|
|
6982
|
-
return true;
|
|
6983
|
-
}
|
|
6984
|
-
},
|
|
6985
|
-
render: function render(_ref2) {
|
|
6986
|
-
var _fieldState$error;
|
|
6987
|
-
var field = _ref2.field,
|
|
6988
|
-
fieldState = _ref2.fieldState;
|
|
6989
|
-
var value = field.value,
|
|
6990
|
-
onChange = field.onChange;
|
|
6991
|
-
var handleChange = function handleChange(e) {
|
|
6992
|
-
setLocalInput(e.target.value);
|
|
6993
|
-
setIsEditing(true);
|
|
6994
|
-
};
|
|
6995
|
-
var handleBlur = function handleBlur() {
|
|
6996
|
-
if (localInput != null && localInput !== '-' && localInput !== '') {
|
|
6997
|
-
var input = localInput.replace(/[^\d-]/g, '');
|
|
6998
|
-
var negative = input.startsWith('-');
|
|
6999
|
-
var digits = input.replace(/[^0-9]/g, '');
|
|
7000
|
-
// Latitude: 4 digits (DDMM), Longitude: 5 (DDDMM)
|
|
7001
|
-
var maxLen = isLongitude ? 5 : 4;
|
|
7002
|
-
if (digits.length > maxLen) {
|
|
7003
|
-
digits = digits.slice(0, maxLen);
|
|
7004
|
-
}
|
|
7005
|
-
var normalized = negative ? "-" + digits : digits;
|
|
7006
|
-
try {
|
|
7007
|
-
var decimal = degreesMinutesToDecimal(normalized);
|
|
7008
|
-
onChange(decimal);
|
|
7009
|
-
} catch (_unused) {
|
|
7010
|
-
// Invalid, do not update form value
|
|
7011
|
-
}
|
|
7012
|
-
}
|
|
7013
|
-
setIsEditing(false);
|
|
7014
|
-
setLocalInput(null);
|
|
7015
|
-
};
|
|
7016
|
-
var displayValue;
|
|
7017
|
-
if (isEditing) {
|
|
7018
|
-
displayValue = localInput != null ? localInput : '';
|
|
7019
|
-
} else if (value != null) {
|
|
7020
|
-
displayValue = decimalToDegreesMinutes(value);
|
|
7021
|
-
} else {
|
|
7022
|
-
displayValue = '';
|
|
7023
|
-
}
|
|
7024
|
-
return jsx(TextField, {
|
|
7025
|
-
placeholder: isLongitude ? 'DDD°MM′' : 'DD°MM′',
|
|
7026
|
-
label: label,
|
|
7027
|
-
value: displayValue,
|
|
7028
|
-
onChange: handleChange,
|
|
7029
|
-
onBlur: handleBlur,
|
|
7030
|
-
disabled: disabled,
|
|
7031
|
-
slotProps: {
|
|
7032
|
-
input: {
|
|
7033
|
-
readOnly: isReadOnly
|
|
7034
|
-
}
|
|
7035
|
-
},
|
|
7036
|
-
size: size,
|
|
7037
|
-
error: !!fieldState.error,
|
|
7038
|
-
helperText: (_fieldState$error = fieldState.error) == null ? void 0 : _fieldState$error.message
|
|
7039
|
-
});
|
|
7040
|
-
}
|
|
7041
|
-
});
|
|
7042
|
-
};
|
|
7043
|
-
|
|
7044
7122
|
var VolcanicFields = function VolcanicFields(_ref) {
|
|
7045
7123
|
var isDisabled = _ref.isDisabled,
|
|
7046
7124
|
isReadOnly = _ref.isReadOnly,
|
|
@@ -7087,7 +7165,8 @@ var VolcanicFields = function VolcanicFields(_ref) {
|
|
|
7087
7165
|
name: "vaSigmetVolcanoCoordinates.latitude",
|
|
7088
7166
|
label: t('latitude-degrees-and-minutes'),
|
|
7089
7167
|
disabled: isDisabled,
|
|
7090
|
-
isReadOnly: isReadOnly
|
|
7168
|
+
isReadOnly: isReadOnly,
|
|
7169
|
+
t: t
|
|
7091
7170
|
}) : jsx(ReactHookFormNumberField, {
|
|
7092
7171
|
name: "vaSigmetVolcanoCoordinates.latitude",
|
|
7093
7172
|
label: t('latitude'),
|
|
@@ -7116,7 +7195,8 @@ var VolcanicFields = function VolcanicFields(_ref) {
|
|
|
7116
7195
|
label: t('longitude-degrees-and-minutes'),
|
|
7117
7196
|
disabled: isDisabled,
|
|
7118
7197
|
isReadOnly: isReadOnly,
|
|
7119
|
-
isLongitude: true
|
|
7198
|
+
isLongitude: true,
|
|
7199
|
+
t: t
|
|
7120
7200
|
}) : jsx(ReactHookFormNumberField, {
|
|
7121
7201
|
name: "vaSigmetVolcanoCoordinates.longitude",
|
|
7122
7202
|
label: t('longitude'),
|
|
@@ -8393,8 +8473,8 @@ var SigmetForm = function SigmetForm(_ref) {
|
|
|
8393
8473
|
isAmending = _ref.isAmending;
|
|
8394
8474
|
var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
|
|
8395
8475
|
t = _useSigmetAirmetTrans.t;
|
|
8396
|
-
var
|
|
8397
|
-
|
|
8476
|
+
var _useTACApi = useTACApi(),
|
|
8477
|
+
fetchSigmetTAC = _useTACApi.fetchSigmetTAC;
|
|
8398
8478
|
var _useFormContext2 = useFormContext(),
|
|
8399
8479
|
watch = _useFormContext2.watch,
|
|
8400
8480
|
setValue = _useFormContext2.setValue,
|
|
@@ -8407,11 +8487,49 @@ var SigmetForm = function SigmetForm(_ref) {
|
|
|
8407
8487
|
var _React$useState2 = React__default.useState(getDefaultPhenomena(productConfig).phenomena),
|
|
8408
8488
|
phenomenaList = _React$useState2[0],
|
|
8409
8489
|
setPhenomenaList = _React$useState2[1];
|
|
8490
|
+
var sourcePanelId = useSelector(function (store) {
|
|
8491
|
+
return uiSelectors.getSourcePanelId(store, 'publicWarnings');
|
|
8492
|
+
});
|
|
8493
|
+
var linkedMaps = useSelector(function (store) {
|
|
8494
|
+
return genericSelectors.getLinkedMaps(store, sourcePanelId);
|
|
8495
|
+
});
|
|
8496
|
+
var getSrsForMapId = useSelector(function (store) {
|
|
8497
|
+
return linkedMaps ? mapSelectors.getSrs(store, linkedMaps[0]) : undefined;
|
|
8498
|
+
});
|
|
8499
|
+
// Fallback to Mercator for '', null, or undefined
|
|
8500
|
+
var projection = getSrsForMapId != null && getSrsForMapId.trim() ? getSrsForMapId : 'EPSG:3857';
|
|
8501
|
+
var prevProjection = usePrevious(projection);
|
|
8502
|
+
// Trigger update if projection changes
|
|
8503
|
+
useEffect(function () {
|
|
8504
|
+
if (prevProjection === undefined) {
|
|
8505
|
+
return;
|
|
8506
|
+
}
|
|
8507
|
+
if (projection !== prevProjection) {
|
|
8508
|
+
var _startGeoJSON$feature;
|
|
8509
|
+
if (startGeoJSON != null && (_startGeoJSON$feature = startGeoJSON.features) != null && _startGeoJSON$feature.length) {
|
|
8510
|
+
updateStartGeoJson(startGeoJSON);
|
|
8511
|
+
}
|
|
8512
|
+
}
|
|
8513
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8514
|
+
}, [projection, prevProjection]);
|
|
8515
|
+
useEffect(function () {
|
|
8516
|
+
if (prevProjection === undefined) {
|
|
8517
|
+
return;
|
|
8518
|
+
}
|
|
8519
|
+
if (projection !== prevProjection) {
|
|
8520
|
+
var _endGeoJSON$features;
|
|
8521
|
+
if (endGeoJSON != null && (_endGeoJSON$features = endGeoJSON.features) != null && _endGeoJSON$features.length) {
|
|
8522
|
+
updateEndGeoJson(endGeoJSON);
|
|
8523
|
+
}
|
|
8524
|
+
}
|
|
8525
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8526
|
+
}, [projection, prevProjection]);
|
|
8410
8527
|
var _useMapDrawTool = useMapDrawTool({
|
|
8411
8528
|
defaultDrawModes: getDrawTools(t, StartOrEndDrawing.start, getFir(productConfig, firBorderAtStart)),
|
|
8412
|
-
defaultGeoJSON: !isCancelSigmet && initialSigmet && initialSigmet.startGeometry ? addFeatureProperties(initialSigmet.startGeometry, featurePropsStart) : undefined,
|
|
8413
|
-
defaultGeoJSONIntersection: !isCancelSigmet && initialSigmet && initialSigmet.startGeometryIntersect ? addFeatureProperties(initialSigmet.startGeometryIntersect, featurePropsIntersectionStart) : undefined,
|
|
8414
|
-
defaultGeoJSONIntersectionBounds: addFeatureProperties(getFir(productConfig, firBorderAtStart), featurePropsFIR)
|
|
8529
|
+
defaultGeoJSON: !isCancelSigmet && initialSigmet != null && initialSigmet.startGeometry ? addFeatureProperties(initialSigmet.startGeometry, featurePropsStart) : undefined,
|
|
8530
|
+
defaultGeoJSONIntersection: !isCancelSigmet && initialSigmet != null && initialSigmet.startGeometryIntersect ? addFeatureProperties(initialSigmet.startGeometryIntersect, featurePropsIntersectionStart) : undefined,
|
|
8531
|
+
defaultGeoJSONIntersectionBounds: addFeatureProperties(getFir(productConfig, firBorderAtStart), featurePropsFIR),
|
|
8532
|
+
projection: projection
|
|
8415
8533
|
}),
|
|
8416
8534
|
startGeoJSON = _useMapDrawTool.geoJSON,
|
|
8417
8535
|
setStartGeoJSON = _useMapDrawTool.setGeoJSON,
|
|
@@ -8425,10 +8543,11 @@ var SigmetForm = function SigmetForm(_ref) {
|
|
|
8425
8543
|
setStartEditModes = _useMapDrawTool.setDrawModes;
|
|
8426
8544
|
var _useMapDrawTool2 = useMapDrawTool({
|
|
8427
8545
|
defaultDrawModes: getDrawTools(t, StartOrEndDrawing.end, getFir(productConfig, firBorderAtStart)),
|
|
8428
|
-
defaultGeoJSON: !isCancelSigmet && initialSigmet && initialSigmet.endGeometry ? addFeatureProperties(initialSigmet.endGeometry, featurePropsEnd) : undefined,
|
|
8429
|
-
defaultGeoJSONIntersection: !isCancelSigmet && initialSigmet && initialSigmet.endGeometryIntersect ? addFeatureProperties(initialSigmet.endGeometryIntersect, featurePropsIntersectionEnd) : undefined,
|
|
8546
|
+
defaultGeoJSON: !isCancelSigmet && initialSigmet != null && initialSigmet.endGeometry ? addFeatureProperties(initialSigmet.endGeometry, featurePropsEnd) : undefined,
|
|
8547
|
+
defaultGeoJSONIntersection: !isCancelSigmet && initialSigmet != null && initialSigmet.endGeometryIntersect ? addFeatureProperties(initialSigmet.endGeometryIntersect, featurePropsIntersectionEnd) : undefined,
|
|
8430
8548
|
defaultGeoJSONIntersectionBounds: addFeatureProperties(getFir(productConfig, firBorderAtStart), featurePropsFIR),
|
|
8431
|
-
defaultGeoJSONIntersectionProperties: featurePropsIntersectionEnd
|
|
8549
|
+
defaultGeoJSONIntersectionProperties: featurePropsIntersectionEnd,
|
|
8550
|
+
projection: projection
|
|
8432
8551
|
}),
|
|
8433
8552
|
endGeoJSON = _useMapDrawTool2.geoJSON,
|
|
8434
8553
|
setEndGeoJSON = _useMapDrawTool2.setGeoJSON,
|
|
@@ -8443,7 +8562,7 @@ var SigmetForm = function SigmetForm(_ref) {
|
|
|
8443
8562
|
var getHasFormErrors = function getHasFormErrors() {
|
|
8444
8563
|
return Object.keys(errors).length > 0;
|
|
8445
8564
|
};
|
|
8446
|
-
var _useTAC = useTAC(t, initialSigmet
|
|
8565
|
+
var _useTAC = useTAC(t, initialSigmet != null ? initialSigmet : initialCancelSigmet, getTAC != null ? getTAC : fetchSigmetTAC, getHasFormErrors, getOmitChangeFromConfig(productConfig)),
|
|
8447
8566
|
tac = _useTAC[0],
|
|
8448
8567
|
updateTac = _useTAC[1];
|
|
8449
8568
|
React__default.useEffect(function () {
|
|
@@ -8524,7 +8643,7 @@ var SigmetForm = function SigmetForm(_ref) {
|
|
|
8524
8643
|
var helperText = isReadOnly ? '' : 'Optional';
|
|
8525
8644
|
React__default.useEffect(function () {
|
|
8526
8645
|
var isInDrawMode = activeStartTool !== '' || activeEndTool !== '';
|
|
8527
|
-
setDialogActionsDisabled
|
|
8646
|
+
setDialogActionsDisabled == null || setDialogActionsDisabled(isInDrawMode);
|
|
8528
8647
|
if (mode === 'view') {
|
|
8529
8648
|
setIsDisabled(true);
|
|
8530
8649
|
} else {
|
|
@@ -8586,12 +8705,12 @@ var SigmetForm = function SigmetForm(_ref) {
|
|
|
8586
8705
|
isReadOnly: isReadOnly,
|
|
8587
8706
|
helperText: helperText,
|
|
8588
8707
|
onChange: onChangeForm
|
|
8589
|
-
}), !isCancelSigmet && hasVolcanicAshes && !isShortTest()
|
|
8708
|
+
}), !isCancelSigmet && hasVolcanicAshes && !isShortTest() ? jsx(VolcanicFields, {
|
|
8590
8709
|
isDisabled: isDisabled,
|
|
8591
8710
|
isReadOnly: isReadOnly,
|
|
8592
8711
|
helperText: helperText,
|
|
8593
8712
|
degreesAndMinutes: degreesAndMinutes
|
|
8594
|
-
}), jsx(ValidFrom, {
|
|
8713
|
+
}) : null, jsx(ValidFrom, {
|
|
8595
8714
|
productConfig: productConfig,
|
|
8596
8715
|
isDisabled: isDisabled,
|
|
8597
8716
|
isAmending: isAmending,
|
|
@@ -8614,7 +8733,7 @@ var SigmetForm = function SigmetForm(_ref) {
|
|
|
8614
8733
|
isDisabled: isDisabled,
|
|
8615
8734
|
isReadOnly: isReadOnly,
|
|
8616
8735
|
onChange: function onChange(event, newPhenomenaList) {
|
|
8617
|
-
onChangeFir(newPhenomenaList
|
|
8736
|
+
onChangeFir(newPhenomenaList != null ? newPhenomenaList : [], event);
|
|
8618
8737
|
}
|
|
8619
8738
|
}), jsx(StartGeometry, {
|
|
8620
8739
|
isReadOnly: isReadOnly,
|
|
@@ -8646,7 +8765,7 @@ var SigmetForm = function SigmetForm(_ref) {
|
|
|
8646
8765
|
}), !isCancelSigmet && !omitChange && jsx(Change, {
|
|
8647
8766
|
isDisabled: isDisabled,
|
|
8648
8767
|
isReadOnly: isReadOnly
|
|
8649
|
-
}), isCancelSigmet && watch('vaSigmetMoveToFIR')
|
|
8768
|
+
}), isCancelSigmet && watch('vaSigmetMoveToFIR') ? jsx(ProductFormFieldLayout, {
|
|
8650
8769
|
children: jsxs(Typography, {
|
|
8651
8770
|
variant: "body2",
|
|
8652
8771
|
sx: Object.assign({}, styles$2.body, {
|
|
@@ -8657,7 +8776,7 @@ var SigmetForm = function SigmetForm(_ref) {
|
|
|
8657
8776
|
children: [" ", watch('vaSigmetMoveToFIR')]
|
|
8658
8777
|
})]
|
|
8659
8778
|
})
|
|
8660
|
-
}), jsx(IssuedAt, {
|
|
8779
|
+
}) : null, jsx(IssuedAt, {
|
|
8661
8780
|
date: getProductIssueDate(t, initialSigmet, initialCancelSigmet),
|
|
8662
8781
|
isReadOnly: isReadOnly
|
|
8663
8782
|
}), jsxs(Tac, {
|
|
@@ -8667,7 +8786,7 @@ var SigmetForm = function SigmetForm(_ref) {
|
|
|
8667
8786
|
name: "sequence",
|
|
8668
8787
|
defaultValue: "-1"
|
|
8669
8788
|
}), /* Add hidden fields for TAC generation in case of cancel sigmet */
|
|
8670
|
-
isCancelSigmet
|
|
8789
|
+
isCancelSigmet ? jsxs(Fragment, {
|
|
8671
8790
|
children: [jsx(ReactHookFormHiddenInput, {
|
|
8672
8791
|
name: "cancelsSigmetSequenceId"
|
|
8673
8792
|
}), jsx(ReactHookFormHiddenInput, {
|
|
@@ -8675,7 +8794,7 @@ var SigmetForm = function SigmetForm(_ref) {
|
|
|
8675
8794
|
}), jsx(ReactHookFormHiddenInput, {
|
|
8676
8795
|
name: "validDateStartOfSigmetToCancel"
|
|
8677
8796
|
})]
|
|
8678
|
-
})]
|
|
8797
|
+
}) : null]
|
|
8679
8798
|
})]
|
|
8680
8799
|
});
|
|
8681
8800
|
};
|
|
@@ -8769,14 +8888,40 @@ var AirmetForm = function AirmetForm(_ref) {
|
|
|
8769
8888
|
setHasUserChangedTime = _React$useState2[1];
|
|
8770
8889
|
var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
|
|
8771
8890
|
t = _useSigmetAirmetTrans.t;
|
|
8772
|
-
var
|
|
8773
|
-
|
|
8891
|
+
var _useTACApi = useTACApi(),
|
|
8892
|
+
fetchAirmetTAC = _useTACApi.fetchAirmetTAC;
|
|
8774
8893
|
var firBorderAtStart = initialAirmet ? initialAirmet.locationIndicatorATSR : productConfig.active_firs[0];
|
|
8894
|
+
var sourcePanelId = useSelector(function (store) {
|
|
8895
|
+
return uiSelectors.getSourcePanelId(store, 'publicWarnings');
|
|
8896
|
+
});
|
|
8897
|
+
var linkedMaps = useSelector(function (store) {
|
|
8898
|
+
return genericSelectors.getLinkedMaps(store, sourcePanelId);
|
|
8899
|
+
});
|
|
8900
|
+
var getSrsForMapId = useSelector(function (store) {
|
|
8901
|
+
return linkedMaps ? mapSelectors.getSrs(store, linkedMaps[0]) : undefined;
|
|
8902
|
+
});
|
|
8903
|
+
// Fallback to Mercator for '', null, or undefined
|
|
8904
|
+
var projection = getSrsForMapId != null && getSrsForMapId.trim() ? getSrsForMapId : 'EPSG:3857';
|
|
8905
|
+
var prevProjection = usePrevious(projection);
|
|
8906
|
+
// Trigger update if projection changes
|
|
8907
|
+
useEffect(function () {
|
|
8908
|
+
if (prevProjection === undefined) {
|
|
8909
|
+
return;
|
|
8910
|
+
}
|
|
8911
|
+
if (projection !== prevProjection) {
|
|
8912
|
+
var _startGeoJSON$feature;
|
|
8913
|
+
if (startGeoJSON != null && (_startGeoJSON$feature = startGeoJSON.features) != null && _startGeoJSON$feature.length) {
|
|
8914
|
+
updateStartGeoJson(startGeoJSON);
|
|
8915
|
+
}
|
|
8916
|
+
}
|
|
8917
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
8918
|
+
}, [projection, prevProjection]);
|
|
8775
8919
|
var _useMapDrawTool = useMapDrawTool({
|
|
8776
8920
|
defaultDrawModes: getDrawTools(t, StartOrEndDrawing.start, getFir(productConfig, firBorderAtStart)),
|
|
8777
|
-
defaultGeoJSON: !isCancelAirmet && initialAirmet && initialAirmet.startGeometry ? addFeatureProperties(initialAirmet.startGeometry, featurePropsStart) : undefined,
|
|
8778
|
-
defaultGeoJSONIntersection: !isCancelAirmet && initialAirmet && initialAirmet.
|
|
8779
|
-
defaultGeoJSONIntersectionBounds: addFeatureProperties(getFir(productConfig, firBorderAtStart), featurePropsFIR)
|
|
8921
|
+
defaultGeoJSON: !isCancelAirmet && initialAirmet != null && initialAirmet.startGeometry ? addFeatureProperties(initialAirmet.startGeometry, featurePropsStart) : undefined,
|
|
8922
|
+
defaultGeoJSONIntersection: !isCancelAirmet && !!(initialAirmet != null && initialAirmet.startGeometry) ? addFeatureProperties(initialAirmet.startGeometryIntersect, featurePropsIntersectionStart) : undefined,
|
|
8923
|
+
defaultGeoJSONIntersectionBounds: addFeatureProperties(getFir(productConfig, firBorderAtStart), featurePropsFIR),
|
|
8924
|
+
projection: projection
|
|
8780
8925
|
}),
|
|
8781
8926
|
startGeoJSON = _useMapDrawTool.geoJSON,
|
|
8782
8927
|
setGeoJSON = _useMapDrawTool.setGeoJSON,
|
|
@@ -8791,7 +8936,7 @@ var AirmetForm = function AirmetForm(_ref) {
|
|
|
8791
8936
|
var getHasFormErrors = function getHasFormErrors() {
|
|
8792
8937
|
return Object.keys(errors).length > 0;
|
|
8793
8938
|
};
|
|
8794
|
-
var _useTAC = useTAC(t, initialAirmet
|
|
8939
|
+
var _useTAC = useTAC(t, initialAirmet != null ? initialAirmet : initialCancelAirmet, getTAC != null ? getTAC : fetchAirmetTAC, getHasFormErrors),
|
|
8795
8940
|
tac = _useTAC[0],
|
|
8796
8941
|
updateTac = _useTAC[1];
|
|
8797
8942
|
React__default.useEffect(function () {
|
|
@@ -8888,17 +9033,17 @@ var AirmetForm = function AirmetForm(_ref) {
|
|
|
8888
9033
|
isDisabled: isDisabled,
|
|
8889
9034
|
isReadOnly: isReadOnly,
|
|
8890
9035
|
onChange: onChangeForm
|
|
8891
|
-
}), !isCancelAirmet && hasSurfaceVisiblity
|
|
9036
|
+
}), !isCancelAirmet && hasSurfaceVisiblity ? jsx(SurfaceVisibility, {
|
|
8892
9037
|
isReadOnly: isReadOnly,
|
|
8893
9038
|
isDisabled: isDisabled,
|
|
8894
9039
|
onChange: onChangeForm,
|
|
8895
9040
|
productConfig: productConfig
|
|
8896
|
-
}), !isCancelAirmet && hasSurfaceWind
|
|
9041
|
+
}) : null, !isCancelAirmet && hasSurfaceWind ? jsx(SurfaceWind, {
|
|
8897
9042
|
isReadOnly: isReadOnly,
|
|
8898
9043
|
isDisabled: isDisabled,
|
|
8899
9044
|
onChange: onChangeForm,
|
|
8900
9045
|
productConfig: productConfig
|
|
8901
|
-
}), !isCancelAirmet && jsx(ObservationForecast, {
|
|
9046
|
+
}) : null, !isCancelAirmet && jsx(ObservationForecast, {
|
|
8902
9047
|
isDisabled: isDisabled,
|
|
8903
9048
|
isReadOnly: isReadOnly
|
|
8904
9049
|
}), !isCancelAirmet && jsx(ObservationForecastTime, {
|
|
@@ -8929,7 +9074,7 @@ var AirmetForm = function AirmetForm(_ref) {
|
|
|
8929
9074
|
isDisabled: isDisabled,
|
|
8930
9075
|
productConfig: productConfig,
|
|
8931
9076
|
onChange: function onChange(event, newPhenomenaList) {
|
|
8932
|
-
onChangeFir(newPhenomenaList
|
|
9077
|
+
onChangeFir(newPhenomenaList != null ? newPhenomenaList : [], event);
|
|
8933
9078
|
}
|
|
8934
9079
|
}), jsx(StartGeometry, {
|
|
8935
9080
|
isReadOnly: isReadOnly,
|
|
@@ -8940,18 +9085,18 @@ var AirmetForm = function AirmetForm(_ref) {
|
|
|
8940
9085
|
activeTool: activeStartTool,
|
|
8941
9086
|
productConfig: productConfig,
|
|
8942
9087
|
isDisabled: drawToolsDisabled
|
|
8943
|
-
}), !isCancelAirmet && hasLevels
|
|
9088
|
+
}), !isCancelAirmet && hasLevels ? jsx(Levels, {
|
|
8944
9089
|
isDisabled: isDisabled,
|
|
8945
9090
|
isReadOnly: isReadOnly,
|
|
8946
9091
|
onChange: onChangeForm,
|
|
8947
9092
|
productType: "airmet",
|
|
8948
9093
|
productConfig: productConfig
|
|
8949
|
-
}), !isCancelAirmet && hasCloudLevels
|
|
9094
|
+
}) : null, !isCancelAirmet && hasCloudLevels ? jsx(CloudLevels, {
|
|
8950
9095
|
isDisabled: isDisabled,
|
|
8951
9096
|
isReadOnly: isReadOnly,
|
|
8952
9097
|
onChange: onChangeForm,
|
|
8953
9098
|
productConfig: productConfig
|
|
8954
|
-
}), !isCancelAirmet && jsx(Progress, {
|
|
9099
|
+
}) : null, !isCancelAirmet && jsx(Progress, {
|
|
8955
9100
|
productType: "airmet",
|
|
8956
9101
|
isDisabled: isDisabled,
|
|
8957
9102
|
isReadOnly: isReadOnly,
|
|
@@ -8970,7 +9115,7 @@ var AirmetForm = function AirmetForm(_ref) {
|
|
|
8970
9115
|
name: "sequence",
|
|
8971
9116
|
defaultValue: "-1"
|
|
8972
9117
|
}), /* Add hidden fields for TAC generation in case of cancel airmet */
|
|
8973
|
-
isCancelAirmet
|
|
9118
|
+
isCancelAirmet ? jsxs(Fragment, {
|
|
8974
9119
|
children: [jsx(ReactHookFormHiddenInput, {
|
|
8975
9120
|
name: "cancelsAirmetSequenceId"
|
|
8976
9121
|
}), jsx(ReactHookFormHiddenInput, {
|
|
@@ -8978,7 +9123,7 @@ var AirmetForm = function AirmetForm(_ref) {
|
|
|
8978
9123
|
}), jsx(ReactHookFormHiddenInput, {
|
|
8979
9124
|
name: "validDateStartOfAirmetToCancel"
|
|
8980
9125
|
})]
|
|
8981
|
-
})]
|
|
9126
|
+
}) : null]
|
|
8982
9127
|
})]
|
|
8983
9128
|
});
|
|
8984
9129
|
};
|
|
@@ -9060,9 +9205,10 @@ var ProductFormDialogContent = function ProductFormDialogContent(_ref) {
|
|
|
9060
9205
|
product = _ref.product;
|
|
9061
9206
|
var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
|
|
9062
9207
|
t = _useSigmetAirmetTrans.t;
|
|
9063
|
-
var
|
|
9064
|
-
|
|
9065
|
-
var apiCall = productType === 'sigmet' ?
|
|
9208
|
+
var postSigmetMutation = usePostSigmet();
|
|
9209
|
+
var postAirmetMutation = usePostAirmet();
|
|
9210
|
+
var apiCall = productType === 'sigmet' ? postSigmetMutation.mutateAsync : postAirmetMutation.mutateAsync;
|
|
9211
|
+
var isLoading = productType === 'sigmet' ? postSigmetMutation.isPending : postAirmetMutation.isPending;
|
|
9066
9212
|
var _useFormContext = useFormContext(),
|
|
9067
9213
|
handleSubmit = _useFormContext.handleSubmit,
|
|
9068
9214
|
formState = _useFormContext.formState,
|
|
@@ -9079,38 +9225,28 @@ var ProductFormDialogContent = function ProductFormDialogContent(_ref) {
|
|
|
9079
9225
|
usePreventBrowserClose(isDirty);
|
|
9080
9226
|
var confirmationDialog = useConfirmationDialog();
|
|
9081
9227
|
var _React$useState = React.useState(false),
|
|
9082
|
-
|
|
9083
|
-
|
|
9084
|
-
var _React$useState2 = React.useState(
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
var _React$useState3 = React.useState(
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
var _React$useState4 = React.useState(false),
|
|
9091
|
-
dialogActionsDisabled = _React$useState4[0],
|
|
9092
|
-
setDialogActionsDisabled = _React$useState4[1];
|
|
9228
|
+
errorStoreMessage = _React$useState[0],
|
|
9229
|
+
setErrorStoreMessage = _React$useState[1];
|
|
9230
|
+
var _React$useState2 = React.useState(''),
|
|
9231
|
+
errorStoreMessageText = _React$useState2[0],
|
|
9232
|
+
setErrorStoreMessageText = _React$useState2[1];
|
|
9233
|
+
var _React$useState3 = React.useState(false),
|
|
9234
|
+
dialogActionsDisabled = _React$useState3[0],
|
|
9235
|
+
setDialogActionsDisabled = _React$useState3[1];
|
|
9093
9236
|
var postProduct = function postProduct(productToPost, newStatus) {
|
|
9094
9237
|
var uuid = product !== null && product.uuid ? product.uuid : null;
|
|
9095
9238
|
var postProductParam = productType === 'sigmet' ? createSigmetPostParameter(productToPost, newStatus, uuid) : createAirmetPostParameter(productToPost, newStatus, uuid);
|
|
9096
|
-
setLoader(true);
|
|
9097
|
-
setErrorStoreMessage(false);
|
|
9098
|
-
setErrorStoreMessageText('');
|
|
9099
9239
|
apiCall(postProductParam).then(function () {
|
|
9100
9240
|
onToggleDialog();
|
|
9101
9241
|
})["catch"](function (error) {
|
|
9102
9242
|
setErrorStoreMessage(true);
|
|
9103
|
-
|
|
9104
|
-
setErrorStoreMessageText(getAxiosErrorMessage(error));
|
|
9105
|
-
}
|
|
9106
|
-
setLoader(false);
|
|
9243
|
+
setErrorStoreMessageText(error.message || 'Unknown error');
|
|
9107
9244
|
});
|
|
9108
9245
|
};
|
|
9109
9246
|
var onToggleDialog = function onToggleDialog(shouldRefreshList) {
|
|
9110
9247
|
if (shouldRefreshList === void 0) {
|
|
9111
9248
|
shouldRefreshList = true;
|
|
9112
9249
|
}
|
|
9113
|
-
setLoader(false);
|
|
9114
9250
|
toggleDialogStatus(shouldRefreshList);
|
|
9115
9251
|
};
|
|
9116
9252
|
var showConfirmDialog = function showConfirmDialog(action) {
|
|
@@ -9265,7 +9401,7 @@ var ProductFormDialogContent = function ProductFormDialogContent(_ref) {
|
|
|
9265
9401
|
})
|
|
9266
9402
|
}), jsx(DraftFieldHelper, {}), jsx(Backdrop, {
|
|
9267
9403
|
"data-testid": "loader",
|
|
9268
|
-
open:
|
|
9404
|
+
open: isLoading,
|
|
9269
9405
|
sx: {
|
|
9270
9406
|
zIndex: 1500,
|
|
9271
9407
|
color: '#fff'
|
|
@@ -9486,25 +9622,39 @@ var ProductListRow = function ProductListRow(_ref2) {
|
|
|
9486
9622
|
productConfig = _ref2.productConfig;
|
|
9487
9623
|
var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
|
|
9488
9624
|
t = _useSigmetAirmetTrans.t;
|
|
9489
|
-
var _useApiContext = useApiContext(),
|
|
9490
|
-
api = _useApiContext.api;
|
|
9491
9625
|
var _useIsMounted = useIsMounted(),
|
|
9492
9626
|
isMounted = _useIsMounted.isMounted;
|
|
9493
9627
|
var _React$useState = React__default.useState(''),
|
|
9494
9628
|
TAC = _React$useState[0],
|
|
9495
9629
|
setTAC = _React$useState[1];
|
|
9496
|
-
var
|
|
9630
|
+
var _useTACApi = useTACApi(),
|
|
9631
|
+
fetchSigmetTAC = _useTACApi.fetchSigmetTAC,
|
|
9632
|
+
fetchAirmetTAC = _useTACApi.fetchAirmetTAC;
|
|
9633
|
+
var apiCall = productType === 'sigmet' ? fetchSigmetTAC : fetchAirmetTAC;
|
|
9497
9634
|
React__default.useEffect(function () {
|
|
9498
|
-
var retrieveTAC = function
|
|
9499
|
-
|
|
9500
|
-
|
|
9501
|
-
|
|
9502
|
-
|
|
9503
|
-
|
|
9504
|
-
|
|
9505
|
-
|
|
9635
|
+
var retrieveTAC = /*#__PURE__*/function () {
|
|
9636
|
+
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(productToPost) {
|
|
9637
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9638
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9639
|
+
case 0:
|
|
9640
|
+
_context.next = 2;
|
|
9641
|
+
return apiCall(productToPost).then(function (result) {
|
|
9642
|
+
if (isMounted.current) {
|
|
9643
|
+
setTAC(result.data);
|
|
9644
|
+
}
|
|
9645
|
+
})["catch"](function () {});
|
|
9646
|
+
case 2:
|
|
9647
|
+
case "end":
|
|
9648
|
+
return _context.stop();
|
|
9649
|
+
}
|
|
9650
|
+
}, _callee);
|
|
9651
|
+
}));
|
|
9652
|
+
return function retrieveTAC(_x) {
|
|
9653
|
+
return _ref3.apply(this, arguments);
|
|
9654
|
+
};
|
|
9655
|
+
}();
|
|
9506
9656
|
if (shouldRetrieveTAC(product)) {
|
|
9507
|
-
retrieveTAC(product);
|
|
9657
|
+
void retrieveTAC(product);
|
|
9508
9658
|
} else if (isMounted.current) {
|
|
9509
9659
|
setTAC(noTAC(t));
|
|
9510
9660
|
}
|
|
@@ -9720,80 +9870,36 @@ var ProductList = function ProductList(_ref) {
|
|
|
9720
9870
|
};
|
|
9721
9871
|
|
|
9722
9872
|
var useProductApi = function useProductApi(productType) {
|
|
9723
|
-
var
|
|
9724
|
-
|
|
9725
|
-
|
|
9726
|
-
|
|
9727
|
-
|
|
9728
|
-
|
|
9729
|
-
|
|
9730
|
-
|
|
9731
|
-
|
|
9732
|
-
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9737
|
-
|
|
9738
|
-
|
|
9739
|
-
});
|
|
9740
|
-
}
|
|
9741
|
-
};
|
|
9742
|
-
var fetchNewData = /*#__PURE__*/function () {
|
|
9743
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
9744
|
-
var _yield$requestList, data, newError;
|
|
9745
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9746
|
-
while (1) switch (_context.prev = _context.next) {
|
|
9747
|
-
case 0:
|
|
9748
|
-
if (!state.isLoading) {
|
|
9873
|
+
var sigmetQuery = useSigmetList(productType !== 'sigmet');
|
|
9874
|
+
var airmetQuery = useAirmetList(productType !== 'airmet');
|
|
9875
|
+
var query = productType === 'sigmet' ? sigmetQuery : airmetQuery;
|
|
9876
|
+
var data = query.data,
|
|
9877
|
+
isLoading = query.isLoading,
|
|
9878
|
+
error = query.error,
|
|
9879
|
+
refetch = query.refetch;
|
|
9880
|
+
return {
|
|
9881
|
+
result: data || [],
|
|
9882
|
+
isLoading: isLoading,
|
|
9883
|
+
error: error,
|
|
9884
|
+
fetchNewData: function () {
|
|
9885
|
+
var _fetchNewData = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
9886
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9887
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9888
|
+
case 0:
|
|
9749
9889
|
_context.next = 2;
|
|
9750
|
-
|
|
9751
|
-
|
|
9752
|
-
|
|
9753
|
-
|
|
9754
|
-
|
|
9755
|
-
|
|
9756
|
-
|
|
9757
|
-
|
|
9758
|
-
|
|
9759
|
-
|
|
9760
|
-
|
|
9761
|
-
|
|
9762
|
-
|
|
9763
|
-
data = _yield$requestList.data;
|
|
9764
|
-
updateState(Object.assign({}, state, {
|
|
9765
|
-
result: data,
|
|
9766
|
-
isLoading: false
|
|
9767
|
-
}));
|
|
9768
|
-
_context.next = 15;
|
|
9769
|
-
break;
|
|
9770
|
-
case 11:
|
|
9771
|
-
_context.prev = 11;
|
|
9772
|
-
_context.t0 = _context["catch"](3);
|
|
9773
|
-
newError = Object.assign({}, _context.t0, {
|
|
9774
|
-
name: translateKeyOutsideComponents('error-backend')
|
|
9775
|
-
});
|
|
9776
|
-
updateState(Object.assign({}, state, {
|
|
9777
|
-
error: newError,
|
|
9778
|
-
isLoading: false
|
|
9779
|
-
}));
|
|
9780
|
-
case 15:
|
|
9781
|
-
case "end":
|
|
9782
|
-
return _context.stop();
|
|
9783
|
-
}
|
|
9784
|
-
}, _callee, null, [[3, 11]]);
|
|
9785
|
-
}));
|
|
9786
|
-
return function fetchNewData() {
|
|
9787
|
-
return _ref.apply(this, arguments);
|
|
9788
|
-
};
|
|
9789
|
-
}();
|
|
9790
|
-
React__default.useEffect(function () {
|
|
9791
|
-
void fetchNewData();
|
|
9792
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
9793
|
-
}, []);
|
|
9794
|
-
return Object.assign({}, state, {
|
|
9795
|
-
fetchNewData: fetchNewData
|
|
9796
|
-
});
|
|
9890
|
+
return refetch();
|
|
9891
|
+
case 2:
|
|
9892
|
+
case "end":
|
|
9893
|
+
return _context.stop();
|
|
9894
|
+
}
|
|
9895
|
+
}, _callee);
|
|
9896
|
+
}));
|
|
9897
|
+
function fetchNewData() {
|
|
9898
|
+
return _fetchNewData.apply(this, arguments);
|
|
9899
|
+
}
|
|
9900
|
+
return fetchNewData;
|
|
9901
|
+
}()
|
|
9902
|
+
};
|
|
9797
9903
|
};
|
|
9798
9904
|
var renewProduct = function renewProduct(oldProduct, productConfig) {
|
|
9799
9905
|
return Object.assign({}, oldProduct, {
|
|
@@ -9827,8 +9933,6 @@ var renewSigmet = function renewSigmet(oldSigmet, productConfig) {
|
|
|
9827
9933
|
* Pass in either 'sigmet' or 'airmet' as prop to determine the mode
|
|
9828
9934
|
* @param {string} productType productType: string - either 'sigmet' or 'airmet'. Determines mode in which wrapper is loaded
|
|
9829
9935
|
*
|
|
9830
|
-
* @example
|
|
9831
|
-
* ```<ApiProvider baseURL="http://test.com" appURL="http://app.com" auth={auth} onSetAuth={onSetAuth} createApi={api.createApi} authTokenURL="url/tokenrefresh"> <MetInfoWrapper productType="sigmet"/> </ApiProvider>```
|
|
9832
9936
|
*/
|
|
9833
9937
|
var MetInfoWrapper = function MetInfoWrapper(_ref) {
|
|
9834
9938
|
var productType = _ref.productType,
|
|
@@ -9910,16 +10014,13 @@ var DownloadSigmetAirmetConfigWrapper = function DownloadSigmetAirmetConfigWrapp
|
|
|
9910
10014
|
var productType = _ref.productType;
|
|
9911
10015
|
var _useSigmetAirmetTrans = useSigmetAirmetTranslation(),
|
|
9912
10016
|
t = _useSigmetAirmetTrans.t;
|
|
9913
|
-
var
|
|
9914
|
-
api = _useApiContext.api;
|
|
9915
|
-
var _useAuthenticationCon = useAuthenticationContext(),
|
|
10017
|
+
var _useAuthenticationCon = useAuthenticationContext$1(),
|
|
9916
10018
|
isLoggedIn = _useAuthenticationCon.isLoggedIn;
|
|
9917
|
-
var
|
|
9918
|
-
|
|
9919
|
-
|
|
9920
|
-
|
|
9921
|
-
|
|
9922
|
-
if (isConfigLoading) {
|
|
10019
|
+
var _useProductConfig = useProductConfig(productType),
|
|
10020
|
+
productConfig = _useProductConfig.data,
|
|
10021
|
+
isLoading = _useProductConfig.isLoading,
|
|
10022
|
+
error = _useProductConfig.error;
|
|
10023
|
+
if (isLoading) {
|
|
9923
10024
|
return jsx(LinearProgress, {
|
|
9924
10025
|
"data-testid": "loadingSpinner"
|
|
9925
10026
|
});
|
|
@@ -9930,6 +10031,12 @@ var DownloadSigmetAirmetConfigWrapper = function DownloadSigmetAirmetConfigWrapp
|
|
|
9930
10031
|
info: !isLoggedIn ? t('error-auth-login') : error.message
|
|
9931
10032
|
});
|
|
9932
10033
|
}
|
|
10034
|
+
if (!productConfig) {
|
|
10035
|
+
return jsx(AlertBanner, {
|
|
10036
|
+
title: t('error-title'),
|
|
10037
|
+
info: t('error-no-config-found')
|
|
10038
|
+
});
|
|
10039
|
+
}
|
|
9933
10040
|
return jsx(MetInfoWrapper, {
|
|
9934
10041
|
productType: productType,
|
|
9935
10042
|
productConfig: productConfig
|
|
@@ -9938,23 +10045,10 @@ var DownloadSigmetAirmetConfigWrapper = function DownloadSigmetAirmetConfigWrapp
|
|
|
9938
10045
|
|
|
9939
10046
|
var AviationProductApiWrapper = function AviationProductApiWrapper(_ref) {
|
|
9940
10047
|
var config = _ref.config,
|
|
9941
|
-
auth = _ref.auth,
|
|
9942
|
-
onSetAuth = _ref.onSetAuth,
|
|
9943
10048
|
productType = _ref.productType;
|
|
9944
|
-
return config ? jsx(
|
|
9945
|
-
|
|
9946
|
-
|
|
9947
|
-
appURL: config.appURL,
|
|
9948
|
-
authTokenURL: config.authTokenURL,
|
|
9949
|
-
authClientId: config.authClientId
|
|
9950
|
-
},
|
|
9951
|
-
auth: auth,
|
|
9952
|
-
onSetAuth: onSetAuth,
|
|
9953
|
-
createApi: createApi$1,
|
|
9954
|
-
children: jsx(ErrorBoundary, {
|
|
9955
|
-
children: jsx(DownloadSigmetAirmetConfigWrapper, {
|
|
9956
|
-
productType: productType
|
|
9957
|
-
})
|
|
10049
|
+
return config ? jsx(ErrorBoundary, {
|
|
10050
|
+
children: jsx(DownloadSigmetAirmetConfigWrapper, {
|
|
10051
|
+
productType: productType
|
|
9958
10052
|
})
|
|
9959
10053
|
}) : null;
|
|
9960
10054
|
};
|
|
@@ -11987,104 +12081,4 @@ var fakeSigmetList = [{
|
|
|
11987
12081
|
}
|
|
11988
12082
|
}];
|
|
11989
12083
|
|
|
11990
|
-
|
|
11991
|
-
var fakeAirmetTAC = 'EHAA AIRMET -1 VALID 310700/311100 EHDB- EHAA AMSTERDAM FIR ISOL CB OBS ENTIRE FIR FL020 STNR NC';
|
|
11992
|
-
var getApiRoutes = function getApiRoutes(axiosInstance) {
|
|
11993
|
-
return {
|
|
11994
|
-
getSigmetConfiguration: function () {
|
|
11995
|
-
var _getSigmetConfiguration = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
11996
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
11997
|
-
while (1) switch (_context.prev = _context.next) {
|
|
11998
|
-
case 0:
|
|
11999
|
-
_context.next = 2;
|
|
12000
|
-
return new Promise(function (resolve) {
|
|
12001
|
-
setTimeout(resolve, 2000);
|
|
12002
|
-
});
|
|
12003
|
-
case 2:
|
|
12004
|
-
return _context.abrupt("return", axiosInstance.get('/sigmetConfiguration').then(function () {
|
|
12005
|
-
return {
|
|
12006
|
-
data: sigmetConfig
|
|
12007
|
-
};
|
|
12008
|
-
}));
|
|
12009
|
-
case 3:
|
|
12010
|
-
case "end":
|
|
12011
|
-
return _context.stop();
|
|
12012
|
-
}
|
|
12013
|
-
}, _callee);
|
|
12014
|
-
}));
|
|
12015
|
-
function getSigmetConfiguration() {
|
|
12016
|
-
return _getSigmetConfiguration.apply(this, arguments);
|
|
12017
|
-
}
|
|
12018
|
-
return getSigmetConfiguration;
|
|
12019
|
-
}(),
|
|
12020
|
-
getAirmetConfiguration: function () {
|
|
12021
|
-
var _getAirmetConfiguration = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
12022
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
12023
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
12024
|
-
case 0:
|
|
12025
|
-
_context2.next = 2;
|
|
12026
|
-
return new Promise(function (resolve) {
|
|
12027
|
-
setTimeout(resolve, 2000);
|
|
12028
|
-
});
|
|
12029
|
-
case 2:
|
|
12030
|
-
return _context2.abrupt("return", axiosInstance.get('/airmetConfiguration').then(function () {
|
|
12031
|
-
return {
|
|
12032
|
-
data: airmetConfig
|
|
12033
|
-
};
|
|
12034
|
-
}));
|
|
12035
|
-
case 3:
|
|
12036
|
-
case "end":
|
|
12037
|
-
return _context2.stop();
|
|
12038
|
-
}
|
|
12039
|
-
}, _callee2);
|
|
12040
|
-
}));
|
|
12041
|
-
function getAirmetConfiguration() {
|
|
12042
|
-
return _getAirmetConfiguration.apply(this, arguments);
|
|
12043
|
-
}
|
|
12044
|
-
return getAirmetConfiguration;
|
|
12045
|
-
}(),
|
|
12046
|
-
getSigmetList: function getSigmetList() {
|
|
12047
|
-
return axiosInstance.get('/sigmetlist').then(function () {
|
|
12048
|
-
return {
|
|
12049
|
-
data: fakeSigmetList
|
|
12050
|
-
};
|
|
12051
|
-
});
|
|
12052
|
-
},
|
|
12053
|
-
getSigmetTAC: function getSigmetTAC(formData) {
|
|
12054
|
-
return axiosInstance.post('/sigmet2tac', formData).then(function () {
|
|
12055
|
-
return {
|
|
12056
|
-
data: fakeSigmetTAC
|
|
12057
|
-
};
|
|
12058
|
-
});
|
|
12059
|
-
},
|
|
12060
|
-
getAirmetTAC: function getAirmetTAC(formdata) {
|
|
12061
|
-
return axiosInstance.post('/airmet2tac', formdata).then(function () {
|
|
12062
|
-
return {
|
|
12063
|
-
data: fakeAirmetTAC
|
|
12064
|
-
};
|
|
12065
|
-
});
|
|
12066
|
-
},
|
|
12067
|
-
postSigmet: function postSigmet(_postSigmet) {
|
|
12068
|
-
// eslint-disable-next-line no-console
|
|
12069
|
-
console.log('form has been posted with following values:', _postSigmet.sigmet);
|
|
12070
|
-
return axiosInstance.post('/sigmet', _postSigmet);
|
|
12071
|
-
},
|
|
12072
|
-
getAirmetList: function getAirmetList() {
|
|
12073
|
-
return axiosInstance.get('/airmetlist').then(function () {
|
|
12074
|
-
return {
|
|
12075
|
-
data: fakeAirmetList
|
|
12076
|
-
};
|
|
12077
|
-
});
|
|
12078
|
-
},
|
|
12079
|
-
postAirmet: function postAirmet(_postAirmet) {
|
|
12080
|
-
// eslint-disable-next-line no-console
|
|
12081
|
-
console.log('form has been posted with following values:', _postAirmet.airmet);
|
|
12082
|
-
return axiosInstance.post('/airmet', _postAirmet);
|
|
12083
|
-
}
|
|
12084
|
-
};
|
|
12085
|
-
};
|
|
12086
|
-
var createApi = function createApi() {
|
|
12087
|
-
return getApiRoutes(createFakeApiInstance());
|
|
12088
|
-
};
|
|
12089
|
-
|
|
12090
|
-
export { AirmetComponentsLookUp, AirmetForm, AirmetType, CancelSigmetVolcanicMovements, CloudLevelUnits, DEFAULT_MINIMUM_SURFACE_LEVEL, DEFAULT_MIN_MOVEMENT_SPEED, DEFAULT_MIN_VISIBILITY, DEFAULT_MIN_WIND_SPEED, Direction, DownloadSigmetAirmetConfigWrapper, LevelUnits, MapViewGeoJson, MetInfoWrapper, MovementUnit, ProductAction, ProductFormDialog, Wrapper as ProductFormDialogContent, ProductList, ProductListRow, ProductStatusDescription, SA_NAMESPACE, SigmetComponentsLookUp, SigmetForm, SigmetType, StartOrEndDrawing, VisibilityCause, WindUnit, airmetConfig, createAirmetPostParameter, createApi$1 as createApi, createApi as createFakeApi, createSigmetPostParameter, decimalToDegreesMinutes, degreesMinutesToDecimal, extractUnitsToShow, fakeAirmetList, fakeSigmetList, findSequenceNumber, firSelectionType, getActiveFIRArea, getAllFirAreas, getAllowedUnits, getBaseLayers, getConfirmationDialogButtonLabel, getConfirmationDialogCancelLabel, getConfirmationDialogContent, getConfirmationDialogTitle, getDefaultPhenomena, getDefaultValidFromValue, getDefaultValidUntilValue, getDefaultValidityMinutesFromConfig, getDialogtitle, getDrawTools, getFieldLabel, getFir, getFirArea, getFirOptions, getHoursBeforeValidity, getLevelInFeet, getLifecycleActions, getMaxCloudLevelValue, getMaxCloudLowerLevelValue, getMaxHoursOfValidity, getMaxLevelValue, getMaxMovementSpeedValue, getMaxPolygonPoints, getMaxVisibilityValue, getMaxWindSpeedValue, getMinCloudLevelValue, getMinCloudLowerLevelValue, getMinLevelValue, getMinMovementSpeedValue, getMinVisibilityValue, getMinWindSpeedValue, getOmitChangeFromConfig, getPhenomenon, getProductFormMode, getProductIssueDate, getProjection, getSequenceStyling, getToolIcon, getValidFromDelayTimeMinutesFromConfig, getValidFromXHoursBeforeMessage, hasMaxFeaturePoints, hasValue, isFir, isInstanceOfAirmet, isInstanceOfCancelAirmet, isInstanceOfCancelSigmet, isInstanceOfCancelSigmetOrAirmet, isInstanceOfSigmet, isInstanceOfSigmetOrAirmet, isLevelLower, isVAPhenomenon, prepareCancelSigmet, prepareFormValues, prepareProductValues, sigmetAirmetTranslations as saTranslations, sigmetConfig, triggerValidations, updateDrawToolsWithFir, useDelayedFormValues, useFormLayers, useShortTestHelpers };
|
|
12084
|
+
export { AirmetComponentsLookUp, AirmetForm, AirmetType, CancelSigmetVolcanicMovements, CloudLevelUnits, DEFAULT_MINIMUM_SURFACE_LEVEL, DEFAULT_MIN_MOVEMENT_SPEED, DEFAULT_MIN_VISIBILITY, DEFAULT_MIN_WIND_SPEED, Direction, DownloadSigmetAirmetConfigWrapper, LevelUnits, MapViewGeoJson, MetInfoWrapper, MovementUnit, ProductAction, ProductFormDialog, Wrapper as ProductFormDialogContent, ProductList, ProductListRow, ProductStatusDescription, SA_NAMESPACE, SigmetComponentsLookUp, SigmetForm, SigmetType, StartOrEndDrawing, VisibilityCause, WindUnit, airmetConfig, createAirmetPostParameter, createSigmetPostParameter, extractUnitsToShow, fakeAirmetList, fakeSigmetList, findSequenceNumber, firSelectionType, getActiveFIRArea, getAllFirAreas, getAllowedUnits, getBaseLayers, getConfirmationDialogButtonLabel, getConfirmationDialogCancelLabel, getConfirmationDialogContent, getConfirmationDialogTitle, getDefaultPhenomena, getDefaultValidFromValue, getDefaultValidUntilValue, getDefaultValidityMinutesFromConfig, getDialogtitle, getDrawTools, getFieldLabel, getFir, getFirArea, getFirOptions, getHoursBeforeValidity, getLevelInFeet, getLifecycleActions, getMaxCloudLevelValue, getMaxCloudLowerLevelValue, getMaxHoursOfValidity, getMaxLevelValue, getMaxMovementSpeedValue, getMaxPolygonPoints, getMaxVisibilityValue, getMaxWindSpeedValue, getMinCloudLevelValue, getMinCloudLowerLevelValue, getMinLevelValue, getMinMovementSpeedValue, getMinVisibilityValue, getMinWindSpeedValue, getOmitChangeFromConfig, getPhenomenon, getProductFormMode, getProductIssueDate, getProjection, getSequenceStyling, getToolIcon, getValidFromDelayTimeMinutesFromConfig, getValidFromXHoursBeforeMessage, hasMaxFeaturePoints, hasValue, isFir, isInstanceOfAirmet, isInstanceOfCancelAirmet, isInstanceOfCancelSigmet, isInstanceOfCancelSigmetOrAirmet, isInstanceOfSigmet, isInstanceOfSigmetOrAirmet, isLevelLower, isVAPhenomenon, prepareCancelSigmet, prepareFormValues, prepareProductValues, sigmetAirmetTranslations as saTranslations, sigmetConfig, triggerValidations, updateDrawToolsWithFir, useDelayedFormValues, useFormLayers, useShortTestHelpers };
|