@opengeoweb/time-series 14.2.2 → 14.4.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 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, useResizeObserver } 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 { isString, trim, trimStart, compact, chain, groupBy, sortBy, uniqBy, isEqual } from 'lodash';
9
+ import { isString, trim, trimStart, compact, chain, groupBy, countBy, 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';
@@ -133,12 +133,15 @@ var en = {
133
133
  "timeseries-location-info-collection": "collection",
134
134
  "timeseries-location-info-detail": "Detail",
135
135
  "timeseries-location-info-no-location-selected": "No location selected",
136
+ "timeseries-location-info-mapFeatureClass": "Map feature class",
137
+ "timeseries-location-info-parameterName": "Parameter name",
136
138
  "timeseries-toggle-location-markers-label": "Markers",
137
139
  "timeseries-toggle-location-markers-tooltip": "Show/hide location markers",
138
140
  "timeseries-legend": "Legend",
139
141
  "timeseries-legend-tooltip-show": "Show legend",
140
142
  "timeseries-legend-tooltip-hide": "Hide legend",
141
143
  "error-title": "Some parameters could not be loaded.",
144
+ "error-message-missing-collection-or-service": "No collection and/or service found for parameter.",
142
145
  "timeseries-add-plot": "Add plot"
143
146
  };
144
147
  var fi = {
@@ -242,12 +245,15 @@ var fi = {
242
245
  "timeseries-location-info-collection": "collection",
243
246
  "timeseries-location-info-detail": "Detail",
244
247
  "timeseries-location-info-no-location-selected": "Ei paikkaa valittuna",
248
+ "timeseries-location-info-mapFeatureClass": "Map feature class",
249
+ "timeseries-location-info-parameterName": "Parameter name",
245
250
  "timeseries-toggle-location-markers-label": "Merkit",
246
251
  "timeseries-toggle-location-markers-tooltip": "Näytä/piilota kohdemerkit",
247
252
  "timeseries-legend": "Selite",
248
253
  "timeseries-legend-tooltip-show": "Näytä selite",
249
254
  "timeseries-legend-tooltip-hide": "Piilota selite",
250
255
  "error-title": "Joitain parametreja ei pystytty lataamaan",
256
+ "error-message-missing-collection-or-service": "Parametrille ei löytynyt kokoelmaa ja/tai palvelua",
251
257
  "timeseries-add-plot": "Lisää kaavio"
252
258
  };
253
259
  var no = {
@@ -351,12 +357,15 @@ var no = {
351
357
  "timeseries-location-info-collection": "collection",
352
358
  "timeseries-location-info-detail": "Detail",
353
359
  "timeseries-location-info-no-location-selected": "Ingen posisjon valgt",
360
+ "timeseries-location-info-mapFeatureClass": "Map feature class",
361
+ "timeseries-location-info-parameterName": "Parameter name",
354
362
  "timeseries-toggle-location-markers-label": "ikke oversatt",
355
363
  "timeseries-toggle-location-markers-tooltip": "ikke oversatt",
356
364
  "timeseries-legend": "Forklaring",
357
365
  "timeseries-legend-tooltip-show": "Vis forklaring",
358
366
  "timeseries-legend-tooltip-hide": "Skjul forklaring",
359
- "error-title": "ikke oversatt",
367
+ "error-title": "Noen parametere kunne ikke lastes.",
368
+ "error-message-missing-collection-or-service": "Ingen kolleksjon og/eller tjeneste funnet for parameter.",
360
369
  "timeseries-add-plot": "Legg til plott"
361
370
  };
362
371
  var nl = {
@@ -465,12 +474,15 @@ var nl = {
465
474
  "timeseries-location-info-collection": "collection",
466
475
  "timeseries-location-info-detail": "Detail",
467
476
  "timeseries-location-info-no-location-selected": "Geen locatie geselecteerd",
477
+ "timeseries-location-info-mapFeatureClass": "Map feature class",
478
+ "timeseries-location-info-parameterName": "Parameter name",
468
479
  "timeseries-toggle-location-markers-label": "Kaart locaties",
469
480
  "timeseries-toggle-location-markers-tooltip": "Toon/Verberg locatie punten",
470
481
  "timeseries-legend": "Legenda",
471
482
  "timeseries-legend-tooltip-show": "Toon legenda",
472
483
  "timeseries-legend-tooltip-hide": "Verberg legenda",
473
484
  "error-title": "Sommige parameters konden niet worden geladen.",
485
+ "error-message-missing-collection-or-service": "Geen collectie en/of service gevonden voor parameter.",
474
486
  "timeseries-add-plot": "Grafiek toevoegen"
475
487
  };
476
488
  var timeseriesTranslations = {
@@ -2767,7 +2779,7 @@ var useGetCollectionsAndInstanceDetails = function useGetCollectionsAndInstanceD
2767
2779
  }
2768
2780
  });
2769
2781
  };
2770
- var useGetPlotsWithData = function useGetPlotsWithData(plotsWithoutData, selectedLocation, services, splitGeoJsonByCollection) {
2782
+ var useGetPlotsWithData = function useGetPlotsWithData(plotsWithoutData, selectedLocation, services, splitGeoJsonByCollection, t) {
2771
2783
  var _useState = useState([]),
2772
2784
  plotsWithData = _useState[0],
2773
2785
  setPlotsWithData = _useState[1];
@@ -2777,7 +2789,8 @@ var useGetPlotsWithData = function useGetPlotsWithData(plotsWithoutData, selecte
2777
2789
  }, [plotsWithoutData, services]);
2778
2790
  // First fetch collection and any relevant instance data
2779
2791
  var _useGetCollectionsAnd = useGetCollectionsAndInstanceDetails(collectionsList),
2780
- collectionDetails = _useGetCollectionsAnd.data;
2792
+ collectionDetails = _useGetCollectionsAnd.data,
2793
+ isDetailsFetching = _useGetCollectionsAnd.isFetching;
2781
2794
  var geojsonMap = useMemo(function () {
2782
2795
  return new Map(splitGeoJsonByCollection.map(function (gjs) {
2783
2796
  return [gjs.serviceName + "_" + gjs.collectionName, gjs];
@@ -2786,8 +2799,9 @@ var useGetPlotsWithData = function useGetPlotsWithData(plotsWithoutData, selecte
2786
2799
  // Construct all queries to be executed
2787
2800
  var queries = useMemo(function () {
2788
2801
  return plotsWithoutData.parameters.map(function (parameter) {
2789
- var _collection$allInstan, _parameter$dimension;
2790
- var service = collectionsList[parameter.serviceId + "-" + parameter.collectionId].service;
2802
+ var _collectionsList, _collection$allInstan, _parameter$dimension;
2803
+ // Note: service can be undefined
2804
+ var service = (_collectionsList = collectionsList[parameter.serviceId + "-" + parameter.collectionId]) == null ? void 0 : _collectionsList.service;
2791
2805
  var collection = collectionDetails == null ? void 0 : collectionDetails.find(function (collection) {
2792
2806
  return collection.serviceId === parameter.serviceId && collection.collectionId === parameter.collectionId;
2793
2807
  });
@@ -2807,11 +2821,11 @@ var useGetPlotsWithData = function useGetPlotsWithData(plotsWithoutData, selecte
2807
2821
  return _regeneratorRuntime().wrap(function _callee7$(_context7) {
2808
2822
  while (1) switch (_context7.prev = _context7.next) {
2809
2823
  case 0:
2810
- if (collection) {
2824
+ if (!(!collection || !service)) {
2811
2825
  _context7.next = 2;
2812
2826
  break;
2813
2827
  }
2814
- throw new Error('No collection found for parameter');
2828
+ throw new Error('error-message-missing-collection-or-service');
2815
2829
  case 2:
2816
2830
  _context7.next = 4;
2817
2831
  return fetchEdrParameter(parameter, selectedLocation, service, geojsonMap, intervalParam, collection, instanceInfo);
@@ -2829,12 +2843,15 @@ var useGetPlotsWithData = function useGetPlotsWithData(plotsWithoutData, selecte
2829
2843
  }
2830
2844
  return queryFn;
2831
2845
  }(),
2832
- enabled: !!parameter && !!selectedLocation.lon && !!selectedLocation.lat && !!service && !!collection,
2846
+ enabled: !!parameter && !!selectedLocation.lon && !!selectedLocation.lat && (
2847
+ // This condition allows us to see errors about missing collections/services
2848
+ // that can not be explained by unfinished previous queries
2849
+ !isDetailsFetching || !!collection && !!service),
2833
2850
  refetchInterval: 5 * 60 * 1000,
2834
2851
  retry: false
2835
2852
  };
2836
2853
  });
2837
- }, [collectionDetails, geojsonMap, plotsWithoutData.parameters, selectedLocation, collectionsList]);
2854
+ }, [collectionDetails, geojsonMap, plotsWithoutData.parameters, selectedLocation, collectionsList, isDetailsFetching]);
2838
2855
  var results = useQueries({
2839
2856
  queries: queries,
2840
2857
  combine: function combine(results) {
@@ -2846,10 +2863,15 @@ var useGetPlotsWithData = function useGetPlotsWithData(plotsWithoutData, selecte
2846
2863
  var isFetching = results.some(function (result) {
2847
2864
  return result.isFetching;
2848
2865
  });
2849
- var errorMessage = results.map(function (result) {
2866
+ var errorsWithCount = countBy(results.map(function (result) {
2850
2867
  var _result$error;
2851
2868
  return result == null || (_result$error = result.error) == null ? void 0 : _result$error.message;
2852
- }).filter(Boolean).join(', ');
2869
+ }).filter(Boolean));
2870
+ var errorMessage = Object.entries(errorsWithCount).map(function (_ref) {
2871
+ var message = _ref[0],
2872
+ count = _ref[1];
2873
+ return "\"" + t(message) + "\" (x" + count + ")";
2874
+ }).join(', ');
2853
2875
  var error = errorMessage ? new Error(errorMessage) : null;
2854
2876
  return {
2855
2877
  data: data,
@@ -5684,9 +5706,7 @@ var generateInfoList = function generateInfoList(element, t) {
5684
5706
  });
5685
5707
  }
5686
5708
  if ((_element$extent2 = element.extent) != null && (_element$extent2 = _element$extent2.spatial) != null && _element$extent2.bbox) {
5687
- // The EDR specification is unclear as to what the type of the bbox is so we cater for both implementations
5688
- // [number, number, number, number] | [[number, number, number, number]]
5689
- var bbox = typeof element.extent.spatial.bbox[0] === 'number' ? element.extent.spatial.bbox : element.extent.spatial.bbox[0];
5709
+ var bbox = element.extent.spatial.bbox[0];
5690
5710
  var value = t('timeseries-info-bbox-rendering', {
5691
5711
  west: bbox[0],
5692
5712
  south: bbox[1],
@@ -6103,9 +6123,8 @@ var LocationInfo = function LocationInfo(_ref) {
6103
6123
  collections: []
6104
6124
  };
6105
6125
  // Internal properties
6106
- var propertyBlacklist = ['parameterName', 'mapFeatureClass'];
6107
- var _loop = function _loop() {
6108
- var _feature$properties3;
6126
+ for (var i = 0; i < (feature == null || (_feature$properties2 = feature.properties) == null ? void 0 : _feature$properties2.occurrences.length); i += 1) {
6127
+ var _feature$properties2, _feature$properties3;
6109
6128
  var occ = feature == null || (_feature$properties3 = feature.properties) == null ? void 0 : _feature$properties3.occurrences[i];
6110
6129
  var collectionInfo = {
6111
6130
  properties: Object.assign({}, occ.properties, {
@@ -6113,14 +6132,7 @@ var LocationInfo = function LocationInfo(_ref) {
6113
6132
  }),
6114
6133
  parameterIndex: i
6115
6134
  };
6116
- propertyBlacklist.forEach(function (property) {
6117
- delete collectionInfo.properties[property];
6118
- });
6119
6135
  calculated.collections.push(collectionInfo);
6120
- };
6121
- for (var i = 0; i < (feature == null || (_feature$properties2 = feature.properties) == null ? void 0 : _feature$properties2.occurrences.length); i += 1) {
6122
- var _feature$properties2;
6123
- _loop();
6124
6136
  }
6125
6137
  return calculated;
6126
6138
  }, [feature]);
@@ -7160,7 +7172,7 @@ var TimeSeriesView = /*#__PURE__*/React__default.memo(function (_ref) {
7160
7172
  onToggleLegendParam = _ref.onToggleLegendParam;
7161
7173
  var _useTimeseriesTransla = useTimeseriesTranslation(),
7162
7174
  t = _useTimeseriesTransla.t;
7163
- var _useGetPlotsWithData = useGetPlotsWithData(plotPreset, selectedLocation, services, splitGeoJsonByCollection),
7175
+ var _useGetPlotsWithData = useGetPlotsWithData(plotPreset, selectedLocation, services, splitGeoJsonByCollection, t),
7164
7176
  plotsWithData = _useGetPlotsWithData.data,
7165
7177
  isFetchingPlots = _useGetPlotsWithData.isFetching,
7166
7178
  error = _useGetPlotsWithData.error;
@@ -7178,7 +7190,7 @@ var TimeSeriesView = /*#__PURE__*/React__default.memo(function (_ref) {
7178
7190
  },
7179
7191
  children: [error && jsx(AlertBanner, {
7180
7192
  title: t('error-title'),
7181
- info: "\"" + error.message + "\"",
7193
+ info: "" + error.message,
7182
7194
  shouldClose: true
7183
7195
  }), plotsWithData && jsx(TimeSeriesChart, {
7184
7196
  plotsWithData: plotsWithData,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeoweb/time-series",
3
- "version": "14.2.2",
3
+ "version": "14.4.0",
4
4
  "description": "GeoWeb time-series library for the opengeoweb project",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -9,26 +9,26 @@
9
9
  },
10
10
  "dependencies": {
11
11
  "immer": "^10.0.3",
12
- "@opengeoweb/shared": "14.2.2",
12
+ "@opengeoweb/shared": "14.4.0",
13
13
  "@reduxjs/toolkit": "^2.6.1",
14
14
  "react-redux": "^9.2.0",
15
- "@opengeoweb/webmap": "14.2.2",
16
- "@opengeoweb/webmap-react": "14.2.2",
15
+ "@opengeoweb/webmap": "14.4.0",
16
+ "@opengeoweb/webmap-react": "14.4.0",
17
17
  "lodash": "^4.17.21",
18
- "@opengeoweb/api": "14.2.2",
19
- "@opengeoweb/theme": "14.2.2",
20
- "@opengeoweb/store": "14.2.2",
18
+ "@opengeoweb/api": "14.4.0",
19
+ "@opengeoweb/theme": "14.4.0",
20
+ "@opengeoweb/store": "14.4.0",
21
21
  "echarts-for-react": "^3.0.2",
22
22
  "echarts": "^5.4.3",
23
23
  "react-sortablejs": "^6.1.4",
24
- "@opengeoweb/snackbar": "14.2.2",
24
+ "@opengeoweb/snackbar": "14.4.0",
25
25
  "react-window": "^1.8.10",
26
26
  "react-virtualized-auto-sizer": "^1.0.21",
27
27
  "msw": "^2.7.3",
28
28
  "i18next": "^25.0.1",
29
29
  "react-i18next": "^15.1.1",
30
- "@opengeoweb/core": "14.2.2",
31
- "@opengeoweb/form-fields": "14.2.2",
30
+ "@opengeoweb/core": "14.4.0",
31
+ "@opengeoweb/form-fields": "14.4.0",
32
32
  "@mui/material": "^7.0.1",
33
33
  "react-hook-form": "^7.61.1",
34
34
  "uuid": "^10.0.0",
@@ -148,7 +148,7 @@ export interface EDRExtentObject {
148
148
  };
149
149
  spatial?: {
150
150
  crs: string;
151
- bbox: [number, number, number, number] | [[number, number, number, number]];
151
+ bbox: [[number, number, number, number]];
152
152
  };
153
153
  custom?: CustomDimension[];
154
154
  }
@@ -190,7 +190,7 @@ export interface EDRInstance {
190
190
  };
191
191
  spatial: {
192
192
  crs: string;
193
- bbox: [number, number, number, number];
193
+ bbox: [[number, number, number, number]];
194
194
  };
195
195
  custom?: CustomDimension[];
196
196
  };
@@ -2,5 +2,5 @@ import i18n from 'i18next';
2
2
  import { UseTranslationResponse } from 'react-i18next';
3
3
  export declare const TIME_SERIES_NAMESPACE = "timeseries";
4
4
  export declare const initTimeseriesI18n: () => void;
5
- export declare const translateKeyOutsideComponents: (key: string, params?: Record<string, string | number> | undefined) => string;
5
+ export declare const translateInTestsAndStories: (key: string, params?: Record<string, string | number> | undefined) => string;
6
6
  export declare const useTimeseriesTranslation: () => UseTranslationResponse<typeof TIME_SERIES_NAMESPACE, typeof i18n>;
@@ -5,6 +5,7 @@ import { EDRServiceInformation } from './api';
5
5
  import { TimeseriesCollectionDetail } from '../../components/TimeSeriesSelect/utils';
6
6
  import { EDRCollection, EDRInstance, GeoJsonWithService, PlotWithData, PointerLocation, UseGetLocationReturnTypeProperties } from '../../components/TimeSeries/types';
7
7
  import { ParameterCollectionQueryData } from '../../components/TimeSeries/utils';
8
+ import { TFunction } from 'i18next';
8
9
  interface CombinedResult<T> {
9
10
  data: T | undefined;
10
11
  isFetching: boolean;
@@ -50,7 +51,7 @@ export declare const useGetDetailsForCollection: (service: TimeSeriesService, co
50
51
  export declare const useGetInstances: (serviceUrl: string, collectionId: string, supportsInstances?: boolean) => UseQueryResult<EDRInstance[]>;
51
52
  export declare const useGetServiceCollectionDetails: (services: TimeSeriesService[], isOpen: boolean) => CombinedResult<TimeseriesCollectionDetail[]>;
52
53
  export declare const useGetCollectionsAndInstanceDetails: (queryData: Record<string, ParameterCollectionQueryData>) => CombinedResult<TimeseriesCollectionDetail[]>;
53
- export declare const useGetPlotsWithData: (plotsWithoutData: PlotPreset, selectedLocation: PointerLocation, services: TimeSeriesService[], splitGeoJsonByCollection: GeoJsonWithService[]) => {
54
+ export declare const useGetPlotsWithData: (plotsWithoutData: PlotPreset, selectedLocation: PointerLocation, services: TimeSeriesService[], splitGeoJsonByCollection: GeoJsonWithService[], t: TFunction) => {
54
55
  data: PlotWithData[] | undefined;
55
56
  isFetching: boolean;
56
57
  error: Error | null | undefined;