@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
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import path from "path"
|
|
2
|
-
import fs from "fs"
|
|
3
|
-
|
|
4
|
-
import { setActivePinia } from "pinia"
|
|
5
|
-
import { createTestingPinia } from "@pinia/testing"
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
afterAll,
|
|
9
|
-
afterEach,
|
|
10
|
-
beforeAll,
|
|
11
|
-
beforeEach,
|
|
12
|
-
describe,
|
|
13
|
-
expect,
|
|
14
|
-
test,
|
|
15
|
-
vi,
|
|
16
|
-
} from "vitest"
|
|
17
|
-
|
|
18
|
-
import {
|
|
19
|
-
executable_name,
|
|
20
|
-
executable_path,
|
|
21
|
-
run_viewer,
|
|
22
|
-
run_back,
|
|
23
|
-
kill_viewer,
|
|
24
|
-
kill_back,
|
|
25
|
-
} from "@ogw_f/utils/local"
|
|
26
|
-
|
|
27
|
-
import Status from "@ogw_f/utils/status"
|
|
28
|
-
|
|
29
|
-
import { api_fetch } from "@ogw_f/composables/api_fetch"
|
|
30
|
-
import * as composables from "@ogw_f/composables/viewer_call"
|
|
31
|
-
import { useDataStyleStore } from "@ogw_f/stores/data_style"
|
|
32
|
-
import { useDataBaseStore } from "@ogw_f/stores/data_base"
|
|
33
|
-
import { useViewerStore } from "@ogw_f/stores/viewer"
|
|
34
|
-
import { useInfraStore } from "@ogw_f/stores/infra"
|
|
35
|
-
import { useGeodeStore } from "@ogw_f/stores/geode"
|
|
36
|
-
|
|
37
|
-
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
|
|
38
|
-
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
|
|
39
|
-
import appMode from "@ogw_f/utils/app_mode"
|
|
40
|
-
import { WebSocket } from "ws"
|
|
41
|
-
|
|
42
|
-
const mesh_edges_schemas = viewer_schemas.opengeodeweb_viewer.mesh.edges
|
|
43
|
-
|
|
44
|
-
const mockLockRequest = vi.fn().mockImplementation(async (name, callback) => {
|
|
45
|
-
return callback({ name })
|
|
46
|
-
})
|
|
47
|
-
|
|
48
|
-
vi.stubGlobal("navigator", {
|
|
49
|
-
...navigator,
|
|
50
|
-
locks: {
|
|
51
|
-
request: mockLockRequest,
|
|
52
|
-
},
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
let foldersBeforeTests = new Set()
|
|
56
|
-
const data_folder_path = path.join(__dirname, "..", "..", "..", "data")
|
|
57
|
-
|
|
58
|
-
function getCurrentFolders(dataFolderPath) {
|
|
59
|
-
if (!fs.existsSync(dataFolderPath)) {
|
|
60
|
-
return new Set()
|
|
61
|
-
}
|
|
62
|
-
const entries = fs.readdirSync(dataFolderPath)
|
|
63
|
-
const folders = new Set()
|
|
64
|
-
for (const entry of entries) {
|
|
65
|
-
const entryPath = path.join(dataFolderPath, entry)
|
|
66
|
-
if (fs.statSync(entryPath).isDirectory()) {
|
|
67
|
-
folders.add(entry)
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return folders
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
function cleanupCreatedFolders(dataFolderPath, foldersBeforeTests) {
|
|
74
|
-
if (!fs.existsSync(dataFolderPath)) {
|
|
75
|
-
return
|
|
76
|
-
}
|
|
77
|
-
const currentFolders = getCurrentFolders(dataFolderPath)
|
|
78
|
-
for (const folder of currentFolders) {
|
|
79
|
-
if (!foldersBeforeTests.has(folder)) {
|
|
80
|
-
const folderPath = path.join(dataFolderPath, folder)
|
|
81
|
-
fs.rmSync(folderPath, { recursive: true, force: true })
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
beforeAll(() => {
|
|
87
|
-
global.WebSocket = WebSocket
|
|
88
|
-
foldersBeforeTests = getCurrentFolders(data_folder_path)
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
afterAll(() => {
|
|
92
|
-
delete global.WebSocket
|
|
93
|
-
cleanupCreatedFolders(data_folder_path, foldersBeforeTests)
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
let id = "fake_id"
|
|
97
|
-
const file_name = "test.og_edc2d"
|
|
98
|
-
const geode_object = "EdgedCurve2D"
|
|
99
|
-
|
|
100
|
-
beforeEach(async () => {
|
|
101
|
-
const pinia = createTestingPinia({
|
|
102
|
-
stubActions: false,
|
|
103
|
-
createSpy: vi.fn,
|
|
104
|
-
})
|
|
105
|
-
setActivePinia(pinia)
|
|
106
|
-
const dataStyleStore = useDataStyleStore()
|
|
107
|
-
const dataBaseStore = useDataBaseStore()
|
|
108
|
-
const geodeStore = useGeodeStore()
|
|
109
|
-
const viewerStore = useViewerStore()
|
|
110
|
-
const infraStore = useInfraStore()
|
|
111
|
-
infraStore.app_mode = appMode.BROWSER
|
|
112
|
-
|
|
113
|
-
if (!fs.existsSync(data_folder_path)) {
|
|
114
|
-
fs.mkdirSync(data_folder_path, { recursive: true })
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
const back_path = path.join(
|
|
118
|
-
executable_path(path.join("tests", "integration", "microservices", "back")),
|
|
119
|
-
executable_name("opengeodeweb-back"),
|
|
120
|
-
)
|
|
121
|
-
const viewer_path = path.join(
|
|
122
|
-
executable_path(
|
|
123
|
-
path.join("tests", "integration", "microservices", "viewer"),
|
|
124
|
-
),
|
|
125
|
-
executable_name("opengeodeweb-viewer"),
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
const back_promise = run_back(back_path, {
|
|
129
|
-
port: 5000,
|
|
130
|
-
data_folder_path,
|
|
131
|
-
})
|
|
132
|
-
|
|
133
|
-
const viewer_promise = run_viewer(viewer_path, {
|
|
134
|
-
port: 1234,
|
|
135
|
-
data_folder_path,
|
|
136
|
-
})
|
|
137
|
-
|
|
138
|
-
const [back_port, viewer_port] = await Promise.all([
|
|
139
|
-
back_promise,
|
|
140
|
-
viewer_promise,
|
|
141
|
-
])
|
|
142
|
-
console.log("Viewer path:", viewer_path)
|
|
143
|
-
geodeStore.default_local_port = back_port
|
|
144
|
-
viewerStore.default_local_port = viewer_port
|
|
145
|
-
await viewerStore.ws_connect()
|
|
146
|
-
console.log("schema", back_schemas.opengeodeweb_back.save_viewable_file)
|
|
147
|
-
|
|
148
|
-
const response = await api_fetch({
|
|
149
|
-
schema: back_schemas.opengeodeweb_back.save_viewable_file,
|
|
150
|
-
params: {
|
|
151
|
-
input_geode_object: geode_object,
|
|
152
|
-
filename: file_name,
|
|
153
|
-
},
|
|
154
|
-
})
|
|
155
|
-
id = response.data.value.id
|
|
156
|
-
|
|
157
|
-
await dataBaseStore.registerObject(id)
|
|
158
|
-
await dataStyleStore.addDataStyle(id, geode_object, "mesh")
|
|
159
|
-
|
|
160
|
-
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
161
|
-
}, 15000)
|
|
162
|
-
|
|
163
|
-
afterEach(async () => {
|
|
164
|
-
const viewerStore = useViewerStore()
|
|
165
|
-
const geodeStore = useGeodeStore()
|
|
166
|
-
await Promise.all([
|
|
167
|
-
kill_viewer(viewerStore.default_local_port),
|
|
168
|
-
kill_back(geodeStore.default_local_port),
|
|
169
|
-
])
|
|
170
|
-
})
|
|
171
|
-
|
|
172
|
-
describe("Mesh edges", () => {
|
|
173
|
-
describe("Edges visibility", () => {
|
|
174
|
-
test("test visibility true", async () => {
|
|
175
|
-
const dataStyleStore = useDataStyleStore()
|
|
176
|
-
const viewerStore = useViewerStore()
|
|
177
|
-
await dataStyleStore.setEdgesVisibility(id, true)
|
|
178
|
-
expect(dataStyleStore.edgesVisibility(id)).toBe(true)
|
|
179
|
-
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
180
|
-
})
|
|
181
|
-
})
|
|
182
|
-
|
|
183
|
-
describe("Edges active coloring", () => {
|
|
184
|
-
test("test coloring", async () => {
|
|
185
|
-
const dataStyleStore = useDataStyleStore()
|
|
186
|
-
const viewerStore = useViewerStore()
|
|
187
|
-
const coloringTypes = ["color"]
|
|
188
|
-
for (let i = 0; i < coloringTypes.length; i++) {
|
|
189
|
-
dataStyleStore.setEdgesActiveColoring(id, coloringTypes[i])
|
|
190
|
-
expect(dataStyleStore.edgesActiveColoring(id)).toBe(coloringTypes[i])
|
|
191
|
-
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
192
|
-
}
|
|
193
|
-
})
|
|
194
|
-
})
|
|
195
|
-
describe("Edges color", () => {
|
|
196
|
-
test("test red", async () => {
|
|
197
|
-
const dataStyleStore = useDataStyleStore()
|
|
198
|
-
const viewerStore = useViewerStore()
|
|
199
|
-
const color = { r: 255, g: 0, b: 0 }
|
|
200
|
-
const spy = vi.spyOn(composables, "viewer_call")
|
|
201
|
-
await dataStyleStore.setEdgesColor(id, color)
|
|
202
|
-
expect(spy).toHaveBeenCalledWith(
|
|
203
|
-
{
|
|
204
|
-
schema: mesh_edges_schemas.color,
|
|
205
|
-
params: { id, color },
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
response_function: expect.any(Function),
|
|
209
|
-
},
|
|
210
|
-
)
|
|
211
|
-
expect(dataStyleStore.edgesColor(id)).toStrictEqual(color)
|
|
212
|
-
expect(viewerStore.status).toBe(Status.CONNECTED)
|
|
213
|
-
})
|
|
214
|
-
})
|
|
215
|
-
})
|