@eodash/eodash 5.0.0-alpha.2.16 → 5.0.0-alpha.2.18

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.
Files changed (49) hide show
  1. package/core/client/App.vue +2 -0
  2. package/core/client/composables/EodashMap.js +207 -103
  3. package/core/client/composables/index.js +13 -2
  4. package/core/client/eodash.js +8 -3
  5. package/core/client/plugins/axios.js +8 -0
  6. package/core/client/plugins/index.js +2 -1
  7. package/core/client/store/Actions.js +2 -1
  8. package/core/client/store/States.js +4 -0
  9. package/core/client/store/stac.js +11 -8
  10. package/core/client/utils/createLayers.js +83 -46
  11. package/core/client/utils/eodashSTAC.js +69 -19
  12. package/core/client/utils/helpers.js +108 -35
  13. package/core/client/vite-env.d.ts +1 -0
  14. package/dist/client/{DashboardLayout-CCtyOil0.js → DashboardLayout-Dk6lzKZA.js} +2 -2
  15. package/dist/client/{DynamicWebComponent-But2r1Sj.js → DynamicWebComponent-BkMCGU7a.js} +2 -2
  16. package/dist/client/EodashDatePicker-D27wn0jP.js +276 -0
  17. package/dist/client/EodashItemFilter-DS1mOc2p.js +7651 -0
  18. package/dist/client/{EodashLayerControl-BhZL4pYM.js → EodashLayerControl-BqGA6jbV.js} +5604 -5428
  19. package/dist/client/{EodashMap-C5tOgVOv.js → EodashMap-BnVrfBnA.js} +9083 -9032
  20. package/dist/client/{EodashMapBtns-CdDfVQj0.js → EodashMapBtns-rv-U1nI_.js} +2 -2
  21. package/dist/client/{ExportState-CKCCN_VI.js → ExportState-C3Z1ET5c.js} +138 -131
  22. package/dist/client/{Footer-B9yVgyzx.js → Footer-BBkNiqPm.js} +63 -63
  23. package/dist/client/{Header-CPIlUEOq.js → Header-BQKHLO5P.js} +70 -70
  24. package/dist/client/{IframeWrapper-DRw1kHJm.js → IframeWrapper-BX4e2uxq.js} +1 -1
  25. package/dist/client/{MobileLayout-CPxVee5U.js → MobileLayout-C2aqobN5.js} +43 -41
  26. package/dist/client/{PopUp-Dca-gx9a.js → PopUp-DG3zrW12.js} +15 -15
  27. package/dist/client/{VImg-PHLA1nP1.js → VImg-BLpHACcB.js} +33 -31
  28. package/dist/client/VMain-DOyRcpub.js +38 -0
  29. package/dist/client/VOverlay-DAiInZQP.js +973 -0
  30. package/dist/client/{WidgetsContainer-jxk3kw-d.js → WidgetsContainer-BqoX7R5Z.js} +3 -3
  31. package/dist/client/{asWebComponent-3OsFQJVx.js → asWebComponent-tNU8_fkz.js} +10199 -9314
  32. package/dist/client/eo-dash.js +1 -1
  33. package/dist/client/{forwardRefs-BxZaq9ml.js → forwardRefs-BexjzXbg.js} +1 -1
  34. package/dist/client/{index-Vul961Xy.js → index-F73os72i.js} +23 -23
  35. package/dist/client/{lerc-B4lXefGh-BESXOHWk.js → lerc-B4lXefGh-DhdntrgS.js} +1 -1
  36. package/dist/client/{ssrBoot-BFMBrCqY.js → ssrBoot-C71RpKe4.js} +1 -1
  37. package/dist/client/style.css +2 -2
  38. package/dist/client/{transition-U5aFjJtV.js → transition-DNdd2Y-1.js} +1 -1
  39. package/dist/client/{webfontloader-D_JbBwHu.js → webfontloader-C7dpDL7m.js} +1 -1
  40. package/dist/node/cli.js +1 -1
  41. package/package.json +26 -24
  42. package/widgets/EodashDatePicker.vue +112 -88
  43. package/widgets/EodashLayerControl.vue +3 -1
  44. package/widgets/EodashMap.vue +62 -54
  45. package/widgets/ExportState.vue +4 -2
  46. package/dist/client/EodashDatePicker-jeYiWflv.js +0 -247
  47. package/dist/client/EodashItemFilter-BFlfWeE_.js +0 -10125
  48. package/dist/client/VMain-Ck81LJfb.js +0 -39
  49. package/dist/client/VOverlay-CL4hiJB8.js +0 -972
@@ -15,6 +15,8 @@ import Dashboard from "@/views/Dashboard.vue";
15
15
  import ErrorAlert from "./components/ErrorAlert.vue";
16
16
  import { onErrorCaptured, ref } from "vue";
17
17
 
18
+ // window.setEodashLoglevel("DEBUG")
19
+
18
20
  const error = ref("");
19
21
  onErrorCaptured((e, inst, info) => {
20
22
  error.value = `
@@ -1,6 +1,16 @@
1
1
  import { EodashCollection } from "@/utils/eodashSTAC";
2
2
  import { setMapProjFromCol } from "@/utils/helpers";
3
3
  import { onMounted, onUnmounted, watch } from "vue";
4
+ import log from "loglevel";
5
+ import { datetime } from "@/store/States";
6
+ import { useSTAcStore } from "@/store/stac";
7
+ import { storeToRefs } from "pinia";
8
+
9
+ /**
10
+ * Holder for previous compare map view as it is overwritten by sync
11
+ * @type { {map:import("ol").View } | null} mapElement
12
+ */
13
+ let viewHolder = null;
4
14
 
5
15
  /**
6
16
  * Description placeholder
@@ -38,32 +48,33 @@ export const useHandleMapMoveEnd = (mapElement, mapPosition) => {
38
48
  };
39
49
 
40
50
  /**
51
+ * Adds data layers extracted from eodash collections to Analysis Group
41
52
  *
42
- * @param {string} indicatorUrl
43
- * @param {import("@/utils/eodashSTAC").EodashCollection[]} eodashCols
44
- * @param {string} updatedTime
45
- * @param {import("stac-ts").StacCatalog
46
- * | import("stac-ts").StacCollection
47
- * | import("stac-ts").StacItem
48
- * | null
49
- * } selectedIndicator
53
+ * @param { Record<string,any>[] | undefined} layersCollection
54
+ * @param {EodashCollection[]} eodashCols
55
+ * @param {string} [updatedTime]
50
56
  */
51
- const createLayersConfig = async (
52
- indicatorUrl,
57
+ const updateLayersConfig = async (
58
+ layersCollection,
53
59
  eodashCols,
54
60
  updatedTime,
55
- selectedIndicator,
56
61
  ) => {
57
- const layersCollection = [];
58
- const dataLayers = {
59
- type: "Group",
60
- properties: {
61
- id: "AnalysisGroup",
62
- title: "Analysis Layers",
63
- layerControlExpand: true,
64
- },
65
- layers: /** @type {Record<string,any>[]}*/ ([]),
66
- };
62
+ log.debug(
63
+ "Updating layer configuration",
64
+ layersCollection,
65
+ eodashCols,
66
+ updatedTime,
67
+ );
68
+ const dataLayersGroup = layersCollection?.find(
69
+ (lyr) => lyr?.properties.id === "AnalysisGroup",
70
+ );
71
+ /** @type {Record<string,any>[]} */
72
+ const analysisLayers = [];
73
+
74
+ if (!dataLayersGroup) {
75
+ log.debug("no AnalysisGroup layer found to be updated");
76
+ return layersCollection;
77
+ }
67
78
 
68
79
  for (const ec of eodashCols) {
69
80
  let layers;
@@ -72,26 +83,47 @@ const createLayersConfig = async (
72
83
  } else {
73
84
  layers = await ec.createLayersJson();
74
85
  }
86
+
75
87
  if (layers) {
76
- dataLayers.layers.push(...layers);
88
+ analysisLayers.push(...layers);
77
89
  }
78
90
  }
79
91
  // Add expand to all analysis layers
80
- dataLayers.layers.forEach((dl) => {
92
+ analysisLayers.forEach((dl) => {
81
93
  dl.properties.layerControlExpand = true;
82
94
  dl.properties.layerControlToolsExpand = true;
83
95
  });
84
96
 
85
- layersCollection.push(dataLayers);
97
+ dataLayersGroup.layers = analysisLayers;
86
98
 
87
- const indicator = new EodashCollection(indicatorUrl);
88
- const indicatorLayers = await indicator.buildJsonArray(
89
- //@ts-expect-error we use this function to generate collection level visualization
90
- selectedIndicator,
91
- indicatorUrl,
92
- selectedIndicator?.title ?? "",
93
- selectedIndicator?.endpointtype === "GeoDB",
94
- );
99
+ return layersCollection;
100
+ };
101
+
102
+ /**
103
+ * @param {import("stac-ts").StacCatalog
104
+ * | import("stac-ts").StacCollection
105
+ * | import("stac-ts").StacItem
106
+ * | null
107
+ * } selectedIndicator
108
+ */
109
+
110
+ const createLayersConfig = async (selectedIndicator) => {
111
+ log.debug("Creating layers config", selectedIndicator);
112
+ const layersCollection = [];
113
+ const dataLayers = {
114
+ type: "Group",
115
+ properties: {
116
+ id: "AnalysisGroup",
117
+ title: "Analysis Layers",
118
+ layerControlExpand: true,
119
+ },
120
+ layers: /** @type {Record<string,any>[]}*/ ([]),
121
+ };
122
+
123
+ layersCollection.push(dataLayers);
124
+ const indicatorLayers =
125
+ //@ts-expect-error indicator is collection
126
+ await EodashCollection.getIndicatorLayers(selectedIndicator);
95
127
 
96
128
  const baseLayers = {
97
129
  type: "Group",
@@ -105,34 +137,41 @@ const createLayersConfig = async (
105
137
  const indicatorBaseLayers = indicatorLayers.filter(
106
138
  (l) => l.properties.group === "baselayer",
107
139
  );
108
- // Only one baselayer can be set to visible, let's first set all to
109
- // false that have not a dedicated property visible, then check
110
- // if there are more then one visible and only allow one
111
- let counter = 0;
112
- let lastPos = 0;
113
- indicatorBaseLayers.forEach((bl, indx) => {
114
- if (!("visible" in bl.properties)) {
115
- bl.properties.visible = false;
116
- }
117
- if (bl.properties.visible) {
118
- counter++;
119
- lastPos = indx;
120
- }
121
- });
122
- // if none visible set the last one as visible
123
- if (counter == 0 && indicatorBaseLayers.length > 0) {
124
- indicatorBaseLayers[0].properties.visible = true;
125
- }
126
- // disable all apart from last
127
- if (counter > 1) {
128
- indicatorBaseLayers.forEach((bl, indx) => {
129
- if (indx !== lastPos) {
140
+
141
+ if (indicatorBaseLayers.length) {
142
+ // Only one baselayer can be set to visible, let's first set all to
143
+ // false that have not a dedicated property visible, then check
144
+ // if there are more then one visible and only allow one
145
+ let counter = 0;
146
+ let lastPos = 0;
147
+ for (let indx = 0; indx < indicatorBaseLayers.length; indx++) {
148
+ const bl = indicatorBaseLayers[indx];
149
+ if (!("visible" in bl.properties)) {
130
150
  bl.properties.visible = false;
131
151
  }
132
- });
133
- }
134
152
 
135
- if (indicatorBaseLayers.length) {
153
+ if (bl.properties.visible) {
154
+ counter++;
155
+ lastPos = indx;
156
+ }
157
+ }
158
+
159
+ // if none visible set the last one as visible
160
+ if (counter === 0) {
161
+ indicatorBaseLayers[0].properties.visible = true;
162
+ }
163
+
164
+ // disable all apart from last
165
+ if (counter > 0) {
166
+ indicatorBaseLayers.forEach((bl, indx) => {
167
+ if (indx !== lastPos) {
168
+ bl.properties.visible = false;
169
+ } else {
170
+ bl.properties.visible = true;
171
+ }
172
+ });
173
+ }
174
+
136
175
  baseLayers.layers.push(...indicatorBaseLayers);
137
176
 
138
177
  // Add exclusive to baselayers and make sure only one is selected
@@ -170,11 +209,24 @@ const createLayersConfig = async (
170
209
  const indicatorOverlays = indicatorLayers.filter(
171
210
  (l) => l.properties.group === "overlay",
172
211
  );
212
+
173
213
  if (indicatorOverlays.length) {
174
214
  overlayLayers.layers.push(...indicatorOverlays);
175
215
  layersCollection.unshift(overlayLayers);
176
216
  }
177
217
 
218
+ // We try to set the current time selection
219
+ // to latest extent date
220
+ // @ts-expect-error it seems the temporal extent is not defined in type
221
+ const interval = selectedIndicator?.extent?.temporal?.interval;
222
+ if (interval && interval.length > 0 && interval[0].length > 1) {
223
+ const endInterval = new Date(interval[0][1]);
224
+ log.debug(
225
+ "Datepicker: found stac extent, setting time to latest value",
226
+ endInterval,
227
+ );
228
+ datetime.value = endInterval.toISOString();
229
+ }
178
230
  return layersCollection;
179
231
  };
180
232
 
@@ -184,62 +236,114 @@ const createLayersConfig = async (
184
236
  * @param {import("vue").Ref<HTMLElement & Record<string,any> | null>} mapElement
185
237
  * @param {import("vue").Ref<import("stac-ts").StacCollection | null>} selectedIndicator
186
238
  * @param {EodashCollection[]} eodashCols
187
- * @param {import("vue").Ref<string>} indicatorUrl
188
239
  * @param {import("vue").Ref<string>} datetime
240
+ * @param {import("vue").Ref<Record<string,any>[]>} mapLayers
241
+ * @param {import("vue").Ref<HTMLElement & Record<string,any> | null>} partnerMap
189
242
  */
190
243
  export const useInitMap = (
191
244
  mapElement,
192
245
  selectedIndicator,
193
246
  eodashCols,
194
- indicatorUrl,
195
247
  datetime,
248
+ mapLayers,
249
+ partnerMap,
196
250
  ) => {
197
- onMounted(() => {
198
- watch(
199
- [selectedIndicator, datetime],
200
- async ([updatedStac, updatedTime], [previousSTAC, _previousTime]) => {
201
- if (updatedStac) {
202
- const layersCollection = await createLayersConfig(
203
- indicatorUrl.value,
204
- eodashCols,
205
- updatedTime,
206
- updatedStac,
207
- );
208
- /** @type {any} */
209
- (mapElement.value).layers = layersCollection;
210
-
211
- // only on different indicator selection and not on time change
212
- if (previousSTAC?.id !== updatedStac.id) {
213
- // Set projection based on indicator level information
214
- setMapProjFromCol(
215
- /** @type {import('stac-ts').StacCollection} */
216
- (updatedStac),
217
- );
218
- // Try to move map view to extent
219
- // Make sure for now we are always converting from 4326
220
- // of stac items into current map projection
221
- // TODO: This might change if we decide to use 4326 as default for zoom and extent
222
- // Sanitize extent
223
- // // @ts-expect-error we will need to change the approach to use
224
- // // native eox-map transformation once included
225
- const b = updatedStac.extent?.spatial.bbox[0];
226
- const sanitizedExtent = [
227
- b[0] > -180 ? b[0] : -180,
228
- b[1] > -90 ? b[1] : -90,
229
- b[2] < 180 ? b[2] : 180,
230
- b[3] < 90 ? b[3] : 90,
231
- ];
232
- const reprojExtent = mapElement.value?.transformExtent(
233
- sanitizedExtent,
234
- "EPSG:4326",
235
- mapElement.value?.map?.getView().getProjection(),
236
- );
251
+ log.debug(
252
+ "InitMap",
253
+ mapElement.value,
254
+ selectedIndicator.value,
255
+ eodashCols.values,
256
+ datetime.value,
257
+ );
258
+
259
+ const stopIndicatorWatcher = watch(
260
+ [selectedIndicator, datetime],
261
+ async ([updatedStac, updatedTime], [previousStac, previousTime]) => {
262
+ if (updatedStac) {
263
+ if (mapElement?.value?.id === "main") {
264
+ // Making sure main map gets the viewer that seems to be
265
+ // removed when the second map is no longer rendered
266
+ if (viewHolder !== null) {
267
+ mapElement?.value?.map.setView(viewHolder);
268
+ viewHolder = null;
269
+ }
270
+ }
271
+ log.debug(
272
+ "Selected Indicator watch triggered",
273
+ updatedStac,
274
+ updatedTime,
275
+ );
276
+ let layersCollection = [];
277
+
278
+ const onlyTimeChanged =
279
+ updatedStac?.id === previousStac?.id && updatedTime !== previousTime;
280
+
281
+ const { selectedCompareStac } = storeToRefs(useSTAcStore());
282
+ if (mapElement?.value?.id === "main") {
283
+ // Main map being initialized
284
+ // Set projection based on indicator level information for both maps
285
+ await setMapProjFromCol(updatedStac);
286
+ } else {
287
+ // Compare map being initialized
288
+ if (selectedCompareStac.value !== null) {
289
+ // save old view to set later
290
+ viewHolder = mapElement?.value?.map.getView();
237
291
  /** @type {any} */
238
- (mapElement.value).zoomExtent = reprojExtent;
292
+ (mapElement.value).sync = partnerMap.value;
239
293
  }
240
294
  }
241
- },
242
- { immediate: true },
243
- );
295
+
296
+ if (onlyTimeChanged) {
297
+ layersCollection =
298
+ (await updateLayersConfig(
299
+ [...(mapElement.value?.layers ?? [])].reverse(),
300
+ eodashCols,
301
+ updatedTime,
302
+ )) ?? [];
303
+ log.debug(
304
+ "Assigned layers after changing time only",
305
+ JSON.parse(JSON.stringify(layersCollection)),
306
+ );
307
+ mapLayers.value = layersCollection;
308
+ return;
309
+ }
310
+
311
+ /** @type {Record<string,any>[]} */
312
+ layersCollection = await createLayersConfig(updatedStac);
313
+
314
+ // updates layersCollection in place
315
+ await updateLayersConfig(layersCollection, eodashCols, updatedTime);
316
+
317
+ // Try to move map view to extent
318
+ // Sanitize extent,
319
+ const b = updatedStac.extent?.spatial.bbox[0];
320
+ const sanitizedExtent = [
321
+ b[0] > -180 ? b[0] : -180,
322
+ b[1] > -90 ? b[1] : -90,
323
+ b[2] < 180 ? b[2] : 180,
324
+ b[3] < 90 ? b[3] : 90,
325
+ ];
326
+
327
+ const reprojExtent = mapElement.value?.transformExtent(
328
+ sanitizedExtent,
329
+ "EPSG:4326",
330
+ mapElement.value?.map?.getView().getProjection(),
331
+ );
332
+ /** @type {any} */
333
+ (mapElement.value).zoomExtent = reprojExtent;
334
+
335
+ log.debug(
336
+ "Assigned layers",
337
+ JSON.parse(JSON.stringify(layersCollection)),
338
+ );
339
+
340
+ mapLayers.value = layersCollection;
341
+ }
342
+ },
343
+ { immediate: true },
344
+ );
345
+
346
+ onUnmounted(() => {
347
+ stopIndicatorWatcher();
244
348
  });
245
349
  };
@@ -12,6 +12,7 @@ import eodash from "@/eodash";
12
12
  import { useTheme } from "vuetify/lib/framework.mjs";
13
13
  import { onMounted, watch } from "vue";
14
14
  import { useSTAcStore } from "@/store/stac";
15
+ import log from "loglevel";
15
16
 
16
17
  /**
17
18
  * Creates an absolute URL from a relative link and assignes it to `currentUrl`
@@ -102,12 +103,12 @@ export const useUpdateTheme = (themeName, themeDefinition = {}) => {
102
103
  };
103
104
 
104
105
  /** Composable that syncs store and URLSearchParameters */
105
-
106
106
  export const useURLSearchParametersSync = () => {
107
107
  onMounted(async () => {
108
108
  // Analyze currently set url params when first loaded and set them in the store
109
109
  if (window.location.search) {
110
110
  const searchParams = new URLSearchParams(window.location.search);
111
+
111
112
  /** @type {number | undefined} */
112
113
  let x,
113
114
  /** @type {number | undefined} */
@@ -117,35 +118,45 @@ export const useURLSearchParametersSync = () => {
117
118
  for (const [key, value] of searchParams) {
118
119
  switch (key) {
119
120
  case "indicator": {
121
+ log.debug("Found indicator key in url");
120
122
  const { loadSelectedSTAC, stac } = useSTAcStore();
121
123
  const match = stac?.find((link) => link.id == value);
122
124
  if (match) {
125
+ log.debug("Found match, loading stac item", match);
123
126
  await loadSelectedSTAC(match.href);
124
127
  }
125
128
  break;
126
129
  }
130
+
127
131
  case "x":
128
132
  x = Number(value);
129
133
  break;
134
+
130
135
  case "y":
131
136
  y = Number(value);
132
137
  break;
138
+
133
139
  case "z":
134
140
  z = Number(value);
135
141
  break;
142
+
136
143
  case "datetime":
137
144
  try {
138
- datetime.value = new Date(value).toISOString();
145
+ const datetimeiso = new Date(value).toISOString();
146
+ log.debug("Valid datetime found", datetimeiso);
147
+ datetime.value = datetimeiso;
139
148
  } catch {
140
149
  datetime.value = new Date().toISOString();
141
150
  }
142
151
  break;
152
+
143
153
  default:
144
154
  break;
145
155
  }
146
156
  }
147
157
 
148
158
  if (x && y && z) {
159
+ log.debug("Coordinates found, applying map poisition", x, y, z);
149
160
  mapPosition.value = [x, y, z];
150
161
  }
151
162
  }
@@ -9,7 +9,8 @@ import { currentUrl } from "./store/States";
9
9
  */
10
10
  export const eodash = reactive({
11
11
  id: "demo",
12
- stacEndpoint: "https://gtif-cerulean.github.io/catalog/cerulean/catalog.json",
12
+ stacEndpoint:
13
+ "https://eodashcatalog.eox.at/test-style/trilateral/catalog.json",
13
14
  brand: {
14
15
  noLayout: true,
15
16
  name: "Demo",
@@ -53,7 +54,7 @@ export const eodash = reactive({
53
54
  id: Symbol(),
54
55
  type: "internal",
55
56
  title: "Indicators",
56
- layout: { x: 0, y: 0, w: 3, h: 8 },
57
+ layout: { x: 0, y: 0, w: 3, h: 6 },
57
58
  widget: {
58
59
  name: "EodashItemFilter",
59
60
  properties: {
@@ -66,7 +67,7 @@ export const eodash = reactive({
66
67
  id: Symbol(),
67
68
  type: "internal",
68
69
  title: "Layer Control",
69
- layout: { x: 0, y: 8, w: 3, h: 4 },
70
+ layout: { x: 0, y: 6, w: 3, h: 6 },
70
71
  widget: {
71
72
  name: "EodashLayerControl",
72
73
  },
@@ -122,6 +123,10 @@ export const eodash = reactive({
122
123
  title: "Datepicker",
123
124
  widget: {
124
125
  name: "EodashDatePicker",
126
+ properties: {
127
+ hintText: `<b>Hint:</b> closest available date is displayed <br />
128
+ on map (see Analysis Layers)`,
129
+ },
125
130
  },
126
131
  }
127
132
  : null;
@@ -0,0 +1,8 @@
1
+ import Axios from "axios";
2
+ import { setupCache } from "axios-cache-interceptor";
3
+
4
+ const instance = Axios.create();
5
+
6
+ export const axios = setupCache(instance, { cacheTakeover: false });
7
+
8
+ export default axios;
@@ -4,13 +4,14 @@ import eodash from "@/eodash";
4
4
  import VCalendar from "v-calendar";
5
5
  import { eodashKey } from "@/utils/keys";
6
6
  import store from "../store";
7
+ import log from "loglevel";
7
8
 
8
9
  export const pinia = createPinia();
9
10
 
10
11
  /** @param {import("vue").App} app */
11
12
  export function registerPlugins(app) {
12
13
  window.eodashStore = store;
13
-
14
+ window.setEodashLoglevel = log.setLevel;
14
15
  app
15
16
  .use(vuetify)
16
17
  .use(pinia)
@@ -1,5 +1,6 @@
1
1
  import { mapEl, mapCompareEl, registeredProjections } from "@/store/States";
2
2
  import { getProjectionCode } from "@/utils/helpers";
3
+ import log from "loglevel";
3
4
 
4
5
  /**
5
6
  * Returns the current layers of {@link mapEl}
@@ -15,7 +16,7 @@ export const registerProjection = async (projection) => {
15
16
  if (!code || registeredProjections.includes(code)) {
16
17
  return;
17
18
  }
18
-
19
+ log.debug("Unregistered projection found, registering it", code);
19
20
  registeredProjections.push(code);
20
21
  if (typeof projection === "object") {
21
22
  // registering whole projection definition
@@ -1,3 +1,7 @@
1
+ /** setting default log level globally to warning */
2
+ import log from "loglevel";
3
+ log.setLevel(log.levels.WARN, true);
4
+
1
5
  import { ref } from "vue";
2
6
 
3
7
  /** Currently selected STAC endpoint */
@@ -1,12 +1,13 @@
1
1
  import { defineStore } from "pinia";
2
2
  import { inject, ref } from "vue";
3
- import axios from "axios";
3
+ import axios from "@/plugins/axios";
4
4
  import { useAbsoluteUrl, useCompareAbsoluteUrl } from "@/composables/index";
5
5
  import { eodashKey } from "@/utils/keys";
6
6
  import { indicator } from "@/store/States";
7
7
  import { extractCollectionUrls } from "@/utils/helpers";
8
8
  import { eodashCollections, eodashCompareCollections } from "@/utils/states";
9
9
  import { EodashCollection } from "@/utils/eodashSTAC";
10
+ import log from "loglevel";
10
11
 
11
12
  export const useSTAcStore = defineStore("stac", () => {
12
13
  /**
@@ -52,6 +53,7 @@ export const useSTAcStore = defineStore("stac", () => {
52
53
  * @see {@link stac}
53
54
  */
54
55
  async function loadSTAC(url = eodash.stacEndpoint) {
56
+ log.debug("Loading STAC endpoint", url);
55
57
  await axios
56
58
  .get(url)
57
59
  .then((resp) => {
@@ -63,6 +65,7 @@ export const useSTAcStore = defineStore("stac", () => {
63
65
  }
64
66
  return link;
65
67
  });
68
+ log.debug("Setting selected STAC", links);
66
69
  stac.value = links;
67
70
  })
68
71
  .catch((err) => {
@@ -98,13 +101,13 @@ export const useSTAcStore = defineStore("stac", () => {
98
101
  }),
99
102
  ).then((collections) => {
100
103
  // empty array from old collections
101
- eodashCollections.length = 0;
104
+ eodashCollections.splice(0, eodashCollections.length);
102
105
  // update eodashCollections
103
106
  eodashCollections.push(...collections);
104
- });
105
107
 
106
- selectedStac.value = resp.data;
107
- indicator.value = selectedStac.value?.id ?? "";
108
+ selectedStac.value = resp.data;
109
+ indicator.value = selectedStac.value?.id ?? "";
110
+ });
108
111
  })
109
112
  .catch((err) => {
110
113
  throw new Error("error loading the selected STAC", err);
@@ -139,12 +142,12 @@ export const useSTAcStore = defineStore("stac", () => {
139
142
  }),
140
143
  ).then((collections) => {
141
144
  // empty array from old collections
142
- eodashCompareCollections.length = 0;
145
+ eodashCompareCollections.splice(0, eodashCompareCollections.length);
143
146
  // update eodashCompareCollections
144
147
  eodashCompareCollections.push(...collections);
145
- });
146
148
 
147
- selectedCompareStac.value = resp.data;
149
+ selectedCompareStac.value = resp.data;
150
+ });
148
151
  })
149
152
  .catch((err) => {
150
153
  throw new Error("error loading the selected comparison STAC", err);