@eodash/eodash 5.0.0-rc.3 → 5.1.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/README.md +1 -0
- package/core/client/App.vue +8 -2
- package/core/client/asWebComponent.js +5 -5
- package/core/client/components/DashboardLayout.vue +42 -25
- package/core/client/components/EodashOverlay.vue +1 -1
- package/core/client/components/ErrorAlert.vue +2 -2
- package/core/client/components/Footer.vue +4 -4
- package/core/client/components/Header.vue +3 -3
- package/core/client/components/MobileLayout.vue +9 -10
- package/core/client/composables/DefineEodash.js +38 -43
- package/core/client/composables/DefineTemplate.js +4 -2
- package/core/client/composables/DefineWidgets.js +14 -8
- package/core/client/composables/index.js +273 -23
- package/core/client/eodashSTAC/EodashCollection.js +80 -47
- package/core/client/eodashSTAC/helpers.js +136 -27
- package/core/client/eodashSTAC/parquet.js +145 -0
- package/core/client/eodashSTAC/triggers.js +6 -3
- package/core/client/plugins/index.js +4 -3
- package/core/client/plugins/vuetify.js +3 -0
- package/core/client/store/actions.js +21 -4
- package/core/client/store/stac.js +93 -56
- package/core/client/store/states.js +15 -5
- package/core/client/types.ts +59 -43
- package/core/client/utils/index.js +79 -0
- package/core/client/utils/keys.js +2 -2
- package/core/client/utils/states.js +30 -5
- package/core/client/views/Dashboard.vue +36 -32
- package/core/client/vite-env.d.ts +7 -0
- package/dist/client/{DashboardLayout-t_PavJPO.js → DashboardLayout-ByVs1DrY.js} +23 -12
- package/dist/client/{DynamicWebComponent-y07rVJch.js → DynamicWebComponent-C3W7HSQm.js} +1 -1
- package/dist/client/{EodashDatePicker-CcOfyzGD.js → EodashDatePicker-BIAf1sMT.js} +59 -32
- package/dist/client/{EodashItemFilter-B9HCvIMi.js → EodashItemFilter-DPznh8UB.js} +20 -10
- package/dist/client/{EodashLayerControl-KStn7Nb_.js → EodashLayerControl-Bhxjw4V2.js} +29 -16
- package/dist/client/EodashLayoutSwitcher-C5qTEffW.js +61 -0
- package/dist/client/EodashMapBtns-WoGq8MuV.js +173 -0
- package/dist/client/{EodashStacInfo-C_hDy6Pd.js → EodashStacInfo-CSvvF2jI.js} +3 -18
- package/dist/client/{EodashTools-BXflvRf8.js → EodashTools-Cv1SXQ5y.js} +13 -13
- package/dist/client/{ExportState-C0QRemK1.js → ExportState-D-iuwaad.js} +58 -52
- package/dist/client/{Footer-7VGyGUAs.js → Footer-CyF0zRAk.js} +15 -13
- package/dist/client/{Header-BQJnXHYq.js → Header-CgD8jDKU.js} +33 -28
- package/dist/client/{MobileLayout-b8nQ-Vyl.js → MobileLayout-EKQ_kpSh.js} +69 -60
- package/dist/client/{PopUp-DgNrh9Df.js → PopUp-BsYLvWch.js} +19 -10
- package/dist/client/ProcessList-C2xsLU2_.js +191 -0
- package/dist/client/{VImg-D4eT3IQ1.js → VImg-OHe8YTs2.js} +24 -24
- package/dist/client/{VMain-C3hN2-H3.js → VMain-PryTLU4a.js} +7 -7
- package/dist/client/{VOverlay-tAeNygaA.js → VOverlay-yUn7p-Uf.js} +64 -27
- package/dist/client/{VTooltip-B0Q3iHMZ.js → VTooltip-DZ0fjpB3.js} +13 -10
- package/dist/client/{WidgetsContainer-CtDHfCYf.js → WidgetsContainer-B9LBadcC.js} +1 -1
- package/dist/client/asWebComponent-By_7_JjS.js +19193 -0
- package/dist/client/async-DkSu_u2K.js +740 -0
- package/dist/client/eo-dash.js +1 -1
- package/dist/client/{forwardRefs-CIFAqXaZ.js → forwardRefs-BXxrv98s.js} +31 -4
- package/dist/client/handling-CgmFXkW6.js +1212 -0
- package/dist/client/helpers-Dy0Q13tP.js +4534 -0
- package/dist/client/{index-DvcUndod.js → index-BuhOHXKv.js} +2 -4
- package/dist/client/{index-BQ16n4Sk.js → index-Ch_HchK3.js} +39 -32
- package/dist/client/{index-Cv7HBz49.js → index-Dqj4tbx2.js} +2 -2
- package/dist/client/index-skjhlH8u.js +376 -0
- package/dist/client/{ssrBoot-BP7SYRyC.js → ssrBoot-Zgc_Ttvi.js} +2 -2
- package/dist/client/templates.js +850 -0
- package/dist/client/transition-C98Yn4Vo.js +40 -0
- package/dist/node/cli.js +16 -6
- package/dist/node/types.d.ts +1 -1
- package/dist/types/core/client/App.vue.d.ts +2 -2
- package/dist/types/core/client/asWebComponent.d.ts +1 -1
- package/dist/types/core/client/components/DynamicWebComponent.vue.d.ts +1 -3
- package/dist/types/core/client/components/Footer.vue.d.ts +1 -105
- package/dist/types/core/client/components/IframeWrapper.vue.d.ts +1 -1
- package/dist/types/core/client/components/MobileLayout.vue.d.ts +1 -324
- package/dist/types/core/client/composables/DefineEodash.d.ts +2 -2
- package/dist/types/core/client/composables/DefineTemplate.d.ts +1 -1
- package/dist/types/core/client/composables/DefineWidgets.d.ts +4 -4
- package/dist/types/core/client/composables/index.d.ts +24 -2
- package/dist/types/core/client/eodashSTAC/EodashCollection.d.ts +9 -6
- package/dist/types/core/client/eodashSTAC/helpers.d.ts +20 -5
- package/dist/types/core/client/eodashSTAC/parquet.d.ts +2 -0
- package/dist/types/core/client/plugins/vuetify.d.ts +7 -4
- package/dist/types/core/client/store/actions.d.ts +3 -2
- package/dist/types/core/client/store/stac.d.ts +16 -13
- package/dist/types/core/client/store/states.d.ts +14 -4
- package/dist/types/core/client/types.d.ts +45 -30
- package/dist/types/core/client/utils/index.d.ts +2 -0
- package/dist/types/core/client/utils/keys.d.ts +4 -4
- package/dist/types/core/client/utils/states.d.ts +59 -47
- package/dist/types/core/client/views/Dashboard.vue.d.ts +2 -2
- package/dist/types/templates/baseConfig.d.ts +4 -0
- package/dist/types/templates/compare.d.ts +210 -0
- package/dist/types/templates/expert.d.ts +151 -0
- package/dist/types/templates/index.d.ts +6 -0
- package/dist/types/templates/light.d.ts +145 -0
- package/dist/types/widgets/EodashDatePicker.vue.d.ts +1 -458
- package/dist/types/widgets/EodashItemFilter.vue.d.ts +3 -3
- package/dist/types/widgets/EodashLayerControl.vue.d.ts +14 -7
- package/dist/types/widgets/EodashLayoutSwitcher.vue.d.ts +1 -3
- package/dist/types/widgets/EodashMap/index.vue.d.ts +1 -4
- package/dist/types/widgets/EodashMapBtns.vue.d.ts +8 -8
- package/dist/types/widgets/EodashProcess/ProcessList.vue.d.ts +8 -1
- package/dist/types/widgets/EodashProcess/index.vue.d.ts +8 -4
- package/dist/types/widgets/EodashProcess/methods/async.d.ts +18 -18
- package/dist/types/widgets/EodashProcess/methods/composables.d.ts +3 -2
- package/dist/types/widgets/EodashProcess/methods/custom-endpoints/chart/index.d.ts +1 -0
- package/dist/types/widgets/EodashProcess/methods/custom-endpoints/chart/sentinelhub-endpoint.d.ts +6 -0
- package/dist/types/widgets/EodashProcess/methods/custom-endpoints/chart/veda-endpoint.d.ts +4 -0
- package/dist/types/widgets/EodashProcess/methods/custom-endpoints/layers/eoxhub-workspaces-endpoint.d.ts +5 -0
- package/dist/types/widgets/EodashProcess/methods/custom-endpoints/layers/index.d.ts +1 -0
- package/dist/types/widgets/EodashProcess/methods/handling.d.ts +12 -5
- package/dist/types/widgets/EodashProcess/methods/outputs.d.ts +72 -41
- package/dist/types/widgets/EodashProcess/methods/utils.d.ts +41 -21
- package/dist/types/widgets/EodashProcess/states.d.ts +11 -0
- package/dist/types/widgets/EodashProcess/types.d.ts +41 -0
- package/dist/types/widgets/EodashStacInfo.vue.d.ts +14 -14
- package/dist/types/widgets/EodashTools.vue.d.ts +3 -3
- package/dist/types/widgets/ExportState.vue.d.ts +1 -1
- package/dist/types/widgets/PopUp.vue.d.ts +11 -16
- package/dist/types/widgets/WidgetsContainer.vue.d.ts +3 -6
- package/package.json +53 -45
- package/templates/baseConfig.js +68 -0
- package/templates/compare.js +162 -0
- package/templates/expert.js +123 -0
- package/templates/index.js +8 -0
- package/templates/light.js +130 -0
- package/widgets/EodashDatePicker.vue +80 -31
- package/widgets/EodashItemFilter.vue +26 -11
- package/widgets/EodashLayerControl.vue +20 -11
- package/widgets/EodashLayoutSwitcher.vue +6 -3
- package/widgets/EodashMap/index.vue +3 -8
- package/widgets/EodashMap/methods/create-layers-config.js +4 -3
- package/widgets/EodashMap/methods/index.js +33 -23
- package/widgets/EodashMapBtns.vue +83 -41
- package/widgets/EodashProcess/ProcessList.vue +34 -10
- package/widgets/EodashProcess/index.vue +55 -20
- package/widgets/EodashProcess/methods/async.js +77 -59
- package/widgets/EodashProcess/methods/composables.js +21 -14
- package/widgets/EodashProcess/methods/custom-endpoints/chart/index.js +35 -0
- package/widgets/EodashProcess/methods/custom-endpoints/chart/sentinelhub-endpoint.js +275 -0
- package/widgets/EodashProcess/methods/custom-endpoints/chart/veda-endpoint.js +116 -0
- package/widgets/EodashProcess/methods/custom-endpoints/layers/eoxhub-workspaces-endpoint.js +94 -0
- package/widgets/EodashProcess/methods/custom-endpoints/layers/index.js +33 -0
- package/widgets/EodashProcess/methods/handling.js +127 -80
- package/widgets/EodashProcess/methods/outputs.js +376 -125
- package/widgets/EodashProcess/methods/utils.js +398 -10
- package/widgets/EodashProcess/states.js +13 -0
- package/widgets/EodashProcess/types.ts +46 -0
- package/widgets/EodashStacInfo.vue +2 -17
- package/widgets/EodashTools.vue +13 -13
- package/widgets/WidgetsContainer.vue +1 -1
- package/core/client/eodash.js +0 -454
- package/dist/client/EodashLayoutSwitcher-DqeFO3RN.js +0 -52
- package/dist/client/EodashMapBtns-5BF27qJB.js +0 -131
- package/dist/client/ProcessList-C62SOVO6.js +0 -484
- package/dist/client/asWebComponent-BJ2NWunV.js +0 -12479
- package/dist/client/eo-dash.css +0 -5
- package/dist/client/index-Da5xXX6Q.js +0 -780
- package/dist/client/transition-Cdb4K27U.js +0 -37
- package/dist/types/core/client/eodash.d.ts +0 -8
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
import log from "loglevel";
|
|
2
|
-
import { extractGeometries, getBboxProperty } from "./utils";
|
|
3
|
-
import { datetime, mapEl } from "@/store/states";
|
|
4
|
-
import axios from "@/plugins/axios";
|
|
5
|
-
import { getLayers } from "@/store/actions";
|
|
6
2
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "./
|
|
3
|
+
applyProcessLayersToMap,
|
|
4
|
+
extractGeometries,
|
|
5
|
+
getBboxProperty,
|
|
6
|
+
updateJsonformSchemaTarget,
|
|
7
|
+
} from "./utils";
|
|
8
|
+
import {
|
|
9
|
+
compareIndicator,
|
|
10
|
+
comparePoi,
|
|
11
|
+
datetime,
|
|
12
|
+
indicator,
|
|
13
|
+
poi,
|
|
14
|
+
} from "@/store/states";
|
|
15
|
+
import axios from "@/plugins/axios";
|
|
16
|
+
import { processCharts, processLayers, processSTAC } from "./outputs";
|
|
17
|
+
import { handleLayersCustomEndpoints } from "./custom-endpoints/layers";
|
|
18
|
+
import { handleChartCustomEndpoints } from "./custom-endpoints/chart";
|
|
19
|
+
import { useSTAcStore } from "@/store/stac";
|
|
20
|
+
import { useGetSubCodeId } from "@/composables";
|
|
12
21
|
|
|
13
22
|
/**
|
|
14
23
|
* Fetch and set the jsonform schema to initialize the process
|
|
@@ -16,7 +25,7 @@ import {
|
|
|
16
25
|
* @export
|
|
17
26
|
* @async
|
|
18
27
|
* @param {Object} params
|
|
19
|
-
* @param {import("vue").Ref<import("stac-ts").StacCollection>} params.selectedStac
|
|
28
|
+
* @param {import("vue").Ref<import("stac-ts").StacCollection | null>} params.selectedStac
|
|
20
29
|
* @param {import("vue").Ref<import("@eox/jsonform").EOxJSONForm | null>} params.jsonformEl
|
|
21
30
|
* @param {import("vue").Ref<Record<string,any> | null>} params.jsonformSchema
|
|
22
31
|
* @param {import("vue").Ref<import("@eox/chart").EOxChart["spec"] | null>} params.chartSpec
|
|
@@ -24,6 +33,7 @@ import {
|
|
|
24
33
|
* @param {import("vue").Ref<boolean>} params.isProcessed
|
|
25
34
|
* @param {import("vue").Ref<boolean>} params.loading
|
|
26
35
|
* @param {import("vue").Ref<boolean>} params.isPolling
|
|
36
|
+
* @param {boolean} params.enableCompare
|
|
27
37
|
*/
|
|
28
38
|
export async function initProcess({
|
|
29
39
|
selectedStac,
|
|
@@ -34,8 +44,19 @@ export async function initProcess({
|
|
|
34
44
|
processResults,
|
|
35
45
|
loading,
|
|
36
46
|
isPolling,
|
|
47
|
+
enableCompare,
|
|
37
48
|
}) {
|
|
38
|
-
|
|
49
|
+
const isPoiAlive = enableCompare ? !!comparePoi.value : !!poi.value;
|
|
50
|
+
let updatedJsonform = null;
|
|
51
|
+
if (selectedStac.value?.["eodash:jsonform"]) {
|
|
52
|
+
updatedJsonform = await axios
|
|
53
|
+
//@ts-expect-error eodash extention
|
|
54
|
+
.get(selectedStac.value["eodash:jsonform"])
|
|
55
|
+
.then((resp) => resp.data);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (!updatedJsonform && isPoiAlive) {
|
|
59
|
+
jsonformSchema.value = null;
|
|
39
60
|
return;
|
|
40
61
|
}
|
|
41
62
|
resetProcess({
|
|
@@ -46,25 +67,19 @@ export async function initProcess({
|
|
|
46
67
|
isPolling,
|
|
47
68
|
processResults,
|
|
48
69
|
});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
.get(selectedStac.value["eodash:jsonform"])
|
|
55
|
-
.then((resp) => resp.data);
|
|
56
|
-
// remove borders from jsonform
|
|
57
|
-
} else {
|
|
58
|
-
if (!jsonformSchema.value) {
|
|
59
|
-
return;
|
|
70
|
+
|
|
71
|
+
await jsonformEl.value?.editor.destroy();
|
|
72
|
+
if (updatedJsonform) {
|
|
73
|
+
if (enableCompare) {
|
|
74
|
+
updatedJsonform = updateJsonformSchemaTarget(updatedJsonform);
|
|
60
75
|
}
|
|
61
|
-
jsonformSchema.value =
|
|
76
|
+
jsonformSchema.value = updatedJsonform;
|
|
62
77
|
}
|
|
63
78
|
}
|
|
64
79
|
|
|
65
80
|
/**
|
|
66
81
|
*
|
|
67
|
-
* @param {
|
|
82
|
+
* @param {object} params
|
|
68
83
|
* @param {import("vue").Ref<boolean>} params.loading
|
|
69
84
|
* @param {import("vue").Ref<import("stac-ts").StacCollection | null>} params.selectedStac
|
|
70
85
|
* @param {import("vue").Ref<import("@eox/jsonform").EOxJSONForm | null>} params.jsonformEl
|
|
@@ -73,6 +88,8 @@ export async function initProcess({
|
|
|
73
88
|
* @param {import("vue").Ref<Record<string, any> | null>} params.chartData
|
|
74
89
|
* @param {import("vue").Ref<boolean>} params.isPolling
|
|
75
90
|
* @param {import("vue").Ref<any[]>} params.processResults
|
|
91
|
+
* @param {import("@eox/map").EOxMap | null} params.mapElement
|
|
92
|
+
* @param {import("vue").Ref<import("../types").AsyncJob[]>} params.jobs
|
|
76
93
|
*/
|
|
77
94
|
export async function handleProcesses({
|
|
78
95
|
loading,
|
|
@@ -83,16 +100,20 @@ export async function handleProcesses({
|
|
|
83
100
|
chartData,
|
|
84
101
|
isPolling,
|
|
85
102
|
processResults,
|
|
103
|
+
mapElement,
|
|
104
|
+
jobs,
|
|
86
105
|
}) {
|
|
87
106
|
if (!jsonformEl.value || !jsonformSchema.value || !selectedStac.value) {
|
|
88
107
|
return;
|
|
89
108
|
}
|
|
109
|
+
|
|
90
110
|
log.debug("Processing...");
|
|
91
111
|
loading.value = true;
|
|
92
112
|
try {
|
|
93
113
|
const serviceLinks = selectedStac.value?.links?.filter(
|
|
94
114
|
(l) => l.rel === "service",
|
|
95
115
|
);
|
|
116
|
+
|
|
96
117
|
const bboxProperty = getBboxProperty(jsonformSchema.value);
|
|
97
118
|
const jsonformValue = /** @type {Record<string,any>} */ (
|
|
98
119
|
jsonformEl.value?.value
|
|
@@ -105,12 +126,20 @@ export async function handleProcesses({
|
|
|
105
126
|
const specUrl = /** @type {string} */ (
|
|
106
127
|
selectedStac.value?.["eodash:vegadefinition"]
|
|
107
128
|
);
|
|
129
|
+
const layerId = selectedStac.value?.id ?? "";
|
|
108
130
|
|
|
109
|
-
[chartSpec.value, chartData.value] = await
|
|
110
|
-
serviceLinks,
|
|
111
|
-
{ ...(jsonformValue ?? {}) },
|
|
131
|
+
[chartSpec.value, chartData.value] = await processCharts({
|
|
132
|
+
links: serviceLinks,
|
|
133
|
+
jsonformValue: { ...(jsonformValue ?? {}) },
|
|
134
|
+
jsonformSchema: jsonformSchema.value,
|
|
135
|
+
enableCompare: mapElement?.id === "compare",
|
|
136
|
+
selectedStac: selectedStac.value,
|
|
112
137
|
specUrl,
|
|
113
|
-
|
|
138
|
+
isPolling,
|
|
139
|
+
jobs,
|
|
140
|
+
customEndpointsHandler: handleChartCustomEndpoints,
|
|
141
|
+
});
|
|
142
|
+
|
|
114
143
|
if (Object.keys(chartData.value ?? {}).length) {
|
|
115
144
|
processResults.value.push(chartData.value);
|
|
116
145
|
}
|
|
@@ -125,63 +154,40 @@ export async function handleProcesses({
|
|
|
125
154
|
chartSpec.value["background"] = "transparent";
|
|
126
155
|
}
|
|
127
156
|
|
|
128
|
-
|
|
157
|
+
await processSTAC(
|
|
129
158
|
serviceLinks,
|
|
130
159
|
jsonformValue,
|
|
131
|
-
|
|
132
|
-
isPolling,
|
|
133
|
-
//@ts-expect-error TODO
|
|
134
|
-
selectedStac.value?.["eodash:mapProjection"]?.["name"] ?? null,
|
|
160
|
+
mapElement?.id === "compare",
|
|
135
161
|
);
|
|
136
162
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const imageLayers = processImage(serviceLinks, jsonformValue, origBbox);
|
|
156
|
-
if (imageLayers?.length) {
|
|
157
|
-
processResults.value.push(
|
|
158
|
-
...imageLayers.map((layer) => layer.source?.url),
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
log.debug(
|
|
163
|
-
"rendered layers after processing:",
|
|
164
|
-
geotiffLayer,
|
|
165
|
-
vectorLayers,
|
|
166
|
-
imageLayers,
|
|
167
|
-
);
|
|
168
|
-
|
|
169
|
-
if (geotiffLayer || vectorLayers?.length || imageLayers?.length) {
|
|
170
|
-
const layers = [
|
|
171
|
-
...(geotiffLayer ? [geotiffLayer] : []),
|
|
172
|
-
...(vectorLayers ?? []),
|
|
173
|
-
...(imageLayers ?? []),
|
|
174
|
-
];
|
|
175
|
-
let currentLayers = [...getLayers()];
|
|
176
|
-
let analysisGroup = currentLayers.find((l) =>
|
|
177
|
-
l.properties.id.includes("AnalysisGroup"),
|
|
178
|
-
);
|
|
179
|
-
analysisGroup?.layers.push(...layers);
|
|
163
|
+
const newLayers = await processLayers({
|
|
164
|
+
isPolling,
|
|
165
|
+
links: serviceLinks,
|
|
166
|
+
jsonformValue: { ...(jsonformValue ?? {}) },
|
|
167
|
+
jsonformSchema: jsonformSchema.value,
|
|
168
|
+
selectedStac: selectedStac.value,
|
|
169
|
+
enableCompare: mapElement?.id === "compare",
|
|
170
|
+
layerId,
|
|
171
|
+
origBbox,
|
|
172
|
+
jobs,
|
|
173
|
+
customLayersHandler: handleLayersCustomEndpoints,
|
|
174
|
+
projection: /** @type {{name?:string}} */ (
|
|
175
|
+
selectedStac.value["eodash:mapProjection"]
|
|
176
|
+
)?.["name"],
|
|
177
|
+
});
|
|
180
178
|
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
// save layers results
|
|
180
|
+
if (newLayers.length) {
|
|
181
|
+
for (const layer of newLayers) {
|
|
182
|
+
if (layer.type === "WebGLTile" && layer.source?.type === "GeoTIFF") {
|
|
183
|
+
processResults.value.push(...(layer.source.sources ?? []));
|
|
184
|
+
} else if (layer.source && "url" in layer.source) {
|
|
185
|
+
processResults.value.push(layer.source.url);
|
|
186
|
+
}
|
|
183
187
|
}
|
|
184
188
|
}
|
|
189
|
+
|
|
190
|
+
applyProcessLayersToMap(mapElement, newLayers);
|
|
185
191
|
loading.value = false;
|
|
186
192
|
} catch (error) {
|
|
187
193
|
console.error("[eodash] Error while running process:", error);
|
|
@@ -228,7 +234,11 @@ export function resetProcess({
|
|
|
228
234
|
*/
|
|
229
235
|
export const onChartClick = (evt) => {
|
|
230
236
|
const chartSpec = evt.target?.spec;
|
|
231
|
-
if (
|
|
237
|
+
if (
|
|
238
|
+
!chartSpec ||
|
|
239
|
+
!evt.detail?.item?.datum ||
|
|
240
|
+
!evt.detail?.item?.datum.datum
|
|
241
|
+
) {
|
|
232
242
|
return;
|
|
233
243
|
}
|
|
234
244
|
const encodingKey = Object.keys(chartSpec.encoding ?? {}).find(
|
|
@@ -241,9 +251,19 @@ export const onChartClick = (evt) => {
|
|
|
241
251
|
if (!temporalKey) {
|
|
242
252
|
return;
|
|
243
253
|
}
|
|
254
|
+
|
|
244
255
|
try {
|
|
245
256
|
const vegaItem = evt.detail.item;
|
|
246
|
-
|
|
257
|
+
let datestring = "";
|
|
258
|
+
// It seems sometimes we have datum inside datum and sometimes not
|
|
259
|
+
if (vegaItem.datum && vegaItem.datum.datum) {
|
|
260
|
+
// If datum is nested, we use the nested datum
|
|
261
|
+
datestring = vegaItem.datum.datum[temporalKey];
|
|
262
|
+
} else {
|
|
263
|
+
// Otherwise, we use the top-level datum
|
|
264
|
+
datestring = vegaItem.datum[temporalKey];
|
|
265
|
+
}
|
|
266
|
+
const temporalValue = new Date(datestring);
|
|
247
267
|
datetime.value = temporalValue.toISOString();
|
|
248
268
|
} catch (error) {
|
|
249
269
|
console.warn(
|
|
@@ -252,3 +272,30 @@ export const onChartClick = (evt) => {
|
|
|
252
272
|
);
|
|
253
273
|
}
|
|
254
274
|
};
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Loads the main indicator of a Point of Interest (POI)
|
|
278
|
+
*/
|
|
279
|
+
export const loadPOiIndicator = () => {
|
|
280
|
+
if (!indicator.value) {
|
|
281
|
+
indicator.value =
|
|
282
|
+
new URLSearchParams(window.location.search).get("indicator") ?? "";
|
|
283
|
+
}
|
|
284
|
+
const stacStore = useSTAcStore();
|
|
285
|
+
const link = stacStore.stac?.find(
|
|
286
|
+
(link) => useGetSubCodeId(link) === indicator.value,
|
|
287
|
+
);
|
|
288
|
+
stacStore.loadSelectedSTAC(link?.href);
|
|
289
|
+
if (comparePoi.value) {
|
|
290
|
+
if (compareIndicator.value) {
|
|
291
|
+
const comparelink = stacStore.stac?.find(
|
|
292
|
+
(link) => useGetSubCodeId(link) === compareIndicator.value,
|
|
293
|
+
);
|
|
294
|
+
stacStore.loadSelectedCompareSTAC(comparelink?.href).catch((err) => {
|
|
295
|
+
console.error("[eodash] Error loading compare STAC:", err);
|
|
296
|
+
});
|
|
297
|
+
} else {
|
|
298
|
+
stacStore.resetSelectedCompareSTAC();
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
};
|