@geode/opengeodeweb-front 9.11.0-rc.7 → 9.11.0-rc.9

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.
Files changed (76) hide show
  1. package/.github/workflows/test.yml +23 -0
  2. package/.oxlintrc.json +1 -1
  3. package/components/FeedBack/ErrorBanner.vue +1 -1
  4. package/components/FeedBack/Snackers.vue +1 -1
  5. package/components/HybridRenderingView.vue +38 -12
  6. package/components/Launcher.vue +1 -1
  7. package/components/PackagesVersions.vue +1 -1
  8. package/components/Recaptcha.vue +1 -1
  9. package/components/RemoteRenderingView.vue +1 -1
  10. package/components/Viewer/BreadCrumb.vue +1 -1
  11. package/components/Viewer/Tree/ObjectTree.vue +1 -1
  12. package/components/Viewer/TreeObject.vue +1 -1
  13. package/components/Wrapper.vue +1 -1
  14. package/composables/api_fetch.js +2 -2
  15. package/composables/run_function_when_microservices_connected.js +1 -1
  16. package/composables/upload_file.js +2 -2
  17. package/composables/viewer_call.js +38 -38
  18. package/geode-opengeodeweb-back-5.10.0-rc.8.tgz +0 -0
  19. package/geode-opengeodeweb-viewer-1.11.0-rc.4.tgz +0 -0
  20. package/internal_stores/mesh/edges.js +49 -52
  21. package/internal_stores/mesh/index.js +20 -14
  22. package/internal_stores/mesh/points.js +9 -7
  23. package/internal_stores/mesh/polygons.js +9 -7
  24. package/internal_stores/mesh/polyhedra.js +8 -6
  25. package/internal_stores/model/blocks.js +1 -1
  26. package/internal_stores/model/corners.js +1 -1
  27. package/internal_stores/model/edges.js +1 -8
  28. package/internal_stores/model/index.js +1 -1
  29. package/internal_stores/model/lines.js +2 -2
  30. package/internal_stores/model/points.js +2 -2
  31. package/internal_stores/model/surfaces.js +1 -1
  32. package/package.json +13 -6
  33. package/stores/data_base.js +9 -1
  34. package/stores/data_style.js +7 -6
  35. package/stores/feedback.js +1 -1
  36. package/stores/geode.js +5 -5
  37. package/stores/hybrid_viewer.js +1 -1
  38. package/stores/infra.js +10 -10
  39. package/stores/menu.js +3 -3
  40. package/stores/treeview.js +1 -1
  41. package/stores/viewer.js +5 -6
  42. package/tests/integration/data/fake_id/edged_curve.vtp +20 -0
  43. package/tests/integration/microservices/back/requirements.in +1 -0
  44. package/tests/integration/microservices/back/requirements.txt +75 -0
  45. package/tests/integration/microservices/viewer/requirements.in +1 -0
  46. package/tests/integration/microservices/viewer/requirements.txt +87 -0
  47. package/tests/integration/stores/DataStyle/mesh/Edges.nuxt.test.js +138 -0
  48. package/{test → tests/unit}/components/CrsSelector.nuxt.test.js +6 -3
  49. package/{test → tests/unit}/components/ExtensionSelector.nuxt.test.js +6 -3
  50. package/{test → tests/unit}/components/FeedBack/ErrorsBanner.nuxt.test.js +10 -3
  51. package/{test → tests/unit}/components/FeedBack/Snackers.nuxt.test.js +24 -21
  52. package/{test → tests/unit}/components/FileSelector.nuxt.test.js +5 -2
  53. package/{test → tests/unit}/components/FileUploader.nuxt.test.js +6 -3
  54. package/{test → tests/unit}/components/Inspector/InspectionButton.nuxt.test.js +6 -3
  55. package/{test → tests/unit}/components/Launcher.nuxt.test.js +9 -2
  56. package/{test → tests/unit}/components/MissingFilesSelector.nuxt.test.js +6 -3
  57. package/{test → tests/unit}/components/ObjectSelector.nuxt.test.js +6 -3
  58. package/{test → tests/unit}/components/PackagesVersions.nuxt.test.js +5 -3
  59. package/{test → tests/unit}/components/Stepper.nuxt.test.js +1 -0
  60. package/{test → tests/unit}/components/Wrapper.nuxt.test.js +1 -1
  61. package/{test → tests/unit}/composables/api_fetch.nuxt.test.js +3 -2
  62. package/{test/composables/run_function_when_microservices_connected.test.js → tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js} +18 -5
  63. package/{test → tests/unit}/composables/upload_file.nuxt.test.js +7 -8
  64. package/{test → tests/unit}/stores/Feedback.nuxt.test.js +12 -8
  65. package/{test → tests/unit}/stores/Geode.nuxt.test.js +33 -10
  66. package/{test → tests/unit}/stores/Infra.nuxt.test.js +58 -25
  67. package/{test → tests/unit}/stores/Viewer.nuxt.test.js +101 -20
  68. package/{test → tests/unit}/utils/validate_schema.nuxt.test.js +3 -0
  69. package/tests/vitest.config.js +33 -0
  70. package/utils/default_styles.js +246 -0
  71. package/utils/local.js +180 -0
  72. package/geode-opengeodeweb-back-5.10.0-rc.5.tgz +0 -0
  73. package/geode-opengeodeweb-viewer-1.11.0-rc.3.tgz +0 -0
  74. package/vitest.config.js +0 -13
  75. /package/{test → tests/unit}/components/Inspector/ResultPanel.nuxt.test.js +0 -0
  76. /package/{test → tests/unit}/components/Step.nuxt.test.js +0 -0
@@ -0,0 +1,246 @@
1
+ // Global variables
2
+
3
+ const points_defaultVisibility = true
4
+ const edges_defaultVisibility = true
5
+ const polygons_defaultVisibility = true
6
+ const polyhedra_defaultVisibility = true
7
+ const points_defaultSize = 10
8
+ const points_defaultColor = { r: 20, g: 20, b: 20 }
9
+ const edges_defaultSize = 5
10
+ const edges_defaultColor = { r: 20, g: 20, b: 20 }
11
+ const polygons_defaultColor = { r: 255, g: 255, b: 255 }
12
+ const polyhedra_defaultColor = { r: 255, g: 255, b: 255 }
13
+
14
+ const corners_defaultVisibility = true
15
+ const lines_defaultVisibility = true
16
+ const surfaces_defaultVisibility = true
17
+ const blocks_defaultVisibility = true
18
+ const lines_defaultColor = { r: 20, g: 20, b: 20 }
19
+
20
+ // Mesh functions
21
+ const meshPointsDefaultStyle = (
22
+ visibility = points_defaultVisibility,
23
+ size = points_defaultSize,
24
+ color = points_defaultColor,
25
+ ) => {
26
+ return {
27
+ visibility,
28
+ coloring: {
29
+ active: "color",
30
+ color,
31
+ vertex: null,
32
+ },
33
+ size,
34
+ }
35
+ }
36
+
37
+ const meshEdgesDefaultStyle = (
38
+ visibility = edges_defaultVisibility,
39
+ size = edges_defaultSize,
40
+ color = edges_defaultColor,
41
+ ) => {
42
+ return {
43
+ visibility,
44
+ coloring: {
45
+ active: "color",
46
+ color,
47
+ },
48
+ size,
49
+ }
50
+ }
51
+
52
+ const meshPolygonsDefaultStyle = (
53
+ visibility = polygons_defaultVisibility,
54
+ color = polygons_defaultColor,
55
+ ) => {
56
+ return {
57
+ visibility,
58
+ coloring: {
59
+ active: "color",
60
+ color,
61
+ textures: null,
62
+ polygon: null,
63
+ vertex: null,
64
+ },
65
+ }
66
+ }
67
+
68
+ const meshPolyhedraDefaultStyle = (
69
+ visibility = polyhedra_defaultVisibility,
70
+ color = polyhedra_defaultColor,
71
+ ) => {
72
+ return {
73
+ visibility,
74
+ coloring: {
75
+ active: "color",
76
+ color,
77
+ polyhedron: null,
78
+ vertex: null,
79
+ },
80
+ }
81
+ }
82
+
83
+ const pointSet_defaultStyle = () => {
84
+ return {
85
+ visibility: true,
86
+ points: meshPointsDefaultStyle(),
87
+ }
88
+ }
89
+
90
+ const edgedCurve_defaultStyle = () => {
91
+ return {
92
+ visibility: true,
93
+ points: meshPointsDefaultStyle(false),
94
+ edges: meshEdgesDefaultStyle(),
95
+ }
96
+ }
97
+
98
+ const surface_defaultStyle = (visibility = true) => {
99
+ return {
100
+ visibility,
101
+ points: meshPointsDefaultStyle(false),
102
+ edges: meshEdgesDefaultStyle(false),
103
+ polygons: meshPolygonsDefaultStyle(),
104
+ }
105
+ }
106
+
107
+ const solid_defaultStyle = () => {
108
+ return {
109
+ visibility: true,
110
+ points: meshPointsDefaultStyle(false),
111
+ edges: meshEdgesDefaultStyle(false),
112
+ polygons: meshPolygonsDefaultStyle(),
113
+ polyhedra: meshPolyhedraDefaultStyle(),
114
+ }
115
+ }
116
+
117
+ // Model functions
118
+ const modelCornersDefaultStyle = (visibility = corners_defaultVisibility) => {
119
+ return { visibility }
120
+ }
121
+ const modelLinesDefaultStyle = (
122
+ visibility = lines_defaultVisibility,
123
+ color = lines_defaultColor,
124
+ ) => {
125
+ return { visibility, color }
126
+ }
127
+ const modelSurfacesDefaultStyle = (visibility = surfaces_defaultVisibility) => {
128
+ return { visibility }
129
+ }
130
+ const modelBlocksDefaultStyle = (visibility = blocks_defaultVisibility) => {
131
+ return { visibility }
132
+ }
133
+ const modelPointsDefaultStyle = (
134
+ visibility = points_defaultVisibility,
135
+ size,
136
+ ) => {
137
+ return { visibility, size }
138
+ }
139
+ const modelEdgesDefaultStyle = (visibility = edges_defaultVisibility) => {
140
+ return { visibility }
141
+ }
142
+
143
+ const brep_defaultStyle = () => {
144
+ return {
145
+ visibility: true,
146
+ corners: modelCornersDefaultStyle(),
147
+ lines: modelLinesDefaultStyle(),
148
+ surfaces: modelSurfacesDefaultStyle(),
149
+ blocks: modelBlocksDefaultStyle(),
150
+ points: modelPointsDefaultStyle(false, points_defaultSize),
151
+ edges: modelEdgesDefaultStyle(false, edges_defaultSize),
152
+ }
153
+ }
154
+
155
+ const crossSection_defaultStyle = () => {
156
+ return {
157
+ visibility: true,
158
+ corners: modelCornersDefaultStyle(),
159
+ lines: modelLinesDefaultStyle(),
160
+ surfaces: modelSurfacesDefaultStyle(),
161
+ points: modelPointsDefaultStyle(false, points_defaultSize),
162
+ edges: modelEdgesDefaultStyle(false, edges_defaultSize),
163
+ }
164
+ }
165
+
166
+ const structuralModel_defaultStyle = () => {
167
+ return {
168
+ visibility: true,
169
+ corners: modelCornersDefaultStyle(),
170
+ lines: modelLinesDefaultStyle(),
171
+ surfaces: modelSurfacesDefaultStyle(),
172
+ blocks: modelBlocksDefaultStyle(),
173
+ points: modelPointsDefaultStyle(false, points_defaultSize),
174
+ edges: modelEdgesDefaultStyle(false, edges_defaultSize),
175
+ }
176
+ }
177
+
178
+ const section_defaultStyle = () => {
179
+ return {
180
+ visibility: true,
181
+ corners: modelCornersDefaultStyle(),
182
+ lines: modelLinesDefaultStyle(),
183
+ surfaces: modelSurfacesDefaultStyle(),
184
+ points: modelPointsDefaultStyle(false, points_defaultSize),
185
+ edges: modelEdgesDefaultStyle(false, edges_defaultSize),
186
+ }
187
+ }
188
+
189
+ const implicitCrossSection_defaultStyle = () => {
190
+ return {
191
+ visibility: true,
192
+ corners: modelCornersDefaultStyle(),
193
+ lines: modelLinesDefaultStyle(),
194
+ surfaces: modelSurfacesDefaultStyle(),
195
+ points: modelPointsDefaultStyle(false, points_defaultSize),
196
+ edges: modelEdgesDefaultStyle(false, edges_defaultSize),
197
+ }
198
+ }
199
+
200
+ const implicitStructuralModel_defaultStyle = () => {
201
+ return {
202
+ visibility: true,
203
+ corners: modelCornersDefaultStyle(),
204
+ lines: modelLinesDefaultStyle(),
205
+ surfaces: modelSurfacesDefaultStyle(),
206
+ blocks: modelBlocksDefaultStyle(),
207
+ points: modelPointsDefaultStyle(false, points_defaultSize),
208
+ edges: modelEdgesDefaultStyle(false, edges_defaultSize),
209
+ }
210
+ }
211
+
212
+ const default_styles = () => {
213
+ return {
214
+ BRep: brep_defaultStyle(),
215
+ CrossSection: crossSection_defaultStyle(),
216
+ EdgedCurve2D: edgedCurve_defaultStyle(),
217
+ EdgedCurve3D: edgedCurve_defaultStyle(),
218
+ Graph: {},
219
+ HybridSolid3D: solid_defaultStyle(),
220
+ ImplicitCrossSection: implicitCrossSection_defaultStyle(),
221
+ ImplicitStructuralModel: implicitStructuralModel_defaultStyle(),
222
+ LightRegularGrid2D: surface_defaultStyle(),
223
+ LightRegularGrid3D: solid_defaultStyle(),
224
+ PointSet2D: pointSet_defaultStyle(),
225
+ PointSet3D: pointSet_defaultStyle(),
226
+ PolygonalSurface2D: surface_defaultStyle(),
227
+ PolygonalSurface3D: surface_defaultStyle(),
228
+ PolyhedralSolid3D: solid_defaultStyle(),
229
+ RasterImage2D: {},
230
+ RasterImage3D: {},
231
+ RegularGrid2D: surface_defaultStyle(),
232
+ RegularGrid3D: solid_defaultStyle(),
233
+ Section: section_defaultStyle(),
234
+ StructuralModel: structuralModel_defaultStyle(),
235
+ TetrahedralSolid3D: solid_defaultStyle(),
236
+ TriangulatedSurface2D: surface_defaultStyle(),
237
+ TriangulatedSurface3D: surface_defaultStyle(),
238
+ VertexSet: {},
239
+ }
240
+ }
241
+
242
+ function getDefaultStyle(type) {
243
+ return default_styles()[type]
244
+ }
245
+
246
+ export { getDefaultStyle }
package/utils/local.js ADDED
@@ -0,0 +1,180 @@
1
+ // Node.js imports
2
+ import fs from "fs"
3
+ import path from "path"
4
+ import child_process from "child_process"
5
+
6
+ // Third party imports
7
+ import pkg from "electron"
8
+ const { app, dialog } = pkg
9
+ import { getPort } from "get-port-please"
10
+ import pidtree from "pidtree"
11
+ import isElectron from "is-electron"
12
+
13
+ import { fileURLToPath } from "url"
14
+
15
+ const __filename = fileURLToPath(import.meta.url) // get the resolved path to the file
16
+ const __dirname = path.dirname(__filename) // get the name of the directory
17
+ console.log("__dirname", __dirname)
18
+
19
+ // Global variables
20
+ var processes = []
21
+
22
+ function venv_script_path(root_path, microservice_path) {
23
+ const venv_path = path.join(root_path, microservice_path, "venv")
24
+ var script_path
25
+ if (process.platform === "win32") {
26
+ script_path = path.join(venv_path, "Scripts")
27
+ } else {
28
+ script_path = path.join(venv_path, "bin")
29
+ }
30
+ return script_path
31
+ }
32
+
33
+ function executable_path(microservice_path, root_path = null) {
34
+ if (root_path != null) return venv_script_path(root_path, microservice_path)
35
+ if (isElectron()) {
36
+ if (app.isPackaged) {
37
+ return process.resourcesPath
38
+ }
39
+ return venv_script_path(app.getAppPath(), microservice_path)
40
+ }
41
+ return venv_script_path(process.cwd(), microservice_path)
42
+ }
43
+
44
+ function executable_name(name) {
45
+ if (process.platform === "win32") {
46
+ return name + ".exe"
47
+ }
48
+ return name
49
+ }
50
+
51
+ function create_path(path) {
52
+ if (!fs.existsSync(path)) {
53
+ fs.mkdir(path, (err) => {
54
+ if (err) {
55
+ return console.error(err)
56
+ }
57
+ console.log(`${path} directory created successfully!`)
58
+ })
59
+ }
60
+ return path
61
+ }
62
+
63
+ async function get_available_port(port) {
64
+ const available_port = await getPort({ port, host: "localhost" })
65
+ console.log("available_port", available_port)
66
+ return available_port
67
+ }
68
+
69
+ async function kill_processes() {
70
+ console.log("kill_processes", processes)
71
+ await processes.forEach(async function (proc) {
72
+ console.log(`Process ${proc} will be killed!`)
73
+ try {
74
+ process.kill(proc)
75
+ } catch (error) {
76
+ console.log(`${error} Process ${proc} could not be killed!`)
77
+ }
78
+ })
79
+ }
80
+
81
+ function register_children_processes(proc) {
82
+ pidtree(proc.pid, { root: true }, function (err, pids) {
83
+ if (err) console.log("err", err)
84
+ processes.push(...pids)
85
+ })
86
+ }
87
+
88
+ async function run_script(
89
+ command,
90
+ args,
91
+ expected_response,
92
+ timeout_seconds = 30,
93
+ ) {
94
+ return new Promise((resolve, reject) => {
95
+ setTimeout(() => {
96
+ reject("Timed out after " + timeout_seconds + " seconds")
97
+ }, timeout_seconds * 1000)
98
+ const child = child_process.spawn(command, args, {
99
+ encoding: "utf8",
100
+ shell: true,
101
+ })
102
+ register_children_processes(child)
103
+
104
+ // You can also use a variable to save the output for when the script closes later
105
+ child.stderr.setEncoding("utf8")
106
+ child.on("error", (error) => {
107
+ dialog.showMessageBox({
108
+ title: "Title",
109
+ type: "warning",
110
+ message: "Error occured.\r\n" + error,
111
+ })
112
+ })
113
+ child.stdout.setEncoding("utf8")
114
+ child.stdout.on("data", (data) => {
115
+ //Here is the output
116
+ data = data.toString()
117
+ if (data.includes(expected_response)) {
118
+ register_children_processes(child)
119
+ resolve(child)
120
+ }
121
+ console.log(data)
122
+ })
123
+ child.stderr.setEncoding("utf8")
124
+ child.stderr.on("data", (data) => {
125
+ console.log(data)
126
+ })
127
+
128
+ child.on("close", (_code) => {
129
+ //Here you can get the exit code of the script
130
+ console.log("Child Process exited with code " + _code)
131
+ })
132
+ child.on("kill", () => {
133
+ console.log("Child Process killed")
134
+ })
135
+ child.name = command.replace(/^.*[\\/]/, "")
136
+ })
137
+ }
138
+
139
+ async function run_back(port, data_folder_path) {
140
+ return new Promise(async (resolve, reject) => {
141
+ const back_command = path.join(
142
+ executable_path(path.join("microservices", "back")),
143
+ executable_name("vease-back"),
144
+ )
145
+ const back_port = await get_available_port(port)
146
+ const back_args = [
147
+ "--port " + back_port,
148
+ "--data_folder_path " + data_folder_path,
149
+ "--allowed_origin http://localhost:*",
150
+ "--timeout " + 0,
151
+ ]
152
+ await run_script(back_command, back_args, "Serving Flask app")
153
+ resolve(back_port)
154
+ })
155
+ }
156
+
157
+ async function run_viewer(viewer_path, args = { port, data_folder_path }) {
158
+ return new Promise(async (resolve, reject) => {
159
+ const viewer_port = await get_available_port(args.port)
160
+ const viewer_args = [
161
+ "--port " + viewer_port,
162
+ "--data_folder_path " + args.data_folder_path,
163
+ "--timeout " + 0,
164
+ ]
165
+ await run_script(viewer_path, viewer_args, "Starting factory")
166
+ resolve(viewer_port)
167
+ })
168
+ }
169
+
170
+ export {
171
+ create_path,
172
+ executable_name,
173
+ executable_path,
174
+ get_available_port,
175
+ kill_processes,
176
+ register_children_processes,
177
+ run_script,
178
+ run_back,
179
+ run_viewer,
180
+ }
package/vitest.config.js DELETED
@@ -1,13 +0,0 @@
1
- import { defineVitestConfig } from "@nuxt/test-utils/config"
2
-
3
- export default defineVitestConfig({
4
- test: {
5
- environment: "nuxt",
6
- globals: true,
7
- server: {
8
- deps: {
9
- inline: ["vuetify"],
10
- },
11
- },
12
- },
13
- })