@eodash/eodash 5.0.0-rc.2.4 → 5.0.0-rc.3

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 (80) hide show
  1. package/core/client/composables/DefineWidgets.js +8 -1
  2. package/core/client/eodash.js +9 -9
  3. package/core/client/eodashSTAC/createLayers.js +4 -17
  4. package/core/client/eodashSTAC/helpers.js +23 -0
  5. package/core/client/store/stac.js +3 -1
  6. package/core/client/types.ts +127 -21
  7. package/core/client/utils/states.js +9 -0
  8. package/core/client/vite-env.d.ts +0 -13
  9. package/dist/client/{DashboardLayout-D1UcB3RV.js → DashboardLayout-t_PavJPO.js} +2 -2
  10. package/dist/client/{DynamicWebComponent-DtZ_mHL9.js → DynamicWebComponent-y07rVJch.js} +1 -1
  11. package/dist/client/{EodashDatePicker-CYU0MZX5.js → EodashDatePicker-CcOfyzGD.js} +3 -83
  12. package/dist/client/{EodashItemFilter-SE9oW3oZ.js → EodashItemFilter-B9HCvIMi.js} +1 -1
  13. package/dist/client/{EodashLayerControl-BuGe29Nt.js → EodashLayerControl-KStn7Nb_.js} +8 -2
  14. package/dist/client/{EodashLayoutSwitcher-6wLl-Gtd.js → EodashLayoutSwitcher-DqeFO3RN.js} +2 -2
  15. package/dist/client/{EodashMapBtns-BWWu6eHG.js → EodashMapBtns-5BF27qJB.js} +36 -12
  16. package/dist/client/{EodashStacInfo-DjRSGLHM.js → EodashStacInfo-C_hDy6Pd.js} +7 -1
  17. package/dist/client/{EodashTools-CJ4hBH_X.js → EodashTools-BXflvRf8.js} +5 -4
  18. package/dist/client/{ExportState-BqnlEpzR.js → ExportState-C0QRemK1.js} +27 -12
  19. package/dist/client/{Footer-C_3WrfI4.js → Footer-7VGyGUAs.js} +1 -1
  20. package/dist/client/{Header-D_hcGpNG.js → Header-BQJnXHYq.js} +3 -3
  21. package/dist/client/{MobileLayout-CDbupC9v.js → MobileLayout-b8nQ-Vyl.js} +5 -5
  22. package/dist/client/{PopUp-Ba6mY2jQ.js → PopUp-DgNrh9Df.js} +3 -3
  23. package/dist/client/ProcessList-C62SOVO6.js +484 -0
  24. package/dist/client/{VImg-Yc9F9pYq.js → VImg-D4eT3IQ1.js} +2 -2
  25. package/dist/client/{VMain-BiS7HPEk.js → VMain-C3hN2-H3.js} +1 -1
  26. package/dist/client/{VOverlay-B9mxXaCv.js → VOverlay-tAeNygaA.js} +15 -6
  27. package/dist/client/{VTooltip-XJLaLrZQ.js → VTooltip-B0Q3iHMZ.js} +3 -3
  28. package/dist/client/{WidgetsContainer-DRVb_73N.js → WidgetsContainer-CtDHfCYf.js} +1 -1
  29. package/dist/client/{asWebComponent-DZpMGxEY.js → asWebComponent-BJ2NWunV.js} +100 -95
  30. package/dist/client/eo-dash.css +2 -2
  31. package/dist/client/eo-dash.js +1 -1
  32. package/dist/client/{forwardRefs-BtkfywIE.js → forwardRefs-CIFAqXaZ.js} +9 -9
  33. package/dist/client/{EodashMap-DhVCoYMi.js → index-BQ16n4Sk.js} +103 -78
  34. package/dist/client/index-Cv7HBz49.js +85 -0
  35. package/dist/client/{EodashProcess-GSj_LMsK.js → index-Da5xXX6Q.js} +349 -443
  36. package/dist/client/{index-f55xuyof.js → index-DvcUndod.js} +1 -1
  37. package/dist/client/{transition-CtL4BoVi.js → transition-Cdb4K27U.js} +1 -1
  38. package/dist/types/core/client/components/MobileLayout.vue.d.ts +9 -9
  39. package/dist/types/core/client/eodashSTAC/EodashCollection.d.ts +11 -6
  40. package/dist/types/core/client/eodashSTAC/createLayers.d.ts +6 -5
  41. package/dist/types/core/client/eodashSTAC/helpers.d.ts +383 -2
  42. package/dist/types/core/client/types.d.ts +85 -19
  43. package/dist/types/core/client/utils/states.d.ts +7 -0
  44. package/dist/types/widgets/EodashDatePicker.vue.d.ts +4 -4
  45. package/dist/types/widgets/EodashItemFilter.vue.d.ts +18 -18
  46. package/dist/types/widgets/EodashLayerControl.vue.d.ts +2 -2
  47. package/dist/types/widgets/EodashLayoutSwitcher.vue.d.ts +2 -2
  48. package/dist/types/widgets/EodashMap/methods/create-layers-config.d.ts +9 -0
  49. package/dist/types/widgets/EodashMap/methods/index.d.ts +5 -0
  50. package/dist/types/widgets/EodashMapBtns.vue.d.ts +8 -2
  51. package/dist/types/widgets/EodashProcess/ProcessList.vue.d.ts +2 -0
  52. package/dist/types/widgets/EodashProcess/methods/async.d.ts +45 -0
  53. package/dist/types/widgets/EodashProcess/methods/composables.d.ts +19 -0
  54. package/dist/types/widgets/EodashProcess/methods/handling.d.ts +78 -0
  55. package/dist/types/widgets/EodashProcess/methods/outputs.d.ts +54 -0
  56. package/dist/types/widgets/EodashProcess/methods/utils.d.ts +42 -0
  57. package/dist/types/widgets/EodashStacInfo.vue.d.ts +12 -12
  58. package/dist/types/widgets/EodashTools.vue.d.ts +44 -6
  59. package/dist/types/widgets/PopUp.vue.d.ts +4 -4
  60. package/package.json +30 -29
  61. package/widgets/EodashLayerControl.vue +8 -1
  62. package/widgets/{EodashMap.vue → EodashMap/index.vue} +53 -29
  63. package/widgets/EodashMap/methods/create-layers-config.js +151 -0
  64. package/{core/client/composables/EodashMap.js → widgets/EodashMap/methods/index.js} +4 -153
  65. package/widgets/EodashMapBtns.vue +33 -7
  66. package/widgets/EodashProcess/ProcessList.vue +82 -0
  67. package/widgets/EodashProcess/index.vue +186 -0
  68. package/widgets/EodashProcess/methods/async.js +209 -0
  69. package/widgets/EodashProcess/methods/composables.js +129 -0
  70. package/widgets/EodashProcess/methods/handling.js +254 -0
  71. package/widgets/EodashProcess/methods/outputs.js +216 -0
  72. package/widgets/EodashProcess/methods/utils.js +138 -0
  73. package/widgets/EodashStacInfo.vue +6 -0
  74. package/widgets/EodashTools.vue +1 -0
  75. package/core/client/composables/EodashProcess.js +0 -624
  76. package/dist/types/core/client/composables/EodashMap.d.ts +0 -6
  77. package/dist/types/core/client/composables/EodashProcess.d.ts +0 -162
  78. package/widgets/EodashProcess.vue +0 -208
  79. /package/dist/types/widgets/{EodashMap.vue.d.ts → EodashMap/index.vue.d.ts} +0 -0
  80. /package/dist/types/widgets/{EodashProcess.vue.d.ts → EodashProcess/index.vue.d.ts} +0 -0
@@ -1,624 +0,0 @@
1
- import { isMulti } from "@eox/jsonform/src/custom-inputs/spatial/utils";
2
- import { nextTick, onMounted, watch } from "vue";
3
- import mustache from "mustache";
4
- import axios from "axios";
5
- import { extractLayerConfig } from "@/eodashSTAC/helpers";
6
- import log from "loglevel";
7
- import { getLayers } from "@/store/actions";
8
- import { mapEl } from "@/store/states";
9
-
10
- /**
11
- * Polls the process status and fetches a result item when the process is successful.
12
- *
13
- * @param {Object} params - Parameters for polling the process status.
14
- * @param {string} params.processUrl - The URL of the process JSON report.
15
- * @param {import("vue").Ref<boolean>} params.isPolling - checks wether the polling should continue
16
- * @param {number} [params.pollInterval=5000] - The interval (in milliseconds) between polling attempts.
17
- * @param {number} [params.maxRetries=60] - The maximum number of polling attempts.
18
- * @returns {Promise<JSON>} The fetched results JSON.
19
- * @throws {Error} If the process does not complete successfully within the maximum retries.
20
- */
21
- export async function pollProcessStatus({
22
- processUrl,
23
- isPolling,
24
- pollInterval = 5000,
25
- maxRetries = 60,
26
- }) {
27
- let retries = 0;
28
- isPolling.value = true;
29
- while (retries < maxRetries && isPolling.value) {
30
- try {
31
- // Fetch the process JSON report
32
- const cacheBuster = new Date().getTime(); // Add a timestamp for cache busting
33
- const response = await axios.get(`${processUrl}?t=${cacheBuster}`);
34
- const processReport = response.data;
35
-
36
- // Check if the status is "successful"
37
- if (processReport.status === "successful") {
38
- console.log("Process completed successfully. Fetching result item...");
39
-
40
- // Extract the result item URL
41
- const resultsUrl = processReport.links[1].href;
42
- if (!resultsUrl) {
43
- throw new Error(`Result links not found in the process report.`);
44
- }
45
-
46
- // Fetch the result item
47
- const resultResponse = await axios.get(resultsUrl);
48
- console.log("Result file fetched successfully:", resultResponse.data);
49
- return resultResponse.data; // Return the json result list
50
- }
51
- if (processReport.status === "failed") {
52
- isPolling.value = false;
53
- throw new Error("Process failed.", processReport);
54
- }
55
-
56
- // Log the current status if not successful
57
- console.log(
58
- `Status: ${processReport.status}. Retrying in ${pollInterval / 1000} seconds...`,
59
- );
60
- } catch (error) {
61
- if (error instanceof Error) {
62
- console.error("Error while polling process status:", error.message);
63
- } else {
64
- console.error("Unknown error occurred:", error);
65
- }
66
- }
67
-
68
- // Wait for the next poll
69
- await new Promise((resolve) => setTimeout(resolve, pollInterval));
70
- retries++;
71
- }
72
- if (!isPolling.value) {
73
- console.warn("Polling was stopped before the process was completed.");
74
- return JSON.parse("{}");
75
- }
76
-
77
- throw new Error(
78
- "Max retries reached. Process did not complete successfully.",
79
- );
80
- }
81
-
82
- /**
83
- * Auto execute the process when the jsonform has the execute option
84
- *
85
- * @param {import("vue").Ref<boolean>} autoExec
86
- * @param {import("vue").Ref<import("@eox/jsonform").EOxJSONForm | null>} jsonformEl
87
- * @param {import("vue").Ref<Record<string,any> | null>} jsonformSchema
88
- * @param {() => Promise<void>} startProcess
89
- **/
90
- export function useAutoExec(
91
- autoExec,
92
- jsonformEl,
93
- jsonformSchema,
94
- startProcess,
95
- ) {
96
- /**
97
- * @param {CustomEvent} _e
98
- **/
99
- const onJsonFormChange = async (_e) => {
100
- await startProcess();
101
- };
102
-
103
- const addEventListener = async () => {
104
- await nextTick(() => {
105
- //@ts-expect-error TODO
106
- jsonformEl.value?.addEventListener("change", onJsonFormChange);
107
- });
108
- };
109
- const removeEventListener = () => {
110
- //@ts-expect-error TODO
111
- jsonformEl.value?.removeEventListener("change", onJsonFormChange);
112
- };
113
-
114
- watch(jsonformSchema, (updatedSchema) => {
115
- autoExec.value = updatedSchema?.options?.["execute"] || false;
116
- });
117
-
118
- onMounted(() => {
119
- watch(
120
- autoExec,
121
- async (exec) => {
122
- if (exec) {
123
- await addEventListener();
124
- } else {
125
- removeEventListener();
126
- }
127
- },
128
- { immediate: true },
129
- );
130
- });
131
- }
132
-
133
- /**
134
- * @param {Record<string,any> |null} [jsonformSchema]
135
- **/
136
- export function getBboxProperty(jsonformSchema) {
137
- return /** @type {string} */ (
138
- Object.keys(jsonformSchema?.properties ?? {}).find(
139
- (key) => jsonformSchema?.properties[key].format === "bounding-box",
140
- )
141
- );
142
- }
143
-
144
- /**
145
- * Extracts the keys of type "geojson" from the jsonform schema
146
- * @param {Record<string,any> |null} [jsonformSchema]
147
- **/
148
- export function getGeoJsonProperties(jsonformSchema) {
149
- return /** @type {string[]} */ (
150
- Object.keys(jsonformSchema?.properties ?? {}).filter(
151
- (key) => jsonformSchema?.properties[key].type === "geojson",
152
- )
153
- );
154
- }
155
-
156
- /**
157
- * Converts jsonform geojson values to stringified geometries
158
- * @param {Record<string,any> |null} [jsonformSchema]
159
- * @param {Record<string,any>} jsonformValue
160
- **/
161
- export function extractGeometries(jsonformValue, jsonformSchema) {
162
- const geojsonKeys = getGeoJsonProperties(jsonformSchema);
163
-
164
- for (const key of geojsonKeys) {
165
- if (!jsonformValue[key]) {
166
- continue;
167
- }
168
-
169
- if (isMulti(jsonformSchema?.properties[key])) {
170
- // jsonformValue[key] is a feature collection
171
- jsonformValue[key] =
172
- /** @type {import("ol/format/GeoJSON").GeoJSONFeatureCollection} */ (
173
- jsonformValue[key]
174
- ).features.map((feature) => JSON.stringify(feature.geometry));
175
- } else {
176
- // jsonformValue[key] is a single feature
177
- jsonformValue[key] = JSON.stringify(jsonformValue[key].geometry);
178
- }
179
- }
180
- }
181
-
182
- /**
183
- * Injects CSS to remove the borders of the jsonform from inside the shadowRoot
184
- * @param {import("@eox/jsonform").EOxJSONForm | null} jsonFormEl
185
- **/
186
- export function injectJsonformCSS(jsonFormEl) {
187
- //@ts-expect-error TODO
188
- if (!jsonFormEl?.shadowRoot) {
189
- console.error("jsonform has no shadowRoot");
190
- return;
191
- }
192
- const stylesheet = new CSSStyleSheet();
193
- stylesheet.replaceSync(`.je-indented-panel {
194
- border: none !important;
195
- }`);
196
- //@ts-expect-error TODO
197
- jsonFormEl.shadowRoot.adoptedStyleSheets = [stylesheet];
198
- }
199
-
200
- /**
201
- * @param {import("stac-ts").StacLink[] | undefined} links
202
- * @param {Record<string,any>|undefined} jsonformValue
203
- * @param {number[]} origBbox
204
- */
205
- export function processImage(links, jsonformValue, origBbox) {
206
- if (!links) return;
207
- const imageLinks = links.filter(
208
- (link) => link.rel === "service" && link.type === "image/png",
209
- );
210
- const layers = [];
211
- for (const link of imageLinks) {
212
- layers.push({
213
- type: "Image",
214
- properties: {
215
- id: link.id,
216
- title: "Results " + link.id,
217
- },
218
- source: {
219
- type: "ImageStatic",
220
- imageExtent: origBbox,
221
- url: mustache.render(link.href, {
222
- ...(jsonformValue ?? {}),
223
- }),
224
- },
225
- });
226
- }
227
- return layers;
228
- }
229
-
230
- /**
231
- * @param {import("stac-ts").StacLink[] | undefined} links
232
- * @param {Record<string,any> | undefined} jsonformValue
233
- * @param {string} layerId
234
- */
235
- export async function processVector(links, jsonformValue, layerId) {
236
- if (!links) return;
237
- /** @type {Record<string,any>[]} */
238
- const layers = [];
239
- const vectorLinks = links.filter(
240
- (link) => link.rel === "service" && link.type === "application/geo+json",
241
- );
242
- if (vectorLinks.length === 0) return layers;
243
-
244
- let flatStyleJSON = null;
245
-
246
- for (const link of vectorLinks) {
247
- if ("eox:flatstyle" in (link ?? {})) {
248
- flatStyleJSON = await axios
249
- .get(/** @type {string} */ (link["eox:flatstyle"]))
250
- .then((resp) => resp.data);
251
- }
252
-
253
- /** @type {Record<string,any>|undefined} */
254
- let layerConfig;
255
- /** @type {Record<string,any>|undefined} */
256
- let style;
257
- if (flatStyleJSON) {
258
- const extracted = extractLayerConfig(flatStyleJSON);
259
- layerConfig = extracted.layerConfig;
260
- style = extracted.style;
261
- }
262
-
263
- layers.push({
264
- type: "Vector",
265
- source: {
266
- type: "Vector",
267
- url: mustache.render(link.href, {
268
- ...(jsonformValue ?? {}),
269
- }),
270
- format: "GeoJSON",
271
- },
272
- properties: {
273
- id: layerId + "_vector_process",
274
- title: "Results " + layerId,
275
- ...(layerConfig && { ...layerConfig, ...(style && { style: style }) }),
276
- },
277
- });
278
- }
279
- return layers;
280
- }
281
-
282
- /**
283
- * @param {import("stac-ts").StacLink[] | undefined} links
284
- * @param {Record<string,any> | undefined} jsonformValue
285
- * @param {import("vue").Ref<boolean>} isPolling
286
- * @param {string} layerId
287
- */
288
- export async function processGeoTiff(links, jsonformValue, layerId, isPolling) {
289
- if (!links) return;
290
- const geotiffLinks = links.filter(
291
- (link) => link.rel === "service" && link.type === "image/tiff",
292
- );
293
- let urls = [];
294
- let flatStyleJSON = null;
295
- for (const link of geotiffLinks ?? []) {
296
- if (link.endpoint === "eoxhub_workspaces") {
297
- // TODO: prove of concept, needs to be reworked for sure
298
- // Special handling for eoxhub workspace process endpoints
299
- const postBody = await axios
300
- .get(/** @type {string} */ (link["body"]), { responseType: "text" })
301
- .then((resp) => resp.data);
302
- const jsonData = JSON.parse(
303
- mustache.render(postBody, { ...(jsonformValue ?? {}) }),
304
- );
305
- try {
306
- const responseProcess = await axios.post(link.href, jsonData, {
307
- headers: {
308
- "Content-Type": "application/json",
309
- },
310
- });
311
- console.log(responseProcess.headers.location);
312
- await pollProcessStatus({
313
- processUrl: responseProcess.headers.location,
314
- isPolling,
315
- })
316
- .then((resultItem) => {
317
- // @ts-expect-error we have currently no definition of what is allowed as response
318
- const resultUrls = resultItem?.urls;
319
- if (!resultUrls?.length) {
320
- return;
321
- }
322
-
323
- urls.push(resultUrls[0]);
324
- })
325
- .catch((error) => {
326
- if (error instanceof Error) {
327
- console.error("Polling failed:", error.message);
328
- } else {
329
- console.error("Unknown error occurred during polling:", error);
330
- }
331
- });
332
- } catch (error) {
333
- if (error instanceof Error) {
334
- console.error("Error sending POST request:", error.message);
335
- } else {
336
- console.error("Unknown error occurred:", error);
337
- }
338
- }
339
- } else {
340
- urls.push(mustache.render(link.href, { ...(jsonformValue ?? {}) }));
341
- }
342
- if ("eox:flatstyle" in (link ?? {})) {
343
- flatStyleJSON = await axios
344
- .get(/** @type {string} */ (link["eox:flatstyle"]))
345
- .then((resp) => resp.data);
346
- }
347
- }
348
- /** @type {Record<string,any>|undefined} */
349
- let layerConfig;
350
- /** @type {Record<string,any>|undefined} */
351
- let style;
352
- if (flatStyleJSON) {
353
- const extracted = extractLayerConfig(layerId ?? "", flatStyleJSON);
354
- layerConfig = extracted.layerConfig;
355
- style = extracted.style;
356
- }
357
- return urls.length
358
- ? {
359
- type: "WebGLTile",
360
- source: {
361
- type: "GeoTIFF",
362
- normalize: !style,
363
- sources: urls.map((url) => ({ url })),
364
- },
365
- properties: {
366
- id: layerId + "_geotiff_process",
367
- title: "Results " + layerId,
368
- ...(layerConfig && { layerConfig: layerConfig }),
369
- },
370
- ...(style && { style: style }),
371
- }
372
- : undefined;
373
- }
374
-
375
- /**
376
- * @param {import("stac-ts").StacLink[] | undefined} links
377
- * @param {Record<string,any> | undefined} jsonformValue
378
- * @param {string} specUrl
379
- * @returns {Promise<[import("@eox/chart").EOxChart["spec"] | null,Record<string,any>|null]>}
380
- **/
381
- export async function getChartValues(links, jsonformValue, specUrl) {
382
- if (!specUrl || !links) return [null, null];
383
- /** @type {import("vega").Spec} */
384
- const spec = await axios.get(specUrl).then((resp) => {
385
- return resp.data;
386
- });
387
- // //@ts-expect-error NamedData
388
- // const dataName = spec?.data?.name;
389
- const dataLinks = links.filter(
390
- (link) => link.rel === "service", // && dataName && link.id === dataName,
391
- );
392
-
393
- /** @type {Record<string,any>} */
394
- const dataValues = {};
395
- for (const link of dataLinks ?? []) {
396
- if (link.type && ["application/json", "text/csv"].includes(link.type)) {
397
- const dataUrl = mustache.render(link.href, {
398
- ...(jsonformValue ?? {}),
399
- ...(link["eox:flatstyle"] ?? {}),
400
- });
401
- // Wait for data to be retrieved
402
- const data = await axios.get(dataUrl).then((resp) => {
403
- return resp.data;
404
- });
405
- // @ts-expect-error we assume data to exist in spec
406
- spec.data.values = data;
407
- continue;
408
- }
409
-
410
- dataValues[/** @type {string} */ (link.id)] = await axios
411
- .get(
412
- mustache.render(link.href, {
413
- ...(jsonformValue ?? {}),
414
- ...(link["eox:flatstyle"] ?? {}),
415
- }),
416
- )
417
- .then((resp) => resp.data);
418
- }
419
- return [spec, dataValues];
420
- }
421
-
422
- /**
423
- * @param {Object} params
424
- * @param {import("vue").Ref<boolean>} params.loading
425
- * @param {import("vue").Ref<import("stac-ts").StacCollection | null>} params.selectedStac
426
- * @param {import("vue").Ref<import("@eox/jsonform").EOxJSONForm | null>} params.jsonformEl
427
- * @param {import("vue").Ref<Record<string,any>|null>} params.jsonformSchema
428
- * @param {import("vue").Ref<import("@eox/chart").EOxChart["spec"] | null>} params.chartSpec
429
- * @param {import("vue").Ref<Record<string, any> | null>} params.chartData
430
- * @param {import("vue").Ref<boolean>} params.isPolling
431
- * @param {import("vue").Ref<any[]>} params.processResults
432
- */
433
- export async function handleProcesses({
434
- loading,
435
- selectedStac,
436
- jsonformEl,
437
- jsonformSchema,
438
- chartSpec,
439
- chartData,
440
- isPolling,
441
- processResults,
442
- }) {
443
- log.debug("Processing...");
444
- loading.value = true;
445
- try {
446
- const serviceLinks = selectedStac.value?.links?.filter(
447
- (l) => l.rel === "service",
448
- );
449
- const bboxProperty = getBboxProperty(jsonformSchema.value);
450
- const jsonformValue = /** @type {Record<string,any>} */ (
451
- //@ts-expect-error todo
452
- jsonformEl.value?.value
453
- );
454
-
455
- extractGeometries(jsonformValue, jsonformSchema.value);
456
-
457
- const origBbox = jsonformValue[bboxProperty];
458
-
459
- const specUrl = /** @type {string} */ (
460
- selectedStac.value?.["eodash:vegadefinition"]
461
- );
462
-
463
- [chartSpec.value, chartData.value] = await getChartValues(
464
- serviceLinks,
465
- { ...(jsonformValue ?? {}) },
466
- specUrl,
467
- );
468
- if (Object.keys(chartData.value ?? {}).length) {
469
- processResults.value.push(chartData.value);
470
- }
471
- //@ts-expect-error we assume that the spec data is of type InlineData
472
- if (chartSpec.value?.data?.values?.length) {
473
- //@ts-expect-error we assume that the spec data is of type InlineData
474
- processResults.value.push(chartSpec.value?.data.values);
475
- }
476
-
477
- if (chartSpec.value && !("background" in chartSpec.value)) {
478
- chartSpec.value["background"] = "transparent";
479
- }
480
-
481
- const geotiffLayer = await processGeoTiff(
482
- serviceLinks,
483
- jsonformValue,
484
- selectedStac.value?.id ?? "",
485
- isPolling,
486
- );
487
-
488
- if (geotiffLayer && geotiffLayer.source?.sources.length) {
489
- processResults.value.push(
490
- ...(geotiffLayer.source?.sources?.map((source) => source.url) ?? []),
491
- );
492
- }
493
- // 3. vector geojson
494
- const vectorLayers = await processVector(
495
- serviceLinks,
496
- jsonformValue,
497
- selectedStac.value?.id ?? "",
498
- );
499
-
500
- if (vectorLayers?.length) {
501
- processResults.value.push(
502
- ...vectorLayers.map((layer) => layer.source?.url),
503
- );
504
- }
505
-
506
- const imageLayers = processImage(serviceLinks, jsonformValue, origBbox);
507
- if (imageLayers?.length) {
508
- processResults.value.push(
509
- ...imageLayers.map((layer) => layer.source?.url),
510
- );
511
- }
512
-
513
- log.debug(
514
- "rendered layers after processing:",
515
- geotiffLayer,
516
- vectorLayers,
517
- imageLayers,
518
- );
519
-
520
- if (geotiffLayer || vectorLayers?.length || imageLayers?.length) {
521
- const layers = [
522
- ...(geotiffLayer ? [geotiffLayer] : []),
523
- ...(vectorLayers ?? []),
524
- ...(imageLayers ?? []),
525
- ];
526
- let currentLayers = [...getLayers()];
527
- let analysisGroup = currentLayers.find((l) =>
528
- l.properties.id.includes("AnalysisGroup"),
529
- );
530
- analysisGroup?.layers.push(...layers);
531
-
532
- if (mapEl.value) {
533
- mapEl.value.layers = [...currentLayers];
534
- }
535
- }
536
- loading.value = false;
537
- } catch (error) {
538
- console.error("[eodash] Error while running process:", error);
539
- loading.value = false;
540
- throw error;
541
- }
542
- }
543
-
544
- /**
545
- * Reset the process state
546
- * @param {Object} params
547
- * @param {import("vue").Ref<boolean>} params.loading
548
- * @param {import("vue").Ref<boolean>} params.isProcessed
549
- * @param {import("vue").Ref<import("@eox/chart").EOxChart["spec"] | null>} params.chartSpec
550
- * @param {import("vue").Ref<boolean>} params.isPolling
551
- * @param {import("vue").Ref<any[]>} params.processResults
552
- * @param {import("vue").Ref<Record<string,any>|null>} params.jsonformSchema
553
- */
554
- export function resetProcess({
555
- loading,
556
- isProcessed,
557
- chartSpec,
558
- jsonformSchema,
559
- processResults,
560
- isPolling,
561
- }) {
562
- loading.value = false;
563
- isProcessed.value = false;
564
- isPolling.value = false;
565
- chartSpec.value = null;
566
- processResults.value = [];
567
- jsonformSchema.value = null;
568
- }
569
-
570
- /**
571
- * Description placeholder
572
- *
573
- * @export
574
- * @async
575
- * @param {Object} params
576
- * @param {import("vue").Ref<import("stac-ts").StacCollection>} params.selectedStac
577
- * @param {import("vue").Ref<import("@eox/jsonform").EOxJSONForm | null>} params.jsonformEl
578
- * @param {import("vue").Ref<Record<string,any> | null>} params.jsonformSchema
579
- * @param {import("vue").Ref<import("@eox/chart").EOxChart["spec"] | null>} params.chartSpec
580
- * @param {import("vue").Ref<any[]>} params.processResults
581
- * @param {import("vue").Ref<boolean>} params.isProcessed
582
- * @param {import("vue").Ref<boolean>} params.loading
583
- * @param {import("vue").Ref<boolean>} params.isPolling
584
- */
585
- export async function initProcess({
586
- selectedStac,
587
- jsonformEl,
588
- jsonformSchema,
589
- chartSpec,
590
- isProcessed,
591
- processResults,
592
- loading,
593
- isPolling,
594
- }) {
595
- if (!selectedStac.value) {
596
- return;
597
- }
598
- resetProcess({
599
- loading,
600
- isProcessed,
601
- chartSpec,
602
- jsonformSchema,
603
- isPolling,
604
- processResults,
605
- });
606
- if (selectedStac.value["eodash:jsonform"]) {
607
- //@ts-expect-error todo
608
- jsonformEl.value?.editor.destroy();
609
- // wait for the layers to be rendered
610
- jsonformSchema.value = await axios
611
- //@ts-expect-error eodash extention
612
- .get(selectedStac.value["eodash:jsonform"])
613
- .then((resp) => resp.data);
614
- // remove borders from jsonform
615
- await nextTick(() => {
616
- injectJsonformCSS(jsonformEl.value);
617
- });
618
- } else {
619
- if (!jsonformSchema.value) {
620
- return;
621
- }
622
- jsonformSchema.value = null;
623
- }
624
- }
@@ -1,6 +0,0 @@
1
- export function useHandleMapMoveEnd(mapElement: import("vue").Ref<(HTMLElement & Record<string, any> & {
2
- map: import("ol").Map;
3
- }) | null>, mapPosition: import("vue").Ref<(number | undefined)[]>): void;
4
- export function useInitMap(mapElement: import("vue").Ref<import("@eox/map").EOxMap | null>, selectedIndicator: import("vue").Ref<import("stac-ts").StacCollection | null>, eodashCols: EodashCollection[], datetime: import("vue").Ref<string>, mapLayers: import("vue").Ref<Record<string, any>[]>, partnerMap: import("vue").Ref<import("@eox/map").EOxMap | null>, zoomToExtent: boolean): void;
5
- export function useUpdateTooltipProperties(eodashCols: EodashCollection[], tooltipProperties: import("vue").Ref<Exclude<import("../types").EodashStyleJson["tooltip"], undefined>>): void;
6
- import { EodashCollection } from "../eodashSTAC/EodashCollection";