@eodash/eodash 5.3.2 → 5.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/core/client/composables/DefineEodash.js +3 -1
- package/core/client/eodashSTAC/EodashCollection.js +29 -43
- package/core/client/eodashSTAC/auth.js +19 -15
- package/core/client/eodashSTAC/createLayers.js +318 -163
- package/core/client/eodashSTAC/helpers.js +64 -42
- package/core/client/eodashSTAC/parquet.js +1 -0
- package/core/client/eodashSTAC/triggers.js +7 -6
- package/core/client/store/states.js +1 -1
- package/core/client/types.ts +15 -9
- package/core/client/utils/states.js +32 -0
- package/dist/client/{DashboardLayout-BHQnHqWW.js → DashboardLayout-CQOGHPW_.js} +2 -2
- package/dist/client/{DynamicWebComponent-B4PdeZ9P.js → DynamicWebComponent-CoLO8FEf.js} +1 -1
- package/dist/client/{EodashDatePicker-Ch_AXVas.js → EodashDatePicker-BZeQ6bcu.js} +3 -3
- package/dist/client/{EodashItemFilter-lTuzCl08.js → EodashItemFilter-CmZkk7GK.js} +1 -1
- package/dist/client/{EodashLayerControl-CBSGRlIi.js → EodashLayerControl-D54fY-bX.js} +2 -2
- package/dist/client/{EodashLayoutSwitcher-DdwQYoI4.js → EodashLayoutSwitcher-BCP3FvDb.js} +3 -3
- package/dist/client/{EodashMapBtns-B910ylV6.js → EodashMapBtns-D-HulIl1.js} +14 -9
- package/dist/client/{EodashStacInfo-CeHGMZ8x.js → EodashStacInfo-BZbmT8vT.js} +1 -1
- package/dist/client/{EodashTimeSlider-BApJJK0u.js → EodashTimeSlider-DIcAJr6D.js} +2 -2
- package/dist/client/{EodashTools-CJVm0k-Q.js → EodashTools-Cz6X6hsF.js} +4 -4
- package/dist/client/{ExportState-NXzNGWYq.js → ExportState-DFVFAgKz.js} +4 -4
- package/dist/client/{Footer-DfXUC8IK.js → Footer-DLzQcjkI.js} +1 -1
- package/dist/client/{Header-BHgaNMEH.js → Header-_D9Z-zFJ.js} +2 -2
- package/dist/client/{MobileLayout-B77RzrNe.js → MobileLayout-3Ko9XSfO.js} +2 -2
- package/dist/client/{PopUp-BJwqRDNq.js → PopUp-DwI8V2gW.js} +2 -2
- package/dist/client/{ProcessList-BFvV4RvS.js → ProcessList-C9eAg2Sb.js} +20 -8
- package/dist/client/{VImg-RGGIQ_yA.js → VImg-COXTnCWE.js} +2 -2
- package/dist/client/{VMain-CniQR94B.js → VMain-C74l1bv-.js} +1 -1
- package/dist/client/{VTooltip-D5dnTfem.js → VTooltip-BLS-cQ9N.js} +2 -2
- package/dist/client/{WidgetsContainer-CvnR4J1T.js → WidgetsContainer-D-VfMRxE.js} +1 -1
- package/dist/client/{asWebComponent-Dptqds6-.js → asWebComponent-Bw03Jutr.js} +390 -220
- package/dist/client/{async-C1hb39Tc.js → async-D4G-FOIc.js} +13 -3
- package/dist/client/eo-dash.js +1 -1
- package/dist/client/{forwardRefs-CiSZZEn2.js → forwardRefs-CRMFoNYN.js} +2 -2
- package/dist/client/{handling-CZ537GCL.js → handling-DTAhQuPh.js} +94 -10
- package/dist/client/{helpers-DoQGyrvY.js → helpers-CsjKHAcK.js} +72 -50
- package/dist/client/{index-4sC2BIcK.js → index-BHilH1qx.js} +17 -13
- package/dist/client/{index-wcTqj0PZ.js → index-BIcmbjr0.js} +55 -16
- package/dist/client/{index--uKz-mt4.js → index-BoCcZ0l4.js} +3 -3
- package/dist/client/{index-DTxo2ysK.js → index-DEmHaCL3.js} +2 -2
- package/dist/client/templates.js +6 -2
- package/dist/client/{transition-CFfv5MCB.js → transition-6MJLK-_H.js} +1 -1
- package/dist/types/core/client/composables/DefineEodash.d.ts +1 -1
- package/dist/types/core/client/eodashSTAC/EodashCollection.d.ts +28 -11
- package/dist/types/core/client/eodashSTAC/auth.d.ts +5 -5
- package/dist/types/core/client/eodashSTAC/createLayers.d.ts +30 -23
- package/dist/types/core/client/eodashSTAC/helpers.d.ts +19 -4
- package/dist/types/core/client/types.d.ts +2 -1
- package/dist/types/core/client/utils/states.d.ts +28 -0
- package/dist/types/templates/index.d.ts +1 -0
- package/dist/types/widgets/EodashMap/EodashMapBtns.vue.d.ts +2 -0
- package/dist/types/widgets/EodashMap/index.vue.d.ts +2 -0
- package/dist/types/widgets/EodashProcess/methods/handling.d.ts +13 -0
- package/dist/types/widgets/EodashProcess/methods/utils.d.ts +1 -0
- package/package.json +2 -2
- package/templates/expert.js +4 -0
- package/templates/index.js +2 -0
- package/widgets/EodashMap/EodashMapBtns.vue +15 -0
- package/widgets/EodashMap/index.vue +17 -4
- package/widgets/EodashMap/methods/create-layers-config.js +23 -0
- package/widgets/EodashMap/methods/index.js +9 -7
- package/widgets/EodashProcess/ProcessList.vue +10 -2
- package/widgets/EodashProcess/index.vue +1 -9
- package/widgets/EodashProcess/methods/composables.js +13 -1
- package/widgets/EodashProcess/methods/custom-endpoints/chart/veda-endpoint.js +15 -6
- package/widgets/EodashProcess/methods/handling.js +77 -0
- package/widgets/EodashProcess/methods/utils.js +10 -0
|
@@ -25,6 +25,19 @@ export function initProcess({ selectedStac, jsonformEl, jsonformSchema, chartSpe
|
|
|
25
25
|
isPolling: import("vue").Ref<boolean>;
|
|
26
26
|
enableCompare: boolean;
|
|
27
27
|
}): Promise<void>;
|
|
28
|
+
/**
|
|
29
|
+
* Update the jsonform schema to have the correct layer id from the map
|
|
30
|
+
*
|
|
31
|
+
* @export
|
|
32
|
+
* @async
|
|
33
|
+
* @param {Object} params
|
|
34
|
+
* @param {import("vue").Ref<Record<string,any> | null>} params.jsonformSchema params.jsonformSchema
|
|
35
|
+
* @param {Record<string, any>[] | undefined} params.newLayers params.newLayers
|
|
36
|
+
*/
|
|
37
|
+
export function updateJsonformIdentifier({ jsonformSchema, newLayers }: {
|
|
38
|
+
jsonformSchema: import("vue").Ref<Record<string, any> | null>;
|
|
39
|
+
newLayers: Record<string, any>[] | undefined;
|
|
40
|
+
}): Promise<void>;
|
|
28
41
|
/**
|
|
29
42
|
*
|
|
30
43
|
* @param {object} params
|
|
@@ -59,4 +59,5 @@ export function extractAsyncResults(resultItem: import("../../EodashProcess/type
|
|
|
59
59
|
*/
|
|
60
60
|
export function updateJsonformSchemaTarget(jsonformSchema: import("json-schema").JSONSchema7 | null | undefined): import("json-schema").JSONSchema7 | null | undefined;
|
|
61
61
|
export function download(fileName: string, content: string | Record<string, any>): void;
|
|
62
|
+
export function getDrawToolsProperty(jsonformSchema: any): string | undefined;
|
|
62
63
|
export function applyProcessLayersToMap(mapElement: import("@eox/map").EOxMap | null, processLayers: import("@eox/map").EoxLayer[]): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eodash/eodash",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./dist/types/core/client/types.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"browser": "./core/client/main.js",
|
|
43
43
|
"scripts": {
|
|
44
44
|
"start": "npx eodash dev --entryPoint templates/baseConfig.js",
|
|
45
|
-
"prepare": "rollup -c",
|
|
45
|
+
"prepare": "rollup -c && chmod +x dist/node/cli.js",
|
|
46
46
|
"prepack": "npm run build:lib && npm run build:types",
|
|
47
47
|
"dev": "npx eodash dev --entryPoint templates/baseConfig.js",
|
|
48
48
|
"dev:lib": "npx eodash dev --entryPoint templates/baseConfig.js --lib",
|
package/templates/expert.js
CHANGED
package/templates/index.js
CHANGED
|
@@ -3,6 +3,8 @@ import { getBaseConfig } from "./baseConfig";
|
|
|
3
3
|
export { default as lite } from "./lite";
|
|
4
4
|
export { default as expert } from "./expert";
|
|
5
5
|
export { default as compare } from "./compare";
|
|
6
|
+
export { default as explore } from "./explore";
|
|
7
|
+
|
|
6
8
|
export { getBaseConfig };
|
|
7
9
|
|
|
8
10
|
export default getBaseConfig;
|
|
@@ -69,6 +69,7 @@
|
|
|
69
69
|
v-if="mapEl && enableSearch"
|
|
70
70
|
:for="mapEl"
|
|
71
71
|
:endpoint="opencageUrl"
|
|
72
|
+
:params="searchParams"
|
|
72
73
|
class="geosearch-detached"
|
|
73
74
|
label="Search"
|
|
74
75
|
small
|
|
@@ -131,6 +132,7 @@ const {
|
|
|
131
132
|
backToPOIs,
|
|
132
133
|
enableSearch,
|
|
133
134
|
enableZoom,
|
|
135
|
+
searchParams,
|
|
134
136
|
} = defineProps({
|
|
135
137
|
exportMap: {
|
|
136
138
|
type: Boolean,
|
|
@@ -157,6 +159,10 @@ const {
|
|
|
157
159
|
type: Boolean,
|
|
158
160
|
default: true,
|
|
159
161
|
},
|
|
162
|
+
searchParams: {
|
|
163
|
+
type: [Boolean, Object],
|
|
164
|
+
default: true,
|
|
165
|
+
},
|
|
160
166
|
enableZoom: {
|
|
161
167
|
type: Boolean,
|
|
162
168
|
default: true,
|
|
@@ -263,11 +269,20 @@ const opencageUrl = `https://api.opencagedata.com/geocode/v1/json?key=${opencage
|
|
|
263
269
|
|
|
264
270
|
<style scoped>
|
|
265
271
|
@import url("@eox/ui/style.css");
|
|
272
|
+
/* Make sure panel does pass click event through */
|
|
273
|
+
.map-buttons {
|
|
274
|
+
pointer-events: none !important;
|
|
275
|
+
}
|
|
266
276
|
|
|
267
277
|
.map-buttons button {
|
|
278
|
+
pointer-events: auto !important;
|
|
268
279
|
margin-bottom: 5px;
|
|
269
280
|
background-color: var(--primary);
|
|
270
281
|
}
|
|
282
|
+
/* Make sure buttons have pointer event */
|
|
283
|
+
.geosearch-detached {
|
|
284
|
+
pointer-events: auto !important;
|
|
285
|
+
}
|
|
271
286
|
|
|
272
287
|
/* Container constraints removal */
|
|
273
288
|
eox-geosearch {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
<span v-if="enableScaleLine" id="scale-line" ref="scale-line" />
|
|
42
42
|
<div
|
|
43
43
|
class="map-buttons-container"
|
|
44
|
-
:style="`margin: ${btnsPosition.gap}px 0 ${btnsPosition.gap}px 0
|
|
44
|
+
:style="`margin: ${btnsPosition.gap}px 0 ${btnsPosition.gap}px 0; top: ${btnsTop}px;`"
|
|
45
45
|
>
|
|
46
46
|
<!-- prettier-ignore -->
|
|
47
47
|
<EodashMapBtns
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
"
|
|
61
61
|
:enableZoom="(indicator || compareIndicator || poi) ? btnsProps.enableZoom : false
|
|
62
62
|
"
|
|
63
|
+
:searchParams="btnsProps.searchParams"
|
|
63
64
|
/>
|
|
64
65
|
</div>
|
|
65
66
|
</span>
|
|
@@ -79,7 +80,7 @@ import {
|
|
|
79
80
|
} from "@/store/states";
|
|
80
81
|
import { storeToRefs } from "pinia";
|
|
81
82
|
import { useSTAcStore } from "@/store/stac";
|
|
82
|
-
import { useDisplay } from "vuetify";
|
|
83
|
+
import { useDisplay, useLayout } from "vuetify";
|
|
83
84
|
import {
|
|
84
85
|
eodashCollections,
|
|
85
86
|
eodashCompareCollections,
|
|
@@ -136,6 +137,7 @@ const props = defineProps({
|
|
|
136
137
|
* enableChangeProjection?: boolean;
|
|
137
138
|
* enableBackToPOIs?: boolean;
|
|
138
139
|
* enableSearch?: boolean;
|
|
140
|
+
* searchParams?: object;
|
|
139
141
|
* enableZoom?: boolean;
|
|
140
142
|
* enableCompareIndicators?: boolean | {
|
|
141
143
|
* compareTemplate?:string;
|
|
@@ -151,6 +153,7 @@ const props = defineProps({
|
|
|
151
153
|
enableBackToPOIs: true,
|
|
152
154
|
enableSearch: true,
|
|
153
155
|
enableZoom: true,
|
|
156
|
+
searchParams: {},
|
|
154
157
|
}),
|
|
155
158
|
},
|
|
156
159
|
});
|
|
@@ -192,6 +195,7 @@ const btnsProps = computed(() => ({
|
|
|
192
195
|
backToPOIs: props.btns.enableBackToPOIs ?? true,
|
|
193
196
|
enableSearch: props.btns.enableSearch ?? true,
|
|
194
197
|
enableZoom: props.btns.enableZoom ?? true,
|
|
198
|
+
searchParams: props.btns.searchParams,
|
|
195
199
|
}));
|
|
196
200
|
|
|
197
201
|
// Prepare containers for scale line and cursor coordinates
|
|
@@ -355,7 +359,10 @@ const tooltipPropertyTransform = (map) => {
|
|
|
355
359
|
param.value = JSON.stringify(param.value);
|
|
356
360
|
}
|
|
357
361
|
if (!isNaN(Number(param.value))) {
|
|
358
|
-
|
|
362
|
+
const decimals = !isNaN(Number(tooltipProp.decimals))
|
|
363
|
+
? Number(tooltipProp.decimals)
|
|
364
|
+
: 4;
|
|
365
|
+
param.value = Number(param.value).toFixed(decimals).toString();
|
|
359
366
|
}
|
|
360
367
|
|
|
361
368
|
return {
|
|
@@ -364,6 +371,13 @@ const tooltipPropertyTransform = (map) => {
|
|
|
364
371
|
};
|
|
365
372
|
};
|
|
366
373
|
};
|
|
374
|
+
const { mainRect } = useLayout();
|
|
375
|
+
const btnsTop = ref(0);
|
|
376
|
+
onMounted(() => {
|
|
377
|
+
const eoDash = document.querySelector("eo-dash");
|
|
378
|
+
btnsTop.value =
|
|
379
|
+
(mainRect.value.top || eoDash?.getBoundingClientRect().top) ?? 0;
|
|
380
|
+
});
|
|
367
381
|
</script>
|
|
368
382
|
|
|
369
383
|
<style scoped>
|
|
@@ -421,7 +435,6 @@ const tooltipPropertyTransform = (map) => {
|
|
|
421
435
|
|
|
422
436
|
.map-buttons-container {
|
|
423
437
|
position: fixed;
|
|
424
|
-
top: 0;
|
|
425
438
|
left: 0;
|
|
426
439
|
width: 100%;
|
|
427
440
|
height: 100%;
|
|
@@ -52,6 +52,29 @@ export const createLayersConfig = async (
|
|
|
52
52
|
dataLayers.layers.push(...layers);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/* check for roles in indicator links to assign visibility property for the data layers */
|
|
56
|
+
if (selectedIndicator?.links) {
|
|
57
|
+
const visibilityLinks = selectedIndicator.links.filter(
|
|
58
|
+
(link) =>
|
|
59
|
+
Array.isArray(link.roles) &&
|
|
60
|
+
(link.roles.includes("disable") || link.roles.includes("hidden")),
|
|
61
|
+
);
|
|
62
|
+
if (visibilityLinks.length > 0) {
|
|
63
|
+
visibilityLinks.forEach((vl) => {
|
|
64
|
+
const targetLayerId = vl.id;
|
|
65
|
+
const targetLayer = dataLayers.layers.find(
|
|
66
|
+
(dl) => dl.properties.id.split(";:;")[0] === targetLayerId,
|
|
67
|
+
);
|
|
68
|
+
if (targetLayer) {
|
|
69
|
+
if (Array.isArray(vl.roles) && vl.roles.includes("disable")) {
|
|
70
|
+
targetLayer.properties.visible = false;
|
|
71
|
+
} else if (Array.isArray(vl.roles) && vl.roles.includes("hidden")) {
|
|
72
|
+
targetLayer.properties.layerControlHide = true;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
55
78
|
layersCollection.push(dataLayers);
|
|
56
79
|
const indicatorLayers =
|
|
57
80
|
//@ts-expect-error indicator is collection
|
|
@@ -155,13 +155,6 @@ export const useInitMap = (
|
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
157
|
|
|
158
|
-
/** @type {Record<string,any>[]} */
|
|
159
|
-
layersCollection = await createLayersConfig(
|
|
160
|
-
updatedStac,
|
|
161
|
-
eodashCols,
|
|
162
|
-
selectedItem ? updatedItem : updatedTime,
|
|
163
|
-
);
|
|
164
|
-
|
|
165
158
|
// We try to set the current time selection to latest extent date
|
|
166
159
|
let endInterval = null;
|
|
167
160
|
const interval = updatedStac?.extent?.temporal?.interval;
|
|
@@ -180,8 +173,17 @@ export const useInitMap = (
|
|
|
180
173
|
!isFirstLoad.value
|
|
181
174
|
) {
|
|
182
175
|
datetime.value = endInterval.toISOString();
|
|
176
|
+
} else if (isFirstLoad.value && !datetime.value && endInterval) {
|
|
177
|
+
datetime.value = endInterval.toISOString();
|
|
183
178
|
}
|
|
184
179
|
|
|
180
|
+
/** @type {Record<string,any>[]} */
|
|
181
|
+
layersCollection = await createLayersConfig(
|
|
182
|
+
updatedStac,
|
|
183
|
+
eodashCols,
|
|
184
|
+
updatedItem ?? updatedTime,
|
|
185
|
+
);
|
|
186
|
+
|
|
185
187
|
if (zoomToExtent) {
|
|
186
188
|
// Try to move map view to extent only when main
|
|
187
189
|
// indicator and map changes
|
|
@@ -20,10 +20,12 @@
|
|
|
20
20
|
<a
|
|
21
21
|
class="processUrl"
|
|
22
22
|
target="_blank"
|
|
23
|
+
v-tooltip="'Process details'"
|
|
23
24
|
:href="getJobStatusUrl(item.jobID, currentIndicator)"
|
|
24
25
|
>{{
|
|
25
26
|
new Date(item.job_start_datetime).toISOString().slice(0, 16)
|
|
26
|
-
}}
|
|
27
|
+
}}
|
|
28
|
+
<v-icon>mdi-open-in-new</v-icon></a
|
|
27
29
|
>
|
|
28
30
|
</td>
|
|
29
31
|
<td>{{ item.status }}</td>
|
|
@@ -71,7 +73,13 @@
|
|
|
71
73
|
</div>
|
|
72
74
|
</template>
|
|
73
75
|
<script setup>
|
|
74
|
-
|
|
76
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
77
|
+
import {
|
|
78
|
+
mdiUploadBox,
|
|
79
|
+
mdiDownloadBox,
|
|
80
|
+
mdiTrashCanOutline,
|
|
81
|
+
mdiOpenInNew,
|
|
82
|
+
} from "@mdi/js";
|
|
75
83
|
import { onMounted, toRef, toRefs } from "vue";
|
|
76
84
|
import { useSTAcStore } from "@/store/stac";
|
|
77
85
|
import { compareIndicator, indicator } from "@/store/states";
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
chartEl,
|
|
60
60
|
compareChartEl,
|
|
61
61
|
} from "@/store/states";
|
|
62
|
-
import { download } from "./methods/utils";
|
|
62
|
+
import { download, getDrawToolsProperty } from "./methods/utils";
|
|
63
63
|
import { compareJobs, jobs } from "./states";
|
|
64
64
|
import { mdiCogPlayOutline, mdiDownloadCircleOutline } from "@mdi/js";
|
|
65
65
|
|
|
@@ -155,14 +155,6 @@ const downloadResults = () => {
|
|
|
155
155
|
};
|
|
156
156
|
|
|
157
157
|
const startProcess = async () => {
|
|
158
|
-
/** @param {*} jsonformSchema */
|
|
159
|
-
const getDrawToolsProperty = (jsonformSchema) => {
|
|
160
|
-
for (const property in jsonformSchema.properties) {
|
|
161
|
-
if (jsonformSchema.properties[property]?.options?.drawtools) {
|
|
162
|
-
return property;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
};
|
|
166
158
|
const drawToolsProperty = getDrawToolsProperty(jsonformSchema.value);
|
|
167
159
|
const propertyIsEmpty =
|
|
168
160
|
drawToolsProperty &&
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { initProcess } from "./handling";
|
|
1
|
+
import { initProcess, updateJsonformIdentifier } from "./handling";
|
|
2
2
|
import { useEventBus } from "@vueuse/core";
|
|
3
3
|
import { nextTick, onMounted, watch } from "vue";
|
|
4
4
|
import { eoxLayersKey } from "@/utils/keys";
|
|
@@ -67,6 +67,18 @@ export const useInitProcess = ({
|
|
|
67
67
|
const evtKey =
|
|
68
68
|
mapElement?.id === "compare" ? "compareLayers:updated" : "layers:updated";
|
|
69
69
|
useOnLayersUpdate(async (evt, _payload) => {
|
|
70
|
+
if (
|
|
71
|
+
evt == "layertime:updated" ||
|
|
72
|
+
evt == "compareLayertime:updated" ||
|
|
73
|
+
evt == "time:updated" ||
|
|
74
|
+
evt == "compareTime:updated"
|
|
75
|
+
) {
|
|
76
|
+
await updateJsonformIdentifier({
|
|
77
|
+
jsonformSchema,
|
|
78
|
+
// @ts-expect-error TODO payload coming from time update events is not an object with layers property
|
|
79
|
+
newLayers: _payload,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
70
82
|
if (evt !== evtKey) {
|
|
71
83
|
return;
|
|
72
84
|
}
|
|
@@ -19,7 +19,7 @@ export async function handleVedaEndpoint({
|
|
|
19
19
|
enableCompare = false,
|
|
20
20
|
}) {
|
|
21
21
|
const vedaLink = links.find(
|
|
22
|
-
(link) => link.rel === "service" && link.endpoint === "veda",
|
|
22
|
+
(link) => link.rel === "service" && (link.endpoint === "veda" || link.endpoint === "veda_stac"),
|
|
23
23
|
);
|
|
24
24
|
if (!vedaLink) {
|
|
25
25
|
return;
|
|
@@ -32,12 +32,17 @@ export async function handleVedaEndpoint({
|
|
|
32
32
|
const configs = await fetchVedaCOGsConfig(
|
|
33
33
|
selectedStac,
|
|
34
34
|
enableCompare ? currentCompareUrl.value : currentUrl.value,
|
|
35
|
+
vedaLink,
|
|
35
36
|
);
|
|
36
37
|
// TODO: convert jsonform bbox type to geojson in the schema to avoid the conversion here
|
|
37
38
|
return await Promise.all(
|
|
38
39
|
configs.map(({ endpoint, datetime }) => {
|
|
40
|
+
const url = new URL(vedaEndpoint);
|
|
41
|
+
const key = vedaLink.endpoint === "veda_stac" ? "ids" : "url";
|
|
42
|
+
url.searchParams.set(key, endpoint);
|
|
43
|
+
|
|
39
44
|
return axios
|
|
40
|
-
.post(
|
|
45
|
+
.post(url.toString(), {
|
|
41
46
|
...{
|
|
42
47
|
type: "Feature",
|
|
43
48
|
properties: {},
|
|
@@ -63,8 +68,9 @@ export async function handleVedaEndpoint({
|
|
|
63
68
|
* Fetches the COGs endpoints from the STAC collections
|
|
64
69
|
* @param {import("stac-ts").StacCollection} selectedStac
|
|
65
70
|
* @param {string} absoluteUrl
|
|
71
|
+
* @param {import("stac-ts").StacLink} vedaLink
|
|
66
72
|
*/
|
|
67
|
-
async function fetchVedaCOGsConfig(selectedStac, absoluteUrl) {
|
|
73
|
+
async function fetchVedaCOGsConfig(selectedStac, absoluteUrl, vedaLink) {
|
|
68
74
|
// retrieve the collections from the indicator
|
|
69
75
|
const collectionLinks = selectedStac.links.filter(
|
|
70
76
|
(link) => link.rel == "child",
|
|
@@ -110,10 +116,13 @@ async function fetchVedaCOGsConfig(selectedStac, absoluteUrl) {
|
|
|
110
116
|
);
|
|
111
117
|
const itemLinks = collection.links.filter((link) => link.rel == "item");
|
|
112
118
|
configs.push(
|
|
113
|
-
...itemLinks.map((link) =>
|
|
114
|
-
endpoint
|
|
119
|
+
...itemLinks.map((link) => {
|
|
120
|
+
const endpoint = /** @type {string} */ (vedaLink.endpoint === "veda_stac" ? link.id : link["cog_href"]);
|
|
121
|
+
return {
|
|
122
|
+
endpoint,
|
|
115
123
|
datetime: /** @type string **/ (link[datetimeProperty]),
|
|
116
|
-
}
|
|
124
|
+
}
|
|
125
|
+
})
|
|
117
126
|
);
|
|
118
127
|
}
|
|
119
128
|
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
applyProcessLayersToMap,
|
|
4
4
|
extractGeometries,
|
|
5
5
|
getBboxProperty,
|
|
6
|
+
getDrawToolsProperty,
|
|
6
7
|
updateJsonformSchemaTarget,
|
|
7
8
|
} from "./utils";
|
|
8
9
|
import {
|
|
@@ -18,6 +19,7 @@ import { handleLayersCustomEndpoints } from "./custom-endpoints/layers";
|
|
|
18
19
|
import { handleChartCustomEndpoints } from "./custom-endpoints/chart";
|
|
19
20
|
import { useSTAcStore } from "@/store/stac";
|
|
20
21
|
import { useGetSubCodeId } from "@/composables";
|
|
22
|
+
import { getLayers } from "@/store/actions";
|
|
21
23
|
|
|
22
24
|
/**
|
|
23
25
|
* Fetch and set the jsonform schema to initialize the process
|
|
@@ -70,6 +72,13 @@ export async function initProcess({
|
|
|
70
72
|
|
|
71
73
|
await jsonformEl.value?.editor.destroy();
|
|
72
74
|
if (updatedJsonform) {
|
|
75
|
+
// make sure correct target layer id is used in jsonform
|
|
76
|
+
if (updatedJsonform.properties?.feature?.options?.drawtools?.layerId) {
|
|
77
|
+
await updateJsonformIdentifier({
|
|
78
|
+
jsonformSchema,
|
|
79
|
+
newLayers: await getLayers(),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
73
82
|
if (enableCompare) {
|
|
74
83
|
updatedJsonform = updateJsonformSchemaTarget(updatedJsonform);
|
|
75
84
|
}
|
|
@@ -77,6 +86,74 @@ export async function initProcess({
|
|
|
77
86
|
}
|
|
78
87
|
}
|
|
79
88
|
|
|
89
|
+
/**
|
|
90
|
+
* Update the jsonform schema to have the correct layer id from the map
|
|
91
|
+
*
|
|
92
|
+
* @export
|
|
93
|
+
* @async
|
|
94
|
+
* @param {Object} params
|
|
95
|
+
* @param {import("vue").Ref<Record<string,any> | null>} params.jsonformSchema params.jsonformSchema
|
|
96
|
+
* @param {Record<string, any>[] | undefined} params.newLayers params.newLayers
|
|
97
|
+
*/
|
|
98
|
+
export async function updateJsonformIdentifier({ jsonformSchema, newLayers }) {
|
|
99
|
+
const form = jsonformSchema.value;
|
|
100
|
+
if (!form) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const drawToolsProperty = getDrawToolsProperty(form);
|
|
104
|
+
if (
|
|
105
|
+
drawToolsProperty &&
|
|
106
|
+
newLayers &&
|
|
107
|
+
form?.properties[drawToolsProperty]?.options?.drawtools?.layerId
|
|
108
|
+
) {
|
|
109
|
+
// get partial or full id and try to match with correct eoxmap layer
|
|
110
|
+
// check if newLayers is an array or an object with layers property
|
|
111
|
+
let layers = newLayers;
|
|
112
|
+
// @ts-expect-error TODO payload coming from time update sometimes is not an object with layers property
|
|
113
|
+
if (newLayers.layers && Array.isArray(newLayers.layers)) {
|
|
114
|
+
// @ts-expect-error TODO payload coming from time update sometimes is not an object with layers property
|
|
115
|
+
layers = newLayers.layers;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const layerId =
|
|
119
|
+
form.properties[drawToolsProperty].options.drawtools.layerId.split(
|
|
120
|
+
";:;",
|
|
121
|
+
)[0];
|
|
122
|
+
let matchedLayerId = null;
|
|
123
|
+
// layers are not flat can be grouped, we need to recursively search
|
|
124
|
+
const traverseLayers = (
|
|
125
|
+
/** @type {Record<string, any>[] | undefined} */ layersArray,
|
|
126
|
+
) => {
|
|
127
|
+
if (!layersArray) {
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
for (const layer of layersArray) {
|
|
131
|
+
if (layer.layers) {
|
|
132
|
+
// @ts-expect-error TODO payload coming from time update events is not an object with layers property
|
|
133
|
+
traverseLayers(layer);
|
|
134
|
+
} else {
|
|
135
|
+
if (layer.properties?.id?.startsWith(layerId)) {
|
|
136
|
+
matchedLayerId = layer.properties.id;
|
|
137
|
+
break;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
traverseLayers(layers);
|
|
143
|
+
if (matchedLayerId) {
|
|
144
|
+
form.properties.feature.options.drawtools.layerId = matchedLayerId;
|
|
145
|
+
// trigger jsonform update in next tick
|
|
146
|
+
jsonformSchema.value = null;
|
|
147
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
148
|
+
jsonformSchema.value = form;
|
|
149
|
+
} else {
|
|
150
|
+
throw new Error(
|
|
151
|
+
`Could not find matching layer for processing form with id: ${layerId}`,
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
80
157
|
/**
|
|
81
158
|
*
|
|
82
159
|
* @param {object} params
|
|
@@ -508,6 +508,16 @@ export function extractAsyncResults(resultItem) {
|
|
|
508
508
|
}
|
|
509
509
|
return extracted;
|
|
510
510
|
}
|
|
511
|
+
|
|
512
|
+
/** @param {*} jsonformSchema */
|
|
513
|
+
export const getDrawToolsProperty = (jsonformSchema) => {
|
|
514
|
+
for (const property in jsonformSchema.properties) {
|
|
515
|
+
if (jsonformSchema.properties[property]?.options?.drawtools) {
|
|
516
|
+
return property;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
|
|
511
521
|
/**
|
|
512
522
|
* @param {import("@eox/map").EOxMap | null} mapElement
|
|
513
523
|
* @param {import("@eox/map").EoxLayer[]} processLayers
|