@geode/opengeodeweb-front 10.3.0 → 10.3.1
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/.eslintrc.cjs +1 -0
- package/app/assets/geode_objects.js +1 -3
- package/app/components/Carousel.vue +7 -4
- package/app/components/CrsSelector.vue +5 -6
- package/app/components/DragAndDrop.vue +18 -8
- package/app/components/ExtensionSelector.vue +9 -17
- package/app/components/FeedBack/ErrorBanner.vue +1 -1
- package/app/components/FeedBack/Snackers.vue +4 -1
- package/app/components/FileSelector.vue +21 -10
- package/app/components/FileUploader.vue +15 -32
- package/app/components/HybridRenderingView.vue +5 -3
- package/app/components/Inspector/InspectionButton.vue +2 -2
- package/app/components/Inspector/ResultPanel.vue +4 -4
- package/app/components/Launcher.vue +1 -1
- package/app/components/Loading.vue +6 -6
- package/app/components/MissingFilesSelector.vue +23 -29
- package/app/components/ObjectSelector.vue +11 -10
- package/app/components/OptionCard.vue +1 -1
- package/app/components/PackagesVersions.vue +5 -3
- package/app/components/Recaptcha.vue +6 -4
- package/app/components/RemoteRenderingView.vue +4 -3
- package/app/components/Screenshot.vue +4 -4
- package/app/components/Step.vue +7 -7
- package/app/components/VeaseViewToolbar.vue +3 -3
- package/app/components/Viewer/BreadCrumb.vue +2 -4
- package/app/components/Viewer/ContextMenu.vue +77 -45
- package/app/components/Viewer/ContextMenuItem.vue +42 -33
- package/app/components/Viewer/EdgedCurve/PointsOptions.vue +3 -3
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +5 -5
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +6 -6
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +5 -5
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +5 -5
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +6 -7
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +6 -6
- package/app/components/Viewer/Generic/Model/EdgesOptions.vue +3 -3
- package/app/components/Viewer/Generic/Model/PointsOptions.vue +4 -4
- package/app/components/Viewer/Grid/2D/CellsOptions.vue +3 -3
- package/app/components/Viewer/Grid/2D/EdgesOptions.vue +3 -3
- package/app/components/Viewer/Grid/2D/PointsOptions.vue +3 -3
- package/app/components/Viewer/Grid/3D/CellsOptions.vue +3 -3
- package/app/components/Viewer/Grid/3D/EdgesOptions.vue +3 -3
- package/app/components/Viewer/Grid/3D/FacetsOptions.vue +3 -3
- package/app/components/Viewer/Grid/3D/PointsOptions.vue +3 -3
- package/app/components/Viewer/HybridSolid/EdgesOptions.vue +3 -3
- package/app/components/Viewer/HybridSolid/PointsOptions.vue +3 -3
- package/app/components/Viewer/HybridSolid/PolygonsOptions.vue +3 -3
- package/app/components/Viewer/HybridSolid/PolyhedraOptions.vue +3 -3
- package/app/components/Viewer/Options/CellAttributeSelector.vue +23 -20
- package/app/components/Viewer/Options/ColorMapList.vue +75 -50
- package/app/components/Viewer/Options/ColorMapPicker.vue +38 -32
- package/app/components/Viewer/Options/ColorPicker.vue +3 -3
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +29 -21
- package/app/components/Viewer/Options/EdgeAttributeSelector.vue +7 -7
- package/app/components/Viewer/Options/PolygonAttributeSelector.vue +7 -7
- package/app/components/Viewer/Options/PolyhedronAttributeSelector.vue +7 -7
- package/app/components/Viewer/Options/TextureItem.vue +5 -5
- package/app/components/Viewer/Options/TexturesSelector.vue +5 -5
- package/app/components/Viewer/Options/VertexAttributeSelector.vue +7 -7
- package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +5 -5
- package/app/components/Viewer/PolygonalSurface/EdgesOptions.vue +3 -3
- package/app/components/Viewer/PolygonalSurface/PointsOptions.vue +3 -3
- package/app/components/Viewer/PolygonalSurface/SpecificPolygonsOptions.vue +6 -6
- package/app/components/Viewer/Solid/EdgesOptions.vue +3 -3
- package/app/components/Viewer/Solid/PointsOptions.vue +3 -3
- package/app/components/Viewer/Solid/PolygonsOptions.vue +3 -3
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +6 -6
- package/app/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue +3 -3
- package/app/components/Viewer/TetrahedralSolid/TrianglesOptions.vue +3 -3
- package/app/components/Viewer/Tree/ObjectTree.vue +7 -9
- package/app/components/Viewer/TreeComponent.vue +9 -13
- package/app/components/Viewer/TreeObject.vue +8 -9
- package/app/components/Viewer/TriangulatedSurface/EdgesOptions.vue +3 -3
- package/app/components/Viewer/TriangulatedSurface/PointsOptions.vue +3 -3
- package/app/components/Viewer/TriangulatedSurface/TrianglesOptions.vue +3 -3
- package/app/components/Wrapper.vue +1 -2
- package/app/components/ZScaling.vue +1 -1
- package/app/composables/project_manager.js +6 -6
- package/app/plugins/auto_store_register.js +1 -1
- package/app/stores/app.js +45 -41
- package/app/stores/data.js +52 -51
- package/app/stores/data_style.js +12 -11
- package/app/stores/feedback.js +5 -1
- package/app/stores/geode.js +16 -13
- package/app/stores/hybrid_viewer.js +72 -44
- package/app/stores/infra.js +18 -16
- package/app/stores/lambda.js +1 -9
- package/app/stores/menu.js +13 -13
- package/app/stores/treeview.js +15 -13
- package/app/stores/viewer.js +39 -33
- package/app/utils/app_mode.js +4 -3
- package/app/utils/default_styles.js +55 -47
- package/app/utils/file_import_workflow.js +4 -17
- package/app/utils/local.js +195 -184
- package/app/utils/upload_file.js +1 -2
- package/eslint.config.js +2 -2
- package/internal/database/database.js +17 -32
- package/internal/database/extended_database.js +25 -0
- package/internal/stores/data_style/mesh/cells/cell.js +3 -3
- package/internal/stores/data_style/mesh/cells/color.js +1 -1
- package/internal/stores/data_style/mesh/cells/index.js +7 -7
- package/internal/stores/data_style/mesh/cells/textures.js +1 -1
- package/internal/stores/data_style/mesh/cells/vertex.js +3 -3
- package/internal/stores/data_style/mesh/cells/visibility.js +1 -1
- package/internal/stores/data_style/mesh/edges/color.js +1 -1
- package/internal/stores/data_style/mesh/edges/edge.js +22 -22
- package/internal/stores/data_style/mesh/edges/index.js +7 -7
- package/internal/stores/data_style/mesh/edges/vertex.js +3 -3
- package/internal/stores/data_style/mesh/edges/visibility.js +1 -1
- package/internal/stores/data_style/mesh/edges/width.js +1 -1
- package/internal/stores/data_style/mesh/index.js +4 -5
- package/internal/stores/data_style/mesh/points/color.js +1 -1
- package/internal/stores/data_style/mesh/points/index.js +6 -6
- package/internal/stores/data_style/mesh/points/size.js +1 -1
- package/internal/stores/data_style/mesh/points/vertex.js +3 -3
- package/internal/stores/data_style/mesh/points/visibility.js +1 -1
- package/internal/stores/data_style/mesh/polygons/color.js +1 -1
- package/internal/stores/data_style/mesh/polygons/index.js +7 -7
- package/internal/stores/data_style/mesh/polygons/polygon.js +3 -3
- package/internal/stores/data_style/mesh/polygons/textures.js +1 -1
- package/internal/stores/data_style/mesh/polygons/vertex.js +3 -3
- package/internal/stores/data_style/mesh/polygons/visibility.js +1 -1
- package/internal/stores/data_style/mesh/polyhedra/color.js +1 -1
- package/internal/stores/data_style/mesh/polyhedra/index.js +6 -6
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +3 -3
- package/internal/stores/data_style/mesh/polyhedra/vertex.js +3 -3
- package/internal/stores/data_style/mesh/polyhedra/visibility.js +1 -1
- package/internal/stores/data_style/model/edges.js +1 -1
- package/internal/stores/data_style/model/index.js +32 -22
- package/internal/utils/api_fetch.js +8 -5
- package/internal/utils/viewer_call.js +42 -46
- package/nuxt.config.js +3 -3
- package/package.json +1 -1
- package/scripts/generate_geode_objects.js +8 -7
- package/tests/integration/setup.js +28 -21
- package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +18 -10
- package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +18 -10
- package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +9 -5
- package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +17 -10
- package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +18 -10
- package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +18 -10
- package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +10 -6
- package/tests/integration/stores/data_style/model/corners.nuxt.test.js +10 -6
- package/tests/integration/stores/data_style/model/edges.nuxt.test.js +9 -5
- package/tests/integration/stores/data_style/model/index.nuxt.test.js +9 -5
- package/tests/integration/stores/data_style/model/lines.nuxt.test.js +10 -6
- package/tests/integration/stores/data_style/model/points.nuxt.test.js +9 -5
- package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +10 -6
- package/tests/integration/stores/viewer.nuxt.test.js +55 -39
- package/tests/setup_indexeddb.js +1 -0
- package/tests/unit/components/CrsSelector.nuxt.test.js +18 -19
- package/tests/unit/components/ExtensionSelector.nuxt.test.js +24 -19
- package/tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js +23 -36
- package/tests/unit/components/FeedBack/Snackers.nuxt.test.js +20 -25
- package/tests/unit/components/FileSelector.nuxt.test.js +27 -27
- package/tests/unit/components/FileUploader.nuxt.test.js +18 -17
- package/tests/unit/components/Inspector/InspectionButton.nuxt.test.js +9 -16
- package/tests/unit/components/Inspector/ResultPanel.nuxt.test.js +8 -6
- package/tests/unit/components/Launcher.nuxt.test.js +12 -17
- package/tests/unit/components/MissingFilesSelector.nuxt.test.js +16 -19
- package/tests/unit/components/ObjectSelector.nuxt.test.js +30 -34
- package/tests/unit/components/PackagesVersions.nuxt.test.js +8 -11
- package/tests/unit/components/Step.nuxt.test.js +8 -7
- package/tests/unit/components/Stepper.nuxt.test.js +14 -12
- package/tests/unit/composables/ProjectManager.nuxt.test.js +142 -100
- package/tests/unit/composables/api_fetch.nuxt.test.js +12 -39
- package/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js +36 -61
- package/tests/unit/composables/upload_file.nuxt.test.js +21 -25
- package/tests/unit/plugins/project_load.nuxt.test.js +22 -21
- package/tests/unit/stores/App.nuxt.test.js +45 -43
- package/tests/unit/stores/Feedback.nuxt.test.js +16 -18
- package/tests/unit/stores/Geode.nuxt.test.js +135 -137
- package/tests/unit/stores/Infra.nuxt.test.js +20 -26
- package/tests/unit/stores/Lambda.nuxt.test.js +30 -31
- package/tests/unit/stores/Treeview.nuxt.test.js +53 -55
- package/tests/unit/stores/Viewer.nuxt.test.js +16 -23
- package/tests/unit/utils/validate_schema.nuxt.test.js +18 -18
- package/tests/utils.js +15 -2
- package/tests/vitest.config.js +6 -2
package/app/stores/infra.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import Status from "@ogw_front/utils/status"
|
|
2
1
|
import { appMode, getAppMode } from "@ogw_front/utils/app_mode"
|
|
2
|
+
import Status from "@ogw_front/utils/status"
|
|
3
3
|
import { useLambdaStore } from "@ogw_front/stores/lambda"
|
|
4
4
|
|
|
5
5
|
export const useInfraStore = defineStore("infra", {
|
|
@@ -12,7 +12,7 @@ export const useInfraStore = defineStore("infra", {
|
|
|
12
12
|
}),
|
|
13
13
|
getters: {
|
|
14
14
|
domain_name() {
|
|
15
|
-
if (this.app_mode
|
|
15
|
+
if (this.app_mode === appMode.CLOUD) {
|
|
16
16
|
return useRuntimeConfig().public.API_URL
|
|
17
17
|
}
|
|
18
18
|
return "localhost"
|
|
@@ -44,14 +44,18 @@ export const useInfraStore = defineStore("infra", {
|
|
|
44
44
|
this.microservices.map((store) => store.$id),
|
|
45
45
|
)
|
|
46
46
|
|
|
47
|
-
if (this.status === Status.CREATED)
|
|
47
|
+
if (this.status === Status.CREATED) {
|
|
48
|
+
return
|
|
49
|
+
}
|
|
48
50
|
|
|
49
|
-
return navigator.locks.request("infra.create_backend", async (
|
|
51
|
+
return navigator.locks.request("infra.create_backend", async () => {
|
|
50
52
|
this.status = Status.CREATING
|
|
51
|
-
if (this.status === Status.CREATED)
|
|
53
|
+
if (this.status === Status.CREATED) {
|
|
54
|
+
return
|
|
55
|
+
}
|
|
52
56
|
console.log("[INFRA] Lock granted for create_backend")
|
|
53
57
|
|
|
54
|
-
if (this.app_mode
|
|
58
|
+
if (this.app_mode === appMode.DESKTOP) {
|
|
55
59
|
console.log("[INFRA] DESKTOP mode - Launching microservices...")
|
|
56
60
|
const microservices_with_launch = this.microservices.filter(
|
|
57
61
|
(store) => store.launch,
|
|
@@ -62,10 +66,10 @@ export const useInfraStore = defineStore("infra", {
|
|
|
62
66
|
)
|
|
63
67
|
const ports = await Promise.all(port_promises)
|
|
64
68
|
|
|
65
|
-
microservices_with_launch.
|
|
69
|
+
for (const [index, store] of microservices_with_launch.entries()) {
|
|
66
70
|
store.$patch({ default_local_port: ports[index] })
|
|
67
|
-
}
|
|
68
|
-
} else if (this.app_mode
|
|
71
|
+
}
|
|
72
|
+
} else if (this.app_mode === appMode.CLOUD) {
|
|
69
73
|
console.log("[INFRA] CLOUD mode - Launching lambda...")
|
|
70
74
|
const lambdaStore = useLambdaStore()
|
|
71
75
|
this.ID = await lambdaStore.launch()
|
|
@@ -84,15 +88,13 @@ export const useInfraStore = defineStore("infra", {
|
|
|
84
88
|
this.microservices.map((store) => store.$id),
|
|
85
89
|
)
|
|
86
90
|
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
await Promise.all(
|
|
92
|
+
this.microservices.map(async (store) => {
|
|
93
|
+
await store.connect()
|
|
89
94
|
console.log("[INFRA] Microservice connected:", store.$id)
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
await Promise.all(connection_promises)
|
|
95
|
+
}),
|
|
96
|
+
)
|
|
94
97
|
console.log("[INFRA] All microservices connected")
|
|
95
|
-
return
|
|
96
98
|
},
|
|
97
99
|
},
|
|
98
100
|
share: {
|
package/app/stores/lambda.js
CHANGED
|
@@ -15,15 +15,7 @@ export const useLambdaStore = defineStore("lambda", {
|
|
|
15
15
|
base_url() {
|
|
16
16
|
const public_runtime_config = useRuntimeConfig().public
|
|
17
17
|
const domain_name = public_runtime_config.API_URL
|
|
18
|
-
const url =
|
|
19
|
-
this.protocol +
|
|
20
|
-
"://" +
|
|
21
|
-
domain_name +
|
|
22
|
-
":" +
|
|
23
|
-
this.port +
|
|
24
|
-
public_runtime_config.SITE_BRANCH +
|
|
25
|
-
public_runtime_config.PROJECT +
|
|
26
|
-
"/createbackend"
|
|
18
|
+
const url = `${this.protocol}://${domain_name}:${this.port}${public_runtime_config.SITE_BRANCH}${public_runtime_config.PROJECT}/createbackend`
|
|
27
19
|
return url
|
|
28
20
|
},
|
|
29
21
|
is_busy() {
|
package/app/stores/menu.js
CHANGED
|
@@ -2,39 +2,39 @@
|
|
|
2
2
|
import PointSetPointsOptions from "@ogw_front/components/Viewer/PointSet/SpecificPointsOptions"
|
|
3
3
|
|
|
4
4
|
// EdgedCurve components
|
|
5
|
-
import EdgedCurvePointsOptions from "@ogw_front/components/Viewer/EdgedCurve/PointsOptions"
|
|
6
5
|
import EdgedCurveEdgesOptions from "@ogw_front/components/Viewer/EdgedCurve/SpecificEdgesOptions"
|
|
6
|
+
import EdgedCurvePointsOptions from "@ogw_front/components/Viewer/EdgedCurve/PointsOptions"
|
|
7
7
|
|
|
8
8
|
// PolygonalSurface components
|
|
9
|
-
import PolygonalSurfacePointsOptions from "@ogw_front/components/Viewer/PolygonalSurface/PointsOptions"
|
|
10
9
|
import PolygonalSurfaceEdgesOptions from "@ogw_front/components/Viewer/PolygonalSurface/EdgesOptions"
|
|
10
|
+
import PolygonalSurfacePointsOptions from "@ogw_front/components/Viewer/PolygonalSurface/PointsOptions"
|
|
11
11
|
import PolygonalSurfacePolygonsOptions from "@ogw_front/components/Viewer/PolygonalSurface/SpecificPolygonsOptions"
|
|
12
12
|
|
|
13
13
|
// TriangulatedSurface components
|
|
14
|
-
import TriangulatedSurfacePointsOptions from "@ogw_front/components/Viewer/TriangulatedSurface/PointsOptions"
|
|
15
14
|
import TriangulatedSurfaceEdgesOptions from "@ogw_front/components/Viewer/TriangulatedSurface/EdgesOptions"
|
|
15
|
+
import TriangulatedSurfacePointsOptions from "@ogw_front/components/Viewer/TriangulatedSurface/PointsOptions"
|
|
16
16
|
import TriangulatedSurfaceTrianglesOptions from "@ogw_front/components/Viewer/TriangulatedSurface/TrianglesOptions"
|
|
17
17
|
|
|
18
18
|
// Grid 2D components
|
|
19
|
-
import Grid2DPointsOptions from "@ogw_front/components/Viewer/Grid/2D/PointsOptions"
|
|
20
|
-
import Grid2DEdgesOptions from "@ogw_front/components/Viewer/Grid/2D/EdgesOptions"
|
|
21
19
|
import Grid2DCellsOptions from "@ogw_front/components/Viewer/Grid/2D/CellsOptions"
|
|
20
|
+
import Grid2DEdgesOptions from "@ogw_front/components/Viewer/Grid/2D/EdgesOptions"
|
|
21
|
+
import Grid2DPointsOptions from "@ogw_front/components/Viewer/Grid/2D/PointsOptions"
|
|
22
22
|
|
|
23
23
|
// Grid 3D components
|
|
24
|
-
import Grid3DPointsOptions from "@ogw_front/components/Viewer/Grid/3D/PointsOptions"
|
|
25
24
|
import Grid3DEdgesOptions from "@ogw_front/components/Viewer/Grid/3D/EdgesOptions"
|
|
25
|
+
import Grid3DPointsOptions from "@ogw_front/components/Viewer/Grid/3D/PointsOptions"
|
|
26
26
|
// import Grid3DFacetsOptions from "@ogw_front/components/Viewer/Grid/3D/FacetsOptions"
|
|
27
27
|
import Grid3DCellsOptions from "@ogw_front/components/Viewer/Grid/3D/CellsOptions"
|
|
28
28
|
|
|
29
29
|
// Solid components
|
|
30
|
-
import SolidPointsOptions from "@ogw_front/components/Viewer/Solid/PointsOptions"
|
|
31
30
|
import SolidEdgesOptions from "@ogw_front/components/Viewer/Solid/EdgesOptions"
|
|
31
|
+
import SolidPointsOptions from "@ogw_front/components/Viewer/Solid/PointsOptions"
|
|
32
32
|
import SolidPolygonsOptions from "@ogw_front/components/Viewer/Solid/PolygonsOptions"
|
|
33
33
|
import SolidPolyhedraOptions from "@ogw_front/components/Viewer/Solid/SpecificPolyhedraOptions"
|
|
34
34
|
|
|
35
35
|
// TetrahedralSolid components
|
|
36
|
-
import TetrahedralSolidTrianglesOptions from "@ogw_front/components/Viewer/TetrahedralSolid/TrianglesOptions"
|
|
37
36
|
import TetrahedralSolidTetrahedraOptions from "@ogw_front/components/Viewer/TetrahedralSolid/TetrahedraOptions"
|
|
37
|
+
import TetrahedralSolidTrianglesOptions from "@ogw_front/components/Viewer/TetrahedralSolid/TrianglesOptions"
|
|
38
38
|
|
|
39
39
|
// Model components
|
|
40
40
|
import ModelEdgesOptions from "@ogw_front/components/Viewer/Generic/Model/EdgesOptions"
|
|
@@ -124,14 +124,14 @@ const menusData = {
|
|
|
124
124
|
export const useMenuStore = defineStore("menu", () => {
|
|
125
125
|
const menus = shallowRef(menusData)
|
|
126
126
|
const display_menu = ref(false)
|
|
127
|
-
const current_id = ref(
|
|
127
|
+
const current_id = ref(undefined)
|
|
128
128
|
const menuX = ref(0)
|
|
129
129
|
const menuY = ref(0)
|
|
130
130
|
const containerWidth = ref(window.innerWidth)
|
|
131
131
|
const containerHeight = ref(window.innerHeight)
|
|
132
132
|
const containerTop = ref(0)
|
|
133
133
|
const containerLeft = ref(0)
|
|
134
|
-
const active_item_index = ref(
|
|
134
|
+
const active_item_index = ref(undefined)
|
|
135
135
|
|
|
136
136
|
function getMenuItems(objectType, geodeObject) {
|
|
137
137
|
if (!objectType || !geodeObject || !menus.value[objectType]) {
|
|
@@ -141,8 +141,8 @@ export const useMenuStore = defineStore("menu", () => {
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
function closeMenu() {
|
|
144
|
-
active_item_index.value =
|
|
145
|
-
current_id.value =
|
|
144
|
+
active_item_index.value = undefined
|
|
145
|
+
current_id.value = undefined
|
|
146
146
|
menuX.value = 0
|
|
147
147
|
menuY.value = 0
|
|
148
148
|
display_menu.value = false
|
|
@@ -183,7 +183,7 @@ export const useMenuStore = defineStore("menu", () => {
|
|
|
183
183
|
|
|
184
184
|
function toggleItemOptions(index) {
|
|
185
185
|
if (active_item_index.value === index) {
|
|
186
|
-
active_item_index.value =
|
|
186
|
+
active_item_index.value = undefined
|
|
187
187
|
} else {
|
|
188
188
|
active_item_index.value = index
|
|
189
189
|
}
|
package/app/stores/treeview.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export const useTreeviewStore = defineStore("treeview", () => {
|
|
2
|
+
const PANEL_WIDTH = 300
|
|
3
|
+
|
|
2
4
|
const items = ref([])
|
|
3
5
|
const selection = ref([])
|
|
4
6
|
const components_selection = ref([])
|
|
5
7
|
const isAdditionnalTreeDisplayed = ref(false)
|
|
6
|
-
const panelWidth = ref(
|
|
8
|
+
const panelWidth = ref(PANEL_WIDTH)
|
|
7
9
|
const model_id = ref("")
|
|
8
10
|
const isTreeCollection = ref(false)
|
|
9
|
-
const selectedTree = ref(
|
|
11
|
+
const selectedTree = ref(undefined)
|
|
10
12
|
const isImporting = ref(false)
|
|
11
13
|
const pendingSelectionIds = ref([])
|
|
12
14
|
|
|
@@ -14,11 +16,11 @@ export const useTreeviewStore = defineStore("treeview", () => {
|
|
|
14
16
|
function addItem(geode_object_type, name, id, viewer_type) {
|
|
15
17
|
const child = { title: name, id, viewer_type }
|
|
16
18
|
|
|
17
|
-
for (let i = 0; i < items.value.length; i
|
|
19
|
+
for (let i = 0; i < items.value.length; i += 1) {
|
|
18
20
|
if (items.value[i].title === geode_object_type) {
|
|
19
21
|
items.value[i].children.push(child)
|
|
20
|
-
items.value[i].children.sort((
|
|
21
|
-
|
|
22
|
+
items.value[i].children.sort((element1, element2) =>
|
|
23
|
+
element1.title.localeCompare(element2.title, undefined, {
|
|
22
24
|
numeric: true,
|
|
23
25
|
sensitivity: "base",
|
|
24
26
|
}),
|
|
@@ -28,8 +30,8 @@ export const useTreeviewStore = defineStore("treeview", () => {
|
|
|
28
30
|
}
|
|
29
31
|
}
|
|
30
32
|
items.value.push({ title: geode_object_type, children: [child] })
|
|
31
|
-
items.value.sort((
|
|
32
|
-
|
|
33
|
+
items.value.sort((element1, element2) =>
|
|
34
|
+
element1.title.localeCompare(element2.title, undefined, {
|
|
33
35
|
numeric: true,
|
|
34
36
|
sensitivity: "base",
|
|
35
37
|
}),
|
|
@@ -59,7 +61,7 @@ export const useTreeviewStore = defineStore("treeview", () => {
|
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
function exportStores() {
|
|
62
|
-
const selectionIds = selection.value.map((
|
|
64
|
+
const selectionIds = selection.value.map((store) => store.id)
|
|
63
65
|
return {
|
|
64
66
|
isAdditionnalTreeDisplayed: isAdditionnalTreeDisplayed.value,
|
|
65
67
|
panelWidth: panelWidth.value,
|
|
@@ -73,14 +75,14 @@ export const useTreeviewStore = defineStore("treeview", () => {
|
|
|
73
75
|
async function importStores(snapshot) {
|
|
74
76
|
isAdditionnalTreeDisplayed.value =
|
|
75
77
|
snapshot?.isAdditionnalTreeDisplayed || false
|
|
76
|
-
panelWidth.value = snapshot?.panelWidth ||
|
|
78
|
+
panelWidth.value = snapshot?.panelWidth || PANEL_WIDTH
|
|
77
79
|
model_id.value = snapshot?.model_id || ""
|
|
78
80
|
isTreeCollection.value = snapshot?.isTreeCollection || false
|
|
79
|
-
selectedTree.value = snapshot?.selectedTree ||
|
|
81
|
+
selectedTree.value = snapshot?.selectedTree || undefined
|
|
80
82
|
|
|
81
83
|
pendingSelectionIds.value =
|
|
82
84
|
snapshot?.selectionIds ||
|
|
83
|
-
(snapshot?.selection || []).map((
|
|
85
|
+
(snapshot?.selection || []).map((store) => store.id) ||
|
|
84
86
|
[]
|
|
85
87
|
}
|
|
86
88
|
|
|
@@ -107,7 +109,7 @@ export const useTreeviewStore = defineStore("treeview", () => {
|
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
function removeItem(id) {
|
|
110
|
-
for (let i = 0; i < items.value.length; i
|
|
112
|
+
for (let i = 0; i < items.value.length; i += 1) {
|
|
111
113
|
const group = items.value[i]
|
|
112
114
|
const childIndex = group.children.findIndex((child) => child.id === id)
|
|
113
115
|
|
|
@@ -130,7 +132,7 @@ export const useTreeviewStore = defineStore("treeview", () => {
|
|
|
130
132
|
}
|
|
131
133
|
}
|
|
132
134
|
|
|
133
|
-
|
|
135
|
+
function clear() {
|
|
134
136
|
items.value = []
|
|
135
137
|
selection.value = []
|
|
136
138
|
components_selection.value = []
|
package/app/stores/viewer.js
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
|
+
import vtkWSLinkClient, {
|
|
2
|
+
newInstance,
|
|
3
|
+
} from "@kitware/vtk.js/IO/Core/WSLinkClient"
|
|
4
|
+
// oxlint-disable-next-line id-length
|
|
1
5
|
import _ from "lodash"
|
|
2
|
-
|
|
6
|
+
// oxlint-disable-next-line no-unassigned-import
|
|
3
7
|
import "@kitware/vtk.js/Rendering/OpenGL/Profiles/Geometry"
|
|
4
|
-
import schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
|
|
5
8
|
import Status from "@ogw_front/utils/status"
|
|
6
9
|
import { appMode } from "@ogw_front/utils/app_mode"
|
|
7
|
-
import
|
|
10
|
+
import schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
|
|
8
11
|
import { useInfraStore } from "@ogw_front/stores/infra"
|
|
12
|
+
import { viewer_call } from "../../internal/utils/viewer_call"
|
|
9
13
|
|
|
10
|
-
const
|
|
14
|
+
const MS_PER_SECOND = 1000
|
|
15
|
+
const SECONDS_PER_REQUEST = 10
|
|
16
|
+
const request_timeout = MS_PER_SECOND * SECONDS_PER_REQUEST
|
|
11
17
|
|
|
12
18
|
export const useViewerStore = defineStore(
|
|
13
19
|
"viewer",
|
|
@@ -16,27 +22,26 @@ export const useViewerStore = defineStore(
|
|
|
16
22
|
|
|
17
23
|
const default_local_port = ref("1234")
|
|
18
24
|
const client = ref({})
|
|
19
|
-
const config = ref(
|
|
25
|
+
const config = ref(undefined)
|
|
20
26
|
const picking_mode = ref(false)
|
|
21
|
-
const picked_point = ref({ x:
|
|
27
|
+
const picked_point = ref({ x: undefined, y: undefined })
|
|
22
28
|
const request_counter = ref(0)
|
|
23
29
|
const status = ref(Status.NOT_CONNECTED)
|
|
24
30
|
const buzy = ref(0)
|
|
25
31
|
|
|
26
32
|
const protocol = computed(() => {
|
|
27
|
-
if (
|
|
33
|
+
if (infraStore.app_mode === appMode.CLOUD) {
|
|
28
34
|
return "wss"
|
|
29
|
-
} else {
|
|
30
|
-
return "ws"
|
|
31
35
|
}
|
|
36
|
+
return "ws"
|
|
32
37
|
})
|
|
33
38
|
|
|
34
39
|
const port = computed(() => {
|
|
35
|
-
if (
|
|
40
|
+
if (infraStore.app_mode === appMode.CLOUD) {
|
|
36
41
|
return "443"
|
|
37
42
|
}
|
|
38
|
-
const VIEWER_PORT = useRuntimeConfig().public
|
|
39
|
-
if (VIEWER_PORT
|
|
43
|
+
const { VIEWER_PORT } = useRuntimeConfig().public
|
|
44
|
+
if (VIEWER_PORT !== undefined && VIEWER_PORT !== "") {
|
|
40
45
|
return VIEWER_PORT
|
|
41
46
|
}
|
|
42
47
|
return default_local_port.value
|
|
@@ -44,8 +49,8 @@ export const useViewerStore = defineStore(
|
|
|
44
49
|
|
|
45
50
|
const base_url = computed(() => {
|
|
46
51
|
let viewer_url = `${protocol.value}://${infraStore.domain_name}:${port.value}`
|
|
47
|
-
if (infraStore.app_mode
|
|
48
|
-
if (infraStore.ID
|
|
52
|
+
if (infraStore.app_mode === appMode.CLOUD) {
|
|
53
|
+
if (infraStore.ID === "") {
|
|
49
54
|
throw new Error("ID must not be empty in cloud mode")
|
|
50
55
|
}
|
|
51
56
|
viewer_url += `/${infraStore.ID}/viewer`
|
|
@@ -54,16 +59,17 @@ export const useViewerStore = defineStore(
|
|
|
54
59
|
return viewer_url
|
|
55
60
|
})
|
|
56
61
|
|
|
57
|
-
const is_busy = computed(() =>
|
|
58
|
-
return request_counter.value > 0
|
|
59
|
-
})
|
|
62
|
+
const is_busy = computed(() => request_counter.value > 0)
|
|
60
63
|
|
|
61
64
|
function toggle_picking_mode(value) {
|
|
62
65
|
picking_mode.value = value
|
|
63
66
|
}
|
|
64
67
|
|
|
65
68
|
async function set_picked_point(x, y) {
|
|
66
|
-
const response = await
|
|
69
|
+
const response = await request(
|
|
70
|
+
schemas.opengeodeweb_viewer.generic.get_point_position,
|
|
71
|
+
{ x, y },
|
|
72
|
+
)
|
|
67
73
|
const { x: world_x, y: world_y } = response
|
|
68
74
|
picked_point.value.x = world_x
|
|
69
75
|
picked_point.value.y = world_y
|
|
@@ -71,14 +77,18 @@ export const useViewerStore = defineStore(
|
|
|
71
77
|
}
|
|
72
78
|
|
|
73
79
|
async function ws_connect() {
|
|
74
|
-
if (status.value === Status.CONNECTED)
|
|
75
|
-
|
|
80
|
+
if (status.value === Status.CONNECTED) {
|
|
81
|
+
return
|
|
82
|
+
}
|
|
76
83
|
return navigator.locks.request("viewer.ws_connect", async (lock) => {
|
|
77
|
-
if (status.value === Status.CONNECTED)
|
|
84
|
+
if (status.value === Status.CONNECTED) {
|
|
85
|
+
return
|
|
86
|
+
}
|
|
78
87
|
try {
|
|
79
88
|
console.log("VIEWER LOCK GRANTED !", lock)
|
|
80
89
|
status.value = Status.CONNECTING
|
|
81
|
-
const SmartConnect =
|
|
90
|
+
const { default: SmartConnect } =
|
|
91
|
+
await import("wslink/src/SmartConnect")
|
|
82
92
|
vtkWSLinkClient.setSmartConnectClass(SmartConnect)
|
|
83
93
|
|
|
84
94
|
const config_obj = { application: "Viewer" }
|
|
@@ -90,7 +100,7 @@ export const useViewerStore = defineStore(
|
|
|
90
100
|
}
|
|
91
101
|
let clientToConnect = client.value
|
|
92
102
|
if (_.isEmpty(clientToConnect)) {
|
|
93
|
-
clientToConnect =
|
|
103
|
+
clientToConnect = newInstance()
|
|
94
104
|
}
|
|
95
105
|
|
|
96
106
|
// Connect to busy store
|
|
@@ -101,17 +111,13 @@ export const useViewerStore = defineStore(
|
|
|
101
111
|
|
|
102
112
|
// Error
|
|
103
113
|
clientToConnect.onConnectionError((httpReq) => {
|
|
104
|
-
const message =
|
|
105
|
-
(httpReq && httpReq.response && httpReq.response.error) ||
|
|
106
|
-
`Connection error`
|
|
114
|
+
const message = httpReq?.response?.error || `Connection error`
|
|
107
115
|
console.error(message)
|
|
108
116
|
})
|
|
109
117
|
|
|
110
118
|
// Close
|
|
111
119
|
clientToConnect.onConnectionClose((httpReq) => {
|
|
112
|
-
const message =
|
|
113
|
-
(httpReq && httpReq.response && httpReq.response.error) ||
|
|
114
|
-
`Connection close`
|
|
120
|
+
const message = httpReq?.response?.error || `Connection close`
|
|
115
121
|
console.error(message)
|
|
116
122
|
})
|
|
117
123
|
|
|
@@ -120,7 +126,7 @@ export const useViewerStore = defineStore(
|
|
|
120
126
|
await import("@kitware/vtk.js/Rendering/Misc/RemoteView")
|
|
121
127
|
client.value = await clientToConnect.connect(config_obj)
|
|
122
128
|
connectImageStream(client.value.getConnection().getSession())
|
|
123
|
-
|
|
129
|
+
clientToConnect.endBusy()
|
|
124
130
|
await request(
|
|
125
131
|
schemas.opengeodeweb_viewer.viewer.reset_visualization,
|
|
126
132
|
{},
|
|
@@ -137,16 +143,16 @@ export const useViewerStore = defineStore(
|
|
|
137
143
|
}
|
|
138
144
|
|
|
139
145
|
function start_request() {
|
|
140
|
-
request_counter.value
|
|
146
|
+
request_counter.value += 1
|
|
141
147
|
}
|
|
142
148
|
|
|
143
149
|
function stop_request() {
|
|
144
|
-
request_counter.value
|
|
150
|
+
request_counter.value -= 1
|
|
145
151
|
}
|
|
146
152
|
|
|
147
153
|
async function launch() {
|
|
148
154
|
console.log("[VIEWER] Launching viewer microservice...")
|
|
149
|
-
const port = await
|
|
155
|
+
const port = await globalThis.electronAPI.run_viewer()
|
|
150
156
|
console.log("[VIEWER] Viewer launched on port:", port)
|
|
151
157
|
return port
|
|
152
158
|
}
|
package/app/utils/app_mode.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import isElectron from "is-electron"
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
const appMode = {
|
|
4
4
|
DESKTOP: "DESKTOP",
|
|
5
5
|
BROWSER: "BROWSER",
|
|
6
6
|
CLOUD: "CLOUD",
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
function getAppMode() {
|
|
10
10
|
if (isElectron()) {
|
|
11
11
|
return appMode.DESKTOP
|
|
12
12
|
}
|
|
@@ -15,4 +15,5 @@ export function getAppMode() {
|
|
|
15
15
|
}
|
|
16
16
|
return appMode.CLOUD
|
|
17
17
|
}
|
|
18
|
-
|
|
18
|
+
|
|
19
|
+
export { appMode, getAppMode }
|