@geode/opengeodeweb-front 10.0.2-rc.1 → 10.0.2-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/app/components/CrsSelector.vue +5 -7
- package/app/components/ExtensionSelector.vue +14 -19
- package/app/components/FileSelector.vue +5 -10
- package/app/components/FileUploader.vue +1 -0
- package/app/components/Inspector/InspectionButton.vue +8 -10
- package/app/components/MissingFilesSelector.vue +9 -19
- package/app/components/ObjectSelector.vue +3 -3
- package/app/components/PackagesVersions.vue +10 -22
- package/app/components/RemoteRenderingView.vue +12 -12
- package/app/components/Screenshot.vue +6 -7
- package/app/components/VeaseViewToolbar.vue +4 -7
- package/app/components/ViewToolbar.vue +6 -10
- package/app/components/Viewer/Options/CellAttributeSelector.vue +4 -5
- package/app/components/Viewer/Options/PolygonAttributeSelector.vue +4 -5
- package/app/components/Viewer/Options/PolyhedronAttributeSelector.vue +4 -7
- package/app/components/Viewer/Options/TextureItem.vue +6 -8
- package/app/components/Viewer/Options/VertexAttributeSelector.vue +3 -7
- package/app/composables/project_manager.js +8 -12
- package/app/stores/data_base.js +10 -16
- package/app/stores/data_style.js +3 -3
- package/app/stores/geode.js +30 -4
- package/app/stores/hybrid_viewer.js +18 -18
- package/app/stores/infra.js +59 -44
- package/app/stores/lambda.js +63 -0
- package/app/stores/viewer.js +34 -7
- package/app/utils/file_import_workflow.js +9 -8
- package/app/{composables → utils}/upload_file.js +6 -6
- package/{internal_stores → internal/stores}/mesh/cells.js +20 -20
- package/{internal_stores → internal/stores}/mesh/edges.js +12 -6
- package/{internal_stores → internal/stores}/mesh/index.js +4 -5
- package/{internal_stores → internal/stores}/mesh/points.js +16 -11
- package/{internal_stores → internal/stores}/mesh/polygons.js +20 -19
- package/{internal_stores → internal/stores}/mesh/polyhedra.js +17 -19
- package/{internal_stores → internal/stores}/model/blocks.js +8 -10
- package/{internal_stores → internal/stores}/model/corners.js +8 -10
- package/{internal_stores → internal/stores}/model/edges.js +4 -5
- package/{internal_stores → internal/stores}/model/index.js +8 -10
- package/{internal_stores → internal/stores}/model/lines.js +8 -10
- package/{internal_stores → internal/stores}/model/points.js +8 -10
- package/{internal_stores → internal/stores}/model/surfaces.js +8 -10
- package/{app/composables → internal/utils}/api_fetch.js +11 -11
- package/{app/composables → internal/utils}/viewer_call.js +5 -5
- package/nuxt.config.js +1 -1
- package/package.json +1 -1
- package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +12 -21
- package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +6 -11
- package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +3 -6
- package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +9 -16
- package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +12 -21
- package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +6 -11
- package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +6 -11
- package/tests/integration/stores/data_style/model/corners.nuxt.test.js +6 -11
- package/tests/integration/stores/data_style/model/edges.nuxt.test.js +3 -6
- package/tests/integration/stores/data_style/model/index.nuxt.test.js +3 -6
- package/tests/integration/stores/data_style/model/lines.nuxt.test.js +6 -11
- package/tests/integration/stores/data_style/model/points.nuxt.test.js +6 -12
- package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +6 -11
- package/tests/unit/components/CrsSelector.nuxt.test.js +10 -7
- package/tests/unit/components/ExtensionSelector.nuxt.test.js +17 -2
- package/tests/unit/components/FileSelector.nuxt.test.js +2 -2
- package/tests/unit/components/FileUploader.nuxt.test.js +2 -2
- package/tests/unit/components/Inspector/InspectionButton.nuxt.test.js +12 -7
- package/tests/unit/components/MissingFilesSelector.nuxt.test.js +20 -9
- package/tests/unit/components/ObjectSelector.nuxt.test.js +2 -2
- package/tests/unit/components/PackagesVersions.nuxt.test.js +2 -2
- package/tests/unit/composables/ProjectManager.nuxt.test.js +9 -11
- package/tests/unit/composables/api_fetch.nuxt.test.js +17 -40
- package/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js +27 -12
- package/tests/unit/composables/upload_file.nuxt.test.js +3 -3
- package/tests/unit/plugins/project_load.nuxt.test.js +2 -3
- package/tests/unit/stores/Geode.nuxt.test.js +47 -49
- package/tests/unit/stores/Infra.nuxt.test.js +196 -66
- package/tests/unit/stores/Lambda.nuxt.test.js +131 -0
- package/tests/unit/stores/Viewer.nuxt.test.js +48 -46
- /package/{internal_stores → internal/stores}/data_style_state.js +0 -0
- /package/tests/unit/stores/{Appstore.nuxt.test.js → App.nuxt.test.js} +0 -0
package/app/stores/geode.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
|
|
2
2
|
import Status from "@ogw_front/utils/status.js"
|
|
3
3
|
import { appMode } from "@ogw_front/utils/app_mode.js"
|
|
4
|
+
import { api_fetch } from "../../internal/utils/api_fetch.js"
|
|
4
5
|
|
|
5
6
|
export const useGeodeStore = defineStore("geode", {
|
|
6
7
|
state: () => ({
|
|
@@ -49,7 +50,7 @@ export const useGeodeStore = defineStore("geode", {
|
|
|
49
50
|
}, 10 * 1000)
|
|
50
51
|
},
|
|
51
52
|
do_ping() {
|
|
52
|
-
const
|
|
53
|
+
const geodeStore = this
|
|
53
54
|
const feedback_store = useFeedbackStore()
|
|
54
55
|
return useFetch(back_schemas.opengeodeweb_back.ping.$id, {
|
|
55
56
|
baseURL: this.base_url,
|
|
@@ -57,17 +58,17 @@ export const useGeodeStore = defineStore("geode", {
|
|
|
57
58
|
body: {},
|
|
58
59
|
onRequestError({ error }) {
|
|
59
60
|
feedback_store.$patch({ server_error: true })
|
|
60
|
-
|
|
61
|
+
geodeStore.status = Status.NOT_CONNECTED
|
|
61
62
|
},
|
|
62
63
|
onResponse({ response }) {
|
|
63
64
|
if (response.ok) {
|
|
64
65
|
feedback_store.$patch({ server_error: false })
|
|
65
|
-
|
|
66
|
+
geodeStore.status = Status.CONNECTED
|
|
66
67
|
}
|
|
67
68
|
},
|
|
68
69
|
onResponseError({ response }) {
|
|
69
70
|
feedback_store.$patch({ server_error: true })
|
|
70
|
-
|
|
71
|
+
geodeStore.status = Status.NOT_CONNECTED
|
|
71
72
|
},
|
|
72
73
|
})
|
|
73
74
|
},
|
|
@@ -77,6 +78,31 @@ export const useGeodeStore = defineStore("geode", {
|
|
|
77
78
|
stop_request() {
|
|
78
79
|
this.request_counter--
|
|
79
80
|
},
|
|
81
|
+
launch() {
|
|
82
|
+
console.log("[GEODE] Launching geode microservice...")
|
|
83
|
+
return window.electronAPI.run_back()
|
|
84
|
+
},
|
|
85
|
+
connect() {
|
|
86
|
+
console.log("[GEODE] Connecting to geode microservice...")
|
|
87
|
+
return this.do_ping()
|
|
88
|
+
},
|
|
89
|
+
request(schema, params, callbacks = {}) {
|
|
90
|
+
console.log("[GEODE] Request:", schema.$id)
|
|
91
|
+
|
|
92
|
+
return api_fetch(
|
|
93
|
+
this,
|
|
94
|
+
{ schema, params },
|
|
95
|
+
{
|
|
96
|
+
...callbacks,
|
|
97
|
+
response_function: async (response) => {
|
|
98
|
+
console.log("[GEODE] Request completed:", schema.$id)
|
|
99
|
+
if (callbacks.response_function) {
|
|
100
|
+
await callbacks.response_function(response)
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
)
|
|
105
|
+
},
|
|
80
106
|
},
|
|
81
107
|
share: {
|
|
82
108
|
omit: ["status"],
|
|
@@ -6,6 +6,7 @@ import vtkActor from "@kitware/vtk.js/Rendering/Core/Actor"
|
|
|
6
6
|
|
|
7
7
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
|
|
8
8
|
import Status from "@ogw_front/utils/status.js"
|
|
9
|
+
import { viewer_call } from "../../internal/utils/viewer_call.js"
|
|
9
10
|
|
|
10
11
|
export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
11
12
|
const viewerStore = useViewerStore()
|
|
@@ -91,11 +92,9 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
91
92
|
genericRenderWindow.value.getRenderWindow().render()
|
|
92
93
|
const schema = viewer_schemas?.opengeodeweb_viewer?.viewer?.set_z_scaling
|
|
93
94
|
if (!schema) return
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
z_scale: z_scale,
|
|
98
|
-
},
|
|
95
|
+
const viewerStore = useViewerStore()
|
|
96
|
+
await viewerStore.request(schema, {
|
|
97
|
+
z_scale: z_scale,
|
|
99
98
|
})
|
|
100
99
|
remoteRender()
|
|
101
100
|
}
|
|
@@ -114,11 +113,10 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
114
113
|
distance: camera.getDistance(),
|
|
115
114
|
},
|
|
116
115
|
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
},
|
|
116
|
+
const viewerStore = useViewerStore()
|
|
117
|
+
viewerStore.request(
|
|
118
|
+
viewer_schemas.opengeodeweb_viewer.viewer.update_camera,
|
|
119
|
+
params,
|
|
122
120
|
{
|
|
123
121
|
response_function: () => {
|
|
124
122
|
remoteRender()
|
|
@@ -131,9 +129,8 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
131
129
|
}
|
|
132
130
|
|
|
133
131
|
function remoteRender() {
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
})
|
|
132
|
+
const viewerStore = useViewerStore()
|
|
133
|
+
viewerStore.request(viewer_schemas.opengeodeweb_viewer.viewer.render)
|
|
137
134
|
}
|
|
138
135
|
|
|
139
136
|
function setContainer(container) {
|
|
@@ -216,6 +213,10 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
216
213
|
}
|
|
217
214
|
|
|
218
215
|
const importStores = (snapshot) => {
|
|
216
|
+
if (!snapshot) {
|
|
217
|
+
console.warn("importStores called with undefined snapshot")
|
|
218
|
+
return
|
|
219
|
+
}
|
|
219
220
|
const z_scale = snapshot.zScale
|
|
220
221
|
|
|
221
222
|
const applyCamera = () => {
|
|
@@ -244,11 +245,10 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
|
|
|
244
245
|
clipping_range: camera_options.clipping_range,
|
|
245
246
|
},
|
|
246
247
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
},
|
|
248
|
+
const viewerStore = useViewerStore()
|
|
249
|
+
return viewerStore.request(
|
|
250
|
+
viewer_schemas.opengeodeweb_viewer.viewer.update_camera,
|
|
251
|
+
payload,
|
|
252
252
|
{
|
|
253
253
|
response_function: () => {
|
|
254
254
|
remoteRender()
|
package/app/stores/infra.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { useStorage } from "@vueuse/core"
|
|
2
1
|
import Status from "@ogw_front/utils/status.js"
|
|
3
2
|
import { appMode, getAppMode } from "@ogw_front/utils/app_mode.js"
|
|
4
3
|
|
|
5
4
|
export const useInfraStore = defineStore("infra", {
|
|
6
5
|
state: () => ({
|
|
7
6
|
app_mode: getAppMode(),
|
|
8
|
-
ID:
|
|
7
|
+
ID: "",
|
|
9
8
|
is_captcha_validated: false,
|
|
10
9
|
status: Status.NOT_CREATED,
|
|
10
|
+
microservices: [],
|
|
11
11
|
}),
|
|
12
12
|
getters: {
|
|
13
13
|
domain_name() {
|
|
@@ -16,69 +16,84 @@ export const useInfraStore = defineStore("infra", {
|
|
|
16
16
|
}
|
|
17
17
|
return "localhost"
|
|
18
18
|
},
|
|
19
|
-
lambda_url() {
|
|
20
|
-
const geode_store = useGeodeStore()
|
|
21
|
-
const public_runtime_config = useRuntimeConfig().public
|
|
22
|
-
const url =
|
|
23
|
-
geode_store.protocol +
|
|
24
|
-
"://" +
|
|
25
|
-
this.domain_name +
|
|
26
|
-
":" +
|
|
27
|
-
geode_store.port +
|
|
28
|
-
public_runtime_config.SITE_BRANCH +
|
|
29
|
-
public_runtime_config.PROJECT +
|
|
30
|
-
"/createbackend"
|
|
31
|
-
return url
|
|
32
|
-
},
|
|
33
19
|
microservices_connected() {
|
|
34
|
-
return (
|
|
35
|
-
|
|
36
|
-
useViewerStore().status == Status.CONNECTED
|
|
20
|
+
return this.microservices.every(
|
|
21
|
+
(store) => store.status === Status.CONNECTED,
|
|
37
22
|
)
|
|
38
23
|
},
|
|
39
24
|
microservices_busy() {
|
|
40
|
-
return
|
|
25
|
+
return this.microservices.some((store) => store.is_busy === true)
|
|
41
26
|
},
|
|
42
27
|
},
|
|
43
28
|
actions: {
|
|
29
|
+
register_microservice(store) {
|
|
30
|
+
const store_name = store.$id
|
|
31
|
+
console.log("[INFRA] Registering microservice:", store_name)
|
|
32
|
+
|
|
33
|
+
if (!this.microservices.find((store) => store.$id === store_name)) {
|
|
34
|
+
this.microservices.push(store)
|
|
35
|
+
console.log("[INFRA] Microservice registered:", store_name)
|
|
36
|
+
}
|
|
37
|
+
},
|
|
44
38
|
async create_backend() {
|
|
45
|
-
console.log("create_backend
|
|
39
|
+
console.log("[INFRA] Starting create_backend - Mode:", this.app_mode)
|
|
40
|
+
console.log(
|
|
41
|
+
"[INFRA] Registered microservices:",
|
|
42
|
+
this.microservices.map((store) => store.$id),
|
|
43
|
+
)
|
|
44
|
+
|
|
46
45
|
if (this.status === Status.CREATED) return
|
|
46
|
+
|
|
47
47
|
return navigator.locks.request("infra.create_backend", async (lock) => {
|
|
48
48
|
this.status = Status.CREATING
|
|
49
49
|
if (this.status === Status.CREATED) return
|
|
50
|
-
console.log("
|
|
50
|
+
console.log("[INFRA] Lock granted for create_backend")
|
|
51
|
+
|
|
51
52
|
if (this.app_mode == appMode.DESKTOP) {
|
|
52
|
-
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
53
|
+
console.log("[INFRA] DESKTOP mode - Launching microservices...")
|
|
54
|
+
const microservices_with_launch = this.microservices.filter(
|
|
55
|
+
(store) => store.launch,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
const port_promises = microservices_with_launch.map((store) =>
|
|
59
|
+
store.launch(),
|
|
60
|
+
)
|
|
61
|
+
const ports = await Promise.all(port_promises)
|
|
62
|
+
|
|
63
|
+
microservices_with_launch.forEach((store, index) => {
|
|
64
|
+
store.$patch({ default_local_port: ports[index] })
|
|
63
65
|
})
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
this.ID = data.value.ID
|
|
71
|
-
localStorage.setItem("ID", data.value.ID)
|
|
66
|
+
} else if (this.app_mode == appMode.CLOUD) {
|
|
67
|
+
console.log("[INFRA] CLOUD mode - Launching lambda...")
|
|
68
|
+
const lambdaStore = useLambdaStore()
|
|
69
|
+
this.ID = await lambdaStore.launch()
|
|
70
|
+
console.log("[INFRA] Lambda launched successfully")
|
|
72
71
|
}
|
|
72
|
+
|
|
73
73
|
this.status = Status.CREATED
|
|
74
|
+
console.log("[INFRA] Backend created successfully")
|
|
74
75
|
return this.create_connection()
|
|
75
76
|
})
|
|
76
77
|
},
|
|
77
78
|
async create_connection() {
|
|
78
|
-
console.log("create_connection")
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
console.log("[INFRA] Starting create_connection")
|
|
80
|
+
console.log(
|
|
81
|
+
"[INFRA] Connecting microservices:",
|
|
82
|
+
this.microservices.map((store) => store.$id),
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
const connection_promises = this.microservices.map((store) => {
|
|
86
|
+
return store.connect().then(() => {
|
|
87
|
+
console.log("[INFRA] Microservice connected:", store.$id)
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
await Promise.all(connection_promises)
|
|
92
|
+
console.log("[INFRA] All microservices connected")
|
|
81
93
|
return
|
|
82
94
|
},
|
|
83
95
|
},
|
|
96
|
+
share: {
|
|
97
|
+
omit: ["microservices"],
|
|
98
|
+
},
|
|
84
99
|
})
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import Status from "@ogw_front/utils/status.js"
|
|
2
|
+
|
|
3
|
+
export const useLambdaStore = defineStore("lambda", {
|
|
4
|
+
state: () => ({
|
|
5
|
+
status: Status.NOT_CONNECTED,
|
|
6
|
+
}),
|
|
7
|
+
getters: {
|
|
8
|
+
protocol() {
|
|
9
|
+
return "https"
|
|
10
|
+
},
|
|
11
|
+
port() {
|
|
12
|
+
return "443"
|
|
13
|
+
},
|
|
14
|
+
base_url() {
|
|
15
|
+
const public_runtime_config = useRuntimeConfig().public
|
|
16
|
+
const domain_name = public_runtime_config.API_URL
|
|
17
|
+
const url =
|
|
18
|
+
this.protocol +
|
|
19
|
+
"://" +
|
|
20
|
+
domain_name +
|
|
21
|
+
":" +
|
|
22
|
+
this.port +
|
|
23
|
+
public_runtime_config.SITE_BRANCH +
|
|
24
|
+
public_runtime_config.PROJECT +
|
|
25
|
+
"/createbackend"
|
|
26
|
+
return url
|
|
27
|
+
},
|
|
28
|
+
is_busy() {
|
|
29
|
+
return false
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
actions: {
|
|
33
|
+
async launch() {
|
|
34
|
+
console.log("[LAMBDA] Launching lambda backend...")
|
|
35
|
+
const feedbackStore = useFeedbackStore()
|
|
36
|
+
|
|
37
|
+
const { data, error } = await useFetch(this.base_url, {
|
|
38
|
+
method: "POST",
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
if (error.value || !data.value) {
|
|
42
|
+
this.status = Status.NOT_CONNECTED
|
|
43
|
+
feedbackStore.server_error = true
|
|
44
|
+
console.error("[LAMBDA] Failed to launch lambda backend", error.value)
|
|
45
|
+
throw new Error("Failed to launch lambda backend")
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
this.status = Status.CONNECTED
|
|
49
|
+
const id = data.value.ID
|
|
50
|
+
|
|
51
|
+
console.log("[LAMBDA] Lambda launched, ID:", id)
|
|
52
|
+
return id
|
|
53
|
+
},
|
|
54
|
+
async connect() {
|
|
55
|
+
console.log("[LAMBDA] Lambda connected")
|
|
56
|
+
this.status = Status.CONNECTED
|
|
57
|
+
return Promise.resolve()
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
share: {
|
|
61
|
+
omit: ["status"],
|
|
62
|
+
},
|
|
63
|
+
})
|
package/app/stores/viewer.js
CHANGED
|
@@ -4,6 +4,7 @@ import "@kitware/vtk.js/Rendering/OpenGL/Profiles/Geometry"
|
|
|
4
4
|
import schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
|
|
5
5
|
import Status from "@ogw_front/utils/status.js"
|
|
6
6
|
import { appMode } from "@ogw_front/utils/app_mode.js"
|
|
7
|
+
import { viewer_call } from "../../internal/utils/viewer_call.js"
|
|
7
8
|
|
|
8
9
|
export const useViewerStore = defineStore("viewer", {
|
|
9
10
|
state: () => ({
|
|
@@ -107,25 +108,23 @@ export const useViewerStore = defineStore("viewer", {
|
|
|
107
108
|
// Connect
|
|
108
109
|
const { connectImageStream } =
|
|
109
110
|
await import("@kitware/vtk.js/Rendering/Misc/RemoteView")
|
|
110
|
-
const
|
|
111
|
+
const viewerStore = this
|
|
111
112
|
return new Promise((resolve, reject) => {
|
|
112
113
|
clientToConnect
|
|
113
114
|
.connect(config)
|
|
114
115
|
.then((validClient) => {
|
|
115
116
|
connectImageStream(validClient.getConnection().getSession())
|
|
116
|
-
|
|
117
|
+
viewerStore.client = validClient
|
|
117
118
|
clientToConnect.endBusy()
|
|
118
|
-
|
|
119
|
-
// Now that the client is ready let's setup the server for us
|
|
120
|
-
viewer_call({
|
|
119
|
+
viewer_call(viewerStore, {
|
|
121
120
|
schema: schemas.opengeodeweb_viewer.viewer.reset_visualization,
|
|
122
121
|
})
|
|
123
|
-
|
|
122
|
+
viewerStore.status = Status.CONNECTED
|
|
124
123
|
resolve()
|
|
125
124
|
})
|
|
126
125
|
.catch((error) => {
|
|
127
126
|
console.error("error", error)
|
|
128
|
-
|
|
127
|
+
viewerStore.status = Status.NOT_CONNECTED
|
|
129
128
|
reject(error)
|
|
130
129
|
})
|
|
131
130
|
})
|
|
@@ -137,6 +136,34 @@ export const useViewerStore = defineStore("viewer", {
|
|
|
137
136
|
stop_request() {
|
|
138
137
|
this.request_counter--
|
|
139
138
|
},
|
|
139
|
+
async launch() {
|
|
140
|
+
console.log("[VIEWER] Launching viewer microservice...")
|
|
141
|
+
const port = await window.electronAPI.run_viewer()
|
|
142
|
+
console.log("[VIEWER] Viewer launched on port:", port)
|
|
143
|
+
return port
|
|
144
|
+
},
|
|
145
|
+
async connect() {
|
|
146
|
+
console.log("[VIEWER] Connecting to viewer microservice...")
|
|
147
|
+
await this.ws_connect()
|
|
148
|
+
console.log("[VIEWER] Viewer connected successfully")
|
|
149
|
+
},
|
|
150
|
+
request(schema, params = {}, callbacks = {}) {
|
|
151
|
+
console.log("[VIEWER] Request:", schema.$id)
|
|
152
|
+
|
|
153
|
+
return viewer_call(
|
|
154
|
+
this,
|
|
155
|
+
{ schema, params },
|
|
156
|
+
{
|
|
157
|
+
...callbacks,
|
|
158
|
+
response_function: async (response) => {
|
|
159
|
+
console.log("[VIEWER] Request completed:", schema.$id)
|
|
160
|
+
if (callbacks.response_function) {
|
|
161
|
+
await callbacks.response_function(response)
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
)
|
|
166
|
+
},
|
|
140
167
|
},
|
|
141
168
|
share: {
|
|
142
169
|
omit: ["status", "client"],
|
|
@@ -57,18 +57,19 @@ async function importItem(item) {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
async function importFile(filename, geode_object_type) {
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
const geodeStore = useGeodeStore()
|
|
61
|
+
const response = await geodeStore.request(
|
|
62
|
+
back_schemas.opengeodeweb_back.save_viewable_file,
|
|
63
|
+
{
|
|
63
64
|
geode_object_type,
|
|
64
65
|
filename,
|
|
65
66
|
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
console.log("data.value", data.value)
|
|
69
|
-
console.log("data.value", data._value)
|
|
67
|
+
)
|
|
70
68
|
|
|
71
|
-
const item = buildImportItemFromPayloadApi(
|
|
69
|
+
const item = buildImportItemFromPayloadApi(
|
|
70
|
+
response.data.value,
|
|
71
|
+
geode_object_type,
|
|
72
|
+
)
|
|
72
73
|
return importItem(item)
|
|
73
74
|
}
|
|
74
75
|
|
|
@@ -3,7 +3,7 @@ export async function upload_file(
|
|
|
3
3
|
{ request_error_function, response_function, response_error_function } = {},
|
|
4
4
|
) {
|
|
5
5
|
const feedback_store = useFeedbackStore()
|
|
6
|
-
const
|
|
6
|
+
const geodeStore = useGeodeStore()
|
|
7
7
|
if (!(file instanceof File)) {
|
|
8
8
|
throw new Error("file must be a instance of File")
|
|
9
9
|
}
|
|
@@ -16,12 +16,12 @@ export async function upload_file(
|
|
|
16
16
|
body: body,
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
geodeStore.start_request()
|
|
20
20
|
return $fetch(route, {
|
|
21
|
-
baseURL:
|
|
21
|
+
baseURL: geodeStore.base_url,
|
|
22
22
|
...request_options,
|
|
23
23
|
onRequestError({ error }) {
|
|
24
|
-
|
|
24
|
+
geodeStore.stop_request()
|
|
25
25
|
feedback_store.add_error(error.code, route, error.message, error.stack)
|
|
26
26
|
if (request_error_function) {
|
|
27
27
|
request_error_function(error)
|
|
@@ -29,14 +29,14 @@ export async function upload_file(
|
|
|
29
29
|
},
|
|
30
30
|
onResponse({ response }) {
|
|
31
31
|
if (response.ok) {
|
|
32
|
-
|
|
32
|
+
geodeStore.stop_request()
|
|
33
33
|
if (response_function) {
|
|
34
34
|
response_function(response)
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
onResponseError({ response }) {
|
|
39
|
-
|
|
39
|
+
geodeStore.stop_request()
|
|
40
40
|
feedback_store.add_error(
|
|
41
41
|
response.status,
|
|
42
42
|
route,
|
|
@@ -3,7 +3,6 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
|
|
|
3
3
|
|
|
4
4
|
// Local constants
|
|
5
5
|
const mesh_cells_schemas = viewer_schemas.opengeodeweb_viewer.mesh.cells
|
|
6
|
-
|
|
7
6
|
export function useMeshCellsStyle() {
|
|
8
7
|
const dataStyleStore = useDataStyleStore()
|
|
9
8
|
|
|
@@ -16,8 +15,10 @@ export function useMeshCellsStyle() {
|
|
|
16
15
|
}
|
|
17
16
|
function setMeshCellsVisibility(id, visibility) {
|
|
18
17
|
const cells_style = meshCellsStyle(id)
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const viewerStore = useViewerStore()
|
|
19
|
+
return viewerStore.request(
|
|
20
|
+
mesh_cells_schemas.visibility,
|
|
21
|
+
{ id, visibility },
|
|
21
22
|
{
|
|
22
23
|
response_function: () => {
|
|
23
24
|
cells_style.visibility = visibility
|
|
@@ -36,8 +37,10 @@ export function useMeshCellsStyle() {
|
|
|
36
37
|
}
|
|
37
38
|
function setMeshCellsColor(id, color) {
|
|
38
39
|
const coloring_style = meshCellsStyle(id).coloring
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
const viewerStore = useViewerStore()
|
|
41
|
+
return viewerStore.request(
|
|
42
|
+
mesh_cells_schemas.color,
|
|
43
|
+
{ id, color },
|
|
41
44
|
{
|
|
42
45
|
response_function: () => {
|
|
43
46
|
coloring_style.color = color
|
|
@@ -56,11 +59,10 @@ export function useMeshCellsStyle() {
|
|
|
56
59
|
}
|
|
57
60
|
function setMeshCellsTextures(id, textures) {
|
|
58
61
|
const coloring_style = meshCellsStyle(id).coloring
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
},
|
|
62
|
+
const viewerStore = useViewerStore()
|
|
63
|
+
return viewerStore.request(
|
|
64
|
+
mesh_cells_schemas.apply_textures,
|
|
65
|
+
{ id, textures },
|
|
64
66
|
{
|
|
65
67
|
response_function: () => {
|
|
66
68
|
coloring_style.textures = textures
|
|
@@ -76,11 +78,10 @@ export function useMeshCellsStyle() {
|
|
|
76
78
|
|
|
77
79
|
function setMeshCellsVertexAttribute(id, vertex_attribute) {
|
|
78
80
|
const coloring_style = meshCellsStyle(id).coloring
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
},
|
|
81
|
+
const viewerStore = useViewerStore()
|
|
82
|
+
return viewerStore.request(
|
|
83
|
+
mesh_cells_schemas.vertex_attribute,
|
|
84
|
+
{ id, ...vertex_attribute },
|
|
84
85
|
{
|
|
85
86
|
response_function: () => {
|
|
86
87
|
coloring_style.vertex = vertex_attribute
|
|
@@ -99,11 +100,10 @@ export function useMeshCellsStyle() {
|
|
|
99
100
|
}
|
|
100
101
|
function setMeshCellsCellAttribute(id, cell_attribute) {
|
|
101
102
|
const coloring_style = meshCellsStyle(id).coloring
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
},
|
|
103
|
+
const viewerStore = useViewerStore()
|
|
104
|
+
return viewerStore.request(
|
|
105
|
+
mesh_cells_schemas.cell_attribute,
|
|
106
|
+
{ id, ...cell_attribute },
|
|
107
107
|
{
|
|
108
108
|
response_function: () => {
|
|
109
109
|
coloring_style.cell = cell_attribute
|
|
@@ -15,8 +15,10 @@ export function useMeshEdgesStyle() {
|
|
|
15
15
|
return meshEdgesStyle(id).visibility
|
|
16
16
|
}
|
|
17
17
|
function setMeshEdgesVisibility(id, visibility) {
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
const viewerStore = useViewerStore()
|
|
19
|
+
return viewerStore.request(
|
|
20
|
+
mesh_edges_schemas.visibility,
|
|
21
|
+
{ id, visibility },
|
|
20
22
|
{
|
|
21
23
|
response_function: () => {
|
|
22
24
|
meshEdgesStyle(id).visibility = visibility
|
|
@@ -57,8 +59,10 @@ export function useMeshEdgesStyle() {
|
|
|
57
59
|
}
|
|
58
60
|
function setMeshEdgesColor(id, color) {
|
|
59
61
|
const coloring_style = meshEdgesStyle(id).coloring
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
const viewerStore = useViewerStore()
|
|
63
|
+
return viewerStore.request(
|
|
64
|
+
mesh_edges_schemas.color,
|
|
65
|
+
{ id, color },
|
|
62
66
|
{
|
|
63
67
|
response_function: () => {
|
|
64
68
|
coloring_style.color = color
|
|
@@ -77,8 +81,10 @@ export function useMeshEdgesStyle() {
|
|
|
77
81
|
}
|
|
78
82
|
function setMeshEdgesWidth(id, width) {
|
|
79
83
|
const edges_style = meshEdgesStyle(id)
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
const viewerStore = useViewerStore()
|
|
85
|
+
return viewerStore.request(
|
|
86
|
+
mesh_edges_schemas.width,
|
|
87
|
+
{ id, width },
|
|
82
88
|
{
|
|
83
89
|
response_function: () => {
|
|
84
90
|
edges_style.width = width
|
|
@@ -24,11 +24,10 @@ export default function useMeshStyle() {
|
|
|
24
24
|
return dataStyleStore.getStyle(id).visibility
|
|
25
25
|
}
|
|
26
26
|
function setMeshVisibility(id, visibility) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
27
|
+
const viewerStore = useViewerStore()
|
|
28
|
+
return viewerStore.request(
|
|
29
|
+
mesh_schemas.visibility,
|
|
30
|
+
{ id, visibility },
|
|
32
31
|
{
|
|
33
32
|
response_function: () => {
|
|
34
33
|
hybridViewerStore.setVisibility(id, visibility)
|