@opengeoweb/sigmet-airmet 4.15.1 → 4.17.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 +216 -110
- package/index.umd.js +227 -118
- package/lib/AirmetDemo.stories.d.ts +2 -0
- package/lib/SigmetDemo.stories.d.ts +2 -0
- package/lib/components/MetInfoWrapper/DownloadSigmetAirmetConfigWrapper.d.ts +9 -0
- package/lib/components/MetInfoWrapper/DownloadSigmetAirmetConfigWrapper.spec.d.ts +1 -0
- package/lib/components/MetInfoWrapper/MetInfoWrapper.stories.d.ts +6 -0
- package/lib/components/MetInfoWrapper/index.d.ts +1 -0
- package/lib/components/ProductForms/AirmetForm/AirmetForm.validations.spec.d.ts +1 -0
- package/lib/components/ProductForms/ProductFormDialog.actions.spec.d.ts +1 -0
- package/lib/components/ProductForms/SigmetForm/SigmetForm.validations.spec.d.ts +1 -0
- package/lib/components/ProductForms/utils.d.ts +3 -0
- package/lib/utils/api.d.ts +7 -1
- package/lib/utils/testUtils.d.ts +2 -0
- package/package.json +10 -7
- package/lib/utils/__mocks__/api.d.ts +0 -1
package/index.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import React__default from 'react';
|
|
|
3
3
|
import { Box, Button, FormControlLabel, Radio, Grid, Typography, Checkbox, MenuItem, FormHelperText, useTheme, Dialog, DialogTitle, DialogContent, Card, LinearProgress, List, ListItem, Backdrop, CircularProgress } from '@mui/material';
|
|
4
4
|
import { useFormContext } from 'react-hook-form';
|
|
5
5
|
import { useDraftFormHelpers, ReactHookFormRadioGroup, ReactHookFormSelect, ReactHookFormNumberField, isInteger, isValidMax, isValidMin, isEmpty, ReactHookFormDateTime, isValidDate, isBefore, isBetween, hasMaxFeaturePoints, hasMulitpleIntersections, ReactHookFormHiddenInput, isMaximumOneDrawing, hasIntersectionWithFIR, isValidGeoJsonCoordinates, isXHoursBefore, isAfter, isXHoursAfter, ReactHookFormTextField, isLatitude, isNonOrBothCoordinates, isLongitude, ReactHookFormFormControl, isGeometryDirty, ReactHookFormProvider, defaultFormOptions } from '@opengeoweb/form-fields';
|
|
6
|
-
import { useApiContext, createApiInstance } from '@opengeoweb/api';
|
|
6
|
+
import { useApiContext, useApi, createApiInstance, createNonAuthApiInstance } from '@opengeoweb/api';
|
|
7
7
|
import produce, { produce as produce$1 } from 'immer';
|
|
8
8
|
import * as turf from '@turf/turf';
|
|
9
9
|
import { polygonToLineString, booleanClockwise, rewind } from '@turf/turf';
|
|
@@ -15,6 +15,7 @@ import { debounce } from 'lodash';
|
|
|
15
15
|
import { useDispatch, useSelector, shallowEqual } from 'react-redux';
|
|
16
16
|
import Ajv from 'ajv';
|
|
17
17
|
import mergeAjvPatch from 'ajv-merge-patch';
|
|
18
|
+
import { Box as Box$1 } from '@mui/system';
|
|
18
19
|
|
|
19
20
|
function _typeof(obj) {
|
|
20
21
|
"@babel/helpers - typeof";
|
|
@@ -776,9 +777,17 @@ var getConfirmationDialogTitle = function getConfirmationDialogTitle(action, pro
|
|
|
776
777
|
};
|
|
777
778
|
var getConfirmationDialogContent = function getConfirmationDialogContent(action, productType) {
|
|
778
779
|
var product = productType.toUpperCase();
|
|
779
|
-
|
|
780
|
+
|
|
781
|
+
if (action === 'DISCARDED') {
|
|
782
|
+
return "Are you sure you would like to discard this ".concat(product, "? Its properties will be lost");
|
|
783
|
+
}
|
|
784
|
+
|
|
780
785
|
if (action === 'CLOSED') return 'Do you want to save any changes made?';
|
|
781
|
-
|
|
786
|
+
|
|
787
|
+
if (action === 'PUBLISHED') {
|
|
788
|
+
return "Are you sure you want to publish this ".concat(product, "?");
|
|
789
|
+
}
|
|
790
|
+
|
|
782
791
|
return "Are you sure you want to cancel this ".concat(product, "?");
|
|
783
792
|
};
|
|
784
793
|
var getConfirmationDialogButtonLabel = function getConfirmationDialogButtonLabel(action, productType) {
|
|
@@ -896,6 +905,17 @@ var getMinMovementSpeedValue = function getMinMovementSpeedValue(unit, selectedF
|
|
|
896
905
|
|
|
897
906
|
return movement_min !== undefined && movement_min[unit] ? movement_min[unit] : DEFAULT_MIN_MOVEMENT_SPEED;
|
|
898
907
|
};
|
|
908
|
+
/** Trigger form validations for given list of field names if field has a value */
|
|
909
|
+
|
|
910
|
+
var triggerValidations = function triggerValidations(fieldNames, getValues, trigger) {
|
|
911
|
+
fieldNames.forEach(function (field) {
|
|
912
|
+
var value = getValues(field);
|
|
913
|
+
|
|
914
|
+
if (value || value === 0) {
|
|
915
|
+
trigger(field);
|
|
916
|
+
}
|
|
917
|
+
});
|
|
918
|
+
};
|
|
899
919
|
|
|
900
920
|
var getDrawModeFromSelectionType = function getDrawModeFromSelectionType(selectionType) {
|
|
901
921
|
switch (selectionType) {
|
|
@@ -933,9 +953,11 @@ var addFeatureProperties = function addFeatureProperties(geojson, featurePropert
|
|
|
933
953
|
});
|
|
934
954
|
};
|
|
935
955
|
var getInitialGeoJSONState = function getInitialGeoJSONState(productConfig, currentSelectedFIR, initialGeometry) {
|
|
956
|
+
var startGeometry = initialGeometry && initialGeometry.start ? initialGeometry.start : geoJSONTemplate['BOX']['start'];
|
|
957
|
+
var endGeometry = initialGeometry && initialGeometry.end ? initialGeometry.end : geoJSONTemplate['BOX']['end'];
|
|
936
958
|
return {
|
|
937
|
-
start: addFeatureProperties(
|
|
938
|
-
end: addFeatureProperties(
|
|
959
|
+
start: addFeatureProperties(startGeometry, featurePropsStart),
|
|
960
|
+
end: addFeatureProperties(endGeometry, featurePropsEnd),
|
|
939
961
|
intersectionStart: addFeatureProperties(initialGeometry === null || initialGeometry === void 0 ? void 0 : initialGeometry.intersectionStart, featurePropsIntersectionStart),
|
|
940
962
|
intersectionEnd: addFeatureProperties(initialGeometry === null || initialGeometry === void 0 ? void 0 : initialGeometry.intersectionEnd, featurePropsIntersectionEnd),
|
|
941
963
|
fir: addFeatureProperties(getFir(productConfig, currentSelectedFIR), featurePropsFIR)
|
|
@@ -1467,6 +1489,22 @@ var DrawTools = function DrawTools(_ref) {
|
|
|
1467
1489
|
}))));
|
|
1468
1490
|
};
|
|
1469
1491
|
|
|
1492
|
+
/* *
|
|
1493
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1494
|
+
* you may not use this file except in compliance with the License.
|
|
1495
|
+
* You may obtain a copy of the License at
|
|
1496
|
+
*
|
|
1497
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1498
|
+
*
|
|
1499
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1500
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1501
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1502
|
+
* See the License for the specific language governing permissions and
|
|
1503
|
+
* limitations under the License.
|
|
1504
|
+
*
|
|
1505
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
1506
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
1507
|
+
* */
|
|
1470
1508
|
var DEFAULT_ROUNDING_LEVELS_FL = 100;
|
|
1471
1509
|
var DEFAULT_ROUNDING_LEVELS_FT = 5;
|
|
1472
1510
|
var DEFAULT_ROUNDING_LEVELS_M = 1;
|
|
@@ -1544,9 +1582,13 @@ var Levels = function Levels(_ref) {
|
|
|
1544
1582
|
isRequired = _useDraftFormHelpers.isRequired;
|
|
1545
1583
|
|
|
1546
1584
|
var levelInfoMode = watch('levelInfoMode');
|
|
1547
|
-
var selectedFIR = watch('locationIndicatorATSR'); // Get allowed level units based on selected FIR - if no FIR selected, allow all default units
|
|
1548
1585
|
|
|
1549
|
-
var
|
|
1586
|
+
var getFIRValue = function getFIRValue() {
|
|
1587
|
+
return getValues('locationIndicatorATSR');
|
|
1588
|
+
}; // Get allowed level units based on selected FIR - if no FIR selected, allow all default units
|
|
1589
|
+
|
|
1590
|
+
|
|
1591
|
+
var allowedLevelUnitsForFir = getAllowedUnits(getFIRValue(), productConfig, 'level_unit', LevelUnits);
|
|
1550
1592
|
React__default.useEffect(function () {
|
|
1551
1593
|
if (levelInfoMode !== 'BETW') {
|
|
1552
1594
|
unregister('lowerLevel');
|
|
@@ -1621,9 +1663,7 @@ var Levels = function Levels(_ref) {
|
|
|
1621
1663
|
isReadOnly: isReadOnly,
|
|
1622
1664
|
defaultValue: 'FL',
|
|
1623
1665
|
onChange: function onChange() {
|
|
1624
|
-
|
|
1625
|
-
trigger('level.value');
|
|
1626
|
-
}
|
|
1666
|
+
triggerValidations(['level.value'], getValues, trigger);
|
|
1627
1667
|
|
|
1628
1668
|
_onChange();
|
|
1629
1669
|
}
|
|
@@ -1646,17 +1686,17 @@ var Levels = function Levels(_ref) {
|
|
|
1646
1686
|
isInteger: isInteger,
|
|
1647
1687
|
max: function max(value) {
|
|
1648
1688
|
return (// The max level depends on the unit
|
|
1649
|
-
isValidMax(value, getMaxLevelValue(getValues('level.unit'),
|
|
1689
|
+
isValidMax(value, getMaxLevelValue(getValues('level.unit'), getFIRValue(), productConfig)) || "The maximum level in ".concat(LevelUnits[getValues('level.unit')], " is ").concat(getMaxLevelValue(getValues('level.unit'), getFIRValue(), productConfig))
|
|
1650
1690
|
);
|
|
1651
1691
|
},
|
|
1652
1692
|
min: function min(value) {
|
|
1653
1693
|
return (// The min level depends on the unit
|
|
1654
|
-
isValidMin(value, getMinLevelValue(getValues('level.unit'),
|
|
1694
|
+
isValidMin(value, getMinLevelValue(getValues('level.unit'), getFIRValue(), productConfig)) || "The minimum level in ".concat(LevelUnits[getValues('level.unit')], " is ").concat(getMinLevelValue(getValues('level.unit'), getFIRValue(), productConfig))
|
|
1655
1695
|
);
|
|
1656
1696
|
},
|
|
1657
1697
|
validateLevels: function validateLevels(value) {
|
|
1658
1698
|
return (// level step depends on the unit
|
|
1659
|
-
_validateLevels(value, getValues('level.unit'), productConfig,
|
|
1699
|
+
_validateLevels(value, getValues('level.unit'), productConfig, getFIRValue())
|
|
1660
1700
|
);
|
|
1661
1701
|
}
|
|
1662
1702
|
}
|
|
@@ -1701,7 +1741,7 @@ var Levels = function Levels(_ref) {
|
|
|
1701
1741
|
isReadOnly: isReadOnly,
|
|
1702
1742
|
defaultValue: 'FL',
|
|
1703
1743
|
onChange: function onChange() {
|
|
1704
|
-
|
|
1744
|
+
triggerValidations(['level.value', 'lowerLevel.value', 'lowerLevel.unit'], getValues, trigger);
|
|
1705
1745
|
|
|
1706
1746
|
_onChange();
|
|
1707
1747
|
}
|
|
@@ -1724,17 +1764,17 @@ var Levels = function Levels(_ref) {
|
|
|
1724
1764
|
isInteger: isInteger,
|
|
1725
1765
|
max: function max(value) {
|
|
1726
1766
|
return (// The max level depends on the unit
|
|
1727
|
-
isValidMax(value, getMaxLevelValue(getValues('level.unit'),
|
|
1767
|
+
isValidMax(value, getMaxLevelValue(getValues('level.unit'), getFIRValue(), productConfig)) || "The maximum level in ".concat(LevelUnits[getValues('level.unit')], " is ").concat(getMaxLevelValue(getValues('level.unit'), getFIRValue(), productConfig))
|
|
1728
1768
|
);
|
|
1729
1769
|
},
|
|
1730
1770
|
min: function min(value) {
|
|
1731
1771
|
return (// The min level depends on the unit
|
|
1732
|
-
isValidMin(value, getMinLevelValue(getValues('level.unit'),
|
|
1772
|
+
isValidMin(value, getMinLevelValue(getValues('level.unit'), getFIRValue(), productConfig)) || "The minimum level in ".concat(LevelUnits[getValues('level.unit')], " is ").concat(getMinLevelValue(getValues('level.unit'), getFIRValue(), productConfig))
|
|
1733
1773
|
);
|
|
1734
1774
|
},
|
|
1735
1775
|
validateLevels: function validateLevels(value) {
|
|
1736
1776
|
return (// level step depends on the unit
|
|
1737
|
-
_validateLevels(value, getValues('level.unit'), productConfig,
|
|
1777
|
+
_validateLevels(value, getValues('level.unit'), productConfig, getFIRValue())
|
|
1738
1778
|
);
|
|
1739
1779
|
}
|
|
1740
1780
|
}
|
|
@@ -1742,7 +1782,7 @@ var Levels = function Levels(_ref) {
|
|
|
1742
1782
|
disabled: isDisabled,
|
|
1743
1783
|
isReadOnly: isReadOnly,
|
|
1744
1784
|
onChange: function onChange() {
|
|
1745
|
-
|
|
1785
|
+
triggerValidations(['lowerLevel.value'], getValues, trigger);
|
|
1746
1786
|
},
|
|
1747
1787
|
autoFocus: true
|
|
1748
1788
|
}))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
@@ -1793,11 +1833,7 @@ var Levels = function Levels(_ref) {
|
|
|
1793
1833
|
isReadOnly: isReadOnly,
|
|
1794
1834
|
defaultValue: getValues('level.unit') || 'FL',
|
|
1795
1835
|
onChange: function onChange() {
|
|
1796
|
-
|
|
1797
|
-
trigger('lowerLevel.value');
|
|
1798
|
-
}
|
|
1799
|
-
|
|
1800
|
-
trigger('level.unit');
|
|
1836
|
+
triggerValidations(['lowerLevel.value', 'level.unit'], getValues, trigger);
|
|
1801
1837
|
|
|
1802
1838
|
_onChange();
|
|
1803
1839
|
}
|
|
@@ -1819,12 +1855,12 @@ var Levels = function Levels(_ref) {
|
|
|
1819
1855
|
isInteger: isInteger,
|
|
1820
1856
|
max: function max(value) {
|
|
1821
1857
|
return (// The max level depends on the unit
|
|
1822
|
-
isValidMax(value, getMaxLevelValue(getValues('lowerLevel.unit'),
|
|
1858
|
+
isValidMax(value, getMaxLevelValue(getValues('lowerLevel.unit'), getFIRValue(), productConfig)) || "The maximum level in ".concat(LevelUnits[getValues('lowerLevel.unit')], " is ").concat(getMaxLevelValue(getValues('lowerLevel.unit'), getFIRValue(), productConfig))
|
|
1823
1859
|
);
|
|
1824
1860
|
},
|
|
1825
1861
|
min: function min(value) {
|
|
1826
1862
|
return (// The min level depends on the unit
|
|
1827
|
-
isValidMin(value, getMinLevelValue(getValues('lowerLevel.unit'),
|
|
1863
|
+
isValidMin(value, getMinLevelValue(getValues('lowerLevel.unit'), getFIRValue(), productConfig)) || "The minimum level in ".concat(LevelUnits[getValues('lowerLevel.unit')], " is ").concat(getMinLevelValue(getValues('lowerLevel.unit'), getFIRValue(), productConfig))
|
|
1828
1864
|
);
|
|
1829
1865
|
},
|
|
1830
1866
|
isLevelLower: function isLevelLower$1(value) {
|
|
@@ -1834,7 +1870,7 @@ var Levels = function Levels(_ref) {
|
|
|
1834
1870
|
},
|
|
1835
1871
|
validateLevels: function validateLevels(value) {
|
|
1836
1872
|
return (// level step depends on the unit
|
|
1837
|
-
_validateLevels(value, getValues('lowerLevel.unit'), productConfig,
|
|
1873
|
+
_validateLevels(value, getValues('lowerLevel.unit'), productConfig, getFIRValue())
|
|
1838
1874
|
);
|
|
1839
1875
|
}
|
|
1840
1876
|
}
|
|
@@ -1887,9 +1923,7 @@ var Levels = function Levels(_ref) {
|
|
|
1887
1923
|
isReadOnly: isReadOnly,
|
|
1888
1924
|
defaultValue: 'FL',
|
|
1889
1925
|
onChange: function onChange() {
|
|
1890
|
-
|
|
1891
|
-
trigger('level.value');
|
|
1892
|
-
}
|
|
1926
|
+
triggerValidations(['level.value'], getValues, trigger);
|
|
1893
1927
|
|
|
1894
1928
|
_onChange();
|
|
1895
1929
|
}
|
|
@@ -1911,17 +1945,17 @@ var Levels = function Levels(_ref) {
|
|
|
1911
1945
|
isInteger: isInteger,
|
|
1912
1946
|
max: function max(value) {
|
|
1913
1947
|
return (// The max level depends on the unit
|
|
1914
|
-
isValidMax(value, getMaxLevelValue(getValues('level.unit'),
|
|
1948
|
+
isValidMax(value, getMaxLevelValue(getValues('level.unit'), getFIRValue(), productConfig)) || "The maximum level in ".concat(LevelUnits[getValues('level.unit')], " is ").concat(getMaxLevelValue(getValues('level.unit'), getFIRValue(), productConfig))
|
|
1915
1949
|
);
|
|
1916
1950
|
},
|
|
1917
1951
|
min: function min(value) {
|
|
1918
1952
|
return (// The min level depends on the unit
|
|
1919
|
-
isValidMin(value, getMinLevelValue(getValues('level.unit'),
|
|
1953
|
+
isValidMin(value, getMinLevelValue(getValues('level.unit'), getFIRValue(), productConfig)) || "The minimum level in ".concat(LevelUnits[getValues('level.unit')], " is ").concat(getMinLevelValue(getValues('level.unit'), getFIRValue(), productConfig))
|
|
1920
1954
|
);
|
|
1921
1955
|
},
|
|
1922
1956
|
validateLevels: function validateLevels(value) {
|
|
1923
1957
|
return (// level step depends on the unit
|
|
1924
|
-
_validateLevels(value, getValues('level.unit'), productConfig,
|
|
1958
|
+
_validateLevels(value, getValues('level.unit'), productConfig, getFIRValue())
|
|
1925
1959
|
);
|
|
1926
1960
|
}
|
|
1927
1961
|
}
|
|
@@ -1977,9 +2011,7 @@ var ObservationForecast = function ObservationForecast(_ref) {
|
|
|
1977
2011
|
}
|
|
1978
2012
|
},
|
|
1979
2013
|
onChange: function onChange() {
|
|
1980
|
-
|
|
1981
|
-
trigger('observationOrForecastTime');
|
|
1982
|
-
}
|
|
2014
|
+
triggerValidations(['observationOrForecastTime'], getValues, trigger);
|
|
1983
2015
|
},
|
|
1984
2016
|
isReadOnly: isReadOnly
|
|
1985
2017
|
}, (!isReadOnly || watch('isObservationOrForecast') === 'OBS') && /*#__PURE__*/React__default.createElement(RadioButtonAndLabel, {
|
|
@@ -2052,6 +2084,23 @@ var ObservationForecastTime = function ObservationForecastTime(_ref) {
|
|
|
2052
2084
|
})) : null;
|
|
2053
2085
|
};
|
|
2054
2086
|
|
|
2087
|
+
/* *
|
|
2088
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2089
|
+
* you may not use this file except in compliance with the License.
|
|
2090
|
+
* You may obtain a copy of the License at
|
|
2091
|
+
*
|
|
2092
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2093
|
+
*
|
|
2094
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2095
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2096
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2097
|
+
* See the License for the specific language governing permissions and
|
|
2098
|
+
* limitations under the License.
|
|
2099
|
+
*
|
|
2100
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2101
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2102
|
+
* */
|
|
2103
|
+
|
|
2055
2104
|
var Phenomenon = function Phenomenon(_ref) {
|
|
2056
2105
|
var productType = _ref.productType,
|
|
2057
2106
|
isDisabled = _ref.isDisabled,
|
|
@@ -2083,9 +2132,9 @@ var Phenomenon = function Phenomenon(_ref) {
|
|
|
2083
2132
|
setValue('movementType', null);
|
|
2084
2133
|
}
|
|
2085
2134
|
|
|
2086
|
-
|
|
2135
|
+
triggerValidations(['validDateStart', 'validDateEnd'], getValues, trigger);
|
|
2087
2136
|
|
|
2088
|
-
|
|
2137
|
+
_onChange();
|
|
2089
2138
|
},
|
|
2090
2139
|
autoFocus: true
|
|
2091
2140
|
}, Object.keys(phenomenaList).map(function (key) {
|
|
@@ -2256,9 +2305,13 @@ var Progress = function Progress(_ref) {
|
|
|
2256
2305
|
isDraft = _useDraftFormHelpers.isDraft;
|
|
2257
2306
|
|
|
2258
2307
|
var movementType = watch('movementType');
|
|
2259
|
-
var selectedFIR = watch('locationIndicatorATSR'); // Get allowed movement units based on selected FIR - if no FIR selected, allow all units
|
|
2260
2308
|
|
|
2261
|
-
var
|
|
2309
|
+
var getFIRValue = function getFIRValue() {
|
|
2310
|
+
return getValues('locationIndicatorATSR');
|
|
2311
|
+
}; // Get allowed movement units based on selected FIR - if no FIR selected, allow all units
|
|
2312
|
+
|
|
2313
|
+
|
|
2314
|
+
var allowedMovementUnitsForFir = getAllowedUnits(getFIRValue(), productConfig, 'movement_unit', MovementUnit);
|
|
2262
2315
|
React__default.useEffect(function () {
|
|
2263
2316
|
if (movementType !== 'MOVEMENT') {
|
|
2264
2317
|
unregister('movementDirection');
|
|
@@ -2348,10 +2401,7 @@ var Progress = function Progress(_ref) {
|
|
|
2348
2401
|
"data-testid": "movement-movementUnit",
|
|
2349
2402
|
onChange: function onChange(event) {
|
|
2350
2403
|
event.stopPropagation();
|
|
2351
|
-
|
|
2352
|
-
if (getValues('movementSpeed') || getValues('movementSpeed') === 0) {
|
|
2353
|
-
trigger('movementSpeed');
|
|
2354
|
-
}
|
|
2404
|
+
triggerValidations(['movementSpeed'], getValues, trigger);
|
|
2355
2405
|
|
|
2356
2406
|
_onChange();
|
|
2357
2407
|
}
|
|
@@ -2372,17 +2422,17 @@ var Progress = function Progress(_ref) {
|
|
|
2372
2422
|
isInteger: isInteger,
|
|
2373
2423
|
min: function min(value) {
|
|
2374
2424
|
return (// The max level depends on the unit
|
|
2375
|
-
isValidMin(value, getMinMovementSpeedValue(getValues('movementUnit'),
|
|
2425
|
+
isValidMin(value, getMinMovementSpeedValue(getValues('movementUnit'), getFIRValue(), productConfig)) || "The minimum level in ".concat(MovementUnit[getValues('movementUnit')], " is ").concat(getMinMovementSpeedValue(getValues('movementUnit'), getFIRValue(), productConfig))
|
|
2376
2426
|
);
|
|
2377
2427
|
},
|
|
2378
2428
|
max: function max(value) {
|
|
2379
2429
|
return (// The max level depends on the unit
|
|
2380
|
-
isValidMax(value, getMaxMovementSpeedValue(getValues('movementUnit'),
|
|
2430
|
+
isValidMax(value, getMaxMovementSpeedValue(getValues('movementUnit'), getFIRValue(), productConfig)) || "The maximum level in ".concat(MovementUnit[getValues('movementUnit')], " is ").concat(getMaxMovementSpeedValue(getValues('movementUnit'), getFIRValue(), productConfig))
|
|
2381
2431
|
);
|
|
2382
2432
|
},
|
|
2383
2433
|
validateMovementSteps: function validateMovementSteps(value) {
|
|
2384
2434
|
return (// movement step depends on the unit
|
|
2385
|
-
_validateMovementSteps(value, getValues('movementUnit'), productConfig,
|
|
2435
|
+
_validateMovementSteps(value, getValues('movementUnit'), productConfig, getFIRValue())
|
|
2386
2436
|
);
|
|
2387
2437
|
}
|
|
2388
2438
|
}
|
|
@@ -2487,7 +2537,9 @@ var SelectFIR = function SelectFIR(_ref) {
|
|
|
2487
2537
|
onChange = _ref$onChange === void 0 ? function () {} : _ref$onChange;
|
|
2488
2538
|
|
|
2489
2539
|
var _useFormContext = useFormContext(),
|
|
2490
|
-
setValue = _useFormContext.setValue
|
|
2540
|
+
setValue = _useFormContext.setValue,
|
|
2541
|
+
trigger = _useFormContext.trigger,
|
|
2542
|
+
getValues = _useFormContext.getValues;
|
|
2491
2543
|
|
|
2492
2544
|
var _useDraftFormHelpers = useDraftFormHelpers(),
|
|
2493
2545
|
isRequired = _useDraftFormHelpers.isRequired;
|
|
@@ -2508,7 +2560,10 @@ var SelectFIR = function SelectFIR(_ref) {
|
|
|
2508
2560
|
setValue('locationIndicatorATSU', valuesFromConfig.locationIndicatorATSU);
|
|
2509
2561
|
setValue('firName', valuesFromConfig.firName);
|
|
2510
2562
|
setValue('locationIndicatorMWO', valuesFromConfig.locationIndicatorMWO);
|
|
2511
|
-
setValue('firGeometry', valuesFromConfig.firGeometry);
|
|
2563
|
+
setValue('firGeometry', valuesFromConfig.firGeometry); // trigger validation for generic fields that depend on FIR config
|
|
2564
|
+
|
|
2565
|
+
var fieldnames = ['validDateStart', 'validDateEnd', 'movementSpeed', 'level.value', 'lowerLevel.value'];
|
|
2566
|
+
triggerValidations(fieldnames, getValues, trigger);
|
|
2512
2567
|
onChange(changeEvent);
|
|
2513
2568
|
};
|
|
2514
2569
|
|
|
@@ -2667,13 +2722,7 @@ var ValidFrom = function ValidFrom(_ref) {
|
|
|
2667
2722
|
}
|
|
2668
2723
|
},
|
|
2669
2724
|
onChange: function onChange() {
|
|
2670
|
-
|
|
2671
|
-
trigger('validDateEnd');
|
|
2672
|
-
}
|
|
2673
|
-
|
|
2674
|
-
if (getValues('observationOrForecastTime')) {
|
|
2675
|
-
trigger('observationOrForecastTime');
|
|
2676
|
-
}
|
|
2725
|
+
triggerValidations(['validDateEnd', 'observationOrForecastTime'], getValues, trigger);
|
|
2677
2726
|
|
|
2678
2727
|
_onChange();
|
|
2679
2728
|
},
|
|
@@ -2744,13 +2793,7 @@ var ValidUntil = function ValidUntil(_ref) {
|
|
|
2744
2793
|
disabled: isDisabled,
|
|
2745
2794
|
isReadOnly: isReadOnly,
|
|
2746
2795
|
onChange: function onChange() {
|
|
2747
|
-
|
|
2748
|
-
trigger('validDateStart');
|
|
2749
|
-
}
|
|
2750
|
-
|
|
2751
|
-
if (getValues('observationOrForecastTime')) {
|
|
2752
|
-
trigger('observationOrForecastTime');
|
|
2753
|
-
}
|
|
2796
|
+
triggerValidations(['validDateStart', 'observationOrForecastTime'], getValues, trigger);
|
|
2754
2797
|
|
|
2755
2798
|
_onChange();
|
|
2756
2799
|
}
|
|
@@ -2920,9 +2963,12 @@ var SurfaceVisibility = function SurfaceVisibility(_ref) {
|
|
|
2920
2963
|
isRequired = _useDraftFormHelpers.isRequired;
|
|
2921
2964
|
|
|
2922
2965
|
var _useFormContext = useFormContext(),
|
|
2923
|
-
|
|
2966
|
+
getValues = _useFormContext.getValues;
|
|
2967
|
+
|
|
2968
|
+
var getFIRValue = function getFIRValue() {
|
|
2969
|
+
return getValues('locationIndicatorATSR');
|
|
2970
|
+
};
|
|
2924
2971
|
|
|
2925
|
-
var selectedFIR = watch('locationIndicatorATSR');
|
|
2926
2972
|
var visibilityLabel = getFieldLabel('Visibility', isReadOnly);
|
|
2927
2973
|
var visibilityCauseLabel = getFieldLabel('Cause', isReadOnly);
|
|
2928
2974
|
return /*#__PURE__*/React__default.createElement(Grid, {
|
|
@@ -2953,16 +2999,16 @@ var SurfaceVisibility = function SurfaceVisibility(_ref) {
|
|
|
2953
2999
|
isRequired: isRequired,
|
|
2954
3000
|
min: function min(value) {
|
|
2955
3001
|
return (// The min level depends on the unit
|
|
2956
|
-
isValidMin(value, getMinVisibilityValue(
|
|
3002
|
+
isValidMin(value, getMinVisibilityValue(getFIRValue(), productConfig)) || "The minimum visibility in meters is ".concat(getMinVisibilityValue(getFIRValue(), productConfig))
|
|
2957
3003
|
);
|
|
2958
3004
|
},
|
|
2959
3005
|
max: function max(value) {
|
|
2960
3006
|
return (// The max level depends on the unit
|
|
2961
|
-
isValidMax(value, getMaxVisibilityValue(
|
|
3007
|
+
isValidMax(value, getMaxVisibilityValue(getFIRValue(), productConfig)) || "The maximum visibility in meters is ".concat(getMaxVisibilityValue(getFIRValue(), productConfig))
|
|
2962
3008
|
);
|
|
2963
3009
|
},
|
|
2964
3010
|
validateSurfaceVisibility: function validateSurfaceVisibility(value) {
|
|
2965
|
-
return _validateSurfaceVisibility(value, productConfig,
|
|
3011
|
+
return _validateSurfaceVisibility(value, productConfig, getFIRValue());
|
|
2966
3012
|
}
|
|
2967
3013
|
}
|
|
2968
3014
|
},
|
|
@@ -3040,15 +3086,17 @@ var SurfaceWind = function SurfaceWind(_ref) {
|
|
|
3040
3086
|
|
|
3041
3087
|
var _useFormContext = useFormContext(),
|
|
3042
3088
|
trigger = _useFormContext.trigger,
|
|
3043
|
-
getValues = _useFormContext.getValues
|
|
3044
|
-
watch = _useFormContext.watch;
|
|
3089
|
+
getValues = _useFormContext.getValues;
|
|
3045
3090
|
|
|
3046
3091
|
var _useDraftFormHelpers = useDraftFormHelpers(),
|
|
3047
3092
|
isRequired = _useDraftFormHelpers.isRequired;
|
|
3048
3093
|
|
|
3049
|
-
var
|
|
3094
|
+
var getFIRValue = function getFIRValue() {
|
|
3095
|
+
return getValues('locationIndicatorATSR');
|
|
3096
|
+
}; // Get allowed speed units based on selected FIR - if no FIR selected, allow all units
|
|
3097
|
+
|
|
3050
3098
|
|
|
3051
|
-
var allowedWindUnitsForFir = getAllowedUnits(
|
|
3099
|
+
var allowedWindUnitsForFir = getAllowedUnits(getFIRValue(), productConfig, 'surfacewind_unit', WindUnit);
|
|
3052
3100
|
var windLabel = getFieldLabel('Wind direction', isReadOnly, 'Set');
|
|
3053
3101
|
var speedLabel = getFieldLabel('Speed', isReadOnly, 'Set');
|
|
3054
3102
|
return /*#__PURE__*/React__default.createElement(Grid, {
|
|
@@ -3085,7 +3133,7 @@ var SurfaceWind = function SurfaceWind(_ref) {
|
|
|
3085
3133
|
validate: {
|
|
3086
3134
|
isRequired: isRequired,
|
|
3087
3135
|
validateSurfaceWindDirection: function validateSurfaceWindDirection(value) {
|
|
3088
|
-
return _validateSurfaceWindDirection(value, productConfig,
|
|
3136
|
+
return _validateSurfaceWindDirection(value, productConfig, getFIRValue());
|
|
3089
3137
|
}
|
|
3090
3138
|
}
|
|
3091
3139
|
},
|
|
@@ -3113,9 +3161,7 @@ var SurfaceWind = function SurfaceWind(_ref) {
|
|
|
3113
3161
|
defaultValue: 'KT',
|
|
3114
3162
|
"data-testid": "surfaceWind-windUnit",
|
|
3115
3163
|
onChange: function onChange() {
|
|
3116
|
-
|
|
3117
|
-
trigger('windSpeed');
|
|
3118
|
-
}
|
|
3164
|
+
triggerValidations(['windSpeed'], getValues, trigger);
|
|
3119
3165
|
|
|
3120
3166
|
_onChange();
|
|
3121
3167
|
}
|
|
@@ -3136,12 +3182,12 @@ var SurfaceWind = function SurfaceWind(_ref) {
|
|
|
3136
3182
|
isInteger: isInteger,
|
|
3137
3183
|
min: function min(value) {
|
|
3138
3184
|
return (// The min level depends on the unit
|
|
3139
|
-
isValidMin(value, getMinWindSpeedValue(getValues('windUnit'),
|
|
3185
|
+
isValidMin(value, getMinWindSpeedValue(getValues('windUnit'), getFIRValue(), productConfig)) || "The minimum wind speed in ".concat(WindUnit[getValues('windUnit')], " is ").concat(getMinWindSpeedValue(getValues('windUnit'), getFIRValue(), productConfig))
|
|
3140
3186
|
);
|
|
3141
3187
|
},
|
|
3142
3188
|
max: function max(value) {
|
|
3143
3189
|
return (// The max level depends on the unit
|
|
3144
|
-
isValidMax(value, getMaxWindSpeedValue(getValues('windUnit'),
|
|
3190
|
+
isValidMax(value, getMaxWindSpeedValue(getValues('windUnit'), getFIRValue(), productConfig)) || "The maximum wind speed in ".concat(WindUnit[getValues('windUnit')], " is ").concat(getMaxWindSpeedValue(getValues('windUnit'), getFIRValue(), productConfig))
|
|
3145
3191
|
);
|
|
3146
3192
|
}
|
|
3147
3193
|
}
|
|
@@ -3229,10 +3275,13 @@ var CloudLevels = function CloudLevels(_ref) {
|
|
|
3229
3275
|
var _useDraftFormHelpers = useDraftFormHelpers(),
|
|
3230
3276
|
isRequired = _useDraftFormHelpers.isRequired;
|
|
3231
3277
|
|
|
3232
|
-
var
|
|
3278
|
+
var getFIRValue = function getFIRValue() {
|
|
3279
|
+
return getValues('locationIndicatorATSR');
|
|
3280
|
+
};
|
|
3281
|
+
|
|
3233
3282
|
var cloudLevelInfoMode = watch('cloudLevelInfoMode'); // Get allowed cloud level units based on selected FIR - if no FIR selected, allow all default units
|
|
3234
3283
|
|
|
3235
|
-
var allowedCloudLevelUnitsForFir = getAllowedUnits(
|
|
3284
|
+
var allowedCloudLevelUnitsForFir = getAllowedUnits(getFIRValue(), productConfig, 'cloud_level_unit', CloudLevelUnits);
|
|
3236
3285
|
React__default.useEffect(function () {
|
|
3237
3286
|
if (cloudLevelInfoMode === 'BETW_SFC' || cloudLevelInfoMode === 'BETW_SFC_ABV') {
|
|
3238
3287
|
unregister('cloudLowerLevel');
|
|
@@ -3325,16 +3374,9 @@ var CloudLevels = function CloudLevels(_ref) {
|
|
|
3325
3374
|
isReadOnly: isReadOnly,
|
|
3326
3375
|
defaultValue: 'FT',
|
|
3327
3376
|
onChange: function onChange() {
|
|
3328
|
-
|
|
3329
|
-
trigger('cloudLevel.value');
|
|
3330
|
-
} // Unit change is reflected in the Lower Cloud Level
|
|
3331
|
-
|
|
3332
|
-
|
|
3377
|
+
// Unit change is reflected in the Lower Cloud Level
|
|
3333
3378
|
setValue('cloudLowerLevel.unit', getValues('cloudLevel.unit'));
|
|
3334
|
-
|
|
3335
|
-
if (getValues('cloudLowerLevel.value') || getValues('cloudLowerLevel.value') === 0) {
|
|
3336
|
-
trigger('cloudLowerLevel.value');
|
|
3337
|
-
}
|
|
3379
|
+
triggerValidations(['cloudLevel.value', 'cloudLowerLevel.value'], getValues, trigger);
|
|
3338
3380
|
|
|
3339
3381
|
_onChange();
|
|
3340
3382
|
}
|
|
@@ -3357,23 +3399,23 @@ var CloudLevels = function CloudLevels(_ref) {
|
|
|
3357
3399
|
isInteger: isInteger,
|
|
3358
3400
|
min: function min(value) {
|
|
3359
3401
|
return (// The min level depends on the unit
|
|
3360
|
-
isValidMin(value, getMinCloudLevelValue(getValues('cloudLevel.unit'),
|
|
3402
|
+
isValidMin(value, getMinCloudLevelValue(getValues('cloudLevel.unit'), getFIRValue(), productConfig)) || "The minimum level in ".concat(CloudLevelUnits[getValues('cloudLevel.unit')], " is ").concat(getMinCloudLevelValue(getValues('cloudLevel.unit'), getFIRValue(), productConfig))
|
|
3361
3403
|
);
|
|
3362
3404
|
},
|
|
3363
3405
|
max: function max(value) {
|
|
3364
3406
|
return (// The max level depends on the unit
|
|
3365
|
-
isValidMax(value, getMaxCloudLevelValue(getValues('cloudLevel.unit'),
|
|
3407
|
+
isValidMax(value, getMaxCloudLevelValue(getValues('cloudLevel.unit'), getFIRValue(), productConfig)) || "The maximum level in ".concat(CloudLevelUnits[getValues('cloudLevel.unit')], " is ").concat(getMaxCloudLevelValue(getValues('cloudLevel.unit'), getFIRValue(), productConfig))
|
|
3366
3408
|
);
|
|
3367
3409
|
},
|
|
3368
3410
|
step: function step(value) {
|
|
3369
|
-
return validateRoundedStep(value, getValues('cloudLevel.unit'), productConfig,
|
|
3411
|
+
return validateRoundedStep(value, getValues('cloudLevel.unit'), productConfig, getFIRValue());
|
|
3370
3412
|
}
|
|
3371
3413
|
}
|
|
3372
3414
|
},
|
|
3373
3415
|
disabled: isDisabled,
|
|
3374
3416
|
isReadOnly: isReadOnly,
|
|
3375
3417
|
onChange: function onChange() {
|
|
3376
|
-
|
|
3418
|
+
triggerValidations(['cloudLowerLevel.value'], getValues, trigger);
|
|
3377
3419
|
}
|
|
3378
3420
|
}))), /*#__PURE__*/React__default.createElement(Grid, {
|
|
3379
3421
|
item: true,
|
|
@@ -3438,16 +3480,9 @@ var CloudLevels = function CloudLevels(_ref) {
|
|
|
3438
3480
|
isReadOnly: isReadOnly,
|
|
3439
3481
|
defaultValue: getValues('cloudLevel.unit') ? getValues('cloudLevel.unit') : 'FT',
|
|
3440
3482
|
onChange: function onChange() {
|
|
3441
|
-
|
|
3442
|
-
trigger('cloudLowerLevel.value');
|
|
3443
|
-
} // Unit change is reflected in the Upper Cloud Level
|
|
3444
|
-
|
|
3445
|
-
|
|
3483
|
+
// Unit change is reflected in the Upper Cloud Level
|
|
3446
3484
|
setValue('cloudLevel.unit', getValues('cloudLowerLevel.unit'));
|
|
3447
|
-
|
|
3448
|
-
if (getValues('cloudLevel.value') || getValues('cloudLevel.value') === 0) {
|
|
3449
|
-
trigger('cloudLevel.value');
|
|
3450
|
-
}
|
|
3485
|
+
triggerValidations(['cloudLowerLevel.value', 'cloudLevel.value'], getValues, trigger);
|
|
3451
3486
|
|
|
3452
3487
|
_onChange();
|
|
3453
3488
|
}
|
|
@@ -3469,12 +3504,12 @@ var CloudLevels = function CloudLevels(_ref) {
|
|
|
3469
3504
|
isInteger: isInteger,
|
|
3470
3505
|
min: function min(value) {
|
|
3471
3506
|
return (// The min level depends on the unit
|
|
3472
|
-
isValidMin(value, getMinCloudLowerLevelValue(getValues('cloudLowerLevel.unit'),
|
|
3507
|
+
isValidMin(value, getMinCloudLowerLevelValue(getValues('cloudLowerLevel.unit'), getFIRValue(), productConfig)) || "The minimum level in ".concat(CloudLevelUnits[getValues('cloudLowerLevel.unit')], " is ").concat(getMinCloudLowerLevelValue(getValues('cloudLowerLevel.unit'), getFIRValue(), productConfig))
|
|
3473
3508
|
);
|
|
3474
3509
|
},
|
|
3475
3510
|
max: function max(value) {
|
|
3476
3511
|
return (// The max level depends on the unit
|
|
3477
|
-
isValidMax(value, getMaxCloudLowerLevelValue(getValues('cloudLowerLevel.unit'),
|
|
3512
|
+
isValidMax(value, getMaxCloudLowerLevelValue(getValues('cloudLowerLevel.unit'), getFIRValue(), productConfig)) || "The maximum level in ".concat(CloudLevelUnits[getValues('cloudLowerLevel.unit')], " is ").concat(getMaxCloudLowerLevelValue(getValues('cloudLowerLevel.unit'), getFIRValue(), productConfig))
|
|
3478
3513
|
);
|
|
3479
3514
|
},
|
|
3480
3515
|
isLevelLower: function isLevelLower$1(value) {
|
|
@@ -3483,7 +3518,7 @@ var CloudLevels = function CloudLevels(_ref) {
|
|
|
3483
3518
|
);
|
|
3484
3519
|
},
|
|
3485
3520
|
step: function step(value) {
|
|
3486
|
-
return validateRoundedStep(value, getValues('cloudLowerLevel.unit'), productConfig,
|
|
3521
|
+
return validateRoundedStep(value, getValues('cloudLowerLevel.unit'), productConfig, getFIRValue());
|
|
3487
3522
|
}
|
|
3488
3523
|
}
|
|
3489
3524
|
},
|
|
@@ -8271,7 +8306,8 @@ var AirmetForm = function AirmetForm(_ref) {
|
|
|
8271
8306
|
watch = _useFormContext2.watch,
|
|
8272
8307
|
setValue = _useFormContext2.setValue,
|
|
8273
8308
|
handleSubmit = _useFormContext2.handleSubmit,
|
|
8274
|
-
getValues = _useFormContext2.getValues
|
|
8309
|
+
getValues = _useFormContext2.getValues,
|
|
8310
|
+
trigger = _useFormContext2.trigger;
|
|
8275
8311
|
|
|
8276
8312
|
var _React$useState = React__default.useState(mode === 'view'),
|
|
8277
8313
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
@@ -8387,7 +8423,11 @@ var AirmetForm = function AirmetForm(_ref) {
|
|
|
8387
8423
|
return updateStartDrawing(updatedGeoJson);
|
|
8388
8424
|
});
|
|
8389
8425
|
|
|
8390
|
-
_setLayerGeoJSONs(updatedGeoJson);
|
|
8426
|
+
_setLayerGeoJSONs(updatedGeoJson); // trigger validation for airmet specific fields that depend on FIR config
|
|
8427
|
+
|
|
8428
|
+
|
|
8429
|
+
var fieldnames = ['windDirection', 'windSpeed', 'visibilityValue', 'cloudLevel.value', 'cloudLowerLevel.value'];
|
|
8430
|
+
triggerValidations(fieldnames, getValues, trigger);
|
|
8391
8431
|
}
|
|
8392
8432
|
}), /*#__PURE__*/React__default.createElement(StartGeometry, {
|
|
8393
8433
|
isReadOnly: isReadOnly,
|
|
@@ -9430,7 +9470,9 @@ var MetInfoWrapper = function MetInfoWrapper(_ref) {
|
|
|
9430
9470
|
toggleDialogOpen();
|
|
9431
9471
|
};
|
|
9432
9472
|
|
|
9433
|
-
return /*#__PURE__*/React__default.createElement(
|
|
9473
|
+
return /*#__PURE__*/React__default.createElement(Box$1, {
|
|
9474
|
+
"data-testid": "sigmetAirmetComponent"
|
|
9475
|
+
}, /*#__PURE__*/React__default.createElement(ProductList, {
|
|
9434
9476
|
productList: productList,
|
|
9435
9477
|
productType: productType,
|
|
9436
9478
|
isLoading: isLoadingList,
|
|
@@ -9446,6 +9488,63 @@ var MetInfoWrapper = function MetInfoWrapper(_ref) {
|
|
|
9446
9488
|
}));
|
|
9447
9489
|
};
|
|
9448
9490
|
|
|
9491
|
+
/* *
|
|
9492
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9493
|
+
* you may not use this file except in compliance with the License.
|
|
9494
|
+
* You may obtain a copy of the License at
|
|
9495
|
+
*
|
|
9496
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9497
|
+
*
|
|
9498
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
9499
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
9500
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9501
|
+
* See the License for the specific language governing permissions and
|
|
9502
|
+
* limitations under the License.
|
|
9503
|
+
*
|
|
9504
|
+
* Copyright 2023 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
9505
|
+
* Copyright 2023 - Finnish Meteorological Institute (FMI)
|
|
9506
|
+
* */
|
|
9507
|
+
var ERROR_TITLE = 'Something went wrong with loading the configuration file';
|
|
9508
|
+
|
|
9509
|
+
var DownloadSigmetAirmetConfigWrapper = function DownloadSigmetAirmetConfigWrapper(_ref) {
|
|
9510
|
+
var productType = _ref.productType,
|
|
9511
|
+
config = _ref.config;
|
|
9512
|
+
|
|
9513
|
+
var _useApiContext = useApiContext(),
|
|
9514
|
+
api = _useApiContext.api;
|
|
9515
|
+
|
|
9516
|
+
var getConfigurationRequest = api[productType === 'sigmet' ? 'getSigmetConfiguration' : 'getAirmetConfiguration'];
|
|
9517
|
+
|
|
9518
|
+
var _useApi = useApi(getConfigurationRequest, config),
|
|
9519
|
+
productConfig = _useApi.result,
|
|
9520
|
+
isConfigLoading = _useApi.isLoading,
|
|
9521
|
+
error = _useApi.error;
|
|
9522
|
+
|
|
9523
|
+
if (isConfigLoading) {
|
|
9524
|
+
return /*#__PURE__*/React__default.createElement(Box$1, {
|
|
9525
|
+
sx: {
|
|
9526
|
+
display: 'flex',
|
|
9527
|
+
justifyContent: 'center',
|
|
9528
|
+
alignItems: 'center'
|
|
9529
|
+
}
|
|
9530
|
+
}, /*#__PURE__*/React__default.createElement(CircularProgress, {
|
|
9531
|
+
"data-testid": "loadingSpinner"
|
|
9532
|
+
}));
|
|
9533
|
+
}
|
|
9534
|
+
|
|
9535
|
+
if (error) {
|
|
9536
|
+
return /*#__PURE__*/React__default.createElement(AlertBanner, {
|
|
9537
|
+
title: ERROR_TITLE,
|
|
9538
|
+
info: error.message
|
|
9539
|
+
});
|
|
9540
|
+
}
|
|
9541
|
+
|
|
9542
|
+
return /*#__PURE__*/React__default.createElement(MetInfoWrapper, {
|
|
9543
|
+
productType: productType,
|
|
9544
|
+
productConfig: productConfig
|
|
9545
|
+
});
|
|
9546
|
+
};
|
|
9547
|
+
|
|
9449
9548
|
/* *
|
|
9450
9549
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9451
9550
|
* you may not use this file except in compliance with the License.
|
|
@@ -9463,8 +9562,11 @@ var MetInfoWrapper = function MetInfoWrapper(_ref) {
|
|
|
9463
9562
|
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
9464
9563
|
* */
|
|
9465
9564
|
|
|
9466
|
-
var getApiRoutes = function getApiRoutes(axiosInstance) {
|
|
9565
|
+
var getApiRoutes = function getApiRoutes(axiosInstance, nonAuthAxiosInstance) {
|
|
9467
9566
|
return {
|
|
9567
|
+
getSigmetConfiguration: function getSigmetConfiguration(config) {
|
|
9568
|
+
return nonAuthAxiosInstance.get("/assets/".concat(config.GW_FEATURE_MODULE_SIGMET_CONFIGURATION));
|
|
9569
|
+
},
|
|
9468
9570
|
getSigmetList: function getSigmetList() {
|
|
9469
9571
|
return axiosInstance.get('/sigmetlist');
|
|
9470
9572
|
},
|
|
@@ -9474,6 +9576,9 @@ var getApiRoutes = function getApiRoutes(axiosInstance) {
|
|
|
9474
9576
|
getSigmetTAC: function getSigmetTAC(sigmetData) {
|
|
9475
9577
|
return axiosInstance.post('/sigmet2tac', Object.assign({}, sigmetData));
|
|
9476
9578
|
},
|
|
9579
|
+
getAirmetConfiguration: function getAirmetConfiguration(config) {
|
|
9580
|
+
return nonAuthAxiosInstance.get("/assets/".concat(config.GW_FEATURE_MODULE_AIRMET_CONFIGURATION));
|
|
9581
|
+
},
|
|
9477
9582
|
getAirmetList: function getAirmetList() {
|
|
9478
9583
|
return axiosInstance.get('/airmetlist');
|
|
9479
9584
|
},
|
|
@@ -9488,7 +9593,8 @@ var getApiRoutes = function getApiRoutes(axiosInstance) {
|
|
|
9488
9593
|
|
|
9489
9594
|
var createApi = function createApi(props) {
|
|
9490
9595
|
var axiosInstance = createApiInstance(props);
|
|
9491
|
-
|
|
9596
|
+
var nonAuthAxiosInstance = createNonAuthApiInstance({});
|
|
9597
|
+
return getApiRoutes(axiosInstance, nonAuthAxiosInstance);
|
|
9492
9598
|
};
|
|
9493
9599
|
|
|
9494
|
-
export { AirmetForm, AirmetPhenomena, CloudLevelUnits, ContentDialog, Direction, LevelUnits, MapDrawMode, MapViewGeoJson, MetInfoWrapper, MovementUnit, ProductList, ProductListRow, ProductStatusDescription, SigmetForm, SigmetPhenomena, StartOrEndDrawing, VisibilityCause, WindUnit, createApi, isInstanceOfAirmet, isInstanceOfCancelAirmet, isInstanceOfCancelSigmet, isInstanceOfCancelSigmetOrAirmet, isInstanceOfSigmet, isInstanceOfSigmetOrAirmet };
|
|
9600
|
+
export { AirmetForm, AirmetPhenomena, CloudLevelUnits, ContentDialog, Direction, DownloadSigmetAirmetConfigWrapper, LevelUnits, MapDrawMode, MapViewGeoJson, MetInfoWrapper, MovementUnit, ProductList, ProductListRow, ProductStatusDescription, SigmetForm, SigmetPhenomena, StartOrEndDrawing, VisibilityCause, WindUnit, createApi, isInstanceOfAirmet, isInstanceOfCancelAirmet, isInstanceOfCancelSigmet, isInstanceOfCancelSigmetOrAirmet, isInstanceOfSigmet, isInstanceOfSigmetOrAirmet };
|