@eodash/eodash 5.0.0 → 5.2.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.
Files changed (162) hide show
  1. package/README.md +1 -0
  2. package/core/client/App.vue +8 -2
  3. package/core/client/asWebComponent.js +5 -5
  4. package/core/client/components/DashboardLayout.vue +43 -26
  5. package/core/client/components/EodashOverlay.vue +5 -6
  6. package/core/client/components/ErrorAlert.vue +2 -2
  7. package/core/client/components/Footer.vue +4 -4
  8. package/core/client/components/Header.vue +3 -3
  9. package/core/client/components/MobileLayout.vue +47 -27
  10. package/core/client/composables/DefineEodash.js +38 -43
  11. package/core/client/composables/DefineTemplate.js +4 -2
  12. package/core/client/composables/DefineWidgets.js +14 -8
  13. package/core/client/composables/index.js +273 -23
  14. package/core/client/eodashSTAC/EodashCollection.js +84 -62
  15. package/core/client/eodashSTAC/createLayers.js +30 -0
  16. package/core/client/eodashSTAC/helpers.js +159 -28
  17. package/core/client/eodashSTAC/parquet.js +145 -0
  18. package/core/client/eodashSTAC/triggers.js +6 -3
  19. package/core/client/plugins/index.js +4 -3
  20. package/core/client/plugins/vuetify.js +3 -0
  21. package/core/client/store/actions.js +21 -4
  22. package/core/client/store/stac.js +93 -56
  23. package/core/client/store/states.js +15 -5
  24. package/core/client/types.ts +59 -43
  25. package/core/client/utils/index.js +79 -0
  26. package/core/client/utils/keys.js +2 -2
  27. package/core/client/utils/states.js +30 -5
  28. package/core/client/views/Dashboard.vue +36 -32
  29. package/core/client/vite-env.d.ts +7 -0
  30. package/dist/client/{DashboardLayout-CkWvOMOW.js → DashboardLayout-Dq9Kfe6O.js} +24 -13
  31. package/dist/client/{DynamicWebComponent-DYBbpvUK.js → DynamicWebComponent-DCBMXskE.js} +1 -1
  32. package/dist/client/{EodashDatePicker-CALmW3SI.js → EodashDatePicker-DtngxU6s.js} +59 -32
  33. package/dist/client/{EodashItemFilter-DlQiE713.js → EodashItemFilter-ClQebJQt.js} +20 -10
  34. package/dist/client/{EodashLayerControl-DEzEbft7.js → EodashLayerControl-BLBds28C.js} +29 -16
  35. package/dist/client/EodashLayoutSwitcher-DQ8SfVDd.js +61 -0
  36. package/dist/client/EodashMapBtns-B89_YBDw.js +326 -0
  37. package/dist/client/{EodashStacInfo-DPPxDkF6.js → EodashStacInfo-Dt1nF06x.js} +3 -18
  38. package/dist/client/{EodashTools-CUaL9s4H.js → EodashTools-DV5ykmWc.js} +13 -13
  39. package/dist/client/{ExportState-DjyIZVhl.js → ExportState-B6zZQUmE.js} +57 -52
  40. package/dist/client/{Footer-DyL0JoWt.js → Footer-DNhXs8k6.js} +15 -13
  41. package/dist/client/{Header-B5Dgty9l.js → Header-BjhN5JY4.js} +32 -28
  42. package/dist/client/MobileLayout-JelB6w1G.js +118 -0
  43. package/dist/client/{PopUp-BfB8s_ki.js → PopUp-CgpvNr3o.js} +18 -10
  44. package/dist/client/ProcessList-vecpxThi.js +198 -0
  45. package/dist/client/{VImg-FD1WVphJ.js → VImg-CETuikH2.js} +221 -26
  46. package/dist/client/{VMain-DJKG4SvM.js → VMain-Ci9DyaGU.js} +7 -7
  47. package/dist/client/{VTooltip-CfeefrXI.js → VTooltip-J4ac48X7.js} +12 -10
  48. package/dist/client/{WidgetsContainer-C2TaTdb6.js → WidgetsContainer-CCML4TyV.js} +1 -1
  49. package/dist/client/asWebComponent-ZyEzWOOf.js +19092 -0
  50. package/dist/client/async-B7jIrM53.js +804 -0
  51. package/dist/client/eo-dash.js +1 -1
  52. package/dist/client/{VOverlay-BzOdRu9h.js → forwardRefs-BQclvjMq.js} +332 -28
  53. package/dist/client/handling-BS24aG1q.js +1227 -0
  54. package/dist/client/helpers-wXK7Ywio.js +4556 -0
  55. package/dist/client/index-4UCzZi8B.js +376 -0
  56. package/dist/client/{index-4CT7Tz83.js → index-9KR-G20t.js} +2 -2
  57. package/dist/client/{index-CIHH_3dW.js → index-B2XpdgR6.js} +227 -86
  58. package/dist/client/material-symbols-outlined.woff2 +0 -0
  59. package/dist/client/material-symbols-rounded.woff2 +0 -0
  60. package/dist/client/material-symbols-sharp.woff2 +0 -0
  61. package/dist/client/material-symbols-subset.woff2 +0 -0
  62. package/dist/client/{ssrBoot-BP7SYRyC.js → ssrBoot-Zgc_Ttvi.js} +2 -2
  63. package/dist/client/templates.js +840 -0
  64. package/dist/client/transition-yBii4fu6.js +40 -0
  65. package/dist/node/cli.js +16 -6
  66. package/dist/node/types.d.ts +1 -1
  67. package/dist/types/core/client/App.vue.d.ts +2 -2
  68. package/dist/types/core/client/asWebComponent.d.ts +1 -1
  69. package/dist/types/core/client/components/DynamicWebComponent.vue.d.ts +1 -3
  70. package/dist/types/core/client/components/Footer.vue.d.ts +1 -105
  71. package/dist/types/core/client/components/IframeWrapper.vue.d.ts +1 -1
  72. package/dist/types/core/client/components/MobileLayout.vue.d.ts +1 -324
  73. package/dist/types/core/client/composables/DefineEodash.d.ts +2 -2
  74. package/dist/types/core/client/composables/DefineTemplate.d.ts +1 -1
  75. package/dist/types/core/client/composables/DefineWidgets.d.ts +4 -4
  76. package/dist/types/core/client/composables/index.d.ts +24 -2
  77. package/dist/types/core/client/eodashSTAC/EodashCollection.d.ts +9 -6
  78. package/dist/types/core/client/eodashSTAC/helpers.d.ts +25 -5
  79. package/dist/types/core/client/eodashSTAC/parquet.d.ts +2 -0
  80. package/dist/types/core/client/plugins/vuetify.d.ts +7 -4
  81. package/dist/types/core/client/store/actions.d.ts +3 -2
  82. package/dist/types/core/client/store/stac.d.ts +16 -13
  83. package/dist/types/core/client/store/states.d.ts +14 -4
  84. package/dist/types/core/client/types.d.ts +46 -31
  85. package/dist/types/core/client/utils/index.d.ts +2 -0
  86. package/dist/types/core/client/utils/keys.d.ts +4 -4
  87. package/dist/types/core/client/utils/states.d.ts +59 -47
  88. package/dist/types/core/client/views/Dashboard.vue.d.ts +2 -2
  89. package/dist/types/templates/baseConfig.d.ts +4 -0
  90. package/dist/types/templates/compare.d.ts +185 -0
  91. package/dist/types/templates/expert.d.ts +147 -0
  92. package/dist/types/templates/index.d.ts +6 -0
  93. package/dist/types/templates/light.d.ts +154 -0
  94. package/dist/types/widgets/EodashDatePicker.vue.d.ts +1 -458
  95. package/dist/types/widgets/EodashItemFilter.vue.d.ts +3 -3
  96. package/dist/types/widgets/EodashLayerControl.vue.d.ts +14 -7
  97. package/dist/types/widgets/EodashLayoutSwitcher.vue.d.ts +1 -3
  98. package/dist/types/widgets/{EodashMapBtns.vue.d.ts → EodashMap/EodashMapBtns.vue.d.ts} +12 -8
  99. package/dist/types/widgets/EodashMap/index.vue.d.ts +9 -4
  100. package/dist/types/widgets/EodashProcess/ProcessList.vue.d.ts +8 -1
  101. package/dist/types/widgets/EodashProcess/index.vue.d.ts +8 -4
  102. package/dist/types/widgets/EodashProcess/methods/async.d.ts +19 -18
  103. package/dist/types/widgets/EodashProcess/methods/composables.d.ts +3 -2
  104. package/dist/types/widgets/EodashProcess/methods/custom-endpoints/chart/index.d.ts +1 -0
  105. package/dist/types/widgets/EodashProcess/methods/custom-endpoints/chart/sentinelhub-endpoint.d.ts +6 -0
  106. package/dist/types/widgets/EodashProcess/methods/custom-endpoints/chart/veda-endpoint.d.ts +4 -0
  107. package/dist/types/widgets/EodashProcess/methods/custom-endpoints/layers/eoxhub-workspaces-endpoint.d.ts +5 -0
  108. package/dist/types/widgets/EodashProcess/methods/custom-endpoints/layers/index.d.ts +1 -0
  109. package/dist/types/widgets/EodashProcess/methods/handling.d.ts +12 -5
  110. package/dist/types/widgets/EodashProcess/methods/outputs.d.ts +72 -41
  111. package/dist/types/widgets/EodashProcess/methods/utils.d.ts +41 -21
  112. package/dist/types/widgets/EodashProcess/states.d.ts +11 -0
  113. package/dist/types/widgets/EodashProcess/types.d.ts +41 -0
  114. package/dist/types/widgets/EodashStacInfo.vue.d.ts +14 -14
  115. package/dist/types/widgets/EodashTools.vue.d.ts +3 -3
  116. package/dist/types/widgets/ExportState.vue.d.ts +1 -1
  117. package/dist/types/widgets/PopUp.vue.d.ts +11 -16
  118. package/dist/types/widgets/WidgetsContainer.vue.d.ts +3 -6
  119. package/package.json +55 -45
  120. package/templates/baseConfig.js +68 -0
  121. package/templates/compare.js +142 -0
  122. package/templates/expert.js +124 -0
  123. package/templates/index.js +8 -0
  124. package/templates/light.js +139 -0
  125. package/widgets/EodashDatePicker.vue +80 -31
  126. package/widgets/EodashItemFilter.vue +26 -11
  127. package/widgets/EodashLayerControl.vue +20 -11
  128. package/widgets/EodashLayoutSwitcher.vue +6 -3
  129. package/widgets/EodashMap/EodashMapBtns.vue +269 -0
  130. package/widgets/EodashMap/index.vue +255 -45
  131. package/widgets/EodashMap/methods/create-layers-config.js +4 -3
  132. package/widgets/EodashMap/methods/index.js +33 -23
  133. package/widgets/EodashProcess/ProcessList.vue +47 -11
  134. package/widgets/EodashProcess/index.vue +55 -20
  135. package/widgets/EodashProcess/methods/async.js +99 -60
  136. package/widgets/EodashProcess/methods/composables.js +21 -14
  137. package/widgets/EodashProcess/methods/custom-endpoints/chart/index.js +35 -0
  138. package/widgets/EodashProcess/methods/custom-endpoints/chart/sentinelhub-endpoint.js +275 -0
  139. package/widgets/EodashProcess/methods/custom-endpoints/chart/veda-endpoint.js +132 -0
  140. package/widgets/EodashProcess/methods/custom-endpoints/layers/eoxhub-workspaces-endpoint.js +94 -0
  141. package/widgets/EodashProcess/methods/custom-endpoints/layers/index.js +33 -0
  142. package/widgets/EodashProcess/methods/handling.js +127 -80
  143. package/widgets/EodashProcess/methods/outputs.js +376 -125
  144. package/widgets/EodashProcess/methods/utils.js +442 -10
  145. package/widgets/EodashProcess/states.js +13 -0
  146. package/widgets/EodashProcess/types.ts +46 -0
  147. package/widgets/EodashStacInfo.vue +2 -17
  148. package/widgets/EodashTools.vue +13 -13
  149. package/widgets/WidgetsContainer.vue +1 -1
  150. package/core/client/eodash.js +0 -454
  151. package/dist/client/EodashLayoutSwitcher-CDeCV8F-.js +0 -52
  152. package/dist/client/EodashMapBtns-CktQCfa-.js +0 -131
  153. package/dist/client/MobileLayout-CRsg_5Q4.js +0 -1217
  154. package/dist/client/ProcessList-DTefwQZx.js +0 -484
  155. package/dist/client/asWebComponent-CLhcT715.js +0 -12479
  156. package/dist/client/eo-dash.css +0 -5
  157. package/dist/client/forwardRefs-Bon_Kku1.js +0 -245
  158. package/dist/client/index-Bm9cbtx5.js +0 -201
  159. package/dist/client/index-DiGDvTQU.js +0 -780
  160. package/dist/client/transition-C5I57hn6.js +0 -37
  161. package/dist/types/core/client/eodash.d.ts +0 -8
  162. package/widgets/EodashMapBtns.vue +0 -113
@@ -1,9 +1,10 @@
1
1
  <template>
2
- <div ref="container" class="process-container">
3
- <ProcessList />
2
+ <div ref="container" class="pb-4">
3
+ <ProcessList :map-element="mapElement" :enable-compare="enableCompare" />
4
4
 
5
5
  <eox-jsonform
6
6
  v-if="jsonformSchema"
7
+ :key="jsonformKey"
7
8
  ref="jsonformEl"
8
9
  .schema="jsonformSchema"
9
10
  ></eox-jsonform>
@@ -14,12 +15,14 @@
14
15
  .dataValues="toRaw(chartData)"
15
16
  @click:item="onChartClick"
16
17
  :style="chartStyles"
18
+ .opt="vegaEmbedOptions"
17
19
  />
18
- <div style="text-align: right">
20
+ <div class="mt-4 text-right">
19
21
  <v-btn
20
- v-if="!autoExec"
22
+ v-if="showExecBtn"
21
23
  :loading="loading"
22
24
  style="margin-right: 20px"
25
+ :append-icon="[mdiCogPlayOutline]"
23
26
  @click="startProcess"
24
27
  color="primary"
25
28
  >
@@ -28,6 +31,7 @@
28
31
  <v-btn
29
32
  v-if="processResults.length && isProcessed && !isAsync"
30
33
  color="primary"
34
+ :append-icon="[mdiDownloadCircleOutline]"
31
35
  @click="downloadResults"
32
36
  >
33
37
  Download
@@ -45,10 +49,29 @@ import { computed, ref, toRaw, useTemplateRef } from "vue";
45
49
  import ProcessList from "./ProcessList.vue";
46
50
  import { handleProcesses, onChartClick } from "./methods/handling";
47
51
  import { useInitProcess, useAutoExec } from "./methods/composables";
48
- import { jobs, updateJobsStatus } from "./methods/async";
49
- import { indicator } from "@/store/states";
52
+ import { updateJobsStatus } from "./methods/async";
53
+ import {
54
+ compareIndicator,
55
+ indicator,
56
+ mapCompareEl,
57
+ mapEl,
58
+ } from "@/store/states";
50
59
  import { download } from "./methods/utils";
51
-
60
+ import { compareJobs, jobs } from "./states";
61
+ import { mdiCogPlayOutline, mdiDownloadCircleOutline } from "@mdi/js";
62
+
63
+ const { enableCompare, vegaEmbedOptions } = defineProps({
64
+ enableCompare: {
65
+ type: Boolean,
66
+ default: false,
67
+ },
68
+ vegaEmbedOptions: {
69
+ type: Object,
70
+ default() {
71
+ return { actions: true };
72
+ },
73
+ },
74
+ });
52
75
  /** @type {import("vue").Ref<import("vega").Spec|null>} */
53
76
  const chartSpec = ref(null);
54
77
 
@@ -78,11 +101,25 @@ const isPolling = ref(false);
78
101
  /** @type {import("vue").Ref<any[]>} */
79
102
  const processResults = ref([]);
80
103
 
81
- const { selectedStac } = storeToRefs(useSTAcStore());
104
+ const showExecBtn = computed(
105
+ () =>
106
+ !autoExec.value &&
107
+ (!!jsonformSchema.value || !!chartSpec.value) &&
108
+ !!jsonformEl.value,
109
+ );
110
+ const { selectedStac, selectedCompareStac } = storeToRefs(useSTAcStore());
111
+ const currentSelectedStac = enableCompare ? selectedCompareStac : selectedStac;
112
+ const mapElement = enableCompare ? mapCompareEl : mapEl;
113
+ const currentIndicator = enableCompare ? compareIndicator : indicator;
114
+ const currentJobs = enableCompare ? compareJobs : jobs;
115
+
116
+ const jsonformKey = computed(
117
+ () => currentIndicator.value + mapElement.value?.id,
118
+ );
82
119
 
83
120
  useInitProcess({
84
- //@ts-expect-error TODO
85
- selectedStac,
121
+ selectedStac: currentSelectedStac,
122
+ mapElement: mapElement.value,
86
123
  jsonformEl,
87
124
  jsonformSchema,
88
125
  chartSpec,
@@ -104,7 +141,7 @@ const downloadResults = () => {
104
141
  : result;
105
142
  fileName = fileName.includes("?") ? fileName.split("?")[0] : fileName;
106
143
  } else {
107
- fileName = selectedStac.value?.id + "_process_results.json";
144
+ fileName = currentSelectedStac.value?.id + "_process_results.json";
108
145
  }
109
146
  download(fileName, result);
110
147
  });
@@ -141,25 +178,25 @@ const startProcess = async () => {
141
178
  processResults.value = [];
142
179
 
143
180
  await handleProcesses({
181
+ jobs: currentJobs,
182
+ selectedStac: currentSelectedStac,
144
183
  jsonformEl,
145
184
  jsonformSchema,
146
185
  chartSpec,
147
186
  chartData,
148
187
  loading,
149
- //@ts-expect-error TODO
150
- selectedStac,
151
- isProcessed,
152
188
  isPolling,
153
189
  processResults,
190
+ mapElement: mapElement.value,
154
191
  });
155
192
 
156
193
  isProcessed.value = true;
157
- if (isAsync.value) updateJobsStatus(jobs, indicator);
194
+ if (isAsync.value) updateJobsStatus(currentJobs, currentIndicator.value);
158
195
  };
159
196
  useAutoExec(autoExec, jsonformEl, jsonformSchema, startProcess);
160
197
 
161
198
  const chartStyles = computed(() => {
162
- /** @type {Record<string,string> }*/
199
+ /** @type {Record<string,string>} */
163
200
  const styles = {};
164
201
  if (!chartSpec.value?.["height"]) {
165
202
  styles["height"] =
@@ -173,14 +210,12 @@ const chartStyles = computed(() => {
173
210
  });
174
211
  </script>
175
212
  <style>
176
- .process-container {
177
- height: 100%;
178
- overflow-y: auto;
179
- }
180
213
  eox-chart {
181
214
  --background-color: transparent;
215
+ padding-top: 1em;
182
216
  }
183
217
  eox-jsonform {
184
218
  padding: 0.7em;
219
+ min-height: 0px;
185
220
  }
186
221
  </style>
@@ -1,39 +1,45 @@
1
- import { indicator, mapEl } from "@/store/states";
1
+ import { compareIndicator, indicator } from "@/store/states";
2
+ // we don't want to use the caching axios instance here
2
3
  import axios from "axios";
3
- import { ref } from "vue";
4
- import { createLayerDefinition, download } from "./utils";
4
+ import {
5
+ applyProcessLayersToMap,
6
+ creatAsyncProcessLayerDefinitions,
7
+ download,
8
+ extractAsyncResults,
9
+ } from "./utils";
5
10
  import log from "loglevel";
6
- import { getLayers } from "@/store/actions";
7
-
8
- /**
9
- * The list of job result from the server
10
- * {job_start_datetime: string, job_end_datetime: string,status: string}
11
- * @type {import("vue").Ref<any[]>}
12
- **/
13
- export const jobs = ref([]);
14
11
 
15
12
  /**
16
13
  * Polls the process status and fetches a result item when the process is successful.
17
14
  *
18
15
  * @param {Object} params - Parameters for polling the process status.
16
+ * @param {import("vue").Ref<import("../types").AsyncJob[]>} params.jobs - The list of jobs to update.
19
17
  * @param {string} params.processUrl - The URL of the process JSON report.
20
18
  * @param {import("vue").Ref<boolean>} params.isPolling - checks wether the polling should continue
21
19
  * @param {number} [params.pollInterval=5000] - The interval (in milliseconds) between polling attempts.
22
20
  * @param {number} [params.maxRetries=60] - The maximum number of polling attempts.
23
- * @returns {Promise<JSON>} The fetched results JSON.
21
+ * @param {boolean} [params.enableCompare=false] - Whether to enable comparison mode, affecting the indicator used.
22
+ * @returns {Promise<import("../types").EOxHubProcessResults>} The fetched results JSON.
24
23
  * @throws {Error} If the process does not complete successfully within the maximum retries.
25
24
  */
26
25
  export async function pollProcessStatus({
26
+ jobs,
27
27
  processUrl,
28
28
  isPolling,
29
29
  pollInterval = 10000,
30
30
  maxRetries = 560,
31
+ enableCompare = false,
31
32
  }) {
32
33
  let retries = 0;
33
34
  isPolling.value = true;
35
+ // Ensure the jobs status is updated after the job has started and before polling
34
36
  setTimeout(() => {
35
- updateJobsStatus(jobs, indicator);
37
+ updateJobsStatus(
38
+ jobs,
39
+ enableCompare ? compareIndicator.value : indicator.value,
40
+ );
36
41
  }, 500);
42
+
37
43
  while (retries < maxRetries && isPolling.value) {
38
44
  try {
39
45
  // Fetch the process JSON report
@@ -89,14 +95,19 @@ export async function pollProcessStatus({
89
95
 
90
96
  /**
91
97
  *
92
- * @param {*} jobs
93
- * @param {*} indicator
98
+ * @param {import("vue").Ref<import("../types").AsyncJob[]>} jobs
99
+ * @param {string} indicator
94
100
  */
95
101
  export async function updateJobsStatus(jobs, indicator) {
96
102
  /** @type {string[]} */
97
- const jobsUrls = JSON.parse(localStorage.getItem(indicator.value) || "[]");
103
+ const jobsUrls = JSON.parse(localStorage.getItem(indicator) || "[]");
104
+ /** @type {import("../types").AsyncJob[]} */
98
105
  const jobResults = await Promise.all(
99
- jobsUrls.map((url) => fetch(url).then((response) => response.json())),
106
+ jobsUrls.map((url) =>
107
+ axios
108
+ .get(url, { params: { t: Date.now() } })
109
+ .then((response) => response.data),
110
+ ),
100
111
  );
101
112
  jobResults.sort((a, b) => {
102
113
  return (
@@ -109,28 +120,45 @@ export async function updateJobsStatus(jobs, indicator) {
109
120
 
110
121
  /**
111
122
  * Removes a job from the local storage and updates the job status
112
- * @param {*} jobObject
123
+ * @param {import("vue").Ref<import("../types").AsyncJob[]>} jobs
124
+ * @param {import("../types").AsyncJob} jobObject
125
+ * @param {string} indicator
113
126
  */
114
- export const deleteJob = async (jobObject) => {
127
+ export const deleteJob = async (jobs, jobObject, indicator) => {
115
128
  /** @type {string[]} */
116
- const jobsUrls = JSON.parse(localStorage.getItem(indicator.value) || "[]");
129
+ const jobsUrls = JSON.parse(localStorage.getItem(indicator) || "[]");
117
130
  const newJobs = jobsUrls.filter((url) => !url.includes(jobObject.jobID));
118
- localStorage.setItem(indicator.value, JSON.stringify(newJobs));
119
- updateJobsStatus(jobs, indicator);
131
+ localStorage.setItem(indicator, JSON.stringify(newJobs));
132
+ await updateJobsStatus(jobs, indicator);
120
133
  };
121
134
 
122
135
  /**
123
136
  * Downloads an existing process results
124
- * @param {*} jobObject
125
- * @param {*} selectedStac
137
+ * @param {import("../types").AsyncJob} jobObject
138
+ * @param {import("stac-ts").StacCollection | null} selectedStac
126
139
  */
127
140
  export const downloadPreviousResults = async (jobObject, selectedStac) => {
128
- /** @type {any[]} */
141
+ /** @type {string[]} */
129
142
  const results = [];
130
- await fetch(jobObject.links[1].href)
131
- .then((response) => response.json())
143
+ const link = jobObject.links.find(
144
+ (link) => link.rel.includes("results") && link.type == "application/json",
145
+ );
146
+ if (!link) {
147
+ return;
148
+ }
149
+ await axios
150
+ .get(link.href)
151
+ .then((response) => response.data)
132
152
  .then((data) => {
133
- results.push(...data.urls);
153
+ // either urls is an Array
154
+ if (data.urls) {
155
+ results.push(...data.urls);
156
+ } else {
157
+ // or urls need to be aggregated from mapping objects
158
+ for (const outputMappingObject of Object.values(data)) {
159
+ results.push(...outputMappingObject.urls);
160
+ }
161
+ }
134
162
  });
135
163
  results.forEach((result) => {
136
164
  if (!result) {
@@ -153,20 +181,21 @@ export const downloadPreviousResults = async (jobObject, selectedStac) => {
153
181
  * Load the process results and update the map layers.
154
182
  *
155
183
  * @async
156
- * @param {*} jobObject
157
- * @param {*} selectedStac
184
+ * @param {import("../types").AsyncJob} jobObject
185
+ * @param {import("stac-ts").StacCollection | null} selectedStac
186
+ * @param {import("@eox/map").EOxMap | null} mapElement
158
187
  */
159
- export const loadProcess = async (jobObject, selectedStac) => {
160
- /** @type {any[]} */
161
- const results = [];
162
- await axios
188
+ export const loadProcess = async (jobObject, selectedStac, mapElement) => {
189
+ /** @type {import("../types").EOxHubProcessResults} */
190
+ const results = await axios
163
191
  .get(jobObject.links[1].href)
164
- .then((response) => results.push(response.data));
192
+ .then((response) => response.data);
165
193
 
166
194
  await loadPreviousProcess({
167
195
  selectedStac,
168
196
  results,
169
197
  jobId: jobObject.jobID,
198
+ mapElement,
170
199
  });
171
200
  };
172
201
 
@@ -175,35 +204,45 @@ export const loadProcess = async (jobObject, selectedStac) => {
175
204
  *
176
205
  * @param {Object} params
177
206
  * @param {import("stac-ts").StacCollection | null} params.selectedStac
178
- * @param {any[]} params.results
179
207
  * @param {string} params.jobId
208
+ * @param {import("../types").EOxHubProcessResults} params.results
209
+ * @param {import("@eox/map").EOxMap | null} params.mapElement
180
210
  */
181
- export async function loadPreviousProcess({ selectedStac, results, jobId }) {
182
- const geotiffLinks = selectedStac?.links.filter(
183
- (link) => link.rel === "service" && link.type === "image/tiff",
184
- );
185
- // const stacProjection = selectedStac
186
- const geotiffLayer = await createLayerDefinition(
187
- geotiffLinks?.[0],
188
- selectedStac?.id ?? "",
189
- results?.[0].urls,
190
- //@ts-expect-error TODO
191
- selectedStac?.["eodash:mapProjection"]?.["name"] ?? null,
192
- jobId,
211
+ export async function loadPreviousProcess({
212
+ selectedStac,
213
+ results,
214
+ jobId,
215
+ mapElement,
216
+ }) {
217
+ const asyncLink = selectedStac?.links.find(
218
+ (link) => link.rel === "service" && link.endpoint == "eoxhub_workspaces",
193
219
  );
220
+ if (!asyncLink) {
221
+ return;
222
+ }
194
223
 
195
- log.debug("rendered layers after loading previous process:", geotiffLayer);
224
+ const unifiedResult = extractAsyncResults(results);
196
225
 
197
- if (geotiffLayer) {
198
- const layers = [...(geotiffLayer ? [geotiffLayer] : [])];
199
- let currentLayers = [...getLayers()];
200
- let analysisGroup = currentLayers.find((l) =>
201
- l.properties.id.includes("AnalysisGroup"),
202
- );
203
- analysisGroup?.layers.push(...layers);
226
+ const layers = await creatAsyncProcessLayerDefinitions(
227
+ unifiedResult,
228
+ asyncLink,
229
+ selectedStac,
230
+ jobId,
231
+ );
204
232
 
205
- if (mapEl.value) {
206
- mapEl.value.layers = [...currentLayers];
207
- }
208
- }
233
+ log.debug("rendered layers after loading previous process:", layers);
234
+ applyProcessLayersToMap(mapElement, layers);
209
235
  }
236
+
237
+ /**
238
+ * extracts job status url from local storage based on identifier
239
+ *
240
+ * @param {string} jobID
241
+ * @param {string} indicator
242
+ */
243
+ export const getJobStatusUrl = (jobID, indicator) => {
244
+ /** @type {string[]} */
245
+ const jobsUrls = JSON.parse(localStorage.getItem(indicator) || "[]");
246
+ const jobUrl = jobsUrls.find((url) => url.includes(jobID));
247
+ return jobUrl;
248
+ };
@@ -1,4 +1,3 @@
1
- import { mapEl } from "@/store/states";
2
1
  import { initProcess } from "./handling";
3
2
  import { useEventBus } from "@vueuse/core";
4
3
  import { nextTick, onMounted, watch } from "vue";
@@ -11,7 +10,7 @@ import { useOnLayersUpdate } from "@/composables";
11
10
  * @export
12
11
  * @async
13
12
  * @param {Object} params
14
- * @param {import("vue").Ref<import("stac-ts").StacCollection>} params.selectedStac
13
+ * @param {import("vue").Ref<import("stac-ts").StacCollection | null>} params.selectedStac
15
14
  * @param {import("vue").Ref<import("@eox/jsonform").EOxJSONForm | null>} params.jsonformEl
16
15
  * @param {import("vue").Ref<Record<string,any> | null>} params.jsonformSchema
17
16
  * @param {import("vue").Ref<import("@eox/chart").EOxChart["spec"] | null>} params.chartSpec
@@ -19,6 +18,7 @@ import { useOnLayersUpdate } from "@/composables";
19
18
  * @param {import("vue").Ref<boolean>} params.isProcessed
20
19
  * @param {import("vue").Ref<boolean>} params.loading
21
20
  * @param {import("vue").Ref<boolean>} params.isPolling
21
+ * @param {import("@eox/map").EOxMap | null} params.mapElement
22
22
  */
23
23
  export const useInitProcess = ({
24
24
  selectedStac,
@@ -29,13 +29,15 @@ export const useInitProcess = ({
29
29
  processResults,
30
30
  loading,
31
31
  isPolling,
32
+ mapElement,
32
33
  }) => {
33
34
  const layersEvents = useEventBus(eoxLayersKey);
34
35
 
35
36
  onMounted(async () => {
36
37
  // wait for the layers to be rendered
37
- if (mapEl.value?.layers.length > 1) {
38
+ if ((mapElement?.layers.length ?? 0) > 1) {
38
39
  await initProcess({
40
+ enableCompare: mapElement?.id === "compare",
39
41
  selectedStac,
40
42
  jsonformEl,
41
43
  jsonformSchema,
@@ -48,6 +50,7 @@ export const useInitProcess = ({
48
50
  } else {
49
51
  layersEvents.once(async () => {
50
52
  await initProcess({
53
+ enableCompare: mapElement?.id === "compare",
51
54
  selectedStac,
52
55
  jsonformEl,
53
56
  jsonformSchema,
@@ -61,19 +64,23 @@ export const useInitProcess = ({
61
64
  }
62
65
  });
63
66
 
67
+ const evtKey =
68
+ mapElement?.id === "compare" ? "compareLayers:updated" : "layers:updated";
64
69
  useOnLayersUpdate(async (evt, _payload) => {
65
- if (evt === "layers:updated") {
66
- await initProcess({
67
- selectedStac,
68
- jsonformEl,
69
- jsonformSchema,
70
- chartSpec,
71
- isProcessed,
72
- processResults,
73
- loading,
74
- isPolling,
75
- });
70
+ if (evt !== evtKey) {
71
+ return;
76
72
  }
73
+ await initProcess({
74
+ enableCompare: mapElement?.id === "compare",
75
+ selectedStac,
76
+ jsonformEl,
77
+ jsonformSchema,
78
+ chartSpec,
79
+ isProcessed,
80
+ processResults,
81
+ loading,
82
+ isPolling,
83
+ });
77
84
  });
78
85
  };
79
86
 
@@ -0,0 +1,35 @@
1
+ import log from "loglevel";
2
+ import { handleSentinelHubProcess } from "./sentinelhub-endpoint";
3
+ import { handleVedaEndpoint } from "./veda-endpoint";
4
+
5
+ export const handleChartCustomEndpoints = createCustomChartEndpointsHandler([
6
+ handleSentinelHubProcess,
7
+ handleVedaEndpoint,
8
+ ]);
9
+ /**
10
+ * @param {((input:import("^/EodashProcess/types").CustomEnpointInput)=> Promise<any[] | undefined | null>)[]} callbacks
11
+ */
12
+ function createCustomChartEndpointsHandler(callbacks) {
13
+ /**
14
+ * @param {import("^/EodashProcess/types").CustomEnpointInput} inputs
15
+ * */
16
+ return async (inputs) => {
17
+ for (const callback of callbacks) {
18
+ const data = await callback(inputs);
19
+ log.debug(
20
+ "Custom endpoint data:",
21
+ data,
22
+ "for callback:",
23
+ callback.name,
24
+ "inputs:",
25
+ inputs,
26
+ );
27
+ const isNotValid = !data || !data.length || data.some((item) => !item);
28
+ if (isNotValid) {
29
+ continue;
30
+ }
31
+ return data;
32
+ }
33
+ return null;
34
+ };
35
+ }