@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.
Files changed (178) hide show
  1. package/.eslintrc.cjs +1 -0
  2. package/app/assets/geode_objects.js +1 -3
  3. package/app/components/Carousel.vue +7 -4
  4. package/app/components/CrsSelector.vue +5 -6
  5. package/app/components/DragAndDrop.vue +18 -8
  6. package/app/components/ExtensionSelector.vue +9 -17
  7. package/app/components/FeedBack/ErrorBanner.vue +1 -1
  8. package/app/components/FeedBack/Snackers.vue +4 -1
  9. package/app/components/FileSelector.vue +21 -10
  10. package/app/components/FileUploader.vue +15 -32
  11. package/app/components/HybridRenderingView.vue +5 -3
  12. package/app/components/Inspector/InspectionButton.vue +2 -2
  13. package/app/components/Inspector/ResultPanel.vue +4 -4
  14. package/app/components/Launcher.vue +1 -1
  15. package/app/components/Loading.vue +6 -6
  16. package/app/components/MissingFilesSelector.vue +23 -29
  17. package/app/components/ObjectSelector.vue +11 -10
  18. package/app/components/OptionCard.vue +1 -1
  19. package/app/components/PackagesVersions.vue +5 -3
  20. package/app/components/Recaptcha.vue +6 -4
  21. package/app/components/RemoteRenderingView.vue +4 -3
  22. package/app/components/Screenshot.vue +4 -4
  23. package/app/components/Step.vue +7 -7
  24. package/app/components/VeaseViewToolbar.vue +3 -3
  25. package/app/components/Viewer/BreadCrumb.vue +2 -4
  26. package/app/components/Viewer/ContextMenu.vue +77 -45
  27. package/app/components/Viewer/ContextMenuItem.vue +42 -33
  28. package/app/components/Viewer/EdgedCurve/PointsOptions.vue +3 -3
  29. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +5 -5
  30. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +6 -6
  31. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +5 -5
  32. package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +5 -5
  33. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +6 -7
  34. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +6 -6
  35. package/app/components/Viewer/Generic/Model/EdgesOptions.vue +3 -3
  36. package/app/components/Viewer/Generic/Model/PointsOptions.vue +4 -4
  37. package/app/components/Viewer/Grid/2D/CellsOptions.vue +3 -3
  38. package/app/components/Viewer/Grid/2D/EdgesOptions.vue +3 -3
  39. package/app/components/Viewer/Grid/2D/PointsOptions.vue +3 -3
  40. package/app/components/Viewer/Grid/3D/CellsOptions.vue +3 -3
  41. package/app/components/Viewer/Grid/3D/EdgesOptions.vue +3 -3
  42. package/app/components/Viewer/Grid/3D/FacetsOptions.vue +3 -3
  43. package/app/components/Viewer/Grid/3D/PointsOptions.vue +3 -3
  44. package/app/components/Viewer/HybridSolid/EdgesOptions.vue +3 -3
  45. package/app/components/Viewer/HybridSolid/PointsOptions.vue +3 -3
  46. package/app/components/Viewer/HybridSolid/PolygonsOptions.vue +3 -3
  47. package/app/components/Viewer/HybridSolid/PolyhedraOptions.vue +3 -3
  48. package/app/components/Viewer/Options/CellAttributeSelector.vue +23 -20
  49. package/app/components/Viewer/Options/ColorMapList.vue +75 -50
  50. package/app/components/Viewer/Options/ColorMapPicker.vue +38 -32
  51. package/app/components/Viewer/Options/ColorPicker.vue +3 -3
  52. package/app/components/Viewer/Options/ColoringTypeSelector.vue +29 -21
  53. package/app/components/Viewer/Options/EdgeAttributeSelector.vue +7 -7
  54. package/app/components/Viewer/Options/PolygonAttributeSelector.vue +7 -7
  55. package/app/components/Viewer/Options/PolyhedronAttributeSelector.vue +7 -7
  56. package/app/components/Viewer/Options/TextureItem.vue +5 -5
  57. package/app/components/Viewer/Options/TexturesSelector.vue +5 -5
  58. package/app/components/Viewer/Options/VertexAttributeSelector.vue +7 -7
  59. package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +5 -5
  60. package/app/components/Viewer/PolygonalSurface/EdgesOptions.vue +3 -3
  61. package/app/components/Viewer/PolygonalSurface/PointsOptions.vue +3 -3
  62. package/app/components/Viewer/PolygonalSurface/SpecificPolygonsOptions.vue +6 -6
  63. package/app/components/Viewer/Solid/EdgesOptions.vue +3 -3
  64. package/app/components/Viewer/Solid/PointsOptions.vue +3 -3
  65. package/app/components/Viewer/Solid/PolygonsOptions.vue +3 -3
  66. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +6 -6
  67. package/app/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue +3 -3
  68. package/app/components/Viewer/TetrahedralSolid/TrianglesOptions.vue +3 -3
  69. package/app/components/Viewer/Tree/ObjectTree.vue +7 -9
  70. package/app/components/Viewer/TreeComponent.vue +9 -13
  71. package/app/components/Viewer/TreeObject.vue +8 -9
  72. package/app/components/Viewer/TriangulatedSurface/EdgesOptions.vue +3 -3
  73. package/app/components/Viewer/TriangulatedSurface/PointsOptions.vue +3 -3
  74. package/app/components/Viewer/TriangulatedSurface/TrianglesOptions.vue +3 -3
  75. package/app/components/Wrapper.vue +1 -2
  76. package/app/components/ZScaling.vue +1 -1
  77. package/app/composables/project_manager.js +6 -6
  78. package/app/plugins/auto_store_register.js +1 -1
  79. package/app/stores/app.js +45 -41
  80. package/app/stores/data.js +52 -51
  81. package/app/stores/data_style.js +12 -11
  82. package/app/stores/feedback.js +5 -1
  83. package/app/stores/geode.js +16 -13
  84. package/app/stores/hybrid_viewer.js +72 -44
  85. package/app/stores/infra.js +18 -16
  86. package/app/stores/lambda.js +1 -9
  87. package/app/stores/menu.js +13 -13
  88. package/app/stores/treeview.js +15 -13
  89. package/app/stores/viewer.js +39 -33
  90. package/app/utils/app_mode.js +4 -3
  91. package/app/utils/default_styles.js +55 -47
  92. package/app/utils/file_import_workflow.js +4 -17
  93. package/app/utils/local.js +195 -184
  94. package/app/utils/upload_file.js +1 -2
  95. package/eslint.config.js +2 -2
  96. package/internal/database/database.js +17 -32
  97. package/internal/database/extended_database.js +25 -0
  98. package/internal/stores/data_style/mesh/cells/cell.js +3 -3
  99. package/internal/stores/data_style/mesh/cells/color.js +1 -1
  100. package/internal/stores/data_style/mesh/cells/index.js +7 -7
  101. package/internal/stores/data_style/mesh/cells/textures.js +1 -1
  102. package/internal/stores/data_style/mesh/cells/vertex.js +3 -3
  103. package/internal/stores/data_style/mesh/cells/visibility.js +1 -1
  104. package/internal/stores/data_style/mesh/edges/color.js +1 -1
  105. package/internal/stores/data_style/mesh/edges/edge.js +22 -22
  106. package/internal/stores/data_style/mesh/edges/index.js +7 -7
  107. package/internal/stores/data_style/mesh/edges/vertex.js +3 -3
  108. package/internal/stores/data_style/mesh/edges/visibility.js +1 -1
  109. package/internal/stores/data_style/mesh/edges/width.js +1 -1
  110. package/internal/stores/data_style/mesh/index.js +4 -5
  111. package/internal/stores/data_style/mesh/points/color.js +1 -1
  112. package/internal/stores/data_style/mesh/points/index.js +6 -6
  113. package/internal/stores/data_style/mesh/points/size.js +1 -1
  114. package/internal/stores/data_style/mesh/points/vertex.js +3 -3
  115. package/internal/stores/data_style/mesh/points/visibility.js +1 -1
  116. package/internal/stores/data_style/mesh/polygons/color.js +1 -1
  117. package/internal/stores/data_style/mesh/polygons/index.js +7 -7
  118. package/internal/stores/data_style/mesh/polygons/polygon.js +3 -3
  119. package/internal/stores/data_style/mesh/polygons/textures.js +1 -1
  120. package/internal/stores/data_style/mesh/polygons/vertex.js +3 -3
  121. package/internal/stores/data_style/mesh/polygons/visibility.js +1 -1
  122. package/internal/stores/data_style/mesh/polyhedra/color.js +1 -1
  123. package/internal/stores/data_style/mesh/polyhedra/index.js +6 -6
  124. package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +3 -3
  125. package/internal/stores/data_style/mesh/polyhedra/vertex.js +3 -3
  126. package/internal/stores/data_style/mesh/polyhedra/visibility.js +1 -1
  127. package/internal/stores/data_style/model/edges.js +1 -1
  128. package/internal/stores/data_style/model/index.js +32 -22
  129. package/internal/utils/api_fetch.js +8 -5
  130. package/internal/utils/viewer_call.js +42 -46
  131. package/nuxt.config.js +3 -3
  132. package/package.json +1 -1
  133. package/scripts/generate_geode_objects.js +8 -7
  134. package/tests/integration/setup.js +28 -21
  135. package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +18 -10
  136. package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +18 -10
  137. package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +9 -5
  138. package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +17 -10
  139. package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +18 -10
  140. package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +18 -10
  141. package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +10 -6
  142. package/tests/integration/stores/data_style/model/corners.nuxt.test.js +10 -6
  143. package/tests/integration/stores/data_style/model/edges.nuxt.test.js +9 -5
  144. package/tests/integration/stores/data_style/model/index.nuxt.test.js +9 -5
  145. package/tests/integration/stores/data_style/model/lines.nuxt.test.js +10 -6
  146. package/tests/integration/stores/data_style/model/points.nuxt.test.js +9 -5
  147. package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +10 -6
  148. package/tests/integration/stores/viewer.nuxt.test.js +55 -39
  149. package/tests/setup_indexeddb.js +1 -0
  150. package/tests/unit/components/CrsSelector.nuxt.test.js +18 -19
  151. package/tests/unit/components/ExtensionSelector.nuxt.test.js +24 -19
  152. package/tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js +23 -36
  153. package/tests/unit/components/FeedBack/Snackers.nuxt.test.js +20 -25
  154. package/tests/unit/components/FileSelector.nuxt.test.js +27 -27
  155. package/tests/unit/components/FileUploader.nuxt.test.js +18 -17
  156. package/tests/unit/components/Inspector/InspectionButton.nuxt.test.js +9 -16
  157. package/tests/unit/components/Inspector/ResultPanel.nuxt.test.js +8 -6
  158. package/tests/unit/components/Launcher.nuxt.test.js +12 -17
  159. package/tests/unit/components/MissingFilesSelector.nuxt.test.js +16 -19
  160. package/tests/unit/components/ObjectSelector.nuxt.test.js +30 -34
  161. package/tests/unit/components/PackagesVersions.nuxt.test.js +8 -11
  162. package/tests/unit/components/Step.nuxt.test.js +8 -7
  163. package/tests/unit/components/Stepper.nuxt.test.js +14 -12
  164. package/tests/unit/composables/ProjectManager.nuxt.test.js +142 -100
  165. package/tests/unit/composables/api_fetch.nuxt.test.js +12 -39
  166. package/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js +36 -61
  167. package/tests/unit/composables/upload_file.nuxt.test.js +21 -25
  168. package/tests/unit/plugins/project_load.nuxt.test.js +22 -21
  169. package/tests/unit/stores/App.nuxt.test.js +45 -43
  170. package/tests/unit/stores/Feedback.nuxt.test.js +16 -18
  171. package/tests/unit/stores/Geode.nuxt.test.js +135 -137
  172. package/tests/unit/stores/Infra.nuxt.test.js +20 -26
  173. package/tests/unit/stores/Lambda.nuxt.test.js +30 -31
  174. package/tests/unit/stores/Treeview.nuxt.test.js +53 -55
  175. package/tests/unit/stores/Viewer.nuxt.test.js +16 -23
  176. package/tests/unit/utils/validate_schema.nuxt.test.js +18 -18
  177. package/tests/utils.js +15 -2
  178. package/tests/vitest.config.js +6 -2
@@ -2,8 +2,8 @@
2
2
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
3
3
 
4
4
  // Local imports
5
- import { useViewerStore } from "@ogw_front/stores/viewer"
6
5
  import { useMeshPolyhedraCommonStyle } from "./common"
6
+ import { useViewerStore } from "@ogw_front/stores/viewer"
7
7
 
8
8
  // Local constants
9
9
  const meshPolyhedraVisibilitySchema =
@@ -38,7 +38,7 @@ export function useModelEdgesStyle() {
38
38
 
39
39
  function applyModelEdgesStyle(id) {
40
40
  const style = modelEdgesStyle(id)
41
- return Promise.all([setModelEdgesVisibility(id, style.visibility)])
41
+ return Promise.resolve([setModelEdgesVisibility(id, style.visibility)])
42
42
  }
43
43
 
44
44
  return {
@@ -2,16 +2,16 @@
2
2
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
3
3
 
4
4
  // Local imports
5
- import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer"
6
- import { useDataStyleStateStore } from "../state"
7
5
  import { useDataStore } from "@ogw_front/stores/data"
8
- import { useViewerStore } from "@ogw_front/stores/viewer"
9
- import { useModelSurfacesStyle } from "./surfaces"
10
- import { useModelCornersStyle } from "./corners"
6
+ import { useDataStyleStateStore } from "../state"
7
+ import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer"
11
8
  import { useModelBlocksStyle } from "./blocks"
12
- import { useModelLinesStyle } from "./lines"
9
+ import { useModelCornersStyle } from "./corners"
13
10
  import { useModelEdgesStyle } from "./edges"
11
+ import { useModelLinesStyle } from "./lines"
14
12
  import { useModelPointsStyle } from "./points"
13
+ import { useModelSurfacesStyle } from "./surfaces"
14
+ import { useViewerStore } from "@ogw_front/stores/viewer"
15
15
 
16
16
  // Local constants
17
17
  const model_schemas = viewer_schemas.opengeodeweb_viewer.model
@@ -48,23 +48,33 @@ export default function useModelStyle() {
48
48
  function visibleMeshComponents(id) {
49
49
  const visible_mesh_components = ref([])
50
50
  const styles = dataStyleStateStore.styles[id]
51
- if (!styles) return visible_mesh_components
51
+ if (!styles) {
52
+ return visible_mesh_components
53
+ }
52
54
 
53
- Object.entries(styles.corners || {}).forEach(([corner_id, style]) => {
54
- if (style.visibility) visible_mesh_components.value.push(corner_id)
55
- })
55
+ for (const [corner_id, style] of Object.entries(styles.corners || {})) {
56
+ if (style.visibility) {
57
+ visible_mesh_components.value.push(corner_id)
58
+ }
59
+ }
56
60
 
57
- Object.entries(styles.lines || {}).forEach(([line_id, style]) => {
58
- if (style.visibility) visible_mesh_components.value.push(line_id)
59
- })
61
+ for (const [line_id, style] of Object.entries(styles.lines || {})) {
62
+ if (style.visibility) {
63
+ visible_mesh_components.value.push(line_id)
64
+ }
65
+ }
60
66
 
61
- Object.entries(styles.surfaces || {}).forEach(([surface_id, style]) => {
62
- if (style.visibility) visible_mesh_components.value.push(surface_id)
63
- })
67
+ for (const [surface_id, style] of Object.entries(styles.surfaces || {})) {
68
+ if (style.visibility) {
69
+ visible_mesh_components.value.push(surface_id)
70
+ }
71
+ }
64
72
 
65
- Object.entries(styles.blocks || {}).forEach(([block_id, style]) => {
66
- if (style.visibility) visible_mesh_components.value.push(block_id)
67
- })
73
+ for (const [block_id, style] of Object.entries(styles.blocks || {})) {
74
+ if (style.visibility) {
75
+ visible_mesh_components.value.push(block_id)
76
+ }
77
+ }
68
78
 
69
79
  return visible_mesh_components
70
80
  }
@@ -79,7 +89,7 @@ export default function useModelStyle() {
79
89
  } else if (component_type === "Block") {
80
90
  return modelBlocksStyleStore.modelBlockVisibility(id, component_id)
81
91
  }
82
- throw new Error("Unknown model component_type: " + component_type)
92
+ throw new Error(`Unknown model component_type: ${component_type}`)
83
93
  }
84
94
 
85
95
  function modelColor(id) {
@@ -132,7 +142,7 @@ export default function useModelStyle() {
132
142
  visibility,
133
143
  )
134
144
  } else {
135
- throw new Error("Unknown model component_type: " + component_type)
145
+ throw new Error(`Unknown model component_type: ${component_type}`)
136
146
  }
137
147
  }
138
148
 
@@ -155,7 +165,7 @@ export default function useModelStyle() {
155
165
  } else if (key === "edges") {
156
166
  promise_array.push(modelEdgesStyleStore.applyModelEdgesStyle(id))
157
167
  } else {
158
- throw new Error("Unknown model key: " + key)
168
+ throw new Error(`Unknown model key: ${key}`)
159
169
  }
160
170
  }
161
171
  return Promise.all(promise_array)
@@ -1,6 +1,9 @@
1
+ // oxlint-disable-next-line id-length
1
2
  import _ from "lodash"
2
- import validate_schema from "@ogw_front/utils/validate_schema"
3
3
  import { useFeedbackStore } from "@ogw_front/stores/feedback"
4
+ import validate_schema from "@ogw_front/utils/validate_schema"
5
+
6
+ const ERROR_400 = 400
4
7
 
5
8
  export function api_fetch(
6
9
  microservice,
@@ -17,15 +20,15 @@ export function api_fetch(
17
20
  if (process.env.NODE_ENV !== "production") {
18
21
  console.log("Bad request", error, schema, params)
19
22
  }
20
- feedbackStore.add_error(400, schema.$id, "Bad request", error)
21
- throw new Error(schema.$id.concat(": ", error))
23
+ feedbackStore.add_error(ERROR_400, schema.$id, "Bad request", error)
24
+ throw new Error(`${schema.$id}: ${error}`)
22
25
  }
23
26
 
24
27
  microservice.start_request()
25
28
 
26
- const method = schema.methods.filter((method) => method !== "OPTIONS")[0]
29
+ const method = schema.methods.find((methodItem) => methodItem !== "OPTIONS")
27
30
  const request_options = {
28
- method: method,
31
+ method,
29
32
  }
30
33
  if (!_.isEmpty(body)) {
31
34
  request_options.body = body
@@ -1,7 +1,10 @@
1
- import validate_schema from "@ogw_front/utils/validate_schema"
1
+ import pTimeout from "p-timeout"
2
2
  import { useFeedbackStore } from "@ogw_front/stores/feedback"
3
+ import validate_schema from "@ogw_front/utils/validate_schema"
3
4
 
4
- export function viewer_call(
5
+ const ERROR_400 = 400
6
+
7
+ export async function viewer_call(
5
8
  microservice,
6
9
  { schema, params = {} },
7
10
  {
@@ -19,61 +22,54 @@ export function viewer_call(
19
22
  if (process.env.NODE_ENV !== "production") {
20
23
  console.log("Bad request", error, schema, params)
21
24
  }
22
- feedbackStore.add_error(400, schema.$id, "Bad request", error)
23
- throw new Error(schema.$id.concat(": ", error))
25
+ feedbackStore.add_error(ERROR_400, schema.$id, "Bad request", error)
26
+ throw new Error(`${schema.$id}: ${error}`)
24
27
  }
25
28
 
26
- const client = microservice.client
29
+ const { client } = microservice
27
30
 
28
- const promise = new Promise((resolve, reject) => {
31
+ async function performCall() {
29
32
  if (!client.getConnection) {
30
- resolve()
31
33
  return
32
34
  }
33
35
  microservice.start_request()
34
36
 
35
- client
36
- .getConnection()
37
- .getSession()
38
- .call(schema.$id, [params])
39
- .then(
40
- (value) => {
41
- if (response_function) {
42
- response_function(value)
43
- }
44
- resolve()
45
- },
46
- (reason) => {
47
- if (request_error_function) {
48
- request_error_function(reason)
49
- }
50
- reject()
51
- },
37
+ try {
38
+ const value = await client
39
+ .getConnection()
40
+ .getSession()
41
+ .call(schema.$id, [params])
42
+ if (response_function) {
43
+ response_function(value)
44
+ }
45
+ return value
46
+ } catch (error) {
47
+ feedbackStore.add_error(
48
+ error.code,
49
+ schema.$id,
50
+ error.message,
51
+ error.message,
52
52
  )
53
- .catch((error) => {
54
- feedbackStore.add_error(
55
- error.code,
56
- schema.$id,
57
- error.message,
58
- error.message,
59
- )
60
- if (response_error_function) {
61
- response_error_function(error)
62
- }
63
- reject()
64
- })
65
- .finally(() => {
66
- microservice.stop_request()
67
- })
68
- })
53
+ if (request_error_function) {
54
+ request_error_function(error)
55
+ }
56
+ if (response_error_function) {
57
+ response_error_function(error)
58
+ }
59
+ throw error
60
+ } finally {
61
+ microservice.stop_request()
62
+ }
63
+ }
64
+
69
65
  if (timeout !== undefined && timeout > 0) {
70
- const timeoutPromise = setTimeout(() => {
71
- reject(`${schema.$id}: Timed out after ${timeout}ms, ${schema} ${params}`)
72
- }, timeout)
73
- return Promise.race([promise, timeoutPromise])
74
- } else {
75
- return promise
66
+ return await pTimeout(performCall(), {
67
+ milliseconds: timeout,
68
+ message: `${schema.$id}: Timed out after ${timeout}ms`,
69
+ })
76
70
  }
71
+
72
+ return await performCall()
77
73
  }
78
74
 
79
75
  export default viewer_call
package/nuxt.config.js CHANGED
@@ -6,8 +6,8 @@ export default defineNuxtConfig({
6
6
  process.env.NODE_ENV === "production" ? process.env.SITE_BRANCH : "",
7
7
  PROJECT: process.env.NODE_ENV === "production" ? process.env.PROJECT : "",
8
8
  BROWSER: process.env.BROWSER ?? false,
9
- GEODE_PORT: process.env.GEODE_PORT ?? null,
10
- VIEWER_PORT: process.env.VIEWER_PORT ?? null,
9
+ GEODE_PORT: process.env.GEODE_PORT ?? undefined,
10
+ VIEWER_PORT: process.env.VIEWER_PORT ?? undefined,
11
11
  },
12
12
  },
13
13
 
@@ -20,7 +20,7 @@ export default defineNuxtConfig({
20
20
  },
21
21
 
22
22
  alias: {
23
- "@ogw_front": __dirname + "/app/",
23
+ "@ogw_front": `${__dirname}/app/`,
24
24
  },
25
25
 
26
26
  // ** Global CSS
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@geode/opengeodeweb-front",
3
3
  "description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
4
4
  "type": "module",
5
- "version": "10.3.0",
5
+ "version": "10.3.1",
6
6
  "main": "./nuxt.config.js",
7
7
  "scripts": {
8
8
  "lint": "eslint --fix --ext .js,.vue --ignore-path .gitignore .",
@@ -1,6 +1,7 @@
1
- import * as path from "path"
2
- import * as fs from "fs"
3
- import * as process from "process"
1
+ // oxlint-disable-next-line id-length
2
+ import fs from "node:fs"
3
+ import path from "node:path"
4
+ import process from "node:process"
4
5
 
5
6
  const output_file = path.join(process.cwd(), "assets/geode_objects")
6
7
 
@@ -8,9 +9,9 @@ if (fs.existsSync(output_file)) {
8
9
  fs.unlinkSync(output_file)
9
10
  }
10
11
 
11
- var files = fs.readdirSync("assets/img/geode_objects/")
12
- var imports = ""
13
- var geode_objects = "const geode_objects = {"
12
+ const files = fs.readdirSync("assets/img/geode_objects/")
13
+ let imports = ""
14
+ let geode_objects = "const geode_objects = {"
14
15
 
15
16
  for (const file of files) {
16
17
  const geode_object = file.replace(".svg", "")
@@ -20,6 +21,6 @@ for (const file of files) {
20
21
  geode_objects += `${geode_object}:{\n tooltip: "${geode_object}",\n image: ${geode_object},\n},\n`
21
22
  }
22
23
  geode_objects += "}\n\n export default geode_objects"
23
- fs.writeFileSync(output_file, imports + "\n" + geode_objects)
24
+ fs.writeFileSync(output_file, `${imports}\n${geode_objects}`)
24
25
 
25
26
  console.log("Fichier JS créé avec succès :", output_file)
@@ -1,26 +1,28 @@
1
1
  // Node.js imports
2
- import path from "path"
3
- import { v4 as uuidv4 } from "uuid"
4
2
  import { WebSocket } from "ws"
3
+ import path from "node:path"
4
+ import { v4 as uuidv4 } from "uuid"
5
5
 
6
6
  // Third party imports
7
- import { setActivePinia } from "pinia"
8
- import { createTestingPinia } from "@pinia/testing"
9
7
  import { afterAll, beforeAll, expect, vi } from "vitest"
10
8
 
11
9
  // Local imports
12
- import { useGeodeStore } from "@ogw_front/stores/geode"
13
- import { useViewerStore } from "@ogw_front/stores/viewer"
14
- import { useInfraStore } from "@ogw_front/stores/infra"
15
- import { appMode } from "@ogw_front/utils/app_mode"
16
- import { importFile } from "@ogw_front/utils/file_import_workflow"
17
- import Status from "@ogw_front/utils/status"
18
10
  import {
11
+ delete_folder_recursive,
19
12
  executable_name,
20
13
  executable_path,
14
+ kill_back,
15
+ kill_viewer,
21
16
  run_back,
22
17
  run_viewer,
23
18
  } from "@ogw_front/utils/local"
19
+ import Status from "@ogw_front/utils/status"
20
+ import { appMode } from "@ogw_front/utils/app_mode"
21
+ import { importFile } from "@ogw_front/utils/file_import_workflow"
22
+ import { setupActivePinia } from "../utils"
23
+ import { useGeodeStore } from "@ogw_front/stores/geode"
24
+ import { useInfraStore } from "@ogw_front/stores/infra"
25
+ import { useViewerStore } from "@ogw_front/stores/viewer"
24
26
 
25
27
  // Local constants
26
28
  const data_folder = path.join("tests", "integration", "data")
@@ -60,11 +62,7 @@ async function runMicroservices() {
60
62
  }
61
63
 
62
64
  async function setupIntegrationTests(file_name, geode_object) {
63
- const pinia = createTestingPinia({
64
- stubActions: false,
65
- createSpy: vi.fn,
66
- })
67
- setActivePinia(pinia)
65
+ setupActivePinia()
68
66
  const viewerStore = useViewerStore()
69
67
 
70
68
  const { back_port, viewer_port, project_folder_path } =
@@ -77,9 +75,9 @@ async function setupIntegrationTests(file_name, geode_object) {
77
75
  return { id, back_port, viewer_port, project_folder_path }
78
76
  }
79
77
 
80
- const mockLockRequest = vi.fn().mockImplementation(async (name, callback) => {
81
- return callback({ name })
82
- })
78
+ const mockLockRequest = vi
79
+ .fn()
80
+ .mockImplementation(async (name, task) => await task({ name }))
83
81
 
84
82
  vi.stubGlobal("navigator", {
85
83
  ...navigator,
@@ -89,11 +87,20 @@ vi.stubGlobal("navigator", {
89
87
  })
90
88
 
91
89
  beforeAll(() => {
92
- global.WebSocket = WebSocket
90
+ globalThis.WebSocket = WebSocket
93
91
  })
94
92
 
95
93
  afterAll(() => {
96
- delete global.WebSocket
94
+ delete globalThis.WebSocket
97
95
  })
98
96
 
99
- export { runMicroservices, setupIntegrationTests }
97
+ async function teardownIntegrationTests(
98
+ back_port,
99
+ viewer_port,
100
+ project_folder_path,
101
+ ) {
102
+ await Promise.all([kill_back(back_port), kill_viewer(viewer_port)])
103
+ delete_folder_recursive(project_folder_path)
104
+ }
105
+
106
+ export { runMicroservices, setupIntegrationTests, teardownIntegrationTests }
@@ -3,29 +3,33 @@ import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"
3
3
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json" with { type: "json" }
4
4
 
5
5
  // Local imports
6
- import Status from "@ogw_front/utils/status"
7
- import { useDataStyleStore } from "@ogw_front/stores/data_style"
8
- import { useViewerStore } from "@ogw_front/stores/viewer"
9
6
  import {
10
7
  delete_folder_recursive,
11
8
  kill_back,
12
9
  kill_viewer,
13
10
  } from "@ogw_front/utils/local"
11
+ import Status from "@ogw_front/utils/status"
14
12
  import { setupIntegrationTests } from "../../../setup"
13
+ import { useDataStyleStore } from "@ogw_front/stores/data_style"
14
+ import { useViewerStore } from "@ogw_front/stores/viewer"
15
15
 
16
16
  // Local constants
17
+ const INTERVAL_TIMEOUT = 20_000
17
18
  const mesh_cells_schemas = viewer_schemas.opengeodeweb_viewer.mesh.cells
18
19
  const file_name = "test.og_rgd2d"
19
20
  const geode_object = "RegularGrid2D"
20
21
  const vertex_attribute = { name: "points" }
21
22
  const cell_attribute = { name: "RGB_data" }
22
23
 
23
- let id, back_port, viewer_port, project_folder_path
24
+ let back_port = 0,
25
+ id = "",
26
+ project_folder_path = "",
27
+ viewer_port = 0
24
28
 
25
29
  beforeEach(async () => {
26
30
  ;({ id, back_port, viewer_port, project_folder_path } =
27
31
  await setupIntegrationTests(file_name, geode_object))
28
- }, 20000)
32
+ }, INTERVAL_TIMEOUT)
29
33
 
30
34
  afterEach(async () => {
31
35
  console.log(
@@ -155,21 +159,25 @@ describe("Mesh cells", () => {
155
159
  ),
156
160
  },
157
161
  ]
158
- for (let i = 0; i < coloringTypes.length; i++) {
159
- if (coloringTypes[i].function) {
160
- await coloringTypes[i].function()
162
+ async function testColoring(coloringType, expectedColoringType) {
163
+ if (coloringType.function) {
164
+ await coloringType.function()
161
165
  }
162
166
  const result = dataStyleStore.setMeshCellsActiveColoring(
163
167
  id,
164
- coloringTypes[i].name,
168
+ coloringType.name,
165
169
  )
166
170
  expect(result).toBeInstanceOf(Promise)
167
171
  await result
168
172
  expect(dataStyleStore.meshCellsActiveColoring(id)).toBe(
169
- coloringTypes[i].name,
173
+ expectedColoringType,
170
174
  )
171
175
  expect(viewerStore.status).toBe(Status.CONNECTED)
172
176
  }
177
+
178
+ await testColoring(coloringTypes[0], "color")
179
+ await testColoring(coloringTypes[1], "vertex")
180
+ await testColoring(coloringTypes[2], "cell")
173
181
  })
174
182
  })
175
183
 
@@ -3,29 +3,33 @@ import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"
3
3
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json" with { type: "json" }
4
4
 
5
5
  // Local imports
6
- import Status from "@ogw_front/utils/status"
7
- import { useDataStyleStore } from "@ogw_front/stores/data_style"
8
- import { useViewerStore } from "@ogw_front/stores/viewer"
9
6
  import {
10
7
  delete_folder_recursive,
11
8
  kill_back,
12
9
  kill_viewer,
13
10
  } from "@ogw_front/utils/local"
11
+ import Status from "@ogw_front/utils/status"
14
12
  import { setupIntegrationTests } from "../../../setup"
13
+ import { useDataStyleStore } from "@ogw_front/stores/data_style"
14
+ import { useViewerStore } from "@ogw_front/stores/viewer"
15
15
 
16
16
  // Local constants
17
+ const INTERVAL_TIMEOUT = 25_000
17
18
  const mesh_edges_schemas = viewer_schemas.opengeodeweb_viewer.mesh.edges
18
19
  const file_name = "test.og_edc3d"
19
20
  const geode_object = "EdgedCurve3D"
20
21
  const vertex_attribute = { name: "vertex_attribute" }
21
22
  const edge_attribute = { name: "edge_attribute" }
22
23
 
23
- let id, back_port, viewer_port, project_folder_path
24
+ let back_port = 0,
25
+ id = "",
26
+ project_folder_path = "",
27
+ viewer_port = 0
24
28
 
25
29
  beforeEach(async () => {
26
30
  ;({ id, back_port, viewer_port, project_folder_path } =
27
31
  await setupIntegrationTests(file_name, geode_object))
28
- }, 25000)
32
+ }, INTERVAL_TIMEOUT)
29
33
 
30
34
  afterEach(async () => {
31
35
  console.log(
@@ -144,21 +148,25 @@ describe("Mesh edges", () => {
144
148
  ),
145
149
  },
146
150
  ]
147
- for (let i = 0; i < coloringTypes.length; i++) {
148
- if (coloringTypes[i].function) {
149
- await coloringTypes[i].function()
151
+ async function testColoring(coloringType) {
152
+ if (coloringType.function) {
153
+ await coloringType.function()
150
154
  }
151
155
  const result = dataStyleStore.setMeshEdgesActiveColoring(
152
156
  id,
153
- coloringTypes[i].name,
157
+ coloringType.name,
154
158
  )
155
159
  expect(result).toBeInstanceOf(Promise)
156
160
  await result
157
161
  expect(dataStyleStore.meshEdgesActiveColoring(id)).toBe(
158
- coloringTypes[i].name,
162
+ coloringType.name,
159
163
  )
160
164
  expect(viewerStore.status).toBe(Status.CONNECTED)
161
165
  }
166
+
167
+ await testColoring(coloringTypes[0])
168
+ await testColoring(coloringTypes[1])
169
+ await testColoring(coloringTypes[2])
162
170
  })
163
171
  test("Edges apply style", async () => {
164
172
  const dataStyleStore = useDataStyleStore()
@@ -3,27 +3,31 @@ import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"
3
3
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json" with { type: "json" }
4
4
 
5
5
  // Local imports
6
- import Status from "@ogw_front/utils/status"
7
- import { useDataStyleStore } from "@ogw_front/stores/data_style"
8
- import { useViewerStore } from "@ogw_front/stores/viewer"
9
6
  import {
10
7
  delete_folder_recursive,
11
8
  kill_back,
12
9
  kill_viewer,
13
10
  } from "@ogw_front/utils/local"
11
+ import Status from "@ogw_front/utils/status"
14
12
  import { setupIntegrationTests } from "../../../setup"
13
+ import { useDataStyleStore } from "@ogw_front/stores/data_style"
14
+ import { useViewerStore } from "@ogw_front/stores/viewer"
15
15
 
16
16
  // Local constants
17
+ const INTERVAL_TIMEOUT = 20_000
17
18
  const mesh_schemas = viewer_schemas.opengeodeweb_viewer.mesh
18
19
  const file_name = "test.og_rgd3d"
19
20
  const geode_object = "RegularGrid3D"
20
21
 
21
- let id, back_port, viewer_port, project_folder_path
22
+ let back_port = 0,
23
+ id = "",
24
+ project_folder_path = "",
25
+ viewer_port = 0
22
26
 
23
27
  beforeEach(async () => {
24
28
  ;({ id, back_port, viewer_port, project_folder_path } =
25
29
  await setupIntegrationTests(file_name, geode_object))
26
- }, 20000)
30
+ }, INTERVAL_TIMEOUT)
27
31
 
28
32
  afterEach(async () => {
29
33
  console.log(
@@ -3,28 +3,32 @@ import { afterEach, beforeEach, describe, expect, test, vi } from "vitest"
3
3
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json" with { type: "json" }
4
4
 
5
5
  // Local imports
6
- import Status from "@ogw_front/utils/status"
7
- import { useDataStyleStore } from "@ogw_front/stores/data_style"
8
- import { useViewerStore } from "@ogw_front/stores/viewer"
9
6
  import {
10
7
  delete_folder_recursive,
11
8
  kill_back,
12
9
  kill_viewer,
13
10
  } from "@ogw_front/utils/local"
11
+ import Status from "@ogw_front/utils/status"
14
12
  import { setupIntegrationTests } from "../../../setup"
13
+ import { useDataStyleStore } from "@ogw_front/stores/data_style"
14
+ import { useViewerStore } from "@ogw_front/stores/viewer"
15
15
 
16
16
  // Local constants
17
+ const INTERVAL_TIMEOUT = 20_000
17
18
  const mesh_points_schemas = viewer_schemas.opengeodeweb_viewer.mesh.points
18
19
  const file_name = "test.og_edc2d"
19
20
  const geode_object = "EdgedCurve2D"
20
21
  const vertex_attribute = { name: "points" }
21
22
 
22
- let id, back_port, viewer_port, project_folder_path
23
+ let back_port = 0,
24
+ id = "",
25
+ project_folder_path = "",
26
+ viewer_port = 0
23
27
 
24
28
  beforeEach(async () => {
25
29
  ;({ id, back_port, viewer_port, project_folder_path } =
26
30
  await setupIntegrationTests(file_name, geode_object))
27
- }, 20000)
31
+ }, INTERVAL_TIMEOUT)
28
32
 
29
33
  afterEach(async () => {
30
34
  console.log(
@@ -95,21 +99,24 @@ describe("Mesh points", () => {
95
99
  ),
96
100
  },
97
101
  ]
98
- for (let i = 0; i < coloringTypes.length; i++) {
99
- if (coloringTypes[i].function) {
100
- await coloringTypes[i].function()
102
+ async function testColoring(coloringType, expectedColoringType) {
103
+ if (coloringType.function) {
104
+ await coloringType.function()
101
105
  }
102
106
  const result = dataStyleStore.setMeshPointsActiveColoring(
103
107
  id,
104
- coloringTypes[i].name,
108
+ coloringType.name,
105
109
  )
106
110
  expect(result).toBeInstanceOf(Promise)
107
111
  await result
108
112
  expect(dataStyleStore.meshPointsActiveColoring(id)).toBe(
109
- coloringTypes[i].name,
113
+ expectedColoringType,
110
114
  )
111
115
  expect(viewerStore.status).toBe(Status.CONNECTED)
112
116
  }
117
+
118
+ await testColoring(coloringTypes[0], "color")
119
+ await testColoring(coloringTypes[1], "vertex")
113
120
  })
114
121
  })
115
122