@opengeoweb/time-series 13.2.1 → 14.0.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 +695 -689
- package/package.json +10 -10
- package/src/lib/components/TimeSeries/types.d.ts +34 -29
- package/src/lib/components/TimeSeries/utils.d.ts +17 -11
- package/src/lib/components/TimeSeriesManager/ParameterInfo/ParameterInfoDialog.d.ts +12 -8
- package/src/lib/components/TimeSeriesSelect/TimeSeriesSelectList.d.ts +4 -4
- package/src/lib/components/TimeSeriesSelect/TimeSeriesSelectListConnect.d.ts +1 -0
- package/src/lib/components/TimeSeriesSelect/utils.d.ts +4 -3
- package/src/lib/utils/edrUtils.d.ts +6 -9
- package/src/lib/utils/timeseries-api/api.d.ts +7 -5
- package/src/lib/utils/timeseries-api/hooks.d.ts +44 -7
package/index.esm.js
CHANGED
|
@@ -6,7 +6,7 @@ import { mapUtils, selectorMemoizationOptions, genericSelectors, uiSelectors, ui
|
|
|
6
6
|
import { snackbarActions, snackbarTypes, snackbarListener, snackbarReducer } from '@opengeoweb/snackbar';
|
|
7
7
|
import { dateUtils, CustomTooltip, CustomToggleButton, TooltipSelect, CustomIconButton, CustomAccordion, ToolContainerDraggable, SearchHighlight, SearchField, ToggleMenu, CustomDialog, AlertBanner, useConfirmationDialog, SwitchButton } from '@opengeoweb/shared';
|
|
8
8
|
import { MenuItem, useTheme, LinearProgress, Grid, Box, Typography, ClickAwayListener, Input, Collapse, ListItem, ListItemButton, ListItemText, List, Button, InputAdornment, Card, styled, Stack, Tooltip, ListItemIcon, Checkbox } from '@mui/material';
|
|
9
|
-
import { trim, trimStart,
|
|
9
|
+
import { isString, trim, trimStart, compact, chain, groupBy, sortBy, uniqBy, isEqual } from 'lodash';
|
|
10
10
|
import { ReactSortable } from 'react-sortablejs';
|
|
11
11
|
import i18n from 'i18next';
|
|
12
12
|
import { useTranslation } from 'react-i18next';
|
|
@@ -17,10 +17,10 @@ import { produce } from 'immer';
|
|
|
17
17
|
import { v4 } from 'uuid';
|
|
18
18
|
import * as turf from '@turf/turf';
|
|
19
19
|
import { MapFeatureClass } from '@opengeoweb/webmap-react';
|
|
20
|
-
import { useQueries, useQuery } from '@tanstack/react-query';
|
|
20
|
+
import { useQueries, useQueryClient, useQuery, queryOptions } from '@tanstack/react-query';
|
|
21
21
|
import { handleResponse } from '@opengeoweb/api';
|
|
22
|
-
import { VariableSizeList, FixedSizeList } from 'react-window';
|
|
23
22
|
import AutoSizer from 'react-virtualized-auto-sizer';
|
|
23
|
+
import { VariableSizeList, FixedSizeList } from 'react-window';
|
|
24
24
|
import { ReactHookFormProvider, defaultFormOptions, ReactHookFormTextField, ReactHookFormSelect } from '@opengeoweb/form-fields';
|
|
25
25
|
import { useFormContext } from 'react-hook-form';
|
|
26
26
|
import Box$1 from '@mui/material/Box';
|
|
@@ -50,6 +50,7 @@ var en = {
|
|
|
50
50
|
"timeseries-dimension": "Dimension",
|
|
51
51
|
"timeseries-dimension-id": "Dimension ID",
|
|
52
52
|
"timeseries-dimension-value": "Dimension value",
|
|
53
|
+
"timeseries-dimension-none": "None",
|
|
53
54
|
"timeseries-reference-time": "Reference Time",
|
|
54
55
|
"timeseries-type": "Type",
|
|
55
56
|
"timeseries-line": "Line",
|
|
@@ -102,6 +103,7 @@ var en = {
|
|
|
102
103
|
"timeseries-service-saved-successfully": "Service \"{{ service }}\" has been saved succesfully",
|
|
103
104
|
"timeseries-info-title": "TS Info",
|
|
104
105
|
"timeseries-info-name": "Name",
|
|
106
|
+
"timeseries-info-label": "Label",
|
|
105
107
|
"timeseries-info-service": "Service",
|
|
106
108
|
"timeseries-info-service-url": "Service URL",
|
|
107
109
|
"timeseries-info-service-type": "Service type",
|
|
@@ -377,6 +379,7 @@ var nl = {
|
|
|
377
379
|
"timeseries-dimension": "Dimensie",
|
|
378
380
|
"timeseries-dimension-id": "Dimensie ID",
|
|
379
381
|
"timeseries-dimension-value": "Dimensie waarde",
|
|
382
|
+
"timeseries-dimension-none": "Geen",
|
|
380
383
|
"timeseries-reference-time": "Referentie Tijd",
|
|
381
384
|
"timeseries-type": "Type",
|
|
382
385
|
"timeseries-line": "Lijn",
|
|
@@ -429,6 +432,7 @@ var nl = {
|
|
|
429
432
|
"timeseries-service-saved-successfully": "Service \"{{ service }}\" is succesvol opgeslagen",
|
|
430
433
|
"timeseries-info-title": "TS Info",
|
|
431
434
|
"timeseries-info-name": "Naam",
|
|
435
|
+
"timeseries-info-label": "Label",
|
|
432
436
|
"timeseries-info-service": "Service",
|
|
433
437
|
"timeseries-info-service-type": "Service type",
|
|
434
438
|
"timeseries-info-service-url": "Service URL",
|
|
@@ -911,22 +915,14 @@ var createUrl = function createUrl(baseUrl, pathToAdd, queryParameters) {
|
|
|
911
915
|
return urlObject.toString();
|
|
912
916
|
};
|
|
913
917
|
var supportedOutputFormat = 'CoverageJSON';
|
|
914
|
-
var getBaseQueryParamArray = function getBaseQueryParamArray(parameter, instance, collection,
|
|
915
|
-
var _instance$extent, _collection$
|
|
916
|
-
if (clipInterval === void 0) {
|
|
917
|
-
clipInterval = [1 * 24, 10 * 24];
|
|
918
|
-
}
|
|
918
|
+
var getBaseQueryParamArray = function getBaseQueryParamArray(parameter, instance, collection, intervalParam) {
|
|
919
|
+
var _instance$extent, _collection$extent;
|
|
919
920
|
var res = [];
|
|
920
921
|
res.push(['parameter-name', parameter.propertyName]);
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
var _clipEdrInterval = clipEdrInterval(interval, clipInterval[0], clipInterval[1]),
|
|
924
|
-
start = _clipEdrInterval[0],
|
|
925
|
-
end = _clipEdrInterval[1];
|
|
926
|
-
if (interval != null && interval.length) {
|
|
927
|
-
res.push(['datetime', start + "/" + end]);
|
|
922
|
+
if (intervalParam) {
|
|
923
|
+
res.push(['datetime', intervalParam]);
|
|
928
924
|
}
|
|
929
|
-
var crs = ((_instance$
|
|
925
|
+
var crs = ((_instance$extent = instance.extent) == null ? void 0 : _instance$extent.spatial.crs) || ((_collection$extent = collection.extent) == null || (_collection$extent = _collection$extent.spatial) == null ? void 0 : _collection$extent.crs);
|
|
930
926
|
if (crs) {
|
|
931
927
|
res.push(['crs', crs]);
|
|
932
928
|
}
|
|
@@ -998,73 +994,45 @@ var constructParameterObject = function constructParameterObject(serviceId, coll
|
|
|
998
994
|
return Object.keys(parametersById).map(function (parameterId) {
|
|
999
995
|
var _parameter$unit$label, _parameter$unit, _COLOR_MAP$parameter$;
|
|
1000
996
|
var parameter = parametersById[parameterId];
|
|
1001
|
-
return {
|
|
997
|
+
return Object.assign({
|
|
1002
998
|
plotType: 'line',
|
|
1003
|
-
propertyName: parameter.id || parameterId
|
|
999
|
+
propertyName: parameter.id || parameterId
|
|
1000
|
+
}, parameter != null && parameter.label ? {
|
|
1001
|
+
propertyLabel: parameter == null ? void 0 : parameter.label
|
|
1002
|
+
} : {}, {
|
|
1004
1003
|
unit: (_parameter$unit$label = (_parameter$unit = parameter.unit) == null ? void 0 : _parameter$unit.label) != null ? _parameter$unit$label : ' ',
|
|
1005
1004
|
serviceId: serviceId,
|
|
1006
1005
|
collectionId: collectionId,
|
|
1007
1006
|
color: (_COLOR_MAP$parameter$ = COLOR_MAP[parameter.id]) != null ? _COLOR_MAP$parameter$ : 'A',
|
|
1008
1007
|
opacity: 70
|
|
1009
|
-
};
|
|
1008
|
+
});
|
|
1010
1009
|
});
|
|
1011
1010
|
};
|
|
1012
|
-
var
|
|
1011
|
+
var getCollectionDetails = function getCollectionDetails(service, collection, instances) {
|
|
1012
|
+
var _collection$extent2;
|
|
1013
|
+
return Object.assign({
|
|
1014
|
+
serviceId: service.id,
|
|
1015
|
+
serviceName: service.name || service.id,
|
|
1016
|
+
collectionId: collection.id,
|
|
1017
|
+
parameters: constructParameterObject(service.id, collection.id, collection.parameter_names),
|
|
1018
|
+
customDimensions: ((_collection$extent2 = collection.extent) == null ? void 0 : _collection$extent2.custom) || [],
|
|
1019
|
+
dataQueries: collection.data_queries || {},
|
|
1020
|
+
extent: collection.extent || {}
|
|
1021
|
+
}, {});
|
|
1022
|
+
};
|
|
1023
|
+
var getServiceCollectionDetails = function getServiceCollectionDetails(service, collections) {
|
|
1013
1024
|
var collectionsParameters = [];
|
|
1014
|
-
var serviceCollections = [];
|
|
1015
1025
|
if (!collections || collections.length === 0) {
|
|
1016
1026
|
// If no collections are provided, return an empty array
|
|
1017
1027
|
return collectionsParameters;
|
|
1018
1028
|
}
|
|
1019
1029
|
// Only use parameters from collections that support /locations or /position
|
|
1020
|
-
// Either directly or through the latest instance
|
|
1021
|
-
var _loop2 = function _loop2() {
|
|
1022
|
-
var _collection$data_quer, _collection$data_quer2, _instances$find, _collection$data_quer3, _latestInstance$data_, _latestInstance$data_2;
|
|
1023
|
-
var collection = _step.value;
|
|
1024
|
-
var hasDirectSupport = !!((_collection$data_quer = collection.data_queries) != null && _collection$data_quer.locations) || !!((_collection$data_quer2 = collection.data_queries) != null && _collection$data_quer2.position);
|
|
1025
|
-
var latestInstance = instances == null || (_instances$find = instances.find(function (item) {
|
|
1026
|
-
return item.serviceId === service.id && item.collectionId === collection.id;
|
|
1027
|
-
})) == null ? void 0 : _instances$find.latestInstance;
|
|
1028
|
-
var hasInstanceSupport = !!((_collection$data_quer3 = collection.data_queries) != null && _collection$data_quer3.instances) && (!!(latestInstance != null && (_latestInstance$data_ = latestInstance.data_queries) != null && _latestInstance$data_.locations) || !!(latestInstance != null && (_latestInstance$data_2 = latestInstance.data_queries) != null && _latestInstance$data_2.position));
|
|
1029
|
-
if (hasDirectSupport || hasInstanceSupport) {
|
|
1030
|
-
serviceCollections.push(collection);
|
|
1031
|
-
}
|
|
1032
|
-
};
|
|
1033
1030
|
for (var _iterator = _createForOfIteratorHelperLoose(collections), _step; !(_step = _iterator()).done;) {
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
var collection = _serviceCollections[_i];
|
|
1039
|
-
var instance = instances == null ? void 0 : instances.find(function (item) {
|
|
1040
|
-
return item.serviceId === service.id && item.collectionId === collection.id;
|
|
1041
|
-
});
|
|
1042
|
-
var latestInstance = instance == null ? void 0 : instance.latestInstance;
|
|
1043
|
-
var allInstances = instance == null ? void 0 : instance.allInstances;
|
|
1044
|
-
// Workaround for non-standard EDR servers, like interpol.met.no
|
|
1045
|
-
var paramNames = {};
|
|
1046
|
-
if (latestInstance != null && latestInstance.parameters) {
|
|
1047
|
-
for (var _iterator2 = _createForOfIteratorHelperLoose(latestInstance.parameters), _step2; !(_step2 = _iterator2()).done;) {
|
|
1048
|
-
var param = _step2.value;
|
|
1049
|
-
paramNames[param.id] = param;
|
|
1050
|
-
}
|
|
1031
|
+
var _collection$data_quer, _collection$data_quer2;
|
|
1032
|
+
var collection = _step.value;
|
|
1033
|
+
if ((_collection$data_quer = collection.data_queries) != null && _collection$data_quer.locations || (_collection$data_quer2 = collection.data_queries) != null && _collection$data_quer2.position) {
|
|
1034
|
+
collectionsParameters.push(getCollectionDetails(service, collection));
|
|
1051
1035
|
}
|
|
1052
|
-
var hasParamNames = Object.keys(paramNames).length > 0;
|
|
1053
|
-
// If the latest instance has parameters, use those, otherwise use the collection's parameter_names
|
|
1054
|
-
// This is to ensure that we always have a parameter source to work with
|
|
1055
|
-
var parameterSource = (latestInstance == null ? void 0 : latestInstance.parameter_names) || (hasParamNames ? paramNames : collection.parameter_names);
|
|
1056
|
-
collectionsParameters.push({
|
|
1057
|
-
serviceId: service.id,
|
|
1058
|
-
serviceName: service.name || service.id,
|
|
1059
|
-
collectionId: collection.id,
|
|
1060
|
-
parameters: constructParameterObject(service.id, collection.id, parameterSource),
|
|
1061
|
-
customDimensions: ((_collection$extent = collection.extent) == null ? void 0 : _collection$extent.custom) || [],
|
|
1062
|
-
collectionDetails: collection,
|
|
1063
|
-
allInstances: allInstances
|
|
1064
|
-
});
|
|
1065
|
-
};
|
|
1066
|
-
for (var _i = 0, _serviceCollections = serviceCollections; _i < _serviceCollections.length; _i++) {
|
|
1067
|
-
_loop();
|
|
1068
1036
|
}
|
|
1069
1037
|
return collectionsParameters;
|
|
1070
1038
|
};
|
|
@@ -1080,15 +1048,6 @@ var getServiceById = function getServiceById(services, serviceId) {
|
|
|
1080
1048
|
return service.id === serviceId;
|
|
1081
1049
|
}) : undefined;
|
|
1082
1050
|
};
|
|
1083
|
-
var getDetailsForCollectionId = function getDetailsForCollectionId(collections, collectionId) {
|
|
1084
|
-
var collection = collections.find(function (collection) {
|
|
1085
|
-
return collection.collectionId === collectionId;
|
|
1086
|
-
});
|
|
1087
|
-
if (collection) {
|
|
1088
|
-
return collection;
|
|
1089
|
-
}
|
|
1090
|
-
return undefined;
|
|
1091
|
-
};
|
|
1092
1051
|
var HOUR_IN_MILLISECONDS = 3600 * 1000;
|
|
1093
1052
|
/**
|
|
1094
1053
|
* This function clips the dates in the EDR interval string to a less wide time range.
|
|
@@ -1104,12 +1063,6 @@ var clipEdrInterval = function clipEdrInterval(interval, maxHoursBefore,
|
|
|
1104
1063
|
maxHoursAfter,
|
|
1105
1064
|
// 10 days to the future
|
|
1106
1065
|
date) {
|
|
1107
|
-
if (maxHoursBefore === void 0) {
|
|
1108
|
-
maxHoursBefore = 1 * 24;
|
|
1109
|
-
}
|
|
1110
|
-
if (maxHoursAfter === void 0) {
|
|
1111
|
-
maxHoursAfter = 10 * 24;
|
|
1112
|
-
}
|
|
1113
1066
|
if (date === void 0) {
|
|
1114
1067
|
date = Date.now();
|
|
1115
1068
|
}
|
|
@@ -1128,6 +1081,16 @@ date) {
|
|
|
1128
1081
|
var end = dateUtils.dateToString(clippedEndDate);
|
|
1129
1082
|
return [start, end];
|
|
1130
1083
|
};
|
|
1084
|
+
// 1 day to past, 10 days to future
|
|
1085
|
+
var clipInterval = [1 * 24, 10 * 24];
|
|
1086
|
+
var constructTimeInterval = function constructTimeInterval(collection, instance, parameter) {
|
|
1087
|
+
var _instance$extent2, _collection$extent3;
|
|
1088
|
+
var interval = ((_instance$extent2 = instance.extent) == null || (_instance$extent2 = _instance$extent2.temporal) == null ? void 0 : _instance$extent2.interval[0]) || (collection == null || (_collection$extent3 = collection.extent) == null || (_collection$extent3 = _collection$extent3.temporal) == null ? void 0 : _collection$extent3.interval[0]);
|
|
1089
|
+
var _clipEdrInterval = clipEdrInterval(interval, clipInterval[0], clipInterval[1]),
|
|
1090
|
+
start = _clipEdrInterval[0],
|
|
1091
|
+
end = _clipEdrInterval[1];
|
|
1092
|
+
return start + "/" + end;
|
|
1093
|
+
};
|
|
1131
1094
|
var EARTH_RADIUS = 6371;
|
|
1132
1095
|
/**
|
|
1133
1096
|
* Find nearest point to the target location in timeseries.
|
|
@@ -1550,11 +1513,7 @@ var slice = createSlice({
|
|
|
1550
1513
|
service.enabled = false;
|
|
1551
1514
|
}
|
|
1552
1515
|
},
|
|
1553
|
-
setServiceFilterChipsInStore: function setServiceFilterChipsInStore(
|
|
1554
|
-
// eslint-disable-next-line no-unused-vars
|
|
1555
|
-
draft,
|
|
1556
|
-
// eslint-disable-next-line no-unused-vars
|
|
1557
|
-
action) {
|
|
1516
|
+
setServiceFilterChipsInStore: function setServiceFilterChipsInStore(draft, action) {
|
|
1558
1517
|
action.payload.forEach(function (service) {
|
|
1559
1518
|
if (draft.timeseriesSelect) {
|
|
1560
1519
|
var _draft$timeseriesSele2;
|
|
@@ -2196,206 +2155,44 @@ var ParameterOpacitySelect = function ParameterOpacitySelect(_ref) {
|
|
|
2196
2155
|
});
|
|
2197
2156
|
};
|
|
2198
2157
|
|
|
2158
|
+
/* *
|
|
2159
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2160
|
+
* you may not use this file except in compliance with the License.
|
|
2161
|
+
* You may obtain a copy of the License at
|
|
2162
|
+
*
|
|
2163
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2164
|
+
*
|
|
2165
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2166
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2167
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2168
|
+
* See the License for the specific language governing permissions and
|
|
2169
|
+
* limitations under the License.
|
|
2170
|
+
*
|
|
2171
|
+
* Copyright 2021 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2172
|
+
* Copyright 2021 - Finnish Meteorological Institute (FMI)
|
|
2173
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2174
|
+
* */
|
|
2199
2175
|
var isTimeSeriesLocation = function isTimeSeriesLocation(obj) {
|
|
2200
2176
|
return 'id' in obj;
|
|
2201
2177
|
};
|
|
2202
2178
|
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
var url = createUrl(serviceUrl, "/collections/" + collectionId + "/instances");
|
|
2221
|
-
return fetch(url).then(handleResponse);
|
|
2222
|
-
};
|
|
2223
|
-
var getInstanceDetails = function getInstanceDetails(serviceUrl, collectionId, instanceId) {
|
|
2224
|
-
var url = createUrl(serviceUrl, "/collections/" + collectionId + "/instances/" + instanceId);
|
|
2225
|
-
return fetch(url).then(handleResponse);
|
|
2226
|
-
};
|
|
2227
|
-
var getSupportedInstances = /*#__PURE__*/function () {
|
|
2228
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(serviceUrl, collectionId, useCollectionFallback) {
|
|
2229
|
-
var _collection$data_quer;
|
|
2230
|
-
var collection, _yield$getInstances, instances;
|
|
2231
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2232
|
-
while (1) switch (_context.prev = _context.next) {
|
|
2233
|
-
case 0:
|
|
2234
|
-
if (!(!serviceUrl || !collectionId)) {
|
|
2235
|
-
_context.next = 2;
|
|
2236
|
-
break;
|
|
2237
|
-
}
|
|
2238
|
-
return _context.abrupt("return", []);
|
|
2239
|
-
case 2:
|
|
2240
|
-
_context.next = 4;
|
|
2241
|
-
return getCollection(serviceUrl, collectionId);
|
|
2242
|
-
case 4:
|
|
2243
|
-
collection = _context.sent;
|
|
2244
|
-
if (!((_collection$data_quer = collection.data_queries) != null && _collection$data_quer.instances)) {
|
|
2245
|
-
_context.next = 11;
|
|
2246
|
-
break;
|
|
2247
|
-
}
|
|
2248
|
-
_context.next = 8;
|
|
2249
|
-
return getInstances(serviceUrl, collectionId);
|
|
2250
|
-
case 8:
|
|
2251
|
-
_yield$getInstances = _context.sent;
|
|
2252
|
-
instances = _yield$getInstances.instances;
|
|
2253
|
-
return _context.abrupt("return", listSupportedInstances(instances));
|
|
2254
|
-
case 11:
|
|
2255
|
-
return _context.abrupt("return", useCollectionFallback ? [collection] : []);
|
|
2256
|
-
case 12:
|
|
2257
|
-
case "end":
|
|
2258
|
-
return _context.stop();
|
|
2259
|
-
}
|
|
2260
|
-
}, _callee);
|
|
2261
|
-
}));
|
|
2262
|
-
return function getSupportedInstances(_x, _x2, _x3) {
|
|
2263
|
-
return _ref.apply(this, arguments);
|
|
2264
|
-
};
|
|
2265
|
-
}();
|
|
2266
|
-
var fetchParametersForService = /*#__PURE__*/function () {
|
|
2267
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(service) {
|
|
2268
|
-
var url, serviceId, _yield$getCollections, collections, latestInstances, supportedInstances;
|
|
2269
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2270
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
2271
|
-
case 0:
|
|
2272
|
-
url = service.url, serviceId = service.id;
|
|
2273
|
-
_context3.next = 3;
|
|
2274
|
-
return getCollections(url);
|
|
2275
|
-
case 3:
|
|
2276
|
-
_yield$getCollections = _context3.sent;
|
|
2277
|
-
collections = _yield$getCollections.collections;
|
|
2278
|
-
_context3.next = 7;
|
|
2279
|
-
return Promise.all(collections.map(/*#__PURE__*/function () {
|
|
2280
|
-
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(collection) {
|
|
2281
|
-
var _collection$data_quer2;
|
|
2282
|
-
var allInstances, instance, details;
|
|
2283
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2284
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
2285
|
-
case 0:
|
|
2286
|
-
if (!((_collection$data_quer2 = collection.data_queries) != null && _collection$data_quer2.instances)) {
|
|
2287
|
-
_context2.next = 10;
|
|
2288
|
-
break;
|
|
2289
|
-
}
|
|
2290
|
-
_context2.next = 3;
|
|
2291
|
-
return getSupportedInstances(url, collection.id);
|
|
2292
|
-
case 3:
|
|
2293
|
-
allInstances = _context2.sent;
|
|
2294
|
-
instance = latestInstance(allInstances);
|
|
2295
|
-
if (!instance) {
|
|
2296
|
-
_context2.next = 10;
|
|
2297
|
-
break;
|
|
2298
|
-
}
|
|
2299
|
-
_context2.next = 8;
|
|
2300
|
-
return getInstanceDetails(url, collection.id, instance.id);
|
|
2301
|
-
case 8:
|
|
2302
|
-
details = _context2.sent;
|
|
2303
|
-
return _context2.abrupt("return", {
|
|
2304
|
-
latestInstance: Object.assign({}, instance, details),
|
|
2305
|
-
collectionDetails: collection,
|
|
2306
|
-
allInstances: allInstances,
|
|
2307
|
-
collectionId: collection.id,
|
|
2308
|
-
serviceId: serviceId
|
|
2309
|
-
});
|
|
2310
|
-
case 10:
|
|
2311
|
-
return _context2.abrupt("return", null);
|
|
2312
|
-
case 11:
|
|
2313
|
-
case "end":
|
|
2314
|
-
return _context2.stop();
|
|
2315
|
-
}
|
|
2316
|
-
}, _callee2);
|
|
2317
|
-
}));
|
|
2318
|
-
return function (_x5) {
|
|
2319
|
-
return _ref3.apply(this, arguments);
|
|
2320
|
-
};
|
|
2321
|
-
}()));
|
|
2322
|
-
case 7:
|
|
2323
|
-
latestInstances = _context3.sent;
|
|
2324
|
-
supportedInstances = latestInstances.filter(function (inst) {
|
|
2325
|
-
return inst !== null;
|
|
2326
|
-
});
|
|
2327
|
-
return _context3.abrupt("return", getParametersFromCollections(service, collections, supportedInstances));
|
|
2328
|
-
case 10:
|
|
2329
|
-
case "end":
|
|
2330
|
-
return _context3.stop();
|
|
2331
|
-
}
|
|
2332
|
-
}, _callee3);
|
|
2333
|
-
}));
|
|
2334
|
-
return function fetchParametersForService(_x4) {
|
|
2335
|
-
return _ref2.apply(this, arguments);
|
|
2336
|
-
};
|
|
2337
|
-
}();
|
|
2338
|
-
var getLocation = function getLocation(serviceUrl, collectionId, instanceId, locationId, queryParamArr) {
|
|
2339
|
-
var path = getLocationPositionPath(collectionId, instanceId);
|
|
2340
|
-
var url = createUrl(serviceUrl, path + "/locations/" + locationId, queryParamArr);
|
|
2341
|
-
return fetch(url).then(handleResponse);
|
|
2342
|
-
};
|
|
2343
|
-
var getPosition = function getPosition(serviceUrl, collectionId, instanceId, position, queryParamArr) {
|
|
2344
|
-
var path = getLocationPositionPath(collectionId, instanceId);
|
|
2345
|
-
var lat = position.lat,
|
|
2346
|
-
lon = position.lon;
|
|
2347
|
-
var url = createUrl(serviceUrl, path + "/position", [].concat(queryParamArr, [['coords', "POINT(" + lon + " " + lat + ")"]]));
|
|
2348
|
-
return fetch(url).then(handleResponse);
|
|
2349
|
-
};
|
|
2350
|
-
var fetchEdrParameter = /*#__PURE__*/function () {
|
|
2351
|
-
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(serviceUrl, parameter, location, instance, collection) {
|
|
2352
|
-
var _instance$data_querie, _collection$collectio, _instance$data_querie2, _collection$collectio2;
|
|
2353
|
-
var collectionId, queryParamArr, locationId, result, _result;
|
|
2354
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
2355
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
2356
|
-
case 0:
|
|
2357
|
-
collectionId = parameter.collectionId;
|
|
2358
|
-
queryParamArr = getBaseQueryParamArray(parameter, instance, collection);
|
|
2359
|
-
if (!(isTimeSeriesLocation(location) && ((_instance$data_querie = instance.data_queries) != null && _instance$data_querie.locations || (_collection$collectio = collection.collectionDetails.data_queries) != null && _collection$collectio.locations))) {
|
|
2360
|
-
_context4.next = 11;
|
|
2361
|
-
break;
|
|
2362
|
-
}
|
|
2363
|
-
locationId = location.id;
|
|
2364
|
-
if (!locationId) {
|
|
2365
|
-
_context4.next = 9;
|
|
2366
|
-
break;
|
|
2367
|
-
}
|
|
2368
|
-
_context4.next = 7;
|
|
2369
|
-
return getLocation(serviceUrl, collectionId, instance.id, locationId, queryParamArr);
|
|
2370
|
-
case 7:
|
|
2371
|
-
result = _context4.sent;
|
|
2372
|
-
return _context4.abrupt("return", result);
|
|
2373
|
-
case 9:
|
|
2374
|
-
_context4.next = 16;
|
|
2375
|
-
break;
|
|
2376
|
-
case 11:
|
|
2377
|
-
if (!((_instance$data_querie2 = instance.data_queries) != null && _instance$data_querie2.position || (_collection$collectio2 = collection.collectionDetails.data_queries) != null && _collection$collectio2.position)) {
|
|
2378
|
-
_context4.next = 16;
|
|
2379
|
-
break;
|
|
2380
|
-
}
|
|
2381
|
-
_context4.next = 14;
|
|
2382
|
-
return getPosition(serviceUrl, collectionId, instance.id, location, queryParamArr);
|
|
2383
|
-
case 14:
|
|
2384
|
-
_result = _context4.sent;
|
|
2385
|
-
return _context4.abrupt("return", _result);
|
|
2386
|
-
case 16:
|
|
2387
|
-
return _context4.abrupt("return", null);
|
|
2388
|
-
case 17:
|
|
2389
|
-
case "end":
|
|
2390
|
-
return _context4.stop();
|
|
2391
|
-
}
|
|
2392
|
-
}, _callee4);
|
|
2393
|
-
}));
|
|
2394
|
-
return function fetchEdrParameter(_x6, _x7, _x8, _x9, _x0) {
|
|
2395
|
-
return _ref4.apply(this, arguments);
|
|
2396
|
-
};
|
|
2397
|
-
}();
|
|
2398
|
-
|
|
2179
|
+
/* *
|
|
2180
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2181
|
+
* you may not use this file except in compliance with the License.
|
|
2182
|
+
* You may obtain a copy of the License at
|
|
2183
|
+
*
|
|
2184
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2185
|
+
*
|
|
2186
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
2187
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2188
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2189
|
+
* See the License for the specific language governing permissions and
|
|
2190
|
+
* limitations under the License.
|
|
2191
|
+
*
|
|
2192
|
+
* Copyright 2022 - Koninklijk Nederlands Meteorologisch Instituut (KNMI)
|
|
2193
|
+
* Copyright 2022 - Finnish Meteorological Institute (FMI)
|
|
2194
|
+
* Copyright 2024 - The Norwegian Meteorological Institute (MET Norway)
|
|
2195
|
+
* */
|
|
2399
2196
|
var createGeoJsonArrays = function createGeoJsonArrays(locations, services, hideFeatures, memoizedSelectedFeature) {
|
|
2400
2197
|
var initialAccumulator = {
|
|
2401
2198
|
obj: {},
|
|
@@ -2460,7 +2257,6 @@ var createGeoJsonArrays = function createGeoJsonArrays(locations, services, hide
|
|
|
2460
2257
|
features: []
|
|
2461
2258
|
}
|
|
2462
2259
|
};
|
|
2463
|
-
// eslint-disable-next-line no-param-reassign
|
|
2464
2260
|
acc.collectionMap[collectionName] = newGeoJsonWithService;
|
|
2465
2261
|
}
|
|
2466
2262
|
acc.collectionMap[collectionName].geoJson.features.push(feature);
|
|
@@ -2509,141 +2305,6 @@ var getNearbyLocation = function getNearbyLocation(parameter, service, selectedL
|
|
|
2509
2305
|
}
|
|
2510
2306
|
return null;
|
|
2511
2307
|
};
|
|
2512
|
-
var getEdrParameter = /*#__PURE__*/function () {
|
|
2513
|
-
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(presetParameter, serviceUrl, location, collection) {
|
|
2514
|
-
var _collection$allInstan, _collection$allInstan2;
|
|
2515
|
-
var instanceInfo, apiData, paramData, paramKey, unit;
|
|
2516
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2517
|
-
while (1) switch (_context.prev = _context.next) {
|
|
2518
|
-
case 0:
|
|
2519
|
-
instanceInfo = presetParameter.instanceId && ((_collection$allInstan = collection.allInstances) == null ? void 0 : _collection$allInstan.find(function (inst) {
|
|
2520
|
-
return inst.id === presetParameter.instanceId;
|
|
2521
|
-
})) || ((_collection$allInstan2 = collection.allInstances) == null ? void 0 : _collection$allInstan2[0]) || {
|
|
2522
|
-
id: ''
|
|
2523
|
-
};
|
|
2524
|
-
_context.next = 3;
|
|
2525
|
-
return fetchEdrParameter(serviceUrl, presetParameter, location, instanceInfo, collection);
|
|
2526
|
-
case 3:
|
|
2527
|
-
apiData = _context.sent;
|
|
2528
|
-
paramData = apiData != null && apiData.coverages ? apiData == null ? void 0 : apiData.coverages[0] : apiData;
|
|
2529
|
-
if (!(!apiData || !(paramData != null && paramData.ranges) || !paramData.domain.axes.t || paramData.domain.axes.t.values.length === 0)) {
|
|
2530
|
-
_context.next = 7;
|
|
2531
|
-
break;
|
|
2532
|
-
}
|
|
2533
|
-
return _context.abrupt("return", null);
|
|
2534
|
-
case 7:
|
|
2535
|
-
// assume only one parameter
|
|
2536
|
-
paramKey = Object.keys(paramData.ranges)[0];
|
|
2537
|
-
unit = getUnit(apiData.parameters[paramKey], i18n.language, 'en');
|
|
2538
|
-
return _context.abrupt("return", Object.assign({}, presetParameter, {
|
|
2539
|
-
unit: unit,
|
|
2540
|
-
timestep: paramData.domain.axes.t.values.map(function (str) {
|
|
2541
|
-
return dateUtils.utc(str);
|
|
2542
|
-
}),
|
|
2543
|
-
value: paramData.ranges[paramKey].values
|
|
2544
|
-
}));
|
|
2545
|
-
case 10:
|
|
2546
|
-
case "end":
|
|
2547
|
-
return _context.stop();
|
|
2548
|
-
}
|
|
2549
|
-
}, _callee);
|
|
2550
|
-
}));
|
|
2551
|
-
return function getEdrParameter(_x, _x2, _x3, _x4) {
|
|
2552
|
-
return _ref.apply(this, arguments);
|
|
2553
|
-
};
|
|
2554
|
-
}();
|
|
2555
|
-
var getErrorMessage = function getErrorMessage(parameter) {
|
|
2556
|
-
return parameter.propertyName + " - " + parameter.collectionId;
|
|
2557
|
-
};
|
|
2558
|
-
var fetchParameter = /*#__PURE__*/function () {
|
|
2559
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(parameter, selectedLocation, service, geojsonMap, collection) {
|
|
2560
|
-
var _selectedLocation$occ, occurrence, position, result, nearbyLocation;
|
|
2561
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2562
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
2563
|
-
case 0:
|
|
2564
|
-
if (collection) {
|
|
2565
|
-
_context2.next = 2;
|
|
2566
|
-
break;
|
|
2567
|
-
}
|
|
2568
|
-
throw new Error('No collection found for parameter');
|
|
2569
|
-
case 2:
|
|
2570
|
-
if (!isTimeSeriesLocation(selectedLocation)) {
|
|
2571
|
-
_context2.next = 14;
|
|
2572
|
-
break;
|
|
2573
|
-
}
|
|
2574
|
-
// The selected location contains a lisf of occurrences (combination of service and collection)
|
|
2575
|
-
occurrence = (_selectedLocation$occ = selectedLocation.occurrences) == null ? void 0 : _selectedLocation$occ.find(function (occ) {
|
|
2576
|
-
var _occ$properties, _occ$properties2;
|
|
2577
|
-
return ((_occ$properties = occ.properties) == null ? void 0 : _occ$properties.collectionId) === parameter.collectionId && ((_occ$properties2 = occ.properties) == null ? void 0 : _occ$properties2.serviceId) === parameter.serviceId;
|
|
2578
|
-
});
|
|
2579
|
-
if (!occurrence) {
|
|
2580
|
-
_context2.next = 14;
|
|
2581
|
-
break;
|
|
2582
|
-
}
|
|
2583
|
-
_context2.prev = 5;
|
|
2584
|
-
_context2.next = 8;
|
|
2585
|
-
return getEdrParameter(parameter, service.url, {
|
|
2586
|
-
id: occurrence.id,
|
|
2587
|
-
lat: selectedLocation.lat,
|
|
2588
|
-
lon: selectedLocation.lon
|
|
2589
|
-
}, collection);
|
|
2590
|
-
case 8:
|
|
2591
|
-
return _context2.abrupt("return", _context2.sent);
|
|
2592
|
-
case 11:
|
|
2593
|
-
_context2.prev = 11;
|
|
2594
|
-
_context2.t0 = _context2["catch"](5);
|
|
2595
|
-
throw new Error(getErrorMessage(parameter));
|
|
2596
|
-
case 14:
|
|
2597
|
-
// Try a position query
|
|
2598
|
-
position = {
|
|
2599
|
-
lon: selectedLocation.lon,
|
|
2600
|
-
lat: selectedLocation.lat
|
|
2601
|
-
};
|
|
2602
|
-
_context2.prev = 15;
|
|
2603
|
-
_context2.next = 18;
|
|
2604
|
-
return getEdrParameter(parameter, service.url, position, collection);
|
|
2605
|
-
case 18:
|
|
2606
|
-
result = _context2.sent;
|
|
2607
|
-
if (!result) {
|
|
2608
|
-
_context2.next = 21;
|
|
2609
|
-
break;
|
|
2610
|
-
}
|
|
2611
|
-
return _context2.abrupt("return", result);
|
|
2612
|
-
case 21:
|
|
2613
|
-
_context2.next = 37;
|
|
2614
|
-
break;
|
|
2615
|
-
case 23:
|
|
2616
|
-
_context2.prev = 23;
|
|
2617
|
-
_context2.t1 = _context2["catch"](15);
|
|
2618
|
-
// As a final option look for a nearby location
|
|
2619
|
-
nearbyLocation = getNearbyLocation(parameter, service, selectedLocation, geojsonMap);
|
|
2620
|
-
if (!nearbyLocation) {
|
|
2621
|
-
_context2.next = 36;
|
|
2622
|
-
break;
|
|
2623
|
-
}
|
|
2624
|
-
_context2.prev = 27;
|
|
2625
|
-
_context2.next = 30;
|
|
2626
|
-
return getEdrParameter(parameter, service.url, nearbyLocation, collection);
|
|
2627
|
-
case 30:
|
|
2628
|
-
return _context2.abrupt("return", _context2.sent);
|
|
2629
|
-
case 33:
|
|
2630
|
-
_context2.prev = 33;
|
|
2631
|
-
_context2.t2 = _context2["catch"](27);
|
|
2632
|
-
throw new Error(getErrorMessage(parameter));
|
|
2633
|
-
case 36:
|
|
2634
|
-
throw new Error(getErrorMessage(parameter));
|
|
2635
|
-
case 37:
|
|
2636
|
-
throw new Error(getErrorMessage(parameter));
|
|
2637
|
-
case 38:
|
|
2638
|
-
case "end":
|
|
2639
|
-
return _context2.stop();
|
|
2640
|
-
}
|
|
2641
|
-
}, _callee2, null, [[5, 11], [15, 23], [27, 33]]);
|
|
2642
|
-
}));
|
|
2643
|
-
return function fetchParameter(_x5, _x6, _x7, _x8, _x9) {
|
|
2644
|
-
return _ref2.apply(this, arguments);
|
|
2645
|
-
};
|
|
2646
|
-
}();
|
|
2647
2308
|
var getPlotsWithParameters = function getPlotsWithParameters(plots, parameters) {
|
|
2648
2309
|
var parametersByPlotId = groupBy(parameters, function (parameter) {
|
|
2649
2310
|
return parameter.plotId;
|
|
@@ -2683,20 +2344,324 @@ var combineParametersWithData = function combineParametersWithData(parameters, d
|
|
|
2683
2344
|
});
|
|
2684
2345
|
});
|
|
2685
2346
|
};
|
|
2347
|
+
var extractUsedCollections = function extractUsedCollections(plotsWithoutData, services) {
|
|
2348
|
+
return plotsWithoutData.parameters.reduce(function (acc, param) {
|
|
2349
|
+
var _Object$assign;
|
|
2350
|
+
var serviceCollection = param.serviceId + "-" + param.collectionId;
|
|
2351
|
+
if (acc.serviceCollection) {
|
|
2352
|
+
return acc;
|
|
2353
|
+
}
|
|
2354
|
+
var service = services.find(function (service) {
|
|
2355
|
+
return service.id === param.serviceId;
|
|
2356
|
+
});
|
|
2357
|
+
if (!service) {
|
|
2358
|
+
return acc;
|
|
2359
|
+
}
|
|
2360
|
+
return Object.assign({}, acc, (_Object$assign = {}, _Object$assign[serviceCollection] = {
|
|
2361
|
+
serviceId: param.serviceId,
|
|
2362
|
+
service: service,
|
|
2363
|
+
collectionId: param.collectionId
|
|
2364
|
+
}, _Object$assign));
|
|
2365
|
+
}, {});
|
|
2366
|
+
};
|
|
2367
|
+
var extractDataFromfetchEdrParameterResponse = function extractDataFromfetchEdrParameterResponse(edrResponse, parameter) {
|
|
2368
|
+
// If coverage collection is returned, take the first
|
|
2369
|
+
var paramData = edrResponse != null && edrResponse.coverages ? edrResponse == null ? void 0 : edrResponse.coverages[0] : edrResponse;
|
|
2370
|
+
if (!edrResponse || !(paramData != null && paramData.ranges) || !paramData.domain.axes.t || paramData.domain.axes.t.values.length === 0) {
|
|
2371
|
+
return null;
|
|
2372
|
+
}
|
|
2373
|
+
// assume only one parameter
|
|
2374
|
+
var paramKey = Object.keys(paramData.ranges)[0];
|
|
2375
|
+
var unit = getUnit(edrResponse.parameters[paramKey], i18n.language, 'en');
|
|
2376
|
+
return Object.assign({}, parameter, {
|
|
2377
|
+
unit: unit,
|
|
2378
|
+
timestep: paramData.domain.axes.t.values.map(function (str) {
|
|
2379
|
+
return dateUtils.utc(str);
|
|
2380
|
+
}),
|
|
2381
|
+
value: paramData.ranges[paramKey].values
|
|
2382
|
+
});
|
|
2383
|
+
};
|
|
2686
2384
|
|
|
2687
|
-
var
|
|
2385
|
+
var getLocations = function getLocations(serviceUrl, collectionId) {
|
|
2386
|
+
var url = createUrl(serviceUrl, "/collections/" + collectionId + "/locations");
|
|
2387
|
+
return fetch(url).then(handleResponse);
|
|
2388
|
+
};
|
|
2389
|
+
var getServiceInformation = function getServiceInformation(serviceUrl) {
|
|
2390
|
+
var url = createUrl(serviceUrl);
|
|
2391
|
+
return fetch(url).then(handleResponse);
|
|
2392
|
+
};
|
|
2393
|
+
var getCollections = function getCollections(serviceUrl) {
|
|
2394
|
+
var url = createUrl(serviceUrl, '/collections');
|
|
2395
|
+
return fetch(url).then(handleResponse);
|
|
2396
|
+
};
|
|
2397
|
+
var getCollection = function getCollection(serviceUrl, collectionId) {
|
|
2398
|
+
var url = createUrl(serviceUrl, "/collections/" + collectionId);
|
|
2399
|
+
return fetch(url).then(handleResponse);
|
|
2400
|
+
};
|
|
2401
|
+
var getInstances = function getInstances(serviceUrl, collectionId) {
|
|
2402
|
+
var url = createUrl(serviceUrl, "/collections/" + collectionId + "/instances");
|
|
2403
|
+
return fetch(url).then(handleResponse);
|
|
2404
|
+
};
|
|
2405
|
+
var getLocation = function getLocation(serviceUrl, collectionId, instanceId, locationId, queryParamArr) {
|
|
2406
|
+
var path = getLocationPositionPath(collectionId, instanceId);
|
|
2407
|
+
var url = createUrl(serviceUrl, path + "/locations/" + locationId, queryParamArr);
|
|
2408
|
+
return fetch(url).then(handleResponse);
|
|
2409
|
+
};
|
|
2410
|
+
var getPosition = function getPosition(serviceUrl, collectionId, instanceId, position, queryParamArr) {
|
|
2411
|
+
var path = getLocationPositionPath(collectionId, instanceId);
|
|
2412
|
+
var lat = position.lat,
|
|
2413
|
+
lon = position.lon;
|
|
2414
|
+
var url = createUrl(serviceUrl, path + "/position", [].concat(queryParamArr, [['coords', "POINT(" + lon + " " + lat + ")"]]));
|
|
2415
|
+
return fetch(url).then(handleResponse);
|
|
2416
|
+
};
|
|
2417
|
+
var getErrorMessage = function getErrorMessage(parameter) {
|
|
2418
|
+
return parameter.propertyName + " - " + parameter.collectionId;
|
|
2419
|
+
};
|
|
2420
|
+
var fetchEdrParameter = /*#__PURE__*/function () {
|
|
2421
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(parameter, location, service, geojsonMap, intervalParam, collection, instance) {
|
|
2422
|
+
var _instance$data_querie, _collection$dataQueri;
|
|
2423
|
+
var collectionId, queryParamArr, _location$occurrences, occurrence, _instance$data_querie2, _collection$dataQueri2, nearbyLocation;
|
|
2424
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2425
|
+
while (1) switch (_context.prev = _context.next) {
|
|
2426
|
+
case 0:
|
|
2427
|
+
collectionId = parameter.collectionId;
|
|
2428
|
+
queryParamArr = getBaseQueryParamArray(parameter, instance, collection, intervalParam);
|
|
2429
|
+
if (!(isTimeSeriesLocation(location) && ((_instance$data_querie = instance.data_queries) != null && _instance$data_querie.locations || (_collection$dataQueri = collection.dataQueries) != null && _collection$dataQueri.locations))) {
|
|
2430
|
+
_context.next = 14;
|
|
2431
|
+
break;
|
|
2432
|
+
}
|
|
2433
|
+
// The selected location contains a list of occurrences (combination of service and collection)
|
|
2434
|
+
occurrence = (_location$occurrences = location.occurrences) == null ? void 0 : _location$occurrences.find(function (occ) {
|
|
2435
|
+
var _occ$properties, _occ$properties2;
|
|
2436
|
+
return ((_occ$properties = occ.properties) == null ? void 0 : _occ$properties.collectionId) === parameter.collectionId && ((_occ$properties2 = occ.properties) == null ? void 0 : _occ$properties2.serviceId) === parameter.serviceId;
|
|
2437
|
+
});
|
|
2438
|
+
if (!(occurrence && occurrence.id)) {
|
|
2439
|
+
_context.next = 14;
|
|
2440
|
+
break;
|
|
2441
|
+
}
|
|
2442
|
+
_context.prev = 5;
|
|
2443
|
+
_context.next = 8;
|
|
2444
|
+
return getLocation(service.url, collectionId, instance.id, occurrence.id, queryParamArr);
|
|
2445
|
+
case 8:
|
|
2446
|
+
return _context.abrupt("return", _context.sent);
|
|
2447
|
+
case 11:
|
|
2448
|
+
_context.prev = 11;
|
|
2449
|
+
_context.t0 = _context["catch"](5);
|
|
2450
|
+
throw new Error(getErrorMessage(parameter));
|
|
2451
|
+
case 14:
|
|
2452
|
+
_context.prev = 14;
|
|
2453
|
+
if (!((_instance$data_querie2 = instance.data_queries) != null && _instance$data_querie2.position || (_collection$dataQueri2 = collection.dataQueries) != null && _collection$dataQueri2.position)) {
|
|
2454
|
+
_context.next = 19;
|
|
2455
|
+
break;
|
|
2456
|
+
}
|
|
2457
|
+
_context.next = 18;
|
|
2458
|
+
return getPosition(service.url, collectionId, instance.id, {
|
|
2459
|
+
lon: location.lon,
|
|
2460
|
+
lat: location.lat
|
|
2461
|
+
}, queryParamArr);
|
|
2462
|
+
case 18:
|
|
2463
|
+
return _context.abrupt("return", _context.sent);
|
|
2464
|
+
case 19:
|
|
2465
|
+
_context.next = 35;
|
|
2466
|
+
break;
|
|
2467
|
+
case 21:
|
|
2468
|
+
_context.prev = 21;
|
|
2469
|
+
_context.t1 = _context["catch"](14);
|
|
2470
|
+
// As a final option look for a nearby location
|
|
2471
|
+
nearbyLocation = getNearbyLocation(parameter, service, location, geojsonMap);
|
|
2472
|
+
if (!nearbyLocation) {
|
|
2473
|
+
_context.next = 34;
|
|
2474
|
+
break;
|
|
2475
|
+
}
|
|
2476
|
+
_context.prev = 25;
|
|
2477
|
+
_context.next = 28;
|
|
2478
|
+
return getLocation(service.url, collectionId, instance.id, nearbyLocation.id || '', queryParamArr);
|
|
2479
|
+
case 28:
|
|
2480
|
+
return _context.abrupt("return", _context.sent);
|
|
2481
|
+
case 31:
|
|
2482
|
+
_context.prev = 31;
|
|
2483
|
+
_context.t2 = _context["catch"](25);
|
|
2484
|
+
throw new Error(getErrorMessage(parameter));
|
|
2485
|
+
case 34:
|
|
2486
|
+
throw new Error(getErrorMessage(parameter));
|
|
2487
|
+
case 35:
|
|
2488
|
+
throw new Error(getErrorMessage(parameter));
|
|
2489
|
+
case 36:
|
|
2490
|
+
case "end":
|
|
2491
|
+
return _context.stop();
|
|
2492
|
+
}
|
|
2493
|
+
}, _callee, null, [[5, 11], [14, 21], [25, 31]]);
|
|
2494
|
+
}));
|
|
2495
|
+
return function fetchEdrParameter(_x, _x2, _x3, _x4, _x5, _x6, _x7) {
|
|
2496
|
+
return _ref.apply(this, arguments);
|
|
2497
|
+
};
|
|
2498
|
+
}();
|
|
2499
|
+
|
|
2500
|
+
// Ensures every timeseries query starts with the same query key
|
|
2501
|
+
var generateTimeSeriesQueryKeys = function generateTimeSeriesQueryKeys(queryKeys) {
|
|
2502
|
+
return ['time-series'].concat(queryKeys);
|
|
2503
|
+
};
|
|
2504
|
+
var timeseriesEDRQueryOptions = {
|
|
2505
|
+
getServiceInformationQuery: function getServiceInformationQuery(serviceUrl) {
|
|
2506
|
+
return queryOptions({
|
|
2507
|
+
queryKey: generateTimeSeriesQueryKeys(['get-service-information', serviceUrl]),
|
|
2508
|
+
queryFn: function () {
|
|
2509
|
+
var _queryFn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
2510
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2511
|
+
while (1) switch (_context.prev = _context.next) {
|
|
2512
|
+
case 0:
|
|
2513
|
+
return _context.abrupt("return", getServiceInformation(serviceUrl));
|
|
2514
|
+
case 1:
|
|
2515
|
+
case "end":
|
|
2516
|
+
return _context.stop();
|
|
2517
|
+
}
|
|
2518
|
+
}, _callee);
|
|
2519
|
+
}));
|
|
2520
|
+
function queryFn() {
|
|
2521
|
+
return _queryFn.apply(this, arguments);
|
|
2522
|
+
}
|
|
2523
|
+
return queryFn;
|
|
2524
|
+
}(),
|
|
2525
|
+
enabled: !!serviceUrl
|
|
2526
|
+
});
|
|
2527
|
+
},
|
|
2528
|
+
getCollectionsQuery: function getCollectionsQuery(serviceUrl) {
|
|
2529
|
+
return queryOptions({
|
|
2530
|
+
queryKey: generateTimeSeriesQueryKeys(['get-collections', serviceUrl]),
|
|
2531
|
+
queryFn: function () {
|
|
2532
|
+
var _queryFn2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
2533
|
+
var result;
|
|
2534
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2535
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
2536
|
+
case 0:
|
|
2537
|
+
_context2.next = 2;
|
|
2538
|
+
return getCollections(serviceUrl);
|
|
2539
|
+
case 2:
|
|
2540
|
+
result = _context2.sent;
|
|
2541
|
+
return _context2.abrupt("return", result.collections);
|
|
2542
|
+
case 4:
|
|
2543
|
+
case "end":
|
|
2544
|
+
return _context2.stop();
|
|
2545
|
+
}
|
|
2546
|
+
}, _callee2);
|
|
2547
|
+
}));
|
|
2548
|
+
function queryFn() {
|
|
2549
|
+
return _queryFn2.apply(this, arguments);
|
|
2550
|
+
}
|
|
2551
|
+
return queryFn;
|
|
2552
|
+
}(),
|
|
2553
|
+
enabled: !!serviceUrl
|
|
2554
|
+
});
|
|
2555
|
+
},
|
|
2556
|
+
getCollectionDetailsQuery: function getCollectionDetailsQuery(service, collectionId) {
|
|
2557
|
+
return queryOptions({
|
|
2558
|
+
queryKey: generateTimeSeriesQueryKeys(['get-collection-details', service == null ? void 0 : service.url, collectionId]),
|
|
2559
|
+
queryFn: function () {
|
|
2560
|
+
var _queryFn3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
2561
|
+
var collection;
|
|
2562
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2563
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
2564
|
+
case 0:
|
|
2565
|
+
_context3.next = 2;
|
|
2566
|
+
return getCollection(service.url, collectionId);
|
|
2567
|
+
case 2:
|
|
2568
|
+
collection = _context3.sent;
|
|
2569
|
+
return _context3.abrupt("return", getCollectionDetails(service, collection));
|
|
2570
|
+
case 4:
|
|
2571
|
+
case "end":
|
|
2572
|
+
return _context3.stop();
|
|
2573
|
+
}
|
|
2574
|
+
}, _callee3);
|
|
2575
|
+
}));
|
|
2576
|
+
function queryFn() {
|
|
2577
|
+
return _queryFn3.apply(this, arguments);
|
|
2578
|
+
}
|
|
2579
|
+
return queryFn;
|
|
2580
|
+
}(),
|
|
2581
|
+
enabled: !!service && !!(service != null && service.url) && service.url !== '' && !!collectionId && collectionId !== ''
|
|
2582
|
+
});
|
|
2583
|
+
},
|
|
2584
|
+
getInstancesQuery: function getInstancesQuery(serviceUrl, collectionId, supportsInstances) {
|
|
2585
|
+
if (supportsInstances === void 0) {
|
|
2586
|
+
supportsInstances = true;
|
|
2587
|
+
}
|
|
2588
|
+
return queryOptions({
|
|
2589
|
+
queryKey: generateTimeSeriesQueryKeys(['get-instances', serviceUrl, collectionId]),
|
|
2590
|
+
queryFn: function () {
|
|
2591
|
+
var _queryFn4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
2592
|
+
var _yield$getInstances, instances;
|
|
2593
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
2594
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
2595
|
+
case 0:
|
|
2596
|
+
_context4.next = 2;
|
|
2597
|
+
return getInstances(serviceUrl, collectionId);
|
|
2598
|
+
case 2:
|
|
2599
|
+
_yield$getInstances = _context4.sent;
|
|
2600
|
+
instances = _yield$getInstances.instances;
|
|
2601
|
+
return _context4.abrupt("return", listSupportedInstances(instances));
|
|
2602
|
+
case 5:
|
|
2603
|
+
case "end":
|
|
2604
|
+
return _context4.stop();
|
|
2605
|
+
}
|
|
2606
|
+
}, _callee4);
|
|
2607
|
+
}));
|
|
2608
|
+
function queryFn() {
|
|
2609
|
+
return _queryFn4.apply(this, arguments);
|
|
2610
|
+
}
|
|
2611
|
+
return queryFn;
|
|
2612
|
+
}(),
|
|
2613
|
+
enabled: supportsInstances && !!serviceUrl && serviceUrl !== '' && !!collectionId && collectionId !== ''
|
|
2614
|
+
});
|
|
2615
|
+
}
|
|
2616
|
+
};
|
|
2617
|
+
var useGetServiceInformation = function useGetServiceInformation(serviceUrl) {
|
|
2618
|
+
return useQuery(timeseriesEDRQueryOptions.getServiceInformationQuery(serviceUrl));
|
|
2619
|
+
};
|
|
2620
|
+
var useGetCollections = function useGetCollections(serviceUrl) {
|
|
2621
|
+
return useQuery(timeseriesEDRQueryOptions.getCollectionsQuery(serviceUrl));
|
|
2622
|
+
};
|
|
2623
|
+
var useGetDetailsForCollection = function useGetDetailsForCollection(service, collectionId) {
|
|
2624
|
+
return useQuery(timeseriesEDRQueryOptions.getCollectionDetailsQuery(service, collectionId));
|
|
2625
|
+
};
|
|
2626
|
+
var useGetInstances = function useGetInstances(serviceUrl, collectionId, supportsInstances) {
|
|
2627
|
+
if (supportsInstances === void 0) {
|
|
2628
|
+
supportsInstances = true;
|
|
2629
|
+
}
|
|
2630
|
+
return useQuery(timeseriesEDRQueryOptions.getInstancesQuery(serviceUrl, collectionId, supportsInstances));
|
|
2631
|
+
};
|
|
2632
|
+
var useGetServiceCollectionDetails = function useGetServiceCollectionDetails(services, isOpen) {
|
|
2633
|
+
var queryClient = useQueryClient();
|
|
2688
2634
|
var queries = useMemo(function () {
|
|
2689
2635
|
return services.map(function (service) {
|
|
2690
2636
|
return {
|
|
2691
|
-
queryKey: ['
|
|
2692
|
-
queryFn: function
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2637
|
+
queryKey: generateTimeSeriesQueryKeys(['get-service-collections-details', service == null ? void 0 : service.id, service == null ? void 0 : service.url]),
|
|
2638
|
+
queryFn: function () {
|
|
2639
|
+
var _queryFn5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
2640
|
+
var collections;
|
|
2641
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
2642
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
2643
|
+
case 0:
|
|
2644
|
+
_context5.next = 2;
|
|
2645
|
+
return queryClient.fetchQuery(timeseriesEDRQueryOptions.getCollectionsQuery(service.url));
|
|
2646
|
+
case 2:
|
|
2647
|
+
collections = _context5.sent;
|
|
2648
|
+
return _context5.abrupt("return", getServiceCollectionDetails(service, collections));
|
|
2649
|
+
case 4:
|
|
2650
|
+
case "end":
|
|
2651
|
+
return _context5.stop();
|
|
2652
|
+
}
|
|
2653
|
+
}, _callee5);
|
|
2654
|
+
}));
|
|
2655
|
+
function queryFn() {
|
|
2656
|
+
return _queryFn5.apply(this, arguments);
|
|
2657
|
+
}
|
|
2658
|
+
return queryFn;
|
|
2659
|
+
}(),
|
|
2660
|
+
enabled: isOpen && !!(service != null && service.id) && !!(service != null && service.url),
|
|
2696
2661
|
refetchInterval: 10 * 60 * 1000
|
|
2697
2662
|
};
|
|
2698
2663
|
});
|
|
2699
|
-
}, [services]);
|
|
2664
|
+
}, [services, isOpen, queryClient]);
|
|
2700
2665
|
return useQueries({
|
|
2701
2666
|
queries: queries,
|
|
2702
2667
|
combine: function combine(results) {
|
|
@@ -2720,46 +2685,144 @@ var useGetCollectionDetails = function useGetCollectionDetails(services) {
|
|
|
2720
2685
|
}
|
|
2721
2686
|
});
|
|
2722
2687
|
};
|
|
2688
|
+
var useGetCollectionsAndInstanceDetails = function useGetCollectionsAndInstanceDetails(queryData) {
|
|
2689
|
+
var queryClient = useQueryClient();
|
|
2690
|
+
var queries = useMemo(function () {
|
|
2691
|
+
return Object.values(queryData).map(function (query) {
|
|
2692
|
+
return {
|
|
2693
|
+
queryKey: generateTimeSeriesQueryKeys(['get-collection-and-instances-details', query.service.url, query.collectionId]),
|
|
2694
|
+
queryFn: function () {
|
|
2695
|
+
var _queryFn6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
2696
|
+
var _collectionDetails$da, _collectionDetails$da2, _collectionDetails$da3;
|
|
2697
|
+
var service, collectionId, collectionDetails, allInstances;
|
|
2698
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
2699
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
2700
|
+
case 0:
|
|
2701
|
+
service = query.service, collectionId = query.collectionId;
|
|
2702
|
+
_context6.next = 3;
|
|
2703
|
+
return queryClient.fetchQuery(timeseriesEDRQueryOptions.getCollectionDetailsQuery(service, collectionId));
|
|
2704
|
+
case 3:
|
|
2705
|
+
collectionDetails = _context6.sent;
|
|
2706
|
+
if (!(!!((_collectionDetails$da = collectionDetails.dataQueries) != null && _collectionDetails$da.instances) && (!!((_collectionDetails$da2 = collectionDetails.dataQueries) != null && _collectionDetails$da2.locations) || !!((_collectionDetails$da3 = collectionDetails.dataQueries) != null && _collectionDetails$da3.position)))) {
|
|
2707
|
+
_context6.next = 9;
|
|
2708
|
+
break;
|
|
2709
|
+
}
|
|
2710
|
+
_context6.next = 7;
|
|
2711
|
+
return queryClient.fetchQuery(timeseriesEDRQueryOptions.getInstancesQuery(service.url, collectionId));
|
|
2712
|
+
case 7:
|
|
2713
|
+
allInstances = _context6.sent;
|
|
2714
|
+
return _context6.abrupt("return", Object.assign({}, collectionDetails, {
|
|
2715
|
+
allInstances: allInstances
|
|
2716
|
+
}));
|
|
2717
|
+
case 9:
|
|
2718
|
+
return _context6.abrupt("return", collectionDetails);
|
|
2719
|
+
case 10:
|
|
2720
|
+
case "end":
|
|
2721
|
+
return _context6.stop();
|
|
2722
|
+
}
|
|
2723
|
+
}, _callee6);
|
|
2724
|
+
}));
|
|
2725
|
+
function queryFn() {
|
|
2726
|
+
return _queryFn6.apply(this, arguments);
|
|
2727
|
+
}
|
|
2728
|
+
return queryFn;
|
|
2729
|
+
}(),
|
|
2730
|
+
enabled: !!query.service.url && !!query.collectionId,
|
|
2731
|
+
refetchInterval: 5 * 60 * 1000
|
|
2732
|
+
};
|
|
2733
|
+
});
|
|
2734
|
+
}, [queryClient, queryData]);
|
|
2735
|
+
return useQueries({
|
|
2736
|
+
queries: queries,
|
|
2737
|
+
combine: function combine(results) {
|
|
2738
|
+
var _results$find2;
|
|
2739
|
+
var data = results.filter(function (query) {
|
|
2740
|
+
return query.isSuccess && query.data;
|
|
2741
|
+
}).flatMap(function (query) {
|
|
2742
|
+
return query.data || [];
|
|
2743
|
+
});
|
|
2744
|
+
var isFetching = results.some(function (result) {
|
|
2745
|
+
return result.isFetching;
|
|
2746
|
+
});
|
|
2747
|
+
var error = (_results$find2 = results.find(function (result) {
|
|
2748
|
+
return result == null ? void 0 : result.error;
|
|
2749
|
+
})) == null ? void 0 : _results$find2.error;
|
|
2750
|
+
return {
|
|
2751
|
+
data: data,
|
|
2752
|
+
isFetching: isFetching,
|
|
2753
|
+
error: error
|
|
2754
|
+
};
|
|
2755
|
+
}
|
|
2756
|
+
});
|
|
2757
|
+
};
|
|
2723
2758
|
var useGetPlotsWithData = function useGetPlotsWithData(plotsWithoutData, selectedLocation, services, splitGeoJsonByCollection) {
|
|
2724
|
-
var _useGetCollectionDeta = useGetCollectionDetails(services),
|
|
2725
|
-
collections = _useGetCollectionDeta.data;
|
|
2726
2759
|
var _useState = useState([]),
|
|
2727
2760
|
plotsWithData = _useState[0],
|
|
2728
2761
|
setPlotsWithData = _useState[1];
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2762
|
+
// Create array of collections we need to query for the data
|
|
2763
|
+
var collectionsList = useMemo(function () {
|
|
2764
|
+
return extractUsedCollections(plotsWithoutData, services);
|
|
2765
|
+
}, [plotsWithoutData, services]);
|
|
2766
|
+
// First fetch collection and any relevant instance data
|
|
2767
|
+
var _useGetCollectionsAnd = useGetCollectionsAndInstanceDetails(collectionsList),
|
|
2768
|
+
collectionDetails = _useGetCollectionsAnd.data;
|
|
2735
2769
|
var geojsonMap = useMemo(function () {
|
|
2736
2770
|
return new Map(splitGeoJsonByCollection.map(function (gjs) {
|
|
2737
2771
|
return [gjs.serviceName + "_" + gjs.collectionName, gjs];
|
|
2738
2772
|
}));
|
|
2739
2773
|
}, [splitGeoJsonByCollection]);
|
|
2740
|
-
|
|
2741
|
-
return collections == null ? void 0 : collections.reduce(function (acc, collection) {
|
|
2742
|
-
var _Object$assign2;
|
|
2743
|
-
return Object.assign({}, acc, (_Object$assign2 = {}, _Object$assign2[collection.collectionId] = collection, _Object$assign2));
|
|
2744
|
-
}, {});
|
|
2745
|
-
}, [collections]);
|
|
2774
|
+
// Construct all queries to be executed
|
|
2746
2775
|
var queries = useMemo(function () {
|
|
2747
2776
|
return plotsWithoutData.parameters.map(function (parameter) {
|
|
2748
|
-
var _parameter$dimension;
|
|
2749
|
-
var service =
|
|
2750
|
-
var collection =
|
|
2777
|
+
var _collection$allInstan, _parameter$dimension;
|
|
2778
|
+
var service = collectionsList[parameter.serviceId + "-" + parameter.collectionId].service;
|
|
2779
|
+
var collection = collectionDetails == null ? void 0 : collectionDetails.find(function (collection) {
|
|
2780
|
+
return collection.serviceId === parameter.serviceId && collection.collectionId === parameter.collectionId;
|
|
2781
|
+
});
|
|
2782
|
+
var instanceInfo = parameter.instanceId && (collection == null || (_collection$allInstan = collection.allInstances) == null ? void 0 : _collection$allInstan.find(function (inst) {
|
|
2783
|
+
return inst.id === parameter.instanceId;
|
|
2784
|
+
})) || latestInstance((collection == null ? void 0 : collection.allInstances) || []) || {
|
|
2785
|
+
id: ''
|
|
2786
|
+
};
|
|
2787
|
+
// Construct timeinterval that needs to be fetched
|
|
2788
|
+
// Create here so if new data is advertised by the collection/instance a new request is made
|
|
2789
|
+
var intervalParam = constructTimeInterval(collection, instanceInfo);
|
|
2751
2790
|
return {
|
|
2752
|
-
queryKey: ['parameter-data', parameter.propertyName, parameter.serviceId, parameter.collectionId, parameter.instanceId, (_parameter$dimension = parameter.dimension) == null ? void 0 : _parameter$dimension.value, selectedLocation.lat, selectedLocation.lon],
|
|
2753
|
-
queryFn: function
|
|
2754
|
-
var
|
|
2755
|
-
|
|
2756
|
-
|
|
2791
|
+
queryKey: generateTimeSeriesQueryKeys(['get-parameter-data', parameter.propertyName, parameter.serviceId, parameter.collectionId, parameter.instanceId || 'undefined', ((_parameter$dimension = parameter.dimension) == null ? void 0 : _parameter$dimension.value) || 'undefined', intervalParam, selectedLocation.lat.toString() || 'undefined', selectedLocation.lon.toString() || 'undefined']),
|
|
2792
|
+
queryFn: function () {
|
|
2793
|
+
var _queryFn7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
2794
|
+
var edrResponse;
|
|
2795
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
2796
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
2797
|
+
case 0:
|
|
2798
|
+
if (collection) {
|
|
2799
|
+
_context7.next = 2;
|
|
2800
|
+
break;
|
|
2801
|
+
}
|
|
2802
|
+
throw new Error('No collection found for parameter');
|
|
2803
|
+
case 2:
|
|
2804
|
+
_context7.next = 4;
|
|
2805
|
+
return fetchEdrParameter(parameter, selectedLocation, service, geojsonMap, intervalParam, collection, instanceInfo);
|
|
2806
|
+
case 4:
|
|
2807
|
+
edrResponse = _context7.sent;
|
|
2808
|
+
return _context7.abrupt("return", extractDataFromfetchEdrParameterResponse(edrResponse, parameter));
|
|
2809
|
+
case 6:
|
|
2810
|
+
case "end":
|
|
2811
|
+
return _context7.stop();
|
|
2812
|
+
}
|
|
2813
|
+
}, _callee7);
|
|
2814
|
+
}));
|
|
2815
|
+
function queryFn() {
|
|
2816
|
+
return _queryFn7.apply(this, arguments);
|
|
2817
|
+
}
|
|
2818
|
+
return queryFn;
|
|
2819
|
+
}(),
|
|
2757
2820
|
enabled: !!parameter && !!selectedLocation.lon && !!selectedLocation.lat && !!service && !!collection,
|
|
2758
2821
|
refetchInterval: 5 * 60 * 1000,
|
|
2759
2822
|
retry: false
|
|
2760
2823
|
};
|
|
2761
2824
|
});
|
|
2762
|
-
}, [
|
|
2825
|
+
}, [collectionDetails, geojsonMap, plotsWithoutData.parameters, selectedLocation, collectionsList]);
|
|
2763
2826
|
var results = useQueries({
|
|
2764
2827
|
queries: queries,
|
|
2765
2828
|
combine: function combine(results) {
|
|
@@ -2798,7 +2861,7 @@ var useGetLocations = function useGetLocations(options) {
|
|
|
2798
2861
|
var queries = useMemo(function () {
|
|
2799
2862
|
return options.map(function (option) {
|
|
2800
2863
|
return {
|
|
2801
|
-
queryKey: ['timeseries-locations', option.service.id, option.collectionId],
|
|
2864
|
+
queryKey: generateTimeSeriesQueryKeys(['get-timeseries-locations', option.service.id, option.collectionId]),
|
|
2802
2865
|
queryFn: function queryFn() {
|
|
2803
2866
|
return getLocations(option.service.url, option.collectionId);
|
|
2804
2867
|
}
|
|
@@ -2808,15 +2871,15 @@ var useGetLocations = function useGetLocations(options) {
|
|
|
2808
2871
|
var results = useQueries({
|
|
2809
2872
|
queries: queries,
|
|
2810
2873
|
combine: function combine(results) {
|
|
2811
|
-
var _results$
|
|
2874
|
+
var _results$find3;
|
|
2812
2875
|
var resultList = results.map(function (result, index) {
|
|
2813
2876
|
var _result$data;
|
|
2814
2877
|
if (result.isPending || result.isError) {
|
|
2815
2878
|
return undefined;
|
|
2816
2879
|
}
|
|
2817
2880
|
var _queries$index$queryK = queries[index].queryKey,
|
|
2818
|
-
serviceId = _queries$index$queryK[
|
|
2819
|
-
collectionId = _queries$index$queryK[
|
|
2881
|
+
serviceId = _queries$index$queryK[2],
|
|
2882
|
+
collectionId = _queries$index$queryK[3];
|
|
2820
2883
|
var features = result == null || (_result$data = result.data) == null ? void 0 : _result$data.features.map(function (feature) {
|
|
2821
2884
|
var geometry = feature.geometry;
|
|
2822
2885
|
var featureClass = getFeatureClass(geometry.type);
|
|
@@ -2848,9 +2911,9 @@ var useGetLocations = function useGetLocations(options) {
|
|
|
2848
2911
|
var isFetching = results.some(function (result) {
|
|
2849
2912
|
return result.isFetching;
|
|
2850
2913
|
});
|
|
2851
|
-
var error = (_results$
|
|
2914
|
+
var error = (_results$find3 = results.find(function (result) {
|
|
2852
2915
|
return result == null ? void 0 : result.error;
|
|
2853
|
-
})) == null ? void 0 : _results$
|
|
2916
|
+
})) == null ? void 0 : _results$find3.error;
|
|
2854
2917
|
return {
|
|
2855
2918
|
data: data,
|
|
2856
2919
|
isFetching: isFetching,
|
|
@@ -2860,115 +2923,27 @@ var useGetLocations = function useGetLocations(options) {
|
|
|
2860
2923
|
});
|
|
2861
2924
|
return results;
|
|
2862
2925
|
};
|
|
2863
|
-
var useGetServiceInformation = function useGetServiceInformation(serviceUrl) {
|
|
2864
|
-
return useQuery({
|
|
2865
|
-
queryKey: ['service-information', serviceUrl],
|
|
2866
|
-
queryFn: function () {
|
|
2867
|
-
var _queryFn = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
2868
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
2869
|
-
while (1) switch (_context.prev = _context.next) {
|
|
2870
|
-
case 0:
|
|
2871
|
-
return _context.abrupt("return", getServiceInformation(serviceUrl));
|
|
2872
|
-
case 1:
|
|
2873
|
-
case "end":
|
|
2874
|
-
return _context.stop();
|
|
2875
|
-
}
|
|
2876
|
-
}, _callee);
|
|
2877
|
-
}));
|
|
2878
|
-
function queryFn() {
|
|
2879
|
-
return _queryFn.apply(this, arguments);
|
|
2880
|
-
}
|
|
2881
|
-
return queryFn;
|
|
2882
|
-
}(),
|
|
2883
|
-
enabled: !!serviceUrl
|
|
2884
|
-
});
|
|
2885
|
-
};
|
|
2886
|
-
var useGetCollections = function useGetCollections(serviceUrl) {
|
|
2887
|
-
return useQuery({
|
|
2888
|
-
queryKey: ['collections', serviceUrl],
|
|
2889
|
-
queryFn: function () {
|
|
2890
|
-
var _queryFn2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
2891
|
-
var result;
|
|
2892
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
2893
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
2894
|
-
case 0:
|
|
2895
|
-
_context2.next = 2;
|
|
2896
|
-
return getCollections(serviceUrl);
|
|
2897
|
-
case 2:
|
|
2898
|
-
result = _context2.sent;
|
|
2899
|
-
return _context2.abrupt("return", result.collections);
|
|
2900
|
-
case 4:
|
|
2901
|
-
case "end":
|
|
2902
|
-
return _context2.stop();
|
|
2903
|
-
}
|
|
2904
|
-
}, _callee2);
|
|
2905
|
-
}));
|
|
2906
|
-
function queryFn() {
|
|
2907
|
-
return _queryFn2.apply(this, arguments);
|
|
2908
|
-
}
|
|
2909
|
-
return queryFn;
|
|
2910
|
-
}(),
|
|
2911
|
-
enabled: !!serviceUrl
|
|
2912
|
-
});
|
|
2913
|
-
};
|
|
2914
|
-
var useGetInstances = function useGetInstances(serviceUrl, collectionId) {
|
|
2915
|
-
return useQuery({
|
|
2916
|
-
queryKey: ['instances', serviceUrl, collectionId],
|
|
2917
|
-
queryFn: function () {
|
|
2918
|
-
var _queryFn3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
2919
|
-
var result;
|
|
2920
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
2921
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
2922
|
-
case 0:
|
|
2923
|
-
_context3.next = 2;
|
|
2924
|
-
return getSupportedInstances(serviceUrl, collectionId, true);
|
|
2925
|
-
case 2:
|
|
2926
|
-
result = _context3.sent;
|
|
2927
|
-
return _context3.abrupt("return", result);
|
|
2928
|
-
case 4:
|
|
2929
|
-
case "end":
|
|
2930
|
-
return _context3.stop();
|
|
2931
|
-
}
|
|
2932
|
-
}, _callee3);
|
|
2933
|
-
}));
|
|
2934
|
-
function queryFn() {
|
|
2935
|
-
return _queryFn3.apply(this, arguments);
|
|
2936
|
-
}
|
|
2937
|
-
return queryFn;
|
|
2938
|
-
}(),
|
|
2939
|
-
enabled: !!serviceUrl && !!collectionId
|
|
2940
|
-
});
|
|
2941
|
-
};
|
|
2942
2926
|
|
|
2943
2927
|
var ParameterNameSelect = function ParameterNameSelect(_ref) {
|
|
2944
2928
|
var rowIsEnabled = _ref.rowIsEnabled,
|
|
2945
2929
|
parameter = _ref.parameter,
|
|
2946
2930
|
patchParameter = _ref.patchParameter,
|
|
2947
2931
|
t = _ref.t;
|
|
2948
|
-
var serviceId = parameter.serviceId
|
|
2932
|
+
var serviceId = parameter.serviceId,
|
|
2933
|
+
collectionId = parameter.collectionId;
|
|
2949
2934
|
var service = useSelector(function (store) {
|
|
2950
2935
|
return getService(store, serviceId);
|
|
2951
2936
|
});
|
|
2952
|
-
var
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
var _useGetCollectionDeta = useGetCollectionDetails([service]),
|
|
2956
|
-
collections = _useGetCollectionDeta.data;
|
|
2957
|
-
React__default.useEffect(function () {
|
|
2958
|
-
if (collections) {
|
|
2959
|
-
var params = getDetailsForCollectionId(collections, parameter.collectionId);
|
|
2960
|
-
if (params) {
|
|
2961
|
-
setParameterList(params.parameters);
|
|
2962
|
-
}
|
|
2963
|
-
}
|
|
2964
|
-
}, [collections, parameter.collectionId]);
|
|
2937
|
+
var _useGetDetailsForColl = useGetDetailsForCollection(service, collectionId),
|
|
2938
|
+
collectionDetails = _useGetDetailsForColl.data;
|
|
2939
|
+
var parameterList = (collectionDetails == null ? void 0 : collectionDetails.parameters) || [];
|
|
2965
2940
|
var isFetching = parameterList.length === 0;
|
|
2966
2941
|
return jsxs(TooltipSelect, {
|
|
2967
2942
|
SelectDisplayProps: {
|
|
2968
2943
|
'aria-label': 'timeseriesManager-parameterName'
|
|
2969
2944
|
},
|
|
2970
2945
|
value: parameter.propertyName,
|
|
2971
|
-
tooltip: "Parameter: " + parameter.propertyName,
|
|
2946
|
+
tooltip: "Parameter: " + parameter.propertyName + " " + (parameter.propertyLabel ? '-' : '') + " " + (parameter.propertyLabel ? parameter.propertyLabel : ''),
|
|
2972
2947
|
isEnabled: rowIsEnabled,
|
|
2973
2948
|
onChange: function onChange(event) {
|
|
2974
2949
|
var selectedParam = parameterList.find(function (parameter) {
|
|
@@ -2996,7 +2971,7 @@ var ParameterNameSelect = function ParameterNameSelect(_ref) {
|
|
|
2996
2971
|
}), parameterList.map(function (parameter) {
|
|
2997
2972
|
return jsx(MenuItem, {
|
|
2998
2973
|
value: parameter.propertyName,
|
|
2999
|
-
children: parameter.propertyName
|
|
2974
|
+
children: parameter.propertyLabel || parameter.propertyName
|
|
3000
2975
|
}, "parametermenu" + parameter.propertyName);
|
|
3001
2976
|
})]
|
|
3002
2977
|
});
|
|
@@ -3119,16 +3094,10 @@ var ParameterDimensionIdSelect = function ParameterDimensionIdSelect(_ref) {
|
|
|
3119
3094
|
id: parameter.id,
|
|
3120
3095
|
dimension: {
|
|
3121
3096
|
id: event.target.value,
|
|
3097
|
+
// Select the first value of selected dimension by default
|
|
3122
3098
|
value: ''
|
|
3123
3099
|
}
|
|
3124
3100
|
};
|
|
3125
|
-
// Select the first value of selected dimension by default
|
|
3126
|
-
if (newParameter.dimension.id && newParameter.dimension.id !== REFERENCE_TIME_ID) {
|
|
3127
|
-
var _customDimensions$fin;
|
|
3128
|
-
newParameter.dimension.value = ((_customDimensions$fin = customDimensions.find(function (dimension) {
|
|
3129
|
-
return dimension.id === newParameter.dimension.id;
|
|
3130
|
-
})) == null ? void 0 : _customDimensions$fin.values[0]) || '';
|
|
3131
|
-
}
|
|
3132
3101
|
patchParameter(newParameter);
|
|
3133
3102
|
},
|
|
3134
3103
|
children: [jsx(MenuItem, {
|
|
@@ -3148,25 +3117,18 @@ var ParameterDimensionIdSelect = function ParameterDimensionIdSelect(_ref) {
|
|
|
3148
3117
|
});
|
|
3149
3118
|
};
|
|
3150
3119
|
|
|
3120
|
+
var defaultValue = 'none';
|
|
3151
3121
|
var ParameterDimensionValueSelect = function ParameterDimensionValueSelect(_ref) {
|
|
3152
|
-
var _parameter$dimension2, _parameter$dimension3, _parameter$dimension4, _parameter$dimension5, _parameter$dimension6;
|
|
3122
|
+
var _parameter$dimension2, _parameter$dimension3, _parameter$dimension4, _parameter$dimension5, _parameter$dimension6, _parameter$dimension8, _parameter$dimension9;
|
|
3153
3123
|
var rowIsEnabled = _ref.rowIsEnabled,
|
|
3154
3124
|
parameter = _ref.parameter,
|
|
3155
3125
|
customDimensions = _ref.customDimensions,
|
|
3156
3126
|
patchParameter = _ref.patchParameter,
|
|
3157
3127
|
t = _ref.t;
|
|
3158
|
-
var
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
if (customDimensions) {
|
|
3163
|
-
setSelectedDimension(customDimensions.find(function (dimension) {
|
|
3164
|
-
var _parameter$dimension;
|
|
3165
|
-
return dimension.id === ((_parameter$dimension = parameter.dimension) == null ? void 0 : _parameter$dimension.id);
|
|
3166
|
-
}));
|
|
3167
|
-
}
|
|
3168
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3169
|
-
}, [customDimensions, (_parameter$dimension2 = parameter.dimension) == null ? void 0 : _parameter$dimension2.id]);
|
|
3128
|
+
var selectedDimension = customDimensions.find(function (dimension) {
|
|
3129
|
+
var _parameter$dimension;
|
|
3130
|
+
return dimension.id === ((_parameter$dimension = parameter.dimension) == null ? void 0 : _parameter$dimension.id);
|
|
3131
|
+
}) || customDimensions[0];
|
|
3170
3132
|
if (!selectedDimension || !customDimensions || customDimensions.length === 0) {
|
|
3171
3133
|
return null;
|
|
3172
3134
|
}
|
|
@@ -3174,15 +3136,16 @@ var ParameterDimensionValueSelect = function ParameterDimensionValueSelect(_ref)
|
|
|
3174
3136
|
SelectDisplayProps: {
|
|
3175
3137
|
'aria-label': 'timeseriesManager-dimensionValue'
|
|
3176
3138
|
},
|
|
3177
|
-
value: ((_parameter$dimension3 = parameter.dimension) == null ? void 0 : _parameter$dimension3.value)
|
|
3139
|
+
value: ((_parameter$dimension2 = parameter.dimension) == null ? void 0 : _parameter$dimension2.value) === undefined || ((_parameter$dimension3 = parameter.dimension) == null ? void 0 : _parameter$dimension3.value) === '' ? defaultValue : (_parameter$dimension4 = parameter.dimension) == null ? void 0 : _parameter$dimension4.value,
|
|
3178
3140
|
"data-testid": "parameterDimensionValueSelect",
|
|
3179
3141
|
tooltip: t('timeseries-dimension-value') + ": " + (((_parameter$dimension5 = parameter.dimension) == null ? void 0 : _parameter$dimension5.value) !== undefined ? (_parameter$dimension6 = parameter.dimension) == null ? void 0 : _parameter$dimension6.value : ''),
|
|
3180
3142
|
isEnabled: rowIsEnabled,
|
|
3181
3143
|
onChange: function onChange(event) {
|
|
3144
|
+
var _parameter$dimension7;
|
|
3182
3145
|
var newParameter = {
|
|
3183
3146
|
id: parameter.id,
|
|
3184
3147
|
dimension: {
|
|
3185
|
-
id: parameter.dimension.id,
|
|
3148
|
+
id: ((_parameter$dimension7 = parameter.dimension) == null ? void 0 : _parameter$dimension7.id) || customDimensions[0].id,
|
|
3186
3149
|
value: event.target.value
|
|
3187
3150
|
}
|
|
3188
3151
|
};
|
|
@@ -3191,7 +3154,11 @@ var ParameterDimensionValueSelect = function ParameterDimensionValueSelect(_ref)
|
|
|
3191
3154
|
children: [jsx(MenuItem, {
|
|
3192
3155
|
disabled: true,
|
|
3193
3156
|
children: t('timeseries-dimension-value')
|
|
3194
|
-
}),
|
|
3157
|
+
}), (((_parameter$dimension8 = parameter.dimension) == null ? void 0 : _parameter$dimension8.value) === undefined || ((_parameter$dimension9 = parameter.dimension) == null ? void 0 : _parameter$dimension9.value) === '') && jsx(MenuItem, {
|
|
3158
|
+
value: "none",
|
|
3159
|
+
"data-testid": "timeseries-dimension-value-none",
|
|
3160
|
+
children: t('timeseries-dimension-none')
|
|
3161
|
+
}, "dimensionvaluemenu-none"), selectedDimension && selectedDimension.values && selectedDimension.values.map(function (value) {
|
|
3195
3162
|
return jsx(MenuItem, {
|
|
3196
3163
|
value: value,
|
|
3197
3164
|
"data-testid": "timeseries-dimension-value-" + value,
|
|
@@ -3285,7 +3252,7 @@ var ReferenceTimeSelect = function ReferenceTimeSelect(_ref) {
|
|
|
3285
3252
|
};
|
|
3286
3253
|
|
|
3287
3254
|
var ParameterDimensionSelect = function ParameterDimensionSelect(_ref) {
|
|
3288
|
-
var _parameter$dimension, _parameter$dimension2;
|
|
3255
|
+
var _collectionDetails$da, _parameter$dimension, _parameter$dimension2, _parameter$dimension3;
|
|
3289
3256
|
var rowIsEnabled = _ref.rowIsEnabled,
|
|
3290
3257
|
parameter = _ref.parameter,
|
|
3291
3258
|
patchParameter = _ref.patchParameter,
|
|
@@ -3295,24 +3262,16 @@ var ParameterDimensionSelect = function ParameterDimensionSelect(_ref) {
|
|
|
3295
3262
|
var service = useSelector(function (store) {
|
|
3296
3263
|
return getService(store, serviceId);
|
|
3297
3264
|
});
|
|
3298
|
-
var _React$useState = React__default.useState([]),
|
|
3299
|
-
customDimensions = _React$useState[0],
|
|
3300
|
-
setCustomDimensions = _React$useState[1];
|
|
3301
3265
|
var _useState = useState([]),
|
|
3302
3266
|
refTimeList = _useState[0],
|
|
3303
3267
|
setRefTimeList = _useState[1];
|
|
3304
|
-
var
|
|
3305
|
-
|
|
3306
|
-
|
|
3268
|
+
var _useGetDetailsForColl = useGetDetailsForCollection(service, collectionId),
|
|
3269
|
+
collectionDetails = _useGetDetailsForColl.data;
|
|
3270
|
+
// Only do an instances call if instances are supported by the collection
|
|
3271
|
+
var supportsInstances = !!(collectionDetails != null && (_collectionDetails$da = collectionDetails.dataQueries) != null && _collectionDetails$da.instances);
|
|
3272
|
+
var _useGetInstances = useGetInstances(service == null ? void 0 : service.url, collectionId, supportsInstances),
|
|
3307
3273
|
instances = _useGetInstances.data;
|
|
3308
|
-
|
|
3309
|
-
if (collections) {
|
|
3310
|
-
var params = getDetailsForCollectionId(collections, collectionId);
|
|
3311
|
-
if (params != null && params.customDimensions) {
|
|
3312
|
-
setCustomDimensions(params.customDimensions);
|
|
3313
|
-
}
|
|
3314
|
-
}
|
|
3315
|
-
}, [collections, collectionId]);
|
|
3274
|
+
var customDimensions = (collectionDetails == null ? void 0 : collectionDetails.customDimensions) || [];
|
|
3316
3275
|
React__default.useEffect(function () {
|
|
3317
3276
|
if (instances) {
|
|
3318
3277
|
// Sort the reference times in descending order (newest first)
|
|
@@ -3322,13 +3281,10 @@ var ParameterDimensionSelect = function ParameterDimensionSelect(_ref) {
|
|
|
3322
3281
|
setRefTimeList(sortedRefTimeList);
|
|
3323
3282
|
}
|
|
3324
3283
|
}, [instances]);
|
|
3325
|
-
var paramInstanceId = parameter.instanceId || (refTimeList.length > 0 ? refTimeList[0].id : undefined);
|
|
3326
3284
|
var hasReferenceTime = refTimeList.length > 0 && !refTimeList.some(function (value) {
|
|
3327
3285
|
return value.id === 'unvalidated';
|
|
3328
3286
|
});
|
|
3329
|
-
if
|
|
3330
|
-
return null;
|
|
3331
|
-
}
|
|
3287
|
+
// Show nothing if no reference time and neither any custom dimensions
|
|
3332
3288
|
if ((!customDimensions || customDimensions.length === 0) && !hasReferenceTime) {
|
|
3333
3289
|
return null;
|
|
3334
3290
|
}
|
|
@@ -3346,18 +3302,20 @@ var ParameterDimensionSelect = function ParameterDimensionSelect(_ref) {
|
|
|
3346
3302
|
})
|
|
3347
3303
|
}), jsx(Grid, {
|
|
3348
3304
|
size: "grow",
|
|
3349
|
-
children:
|
|
3305
|
+
children:
|
|
3306
|
+
// Show referene time select if no dimension selected yet and reference time is available OR if reference time has been selected
|
|
3307
|
+
!((_parameter$dimension = parameter.dimension) != null && _parameter$dimension.id) && hasReferenceTime || (_parameter$dimension2 = parameter.dimension) != null && _parameter$dimension2.id && ((_parameter$dimension3 = parameter.dimension) == null ? void 0 : _parameter$dimension3.id) === REFERENCE_TIME_ID ? jsx(ReferenceTimeSelect, {
|
|
3350
3308
|
rowIsEnabled: rowIsEnabled,
|
|
3351
3309
|
parameter: parameter,
|
|
3352
|
-
customDimensions: customDimensions,
|
|
3353
3310
|
patchParameter: patchParameter,
|
|
3354
|
-
t: t
|
|
3355
|
-
|
|
3311
|
+
t: t,
|
|
3312
|
+
refTimeList: refTimeList
|
|
3313
|
+
}) : jsx(ParameterDimensionValueSelect, {
|
|
3356
3314
|
rowIsEnabled: rowIsEnabled,
|
|
3357
3315
|
parameter: parameter,
|
|
3316
|
+
customDimensions: customDimensions,
|
|
3358
3317
|
patchParameter: patchParameter,
|
|
3359
|
-
t: t
|
|
3360
|
-
refTimeList: refTimeList
|
|
3318
|
+
t: t
|
|
3361
3319
|
})
|
|
3362
3320
|
})]
|
|
3363
3321
|
});
|
|
@@ -3708,7 +3666,6 @@ var ParameterList = function ParameterList(_ref) {
|
|
|
3708
3666
|
})
|
|
3709
3667
|
});
|
|
3710
3668
|
};
|
|
3711
|
-
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
|
|
3712
3669
|
var getStyles$1 = function getStyles(isEnabled) {
|
|
3713
3670
|
return {
|
|
3714
3671
|
plot: {
|
|
@@ -4174,9 +4131,9 @@ var filterCollectionsParametersFromService = function filterCollectionsParameter
|
|
|
4174
4131
|
// Not found in collection - search in parameters
|
|
4175
4132
|
var filteredParamters = collection.parameters.reduce(function (filteredParameterList, parameter) {
|
|
4176
4133
|
var parameterContainsSearch = searchStringArray.every(function (search) {
|
|
4177
|
-
var _parameter$propertyNa;
|
|
4134
|
+
var _parameter$propertyNa, _parameter$propertyLa;
|
|
4178
4135
|
var searchLowercase = search.toLowerCase();
|
|
4179
|
-
var isSearchTextInParameterName = (_parameter$propertyNa = parameter.propertyName) == null ? void 0 : _parameter$propertyNa.toLowerCase().includes(searchLowercase);
|
|
4136
|
+
var isSearchTextInParameterName = ((_parameter$propertyNa = parameter.propertyName) == null ? void 0 : _parameter$propertyNa.toLowerCase().includes(searchLowercase)) || ((_parameter$propertyLa = parameter.propertyLabel) == null ? void 0 : _parameter$propertyLa.toLowerCase().includes(searchLowercase));
|
|
4180
4137
|
return isSearchTextInParameterName;
|
|
4181
4138
|
});
|
|
4182
4139
|
if (parameterContainsSearch) {
|
|
@@ -4385,6 +4342,7 @@ var TimeSeriesSelectList = function TimeSeriesSelectList(_ref) {
|
|
|
4385
4342
|
return collectionListItem.serviceId === plotParameter.serviceId && collectionListItem.collectionId === plotParameter.collectionId && parameter.propertyName === plotParameter.propertyName;
|
|
4386
4343
|
});
|
|
4387
4344
|
var plotHasParameter = Boolean(plotParameter);
|
|
4345
|
+
var paramDisplayName = parameter.propertyLabel ? parameter.propertyLabel + " (" + parameter.propertyName + ")" : parameter.propertyName;
|
|
4388
4346
|
return jsx(ListItem, {
|
|
4389
4347
|
sx: {
|
|
4390
4348
|
paddingLeft: '40px',
|
|
@@ -4406,7 +4364,7 @@ var TimeSeriesSelectList = function TimeSeriesSelectList(_ref) {
|
|
|
4406
4364
|
}
|
|
4407
4365
|
},
|
|
4408
4366
|
role: "listitem",
|
|
4409
|
-
"aria-label":
|
|
4367
|
+
"aria-label": paramDisplayName,
|
|
4410
4368
|
children: jsxs(Grid, {
|
|
4411
4369
|
container: true,
|
|
4412
4370
|
size: "grow",
|
|
@@ -4418,7 +4376,7 @@ var TimeSeriesSelectList = function TimeSeriesSelectList(_ref) {
|
|
|
4418
4376
|
children: jsx(Box, {
|
|
4419
4377
|
sx: fontStyling(),
|
|
4420
4378
|
children: jsx(SearchHighlight, {
|
|
4421
|
-
text:
|
|
4379
|
+
text: paramDisplayName,
|
|
4422
4380
|
search: searchFilter
|
|
4423
4381
|
})
|
|
4424
4382
|
})
|
|
@@ -4428,7 +4386,7 @@ var TimeSeriesSelectList = function TimeSeriesSelectList(_ref) {
|
|
|
4428
4386
|
marginRight: '8px'
|
|
4429
4387
|
},
|
|
4430
4388
|
children: [jsx(ParameterInfoButtonConnect, {
|
|
4431
|
-
parameter: plotParameter
|
|
4389
|
+
parameter: plotParameter != null ? plotParameter : Object.assign({}, parameter, {
|
|
4432
4390
|
plotId: selectPlot.plotId
|
|
4433
4391
|
})
|
|
4434
4392
|
}), jsx(CustomToggleButton, {
|
|
@@ -4467,9 +4425,10 @@ var TimeSeriesSelectList = function TimeSeriesSelectList(_ref) {
|
|
|
4467
4425
|
var TimeSeriesSelectListConnect = /*#__PURE__*/memo(function (_ref) {
|
|
4468
4426
|
var selectPlot = _ref.selectPlot,
|
|
4469
4427
|
handleAddOrRemoveClick = _ref.handleAddOrRemoveClick,
|
|
4470
|
-
services = _ref.services
|
|
4471
|
-
|
|
4472
|
-
|
|
4428
|
+
services = _ref.services,
|
|
4429
|
+
isOpen = _ref.isOpen;
|
|
4430
|
+
var _useGetServiceCollect = useGetServiceCollectionDetails(services, isOpen),
|
|
4431
|
+
collectionList = _useGetServiceCollect.data;
|
|
4473
4432
|
var _useState = useState({}),
|
|
4474
4433
|
collectionListItemDetails = _useState[0],
|
|
4475
4434
|
setCollectionListItemDetails = _useState[1];
|
|
@@ -4818,7 +4777,9 @@ var Rows = function Rows(_ref2) {
|
|
|
4818
4777
|
children: [jsx(CustomTooltip, {
|
|
4819
4778
|
title: t('timeseries-update-service'),
|
|
4820
4779
|
placement: "left",
|
|
4821
|
-
|
|
4780
|
+
slotProps: {
|
|
4781
|
+
popper: tooltipPopperProps
|
|
4782
|
+
},
|
|
4822
4783
|
children: jsx("span", {
|
|
4823
4784
|
children: jsx(CustomIconButton, {
|
|
4824
4785
|
"aria-label": t('timeseries-update-service'),
|
|
@@ -4831,7 +4792,9 @@ var Rows = function Rows(_ref2) {
|
|
|
4831
4792
|
}), userAddedService ? jsx(CustomTooltip, {
|
|
4832
4793
|
title: t('timeseries-edit-service'),
|
|
4833
4794
|
placement: "left",
|
|
4834
|
-
|
|
4795
|
+
slotProps: {
|
|
4796
|
+
popper: tooltipPopperProps
|
|
4797
|
+
},
|
|
4835
4798
|
children: jsx("span", {
|
|
4836
4799
|
children: jsx(CustomIconButton, {
|
|
4837
4800
|
"aria-label": t('timeseries-edit-service'),
|
|
@@ -4844,7 +4807,9 @@ var Rows = function Rows(_ref2) {
|
|
|
4844
4807
|
}) : jsx(CustomTooltip, {
|
|
4845
4808
|
title: t('timeseries-show-service'),
|
|
4846
4809
|
placement: "left",
|
|
4847
|
-
|
|
4810
|
+
slotProps: {
|
|
4811
|
+
popper: tooltipPopperProps
|
|
4812
|
+
},
|
|
4848
4813
|
children: jsx("span", {
|
|
4849
4814
|
children: jsx(CustomIconButton, {
|
|
4850
4815
|
"aria-label": t('timeseries-show-service'),
|
|
@@ -4857,7 +4822,9 @@ var Rows = function Rows(_ref2) {
|
|
|
4857
4822
|
}), userAddedService && jsx(Box, {
|
|
4858
4823
|
children: jsx(CustomTooltip, {
|
|
4859
4824
|
title: deleteServiceTitle(serviceHasParametersInUse, t),
|
|
4860
|
-
|
|
4825
|
+
slotProps: {
|
|
4826
|
+
popper: tooltipPopperProps
|
|
4827
|
+
},
|
|
4861
4828
|
placement: "left",
|
|
4862
4829
|
children: jsx("span", {
|
|
4863
4830
|
children: jsx(CustomIconButton, {
|
|
@@ -5440,9 +5407,9 @@ var TimeSeriesSelect = function TimeSeriesSelect(_ref) {
|
|
|
5440
5407
|
services = _ref.services;
|
|
5441
5408
|
var _useTimeseriesTransla = useTimeseriesTranslation(),
|
|
5442
5409
|
t = _useTimeseriesTransla.t;
|
|
5443
|
-
var
|
|
5444
|
-
isFetching =
|
|
5445
|
-
error =
|
|
5410
|
+
var _useGetServiceCollect = useGetServiceCollectionDetails(services, isOpen),
|
|
5411
|
+
isFetching = _useGetServiceCollect.isFetching,
|
|
5412
|
+
error = _useGetServiceCollect.error;
|
|
5446
5413
|
return jsxs(ToolContainerDraggable, {
|
|
5447
5414
|
title: t('timeseries-select-for') + " " + selectPlot.title,
|
|
5448
5415
|
startSize: {
|
|
@@ -5498,7 +5465,8 @@ var TimeSeriesSelect = function TimeSeriesSelect(_ref) {
|
|
|
5498
5465
|
}), jsx(TimeSeriesSelectListConnect, {
|
|
5499
5466
|
selectPlot: selectPlot,
|
|
5500
5467
|
handleAddOrRemoveClick: handleAddOrRemoveClick,
|
|
5501
|
-
services: services
|
|
5468
|
+
services: services,
|
|
5469
|
+
isOpen: isOpen
|
|
5502
5470
|
}), jsx(ServicePopupConnect, {})]
|
|
5503
5471
|
})]
|
|
5504
5472
|
});
|
|
@@ -5556,7 +5524,11 @@ var TimeSeriesSelectConnect = function TimeSeriesSelectConnect(_ref) {
|
|
|
5556
5524
|
var ParameterInfoDialog = function ParameterInfoDialog(_ref) {
|
|
5557
5525
|
var onClose = _ref.onClose,
|
|
5558
5526
|
currentParameterInfo = _ref.currentParameterInfo,
|
|
5527
|
+
collectionInformation = _ref.collectionInformation,
|
|
5528
|
+
isLoadingCollectionInformation = _ref.isLoadingCollectionInformation,
|
|
5559
5529
|
instanceInformation = _ref.instanceInformation,
|
|
5530
|
+
isLoadingInstanceInformation = _ref.isLoadingInstanceInformation,
|
|
5531
|
+
supportsInstances = _ref.supportsInstances,
|
|
5560
5532
|
relatedService = _ref.relatedService,
|
|
5561
5533
|
isOpen = _ref.isOpen,
|
|
5562
5534
|
_ref$onMouseDown = _ref.onMouseDown,
|
|
@@ -5587,7 +5559,10 @@ var ParameterInfoDialog = function ParameterInfoDialog(_ref) {
|
|
|
5587
5559
|
sx: {
|
|
5588
5560
|
padding: 2
|
|
5589
5561
|
},
|
|
5590
|
-
children: [jsx(ParameterInfoText$1, {
|
|
5562
|
+
children: [currentParameterInfo.propertyLabel && jsx(ParameterInfoText$1, {
|
|
5563
|
+
label: t('timeseries-info-label'),
|
|
5564
|
+
value: currentParameterInfo.propertyLabel
|
|
5565
|
+
}), jsx(ParameterInfoText$1, {
|
|
5591
5566
|
label: t('timeseries-info-name'),
|
|
5592
5567
|
value: currentParameterInfo.propertyName
|
|
5593
5568
|
}), jsx(ParameterInfoText$1, {
|
|
@@ -5608,10 +5583,17 @@ var ParameterInfoDialog = function ParameterInfoDialog(_ref) {
|
|
|
5608
5583
|
label: t('timeseries-collection'),
|
|
5609
5584
|
value: currentParameterInfo.collectionId
|
|
5610
5585
|
}), jsx(QueryInfoElement, {
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5586
|
+
queryInformation: collectionInformation,
|
|
5587
|
+
isLoadingCollectionInformation: isLoadingCollectionInformation
|
|
5588
|
+
}), supportsInstances ? jsx(DimensionInfoElement, {
|
|
5589
|
+
instanceInformation: instanceInformation,
|
|
5590
|
+
isLoading: isLoadingInstanceInformation
|
|
5591
|
+
}) :
|
|
5592
|
+
// If no instances, display temporal and spatial extent here
|
|
5593
|
+
collectionInformation && jsx(ParameterInfoList, {
|
|
5594
|
+
label: currentParameterInfo.collectionId,
|
|
5595
|
+
list: generateInfoList(collectionInformation, t)
|
|
5596
|
+
}, currentParameterInfo.collectionId)]
|
|
5615
5597
|
})
|
|
5616
5598
|
});
|
|
5617
5599
|
};
|
|
@@ -5641,18 +5623,19 @@ var LoadingIndicator = function LoadingIndicator(_ref2) {
|
|
|
5641
5623
|
});
|
|
5642
5624
|
};
|
|
5643
5625
|
var QueryInfoElement = function QueryInfoElement(_ref3) {
|
|
5644
|
-
var
|
|
5626
|
+
var queryInformation = _ref3.queryInformation,
|
|
5627
|
+
isLoadingCollectionInformation = _ref3.isLoadingCollectionInformation;
|
|
5645
5628
|
var _useTimeseriesTransla2 = useTimeseriesTranslation(),
|
|
5646
5629
|
t = _useTimeseriesTransla2.t;
|
|
5647
|
-
if (
|
|
5630
|
+
if (isLoadingCollectionInformation) {
|
|
5648
5631
|
return jsx(LoadingIndicator, {
|
|
5649
5632
|
subtitle: t('timeseries-info-queries'),
|
|
5650
5633
|
textStyle: textStyle$1
|
|
5651
5634
|
});
|
|
5652
5635
|
}
|
|
5653
|
-
var queryInfo =
|
|
5654
|
-
var
|
|
5655
|
-
var queries = [(
|
|
5636
|
+
var queryInfo = !queryInformation ? t('timeseries-info-no-data-available') : function () {
|
|
5637
|
+
var dataQueries = queryInformation.dataQueries;
|
|
5638
|
+
var queries = [(dataQueries == null ? void 0 : dataQueries.locations) && 'locations', (dataQueries == null ? void 0 : dataQueries.position) && 'position'].filter(Boolean);
|
|
5656
5639
|
return queries.length === 0 ? t('timeseries-info-no-data-available') : queries.join(', ');
|
|
5657
5640
|
}();
|
|
5658
5641
|
return jsxs(Fragment, {
|
|
@@ -5667,11 +5650,40 @@ var QueryInfoElement = function QueryInfoElement(_ref3) {
|
|
|
5667
5650
|
})]
|
|
5668
5651
|
});
|
|
5669
5652
|
};
|
|
5670
|
-
var
|
|
5671
|
-
var
|
|
5653
|
+
var generateInfoList = function generateInfoList(element, t) {
|
|
5654
|
+
var _element$extent, _element$extent2;
|
|
5655
|
+
var infoList = [];
|
|
5656
|
+
if ((_element$extent = element.extent) != null && (_element$extent = _element$extent.temporal) != null && _element$extent.values) {
|
|
5657
|
+
infoList.push({
|
|
5658
|
+
label: t('timeseries-info-time'),
|
|
5659
|
+
icon: jsx(DimensionsTime, {}),
|
|
5660
|
+
value: element.extent.temporal.values.join(', ')
|
|
5661
|
+
});
|
|
5662
|
+
}
|
|
5663
|
+
if ((_element$extent2 = element.extent) != null && (_element$extent2 = _element$extent2.spatial) != null && _element$extent2.bbox) {
|
|
5664
|
+
// The EDR specification is unclear as to what the type of the bbox is so we cater for both implementations
|
|
5665
|
+
// [number, number, number, number] | [[number, number, number, number]]
|
|
5666
|
+
var bbox = typeof element.extent.spatial.bbox[0] === 'number' ? element.extent.spatial.bbox : element.extent.spatial.bbox[0];
|
|
5667
|
+
var value = t('timeseries-info-bbox-rendering', {
|
|
5668
|
+
west: bbox[0],
|
|
5669
|
+
south: bbox[1],
|
|
5670
|
+
east: bbox[2],
|
|
5671
|
+
north: bbox[3]
|
|
5672
|
+
});
|
|
5673
|
+
infoList.push({
|
|
5674
|
+
label: t('timeseries-info-bbox'),
|
|
5675
|
+
icon: jsx(DrawRegion, {}),
|
|
5676
|
+
value: value === 'timeseries-info-bbox-rendering' ? bbox.join(', ') : value
|
|
5677
|
+
});
|
|
5678
|
+
}
|
|
5679
|
+
return infoList;
|
|
5680
|
+
};
|
|
5681
|
+
var DimensionInfoElement = function DimensionInfoElement(_ref4) {
|
|
5682
|
+
var instanceInformation = _ref4.instanceInformation,
|
|
5683
|
+
isLoading = _ref4.isLoading;
|
|
5672
5684
|
var _useTimeseriesTransla3 = useTimeseriesTranslation(),
|
|
5673
5685
|
t = _useTimeseriesTransla3.t;
|
|
5674
|
-
if (
|
|
5686
|
+
if (isLoading) {
|
|
5675
5687
|
return jsx(LoadingIndicator, {
|
|
5676
5688
|
subtitle: t('timeseries-info-instance-dimensions'),
|
|
5677
5689
|
textStyle: textStyle$1
|
|
@@ -5682,37 +5694,16 @@ var InstanceInfoElement = function InstanceInfoElement(_ref4) {
|
|
|
5682
5694
|
variant: "subtitle2",
|
|
5683
5695
|
sx: textStyle$1,
|
|
5684
5696
|
children: t('timeseries-info-instance-dimensions')
|
|
5685
|
-
}), instanceInformation.
|
|
5697
|
+
}), !instanceInformation || instanceInformation.length === 0 ? jsx(Typography, {
|
|
5686
5698
|
variant: "body2",
|
|
5687
5699
|
sx: textStyleWithMargin$1,
|
|
5688
5700
|
children: t('timeseries-info-no-data-available')
|
|
5689
|
-
}) : [].concat(instanceInformation
|
|
5690
|
-
var
|
|
5691
|
-
var infoList = [];
|
|
5692
|
-
if ((_instance$extent = instance.extent) != null && (_instance$extent = _instance$extent.temporal) != null && _instance$extent.values) {
|
|
5693
|
-
infoList.push({
|
|
5694
|
-
label: t('timeseries-info-time'),
|
|
5695
|
-
icon: jsx(DimensionsTime, {}),
|
|
5696
|
-
value: instance.extent.temporal.values.join(', ')
|
|
5697
|
-
});
|
|
5698
|
-
}
|
|
5699
|
-
if ((_instance$extent2 = instance.extent) != null && _instance$extent2.spatial.bbox) {
|
|
5700
|
-
var value = t('timeseries-info-bbox-rendering', {
|
|
5701
|
-
west: instance.extent.spatial.bbox[0],
|
|
5702
|
-
south: instance.extent.spatial.bbox[1],
|
|
5703
|
-
east: instance.extent.spatial.bbox[2],
|
|
5704
|
-
north: instance.extent.spatial.bbox[3]
|
|
5705
|
-
});
|
|
5706
|
-
infoList.push({
|
|
5707
|
-
label: t('timeseries-info-bbox'),
|
|
5708
|
-
icon: jsx(DrawRegion, {}),
|
|
5709
|
-
value: value === 'timeseries-info-bbox-rendering' ? instance.extent.spatial.bbox.join(', ') : value
|
|
5710
|
-
});
|
|
5711
|
-
}
|
|
5701
|
+
}) : [].concat(instanceInformation).sort().reverse().map(function (element) {
|
|
5702
|
+
var infoList = generateInfoList(element, t);
|
|
5712
5703
|
return jsx(ParameterInfoList, {
|
|
5713
|
-
label:
|
|
5704
|
+
label: element.id,
|
|
5714
5705
|
list: infoList
|
|
5715
|
-
},
|
|
5706
|
+
}, element.id);
|
|
5716
5707
|
})]
|
|
5717
5708
|
});
|
|
5718
5709
|
};
|
|
@@ -5791,32 +5782,20 @@ var ParameterInfoList = function ParameterInfoList(_ref6) {
|
|
|
5791
5782
|
};
|
|
5792
5783
|
|
|
5793
5784
|
var ParameterInfoDialogConnect = function ParameterInfoDialogConnect() {
|
|
5794
|
-
var
|
|
5795
|
-
isLoading: false,
|
|
5796
|
-
instances: []
|
|
5797
|
-
}),
|
|
5798
|
-
temporalInformation = _useState[0],
|
|
5799
|
-
setTemporalInformation = _useState[1];
|
|
5785
|
+
var _collection$dataQueri;
|
|
5800
5786
|
var currentParameterInfoDisplayed = useSelector(getParameterInfoParameter);
|
|
5801
5787
|
var relatedService = useSelector(function (store) {
|
|
5802
5788
|
return getService(store, (currentParameterInfoDisplayed == null ? void 0 : currentParameterInfoDisplayed.serviceId) || '');
|
|
5803
|
-
})
|
|
5804
|
-
|
|
5789
|
+
}) || {
|
|
5790
|
+
url: ''
|
|
5791
|
+
};
|
|
5792
|
+
var _useGetDetailsForColl = useGetDetailsForCollection(relatedService, (currentParameterInfoDisplayed == null ? void 0 : currentParameterInfoDisplayed.collectionId) || ''),
|
|
5793
|
+
collection = _useGetDetailsForColl.data,
|
|
5794
|
+
isFetchingCollection = _useGetDetailsForColl.isFetching;
|
|
5795
|
+
var supportsInstances = !!(collection != null && (_collection$dataQueri = collection.dataQueries) != null && _collection$dataQueri.instances);
|
|
5796
|
+
var _useGetInstances = useGetInstances(relatedService == null ? void 0 : relatedService.url, (currentParameterInfoDisplayed == null ? void 0 : currentParameterInfoDisplayed.collectionId) || '', supportsInstances),
|
|
5805
5797
|
instances = _useGetInstances.data,
|
|
5806
|
-
|
|
5807
|
-
useEffect(function () {
|
|
5808
|
-
if (isFetching) {
|
|
5809
|
-
setTemporalInformation({
|
|
5810
|
-
isLoading: true
|
|
5811
|
-
});
|
|
5812
|
-
}
|
|
5813
|
-
if (instances) {
|
|
5814
|
-
setTemporalInformation({
|
|
5815
|
-
isLoading: false,
|
|
5816
|
-
instances: instances
|
|
5817
|
-
});
|
|
5818
|
-
}
|
|
5819
|
-
}, [instances, isFetching]);
|
|
5798
|
+
isFetchingInstances = _useGetInstances.isFetching;
|
|
5820
5799
|
var _useSetupDialog = useSetupDialog(uiTypes.DialogTypes.TimeSeriesInfo),
|
|
5821
5800
|
dialogOrder = _useSetupDialog.dialogOrder,
|
|
5822
5801
|
onCloseDialog = _useSetupDialog.onCloseDialog,
|
|
@@ -5828,7 +5807,11 @@ var ParameterInfoDialogConnect = function ParameterInfoDialogConnect() {
|
|
|
5828
5807
|
}
|
|
5829
5808
|
return jsx(ParameterInfoDialog, {
|
|
5830
5809
|
isOpen: isDialogOpen,
|
|
5831
|
-
|
|
5810
|
+
collectionInformation: collection,
|
|
5811
|
+
isLoadingCollectionInformation: isFetchingCollection,
|
|
5812
|
+
supportsInstances: supportsInstances,
|
|
5813
|
+
instanceInformation: instances,
|
|
5814
|
+
isLoadingInstanceInformation: isFetchingInstances,
|
|
5832
5815
|
onClose: onCloseDialog,
|
|
5833
5816
|
onMouseDown: setDialogOrder,
|
|
5834
5817
|
order: dialogOrder,
|
|
@@ -5987,6 +5970,25 @@ var TimeSeriesManagerConnect = function TimeSeriesManagerConnect(_ref) {
|
|
|
5987
5970
|
});
|
|
5988
5971
|
};
|
|
5989
5972
|
|
|
5973
|
+
var extractUsedServices = function extractUsedServices(services, feature) {
|
|
5974
|
+
var _feature$properties;
|
|
5975
|
+
if (!services || !(feature != null && (_feature$properties = feature.properties) != null && _feature$properties.occurrences) || feature.properties.occurrences.length < 1) {
|
|
5976
|
+
return [];
|
|
5977
|
+
}
|
|
5978
|
+
var usedServices = [];
|
|
5979
|
+
feature.properties.occurrences.forEach(function (occ) {
|
|
5980
|
+
var _occ$properties, _occ$properties2;
|
|
5981
|
+
if (occ != null && (_occ$properties = occ.properties) != null && _occ$properties.serviceId && occ != null && (_occ$properties2 = occ.properties) != null && _occ$properties2.collectionId) {
|
|
5982
|
+
var service = services.find(function (el) {
|
|
5983
|
+
return el.id === occ.properties.serviceId;
|
|
5984
|
+
});
|
|
5985
|
+
if (service) {
|
|
5986
|
+
usedServices.push(service);
|
|
5987
|
+
}
|
|
5988
|
+
}
|
|
5989
|
+
});
|
|
5990
|
+
return usedServices;
|
|
5991
|
+
};
|
|
5990
5992
|
var LocationInfo = function LocationInfo(_ref) {
|
|
5991
5993
|
var feature = _ref.feature,
|
|
5992
5994
|
mapPinLocation = _ref.mapPinLocation,
|
|
@@ -6000,8 +6002,9 @@ var LocationInfo = function LocationInfo(_ref) {
|
|
|
6000
6002
|
var _useState = useState([]),
|
|
6001
6003
|
parameters = _useState[0],
|
|
6002
6004
|
setParameters = _useState[1];
|
|
6003
|
-
var
|
|
6004
|
-
|
|
6005
|
+
var usedServices = extractUsedServices(services, feature);
|
|
6006
|
+
var _useGetServiceCollect = useGetServiceCollectionDetails(usedServices, isOpen),
|
|
6007
|
+
collections = _useGetServiceCollect.data;
|
|
6005
6008
|
useEffect(function () {
|
|
6006
6009
|
if (!feature || !feature.properties || !feature.properties.occurrences || feature.properties.occurrences.length < 1) {
|
|
6007
6010
|
setParameters(function (prev) {
|
|
@@ -6038,12 +6041,14 @@ var LocationInfo = function LocationInfo(_ref) {
|
|
|
6038
6041
|
parameters: []
|
|
6039
6042
|
};
|
|
6040
6043
|
}
|
|
6041
|
-
var collection =
|
|
6044
|
+
var collection = collections.find(function (collection) {
|
|
6045
|
+
return collection.collectionId === occ.properties.collectionId;
|
|
6046
|
+
});
|
|
6042
6047
|
if (collection && collection.parameters) {
|
|
6043
6048
|
return {
|
|
6044
6049
|
loading: false,
|
|
6045
6050
|
parameters: collection.parameters.map(function (parameter) {
|
|
6046
|
-
return parameter.propertyName;
|
|
6051
|
+
return parameter.propertyLabel || parameter.propertyName;
|
|
6047
6052
|
})
|
|
6048
6053
|
};
|
|
6049
6054
|
}
|
|
@@ -6077,8 +6082,8 @@ var LocationInfo = function LocationInfo(_ref) {
|
|
|
6077
6082
|
// Internal properties
|
|
6078
6083
|
var propertyBlacklist = ['parameterName', 'mapFeatureClass'];
|
|
6079
6084
|
var _loop = function _loop() {
|
|
6080
|
-
var _feature$
|
|
6081
|
-
var occ = feature == null || (_feature$
|
|
6085
|
+
var _feature$properties3;
|
|
6086
|
+
var occ = feature == null || (_feature$properties3 = feature.properties) == null ? void 0 : _feature$properties3.occurrences[i];
|
|
6082
6087
|
var collectionInfo = {
|
|
6083
6088
|
properties: Object.assign({}, occ.properties, {
|
|
6084
6089
|
locationId: occ.id
|
|
@@ -6090,8 +6095,8 @@ var LocationInfo = function LocationInfo(_ref) {
|
|
|
6090
6095
|
});
|
|
6091
6096
|
calculated.collections.push(collectionInfo);
|
|
6092
6097
|
};
|
|
6093
|
-
for (var i = 0; i < (feature == null || (_feature$
|
|
6094
|
-
var _feature$
|
|
6098
|
+
for (var i = 0; i < (feature == null || (_feature$properties2 = feature.properties) == null ? void 0 : _feature$properties2.occurrences.length); i += 1) {
|
|
6099
|
+
var _feature$properties2;
|
|
6095
6100
|
_loop();
|
|
6096
6101
|
}
|
|
6097
6102
|
return calculated;
|
|
@@ -7523,7 +7528,6 @@ var TimeSeriesConnect = function TimeSeriesConnect(_ref3) {
|
|
|
7523
7528
|
};
|
|
7524
7529
|
setTimeSeriesLocation(validLocation);
|
|
7525
7530
|
}
|
|
7526
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
7527
7531
|
}, [activeMapId, selectedFeature, setTimeSeriesLocation, memoizedSelectedFeature, allMaps]);
|
|
7528
7532
|
useEffect(function () {
|
|
7529
7533
|
return function () {
|
|
@@ -7868,8 +7872,10 @@ var LocationListItem = function LocationListItem(_ref) {
|
|
|
7868
7872
|
minWidth: '42px'
|
|
7869
7873
|
},
|
|
7870
7874
|
children: jsx(Checkbox, {
|
|
7871
|
-
|
|
7872
|
-
|
|
7875
|
+
slotProps: {
|
|
7876
|
+
input: {
|
|
7877
|
+
'aria-label': location
|
|
7878
|
+
}
|
|
7873
7879
|
},
|
|
7874
7880
|
color: "secondary",
|
|
7875
7881
|
checked: selectedLocation === location,
|
|
@@ -8086,7 +8092,7 @@ var LocationSelectDialogConnect = function LocationSelectDialogConnect() {
|
|
|
8086
8092
|
lat: lat,
|
|
8087
8093
|
lon: lon,
|
|
8088
8094
|
id: feature.id,
|
|
8089
|
-
occurrences: (_feature$properties = feature.properties) == null ? void 0 : _feature$properties.
|
|
8095
|
+
occurrences: (_feature$properties = feature.properties) == null || (_feature$properties = _feature$properties.occurrences) == null ? void 0 : _feature$properties.map(function (occ) {
|
|
8090
8096
|
var _occ$properties, _occ$properties2, _occ$properties3, _occ$properties4;
|
|
8091
8097
|
return {
|
|
8092
8098
|
id: occ.id,
|