@geode/opengeodeweb-front 10.20.1 → 10.21.0-rc.2

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 (45) hide show
  1. package/app/components/CrsSelector.vue +3 -3
  2. package/app/components/ExtensionSelector.vue +3 -3
  3. package/app/components/FileSelector.vue +3 -3
  4. package/app/components/FileUploader.vue +4 -4
  5. package/app/components/Inspector/InspectionButton.vue +3 -3
  6. package/app/components/Loading.vue +27 -0
  7. package/app/components/MissingFilesSelector.vue +3 -3
  8. package/app/components/ObjectSelector.vue +3 -3
  9. package/app/components/PackagesVersions.vue +4 -4
  10. package/app/components/Viewer/ObjectTree/Layout.vue +6 -3
  11. package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +47 -1
  12. package/app/components/Viewer/ObjectTree/Views/ModelCollections.vue +222 -0
  13. package/app/components/Viewer/ObjectTree/Views/ModelComponents.vue +10 -4
  14. package/app/components/Viewer/Options/AttributeSelector.vue +3 -3
  15. package/app/components/Viewer/Options/TextureItem.vue +4 -4
  16. package/app/composables/model_collections.js +72 -0
  17. package/app/composables/model_components.js +5 -1
  18. package/app/composables/project_manager.js +5 -5
  19. package/app/composables/virtual_tree.js +8 -7
  20. package/app/stores/{geode.js → back.js} +16 -1
  21. package/app/stores/data.js +39 -111
  22. package/app/stores/data_helpers/collections.js +102 -0
  23. package/app/stores/data_helpers/mesh.js +122 -0
  24. package/app/stores/treeview.js +18 -8
  25. package/app/stores/viewer.js +18 -0
  26. package/app/utils/extension.js +0 -2
  27. package/app/utils/import_workflow.js +3 -3
  28. package/internal/stores/hybrid_viewer_camera_animation.js +24 -2
  29. package/package.json +3 -3
  30. package/tests/integration/setup.js +3 -3
  31. package/tests/unit/components/CrsSelector.nuxt.test.js +6 -6
  32. package/tests/unit/components/ExtensionSelector.nuxt.test.js +4 -4
  33. package/tests/unit/components/FileSelector.nuxt.test.js +3 -3
  34. package/tests/unit/components/FileUploader.nuxt.test.js +3 -3
  35. package/tests/unit/components/Inspector/InspectionButton.nuxt.test.js +4 -4
  36. package/tests/unit/components/MissingFilesSelector.nuxt.test.js +4 -4
  37. package/tests/unit/components/ObjectSelector.nuxt.test.js +3 -3
  38. package/tests/unit/components/PackagesVersions.nuxt.test.js +3 -3
  39. package/tests/unit/composables/api_fetch.nuxt.test.js +9 -9
  40. package/tests/unit/composables/project_manager.nuxt.test.js +3 -3
  41. package/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js +7 -7
  42. package/tests/unit/composables/upload_file.nuxt.test.js +7 -7
  43. package/tests/unit/stores/app.nuxt.test.js +9 -9
  44. package/tests/unit/stores/{geode.nuxt.test.js → back.nuxt.test.js} +43 -43
  45. package/tests/unit/stores/infra.nuxt.test.js +34 -34
@@ -30,6 +30,7 @@ export const useViewerStore = defineStore(
30
30
  const picked_point = ref({ x: undefined, y: undefined, z: undefined });
31
31
  const request_counter = ref(0);
32
32
  const status = ref(Status.NOT_CONNECTED);
33
+ const version = ref("0.0.0");
33
34
  const busy = ref(0);
34
35
 
35
36
  const protocol = computed(() => {
@@ -185,6 +186,21 @@ export const useViewerStore = defineStore(
185
186
  );
186
187
  }
187
188
 
189
+ function get_version(schema) {
190
+ if (!schema) {
191
+ return;
192
+ }
193
+ return request(
194
+ schema,
195
+ {},
196
+ {
197
+ response_function: (response) => {
198
+ version.value = response.microservice_version;
199
+ },
200
+ },
201
+ );
202
+ }
203
+
188
204
  return {
189
205
  default_local_port,
190
206
  client,
@@ -205,6 +221,8 @@ export const useViewerStore = defineStore(
205
221
  launch,
206
222
  connect,
207
223
  request,
224
+ version,
225
+ get_version,
208
226
  };
209
227
  },
210
228
  {
@@ -35,8 +35,6 @@ async function registerRunningExtensions() {
35
35
  });
36
36
  appStore.registerStore(store);
37
37
  console.log("[ExtensionManager] Store registered:", store.$id);
38
- await store.connect();
39
- console.log("[ExtensionManager] Microservice connected:", store.$id);
40
38
  infraStore.register_microservice(store);
41
39
  }
42
40
  return {
@@ -3,9 +3,9 @@
3
3
  import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json";
4
4
 
5
5
  // Local imports
6
+ import { useBackStore } from "@ogw_front/stores/back";
6
7
  import { useDataStore } from "@ogw_front/stores/data";
7
8
  import { useDataStyleStore } from "@ogw_front/stores/data_style";
8
- import { useGeodeStore } from "@ogw_front/stores/geode";
9
9
  import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
10
10
  import { useTreeviewStore } from "@ogw_front/stores/treeview";
11
11
 
@@ -55,8 +55,8 @@ async function importItem(item) {
55
55
  }
56
56
 
57
57
  async function importFile(filename, geode_object_type) {
58
- const geodeStore = useGeodeStore();
59
- const response = await geodeStore.request(back_schemas.opengeodeweb_back.save_viewable_file, {
58
+ const backStore = useBackStore();
59
+ const response = await backStore.request(back_schemas.opengeodeweb_back.save_viewable_file, {
60
60
  geode_object_type,
61
61
  filename,
62
62
  });
@@ -4,6 +4,7 @@ const NEAR_ZERO_THRESHOLD = 1e-10;
4
4
  const SLERP_LINEAR_THRESHOLD = 0.9995;
5
5
  const LONG_ANIMATION_DURATION = 1000;
6
6
  const SHORT_ANIMATION_DURATION = 500;
7
+ const MID_ANIMATION_RATIO = 0.5;
7
8
 
8
9
  function vecSub(vector, other) {
9
10
  return [vector[0] - other[0], vector[1] - other[1], vector[2] - other[2]];
@@ -21,7 +22,7 @@ function vecNormalize(vector) {
21
22
  return [vector[0] / len, vector[1] / len, vector[2] / len];
22
23
  }
23
24
 
24
- function slerp(from, target, ratio) {
25
+ function slerp(from, target, ratio, mid) {
25
26
  const normFrom = vecNormalize(from);
26
27
  const normTarget = vecNormalize(target);
27
28
  let dotProduct =
@@ -34,6 +35,11 @@ function slerp(from, target, ratio) {
34
35
  normFrom[2] + (normTarget[2] - normFrom[2]) * ratio,
35
36
  ]);
36
37
  }
38
+ if (dotProduct < -SLERP_LINEAR_THRESHOLD && mid) {
39
+ return ratio < MID_ANIMATION_RATIO
40
+ ? slerp(normFrom, mid, ratio * 2)
41
+ : slerp(mid, normTarget, (ratio - MID_ANIMATION_RATIO) * 2);
42
+ }
37
43
  const theta = Math.acos(dotProduct);
38
44
  const sinTheta = Math.sin(theta);
39
45
  const weightFrom = Math.sin((1 - ratio) * theta) / sinTheta;
@@ -71,6 +77,22 @@ function animateCamera(options) {
71
77
  const targetDir = vecSub(targetState.position, targetState.focal_point);
72
78
  const startDist = vecLength(startDir);
73
79
  const targetDist = vecLength(targetDir);
80
+
81
+ const normStart = vecNormalize(startDir);
82
+ const normTarget = vecNormalize(targetDir);
83
+ const startTargetDot =
84
+ normStart[0] * normTarget[0] + normStart[1] * normTarget[1] + normStart[2] * normTarget[2];
85
+
86
+ let antipodalMid = undefined;
87
+ if (startTargetDot < -SLERP_LINEAR_THRESHOLD) {
88
+ const normUp = vecNormalize(startState.view_up);
89
+ antipodalMid = vecNormalize([
90
+ normStart[1] * normUp[2] - normStart[2] * normUp[1],
91
+ normStart[2] * normUp[0] - normStart[0] * normUp[2],
92
+ normStart[0] * normUp[1] - normStart[1] * normUp[0],
93
+ ]);
94
+ }
95
+
74
96
  const startTime = performance.now();
75
97
  function animate(currentTime) {
76
98
  const progress = Math.min((currentTime - startTime) / duration, 1);
@@ -79,7 +101,7 @@ function animateCamera(options) {
79
101
  ? 1 - (1 - progress) ** easeExponent
80
102
  : progress * (2 - progress);
81
103
  const bump = bumpMultiplier * Math.sin(Math.PI * progress);
82
- const dir = slerp(startDir, targetDir, ease);
104
+ const dir = slerp(startDir, targetDir, ease, antipodalMid);
83
105
  const dist = startDist + (targetDist - startDist) * ease + bump;
84
106
  const focalPoint = startState.focal_point.map(
85
107
  (startValue, index) => startValue + (targetState.focal_point[index] - startValue) * ease,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
- "version": "10.20.1",
3
+ "version": "10.21.0-rc.2",
4
4
  "description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
5
5
  "homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Front",
6
6
  "bugs": {
@@ -34,8 +34,8 @@
34
34
  "build": ""
35
35
  },
36
36
  "dependencies": {
37
- "@geode/opengeodeweb-back": "latest",
38
- "@geode/opengeodeweb-viewer": "latest",
37
+ "@geode/opengeodeweb-back": "next",
38
+ "@geode/opengeodeweb-viewer": "next",
39
39
  "@google-cloud/run": "3.2.0",
40
40
  "@kitware/vtk.js": "33.3.0",
41
41
  "@mdi/font": "7.4.47",
@@ -14,7 +14,7 @@ import { Status } from "@ogw_front/utils/status";
14
14
  import { appMode } from "@ogw_front/utils/local/app_mode";
15
15
  import { importFile } from "@ogw_front/utils/import_workflow";
16
16
  import { setupActivePinia } from "@ogw_tests/utils";
17
- import { useGeodeStore } from "@ogw_front/stores/geode";
17
+ import { useBackStore } from "@ogw_front/stores/back";
18
18
  import { useInfraStore } from "@ogw_front/stores/infra";
19
19
  import { useViewerStore } from "@ogw_front/stores/viewer";
20
20
 
@@ -23,7 +23,7 @@ const beforeAllTimeout = 40_000;
23
23
  const data_folder = path.join("tests", "integration", "data", "uploads");
24
24
 
25
25
  async function runMicroservices() {
26
- const geodeStore = useGeodeStore();
26
+ const backStore = useBackStore();
27
27
  const infraStore = useInfraStore();
28
28
  const viewerStore = useViewerStore();
29
29
  infraStore.app_mode = appMode.BROWSER;
@@ -53,7 +53,7 @@ async function runMicroservices() {
53
53
  port: viewer_port,
54
54
  });
55
55
 
56
- geodeStore.default_local_port = back_port;
56
+ backStore.default_local_port = back_port;
57
57
  viewerStore.default_local_port = viewer_port;
58
58
 
59
59
  return {
@@ -5,19 +5,19 @@ import { mountSuspended } from "@nuxt/test-utils/runtime";
5
5
  // Local imports
6
6
  import { setupActivePinia, vuetify } from "@ogw_tests/utils";
7
7
  import CrsSelector from "@ogw_front/components/CrsSelector";
8
- import { useGeodeStore } from "@ogw_front/stores/geode";
8
+ import { useBackStore } from "@ogw_front/stores/back";
9
9
 
10
10
  const EXPECTED_LENGTH = 1;
11
11
  const FIRST_INDEX = 0;
12
12
 
13
13
  let pinia = undefined;
14
- let geodeStore = undefined;
14
+ let backStore = undefined;
15
15
 
16
16
  describe("crs selector", () => {
17
17
  beforeEach(() => {
18
18
  pinia = setupActivePinia();
19
- geodeStore = useGeodeStore();
20
- geodeStore.base_url = "/";
19
+ backStore = useBackStore();
20
+ backStore.base_url = "/";
21
21
  });
22
22
 
23
23
  test("default behavior", async () => {
@@ -29,8 +29,8 @@ describe("crs selector", () => {
29
29
  },
30
30
  ];
31
31
 
32
- // Mock geodeStore.request instead of registerEndpoint
33
- geodeStore.request = vi.fn((schema, params, callbacks) => {
32
+ // Mock backStore.request instead of registerEndpoint
33
+ backStore.request = vi.fn((schema, params, callbacks) => {
34
34
  callbacks.response_function({ crs_list });
35
35
  return Promise.resolve({ crs_list });
36
36
  });
@@ -8,7 +8,7 @@ import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json";
8
8
  // Local imports
9
9
  import { setupActivePinia, vuetify } from "@ogw_tests/utils";
10
10
  import ExtensionSelector from "@ogw_front/components/ExtensionSelector";
11
- import { useGeodeStore } from "@ogw_front/stores/geode";
11
+ import { useBackStore } from "@ogw_front/stores/back";
12
12
 
13
13
  const EXPECTED_LENGTH = 1;
14
14
  const FIRST_INDEX = 0;
@@ -17,13 +17,13 @@ const SECOND_INDEX = 1;
17
17
  const schema = schemas.opengeodeweb_back.geode_objects_and_output_extensions;
18
18
 
19
19
  const pinia = setupActivePinia();
20
- const geodeStore = useGeodeStore();
20
+ const backStore = useBackStore();
21
21
 
22
22
  describe("extension selector", () => {
23
23
  beforeEach(() => {
24
- geodeStore.base_url = "/";
24
+ backStore.base_url = "/";
25
25
 
26
- geodeStore.request = vi.fn(() => {
26
+ backStore.request = vi.fn(() => {
27
27
  const response = {
28
28
  geode_objects_and_output_extensions: {
29
29
  BRep: { msh: { is_saveable: true } },
@@ -9,7 +9,7 @@ import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json";
9
9
  import { setupActivePinia, vuetify } from "@ogw_tests/utils";
10
10
  import FileSelector from "@ogw_front/components/FileSelector";
11
11
  import FileUploader from "@ogw_front/components/FileUploader";
12
- import { useGeodeStore } from "@ogw_front/stores/geode";
12
+ import { useBackStore } from "@ogw_front/stores/back";
13
13
 
14
14
  const EXPECTED_LENGTH = 1;
15
15
  const FIRST_INDEX = 0;
@@ -20,8 +20,8 @@ const upload_file_schema = schemas.opengeodeweb_back.upload_file;
20
20
 
21
21
  describe("file selector", () => {
22
22
  const pinia = setupActivePinia();
23
- const geodeStore = useGeodeStore();
24
- geodeStore.base_url = "/";
23
+ const backStore = useBackStore();
24
+ backStore.base_url = "/";
25
25
 
26
26
  test("select file", async () => {
27
27
  registerEndpoint(allowed_files_schema.$id, {
@@ -8,7 +8,7 @@ import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json";
8
8
  // Local imports
9
9
  import { setupActivePinia, vuetify } from "@ogw_tests/utils";
10
10
  import FileUploader from "@ogw_front/components/FileUploader";
11
- import { useGeodeStore } from "@ogw_front/stores/geode";
11
+ import { useBackStore } from "@ogw_front/stores/back";
12
12
 
13
13
  const FIRST_INDEX = 0;
14
14
  const SECOND_INDEX = 1;
@@ -17,8 +17,8 @@ const upload_file_schema = schemas.opengeodeweb_back.upload_file;
17
17
 
18
18
  describe("file uploader", () => {
19
19
  const pinia = setupActivePinia();
20
- const geodeStore = useGeodeStore();
21
- geodeStore.base_url = "/";
20
+ const backStore = useBackStore();
21
+ backStore.base_url = "/";
22
22
 
23
23
  registerEndpoint(upload_file_schema.$id, {
24
24
  method: upload_file_schema.methods[FIRST_INDEX],
@@ -7,12 +7,12 @@ import { mountSuspended } from "@nuxt/test-utils/runtime";
7
7
  // Local imports
8
8
  import { setupActivePinia, vuetify } from "@ogw_tests/utils";
9
9
  import InspectorInspectionButton from "@ogw_front/components/Inspector/InspectionButton";
10
- import { useGeodeStore } from "@ogw_front/stores/geode";
10
+ import { useBackStore } from "@ogw_front/stores/back";
11
11
 
12
12
  describe("inspector inspection button", () => {
13
13
  const pinia = setupActivePinia();
14
- const geodeStore = useGeodeStore();
15
- geodeStore.base_url = "/";
14
+ const backStore = useBackStore();
15
+ backStore.base_url = "/";
16
16
 
17
17
  test("with issues", async () => {
18
18
  const inspection_result = {
@@ -31,7 +31,7 @@ describe("inspector inspection button", () => {
31
31
  },
32
32
  ],
33
33
  };
34
- geodeStore.request = vi.fn((_schema, _params, callbacks) => {
34
+ backStore.request = vi.fn((_schema, _params, callbacks) => {
35
35
  callbacks?.response_function?.({ inspection_result });
36
36
  return Promise.resolve({ inspection_result });
37
37
  });
@@ -9,7 +9,7 @@ import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json";
9
9
  import { setupActivePinia, vuetify } from "@ogw_tests/utils";
10
10
  import FileUploader from "@ogw_front/components/FileUploader";
11
11
  import MissingFilesSelector from "@ogw_front/components/MissingFilesSelector";
12
- import { useGeodeStore } from "@ogw_front/stores/geode";
12
+ import { useBackStore } from "@ogw_front/stores/back";
13
13
 
14
14
  const EXPECTED_LENGTH = 1;
15
15
  const FIRST_INDEX = 0;
@@ -19,11 +19,11 @@ const upload_file_schema = schemas.opengeodeweb_back.upload_file;
19
19
 
20
20
  describe("missing files selector", () => {
21
21
  const pinia = setupActivePinia();
22
- const geodeStore = useGeodeStore();
23
- geodeStore.base_url = "/";
22
+ const backStore = useBackStore();
23
+ backStore.base_url = "/";
24
24
 
25
25
  test("select file", async () => {
26
- geodeStore.request = vi.fn((schema, params, callbacks) => {
26
+ backStore.request = vi.fn((schema, params, callbacks) => {
27
27
  callbacks?.response_function?.({
28
28
  has_missing_files: true,
29
29
  mandatory_files: ["fake_file.txt"],
@@ -6,7 +6,7 @@ import { flushPromises } from "@vue/test-utils";
6
6
  import { setupActivePinia, vuetify } from "@ogw_tests/utils";
7
7
  import ObjectSelector from "@ogw_front/components/ObjectSelector";
8
8
  import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json";
9
- import { useGeodeStore } from "@ogw_front/stores/geode";
9
+ import { useBackStore } from "@ogw_front/stores/back";
10
10
 
11
11
  const EXPECTED_LENGTH = 1;
12
12
  const FIRST_INDEX = 0;
@@ -18,8 +18,8 @@ const { allowed_objects } = schemas.opengeodeweb_back;
18
18
 
19
19
  describe("object selector", () => {
20
20
  const pinia = setupActivePinia();
21
- const geodeStore = useGeodeStore();
22
- geodeStore.base_url = "/";
21
+ const backStore = useBackStore();
22
+ backStore.base_url = "/";
23
23
 
24
24
  test("loadable with one class", async () => {
25
25
  const response = {
@@ -3,15 +3,15 @@ import { mountSuspended, registerEndpoint } from "@nuxt/test-utils/runtime";
3
3
 
4
4
  import { setupActivePinia, vuetify } from "@ogw_tests/utils";
5
5
  import PackagesVersions from "@ogw_front/components/PackagesVersions";
6
- import { useGeodeStore } from "@ogw_front/stores/geode";
6
+ import { useBackStore } from "@ogw_front/stores/back";
7
7
 
8
8
  const FIRST_INDEX = 0;
9
9
 
10
10
  describe("packages versions", () => {
11
11
  test("mount", async () => {
12
12
  const pinia = setupActivePinia();
13
- const geodeStore = useGeodeStore();
14
- geodeStore.base_url = "/";
13
+ const backStore = useBackStore();
14
+ backStore.base_url = "/";
15
15
 
16
16
  const schema = {
17
17
  $id: "/versions",
@@ -4,16 +4,16 @@ import { registerEndpoint } from "@nuxt/test-utils/runtime";
4
4
 
5
5
  // Local imports
6
6
  import { setupActivePinia } from "@ogw_tests/utils";
7
+ import { useBackStore } from "@ogw_front/stores/back";
7
8
  import { useFeedbackStore } from "@ogw_front/stores/feedback";
8
- import { useGeodeStore } from "@ogw_front/stores/geode";
9
9
 
10
10
  const FIRST_INDEX = 0;
11
11
 
12
- describe("geodeStore.request()", () => {
12
+ describe("backStore.request()", () => {
13
13
  setupActivePinia();
14
- const geodeStore = useGeodeStore();
14
+ const backStore = useBackStore();
15
15
  const feedbackStore = useFeedbackStore();
16
- geodeStore.base_url = "";
16
+ backStore.base_url = "";
17
17
 
18
18
  const schema = {
19
19
  $id: "/test",
@@ -30,8 +30,8 @@ describe("geodeStore.request()", () => {
30
30
 
31
31
  beforeEach(async () => {
32
32
  await feedbackStore.$reset();
33
- await geodeStore.$reset();
34
- geodeStore.base_url = "";
33
+ await backStore.$reset();
34
+ backStore.base_url = "";
35
35
  });
36
36
 
37
37
  test("invalid schema", () => {
@@ -48,12 +48,12 @@ describe("geodeStore.request()", () => {
48
48
  additionalProperties: false,
49
49
  };
50
50
  const params = { test: "hello" };
51
- expect(() => geodeStore.request(invalid_schema, params)).toThrow("data/test must be number");
51
+ expect(() => backStore.request(invalid_schema, params)).toThrow("data/test must be number");
52
52
  });
53
53
 
54
54
  test("invalid params", () => {
55
55
  const params = {};
56
- expect(() => geodeStore.request(schema, params)).toThrow(
56
+ expect(() => backStore.request(schema, params)).toThrow(
57
57
  "data must have required property 'test'",
58
58
  );
59
59
  });
@@ -70,7 +70,7 @@ describe("geodeStore.request()", () => {
70
70
  method: schema.methods[FIRST_INDEX],
71
71
  handler: () => ({ result: "success" }),
72
72
  });
73
- await geodeStore.request(schema, params, callbacks);
73
+ await backStore.request(schema, params, callbacks);
74
74
  expect(errorCalled).toBe(false);
75
75
  });
76
76
  });
@@ -80,7 +80,7 @@ const snapshotMock = {
80
80
  },
81
81
  };
82
82
 
83
- const geodeStoreMock = {
83
+ const backStoreMock = {
84
84
  start_request: vi.fn(),
85
85
  stop_request: vi.fn(),
86
86
  base_url: vi.fn(() => ""),
@@ -173,8 +173,8 @@ vi.mock(import("@ogw_front/stores/data_style"), () => ({
173
173
  vi.mock(import("@ogw_front/stores/hybrid_viewer"), () => ({
174
174
  useHybridViewerStore: () => hybridViewerStoreMock,
175
175
  }));
176
- vi.mock(import("@ogw_front/stores/geode"), () => ({
177
- useGeodeStore: () => geodeStoreMock,
176
+ vi.mock(import("@ogw_front/stores/back"), () => ({
177
+ useBackStore: () => backStoreMock,
178
178
  }));
179
179
  vi.mock(import("@ogw_front/stores/app"), () => ({
180
180
  useAppStore: () => ({
@@ -6,24 +6,24 @@ import { flushPromises } from "@vue/test-utils";
6
6
  import { Status } from "@ogw_front/utils/status";
7
7
  import { run_function_when_microservices_connected } from "@ogw_front/composables/run_function_when_microservices_connected";
8
8
  import { setupActivePinia } from "@ogw_tests/utils";
9
- import { useGeodeStore } from "@ogw_front/stores/geode";
9
+ import { useBackStore } from "@ogw_front/stores/back";
10
10
  import { useInfraStore } from "@ogw_front/stores/infra";
11
11
  import { useViewerStore } from "@ogw_front/stores/viewer";
12
12
 
13
13
  const dumb_obj = { dumb_method: () => true };
14
14
  let infraStore = undefined;
15
- let geodeStore = undefined;
15
+ let backStore = undefined;
16
16
  let viewerStore = undefined;
17
17
 
18
18
  describe("when_microservices_connected_run_function", () => {
19
19
  beforeEach(() => {
20
20
  setupActivePinia();
21
21
  infraStore = useInfraStore();
22
- geodeStore = useGeodeStore();
22
+ backStore = useBackStore();
23
23
  viewerStore = useViewerStore();
24
24
 
25
25
  // Register microservices in infra store
26
- infraStore.register_microservice(geodeStore, {
26
+ infraStore.register_microservice(backStore, {
27
27
  request: vi.fn(),
28
28
  connect: vi.fn(),
29
29
  launch: vi.fn(),
@@ -34,14 +34,14 @@ describe("when_microservices_connected_run_function", () => {
34
34
  launch: vi.fn(),
35
35
  });
36
36
 
37
- geodeStore.$patch({ status: Status.NOT_CONNECTED });
37
+ backStore.$patch({ status: Status.NOT_CONNECTED });
38
38
  viewerStore.$patch({ status: Status.NOT_CONNECTED });
39
39
  });
40
40
 
41
41
  test("microservices not connected", () => {
42
42
  const spy = vi.spyOn(dumb_obj, "dumb_method");
43
43
  run_function_when_microservices_connected(dumb_obj.dumb_method);
44
- geodeStore.$patch({ status: Status.NOT_CONNECTED });
44
+ backStore.$patch({ status: Status.NOT_CONNECTED });
45
45
  viewerStore.$patch({ status: Status.NOT_CONNECTED });
46
46
  expect(spy).not.toHaveBeenCalled();
47
47
  });
@@ -49,7 +49,7 @@ describe("when_microservices_connected_run_function", () => {
49
49
  test("microservices connected", async () => {
50
50
  const spy = vi.spyOn(dumb_obj, "dumb_method");
51
51
  run_function_when_microservices_connected(dumb_obj.dumb_method);
52
- geodeStore.$patch({ status: Status.CONNECTED });
52
+ backStore.$patch({ status: Status.CONNECTED });
53
53
  viewerStore.$patch({ status: Status.CONNECTED });
54
54
  await flushPromises();
55
55
  expect(spy).toHaveBeenCalledWith();
@@ -5,8 +5,8 @@ import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json";
5
5
 
6
6
  // Local imports
7
7
  import { setupActivePinia } from "@ogw_tests/utils";
8
+ import { useBackStore } from "@ogw_front/stores/back";
8
9
  import { useFeedbackStore } from "@ogw_front/stores/feedback";
9
- import { useGeodeStore } from "@ogw_front/stores/geode";
10
10
 
11
11
  const ZERO = 0;
12
12
  const schema = schemas.opengeodeweb_back.upload_file;
@@ -14,27 +14,27 @@ const schema = schemas.opengeodeweb_back.upload_file;
14
14
  describe("upload_file", () => {
15
15
  beforeEach(() => {
16
16
  setupActivePinia();
17
- const geodeStore = useGeodeStore();
18
- geodeStore.base_url = "";
17
+ const backStore = useBackStore();
18
+ backStore.base_url = "";
19
19
  });
20
20
 
21
21
  test("throw error", async () => {
22
- const geodeStore = useGeodeStore();
22
+ const backStore = useBackStore();
23
23
  const file = "toto";
24
24
 
25
- await expect(geodeStore.upload(file)).rejects.toThrow("file must be a instance of File");
25
+ await expect(backStore.upload(file)).rejects.toThrow("file must be a instance of File");
26
26
  });
27
27
 
28
28
  test("onResponse", async () => {
29
29
  const feedbackStore = useFeedbackStore();
30
- const geodeStore = useGeodeStore();
30
+ const backStore = useBackStore();
31
31
  registerEndpoint(schema.$id, {
32
32
  method: "PUT",
33
33
  handler: () => ({ test: "ok" }),
34
34
  });
35
35
  const file = new File(["fake_file"], "fake_file.txt");
36
36
  let response_value = "";
37
- await geodeStore.upload(file, {
37
+ await backStore.upload(file, {
38
38
  response_function: (response) => {
39
39
  response_value = response._data.test;
40
40
  },
@@ -52,7 +52,7 @@ describe("app store", () => {
52
52
  load: vi.fn(),
53
53
  };
54
54
  const mock_store_2 = {
55
- $id: "geodeStore",
55
+ $id: "backStore",
56
56
  save: vi.fn(),
57
57
  load: vi.fn(),
58
58
  };
@@ -62,7 +62,7 @@ describe("app store", () => {
62
62
 
63
63
  expect(appStore.stores).toHaveLength(MULTIPLE_STORES_LENGTH);
64
64
  expect(appStore.stores[FIRST_INDEX].$id).toBe("userStore");
65
- expect(appStore.stores[SECOND_INDEX].$id).toBe("geodeStore");
65
+ expect(appStore.stores[SECOND_INDEX].$id).toBe("backStore");
66
66
  });
67
67
  });
68
68
 
@@ -78,7 +78,7 @@ describe("app store", () => {
78
78
  importStores: vi.fn(),
79
79
  };
80
80
  const mock_store_2 = {
81
- $id: "geodeStore",
81
+ $id: "backStore",
82
82
  exportStores: vi.fn().mockReturnValue({ items: [], total: 0 }),
83
83
  importStores: vi.fn(),
84
84
  };
@@ -92,7 +92,7 @@ describe("app store", () => {
92
92
  expect(mock_store_2.exportStores).toHaveBeenCalledTimes(CALL_COUNT_ONCE);
93
93
  expect(snapshot).toStrictEqual({
94
94
  userStore: { name: "toto", email: "toto@titi.com" },
95
- geodeStore: { items: [], total: 0 },
95
+ backStore: { items: [], total: 0 },
96
96
  });
97
97
  });
98
98
 
@@ -134,19 +134,19 @@ describe("app store", () => {
134
134
  $id: "userStore",
135
135
  importStores: vi.fn().mockResolvedValue(),
136
136
  };
137
- const geodeStore = {
138
- $id: "geodeStore",
137
+ const backStore = {
138
+ $id: "backStore",
139
139
  importStores: vi.fn().mockResolvedValue(),
140
140
  };
141
141
  appStore.registerStore(userStore);
142
- appStore.registerStore(geodeStore);
142
+ appStore.registerStore(backStore);
143
143
  const snapshot = {
144
144
  userStore: { some: "data" },
145
- geodeStore: { other: "data" },
145
+ backStore: { other: "data" },
146
146
  };
147
147
  await appStore.importStores(snapshot);
148
148
  expect(userStore.importStores).toHaveBeenCalledTimes(CALL_COUNT_ONCE);
149
- expect(geodeStore.importStores).toHaveBeenCalledTimes(CALL_COUNT_ONCE);
149
+ expect(backStore.importStores).toHaveBeenCalledTimes(CALL_COUNT_ONCE);
150
150
  });
151
151
 
152
152
  test("skip stores without importStores method", async () => {