@geode/opengeodeweb-front 10.6.2 → 10.6.3-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.
Files changed (235) hide show
  1. package/.eslintrc.cjs +1 -1
  2. package/.oxlintrc.json +3 -22
  3. package/app/assets/geode_objects.js +26 -26
  4. package/app/components/Carousel.vue +62 -66
  5. package/app/components/CrsSelector.vue +48 -52
  6. package/app/components/DeleteDialog.vue +21 -37
  7. package/app/components/DragAndDrop.vue +35 -41
  8. package/app/components/ExtensionSelector.vue +50 -63
  9. package/app/components/FeedBack/ErrorBanner.vue +7 -10
  10. package/app/components/FeedBack/Snackers.vue +12 -14
  11. package/app/components/FetchingData.vue +1 -6
  12. package/app/components/FileSelector.vue +41 -47
  13. package/app/components/FileUploader.vue +62 -79
  14. package/app/components/GlassCard.vue +19 -19
  15. package/app/components/HybridRenderingView.vue +37 -38
  16. package/app/components/InfraConnected.vue +3 -3
  17. package/app/components/Inspector/InspectionButton.vue +27 -31
  18. package/app/components/Inspector/ResultPanel.vue +13 -24
  19. package/app/components/Launcher.vue +13 -13
  20. package/app/components/Loading.vue +63 -69
  21. package/app/components/MissingFilesSelector.vue +53 -73
  22. package/app/components/ObjectSelector.vue +81 -99
  23. package/app/components/PackagesVersions.vue +27 -30
  24. package/app/components/Recaptcha.vue +60 -71
  25. package/app/components/RemoteRenderingView.vue +102 -108
  26. package/app/components/Screenshot.vue +36 -42
  27. package/app/components/SearchBar.vue +5 -5
  28. package/app/components/Step.vue +37 -44
  29. package/app/components/Stepper.vue +29 -35
  30. package/app/components/VeaseViewToolbar.vue +69 -78
  31. package/app/components/ViewToolbar.vue +41 -45
  32. package/app/components/Viewer/BreadCrumb.vue +18 -30
  33. package/app/components/Viewer/ContextMenu.vue +176 -179
  34. package/app/components/Viewer/ContextMenuItem.vue +105 -117
  35. package/app/components/Viewer/EdgedCurve/PointsOptions.vue +6 -9
  36. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +82 -93
  37. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +84 -99
  38. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +83 -98
  39. package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +62 -73
  40. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +84 -108
  41. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +82 -105
  42. package/app/components/Viewer/Generic/Model/EdgesOptions.vue +19 -23
  43. package/app/components/Viewer/Generic/Model/PointsOptions.vue +26 -30
  44. package/app/components/Viewer/Grid/2D/CellsOptions.vue +5 -5
  45. package/app/components/Viewer/Grid/2D/EdgesOptions.vue +6 -9
  46. package/app/components/Viewer/Grid/2D/PointsOptions.vue +6 -9
  47. package/app/components/Viewer/Grid/3D/CellsOptions.vue +5 -5
  48. package/app/components/Viewer/Grid/3D/EdgesOptions.vue +6 -9
  49. package/app/components/Viewer/Grid/3D/FacetsOptions.vue +5 -5
  50. package/app/components/Viewer/Grid/3D/PointsOptions.vue +6 -9
  51. package/app/components/Viewer/HybridSolid/EdgesOptions.vue +6 -9
  52. package/app/components/Viewer/HybridSolid/PointsOptions.vue +6 -9
  53. package/app/components/Viewer/HybridSolid/PolygonsOptions.vue +6 -9
  54. package/app/components/Viewer/HybridSolid/PolyhedraOptions.vue +6 -9
  55. package/app/components/Viewer/Options/AttributeColorBar.vue +8 -8
  56. package/app/components/Viewer/Options/AttributeSelector.vue +73 -78
  57. package/app/components/Viewer/Options/ColorMapList.vue +115 -140
  58. package/app/components/Viewer/Options/ColorMapPicker.vue +128 -142
  59. package/app/components/Viewer/Options/ColorPicker.vue +9 -9
  60. package/app/components/Viewer/Options/ColoringTypeSelector.vue +77 -91
  61. package/app/components/Viewer/Options/TextureItem.vue +54 -58
  62. package/app/components/Viewer/Options/TexturesSelector.vue +22 -26
  63. package/app/components/Viewer/Options/VisibilitySwitch.vue +1 -1
  64. package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +61 -68
  65. package/app/components/Viewer/PolygonalSurface/EdgesOptions.vue +6 -9
  66. package/app/components/Viewer/PolygonalSurface/PointsOptions.vue +6 -9
  67. package/app/components/Viewer/PolygonalSurface/SpecificPolygonsOptions.vue +83 -103
  68. package/app/components/Viewer/Solid/EdgesOptions.vue +6 -9
  69. package/app/components/Viewer/Solid/PointsOptions.vue +6 -9
  70. package/app/components/Viewer/Solid/PolygonsOptions.vue +6 -9
  71. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +82 -105
  72. package/app/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue +5 -5
  73. package/app/components/Viewer/TetrahedralSolid/TrianglesOptions.vue +5 -5
  74. package/app/components/Viewer/Tree/ObjectTree.vue +80 -89
  75. package/app/components/Viewer/TreeComponent.vue +43 -49
  76. package/app/components/Viewer/TreeObject.vue +48 -50
  77. package/app/components/Viewer/TriangulatedSurface/EdgesOptions.vue +6 -9
  78. package/app/components/Viewer/TriangulatedSurface/PointsOptions.vue +5 -5
  79. package/app/components/Viewer/TriangulatedSurface/TrianglesOptions.vue +5 -5
  80. package/app/components/Wrapper.vue +8 -8
  81. package/app/components/ZScaling.vue +18 -27
  82. package/app/composables/project_manager.js +57 -67
  83. package/app/composables/run_function_when_microservices_connected.js +8 -8
  84. package/app/plugins/auto_store_register.js +11 -13
  85. package/app/stores/app.js +118 -138
  86. package/app/stores/data.js +52 -68
  87. package/app/stores/data_style.js +36 -36
  88. package/app/stores/feedback.js +17 -20
  89. package/app/stores/geode.js +54 -55
  90. package/app/stores/hybrid_viewer.js +164 -177
  91. package/app/stores/infra.js +45 -55
  92. package/app/stores/lambda.js +26 -26
  93. package/app/stores/menu.js +78 -85
  94. package/app/stores/treeview.js +57 -65
  95. package/app/stores/viewer.js +92 -104
  96. package/app/utils/colormap.js +3 -3
  97. package/app/utils/config.js +16 -22
  98. package/app/utils/default_styles.js +50 -62
  99. package/app/utils/extension.js +44 -44
  100. package/app/utils/file_import_workflow.js +50 -64
  101. package/app/utils/local/app_mode.js +2 -2
  102. package/app/utils/local/cleanup.js +66 -72
  103. package/app/utils/local/microservices.js +61 -71
  104. package/app/utils/local/path.js +16 -19
  105. package/app/utils/local/scripts.js +22 -22
  106. package/app/utils/recaptcha.js +6 -6
  107. package/app/utils/server.js +21 -24
  108. package/app/utils/status.js +2 -2
  109. package/app/utils/treeview.js +4 -4
  110. package/app/utils/validate_schema.js +7 -7
  111. package/commitlint.config.js +2 -2
  112. package/eslint.config.js +4 -4
  113. package/internal/database/database.js +38 -46
  114. package/internal/database/extended_database.js +9 -10
  115. package/internal/database/tables/data.js +2 -3
  116. package/internal/database/tables/model_components.js +1 -1
  117. package/internal/database/tables/model_components_relation.js +1 -1
  118. package/internal/stores/data_style/mesh/cells/cell.js +47 -63
  119. package/internal/stores/data_style/mesh/cells/color.js +11 -16
  120. package/internal/stores/data_style/mesh/cells/common.js +6 -6
  121. package/internal/stores/data_style/mesh/cells/index.js +37 -47
  122. package/internal/stores/data_style/mesh/cells/textures.js +11 -12
  123. package/internal/stores/data_style/mesh/cells/vertex.js +47 -58
  124. package/internal/stores/data_style/mesh/cells/visibility.js +11 -16
  125. package/internal/stores/data_style/mesh/edges/color.js +11 -16
  126. package/internal/stores/data_style/mesh/edges/common.js +6 -6
  127. package/internal/stores/data_style/mesh/edges/edge.js +47 -63
  128. package/internal/stores/data_style/mesh/edges/index.js +38 -52
  129. package/internal/stores/data_style/mesh/edges/vertex.js +47 -58
  130. package/internal/stores/data_style/mesh/edges/visibility.js +11 -16
  131. package/internal/stores/data_style/mesh/edges/width.js +11 -16
  132. package/internal/stores/data_style/mesh/index.js +34 -34
  133. package/internal/stores/data_style/mesh/points/color.js +11 -16
  134. package/internal/stores/data_style/mesh/points/common.js +6 -6
  135. package/internal/stores/data_style/mesh/points/index.js +35 -49
  136. package/internal/stores/data_style/mesh/points/size.js +11 -16
  137. package/internal/stores/data_style/mesh/points/vertex.js +47 -58
  138. package/internal/stores/data_style/mesh/points/visibility.js +11 -16
  139. package/internal/stores/data_style/mesh/polygons/color.js +11 -16
  140. package/internal/stores/data_style/mesh/polygons/common.js +6 -6
  141. package/internal/stores/data_style/mesh/polygons/index.js +36 -45
  142. package/internal/stores/data_style/mesh/polygons/polygon.js +45 -56
  143. package/internal/stores/data_style/mesh/polygons/textures.js +11 -16
  144. package/internal/stores/data_style/mesh/polygons/vertex.js +47 -58
  145. package/internal/stores/data_style/mesh/polygons/visibility.js +11 -16
  146. package/internal/stores/data_style/mesh/polyhedra/color.js +11 -16
  147. package/internal/stores/data_style/mesh/polyhedra/common.js +6 -6
  148. package/internal/stores/data_style/mesh/polyhedra/index.js +29 -42
  149. package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +43 -47
  150. package/internal/stores/data_style/mesh/polyhedra/vertex.js +47 -58
  151. package/internal/stores/data_style/mesh/polyhedra/visibility.js +11 -17
  152. package/internal/stores/data_style/model/blocks/color.js +21 -24
  153. package/internal/stores/data_style/model/blocks/common.js +6 -6
  154. package/internal/stores/data_style/model/blocks/index.js +13 -17
  155. package/internal/stores/data_style/model/blocks/visibility.js +21 -24
  156. package/internal/stores/data_style/model/corners/color.js +21 -24
  157. package/internal/stores/data_style/model/corners/common.js +6 -6
  158. package/internal/stores/data_style/model/corners/index.js +14 -18
  159. package/internal/stores/data_style/model/corners/visibility.js +21 -25
  160. package/internal/stores/data_style/model/edges/common.js +4 -4
  161. package/internal/stores/data_style/model/edges/index.js +7 -7
  162. package/internal/stores/data_style/model/edges/visibility.js +11 -15
  163. package/internal/stores/data_style/model/index.js +84 -100
  164. package/internal/stores/data_style/model/lines/color.js +21 -24
  165. package/internal/stores/data_style/model/lines/common.js +6 -6
  166. package/internal/stores/data_style/model/lines/index.js +13 -17
  167. package/internal/stores/data_style/model/lines/visibility.js +21 -24
  168. package/internal/stores/data_style/model/points/common.js +4 -4
  169. package/internal/stores/data_style/model/points/index.js +9 -9
  170. package/internal/stores/data_style/model/points/size.js +11 -11
  171. package/internal/stores/data_style/model/points/visibility.js +11 -15
  172. package/internal/stores/data_style/model/surfaces/color.js +21 -24
  173. package/internal/stores/data_style/model/surfaces/common.js +6 -6
  174. package/internal/stores/data_style/model/surfaces/index.js +14 -22
  175. package/internal/stores/data_style/model/surfaces/visibility.js +18 -22
  176. package/internal/stores/data_style/state.js +11 -11
  177. package/internal/utils/api_fetch.js +24 -34
  178. package/internal/utils/upload_file.js +19 -24
  179. package/internal/utils/viewer_call.js +23 -36
  180. package/nuxt.config.js +7 -11
  181. package/package.json +3 -3
  182. package/scripts/generate_geode_objects.js +14 -16
  183. package/server/api/app/kill.post.js +4 -4
  184. package/server/api/app/project_folder_path.post.js +11 -11
  185. package/server/api/app/run_back.post.js +12 -12
  186. package/server/api/app/run_viewer.post.js +12 -12
  187. package/server/api/extensions/run.post.js +34 -41
  188. package/server/api/extensions/upload.put.js +48 -62
  189. package/tests/integration/setup.js +43 -53
  190. package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +90 -116
  191. package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +81 -107
  192. package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +38 -41
  193. package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +85 -101
  194. package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +89 -113
  195. package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +81 -105
  196. package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +56 -73
  197. package/tests/integration/stores/data_style/model/corners.nuxt.test.js +59 -76
  198. package/tests/integration/stores/data_style/model/edges.nuxt.test.js +39 -42
  199. package/tests/integration/stores/data_style/model/index.nuxt.test.js +31 -34
  200. package/tests/integration/stores/data_style/model/lines.nuxt.test.js +60 -73
  201. package/tests/integration/stores/data_style/model/points.nuxt.test.js +52 -55
  202. package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +59 -80
  203. package/tests/integration/stores/viewer.nuxt.test.js +35 -38
  204. package/tests/setup_indexeddb.js +2 -2
  205. package/tests/unit/components/CrsSelector.nuxt.test.js +28 -28
  206. package/tests/unit/components/ExtensionSelector.nuxt.test.js +33 -35
  207. package/tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js +23 -23
  208. package/tests/unit/components/FeedBack/Snackers.nuxt.test.js +18 -18
  209. package/tests/unit/components/FileSelector.nuxt.test.js +57 -59
  210. package/tests/unit/components/FileUploader.nuxt.test.js +35 -39
  211. package/tests/unit/components/Inspector/InspectionButton.nuxt.test.js +28 -28
  212. package/tests/unit/components/Inspector/ResultPanel.nuxt.test.js +22 -27
  213. package/tests/unit/components/Launcher.nuxt.test.js +20 -22
  214. package/tests/unit/components/MissingFilesSelector.nuxt.test.js +37 -37
  215. package/tests/unit/components/ObjectSelector.nuxt.test.js +62 -62
  216. package/tests/unit/components/PackagesVersions.nuxt.test.js +16 -16
  217. package/tests/unit/components/Step.nuxt.test.js +18 -19
  218. package/tests/unit/components/Stepper.nuxt.test.js +18 -18
  219. package/tests/unit/composables/api_fetch.nuxt.test.js +34 -36
  220. package/tests/unit/composables/project_manager.nuxt.test.js +93 -112
  221. package/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js +36 -36
  222. package/tests/unit/composables/upload_file.nuxt.test.js +27 -29
  223. package/tests/unit/plugins/project_load.nuxt.test.js +31 -33
  224. package/tests/unit/stores/app.nuxt.test.js +90 -92
  225. package/tests/unit/stores/feedback.nuxt.test.js +47 -57
  226. package/tests/unit/stores/geode.nuxt.test.js +111 -115
  227. package/tests/unit/stores/infra.nuxt.test.js +148 -148
  228. package/tests/unit/stores/lambda.nuxt.test.js +72 -74
  229. package/tests/unit/stores/treeview.nuxt.test.js +19 -21
  230. package/tests/unit/stores/viewer.nuxt.test.js +109 -122
  231. package/tests/unit/utils/recaptcha.nuxt.test.js +25 -29
  232. package/tests/unit/utils/validate_schema.nuxt.test.js +17 -17
  233. package/tests/utils.js +11 -11
  234. package/tests/vitest.config.js +9 -9
  235. package/vuetify_config.js +2 -2
@@ -1,22 +1,22 @@
1
1
  // Third party imports
2
- import { computed, reactive, ref, shallowRef } from "vue"
3
- import { describe, expect, test } from "vitest"
4
- import ResizeObserver from "resize-observer-polyfill"
5
- import { mountSuspended } from "@nuxt/test-utils/runtime"
2
+ import { computed, reactive, ref, shallowRef } from "vue";
3
+ import { describe, expect, test } from "vitest";
4
+ import ResizeObserver from "resize-observer-polyfill";
5
+ import { mountSuspended } from "@nuxt/test-utils/runtime";
6
6
 
7
7
  // Local imports
8
- import ObjectSelector from "@ogw_front/components/ObjectSelector"
9
- import Stepper from "@ogw_front/components/Stepper"
10
- import { vuetify } from "@ogw_tests/utils"
8
+ import ObjectSelector from "@ogw_front/components/ObjectSelector";
9
+ import Stepper from "@ogw_front/components/Stepper";
10
+ import { vuetify } from "@ogw_tests/utils";
11
11
 
12
- const FIRST_INDEX = 0
12
+ const FIRST_INDEX = 0;
13
13
 
14
- globalThis.ResizeObserver = ResizeObserver
14
+ globalThis.ResizeObserver = ResizeObserver;
15
15
 
16
16
  describe(Stepper, () => {
17
17
  test(`Mount`, async () => {
18
- const geode_object_type = ref("BRep")
19
- const files = ref([])
18
+ const geode_object_type = ref("BRep");
19
+ const files = ref([]);
20
20
  const stepper_tree = reactive({
21
21
  current_step_index: ref(FIRST_INDEX),
22
22
  geode_object_type,
@@ -32,19 +32,19 @@ describe(Stepper, () => {
32
32
  },
33
33
  chips: computed(() => {
34
34
  if (geode_object_type.value === "") {
35
- return []
35
+ return [];
36
36
  }
37
- return [geode_object_type.value]
37
+ return [geode_object_type.value];
38
38
  }),
39
39
  },
40
40
  ],
41
- })
41
+ });
42
42
  const wrapper = await mountSuspended(Stepper, {
43
43
  global: {
44
44
  plugins: [vuetify],
45
45
  provide: { stepper_tree },
46
46
  },
47
- })
48
- expect(wrapper.exists()).toBeTruthy()
49
- })
50
- })
47
+ });
48
+ expect(wrapper.exists()).toBeTruthy();
49
+ });
50
+ });
@@ -1,19 +1,19 @@
1
1
  // Third party imports
2
- import { beforeEach, describe, expect, test } from "vitest"
3
- import { registerEndpoint } from "@nuxt/test-utils/runtime"
2
+ import { beforeEach, describe, expect, test } from "vitest";
3
+ import { registerEndpoint } from "@nuxt/test-utils/runtime";
4
4
 
5
5
  // Local imports
6
- import { setupActivePinia } from "@ogw_tests/utils"
7
- import { useFeedbackStore } from "@ogw_front/stores/feedback"
8
- import { useGeodeStore } from "@ogw_front/stores/geode"
6
+ import { setupActivePinia } from "@ogw_tests/utils";
7
+ import { useFeedbackStore } from "@ogw_front/stores/feedback";
8
+ import { useGeodeStore } from "@ogw_front/stores/geode";
9
9
 
10
- const FIRST_INDEX = 0
10
+ const FIRST_INDEX = 0;
11
11
 
12
12
  describe("geodeStore.request()", () => {
13
- setupActivePinia()
14
- const geodeStore = useGeodeStore()
15
- const feedbackStore = useFeedbackStore()
16
- geodeStore.base_url = ""
13
+ setupActivePinia();
14
+ const geodeStore = useGeodeStore();
15
+ const feedbackStore = useFeedbackStore();
16
+ geodeStore.base_url = "";
17
17
 
18
18
  const schema = {
19
19
  $id: "/test",
@@ -26,15 +26,15 @@ describe("geodeStore.request()", () => {
26
26
  },
27
27
  required: ["test"],
28
28
  additionalProperties: false,
29
- }
29
+ };
30
30
 
31
31
  beforeEach(async () => {
32
- await feedbackStore.$reset()
33
- await geodeStore.$reset()
34
- geodeStore.base_url = ""
35
- })
32
+ await feedbackStore.$reset();
33
+ await geodeStore.$reset();
34
+ geodeStore.base_url = "";
35
+ });
36
36
 
37
- test("invalid schema", async () => {
37
+ test("invalid schema", () => {
38
38
  const invalid_schema = {
39
39
  $id: "/test",
40
40
  type: "object",
@@ -46,33 +46,31 @@ describe("geodeStore.request()", () => {
46
46
  },
47
47
  required: ["test"],
48
48
  additionalProperties: false,
49
- }
50
- const params = { test: "hello" }
51
- expect(() => geodeStore.request(invalid_schema, params)).toThrow(
52
- "data/test must be number",
53
- )
54
- })
49
+ };
50
+ const params = { test: "hello" };
51
+ expect(() => geodeStore.request(invalid_schema, params)).toThrow("data/test must be number");
52
+ });
55
53
 
56
- test("invalid params", async () => {
57
- const params = {}
54
+ test("invalid params", () => {
55
+ const params = {};
58
56
  expect(() => geodeStore.request(schema, params)).toThrow(
59
57
  "data must have required property 'test'",
60
- )
61
- })
58
+ );
59
+ });
62
60
 
63
61
  test("request with callbacks", async () => {
64
- const params = { test: "hello" }
65
- let errorCalled = false
62
+ const params = { test: "hello" };
63
+ let errorCalled = false;
66
64
  const callbacks = {
67
- request_error_function: async () => {
68
- errorCalled = true
65
+ request_error_function: () => {
66
+ errorCalled = true;
69
67
  },
70
- }
68
+ };
71
69
  registerEndpoint(schema.$id, {
72
70
  method: schema.methods[FIRST_INDEX],
73
71
  handler: () => ({ result: "success" }),
74
- })
75
- await geodeStore.request(schema, params, callbacks)
76
- expect(errorCalled).toBeFalsy()
77
- })
78
- })
72
+ });
73
+ await geodeStore.request(schema, params, callbacks);
74
+ expect(errorCalled).toBeFalsy();
75
+ });
76
+ });
@@ -1,32 +1,32 @@
1
1
  // Third party imports
2
- import { beforeEach, describe, expect, test, vi } from "vitest"
2
+ import { beforeEach, describe, expect, test, vi } from "vitest";
3
3
 
4
4
  // Local imports
5
- import { appMode } from "@ogw_front/utils/local/app_mode"
6
- import { setupActivePinia } from "@ogw_tests/utils"
7
- import { useProjectManager } from "@ogw_front/composables/project_manager"
5
+ import { appMode } from "@ogw_front/utils/local/app_mode";
6
+ import { setupActivePinia } from "@ogw_tests/utils";
7
+ import { useProjectManager } from "@ogw_front/composables/project_manager";
8
8
 
9
9
  // Constants
10
- const PANEL_WIDTH = 300
11
- const Z_SCALE = 1.5
12
- const FOCAL_POINT1 = 1
13
- const FOCAL_POINT2 = 2
14
- const FOCAL_POINT3 = 3
15
- const FOCAL_POINT = [FOCAL_POINT1, FOCAL_POINT2, FOCAL_POINT3]
16
- const VIEW_UP1 = 0
17
- const VIEW_UP2 = 1
18
- const VIEW_UP3 = 0
19
- const VIEW_UP = [VIEW_UP1, VIEW_UP2, VIEW_UP3]
20
- const POSITION1 = 10
21
- const POSITION2 = 11
22
- const POSITION3 = 12
23
- const POSITION = [POSITION1, POSITION2, POSITION3]
24
- const VIEW_ANGLE = 30
25
- const CLIPPING_RANGE1 = 0.1
26
- const CLIPPING_RANGE2 = 1000
27
- const CLIPPING_RANGE = [CLIPPING_RANGE1, CLIPPING_RANGE2]
28
- const POINT_SIZE = 2
29
- const VIEWER_CALL_COUNT = 2
10
+ const PANEL_WIDTH = 300;
11
+ const Z_SCALE = 1.5;
12
+ const FOCAL_POINT1 = 1;
13
+ const FOCAL_POINT2 = 2;
14
+ const FOCAL_POINT3 = 3;
15
+ const FOCAL_POINT = [FOCAL_POINT1, FOCAL_POINT2, FOCAL_POINT3];
16
+ const VIEW_UP1 = 0;
17
+ const VIEW_UP2 = 1;
18
+ const VIEW_UP3 = 0;
19
+ const VIEW_UP = [VIEW_UP1, VIEW_UP2, VIEW_UP3];
20
+ const POSITION1 = 10;
21
+ const POSITION2 = 11;
22
+ const POSITION3 = 12;
23
+ const POSITION = [POSITION1, POSITION2, POSITION3];
24
+ const VIEW_ANGLE = 30;
25
+ const CLIPPING_RANGE1 = 0.1;
26
+ const CLIPPING_RANGE2 = 1000;
27
+ const CLIPPING_RANGE = [CLIPPING_RANGE1, CLIPPING_RANGE2];
28
+ const POINT_SIZE = 2;
29
+ const VIEWER_CALL_COUNT = 2;
30
30
 
31
31
  // Snapshot
32
32
  const snapshotMock = {
@@ -76,68 +76,68 @@ const snapshotMock = {
76
76
  clipping_range: CLIPPING_RANGE,
77
77
  },
78
78
  },
79
- }
79
+ };
80
80
 
81
81
  const geodeStoreMock = {
82
82
  start_request: vi.fn(),
83
83
  stop_request: vi.fn(),
84
84
  base_url: vi.fn(() => ""),
85
85
  $reset: vi.fn(),
86
- }
86
+ };
87
87
  const infraStoreMock = {
88
88
  app_mode: appMode.BROWSER,
89
89
  ID: "1234",
90
- }
90
+ };
91
91
  const viewerStoreMock = {
92
92
  ws_connect: vi.fn().mockResolvedValue(),
93
93
  base_url: vi.fn(() => ""),
94
94
  request: vi.fn().mockResolvedValue(),
95
- }
95
+ };
96
96
  const treeviewStoreMock = {
97
97
  clear: vi.fn(),
98
98
  importStores: vi.fn().mockResolvedValue(),
99
99
  finalizeImportSelection: vi.fn(),
100
100
  addItem: vi.fn().mockResolvedValue(),
101
- }
101
+ };
102
102
  const dataStoreMock = {
103
103
  clear: vi.fn(),
104
104
  registerObject: vi.fn().mockResolvedValue(),
105
105
  addItem: vi.fn().mockResolvedValue(),
106
- }
106
+ };
107
107
  const dataStyleStoreMock = {
108
108
  importStores: vi.fn().mockResolvedValue(),
109
109
  applyAllStylesFromState: vi.fn().mockResolvedValue(),
110
110
  addDataStyle: vi.fn().mockResolvedValue(),
111
111
  applyDefaultStyle: vi.fn().mockResolvedValue(),
112
- }
112
+ };
113
113
 
114
- const viewer_call_mock_fn = vi.fn().mockResolvedValue()
114
+ const viewer_call_mock_fn = vi.fn().mockResolvedValue();
115
115
 
116
116
  const hybridViewerStoreMock = {
117
117
  clear: vi.fn(),
118
118
  initHybridViewer: vi.fn().mockResolvedValue(),
119
119
  importStores: vi.fn((snapshot) => {
120
120
  if (snapshot?.zScale !== undefined) {
121
- hybridViewerStoreMock.setZScaling(snapshot.zScale)
121
+ hybridViewerStoreMock.setZScaling(snapshot.zScale);
122
122
  }
123
123
  if (snapshot?.camera_options) {
124
124
  viewer_call_mock_fn({
125
125
  schema: { $id: "opengeodeweb_viewer.viewer.update_camera" },
126
126
  params: { camera_options: snapshot.camera_options },
127
- })
128
- hybridViewerStoreMock.remoteRender()
127
+ });
128
+ hybridViewerStoreMock.remoteRender();
129
129
  }
130
130
  }),
131
131
  addItem: vi.fn().mockResolvedValue(),
132
132
  remoteRender: vi.fn(),
133
133
  setZScaling: vi.fn(),
134
- }
134
+ };
135
135
 
136
136
  // MOCKS
137
- vi.stubGlobal("$fetch", vi.fn().mockResolvedValue({ snapshot: snapshotMock }))
137
+ vi.stubGlobal("$fetch", vi.fn().mockResolvedValue({ snapshot: snapshotMock }));
138
138
  vi.mock(import("@ogw_internal/utils/viewer_call"), () => ({
139
139
  viewer_call: viewer_call_mock_fn,
140
- }))
140
+ }));
141
141
 
142
142
  vi.mock(import("@ogw_front/composables/api_fetch"), () => ({
143
143
  api_fetch: vi.fn(async (_req, options = {}) => {
@@ -146,151 +146,132 @@ vi.mock(import("@ogw_front/composables/api_fetch"), () => ({
146
146
  headers: {
147
147
  get: (k) => (k === "new-file-name" ? "project_123.vease" : undefined),
148
148
  },
149
- }
149
+ };
150
150
  if (options.response_function) {
151
- await options.response_function(response)
151
+ await options.response_function(response);
152
152
  }
153
- return response
153
+ return response;
154
154
  }),
155
- }))
156
- vi.mock(import("js-file-download"), () => ({ default: vi.fn() }))
155
+ }));
156
+ vi.mock(import("js-file-download"), () => ({ default: vi.fn() }));
157
157
  vi.mock(import("@ogw_front/stores/infra"), () => ({
158
158
  useInfraStore: () => infraStoreMock,
159
- }))
159
+ }));
160
160
  vi.mock(import("@ogw_front/stores/viewer"), () => ({
161
161
  useViewerStore: () => viewerStoreMock,
162
- }))
162
+ }));
163
163
  vi.mock(import("@ogw_front/stores/treeview"), () => ({
164
164
  useTreeviewStore: () => treeviewStoreMock,
165
- }))
165
+ }));
166
166
  vi.mock(import("@ogw_front/stores/data"), () => ({
167
167
  useDataStore: () => dataStoreMock,
168
- }))
168
+ }));
169
169
  vi.mock(import("@ogw_front/stores/data_style"), () => ({
170
170
  useDataStyleStore: () => dataStyleStoreMock,
171
- }))
171
+ }));
172
172
  vi.mock(import("@ogw_front/stores/hybrid_viewer"), () => ({
173
173
  useHybridViewerStore: () => hybridViewerStoreMock,
174
- }))
174
+ }));
175
175
  vi.mock(import("@ogw_front/stores/geode"), () => ({
176
176
  useGeodeStore: () => geodeStoreMock,
177
- }))
177
+ }));
178
178
  vi.mock(import("@ogw_front/stores/app"), () => ({
179
179
  useAppStore: () => ({
180
180
  exportStores: vi.fn(() => ({ projectName: "mockedProject" })),
181
181
  }),
182
- }))
182
+ }));
183
183
 
184
184
  vi.stubGlobal("useAppStore", () => ({
185
185
  exportStores: vi.fn(() => ({ projectName: "mockedProject" })),
186
- }))
186
+ }));
187
187
 
188
- const mockLockRequest = vi
189
- .fn()
190
- .mockImplementation(async (name, task) => await task({ name }))
188
+ const mockLockRequest = vi.fn().mockImplementation(async (name, task) => await task({ name }));
191
189
 
192
190
  vi.stubGlobal("navigator", {
193
191
  ...navigator,
194
192
  locks: {
195
193
  request: mockLockRequest,
196
194
  },
197
- })
195
+ });
198
196
 
199
197
  function verifyViewerCalls() {
200
- expect(viewerStoreMock.ws_connect).toHaveBeenCalledWith()
201
- expect(viewer_call_mock_fn).toHaveBeenCalledTimes(VIEWER_CALL_COUNT)
198
+ expect(viewerStoreMock.ws_connect).toHaveBeenCalledWith();
199
+ expect(viewer_call_mock_fn).toHaveBeenCalledTimes(VIEWER_CALL_COUNT);
202
200
  }
203
201
 
204
202
  function verifyStoreImports() {
205
- expect(treeviewStoreMock.importStores).toHaveBeenCalledWith(
206
- snapshotMock.treeview,
207
- )
208
- expect(hybridViewerStoreMock.initHybridViewer).toHaveBeenCalledWith()
209
- expect(hybridViewerStoreMock.importStores).toHaveBeenCalledWith(
210
- snapshotMock.hybridViewer,
211
- )
212
- expect(hybridViewerStoreMock.setZScaling).toHaveBeenCalledWith(Z_SCALE)
203
+ expect(treeviewStoreMock.importStores).toHaveBeenCalledWith(snapshotMock.treeview);
204
+ expect(hybridViewerStoreMock.initHybridViewer).toHaveBeenCalledWith();
205
+ expect(hybridViewerStoreMock.importStores).toHaveBeenCalledWith(snapshotMock.hybridViewer);
206
+ expect(hybridViewerStoreMock.setZScaling).toHaveBeenCalledWith(Z_SCALE);
213
207
  }
214
208
 
215
209
  function verifyDataManagement() {
216
- expect(dataStyleStoreMock.importStores).toHaveBeenCalledWith(
217
- snapshotMock.dataStyle,
218
- )
219
- expect(dataStyleStoreMock.applyAllStylesFromState).toHaveBeenCalledWith()
220
- expect(dataStoreMock.registerObject).toHaveBeenCalledWith("abc123")
221
- expect(dataStoreMock.addItem).toHaveBeenCalledWith(snapshotMock.data.items[0])
222
- expect(treeviewStoreMock.addItem).toHaveBeenCalledWith(
223
- "PointSet2D",
224
- "My Data",
225
- "abc123",
226
- "mesh",
227
- )
210
+ expect(dataStyleStoreMock.importStores).toHaveBeenCalledWith(snapshotMock.dataStyle);
211
+ expect(dataStyleStoreMock.applyAllStylesFromState).toHaveBeenCalledWith();
212
+ expect(dataStoreMock.registerObject).toHaveBeenCalledWith("abc123");
213
+ expect(dataStoreMock.addItem).toHaveBeenCalledWith(snapshotMock.data.items[0]);
214
+ expect(treeviewStoreMock.addItem).toHaveBeenCalledWith("PointSet2D", "My Data", "abc123", "mesh");
228
215
  }
229
216
 
230
217
  function verifyRemaining() {
231
- expect(hybridViewerStoreMock.addItem).toHaveBeenCalledWith("abc123")
232
- expect(dataStyleStoreMock.addDataStyle).toHaveBeenCalledWith(
233
- "abc123",
234
- "PointSet2D",
235
- )
236
- expect(dataStyleStoreMock.applyDefaultStyle).toHaveBeenCalledWith("abc123")
237
- expect(hybridViewerStoreMock.remoteRender).toHaveBeenCalledWith()
218
+ expect(hybridViewerStoreMock.addItem).toHaveBeenCalledWith("abc123");
219
+ expect(dataStyleStoreMock.addDataStyle).toHaveBeenCalledWith("abc123", "PointSet2D");
220
+ expect(dataStyleStoreMock.applyDefaultStyle).toHaveBeenCalledWith("abc123");
221
+ expect(hybridViewerStoreMock.remoteRender).toHaveBeenCalledWith();
238
222
  }
239
223
 
240
224
  beforeEach(() => {
241
- setupActivePinia()
225
+ setupActivePinia();
242
226
  const storesList = [
243
227
  viewerStoreMock,
244
228
  treeviewStoreMock,
245
229
  dataStoreMock,
246
230
  dataStyleStoreMock,
247
231
  hybridViewerStoreMock,
248
- ]
232
+ ];
249
233
  for (const store of storesList) {
250
- const values = Object.values(store)
234
+ const values = Object.values(store);
251
235
  for (const value of values) {
252
236
  if (typeof value === "function" && value.mockClear) {
253
- value.mockClear()
237
+ value.mockClear();
254
238
  }
255
239
  }
256
240
  }
257
- viewer_call_mock_fn.mockClear()
258
- })
241
+ viewer_call_mock_fn.mockClear();
242
+ });
259
243
 
260
244
  describe("projectManager composable (compact)", () => {
261
245
  test("exportProject", async () => {
262
- const { exportProject } = useProjectManager()
263
- const { default: fileDownload } = await import("js-file-download")
246
+ const { exportProject } = useProjectManager();
247
+ const { default: fileDownload } = await import("js-file-download");
264
248
 
265
- await exportProject()
249
+ await exportProject();
266
250
 
267
- expect(fileDownload).toHaveBeenCalledWith(
268
- { snapshot: snapshotMock },
269
- "project.vease",
270
- )
271
- })
251
+ expect(fileDownload).toHaveBeenCalledWith({ snapshot: snapshotMock }, "project.vease");
252
+ });
272
253
 
273
254
  test("importProjectFile with snapshot - Viewer and Stores", async () => {
274
- const { importProjectFile } = useProjectManager()
255
+ const { importProjectFile } = useProjectManager();
275
256
  const file = new Blob(['{"dataBase":{"db":{}}}'], {
276
257
  type: "application/json",
277
- })
258
+ });
278
259
 
279
- await importProjectFile(file)
260
+ await importProjectFile(file);
280
261
 
281
- verifyViewerCalls()
282
- verifyStoreImports()
283
- })
262
+ verifyViewerCalls();
263
+ verifyStoreImports();
264
+ });
284
265
 
285
266
  test("importProjectFile with snapshot - Data and Rendering", async () => {
286
- const { importProjectFile } = useProjectManager()
267
+ const { importProjectFile } = useProjectManager();
287
268
  const file = new Blob(['{"dataBase":{"db":{}}}'], {
288
269
  type: "application/json",
289
- })
270
+ });
290
271
 
291
- await importProjectFile(file)
272
+ await importProjectFile(file);
292
273
 
293
- verifyDataManagement()
294
- verifyRemaining()
295
- })
296
- })
274
+ verifyDataManagement();
275
+ verifyRemaining();
276
+ });
277
+ });
@@ -1,57 +1,57 @@
1
1
  // Third party imports
2
- import { beforeEach, describe, expect, test, vi } from "vitest"
3
- import { flushPromises } from "@vue/test-utils"
2
+ import { beforeEach, describe, expect, test, vi } from "vitest";
3
+ import { flushPromises } from "@vue/test-utils";
4
4
 
5
5
  // Local imports
6
- import { Status } from "@ogw_front/utils/status"
7
- import { run_function_when_microservices_connected } from "@ogw_front/composables/run_function_when_microservices_connected"
8
- import { setupActivePinia } from "@ogw_tests/utils"
9
- import { useGeodeStore } from "@ogw_front/stores/geode"
10
- import { useInfraStore } from "@ogw_front/stores/infra"
11
- import { useViewerStore } from "@ogw_front/stores/viewer"
6
+ import { Status } from "@ogw_front/utils/status";
7
+ import { run_function_when_microservices_connected } from "@ogw_front/composables/run_function_when_microservices_connected";
8
+ import { setupActivePinia } from "@ogw_tests/utils";
9
+ import { useGeodeStore } from "@ogw_front/stores/geode";
10
+ import { useInfraStore } from "@ogw_front/stores/infra";
11
+ import { useViewerStore } from "@ogw_front/stores/viewer";
12
12
 
13
- const dumb_obj = { dumb_method: () => true }
14
- let infraStore = undefined
15
- let geodeStore = undefined
16
- let viewerStore = undefined
13
+ const dumb_obj = { dumb_method: () => true };
14
+ let infraStore = undefined;
15
+ let geodeStore = undefined;
16
+ let viewerStore = undefined;
17
17
 
18
18
  beforeEach(() => {
19
- setupActivePinia()
20
- infraStore = useInfraStore()
21
- geodeStore = useGeodeStore()
22
- viewerStore = useViewerStore()
19
+ setupActivePinia();
20
+ infraStore = useInfraStore();
21
+ geodeStore = useGeodeStore();
22
+ viewerStore = useViewerStore();
23
23
 
24
24
  // Register microservices in infra store
25
25
  infraStore.register_microservice(geodeStore, {
26
26
  request: vi.fn(),
27
27
  connect: vi.fn(),
28
28
  launch: vi.fn(),
29
- })
29
+ });
30
30
  infraStore.register_microservice(viewerStore, {
31
31
  request: vi.fn(),
32
32
  connect: vi.fn(),
33
33
  launch: vi.fn(),
34
- })
34
+ });
35
35
 
36
- geodeStore.$patch({ status: Status.NOT_CONNECTED })
37
- viewerStore.$patch({ status: Status.NOT_CONNECTED })
38
- })
36
+ geodeStore.$patch({ status: Status.NOT_CONNECTED });
37
+ viewerStore.$patch({ status: Status.NOT_CONNECTED });
38
+ });
39
39
 
40
40
  describe("when_microservices_connected_run_function", () => {
41
- test("microservices not connected", async () => {
42
- const spy = vi.spyOn(dumb_obj, "dumb_method")
43
- run_function_when_microservices_connected(dumb_obj.dumb_method)
44
- geodeStore.$patch({ status: Status.NOT_CONNECTED })
45
- viewerStore.$patch({ status: Status.NOT_CONNECTED })
46
- expect(spy).not.toHaveBeenCalled()
47
- })
41
+ test("microservices not connected", () => {
42
+ const spy = vi.spyOn(dumb_obj, "dumb_method");
43
+ run_function_when_microservices_connected(dumb_obj.dumb_method);
44
+ geodeStore.$patch({ status: Status.NOT_CONNECTED });
45
+ viewerStore.$patch({ status: Status.NOT_CONNECTED });
46
+ expect(spy).not.toHaveBeenCalled();
47
+ });
48
48
 
49
49
  test("microservices connected", async () => {
50
- const spy = vi.spyOn(dumb_obj, "dumb_method")
51
- run_function_when_microservices_connected(dumb_obj.dumb_method)
52
- geodeStore.$patch({ status: Status.CONNECTED })
53
- viewerStore.$patch({ status: Status.CONNECTED })
54
- await flushPromises()
55
- expect(spy).toHaveBeenCalledWith()
56
- })
57
- })
50
+ const spy = vi.spyOn(dumb_obj, "dumb_method");
51
+ run_function_when_microservices_connected(dumb_obj.dumb_method);
52
+ geodeStore.$patch({ status: Status.CONNECTED });
53
+ viewerStore.$patch({ status: Status.CONNECTED });
54
+ await flushPromises();
55
+ expect(spy).toHaveBeenCalledWith();
56
+ });
57
+ });