@geode/opengeodeweb-front 10.30.0-rc.8 → 10.30.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/app/components/ObjectSelector.vue +26 -76
- package/app/components/Viewer/Generic/Model/BlocksOptions.vue +2 -2
- package/app/components/Viewer/Generic/Model/CornersOptions.vue +2 -2
- package/app/components/Viewer/Generic/Model/LinesOptions.vue +2 -2
- package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +2 -2
- package/app/components/Viewer/ObjectTree/Base/CommonTreeView.vue +1 -0
- package/app/components/Viewer/ObjectTree/Base/TreeRow.vue +8 -0
- package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +3 -0
- package/app/components/Viewer/Options/AttributeSelector.vue +13 -6
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +7 -7
- package/app/composables/project_manager.js +14 -11
- package/app/stores/app.js +8 -7
- package/app/stores/back.js +2 -13
- package/app/stores/cloud.js +3 -0
- package/app/stores/infra.js +0 -5
- package/app/stores/viewer.js +0 -12
- package/app/utils/extension.js +4 -3
- package/app/utils/import_workflow.js +1 -9
- package/app/utils/log.js +18 -0
- package/internal/utils/api_fetch.js +26 -53
- package/internal/utils/upload_file.js +33 -29
- package/internal/utils/viewer_call.js +7 -2
- package/package.json +17 -16
- package/server/api/cloud/extensions/run.post.js +72 -0
- package/server/api/{microservice → local}/extensions/run.post.js +10 -46
- package/server/api/microservice/app/set_back_base_url.post.js +22 -0
- package/server/api/microservice/app/set_viewer_base_url.post.js +22 -0
- package/server/utils/cloud.js +107 -1
- package/server/utils/extension.js +50 -0
- package/server/utils/microservices.js +51 -26
- package/server/utils/path.js +10 -0
- package/server/utils/server_config.js +4 -10
- package/shared/scripts.js +47 -9
- package/shared/utils/fetch_raw.js +1 -0
- package/shared/utils/response_handlers/load.js +74 -0
- package/tests/unit/composables/project_manager.nuxt.test.js +12 -1
- package/tests/unit/composables/upload_file.nuxt.test.js +2 -2
- package/tests/unit/stores/cloud.nuxt.test.js +23 -26
- package/tests/unit/stores/infra.nuxt.test.js +12 -5
- package/tests/unit/utils/validate_schema.nuxt.test.js +1 -1
- package/app/utils/validate_schema.js +0 -13
- /package/server/api/{microservice → local}/extensions/kill.post.js +0 -0
- /package/server/api/serverless/{run_cloud.js → run_cloud.post.js} +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import FetchingData from "@ogw_front/components/FetchingData.vue";
|
|
3
3
|
import { geode_objects } from "@ogw_front/assets/geode_objects";
|
|
4
|
+
import { resolveAllowedObjects } from "@ogw_shared/utils/response_handlers/load.js";
|
|
4
5
|
import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json";
|
|
5
6
|
import { useBackStore } from "@ogw_front/stores/back";
|
|
6
7
|
|
|
@@ -15,100 +16,49 @@ const { filenames } = defineProps({
|
|
|
15
16
|
const backStore = useBackStore();
|
|
16
17
|
|
|
17
18
|
const loading = ref(false);
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
19
|
+
const allowedGeodeObjects = ref({});
|
|
20
|
+
const toggleLoading = useToggle(loading);
|
|
21
|
+
const multipleFilesNoCommon = ref(false);
|
|
21
22
|
|
|
22
|
-
function
|
|
23
|
-
const
|
|
24
|
-
if (object_keys.length === 0) {
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
if (object_keys.length === 1 && object_map[object_keys[0]].is_loadable > 0) {
|
|
28
|
-
return object_keys[0];
|
|
29
|
-
}
|
|
30
|
-
const highest_load_score = Math.max(...object_keys.map((key) => object_map[key].is_loadable));
|
|
31
|
-
if (highest_load_score <= 0) {
|
|
32
|
-
return undefined;
|
|
33
|
-
}
|
|
34
|
-
const best_score_objects = object_keys.filter(
|
|
35
|
-
(key) => object_map[key].is_loadable === highest_load_score,
|
|
36
|
-
);
|
|
37
|
-
if (best_score_objects.length === 1) {
|
|
38
|
-
return best_score_objects[0];
|
|
39
|
-
}
|
|
40
|
-
const highest_priority = Math.max(
|
|
41
|
-
...best_score_objects.map((key) => object_map[key].object_priority ?? -Infinity),
|
|
42
|
-
);
|
|
43
|
-
const best_priority_objects = best_score_objects.filter(
|
|
44
|
-
(key) => object_map[key].object_priority === highest_priority,
|
|
45
|
-
);
|
|
46
|
-
if (highest_priority !== -Infinity && best_priority_objects.length === 1) {
|
|
47
|
-
return best_priority_objects[0];
|
|
48
|
-
}
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function isCsvFile(filename) {
|
|
53
|
-
return filename.toLowerCase().endsWith(".csv") || filename.toLowerCase().endsWith(".csv.json");
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
async function get_allowed_objects() {
|
|
57
|
-
toggle_loading();
|
|
58
|
-
allowed_objects.value = {};
|
|
59
|
-
multiple_files_no_common.value = false;
|
|
60
|
-
|
|
61
|
-
const promise_array = filenames.map((filename) => {
|
|
23
|
+
async function fetchAllowedObjectsList() {
|
|
24
|
+
const promiseArray = filenames.map((filename) => {
|
|
62
25
|
const params = { filename };
|
|
63
26
|
return backStore.request({ schema, params });
|
|
64
27
|
});
|
|
65
|
-
const responses = await Promise.all(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const common_keys = all_keys.filter((key) => allowed_objects_list.every((obj) => key in obj));
|
|
28
|
+
const responses = await Promise.all(promiseArray);
|
|
29
|
+
return responses.map((response) => response.allowed_objects);
|
|
30
|
+
}
|
|
69
31
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
32
|
+
async function getAllowedGeodeObjects() {
|
|
33
|
+
toggleLoading();
|
|
34
|
+
allowedGeodeObjects.value = {};
|
|
35
|
+
multipleFilesNoCommon.value = false;
|
|
73
36
|
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
const load_scores = allowed_objects_list.map((obj) => obj[key].is_loadable);
|
|
77
|
-
const priorities = allowed_objects_list
|
|
78
|
-
.map((obj) => obj[key].object_priority)
|
|
79
|
-
.filter((priority) => priority !== undefined);
|
|
80
|
-
final_object[key] = { is_loadable: Math.min(...load_scores) };
|
|
81
|
-
if (priorities.length > 0) {
|
|
82
|
-
final_object[key].object_priority = Math.max(...priorities);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
const isCsv = filenames.some((filename) => isCsvFile(filename));
|
|
86
|
-
if (isCsv && !final_object["PointSet3D"]) {
|
|
87
|
-
final_object["PointSet3D"] = { is_loadable: 1, object_priority: 100 };
|
|
88
|
-
}
|
|
37
|
+
const allowedGeodeObjectsList = await fetchAllowedObjectsList();
|
|
38
|
+
const resolved = resolveAllowedObjects(filenames, allowedGeodeObjectsList);
|
|
89
39
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
if (
|
|
93
|
-
|
|
40
|
+
allowedGeodeObjects.value = resolved.mergedAllowedObjects;
|
|
41
|
+
multipleFilesNoCommon.value = resolved.multipleFilesNoCommon;
|
|
42
|
+
if (resolved.selectedGeodeObject) {
|
|
43
|
+
setGeodeObject(resolved.selectedGeodeObject);
|
|
94
44
|
}
|
|
95
|
-
|
|
45
|
+
toggleLoading();
|
|
96
46
|
}
|
|
97
47
|
|
|
98
|
-
function
|
|
48
|
+
function setGeodeObject(geode_object_type) {
|
|
99
49
|
if (geode_object_type) {
|
|
100
50
|
emit("update_values", { geode_object_type });
|
|
101
51
|
emit("increment_step");
|
|
102
52
|
}
|
|
103
53
|
}
|
|
104
54
|
// oxlint-disable-next-line no-top-level-await
|
|
105
|
-
await
|
|
55
|
+
await getAllowedGeodeObjects();
|
|
106
56
|
</script>
|
|
107
57
|
|
|
108
58
|
<template>
|
|
109
59
|
<FetchingData v-if="loading" />
|
|
110
|
-
<v-row v-else-if="Object.keys(
|
|
111
|
-
<v-col v-for="(value, key) in
|
|
60
|
+
<v-row v-else-if="Object.keys(allowedGeodeObjects).length" class="justify-left">
|
|
61
|
+
<v-col v-for="(value, key) in allowedGeodeObjects" :key="key" cols="3" md="4">
|
|
112
62
|
<v-tooltip
|
|
113
63
|
:text="
|
|
114
64
|
value['is_loadable']
|
|
@@ -124,7 +74,7 @@ await get_allowed_objects();
|
|
|
124
74
|
class="card ma-2"
|
|
125
75
|
hover
|
|
126
76
|
rounded
|
|
127
|
-
@click="
|
|
77
|
+
@click="setGeodeObject(key)"
|
|
128
78
|
:disabled="!value['is_loadable']"
|
|
129
79
|
:elevation="value['is_loadable'] ? 5 : 3"
|
|
130
80
|
>
|
|
@@ -139,7 +89,7 @@ await get_allowed_objects();
|
|
|
139
89
|
</v-tooltip>
|
|
140
90
|
</v-col>
|
|
141
91
|
</v-row>
|
|
142
|
-
<v-row v-else-if="
|
|
92
|
+
<v-row v-else-if="multipleFilesNoCommon" class="pa-5">
|
|
143
93
|
<v-card class="card" variant="tonal" rounded>
|
|
144
94
|
<v-card-text>
|
|
145
95
|
These files cannot be loaded together because they don't share a common data type.
|
|
@@ -238,7 +238,7 @@ const polyhedronSchema = back_schemas.opengeodeweb_back.model_component_polyhedr
|
|
|
238
238
|
<VisibilitySwitch data-testid="modelBlocksVisibilitySwitch" v-model="blocksVisibility" />
|
|
239
239
|
<ViewerOptionsColoringTypeSelector
|
|
240
240
|
:id="modelId"
|
|
241
|
-
:
|
|
241
|
+
:componentIds="targetBlockIds"
|
|
242
242
|
v-model:coloring_style_key="blocksActiveColoring"
|
|
243
243
|
v-model:color="blocksColor"
|
|
244
244
|
v-model:vertex_attribute_name="blocksVertexAttributeName"
|
|
@@ -259,7 +259,7 @@ const polyhedronSchema = back_schemas.opengeodeweb_back.model_component_polyhedr
|
|
|
259
259
|
<VisibilitySwitch v-model="blockVisibility" />
|
|
260
260
|
<ViewerOptionsColoringTypeSelector
|
|
261
261
|
:id="modelId"
|
|
262
|
-
:
|
|
262
|
+
:componentIds="[blockId]"
|
|
263
263
|
v-model:coloring_style_key="blockActiveColoring"
|
|
264
264
|
v-model:color="blockColor"
|
|
265
265
|
v-model:vertex_attribute_name="vertexAttributeName"
|
|
@@ -159,7 +159,7 @@ const vertexSchema = back_schemas.opengeodeweb_back.model_component_vertex_attri
|
|
|
159
159
|
<VisibilitySwitch data-testid="modelCornersVisibilitySwitch" v-model="cornersVisibility" />
|
|
160
160
|
<ViewerOptionsColoringTypeSelector
|
|
161
161
|
:id="modelId"
|
|
162
|
-
:
|
|
162
|
+
:componentIds="targetCornerIds"
|
|
163
163
|
v-model:coloring_style_key="cornersActiveColoring"
|
|
164
164
|
v-model:color="cornersColor"
|
|
165
165
|
v-model:vertex_attribute_name="cornersVertexAttributeName"
|
|
@@ -176,7 +176,7 @@ const vertexSchema = back_schemas.opengeodeweb_back.model_component_vertex_attri
|
|
|
176
176
|
<VisibilitySwitch v-model="cornerVisibility" />
|
|
177
177
|
<ViewerOptionsColoringTypeSelector
|
|
178
178
|
:id="modelId"
|
|
179
|
-
:
|
|
179
|
+
:componentIds="[cornerId]"
|
|
180
180
|
v-model:coloring_style_key="cornerActiveColoring"
|
|
181
181
|
v-model:color="cornerColor"
|
|
182
182
|
v-model:vertex_attribute_name="vertexAttributeName"
|
|
@@ -234,7 +234,7 @@ const edgeSchema = back_schemas.opengeodeweb_back.model_component_edge_attribute
|
|
|
234
234
|
<VisibilitySwitch data-testid="modelLinesVisibilitySwitch" v-model="linesVisibility" />
|
|
235
235
|
<ViewerOptionsColoringTypeSelector
|
|
236
236
|
:id="modelId"
|
|
237
|
-
:
|
|
237
|
+
:componentIds="targetLineIds"
|
|
238
238
|
v-model:coloring_style_key="linesActiveColoring"
|
|
239
239
|
v-model:color="linesColor"
|
|
240
240
|
v-model:vertex_attribute_name="linesVertexAttributeName"
|
|
@@ -255,7 +255,7 @@ const edgeSchema = back_schemas.opengeodeweb_back.model_component_edge_attribute
|
|
|
255
255
|
<VisibilitySwitch v-model="lineVisibility" />
|
|
256
256
|
<ViewerOptionsColoringTypeSelector
|
|
257
257
|
:id="modelId"
|
|
258
|
-
:
|
|
258
|
+
:componentIds="[lineId]"
|
|
259
259
|
v-model:coloring_style_key="lineActiveColoring"
|
|
260
260
|
v-model:color="lineColor"
|
|
261
261
|
v-model:vertex_attribute_name="vertexAttributeName"
|
|
@@ -242,7 +242,7 @@ const polygonSchema = back_schemas.opengeodeweb_back.model_component_polygon_att
|
|
|
242
242
|
<VisibilitySwitch data-testid="modelSurfacesVisibilitySwitch" v-model="surfacesVisibility" />
|
|
243
243
|
<ViewerOptionsColoringTypeSelector
|
|
244
244
|
:id="modelId"
|
|
245
|
-
:
|
|
245
|
+
:componentIds="targetSurfaceIds"
|
|
246
246
|
v-model:coloring_style_key="surfacesActiveColoring"
|
|
247
247
|
v-model:color="surfacesColor"
|
|
248
248
|
v-model:vertex_attribute_name="surfacesVertexAttributeName"
|
|
@@ -263,7 +263,7 @@ const polygonSchema = back_schemas.opengeodeweb_back.model_component_polygon_att
|
|
|
263
263
|
<VisibilitySwitch v-model="surfaceVisibility" />
|
|
264
264
|
<ViewerOptionsColoringTypeSelector
|
|
265
265
|
:id="modelId"
|
|
266
|
-
:
|
|
266
|
+
:componentIds="[surfaceId]"
|
|
267
267
|
v-model:coloring_style_key="surfaceActiveColoring"
|
|
268
268
|
v-model:color="surfaceColor"
|
|
269
269
|
v-model:vertex_attribute_name="vertexAttributeName"
|
|
@@ -48,6 +48,7 @@ function handleRowClick(event) {
|
|
|
48
48
|
<div class="d-flex align-center flex-shrink-0">
|
|
49
49
|
<v-icon
|
|
50
50
|
v-if="!item.isLeaf"
|
|
51
|
+
:data-testid="item.isOpen ? 'collapseTreeRowButton' : 'expandTreeRowButton'"
|
|
51
52
|
:icon="item.isOpen ? 'mdi-menu-down' : 'mdi-menu-right'"
|
|
52
53
|
class="me-1"
|
|
53
54
|
color="black"
|
|
@@ -69,6 +70,13 @@ function handleRowClick(event) {
|
|
|
69
70
|
/>
|
|
70
71
|
<v-btn
|
|
71
72
|
v-else-if="showEyeButton"
|
|
73
|
+
:data-testid="
|
|
74
|
+
getIndeterminate(item.raw)
|
|
75
|
+
? 'indeterminateObjectEyeButton'
|
|
76
|
+
: isSelected(item.raw)
|
|
77
|
+
? 'visibleObjectEyeButton'
|
|
78
|
+
: 'hiddenObjectEyeButton'
|
|
79
|
+
"
|
|
72
80
|
:icon="
|
|
73
81
|
getIndeterminate(item.raw)
|
|
74
82
|
? 'mdi-eye-minus-outline'
|
|
@@ -182,6 +182,7 @@ function expandAll() {
|
|
|
182
182
|
<template v-if="item.geode_object_type !== 'HorizonStack3D'">
|
|
183
183
|
<v-btn
|
|
184
184
|
v-if="item.viewer_type"
|
|
185
|
+
data-testid="focusObjectButton"
|
|
185
186
|
icon="mdi-target"
|
|
186
187
|
size="medium"
|
|
187
188
|
variant="text"
|
|
@@ -190,6 +191,7 @@ function expandAll() {
|
|
|
190
191
|
/>
|
|
191
192
|
<v-btn
|
|
192
193
|
v-if="isModel(item)"
|
|
194
|
+
data-testid="expandModelComponentsButton"
|
|
193
195
|
icon="mdi-magnify-expand"
|
|
194
196
|
size="medium"
|
|
195
197
|
class="ml-2"
|
|
@@ -206,6 +208,7 @@ function expandAll() {
|
|
|
206
208
|
/>
|
|
207
209
|
<v-btn
|
|
208
210
|
v-if="isModel(item) && hasCollectionsMap[item.id]"
|
|
211
|
+
data-testid="expandModelCollectionsButton"
|
|
209
212
|
icon="mdi-format-list-group"
|
|
210
213
|
size="medium"
|
|
211
214
|
class="ml-2"
|
|
@@ -9,9 +9,9 @@ const attributeItem = defineModel("attributeItem", { type: Number });
|
|
|
9
9
|
const attributeRange = defineModel("attributeRange", { type: Array });
|
|
10
10
|
const attributeColorMap = defineModel("attributeColorMap", { type: String });
|
|
11
11
|
|
|
12
|
-
const { id,
|
|
12
|
+
const { id, componentIds, schema } = defineProps({
|
|
13
13
|
id: { type: String, required: true },
|
|
14
|
-
|
|
14
|
+
componentIds: { type: Array, default: undefined },
|
|
15
15
|
schema: { type: Object, required: true },
|
|
16
16
|
});
|
|
17
17
|
|
|
@@ -64,14 +64,21 @@ function resetRange() {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
function hasSelectedComponent(components) {
|
|
68
|
+
return Array.isArray(components) && components.length > 0;
|
|
69
|
+
}
|
|
70
|
+
|
|
67
71
|
function getAttributes() {
|
|
68
|
-
|
|
72
|
+
const requiresComponent = schema.properties.component_ids !== undefined;
|
|
73
|
+
if (requiresComponent && !hasSelectedComponent(componentIds)) {
|
|
69
74
|
return;
|
|
70
75
|
}
|
|
76
|
+
|
|
71
77
|
const params = { id };
|
|
72
|
-
if (
|
|
73
|
-
params.
|
|
78
|
+
if (requiresComponent) {
|
|
79
|
+
params.component_ids = componentIds;
|
|
74
80
|
}
|
|
81
|
+
|
|
75
82
|
backStore.request(
|
|
76
83
|
{ schema, params },
|
|
77
84
|
{
|
|
@@ -87,7 +94,7 @@ onMounted(() => {
|
|
|
87
94
|
});
|
|
88
95
|
|
|
89
96
|
watch(
|
|
90
|
-
() => [id,
|
|
97
|
+
() => [id, componentIds, schema],
|
|
91
98
|
() => {
|
|
92
99
|
getAttributes();
|
|
93
100
|
},
|
|
@@ -36,9 +36,9 @@ const polyhedron_attribute_color_map = defineModel("polyhedron_attribute_color_m
|
|
|
36
36
|
type: String,
|
|
37
37
|
});
|
|
38
38
|
|
|
39
|
-
const { id,
|
|
39
|
+
const { id, componentIds, capabilities, schemas, allowRandom } = defineProps({
|
|
40
40
|
id: { type: String, required: true },
|
|
41
|
-
|
|
41
|
+
componentIds: { type: Array, default: undefined },
|
|
42
42
|
capabilities: {
|
|
43
43
|
type: Object,
|
|
44
44
|
default: () => ({}),
|
|
@@ -215,7 +215,7 @@ watch(
|
|
|
215
215
|
v-model:attributeRange="vertex_attribute_range"
|
|
216
216
|
v-model:attributeColorMap="vertex_attribute_color_map"
|
|
217
217
|
:id="id"
|
|
218
|
-
:
|
|
218
|
+
:componentIds="componentIds"
|
|
219
219
|
:schema="vertexSchema"
|
|
220
220
|
/>
|
|
221
221
|
</template>
|
|
@@ -226,7 +226,7 @@ watch(
|
|
|
226
226
|
v-model:attributeRange="edge_attribute_range"
|
|
227
227
|
v-model:attributeColorMap="edge_attribute_color_map"
|
|
228
228
|
:id="id"
|
|
229
|
-
:
|
|
229
|
+
:componentIds="componentIds"
|
|
230
230
|
:schema="edgeSchema"
|
|
231
231
|
/>
|
|
232
232
|
</template>
|
|
@@ -237,7 +237,7 @@ watch(
|
|
|
237
237
|
v-model:attributeRange="cell_attribute_range"
|
|
238
238
|
v-model:attributeColorMap="cell_attribute_color_map"
|
|
239
239
|
:id="id"
|
|
240
|
-
:
|
|
240
|
+
:componentIds="componentIds"
|
|
241
241
|
:schema="cellSchema"
|
|
242
242
|
/>
|
|
243
243
|
</template>
|
|
@@ -248,7 +248,7 @@ watch(
|
|
|
248
248
|
v-model:attributeRange="polygon_attribute_range"
|
|
249
249
|
v-model:attributeColorMap="polygon_attribute_color_map"
|
|
250
250
|
:id="id"
|
|
251
|
-
:
|
|
251
|
+
:componentIds="componentIds"
|
|
252
252
|
:schema="polygonSchema"
|
|
253
253
|
/>
|
|
254
254
|
</template>
|
|
@@ -259,7 +259,7 @@ watch(
|
|
|
259
259
|
v-model:attributeRange="polyhedron_attribute_range"
|
|
260
260
|
v-model:attributeColorMap="polyhedron_attribute_color_map"
|
|
261
261
|
:id="id"
|
|
262
|
-
:
|
|
262
|
+
:componentIds="componentIds"
|
|
263
263
|
:schema="polyhedronSchema"
|
|
264
264
|
/>
|
|
265
265
|
</template>
|
|
@@ -2,8 +2,8 @@ import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.jso
|
|
|
2
2
|
import fileDownload from "js-file-download";
|
|
3
3
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
|
|
4
4
|
|
|
5
|
+
import { fetchRaw } from "@ogw_shared/utils/fetch_raw";
|
|
5
6
|
import { importWorkflowFromSnapshot } from "@ogw_front/utils/import_workflow";
|
|
6
|
-
|
|
7
7
|
import { useAppStore } from "@ogw_front/stores/app";
|
|
8
8
|
import { useBackStore } from "@ogw_front/stores/back";
|
|
9
9
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
@@ -21,12 +21,14 @@ async function exportProject() {
|
|
|
21
21
|
const snapshot = await appStore.exportStores();
|
|
22
22
|
const schema = back_schemas.opengeodeweb_back.export_project;
|
|
23
23
|
const defaultName = "project.vease";
|
|
24
|
-
|
|
25
|
-
const result = await
|
|
24
|
+
const params = { snapshot, filename: defaultName };
|
|
25
|
+
const result = await fetchRaw({
|
|
26
|
+
route: schema.$id,
|
|
27
|
+
params,
|
|
28
|
+
method: schema.methods[0],
|
|
26
29
|
baseURL: backStore.base_url,
|
|
27
|
-
method: schema.methods.find((method) => method !== "OPTIONS"),
|
|
28
|
-
body: { snapshot, filename: defaultName },
|
|
29
30
|
});
|
|
31
|
+
|
|
30
32
|
fileDownload(result, defaultName);
|
|
31
33
|
feedbackStore.add_success("Project exported successfully");
|
|
32
34
|
return { result };
|
|
@@ -46,15 +48,15 @@ async function importProject(file) {
|
|
|
46
48
|
if (client && client.getConnection && client.getConnection().getSession) {
|
|
47
49
|
await client.getConnection().getSession().call("opengeodeweb_viewer.release_database", [{}]);
|
|
48
50
|
}
|
|
49
|
-
const
|
|
51
|
+
const resetVisualizationSchema = viewer_schemas.opengeodeweb_viewer.viewer.reset_visualization;
|
|
50
52
|
const timeout = undefined;
|
|
51
|
-
await viewerStore.request({ schema, timeout });
|
|
53
|
+
await viewerStore.request({ schema: resetVisualizationSchema, timeout });
|
|
52
54
|
|
|
53
55
|
treeviewStore.clear();
|
|
54
56
|
dataStore.clear();
|
|
55
57
|
hybridViewerStore.clear();
|
|
56
58
|
|
|
57
|
-
const
|
|
59
|
+
const importProjectSchema = back_schemas.opengeodeweb_back.import_project;
|
|
58
60
|
const form = new FormData();
|
|
59
61
|
const originalFileName = file && file.name ? file.name : "project.vease";
|
|
60
62
|
if (!originalFileName.toLowerCase().endsWith(".vease")) {
|
|
@@ -62,10 +64,11 @@ async function importProject(file) {
|
|
|
62
64
|
}
|
|
63
65
|
form.append("file", file, originalFileName);
|
|
64
66
|
|
|
65
|
-
const result = await
|
|
67
|
+
const result = await fetchRaw({
|
|
68
|
+
route: importProjectSchema.$id,
|
|
69
|
+
params: form,
|
|
70
|
+
method: importProjectSchema.methods[0],
|
|
66
71
|
baseURL: backStore.base_url,
|
|
67
|
-
method: "POST",
|
|
68
|
-
body: form,
|
|
69
72
|
});
|
|
70
73
|
const snapshot = result && result.snapshot ? result.snapshot : {};
|
|
71
74
|
|
package/app/stores/app.js
CHANGED
|
@@ -227,13 +227,16 @@ export const useAppStore = defineStore("app", () => {
|
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
function upload(file, callbacks = {}) {
|
|
230
|
-
const
|
|
230
|
+
const schema = {
|
|
231
|
+
$id: "/api/local/extensions/upload",
|
|
232
|
+
methods: ["OPTIONS", "PUT"],
|
|
233
|
+
};
|
|
231
234
|
const store = useAppStore();
|
|
232
235
|
const { PROJECT: projectName } = useRuntimeConfig().public;
|
|
233
236
|
const params = { projectName };
|
|
234
237
|
return upload_file(
|
|
235
238
|
store,
|
|
236
|
-
{
|
|
239
|
+
{ schema, file, params },
|
|
237
240
|
{
|
|
238
241
|
...callbacks,
|
|
239
242
|
response_function: async (response) => {
|
|
@@ -247,16 +250,13 @@ export const useAppStore = defineStore("app", () => {
|
|
|
247
250
|
}
|
|
248
251
|
|
|
249
252
|
function request({ schema, params }, callbacks = {}) {
|
|
250
|
-
console.log("[APP] Request:", schema.$id);
|
|
251
|
-
|
|
252
253
|
const store = useAppStore();
|
|
253
254
|
return api_fetch(
|
|
254
255
|
store,
|
|
255
|
-
{ schema, params
|
|
256
|
+
{ schema, params },
|
|
256
257
|
{
|
|
257
258
|
...callbacks,
|
|
258
259
|
response_function: async (response) => {
|
|
259
|
-
console.log("[APP] Request completed:", schema.$id);
|
|
260
260
|
if (callbacks.response_function) {
|
|
261
261
|
await callbacks.response_function(response);
|
|
262
262
|
}
|
|
@@ -274,7 +274,8 @@ export const useAppStore = defineStore("app", () => {
|
|
|
274
274
|
}
|
|
275
275
|
const is_busy = computed(() => request_counter.value > 0);
|
|
276
276
|
|
|
277
|
-
const projectFolderPath = ref(
|
|
277
|
+
const projectFolderPath = ref("");
|
|
278
|
+
|
|
278
279
|
function createProjectFolder() {
|
|
279
280
|
const { PROJECT } = useRuntimeConfig().public;
|
|
280
281
|
const schema = {
|
package/app/stores/back.js
CHANGED
|
@@ -104,22 +104,12 @@ export const useBackStore = defineStore("back", {
|
|
|
104
104
|
return Promise.resolve();
|
|
105
105
|
},
|
|
106
106
|
request({ schema, params = {} }, callbacks = {}) {
|
|
107
|
-
console.log("[GEODE] Request:", schema.$id);
|
|
108
|
-
const start = Date.now();
|
|
109
|
-
|
|
110
107
|
return api_fetch(
|
|
111
108
|
this,
|
|
112
109
|
{ schema, params, headers: {} },
|
|
113
110
|
{
|
|
114
111
|
...callbacks,
|
|
115
112
|
response_function: async (response) => {
|
|
116
|
-
console.log(
|
|
117
|
-
"[GEODE] Request completed:",
|
|
118
|
-
schema.$id,
|
|
119
|
-
"in",
|
|
120
|
-
(Date.now() - start) / MILLISECONDS_IN_SECOND,
|
|
121
|
-
"s",
|
|
122
|
-
);
|
|
123
113
|
if (callbacks.response_function) {
|
|
124
114
|
await callbacks.response_function(response);
|
|
125
115
|
}
|
|
@@ -128,17 +118,16 @@ export const useBackStore = defineStore("back", {
|
|
|
128
118
|
);
|
|
129
119
|
},
|
|
130
120
|
upload(file, callbacks = {}) {
|
|
131
|
-
const
|
|
121
|
+
const schema = back_schemas.opengeodeweb_back.upload_file;
|
|
132
122
|
return upload_file(
|
|
133
123
|
this,
|
|
134
124
|
{
|
|
135
|
-
|
|
125
|
+
schema,
|
|
136
126
|
file,
|
|
137
127
|
},
|
|
138
128
|
{
|
|
139
129
|
...callbacks,
|
|
140
130
|
response_function: async (response) => {
|
|
141
|
-
console.log("[GEODE] Request completed:", route);
|
|
142
131
|
if (callbacks.response_function) {
|
|
143
132
|
await callbacks.response_function(response);
|
|
144
133
|
}
|
package/app/stores/cloud.js
CHANGED
|
@@ -43,6 +43,9 @@ export const useCloudStore = defineStore("cloud", {
|
|
|
43
43
|
domain_name: response.url,
|
|
44
44
|
});
|
|
45
45
|
setAppBaseUrl(appStore.base_url);
|
|
46
|
+
appStore.$patch({
|
|
47
|
+
projectFolderPath: "/project",
|
|
48
|
+
});
|
|
46
49
|
},
|
|
47
50
|
response_error_function: () => {
|
|
48
51
|
feedbackStore.$patch({ server_error: true });
|
package/app/stores/infra.js
CHANGED
|
@@ -77,11 +77,6 @@ export const useInfraStore = defineStore("infra", {
|
|
|
77
77
|
},
|
|
78
78
|
async create_connection() {
|
|
79
79
|
console.log("[INFRA] Starting create_connection");
|
|
80
|
-
console.log(
|
|
81
|
-
"[INFRA] Connecting microservices:",
|
|
82
|
-
this.microservices.map((store) => store.$id),
|
|
83
|
-
);
|
|
84
|
-
|
|
85
80
|
await Promise.all(
|
|
86
81
|
this.microservices.map(async (store) => {
|
|
87
82
|
console.log("[INFRA] Connecting to microservice:", store.$id);
|
package/app/stores/viewer.js
CHANGED
|
@@ -156,25 +156,13 @@ export const useViewerStore = defineStore(
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
function request({ schema, params = {}, timeout = request_timeout }, callbacks = {}) {
|
|
159
|
-
console.log("[VIEWER] Request:", schema.$id);
|
|
160
|
-
const start = Date.now();
|
|
161
|
-
|
|
162
|
-
// Get current store instance to pass to viewer_call
|
|
163
159
|
const store = useViewerStore();
|
|
164
|
-
|
|
165
160
|
return viewer_call(
|
|
166
161
|
store,
|
|
167
162
|
{ schema, params, timeout },
|
|
168
163
|
{
|
|
169
164
|
...callbacks,
|
|
170
165
|
response_function: async (response) => {
|
|
171
|
-
console.log(
|
|
172
|
-
"[VIEWER] Request completed:",
|
|
173
|
-
schema.$id,
|
|
174
|
-
"in",
|
|
175
|
-
(Date.now() - start) / MS_PER_SECOND,
|
|
176
|
-
"s",
|
|
177
|
-
);
|
|
178
166
|
if (callbacks.response_function) {
|
|
179
167
|
await callbacks.response_function(response);
|
|
180
168
|
}
|
package/app/utils/extension.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import _ from "lodash";
|
|
5
5
|
|
|
6
6
|
// Local imports
|
|
7
|
+
import { isCloudMode } from "@ogw_front/utils/stores";
|
|
7
8
|
import { useAppStore } from "@ogw_front/stores/app";
|
|
8
9
|
import { useInfraStore } from "@ogw_front/stores/infra";
|
|
9
10
|
|
|
@@ -105,9 +106,9 @@ function runExtensions() {
|
|
|
105
106
|
const { projectFolderPath } = appStore;
|
|
106
107
|
const { PROJECT: projectName } = useRuntimeConfig().public;
|
|
107
108
|
const params = { projectFolderPath, projectName };
|
|
108
|
-
|
|
109
|
+
const endpoint = isCloudMode() ? "cloud" : "local";
|
|
109
110
|
const schema = {
|
|
110
|
-
$id:
|
|
111
|
+
$id: `/api/${endpoint}/extensions/run`,
|
|
111
112
|
methods: ["POST"],
|
|
112
113
|
type: "object",
|
|
113
114
|
properties: {
|
|
@@ -130,7 +131,7 @@ function killExtension(extensionId) {
|
|
|
130
131
|
console.log(`[AppStore] Killing extension: ${extensionId}`, { params });
|
|
131
132
|
|
|
132
133
|
const schema = {
|
|
133
|
-
$id: "/api/
|
|
134
|
+
$id: "/api/local/extensions/kill",
|
|
134
135
|
methods: ["POST"],
|
|
135
136
|
type: "object",
|
|
136
137
|
properties: {
|
|
@@ -35,13 +35,6 @@ async function importWorkflow(files) {
|
|
|
35
35
|
return results;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
function buildImportItemFromPayloadApi(value, geode_object_type) {
|
|
39
|
-
return {
|
|
40
|
-
geode_object_type,
|
|
41
|
-
...value,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
|
|
45
38
|
async function importItem(item) {
|
|
46
39
|
const dataStore = useDataStore();
|
|
47
40
|
const dataStyleStore = useDataStyleStore();
|
|
@@ -94,8 +87,7 @@ async function importFile(filename, geode_object_type) {
|
|
|
94
87
|
filename,
|
|
95
88
|
};
|
|
96
89
|
const response = await backStore.request({ schema, params });
|
|
97
|
-
|
|
98
|
-
return importItem(item);
|
|
90
|
+
return importItem(response);
|
|
99
91
|
}
|
|
100
92
|
|
|
101
93
|
async function importWorkflowFromSnapshot(items) {
|
package/app/utils/log.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
function startRequestLog(microservice, schema) {
|
|
2
|
+
console.log(`[${microservice.$id}] Request:`, schema.$id);
|
|
3
|
+
const requestStartingTime = new Date(Date.now());
|
|
4
|
+
return requestStartingTime;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function endRequestLog(microservice, schema, requestStartingTime) {
|
|
8
|
+
const requestEndingTime = new Date(Date.now());
|
|
9
|
+
console.log(
|
|
10
|
+
`[${microservice.$id}] Request completed:`,
|
|
11
|
+
schema.$id,
|
|
12
|
+
"in",
|
|
13
|
+
requestEndingTime.getSeconds() - requestStartingTime.getSeconds(),
|
|
14
|
+
"s",
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export { startRequestLog, endRequestLog };
|