@geode/opengeodeweb-front 9.12.0 → 9.12.1-rc.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/components/Step.vue +10 -0
- package/components/Viewer/Generic/Mesh/EdgesOptions.vue +7 -6
- package/components/Viewer/Generic/Mesh/PointsOptions.vue +11 -10
- package/components/Viewer/Generic/Mesh/PolygonsOptions.vue +14 -14
- package/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +6 -6
- package/components/Viewer/PointSet/SpecificPointsOptions.vue +11 -10
- package/components/Viewer/Tree/ObjectTree.vue +1 -1
- package/composables/api_fetch.js +1 -3
- package/composables/viewer_call.js +1 -3
- package/internal_stores/data_style_state.js +2 -1
- package/internal_stores/mesh/edges.js +39 -36
- package/internal_stores/mesh/index.js +13 -8
- package/internal_stores/mesh/points.js +66 -79
- package/internal_stores/mesh/polygons.js +80 -88
- package/internal_stores/mesh/polyhedra.js +111 -99
- package/internal_stores/model/blocks.js +0 -2
- package/internal_stores/model/corners.js +0 -2
- package/internal_stores/model/lines.js +0 -2
- package/internal_stores/model/surfaces.js +0 -2
- package/package.json +2 -2
- package/stores/data_base.js +1 -3
- package/stores/data_style.js +7 -5
- package/stores/infra.js +4 -6
- package/stores/treeview.js +7 -0
- package/tests/integration/data/uploads/test.og_psf3d +0 -0
- package/tests/integration/data/uploads/test.og_rgd3d +0 -0
- package/tests/integration/microservices/back/requirements.txt +1 -1
- package/tests/integration/microservices/viewer/requirements.txt +1 -1
- package/tests/integration/setup.js +111 -0
- package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +77 -0
- package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +79 -0
- package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +78 -0
- package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +78 -0
- package/tests/integration/utils.js +35 -0
- package/tests/unit/utils/validate_schema.nuxt.test.js +1 -2
- package/tests/vitest.config.js +1 -0
- package/utils/local.js +42 -43
- package/tests/integration/data/fake_id/edged_curve.vtp +0 -20
- package/tests/integration/stores/DataStyle/mesh/Edges.nuxt.test.js +0 -215
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// Node.js imports
|
|
2
|
+
import path from "path"
|
|
3
|
+
import { v4 as uuidv4 } from "uuid"
|
|
4
|
+
import { WebSocket } from "ws"
|
|
5
|
+
|
|
6
|
+
// Third party imports
|
|
7
|
+
import { setActivePinia } from "pinia"
|
|
8
|
+
import { createTestingPinia } from "@pinia/testing"
|
|
9
|
+
import { afterAll, beforeAll, expect, vi } from "vitest"
|
|
10
|
+
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
|
|
11
|
+
|
|
12
|
+
// Local imports
|
|
13
|
+
import { useDataStyleStore } from "~/stores/data_style"
|
|
14
|
+
import { useDataBaseStore } from "~/stores/data_base"
|
|
15
|
+
import { useGeodeStore } from "~/stores/geode"
|
|
16
|
+
import { useViewerStore } from "~/stores/viewer"
|
|
17
|
+
import { useInfraStore } from "~/stores/infra"
|
|
18
|
+
import { api_fetch } from "~/composables/api_fetch"
|
|
19
|
+
import { appMode } from "~/utils/app_mode"
|
|
20
|
+
import Status from "~/utils/status"
|
|
21
|
+
import {
|
|
22
|
+
executable_name,
|
|
23
|
+
executable_path,
|
|
24
|
+
run_back,
|
|
25
|
+
run_viewer,
|
|
26
|
+
} from "~/utils/local"
|
|
27
|
+
import { getCurrentFolders, cleanupCreatedFolders } from "./utils.js"
|
|
28
|
+
|
|
29
|
+
async function setupIntegrationTests(file_name, geode_object, object_type) {
|
|
30
|
+
const pinia = createTestingPinia({
|
|
31
|
+
stubActions: false,
|
|
32
|
+
createSpy: vi.fn,
|
|
33
|
+
})
|
|
34
|
+
setActivePinia(pinia)
|
|
35
|
+
const dataStyleStore = useDataStyleStore()
|
|
36
|
+
const dataBaseStore = useDataBaseStore()
|
|
37
|
+
const geodeStore = useGeodeStore()
|
|
38
|
+
const viewerStore = useViewerStore()
|
|
39
|
+
const infraStore = useInfraStore()
|
|
40
|
+
infraStore.app_mode = appMode.BROWSER
|
|
41
|
+
|
|
42
|
+
const microservices_path = path.join("tests", "integration", "microservices")
|
|
43
|
+
const project_folder_path = path.join(__dirname, "data", uuidv4())
|
|
44
|
+
const upload_folder_path = path.join(__dirname, "data", "uploads")
|
|
45
|
+
const back_path = path.join(
|
|
46
|
+
executable_path(path.join(microservices_path, "back")),
|
|
47
|
+
executable_name("opengeodeweb-back"),
|
|
48
|
+
)
|
|
49
|
+
const viewer_path = path.join(
|
|
50
|
+
executable_path(path.join(microservices_path, "viewer")),
|
|
51
|
+
executable_name("opengeodeweb-viewer"),
|
|
52
|
+
)
|
|
53
|
+
const [back_port, viewer_port] = await Promise.all([
|
|
54
|
+
run_back(back_path, {
|
|
55
|
+
project_folder_path: project_folder_path,
|
|
56
|
+
upload_folder_path: upload_folder_path,
|
|
57
|
+
}),
|
|
58
|
+
run_viewer(viewer_path, {
|
|
59
|
+
project_folder_path: project_folder_path,
|
|
60
|
+
}),
|
|
61
|
+
])
|
|
62
|
+
console.log("back_port", back_port)
|
|
63
|
+
console.log("viewer_port", viewer_port)
|
|
64
|
+
geodeStore.default_local_port = back_port
|
|
65
|
+
viewerStore.default_local_port = viewer_port
|
|
66
|
+
await viewerStore.ws_connect()
|
|
67
|
+
|
|
68
|
+
const response = await api_fetch({
|
|
69
|
+
schema: back_schemas.opengeodeweb_back.save_viewable_file,
|
|
70
|
+
params: {
|
|
71
|
+
input_geode_object: geode_object,
|
|
72
|
+
filename: file_name,
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
const id = response.data._value.id
|
|
77
|
+
await dataBaseStore.registerObject(id)
|
|
78
|
+
await dataStyleStore.addDataStyle(id, geode_object, object_type)
|
|
79
|
+
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
80
|
+
return { id, back_port, viewer_port }
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const mockLockRequest = vi.fn().mockImplementation(async (name, callback) => {
|
|
84
|
+
return callback({ name })
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
vi.stubGlobal("navigator", {
|
|
88
|
+
...navigator,
|
|
89
|
+
locks: {
|
|
90
|
+
request: mockLockRequest,
|
|
91
|
+
},
|
|
92
|
+
})
|
|
93
|
+
|
|
94
|
+
let foldersBeforeTests = new Set()
|
|
95
|
+
|
|
96
|
+
const data_folder = path.join("tests", "integration", "data")
|
|
97
|
+
beforeAll(() => {
|
|
98
|
+
global.WebSocket = WebSocket
|
|
99
|
+
foldersBeforeTests = getCurrentFolders(data_folder)
|
|
100
|
+
console.log("foldersBeforeTests", foldersBeforeTests)
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
afterAll(() => {
|
|
104
|
+
console.log("afterAll")
|
|
105
|
+
delete global.WebSocket
|
|
106
|
+
setTimeout(() => {
|
|
107
|
+
cleanupCreatedFolders(data_folder, foldersBeforeTests)
|
|
108
|
+
}, 2000)
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
export { setupIntegrationTests }
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// Node.js imports
|
|
2
|
+
|
|
3
|
+
// Third party imports
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"
|
|
5
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json" with { type: "json" }
|
|
6
|
+
|
|
7
|
+
// Local imports
|
|
8
|
+
import Status from "~/utils/status"
|
|
9
|
+
import * as composables from "~/composables/viewer_call"
|
|
10
|
+
import { useDataStyleStore } from "~/stores/data_style"
|
|
11
|
+
import { useViewerStore } from "~/stores/viewer"
|
|
12
|
+
import { setupIntegrationTests } from "../../../setup.js"
|
|
13
|
+
|
|
14
|
+
// Local constants
|
|
15
|
+
const mesh_edges_schemas = viewer_schemas.opengeodeweb_viewer.mesh.edges
|
|
16
|
+
let id, back_port, viewer_port
|
|
17
|
+
const file_name = "test.og_edc2d"
|
|
18
|
+
const geode_object = "EdgedCurve2D"
|
|
19
|
+
const object_type = "mesh"
|
|
20
|
+
|
|
21
|
+
beforeEach(async () => {
|
|
22
|
+
;({ id, back_port, viewer_port } = await setupIntegrationTests(
|
|
23
|
+
file_name,
|
|
24
|
+
geode_object,
|
|
25
|
+
object_type,
|
|
26
|
+
))
|
|
27
|
+
}, 20000)
|
|
28
|
+
|
|
29
|
+
afterEach(async () => {
|
|
30
|
+
await Promise.all([kill_back(back_port), kill_viewer(viewer_port)])
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
describe("Mesh edges", () => {
|
|
34
|
+
describe("Edges visibility", () => {
|
|
35
|
+
test("Visibility true", async () => {
|
|
36
|
+
const dataStyleStore = useDataStyleStore()
|
|
37
|
+
const viewerStore = useViewerStore()
|
|
38
|
+
await dataStyleStore.setMeshEdgesVisibility(id, true)
|
|
39
|
+
expect(dataStyleStore.meshEdgesVisibility(id)).toBe(true)
|
|
40
|
+
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
describe("Edges active coloring", () => {
|
|
44
|
+
test("test coloring", async () => {
|
|
45
|
+
const dataStyleStore = useDataStyleStore()
|
|
46
|
+
const viewerStore = useViewerStore()
|
|
47
|
+
const coloringTypes = ["color"]
|
|
48
|
+
for (let i = 0; i < coloringTypes.length; i++) {
|
|
49
|
+
dataStyleStore.setMeshEdgesActiveColoring(id, coloringTypes[i])
|
|
50
|
+
expect(dataStyleStore.meshEdgesActiveColoring(id)).toBe(
|
|
51
|
+
coloringTypes[i],
|
|
52
|
+
)
|
|
53
|
+
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
describe("Edges color", () => {
|
|
58
|
+
test("test red", async () => {
|
|
59
|
+
const dataStyleStore = useDataStyleStore()
|
|
60
|
+
const viewerStore = useViewerStore()
|
|
61
|
+
const color = { r: 255, g: 0, b: 0 }
|
|
62
|
+
const spy = vi.spyOn(composables, "viewer_call")
|
|
63
|
+
await dataStyleStore.setMeshEdgesColor(id, color)
|
|
64
|
+
expect(spy).toHaveBeenCalledWith(
|
|
65
|
+
{
|
|
66
|
+
schema: mesh_edges_schemas.color,
|
|
67
|
+
params: { id, color },
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
response_function: expect.any(Function),
|
|
71
|
+
},
|
|
72
|
+
)
|
|
73
|
+
expect(dataStyleStore.meshEdgesColor(id)).toStrictEqual(color)
|
|
74
|
+
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
75
|
+
})
|
|
76
|
+
})
|
|
77
|
+
})
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Node.js imports
|
|
2
|
+
|
|
3
|
+
// Third party imports
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"
|
|
5
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json" with { type: "json" }
|
|
6
|
+
|
|
7
|
+
// Local imports
|
|
8
|
+
import Status from "~/utils/status"
|
|
9
|
+
import * as composables from "~/composables/viewer_call"
|
|
10
|
+
import { useDataStyleStore } from "~/stores/data_style"
|
|
11
|
+
import { useViewerStore } from "~/stores/viewer"
|
|
12
|
+
import { kill_back, kill_viewer } from "~/utils/local"
|
|
13
|
+
import { setupIntegrationTests } from "../../../setup.js"
|
|
14
|
+
|
|
15
|
+
// Local constants
|
|
16
|
+
const mesh_points_schemas = viewer_schemas.opengeodeweb_viewer.mesh.points
|
|
17
|
+
let id, back_port, viewer_port
|
|
18
|
+
const file_name = "test.og_edc2d"
|
|
19
|
+
const geode_object = "EdgedCurve2D"
|
|
20
|
+
const object_type = "mesh"
|
|
21
|
+
|
|
22
|
+
beforeEach(async () => {
|
|
23
|
+
;({ id, back_port, viewer_port } = await setupIntegrationTests(
|
|
24
|
+
file_name,
|
|
25
|
+
geode_object,
|
|
26
|
+
object_type,
|
|
27
|
+
))
|
|
28
|
+
}, 20000)
|
|
29
|
+
|
|
30
|
+
afterEach(async () => {
|
|
31
|
+
await Promise.all([kill_back(back_port), kill_viewer(viewer_port)])
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
describe("Mesh points", () => {
|
|
35
|
+
describe("Points visibility", () => {
|
|
36
|
+
test("Visibility true", async () => {
|
|
37
|
+
const dataStyleStore = useDataStyleStore()
|
|
38
|
+
const viewerStore = useViewerStore()
|
|
39
|
+
await dataStyleStore.setMeshPointsVisibility(id, true)
|
|
40
|
+
expect(dataStyleStore.meshPointsVisibility(id)).toBe(true)
|
|
41
|
+
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
describe("Points active coloring", () => {
|
|
46
|
+
test("test coloring", async () => {
|
|
47
|
+
const dataStyleStore = useDataStyleStore()
|
|
48
|
+
const viewerStore = useViewerStore()
|
|
49
|
+
const coloringTypes = ["color"]
|
|
50
|
+
for (let i = 0; i < coloringTypes.length; i++) {
|
|
51
|
+
dataStyleStore.setMeshPointsActiveColoring(id, coloringTypes[i])
|
|
52
|
+
expect(dataStyleStore.meshPointsActiveColoring(id)).toBe(
|
|
53
|
+
coloringTypes[i],
|
|
54
|
+
)
|
|
55
|
+
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
describe("Points color", () => {
|
|
60
|
+
test("test red", async () => {
|
|
61
|
+
const dataStyleStore = useDataStyleStore()
|
|
62
|
+
const viewerStore = useViewerStore()
|
|
63
|
+
const color = { r: 255, g: 0, b: 0 }
|
|
64
|
+
const spy = vi.spyOn(composables, "viewer_call")
|
|
65
|
+
await dataStyleStore.setMeshPointsColor(id, color)
|
|
66
|
+
expect(spy).toHaveBeenCalledWith(
|
|
67
|
+
{
|
|
68
|
+
schema: mesh_points_schemas.color,
|
|
69
|
+
params: { id, color },
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
response_function: expect.any(Function),
|
|
73
|
+
},
|
|
74
|
+
)
|
|
75
|
+
expect(dataStyleStore.meshPointsColor(id)).toStrictEqual(color)
|
|
76
|
+
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
})
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Node.js imports
|
|
2
|
+
|
|
3
|
+
// Third party imports
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"
|
|
5
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json" with { type: "json" }
|
|
6
|
+
|
|
7
|
+
// Local imports
|
|
8
|
+
import Status from "~/utils/status"
|
|
9
|
+
import * as composables from "~/composables/viewer_call"
|
|
10
|
+
import { useDataStyleStore } from "~/stores/data_style"
|
|
11
|
+
import { useViewerStore } from "~/stores/viewer"
|
|
12
|
+
import { kill_back, kill_viewer } from "~/utils/local"
|
|
13
|
+
import { setupIntegrationTests } from "../../../setup.js"
|
|
14
|
+
|
|
15
|
+
// Local constants
|
|
16
|
+
const mesh_polygons_schemas = viewer_schemas.opengeodeweb_viewer.mesh.polygons
|
|
17
|
+
let id, back_port, viewer_port
|
|
18
|
+
const file_name = "test.og_psf3d"
|
|
19
|
+
const geode_object = "PolygonalSurface3D"
|
|
20
|
+
const object_type = "mesh"
|
|
21
|
+
|
|
22
|
+
beforeEach(async () => {
|
|
23
|
+
;({ id, back_port, viewer_port } = await setupIntegrationTests(
|
|
24
|
+
file_name,
|
|
25
|
+
geode_object,
|
|
26
|
+
object_type,
|
|
27
|
+
))
|
|
28
|
+
}, 20000)
|
|
29
|
+
|
|
30
|
+
afterEach(async () => {
|
|
31
|
+
await Promise.all([kill_back(back_port), kill_viewer(viewer_port)])
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
describe("Mesh polygons", () => {
|
|
35
|
+
describe("Polygons visibility", () => {
|
|
36
|
+
test("Visibility true", async () => {
|
|
37
|
+
const dataStyleStore = useDataStyleStore()
|
|
38
|
+
const viewerStore = useViewerStore()
|
|
39
|
+
await dataStyleStore.setMeshPolygonsVisibility(id, true)
|
|
40
|
+
expect(dataStyleStore.meshPolygonsVisibility(id)).toBe(true)
|
|
41
|
+
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
describe("Polygons active coloring", () => {
|
|
45
|
+
test("test coloring", async () => {
|
|
46
|
+
const dataStyleStore = useDataStyleStore()
|
|
47
|
+
const viewerStore = useViewerStore()
|
|
48
|
+
const coloringTypes = ["color"]
|
|
49
|
+
for (let i = 0; i < coloringTypes.length; i++) {
|
|
50
|
+
dataStyleStore.setMeshPolygonsActiveColoring(id, coloringTypes[i])
|
|
51
|
+
expect(dataStyleStore.meshPolygonsActiveColoring(id)).toBe(
|
|
52
|
+
coloringTypes[i],
|
|
53
|
+
)
|
|
54
|
+
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
describe("Polygons color", () => {
|
|
59
|
+
test("test red", async () => {
|
|
60
|
+
const dataStyleStore = useDataStyleStore()
|
|
61
|
+
const viewerStore = useViewerStore()
|
|
62
|
+
const color = { r: 255, g: 0, b: 0 }
|
|
63
|
+
const spy = vi.spyOn(composables, "viewer_call")
|
|
64
|
+
await dataStyleStore.setMeshPolygonsColor(id, color)
|
|
65
|
+
expect(spy).toHaveBeenCalledWith(
|
|
66
|
+
{
|
|
67
|
+
schema: mesh_polygons_schemas.color,
|
|
68
|
+
params: { id, color },
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
response_function: expect.any(Function),
|
|
72
|
+
},
|
|
73
|
+
)
|
|
74
|
+
expect(dataStyleStore.meshPolygonsColor(id)).toStrictEqual(color)
|
|
75
|
+
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
})
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
// Node.js imports
|
|
2
|
+
|
|
3
|
+
// Third party imports
|
|
4
|
+
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"
|
|
5
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json" with { type: "json" }
|
|
6
|
+
|
|
7
|
+
// Local imports
|
|
8
|
+
import Status from "~/utils/status"
|
|
9
|
+
import * as composables from "~/composables/viewer_call"
|
|
10
|
+
import { useDataStyleStore } from "~/stores/data_style"
|
|
11
|
+
import { useViewerStore } from "~/stores/viewer"
|
|
12
|
+
import { kill_back, kill_viewer } from "~/utils/local"
|
|
13
|
+
import { setupIntegrationTests } from "../../../setup.js"
|
|
14
|
+
|
|
15
|
+
// Local constants
|
|
16
|
+
const mesh_polyhedra_schemas = viewer_schemas.opengeodeweb_viewer.mesh.polyhedra
|
|
17
|
+
let id, back_port, viewer_port
|
|
18
|
+
const file_name = "test.og_rgd3d"
|
|
19
|
+
const geode_object = "RegularGrid3D"
|
|
20
|
+
const object_type = "mesh"
|
|
21
|
+
|
|
22
|
+
beforeEach(async () => {
|
|
23
|
+
;({ id, back_port, viewer_port } = await setupIntegrationTests(
|
|
24
|
+
file_name,
|
|
25
|
+
geode_object,
|
|
26
|
+
object_type,
|
|
27
|
+
))
|
|
28
|
+
}, 20000)
|
|
29
|
+
|
|
30
|
+
afterEach(async () => {
|
|
31
|
+
await Promise.all([kill_back(back_port), kill_viewer(viewer_port)])
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
describe("Mesh polyhedra", () => {
|
|
35
|
+
describe("Polyhedra visibility", () => {
|
|
36
|
+
test("Visibility true", async () => {
|
|
37
|
+
const dataStyleStore = useDataStyleStore()
|
|
38
|
+
const viewerStore = useViewerStore()
|
|
39
|
+
await dataStyleStore.setMeshPolyhedraVisibility(id, true)
|
|
40
|
+
expect(dataStyleStore.meshPolyhedraVisibility(id)).toBe(true)
|
|
41
|
+
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
42
|
+
})
|
|
43
|
+
})
|
|
44
|
+
describe("Polyhedra active coloring", () => {
|
|
45
|
+
test("test coloring", async () => {
|
|
46
|
+
const dataStyleStore = useDataStyleStore()
|
|
47
|
+
const viewerStore = useViewerStore()
|
|
48
|
+
const coloringTypes = ["color"]
|
|
49
|
+
for (let i = 0; i < coloringTypes.length; i++) {
|
|
50
|
+
dataStyleStore.setMeshPolyhedraActiveColoring(id, coloringTypes[i])
|
|
51
|
+
expect(dataStyleStore.meshPolyhedraActiveColoring(id)).toBe(
|
|
52
|
+
coloringTypes[i],
|
|
53
|
+
)
|
|
54
|
+
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
describe("Polyhedra color", () => {
|
|
59
|
+
test("test red", async () => {
|
|
60
|
+
const dataStyleStore = useDataStyleStore()
|
|
61
|
+
const viewerStore = useViewerStore()
|
|
62
|
+
const color = { r: 255, g: 0, b: 0 }
|
|
63
|
+
const spy = vi.spyOn(composables, "viewer_call")
|
|
64
|
+
await dataStyleStore.setMeshPolyhedraColor(id, color)
|
|
65
|
+
expect(spy).toHaveBeenCalledWith(
|
|
66
|
+
{
|
|
67
|
+
schema: mesh_polyhedra_schemas.color,
|
|
68
|
+
params: { id, color },
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
response_function: expect.any(Function),
|
|
72
|
+
},
|
|
73
|
+
)
|
|
74
|
+
expect(dataStyleStore.meshPolyhedraColor(id)).toStrictEqual(color)
|
|
75
|
+
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
})
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Node.js imports
|
|
2
|
+
import fs from "fs"
|
|
3
|
+
import path from "path"
|
|
4
|
+
|
|
5
|
+
function getCurrentFolders(dataFolderPath) {
|
|
6
|
+
if (!fs.existsSync(dataFolderPath)) {
|
|
7
|
+
return new Set()
|
|
8
|
+
}
|
|
9
|
+
const entries = fs.readdirSync(dataFolderPath)
|
|
10
|
+
const folders = new Set()
|
|
11
|
+
for (const entry of entries) {
|
|
12
|
+
const entryPath = path.join(dataFolderPath, entry)
|
|
13
|
+
if (fs.statSync(entryPath).isDirectory()) {
|
|
14
|
+
folders.add(entry)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return folders
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function cleanupCreatedFolders(dataFolderPath, foldersBeforeTests) {
|
|
21
|
+
if (!fs.existsSync(dataFolderPath)) {
|
|
22
|
+
return
|
|
23
|
+
}
|
|
24
|
+
const currentFolders = getCurrentFolders(dataFolderPath)
|
|
25
|
+
console.log("getCurrentFolders currentFolders", currentFolders)
|
|
26
|
+
for (const folder of currentFolders) {
|
|
27
|
+
if (!foldersBeforeTests.has(folder)) {
|
|
28
|
+
const folderPath = path.join(dataFolderPath, folder)
|
|
29
|
+
fs.rmSync(folderPath, { recursive: true, force: true })
|
|
30
|
+
console.log(`Deleted folder: ${folderPath}`)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { getCurrentFolders, cleanupCreatedFolders }
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { describe, expect, test } from "vitest"
|
|
2
2
|
|
|
3
|
-
import validate_schema from "
|
|
4
|
-
console.log("@ogw_f", "@ogw_f")
|
|
3
|
+
import validate_schema from "~/utils/validate_schema.js"
|
|
5
4
|
|
|
6
5
|
describe("validate_schema.js", () => {
|
|
7
6
|
const schema = {
|
package/tests/vitest.config.js
CHANGED
package/utils/local.js
CHANGED
|
@@ -50,13 +50,11 @@ function create_path(path) {
|
|
|
50
50
|
return path
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
port,
|
|
53
|
+
function get_available_port() {
|
|
54
|
+
return getPort({
|
|
56
55
|
host: "localhost",
|
|
56
|
+
random: true,
|
|
57
57
|
})
|
|
58
|
-
console.log("available_port", available_port)
|
|
59
|
-
return available_port
|
|
60
58
|
}
|
|
61
59
|
|
|
62
60
|
async function run_script(
|
|
@@ -69,6 +67,7 @@ async function run_script(
|
|
|
69
67
|
setTimeout(() => {
|
|
70
68
|
reject("Timed out after " + timeout_seconds + " seconds")
|
|
71
69
|
}, timeout_seconds * 1000)
|
|
70
|
+
|
|
72
71
|
const child = child_process.spawn(command, args, {
|
|
73
72
|
encoding: "utf8",
|
|
74
73
|
shell: true,
|
|
@@ -109,32 +108,43 @@ async function run_script(
|
|
|
109
108
|
})
|
|
110
109
|
}
|
|
111
110
|
|
|
112
|
-
async function run_back(
|
|
111
|
+
async function run_back(
|
|
112
|
+
command,
|
|
113
|
+
args = {
|
|
114
|
+
project_folder_path,
|
|
115
|
+
upload_folder_path: undefined,
|
|
116
|
+
},
|
|
117
|
+
) {
|
|
113
118
|
return new Promise(async (resolve, reject) => {
|
|
114
|
-
|
|
115
|
-
|
|
119
|
+
let upload_folder_path = args.upload_folder_path
|
|
120
|
+
if (!args.upload_folder_path) {
|
|
121
|
+
upload_folder_path = args.project_folder_path
|
|
122
|
+
}
|
|
123
|
+
const port = await get_available_port()
|
|
116
124
|
const back_args = [
|
|
117
|
-
"--port " +
|
|
118
|
-
"--data_folder_path " + args.
|
|
125
|
+
"--port " + port,
|
|
126
|
+
"--data_folder_path " + args.project_folder_path,
|
|
119
127
|
"--upload_folder_path " + upload_folder_path,
|
|
120
128
|
"--allowed_origin http://localhost:*",
|
|
121
129
|
"--timeout " + 0,
|
|
122
130
|
]
|
|
131
|
+
console.log("run_back", command, back_args)
|
|
123
132
|
await run_script(command, back_args, "Serving Flask app")
|
|
124
|
-
resolve(
|
|
133
|
+
resolve(port)
|
|
125
134
|
})
|
|
126
135
|
}
|
|
127
136
|
|
|
128
|
-
async function run_viewer(command, args = {
|
|
137
|
+
async function run_viewer(command, args = { project_folder_path }) {
|
|
129
138
|
return new Promise(async (resolve, reject) => {
|
|
130
|
-
const
|
|
139
|
+
const port = await get_available_port()
|
|
131
140
|
const viewer_args = [
|
|
132
|
-
"--port " +
|
|
133
|
-
"--data_folder_path " + args.
|
|
141
|
+
"--port " + port,
|
|
142
|
+
"--data_folder_path " + args.project_folder_path,
|
|
134
143
|
"--timeout " + 0,
|
|
135
144
|
]
|
|
145
|
+
console.log("run_viewer", command, viewer_args)
|
|
136
146
|
await run_script(command, viewer_args, "Starting factory")
|
|
137
|
-
resolve(
|
|
147
|
+
resolve(port)
|
|
138
148
|
})
|
|
139
149
|
}
|
|
140
150
|
|
|
@@ -153,8 +163,6 @@ function delete_folder_recursive(data_folder_path) {
|
|
|
153
163
|
|
|
154
164
|
function kill_back(back_port) {
|
|
155
165
|
return new Promise((resolve, reject) => {
|
|
156
|
-
console.log("back_schemas", back_schemas)
|
|
157
|
-
|
|
158
166
|
fetch(
|
|
159
167
|
"http://localhost:" +
|
|
160
168
|
back_port +
|
|
@@ -176,7 +184,7 @@ function kill_back(back_port) {
|
|
|
176
184
|
}
|
|
177
185
|
|
|
178
186
|
function kill_viewer(viewer_port) {
|
|
179
|
-
return new Promise((resolve
|
|
187
|
+
return new Promise((resolve) => {
|
|
180
188
|
const socket = new WebSocket("ws://localhost:" + viewer_port + "/ws")
|
|
181
189
|
socket.on("open", () => {
|
|
182
190
|
console.log("Connected to WebSocket server")
|
|
@@ -191,19 +199,15 @@ function kill_viewer(viewer_port) {
|
|
|
191
199
|
socket.on("message", (data) => {
|
|
192
200
|
const message = data.toString()
|
|
193
201
|
console.log("Received from server:", message)
|
|
202
|
+
|
|
194
203
|
if (message.includes("hello")) {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
)
|
|
203
|
-
} catch (error) {
|
|
204
|
-
console.error("WebSocket error:", error)
|
|
205
|
-
resolve()
|
|
206
|
-
}
|
|
204
|
+
socket.send(
|
|
205
|
+
JSON.stringify({
|
|
206
|
+
id: viewer_schemas.opengeodeweb_viewer.kill.$id,
|
|
207
|
+
method: viewer_schemas.opengeodeweb_viewer.kill.$id,
|
|
208
|
+
}),
|
|
209
|
+
)
|
|
210
|
+
resolve()
|
|
207
211
|
}
|
|
208
212
|
})
|
|
209
213
|
socket.on("close", () => {
|
|
@@ -220,8 +224,8 @@ function kill_viewer(viewer_port) {
|
|
|
220
224
|
async function run_browser(
|
|
221
225
|
script_name,
|
|
222
226
|
microservices_options = {
|
|
223
|
-
back: { command, args: {
|
|
224
|
-
viewer: { command, args: {
|
|
227
|
+
back: { command, args: { project_folder_path } },
|
|
228
|
+
viewer: { command, args: { project_folder_path } },
|
|
225
229
|
},
|
|
226
230
|
) {
|
|
227
231
|
console.log("microservices_options", microservices_options)
|
|
@@ -247,23 +251,16 @@ async function run_browser(
|
|
|
247
251
|
process.env.BROWSER = true
|
|
248
252
|
process.on("SIGINT", async () => {
|
|
249
253
|
console.log("Shutting down microservices")
|
|
250
|
-
await Promise.all([
|
|
251
|
-
kill_back(process.env.GEODE_PORT),
|
|
252
|
-
kill_viewer(process.env.VIEWER_PORT),
|
|
253
|
-
])
|
|
254
|
+
await Promise.all([kill_back(back_port), kill_viewer(viewer_port)])
|
|
254
255
|
console.log("Quitting App...")
|
|
255
256
|
process.exit(0)
|
|
256
257
|
})
|
|
257
258
|
|
|
258
|
-
const nuxt_port = await get_available_port()
|
|
259
|
-
console.log("nuxt_port", nuxt_port)
|
|
260
|
-
|
|
261
|
-
process.env.NUXT_PORT = nuxt_port
|
|
262
259
|
const nuxt_process = child_process.spawn("npm", ["run", script_name], {
|
|
263
260
|
shell: true,
|
|
264
261
|
})
|
|
265
262
|
|
|
266
|
-
return new Promise((resolve
|
|
263
|
+
return new Promise((resolve) => {
|
|
267
264
|
nuxt_process.stdout.on("data", function (data) {
|
|
268
265
|
const output = data.toString()
|
|
269
266
|
const portMatch = output.match(
|
|
@@ -271,7 +268,9 @@ async function run_browser(
|
|
|
271
268
|
)
|
|
272
269
|
console.log("Nuxt: ", output)
|
|
273
270
|
if (portMatch) {
|
|
274
|
-
|
|
271
|
+
const nuxt_port = portMatch[1]
|
|
272
|
+
process.env.NUXT_PORT = nuxt_port
|
|
273
|
+
resolve({ geode_port: back_port, viewer_port, nuxt_port })
|
|
275
274
|
return
|
|
276
275
|
}
|
|
277
276
|
})
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0"?>
|
|
2
|
-
<VTKFile type="PolyData" version="1.0" byte_order="LittleEndian" header_type="UInt32" compressor="vtkZLibDataCompressor">
|
|
3
|
-
<PolyData>
|
|
4
|
-
<Piece NumberOfPoints="4" NumberOfLines="4">
|
|
5
|
-
<PointData>
|
|
6
|
-
<DataArray type="Float64" Name="points" format="ascii" NumberOfComponents="3" RangeMin="0.100000001" RangeMax="9.39999962">0.1 0.2 0.3 2.1 9.4 6.7 7.5 5.2 6.3 8.7 1.4 4.7 </DataArray>
|
|
7
|
-
</PointData>
|
|
8
|
-
<Points>
|
|
9
|
-
<DataArray type="Float64" Name="Points" format="ascii" NumberOfComponents="3" RangeMin="0.10000000000000001" RangeMax="9.4000000000000004">0.1 0.2 0.3 2.1 9.4 6.7 7.5 5.2 6.3 8.7 1.4 4.7 </DataArray>
|
|
10
|
-
</Points>
|
|
11
|
-
<CellData>
|
|
12
|
-
<DataArray type="Float64" Name="edges" format="ascii" NumberOfComponents="2" RangeMin="0" RangeMax="3">0 1 0 2 3 2 1 2 </DataArray>
|
|
13
|
-
</CellData>
|
|
14
|
-
<Lines>
|
|
15
|
-
<DataArray type="Int64" Name="connectivity" format="ascii" RangeMin="0" RangeMax="3">0 1 0 2 3 2 1 2 </DataArray>
|
|
16
|
-
<DataArray type="Int64" Name="offsets" format="ascii" RangeMin="0" RangeMax="4">2 4 6 8 </DataArray>
|
|
17
|
-
</Lines>
|
|
18
|
-
</Piece>
|
|
19
|
-
</PolyData>
|
|
20
|
-
</VTKFile>
|