@eodash/eodash 5.0.0-rc.2.5 → 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.
- package/core/client/composables/DefineWidgets.js +8 -1
- package/core/client/eodash.js +9 -9
- package/core/client/eodashSTAC/createLayers.js +4 -18
- package/core/client/eodashSTAC/helpers.js +23 -0
- package/core/client/store/stac.js +3 -1
- package/core/client/types.ts +125 -19
- package/core/client/utils/states.js +9 -0
- package/dist/client/{DashboardLayout-BX3Sm_Vx.js → DashboardLayout-t_PavJPO.js} +2 -2
- package/dist/client/{DynamicWebComponent-BqoHM1np.js → DynamicWebComponent-y07rVJch.js} +1 -1
- package/dist/client/{EodashDatePicker-BoWV2vc8.js → EodashDatePicker-CcOfyzGD.js} +3 -83
- package/dist/client/{EodashItemFilter-127fZLyK.js → EodashItemFilter-B9HCvIMi.js} +1 -1
- package/dist/client/{EodashLayerControl-B-pZaizw.js → EodashLayerControl-KStn7Nb_.js} +8 -2
- package/dist/client/{EodashLayoutSwitcher-DwexHfOD.js → EodashLayoutSwitcher-DqeFO3RN.js} +2 -2
- package/dist/client/{EodashMapBtns-Jfn3bpWD.js → EodashMapBtns-5BF27qJB.js} +36 -12
- package/dist/client/{EodashStacInfo-STq_bW7S.js → EodashStacInfo-C_hDy6Pd.js} +7 -1
- package/dist/client/{EodashTools-uxSuJhVJ.js → EodashTools-BXflvRf8.js} +5 -4
- package/dist/client/{ExportState-Ckcb6u01.js → ExportState-C0QRemK1.js} +27 -12
- package/dist/client/{Footer-C8JP-coH.js → Footer-7VGyGUAs.js} +1 -1
- package/dist/client/{Header-Dxx7q9FW.js → Header-BQJnXHYq.js} +3 -3
- package/dist/client/{MobileLayout-BE19Peep.js → MobileLayout-b8nQ-Vyl.js} +5 -5
- package/dist/client/{PopUp-D3IyjsN4.js → PopUp-DgNrh9Df.js} +3 -3
- package/dist/client/ProcessList-C62SOVO6.js +484 -0
- package/dist/client/{VImg-BmCNSu3X.js → VImg-D4eT3IQ1.js} +2 -2
- package/dist/client/{VMain-eZDKIfmJ.js → VMain-C3hN2-H3.js} +1 -1
- package/dist/client/{VOverlay-BS-E4Z6g.js → VOverlay-tAeNygaA.js} +15 -6
- package/dist/client/{VTooltip-BMsliOuh.js → VTooltip-B0Q3iHMZ.js} +3 -3
- package/dist/client/{WidgetsContainer-Cl6M5R5c.js → WidgetsContainer-CtDHfCYf.js} +1 -1
- package/dist/client/{asWebComponent-Df8nUiLs.js → asWebComponent-BJ2NWunV.js} +100 -96
- package/dist/client/eo-dash.css +2 -2
- package/dist/client/eo-dash.js +1 -1
- package/dist/client/{forwardRefs-lhDuXD-N.js → forwardRefs-CIFAqXaZ.js} +9 -9
- package/dist/client/{EodashMap-BSR7_wRA.js → index-BQ16n4Sk.js} +101 -80
- package/dist/client/index-Cv7HBz49.js +85 -0
- package/dist/client/{EodashProcess-CpbZPYBp.js → index-Da5xXX6Q.js} +346 -468
- package/dist/client/{index-Bt5GEGxl.js → index-DvcUndod.js} +1 -1
- package/dist/client/{transition-DHEuQX4I.js → transition-Cdb4K27U.js} +1 -1
- package/dist/types/core/client/components/MobileLayout.vue.d.ts +9 -9
- package/dist/types/core/client/eodashSTAC/helpers.d.ts +3 -2
- package/dist/types/core/client/types.d.ts +83 -17
- package/dist/types/core/client/utils/states.d.ts +7 -0
- package/dist/types/widgets/EodashDatePicker.vue.d.ts +4 -4
- package/dist/types/widgets/EodashItemFilter.vue.d.ts +18 -18
- package/dist/types/widgets/EodashLayerControl.vue.d.ts +2 -2
- package/dist/types/widgets/EodashLayoutSwitcher.vue.d.ts +2 -2
- package/dist/types/widgets/EodashMap/methods/create-layers-config.d.ts +9 -0
- package/dist/types/widgets/EodashMap/methods/index.d.ts +5 -0
- package/dist/types/widgets/EodashMapBtns.vue.d.ts +8 -2
- package/dist/types/widgets/EodashProcess/ProcessList.vue.d.ts +2 -0
- package/dist/types/widgets/EodashProcess/methods/async.d.ts +45 -0
- package/dist/types/widgets/EodashProcess/methods/composables.d.ts +19 -0
- package/dist/types/widgets/EodashProcess/methods/handling.d.ts +78 -0
- package/dist/types/widgets/EodashProcess/methods/outputs.d.ts +54 -0
- package/dist/types/widgets/EodashProcess/methods/utils.d.ts +42 -0
- package/dist/types/widgets/EodashStacInfo.vue.d.ts +12 -12
- package/dist/types/widgets/EodashTools.vue.d.ts +44 -6
- package/dist/types/widgets/PopUp.vue.d.ts +4 -4
- package/package.json +27 -27
- package/widgets/EodashLayerControl.vue +8 -1
- package/widgets/{EodashMap.vue → EodashMap/index.vue} +51 -31
- package/widgets/EodashMap/methods/create-layers-config.js +151 -0
- package/{core/client/composables/EodashMap.js → widgets/EodashMap/methods/index.js} +4 -153
- package/widgets/EodashMapBtns.vue +33 -7
- package/widgets/EodashProcess/ProcessList.vue +82 -0
- package/widgets/EodashProcess/index.vue +186 -0
- package/widgets/EodashProcess/methods/async.js +209 -0
- package/widgets/EodashProcess/methods/composables.js +129 -0
- package/widgets/EodashProcess/methods/handling.js +254 -0
- package/widgets/EodashProcess/methods/outputs.js +216 -0
- package/widgets/EodashProcess/methods/utils.js +138 -0
- package/widgets/EodashStacInfo.vue +6 -0
- package/widgets/EodashTools.vue +1 -0
- package/core/client/composables/EodashProcess.js +0 -654
- package/dist/types/core/client/composables/EodashMap.d.ts +0 -6
- package/dist/types/core/client/composables/EodashProcess.d.ts +0 -162
- package/widgets/EodashProcess.vue +0 -206
- /package/dist/types/widgets/{EodashMap.vue.d.ts → EodashMap/index.vue.d.ts} +0 -0
- /package/dist/types/widgets/{EodashProcess.vue.d.ts → EodashProcess/index.vue.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createLayersConfig } from "./create-layers-config";
|
|
2
2
|
import { setMapProjFromCol } from "@/eodashSTAC/triggers";
|
|
3
3
|
import { nextTick, onMounted, onUnmounted, watch } from "vue";
|
|
4
4
|
import log from "loglevel";
|
|
@@ -7,7 +7,7 @@ import { storeToRefs } from "pinia";
|
|
|
7
7
|
import { useEventBus } from "@vueuse/core";
|
|
8
8
|
import { eoxLayersKey } from "@/utils/keys";
|
|
9
9
|
import { posIsSetFromUrl } from "@/utils/states";
|
|
10
|
-
import { useOnLayersUpdate } from "
|
|
10
|
+
import { useOnLayersUpdate } from "@/composables";
|
|
11
11
|
/**
|
|
12
12
|
* Holder for previous compare map view as it is overwritten by sync
|
|
13
13
|
* @type { import("ol").View | null} mapElement
|
|
@@ -52,161 +52,12 @@ export const useHandleMapMoveEnd = (mapElement, mapPosition) => {
|
|
|
52
52
|
});
|
|
53
53
|
};
|
|
54
54
|
|
|
55
|
-
/**
|
|
56
|
-
* Creates full layer configuration from indicator and time information
|
|
57
|
-
* @param {import("stac-ts").StacCatalog
|
|
58
|
-
* | import("stac-ts").StacCollection
|
|
59
|
-
* | import("stac-ts").StacItem
|
|
60
|
-
* | null
|
|
61
|
-
* } selectedIndicator
|
|
62
|
-
* @param {EodashCollection[]} eodashCols
|
|
63
|
-
* @param {string} [updatedTime]
|
|
64
|
-
*/
|
|
65
|
-
|
|
66
|
-
const createLayersConfig = async (
|
|
67
|
-
selectedIndicator,
|
|
68
|
-
eodashCols,
|
|
69
|
-
updatedTime,
|
|
70
|
-
) => {
|
|
71
|
-
log.debug(
|
|
72
|
-
"Creating layers config",
|
|
73
|
-
selectedIndicator,
|
|
74
|
-
eodashCols,
|
|
75
|
-
updatedTime,
|
|
76
|
-
);
|
|
77
|
-
const layersCollection = [];
|
|
78
|
-
const dataLayers = {
|
|
79
|
-
type: "Group",
|
|
80
|
-
properties: {
|
|
81
|
-
id: "AnalysisGroup",
|
|
82
|
-
title: "Data Layers",
|
|
83
|
-
layerControlExpand: true,
|
|
84
|
-
},
|
|
85
|
-
layers: /** @type {Record<string,any>[]}*/ ([]),
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
for (const ec of eodashCols) {
|
|
89
|
-
let layers;
|
|
90
|
-
if (updatedTime) {
|
|
91
|
-
layers = await ec.createLayersJson(new Date(updatedTime));
|
|
92
|
-
} else {
|
|
93
|
-
layers = await ec.createLayersJson();
|
|
94
|
-
}
|
|
95
|
-
// Add expand to all analysis layers
|
|
96
|
-
layers.forEach((dl) => {
|
|
97
|
-
dl.properties.layerControlExpand = true;
|
|
98
|
-
dl.properties.layerControlToolsExpand = true;
|
|
99
|
-
});
|
|
100
|
-
dataLayers.layers.push(...layers);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
layersCollection.push(dataLayers);
|
|
104
|
-
const indicatorLayers =
|
|
105
|
-
//@ts-expect-error indicator is collection
|
|
106
|
-
await EodashCollection.getIndicatorLayers(selectedIndicator);
|
|
107
|
-
const geodbLayer = EodashCollection.getGeoDBLayer(eodashCols);
|
|
108
|
-
if (geodbLayer) {
|
|
109
|
-
dataLayers.layers.unshift(geodbLayer);
|
|
110
|
-
}
|
|
111
|
-
const baseLayers = {
|
|
112
|
-
type: "Group",
|
|
113
|
-
properties: {
|
|
114
|
-
id: "BaseLayersGroup",
|
|
115
|
-
title: "Base Layers",
|
|
116
|
-
},
|
|
117
|
-
layers: /** @type {Record<string,any>[]}*/ ([]),
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
const indicatorBaseLayers = indicatorLayers.filter(
|
|
121
|
-
(l) => l.properties.group === "baselayer",
|
|
122
|
-
);
|
|
123
|
-
|
|
124
|
-
if (indicatorBaseLayers.length) {
|
|
125
|
-
// Only one baselayer can be set to visible, let's first set all to
|
|
126
|
-
// false that have not a dedicated property visible, then check
|
|
127
|
-
// if there are more then one visible and only allow one
|
|
128
|
-
let counter = 0;
|
|
129
|
-
let lastPos = 0;
|
|
130
|
-
for (let indx = 0; indx < indicatorBaseLayers.length; indx++) {
|
|
131
|
-
const bl = indicatorBaseLayers[indx];
|
|
132
|
-
if (!("visible" in bl.properties)) {
|
|
133
|
-
bl.properties.visible = false;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
if (bl.properties.visible) {
|
|
137
|
-
counter++;
|
|
138
|
-
lastPos = indx;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// if none visible set the last one as visible
|
|
143
|
-
if (counter === 0) {
|
|
144
|
-
indicatorBaseLayers[0].properties.visible = true;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// disable all apart from last
|
|
148
|
-
if (counter > 0) {
|
|
149
|
-
indicatorBaseLayers.forEach((bl, indx) => {
|
|
150
|
-
if (indx !== lastPos) {
|
|
151
|
-
bl.properties.visible = false;
|
|
152
|
-
} else {
|
|
153
|
-
bl.properties.visible = true;
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
baseLayers.layers.push(...indicatorBaseLayers);
|
|
159
|
-
|
|
160
|
-
// Add exclusive to baselayers and make sure only one is selected
|
|
161
|
-
baseLayers.layers.forEach((bl) => {
|
|
162
|
-
bl.properties.layerControlExclusive = true;
|
|
163
|
-
});
|
|
164
|
-
} else {
|
|
165
|
-
// Default to some baselayer
|
|
166
|
-
baseLayers.layers.push({
|
|
167
|
-
type: "Tile",
|
|
168
|
-
properties: {
|
|
169
|
-
id: "osm",
|
|
170
|
-
title: "Background",
|
|
171
|
-
layerControlExclusive: true,
|
|
172
|
-
},
|
|
173
|
-
source: {
|
|
174
|
-
type: "OSM",
|
|
175
|
-
},
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
if (baseLayers.layers.length) {
|
|
180
|
-
layersCollection.push(baseLayers);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
const overlayLayers = {
|
|
184
|
-
type: "Group",
|
|
185
|
-
properties: {
|
|
186
|
-
id: "OverlayGroup",
|
|
187
|
-
title: "Overlay Layers",
|
|
188
|
-
},
|
|
189
|
-
layers: /** @type {Record<string,any>[]}*/ ([]),
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
const indicatorOverlays = indicatorLayers.filter(
|
|
193
|
-
(l) => l.properties.group === "overlay",
|
|
194
|
-
);
|
|
195
|
-
|
|
196
|
-
if (indicatorOverlays.length) {
|
|
197
|
-
overlayLayers.layers.push(...indicatorOverlays);
|
|
198
|
-
layersCollection.unshift(overlayLayers);
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
return layersCollection;
|
|
202
|
-
};
|
|
203
|
-
|
|
204
55
|
/**
|
|
205
56
|
* Initializes the map and updates it based on changes in the selected indicator and datetime,
|
|
206
57
|
*
|
|
207
58
|
* @param {import("vue").Ref<import("@eox/map").EOxMap| null>} mapElement
|
|
208
59
|
* @param {import("vue").Ref<import("stac-ts").StacCollection | null>} selectedIndicator
|
|
209
|
-
* @param {EodashCollection[]} eodashCols
|
|
60
|
+
* @param {import("@/eodashSTAC/EodashCollection").EodashCollection[]} eodashCols
|
|
210
61
|
* @param {import("vue").Ref<string>} datetime
|
|
211
62
|
* @param {import("vue").Ref<Record<string,any>[]>} mapLayers
|
|
212
63
|
* @param {import("vue").Ref<import("@eox/map").EOxMap| null>} partnerMap
|
|
@@ -364,7 +215,7 @@ export const useInitMap = (
|
|
|
364
215
|
};
|
|
365
216
|
/**
|
|
366
217
|
*
|
|
367
|
-
* @param {EodashCollection[]} eodashCols
|
|
218
|
+
* @param {import("@/eodashSTAC/EodashCollection").EodashCollection[]} eodashCols
|
|
368
219
|
* @param {import("vue").Ref<Exclude<import("@/types").EodashStyleJson["tooltip"],undefined>>} tooltipProperties
|
|
369
220
|
*/
|
|
370
221
|
export const useUpdateTooltipProperties = (eodashCols, tooltipProperties) => {
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
/>
|
|
17
17
|
<v-btn
|
|
18
18
|
class="map-btn"
|
|
19
|
-
:icon="[
|
|
19
|
+
:icon="[compareIcon]"
|
|
20
20
|
v-if="compareIndicators"
|
|
21
|
-
@click="
|
|
21
|
+
@click="onCompareClick"
|
|
22
22
|
/>
|
|
23
23
|
<PopUp
|
|
24
24
|
v-model="showCompareIndicators"
|
|
@@ -39,14 +39,17 @@
|
|
|
39
39
|
import { makePanelTransparent } from "@/composables";
|
|
40
40
|
import { changeMapProjection, setActiveTemplate } from "@/store/actions";
|
|
41
41
|
import { availableMapProjection } from "@/store/states";
|
|
42
|
-
import { mdiCompare, mdiEarthBox, mdiMapPlus } from "@mdi/js";
|
|
42
|
+
import { mdiCompare, mdiCompareRemove, mdiEarthBox, mdiMapPlus } from "@mdi/js";
|
|
43
43
|
import ExportState from "^/ExportState.vue";
|
|
44
|
-
import { computed, ref } from "vue";
|
|
44
|
+
import { computed, ref, triggerRef } from "vue";
|
|
45
45
|
import PopUp from "./PopUp.vue";
|
|
46
46
|
import EodashItemFilter from "./EodashItemFilter.vue";
|
|
47
47
|
import { useDisplay } from "vuetify/lib/framework.mjs";
|
|
48
|
+
import { useSTAcStore } from "@/store/stac";
|
|
49
|
+
import { storeToRefs } from "pinia";
|
|
50
|
+
import { switchToCompare } from "@/utils/states";
|
|
48
51
|
|
|
49
|
-
defineProps({
|
|
52
|
+
const { compareIndicators, changeProjection, exportMap } = defineProps({
|
|
50
53
|
exportMap: {
|
|
51
54
|
type: Boolean,
|
|
52
55
|
default: true,
|
|
@@ -56,22 +59,45 @@ defineProps({
|
|
|
56
59
|
default: true,
|
|
57
60
|
},
|
|
58
61
|
compareIndicators: {
|
|
59
|
-
type
|
|
62
|
+
/** @type {import("vue").PropType<boolean | {compareTemplate?:string;fallbackTemplate?:string}> }*/
|
|
63
|
+
type: [Boolean, Object],
|
|
60
64
|
default: true,
|
|
61
65
|
},
|
|
62
66
|
});
|
|
67
|
+
const { selectedStac, selectedCompareStac } = storeToRefs(useSTAcStore());
|
|
63
68
|
const { smAndDown } = useDisplay();
|
|
64
69
|
const popupWidth = computed(() => (smAndDown ? "70%" : "500px"));
|
|
65
70
|
const popupHeight = computed(() => (smAndDown ? "90%" : "500px"));
|
|
66
71
|
|
|
67
72
|
const showMapState = ref(false);
|
|
68
73
|
const showCompareIndicators = ref(false);
|
|
74
|
+
const compareIcon = computed(() =>
|
|
75
|
+
switchToCompare.value ? mdiCompare : mdiCompareRemove,
|
|
76
|
+
);
|
|
77
|
+
const onCompareClick = () => {
|
|
78
|
+
if (switchToCompare.value) {
|
|
79
|
+
showCompareIndicators.value = !showCompareIndicators.value;
|
|
80
|
+
} else {
|
|
81
|
+
switchToCompare.value = true;
|
|
82
|
+
const fallbackTemplate =
|
|
83
|
+
(typeof compareIndicators === "object" &&
|
|
84
|
+
compareIndicators.fallbackTemplate) ||
|
|
85
|
+
"expert";
|
|
86
|
+
selectedCompareStac.value = null;
|
|
87
|
+
setActiveTemplate(fallbackTemplate);
|
|
88
|
+
triggerRef(selectedStac);
|
|
89
|
+
}
|
|
90
|
+
};
|
|
69
91
|
|
|
70
92
|
/** @type {import("vue").Ref<HTMLDivElement|null>} */
|
|
71
93
|
const rootRef = ref(null);
|
|
72
94
|
|
|
73
95
|
const onSelectCompareIndicator = () => {
|
|
74
|
-
|
|
96
|
+
const compareTemplate =
|
|
97
|
+
(typeof compareIndicators === "object" &&
|
|
98
|
+
compareIndicators.compareTemplate) ||
|
|
99
|
+
"compare";
|
|
100
|
+
setActiveTemplate(compareTemplate);
|
|
75
101
|
showCompareIndicators.value = !showCompareIndicators.value;
|
|
76
102
|
};
|
|
77
103
|
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<v-table
|
|
4
|
+
v-if="jobs.length"
|
|
5
|
+
density="compact"
|
|
6
|
+
style="background-color: transparent"
|
|
7
|
+
>
|
|
8
|
+
<thead>
|
|
9
|
+
<tr>
|
|
10
|
+
<th class="text-left">Executed on</th>
|
|
11
|
+
<th class="text-left">Status</th>
|
|
12
|
+
<th class="text-left"></th>
|
|
13
|
+
<th class="text-left"></th>
|
|
14
|
+
<th class="text-left"></th>
|
|
15
|
+
</tr>
|
|
16
|
+
</thead>
|
|
17
|
+
<tbody>
|
|
18
|
+
<tr v-for="item in jobs" :key="item.date">
|
|
19
|
+
<td>
|
|
20
|
+
{{ new Date(item.job_start_datetime).toISOString().slice(0, 16) }}
|
|
21
|
+
</td>
|
|
22
|
+
<td>{{ item.status }}</td>
|
|
23
|
+
<td style="padding: 0px">
|
|
24
|
+
<v-btn
|
|
25
|
+
:disabled="item.status !== 'successful'"
|
|
26
|
+
color="primary"
|
|
27
|
+
@click="loadProcess(item, selectedStac)"
|
|
28
|
+
:icon="[mdiUploadBox]"
|
|
29
|
+
variant="text"
|
|
30
|
+
v-tooltip="'Load results to map'"
|
|
31
|
+
>
|
|
32
|
+
</v-btn>
|
|
33
|
+
</td>
|
|
34
|
+
<td style="padding: 0px">
|
|
35
|
+
<v-btn
|
|
36
|
+
:disabled="item.status !== 'successful'"
|
|
37
|
+
color="primary"
|
|
38
|
+
@click="downloadPreviousResults(item, selectedStac)"
|
|
39
|
+
:icon="[mdiDownloadBox]"
|
|
40
|
+
variant="text"
|
|
41
|
+
v-tooltip="'Download results'"
|
|
42
|
+
>
|
|
43
|
+
</v-btn>
|
|
44
|
+
</td>
|
|
45
|
+
<td style="padding: 0px">
|
|
46
|
+
<v-btn
|
|
47
|
+
color="#ff5252"
|
|
48
|
+
@click="deleteJob(item)"
|
|
49
|
+
:icon="[mdiTrashCanOutline]"
|
|
50
|
+
variant="text"
|
|
51
|
+
v-tooltip="'Remove job'"
|
|
52
|
+
>
|
|
53
|
+
</v-btn>
|
|
54
|
+
</td>
|
|
55
|
+
</tr>
|
|
56
|
+
</tbody>
|
|
57
|
+
</v-table>
|
|
58
|
+
</div>
|
|
59
|
+
</template>
|
|
60
|
+
<script setup>
|
|
61
|
+
import { mdiUploadBox, mdiDownloadBox, mdiTrashCanOutline } from "@mdi/js";
|
|
62
|
+
import { onMounted, toRefs } from "vue";
|
|
63
|
+
import { useSTAcStore } from "@/store/stac";
|
|
64
|
+
import { indicator } from "@/store/states";
|
|
65
|
+
import {
|
|
66
|
+
deleteJob,
|
|
67
|
+
downloadPreviousResults,
|
|
68
|
+
jobs,
|
|
69
|
+
loadProcess,
|
|
70
|
+
updateJobsStatus,
|
|
71
|
+
} from "./methods/async";
|
|
72
|
+
|
|
73
|
+
const { selectedStac } = toRefs(useSTAcStore());
|
|
74
|
+
|
|
75
|
+
onMounted(() => updateJobsStatus(jobs, indicator));
|
|
76
|
+
</script>
|
|
77
|
+
<style lang="scss">
|
|
78
|
+
div.v-table__wrapper {
|
|
79
|
+
overflow: hidden !important;
|
|
80
|
+
height: max-content !important;
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div ref="container" class="process-container">
|
|
3
|
+
<ProcessList />
|
|
4
|
+
|
|
5
|
+
<eox-jsonform
|
|
6
|
+
v-if="jsonformSchema"
|
|
7
|
+
ref="jsonformEl"
|
|
8
|
+
.schema="jsonformSchema"
|
|
9
|
+
></eox-jsonform>
|
|
10
|
+
<eox-chart
|
|
11
|
+
class="chart"
|
|
12
|
+
v-if="isProcessed && chartSpec"
|
|
13
|
+
.spec="toRaw(chartSpec)"
|
|
14
|
+
.dataValues="toRaw(chartData)"
|
|
15
|
+
@click:item="onChartClick"
|
|
16
|
+
:style="chartStyles"
|
|
17
|
+
/>
|
|
18
|
+
<div style="text-align: right">
|
|
19
|
+
<v-btn
|
|
20
|
+
v-if="!autoExec"
|
|
21
|
+
:loading="loading"
|
|
22
|
+
style="margin-right: 20px"
|
|
23
|
+
@click="startProcess"
|
|
24
|
+
color="primary"
|
|
25
|
+
>
|
|
26
|
+
Execute
|
|
27
|
+
</v-btn>
|
|
28
|
+
<v-btn
|
|
29
|
+
v-if="processResults.length && isProcessed && !isAsync"
|
|
30
|
+
color="primary"
|
|
31
|
+
@click="downloadResults"
|
|
32
|
+
>
|
|
33
|
+
Download
|
|
34
|
+
</v-btn>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
</template>
|
|
38
|
+
<script setup>
|
|
39
|
+
import "@eox/chart";
|
|
40
|
+
import "@eox/drawtools";
|
|
41
|
+
import "@eox/jsonform";
|
|
42
|
+
import { useSTAcStore } from "@/store/stac";
|
|
43
|
+
import { storeToRefs } from "pinia";
|
|
44
|
+
import { computed, ref, toRaw, useTemplateRef } from "vue";
|
|
45
|
+
import ProcessList from "./ProcessList.vue";
|
|
46
|
+
import { handleProcesses, onChartClick } from "./methods/handling";
|
|
47
|
+
import { useInitProcess, useAutoExec } from "./methods/composables";
|
|
48
|
+
import { jobs, updateJobsStatus } from "./methods/async";
|
|
49
|
+
import { indicator } from "@/store/states";
|
|
50
|
+
import { download } from "./methods/utils";
|
|
51
|
+
|
|
52
|
+
/** @type {import("vue").Ref<import("vega").Spec|null>} */
|
|
53
|
+
const chartSpec = ref(null);
|
|
54
|
+
|
|
55
|
+
/** @type {import("vue").Ref<Record<string,any>|null>} */
|
|
56
|
+
const chartData = ref(null);
|
|
57
|
+
const isProcessed = ref(false);
|
|
58
|
+
|
|
59
|
+
/** @type {import("vue").Ref<Record<string,any>|null>} */
|
|
60
|
+
const jsonformSchema = ref(null);
|
|
61
|
+
|
|
62
|
+
const jsonformEl =
|
|
63
|
+
/** @type {Readonly<import("vue").ShallowRef<import("@eox/jsonform").EOxJSONForm | null>>} */ (
|
|
64
|
+
useTemplateRef("jsonformEl")
|
|
65
|
+
);
|
|
66
|
+
const isAsync = computed(
|
|
67
|
+
() =>
|
|
68
|
+
selectedStac.value?.links.filter((l) => l.endpoint === "eoxhub_workspaces")
|
|
69
|
+
.length,
|
|
70
|
+
);
|
|
71
|
+
const containerEl = useTemplateRef("container");
|
|
72
|
+
|
|
73
|
+
const loading = ref(false);
|
|
74
|
+
|
|
75
|
+
const autoExec = ref(false);
|
|
76
|
+
|
|
77
|
+
const isPolling = ref(false);
|
|
78
|
+
/** @type {import("vue").Ref<any[]>} */
|
|
79
|
+
const processResults = ref([]);
|
|
80
|
+
|
|
81
|
+
const { selectedStac } = storeToRefs(useSTAcStore());
|
|
82
|
+
|
|
83
|
+
useInitProcess({
|
|
84
|
+
//@ts-expect-error TODO
|
|
85
|
+
selectedStac,
|
|
86
|
+
jsonformEl,
|
|
87
|
+
jsonformSchema,
|
|
88
|
+
chartSpec,
|
|
89
|
+
isProcessed,
|
|
90
|
+
processResults,
|
|
91
|
+
loading,
|
|
92
|
+
isPolling,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const downloadResults = () => {
|
|
96
|
+
processResults.value.forEach((result) => {
|
|
97
|
+
if (!result) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
let fileName = "";
|
|
101
|
+
if (typeof result === "string") {
|
|
102
|
+
fileName = result.includes("/")
|
|
103
|
+
? (result.split("/").pop() ?? "")
|
|
104
|
+
: result;
|
|
105
|
+
fileName = fileName.includes("?") ? fileName.split("?")[0] : fileName;
|
|
106
|
+
} else {
|
|
107
|
+
fileName = selectedStac.value?.id + "_process_results.json";
|
|
108
|
+
}
|
|
109
|
+
download(fileName, result);
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const startProcess = async () => {
|
|
114
|
+
/** @param {*} jsonformSchema */
|
|
115
|
+
const getDrawToolsProperty = (jsonformSchema) => {
|
|
116
|
+
for (const property in jsonformSchema.properties) {
|
|
117
|
+
if (jsonformSchema.properties[property]?.options?.drawtools) {
|
|
118
|
+
return property;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
const drawToolsProperty = getDrawToolsProperty(jsonformSchema.value);
|
|
123
|
+
const propertyIsEmpty =
|
|
124
|
+
drawToolsProperty &&
|
|
125
|
+
//@ts-expect-error jsonfrom.value is not typed
|
|
126
|
+
Array.isArray(jsonformEl.value?.value[drawToolsProperty]) &&
|
|
127
|
+
//@ts-expect-error jsonfrom.value is not typed
|
|
128
|
+
!jsonformEl.value?.value[drawToolsProperty].length;
|
|
129
|
+
|
|
130
|
+
if (propertyIsEmpty) {
|
|
131
|
+
isProcessed.value = false;
|
|
132
|
+
chartSpec.value = null;
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
const errors = jsonformEl.value?.editor.validate();
|
|
136
|
+
if (errors?.length) {
|
|
137
|
+
console.warn("[eodash] Form validation failed", errors);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
processResults.value = [];
|
|
142
|
+
|
|
143
|
+
await handleProcesses({
|
|
144
|
+
jsonformEl,
|
|
145
|
+
jsonformSchema,
|
|
146
|
+
chartSpec,
|
|
147
|
+
chartData,
|
|
148
|
+
loading,
|
|
149
|
+
//@ts-expect-error TODO
|
|
150
|
+
selectedStac,
|
|
151
|
+
isProcessed,
|
|
152
|
+
isPolling,
|
|
153
|
+
processResults,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
isProcessed.value = true;
|
|
157
|
+
if (isAsync.value) updateJobsStatus(jobs, indicator);
|
|
158
|
+
};
|
|
159
|
+
useAutoExec(autoExec, jsonformEl, jsonformSchema, startProcess);
|
|
160
|
+
|
|
161
|
+
const chartStyles = computed(() => {
|
|
162
|
+
/** @type {Record<string,string> }*/
|
|
163
|
+
const styles = {};
|
|
164
|
+
if (!chartSpec.value?.["height"]) {
|
|
165
|
+
styles["height"] =
|
|
166
|
+
Math.max(
|
|
167
|
+
(containerEl.value?.offsetHeight ?? 0) -
|
|
168
|
+
(jsonformEl.value?.offsetHeight ?? 0),
|
|
169
|
+
200,
|
|
170
|
+
) + "px";
|
|
171
|
+
}
|
|
172
|
+
return styles;
|
|
173
|
+
});
|
|
174
|
+
</script>
|
|
175
|
+
<style>
|
|
176
|
+
.process-container {
|
|
177
|
+
height: 100%;
|
|
178
|
+
overflow-y: auto;
|
|
179
|
+
}
|
|
180
|
+
eox-chart {
|
|
181
|
+
--background-color: transparent;
|
|
182
|
+
}
|
|
183
|
+
eox-jsonform {
|
|
184
|
+
padding: 0.7em;
|
|
185
|
+
}
|
|
186
|
+
</style>
|