@geode/opengeodeweb-front 12.2.0-rc.3 → 12.2.0-rc.5

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 (135) hide show
  1. package/.build/tests/browser/helpers/object_trees/common.js +3 -1
  2. package/.build/tests/browser/helpers/object_trees/model_tree_bar.js +41 -0
  3. package/.build/tests/browser/helpers/wait_for_action_settled.js +2 -2
  4. package/.build/tests/browser/suites/index.js +2 -0
  5. package/.build/tests/browser/suites/model/collections.js +1 -1
  6. package/.build/tests/browser/suites/object_tree/controls.js +2 -1
  7. package/.build/tests/browser/suites/object_tree/model_tree_bar.js +81 -0
  8. package/app/components/ClippingPlanes.vue +1 -1
  9. package/app/components/FactorFilterPanel.vue +1 -1
  10. package/app/components/Launcher.vue +3 -2
  11. package/app/components/ThresholdFilter.vue +1 -2
  12. package/app/components/Viewer/Basemap/CropOptions.vue +7 -8
  13. package/app/components/Viewer/Basemap/OpacityOptions.vue +7 -8
  14. package/app/components/Viewer/ContextMenu/CircularItems.vue +6 -43
  15. package/app/components/Viewer/ContextMenu/ContextMenu.vue +1 -6
  16. package/app/components/Viewer/ContextMenu/ContextMenuItem.vue +14 -16
  17. package/app/components/Viewer/EdgedCurve/PointsOptions.vue +5 -4
  18. package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +10 -13
  19. package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +8 -11
  20. package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +16 -13
  21. package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +28 -31
  22. package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +9 -11
  23. package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +8 -11
  24. package/app/components/Viewer/Generic/Model/BlocksOptions.vue +1 -1
  25. package/app/components/Viewer/Generic/Model/CornersOptions.vue +1 -1
  26. package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +1 -1
  27. package/app/components/Viewer/Generic/Model/EdgesOptions.vue +7 -8
  28. package/app/components/Viewer/Generic/Model/LinesOptions.vue +1 -1
  29. package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +1 -1
  30. package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +5 -7
  31. package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +5 -7
  32. package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +5 -7
  33. package/app/components/Viewer/Generic/Model/ModelStyleOptions.vue +7 -8
  34. package/app/components/Viewer/Generic/Model/PointsOptions.vue +7 -8
  35. package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +1 -1
  36. package/app/components/Viewer/Grid/2D/CellsOptions.vue +6 -4
  37. package/app/components/Viewer/Grid/2D/EdgesOptions.vue +6 -4
  38. package/app/components/Viewer/Grid/2D/PointsOptions.vue +5 -4
  39. package/app/components/Viewer/Grid/3D/CellsOptions.vue +6 -4
  40. package/app/components/Viewer/Grid/3D/EdgesOptions.vue +6 -4
  41. package/app/components/Viewer/Grid/3D/FacetsOptions.vue +6 -4
  42. package/app/components/Viewer/Grid/3D/PointsOptions.vue +5 -4
  43. package/app/components/Viewer/Image/ImageOptions.vue +10 -13
  44. package/app/components/Viewer/ObjectTree/Base/CommonTreeView.vue +17 -1
  45. package/app/components/Viewer/ObjectTree/Base/ComponentRelations.vue +2 -2
  46. package/app/components/Viewer/ObjectTree/Base/Controls.vue +26 -2
  47. package/app/components/Viewer/ObjectTree/Base/StickyHeader.vue +4 -1
  48. package/app/components/Viewer/ObjectTree/Base/TreeRow.vue +6 -8
  49. package/app/components/Viewer/ObjectTree/Box.vue +30 -5
  50. package/app/components/Viewer/ObjectTree/Layout.vue +183 -54
  51. package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +10 -15
  52. package/app/components/Viewer/ObjectTree/Views/ModelTree.vue +3 -0
  53. package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +28 -31
  54. package/app/components/Viewer/Scene/BackgroundOptions.vue +4 -7
  55. package/app/components/Viewer/Scene/OrientationWidgetOptions.vue +4 -7
  56. package/app/components/Viewer/Scene/TextOptions.vue +4 -7
  57. package/app/components/Viewer/Solid/EdgesOptions.vue +6 -4
  58. package/app/components/Viewer/Solid/PointsOptions.vue +5 -4
  59. package/app/components/Viewer/Solid/PolygonsOptions.vue +6 -4
  60. package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +8 -11
  61. package/app/components/Viewer/Surface/EdgesOptions.vue +6 -4
  62. package/app/components/Viewer/Surface/PointsOptions.vue +6 -4
  63. package/app/components/Viewer/Surface/PolygonsOptions.vue +8 -11
  64. package/app/components/Viewer/Surface/Triangulated/TrianglesOptions.vue +5 -4
  65. package/app/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue +6 -4
  66. package/app/components/Viewer/TetrahedralSolid/TrianglesOptions.vue +6 -4
  67. package/app/composables/circular_menu.ts +45 -0
  68. package/app/composables/hover_highlight.ts +1 -1
  69. package/app/composables/model_menu_context.ts +7 -11
  70. package/app/composables/model_tree.ts +3 -3
  71. package/app/composables/model_tree_drag.ts +56 -0
  72. package/app/composables/project_manager_helpers/types.ts +2 -3
  73. package/app/composables/use_adaptive_styles.ts +15 -8
  74. package/app/composables/use_overlapping_picker.ts +7 -19
  75. package/app/composables/viewer_context_menu.ts +2 -1
  76. package/app/composables/virtual_tree.ts +7 -1
  77. package/app/stores/api.ts +6 -59
  78. package/app/stores/app.ts +21 -55
  79. package/app/stores/back.ts +86 -145
  80. package/app/stores/camera_manager.ts +12 -25
  81. package/app/stores/cloud.ts +21 -101
  82. package/app/stores/crs.ts +3 -2
  83. package/app/stores/data.ts +66 -409
  84. package/app/stores/data_style.ts +99 -93
  85. package/app/stores/feedback.ts +57 -53
  86. package/app/stores/infra.ts +61 -101
  87. package/app/stores/treeview.ts +39 -30
  88. package/app/stores/viewer.ts +9 -29
  89. package/app/stores/viewer_helpers/actions.ts +1 -23
  90. package/app/utils/backend_lifecycle.ts +155 -0
  91. package/app/utils/import_item.ts +5 -4
  92. package/app/utils/threshold_sources.ts +3 -2
  93. package/app/utils/treeview.ts +25 -1
  94. package/app/utils/viewer_object_type.ts +21 -0
  95. package/internal/database/base_database.ts +2 -1
  96. package/internal/database/database.ts +90 -7
  97. package/internal/database/queries.ts +45 -0
  98. package/internal/database/tables/camera_positions.ts +11 -1
  99. package/internal/database/tables/data.ts +20 -1
  100. package/internal/database/tables/data_style.ts +3 -1
  101. package/internal/database/tables/model_component_datastyle.ts +3 -1
  102. package/internal/database/tables/model_component_type_datastyle.ts +3 -1
  103. package/internal/database/tables/model_components.ts +12 -1
  104. package/internal/database/tables/model_components_relation.ts +11 -1
  105. package/internal/database/tables/scene_style.ts +3 -1
  106. package/internal/database/tables/treeview_config.ts +31 -0
  107. package/internal/stores/data/items.ts +110 -0
  108. package/internal/stores/data/model/collections.ts +107 -0
  109. package/internal/stores/data/model/components.ts +129 -0
  110. package/internal/stores/data/model/mesh_components.ts +134 -0
  111. package/internal/stores/data/model/relations.ts +76 -0
  112. package/internal/stores/data/model/types.ts +14 -0
  113. package/internal/stores/data/registration.ts +54 -0
  114. package/internal/stores/data/snapshot.ts +83 -0
  115. package/internal/stores/data/types.ts +26 -0
  116. package/internal/stores/data_style/model/common_mutations.ts +47 -77
  117. package/internal/stores/data_style/model/selection.ts +3 -10
  118. package/internal/stores/data_style/scene.ts +2 -2
  119. package/internal/stores/data_style/state.ts +10 -8
  120. package/internal/stores/data_style/state_shared.ts +10 -7
  121. package/internal/stores/hybrid_viewer/brightness.ts +36 -19
  122. package/internal/stores/hybrid_viewer/highlight.ts +9 -14
  123. package/internal/stores/hybrid_viewer/scene.ts +1 -1
  124. package/internal/stores/microservice.ts +192 -0
  125. package/package.json +1 -1
  126. package/tests/browser/helpers/data/helpers/attribute.ts +2 -1
  127. package/tests/browser/helpers/object_trees/common.ts +4 -0
  128. package/tests/browser/helpers/object_trees/model_tree_bar.ts +78 -0
  129. package/tests/browser/helpers/wait_for_action_settled.ts +2 -3
  130. package/tests/browser/suites/model/collections.ts +2 -1
  131. package/tests/browser/suites/object_tree/controls.ts +3 -0
  132. package/tests/browser/suites/object_tree/model_tree_bar.ts +125 -0
  133. package/app/stores/data_helpers/collections.ts +0 -122
  134. package/app/stores/data_helpers/mesh.ts +0 -167
  135. package/app/stores/data_helpers/relations.ts +0 -94
@@ -43,7 +43,9 @@ async function toggleSearchObjects(window) {
43
43
  await waitForActionSettled(window);
44
44
  }
45
45
  async function fillSearchQuery(window, query, tree) {
46
- await tree.getByTestId("searchObjectsInput").locator("input").fill(query);
46
+ const searchInput = tree.getByTestId("searchObjectsInput").locator("input");
47
+ if (!await searchInput.isVisible()) await tree.getByTestId("searchObjectsButton").click();
48
+ await searchInput.fill(query);
47
49
  await moveMouseOutOfTheWay(window);
48
50
  await waitForActionSettled(window);
49
51
  }
@@ -0,0 +1,41 @@
1
+ import { waitForActionSettled } from "../wait_for_action_settled.js";
2
+ import { moveMouseOutOfTheWay } from "../app_interaction.js";
3
+ import { getModelComponentsObjectTree } from "./model_components_object_tree.js";
4
+ //#region tests/browser/helpers/object_trees/model_tree_bar.ts
5
+ const DRAG_STEPS = 10;
6
+ function getModelTreeToggles(window) {
7
+ return window.getByTestId("modelTreeToggle");
8
+ }
9
+ function getModelTreeRows(window) {
10
+ return getModelComponentsObjectTree(window).getByTestId("treeRowWrapper");
11
+ }
12
+ async function clickModelTreeBarButton(window, locator) {
13
+ await locator.click();
14
+ await moveMouseOutOfTheWay(window);
15
+ await waitForActionSettled(window);
16
+ }
17
+ async function getModelTreePanelColors(window) {
18
+ return await window.locator(".tree-box").evaluateAll((boxes) => boxes.map((box) => {
19
+ if (box instanceof HTMLElement) return box.style.getPropertyValue("--tree-box-accent");
20
+ return "";
21
+ }).filter((color) => color !== ""));
22
+ }
23
+ async function getModelTreeButtonColors(window) {
24
+ return await getModelTreeToggles(window).evaluateAll((toggles) => toggles.map((toggle) => {
25
+ if (toggle instanceof HTMLElement) return toggle.style.getPropertyValue("--model-tree-color");
26
+ return "";
27
+ }));
28
+ }
29
+ async function dragModelTreeButton(window, fromIndex, toIndex) {
30
+ const source = await getModelTreeToggles(window).nth(fromIndex).boundingBox();
31
+ const target = await getModelTreeToggles(window).nth(toIndex).boundingBox();
32
+ if (source === null || target === null) throw new Error("The model buttons are not displayed.");
33
+ await window.mouse.move(source.x + source.width / 2, source.y + source.height / 2);
34
+ await window.mouse.down();
35
+ await window.mouse.move(target.x + target.width / 2, target.y + target.height / 2, { steps: DRAG_STEPS });
36
+ await window.mouse.up();
37
+ await moveMouseOutOfTheWay(window);
38
+ await waitForActionSettled(window);
39
+ }
40
+ //#endregion
41
+ export { clickModelTreeBarButton, dragModelTreeButton, getModelTreeButtonColors, getModelTreePanelColors, getModelTreeRows, getModelTreeToggles };
@@ -16,7 +16,7 @@ async function isMicroservicesBusy(window) {
16
16
  const MUTATION_QUIET_MS = 250;
17
17
  const MUTATION_POLL_INTERVAL_MS = 20;
18
18
  async function waitForDomSettled(window, budgetMs) {
19
- await window.evaluate((quietMs) => {
19
+ await window.evaluate(() => {
20
20
  globalThis.e2eLastMutationAt = performance.now();
21
21
  if (!globalThis.e2eMutationObserver) {
22
22
  const observer = new MutationObserver(() => {
@@ -29,7 +29,7 @@ async function waitForDomSettled(window, budgetMs) {
29
29
  });
30
30
  globalThis.e2eMutationObserver = observer;
31
31
  }
32
- }, MUTATION_QUIET_MS);
32
+ });
33
33
  await window.waitForFunction((quietMs) => performance.now() - (globalThis.e2eLastMutationAt ?? 0) >= quietMs, MUTATION_QUIET_MS, {
34
34
  polling: MUTATION_POLL_INTERVAL_MS,
35
35
  timeout: budgetMs
@@ -23,6 +23,7 @@ import { surfaces_exports } from "./model/surfaces.js";
23
23
  import { component_relations_exports } from "./object_tree/component_relations.js";
24
24
  import { controls_exports } from "./object_tree/controls.js";
25
25
  import { group_context_menu_exports } from "./object_tree/group_context_menu.js";
26
+ import { model_tree_bar_exports } from "./object_tree/model_tree_bar.js";
26
27
  import { multi_type_import_exports } from "./object_tree/multi_type_import.js";
27
28
  import { time_series_exports } from "./time_series.js";
28
29
  //#region tests/browser/suites/index.ts
@@ -53,6 +54,7 @@ const suites = Object.fromEntries(Object.entries(/* @__PURE__ */ Object.assign({
53
54
  "./object_tree/component_relations.ts": component_relations_exports,
54
55
  "./object_tree/controls.ts": controls_exports,
55
56
  "./object_tree/group_context_menu.ts": group_context_menu_exports,
57
+ "./object_tree/model_tree_bar.ts": model_tree_bar_exports,
56
58
  "./object_tree/multi_type_import.ts": multi_type_import_exports,
57
59
  "./time_series.ts": time_series_exports
58
60
  })).map(([file, { registerTests }]) => [SUITE_PATH_REGEX.exec(file)?.groups?.name ?? file, registerTests]));
@@ -13,7 +13,7 @@ import { expect } from "@playwright/test";
13
13
  var collections_exports = /* @__PURE__ */ __exportAll({ registerTests: () => registerTests });
14
14
  const structuralModelFilename = "test.og_strm";
15
15
  const collectionTypeRowName = "ModelBoundaries";
16
- const collectionRowName = "019ea684-373";
16
+ const collectionRowName = "019ea684-37";
17
17
  const vertexAttributeName = "test_vertex";
18
18
  function registerTests({ test, loadTestDatas }) {
19
19
  test.describe.configure({ mode: "serial" });
@@ -2,7 +2,7 @@ import { __exportAll } from "../../../../_virtual/_rolldown/runtime.js";
2
2
  import { brepGeodeObjectType } from "../../helpers/constants.js";
3
3
  import { waitForActionSettled } from "../../helpers/wait_for_action_settled.js";
4
4
  import { closeAllMenus, moveMouseOutOfTheWay } from "../../helpers/app_interaction.js";
5
- import { checkFilterCategory, copyTreeRowId, fillSearchQuery, getTreeRowId, hideObjectInTree, openFilterMenu, toggleSearchObjects, toggleSortObjects, uncheckFilterCategory } from "../../helpers/object_trees/common.js";
5
+ import { checkFilterCategory, copyTreeRowId, expandGeodeObjectTypeInTree, fillSearchQuery, getTreeRowId, hideObjectInTree, openFilterMenu, toggleSearchObjects, toggleSortObjects, uncheckFilterCategory } from "../../helpers/object_trees/common.js";
6
6
  import { collapseMainObjectTree, getMainObjectTree, toggleObjectsTree } from "../../helpers/object_trees/main_object_tree.js";
7
7
  import "../../helpers/viewer_interaction.js";
8
8
  import { resetCamera } from "../../helpers/camera_interaction.js";
@@ -50,6 +50,7 @@ function registerTests({ test, loadTestDatas }) {
50
50
  });
51
51
  test("search by id", async ({ window, screenshotMask }) => {
52
52
  const mainObjectTree = getMainObjectTree(window);
53
+ await expandGeodeObjectTypeInTree(window, brepGeodeObjectType, mainObjectTree);
53
54
  const brepLabel = mainObjectTree.locator("[data-testid^=\"treeRow-\"]", { hasText: "test" }).first();
54
55
  const searchPrefix = (await getTreeRowId(brepLabel, "test")).slice(0, 3);
55
56
  await fillSearchQuery(window, searchPrefix, mainObjectTree);
@@ -0,0 +1,81 @@
1
+ import { __exportAll } from "../../../../_virtual/_rolldown/runtime.js";
2
+ import { brepGeodeObjectType, defaultDataName, structuralModelGeodeObjectType } from "../../helpers/constants.js";
3
+ import { moveMouseOutOfTheWay } from "../../helpers/app_interaction.js";
4
+ import { fillSearchQuery } from "../../helpers/object_trees/common.js";
5
+ import { collapseMainObjectTreeGroup, expandMainObjectTree, getMainObjectTree } from "../../helpers/object_trees/main_object_tree.js";
6
+ import { expandMeshComponentType, getModelComponentsObjectTree, openModelComponentsTree } from "../../helpers/object_trees/model_components_object_tree.js";
7
+ import { clickModelTreeBarButton, dragModelTreeButton, getModelTreeButtonColors, getModelTreePanelColors, getModelTreeRows, getModelTreeToggles } from "../../helpers/object_trees/model_tree_bar.js";
8
+ import { expect } from "@playwright/test";
9
+ //#region tests/browser/suites/object_tree/model_tree_bar.ts
10
+ var model_tree_bar_exports = /* @__PURE__ */ __exportAll({ registerTests: () => registerTests });
11
+ const brepFilename = "test.og_brep";
12
+ const structuralModelFilename = "test.og_strm";
13
+ function registerTests({ test, loadTestDatas }) {
14
+ test.describe.configure({ mode: "serial" });
15
+ let surfaceRows = 0;
16
+ test("open a model tree with its surfaces expanded", async ({ window }) => {
17
+ test.slow();
18
+ await loadTestDatas(window, [brepFilename]);
19
+ await loadTestDatas(window, [structuralModelFilename]);
20
+ await expandMainObjectTree(window);
21
+ await openModelComponentsTree(window, brepGeodeObjectType, defaultDataName);
22
+ await expandMeshComponentType(window, "Surfaces");
23
+ await moveMouseOutOfTheWay(window);
24
+ surfaceRows = await getModelTreeRows(window).count();
25
+ await expect(getModelTreeToggles(window)).toHaveCount(1);
26
+ });
27
+ test("collapse the model tree from its button", async ({ window }) => {
28
+ await clickModelTreeBarButton(window, window.getByTestId("toggleModelTreeButton"));
29
+ await expect(getModelComponentsObjectTree(window)).toHaveCount(0);
30
+ await expect(getModelTreeToggles(window)).toHaveCount(1);
31
+ });
32
+ test("show the model tree again with its state", async ({ window }) => {
33
+ await clickModelTreeBarButton(window, window.getByTestId("toggleModelTreeButton"));
34
+ await expect(getModelComponentsObjectTree(window)).toHaveCount(1);
35
+ await expect(getModelTreeRows(window)).toHaveCount(surfaceRows);
36
+ });
37
+ test("open a second model tree", async ({ window }) => {
38
+ await openModelComponentsTree(window, structuralModelGeodeObjectType, defaultDataName);
39
+ await expect(getModelComponentsObjectTree(window)).toHaveCount(2);
40
+ await expect(window.getByTestId("toggleAllModelTreesButton")).toBeVisible();
41
+ });
42
+ test("collapse all the model trees", async ({ window }) => {
43
+ await clickModelTreeBarButton(window, window.getByTestId("toggleAllModelTreesButton"));
44
+ await expect(getModelComponentsObjectTree(window)).toHaveCount(0);
45
+ });
46
+ test("show all the model trees", async ({ window }) => {
47
+ await clickModelTreeBarButton(window, window.getByTestId("toggleAllModelTreesButton"));
48
+ await expect(getModelComponentsObjectTree(window)).toHaveCount(2);
49
+ });
50
+ test("reorder the model trees from their buttons", async ({ window }) => {
51
+ const before = await getModelTreePanelColors(window);
52
+ await dragModelTreeButton(window, 1, 0);
53
+ await expect.poll(async () => {
54
+ return await getModelTreePanelColors(window);
55
+ }).toStrictEqual(before.toReversed());
56
+ expect(await getModelTreeButtonColors(window)).toStrictEqual(before.toReversed());
57
+ });
58
+ test("the search takes the keyboard as it opens", async ({ window }) => {
59
+ const mainObjectTree = getMainObjectTree(window);
60
+ await collapseMainObjectTreeGroup(window, brepGeodeObjectType);
61
+ await mainObjectTree.getByTestId("searchObjectsButton").click();
62
+ for (const key of [
63
+ "t",
64
+ "e",
65
+ "s"
66
+ ]) await window.keyboard.press(key);
67
+ await expect(mainObjectTree.getByTestId("searchObjectsInput").locator("input")).toHaveValue("tes");
68
+ });
69
+ test("clearing the search folds the groups back", async ({ window }) => {
70
+ const mainObjectTree = getMainObjectTree(window);
71
+ await fillSearchQuery(window, "", mainObjectTree);
72
+ await expect(mainObjectTree.getByTestId("treeRowWrapper").filter({ hasText: defaultDataName })).toHaveCount(1);
73
+ });
74
+ test("leaving an empty search folds it back", async ({ window }) => {
75
+ const searchInput = getMainObjectTree(window).getByTestId("searchObjectsInput").locator("input");
76
+ await searchInput.blur();
77
+ await expect(searchInput).toBeHidden();
78
+ });
79
+ }
80
+ //#endregion
81
+ export { model_tree_bar_exports, registerTests };
@@ -35,7 +35,7 @@ function createPlane(origin: ClippingPlane["origin"], normal: number[]): Clippin
35
35
  return { id: newItemId(), origin, normal, opacity: DEFAULT_PLANE_OPACITY };
36
36
  }
37
37
  const planes = ref<ClippingPlane[]>([createPlane(undefined, [1, 0, 0])]);
38
- const allItems = dataStore.refRegisteredItems();
38
+ const allItems = computed(() => dataStore.registeredItems);
39
39
  const targetIds = computed<string[]>(() => {
40
40
  if (targetAllVisible.value) {
41
41
  return allItems.value.map((item) => item.data_id);
@@ -43,7 +43,7 @@ const targetAllVisible = ref<boolean>(true);
43
43
  const selectedDatasetIds = ref<string[]>([]);
44
44
  const factor = ref<number>(factorRange.defaultValue);
45
45
 
46
- const allItems = dataStore.refRegisteredItems();
46
+ const allItems = computed(() => dataStore.registeredItems);
47
47
  const availableDatasets = computed<{ title: string; value: string }[]>(() =>
48
48
  allItems.value.map((item) => ({
49
49
  title: item.name || item.data_id,
@@ -2,6 +2,7 @@
2
2
  import Loading from "@ogw_front/components/Loading.vue";
3
3
  import { Status } from "@ogw_front/utils/status";
4
4
  import { appMode } from "@ogw_shared/app_mode";
5
+ import { createBackend } from "@ogw_front/utils/backend_lifecycle";
5
6
  import { getCloudUrlParam } from "@ogw_front/utils/cloud";
6
7
  import { useInfraStore } from "@ogw_front/stores/infra";
7
8
 
@@ -24,11 +25,11 @@ const infraStore = useInfraStore();
24
25
  // In cloud mode, wait for the user to authenticate and load the app, unless a `?cloud_url=` link
25
26
  // Points at an already running service: that one is connected straight away, without authentication.
26
27
  if (infraStore.app_mode !== appMode.CLOUD || getCloudUrlParam() !== undefined) {
27
- infraStore.create_backend(authToken);
28
+ void createBackend(authToken);
28
29
  }
29
30
 
30
31
  function cloudCreateBackend(): Promise<void> {
31
- return infraStore.create_backend(authToken);
32
+ return createBackend(authToken);
32
33
  }
33
34
  </script>
34
35
 
@@ -30,9 +30,8 @@ const thresholds = computed<Threshold[]>(() => {
30
30
  });
31
31
  const cards = useTemplateRef("cards");
32
32
 
33
- const allItems = dataStore.refAllItems();
34
33
  const availableDatasets = computed<{ title: string; value: string }[]>(() =>
35
- allItems.value.map((item) => ({
34
+ dataStore.items.map((item) => ({
36
35
  title: item.name || item.data_id,
37
36
  value: item.data_id,
38
37
  })),
@@ -1,20 +1,20 @@
1
1
  <script setup lang="ts">
2
2
  import { MAP_STYLES, mapStyleOf } from "@ogw_front/utils/basemap_tree";
3
- import ViewerContextMenuItem, {
4
- type ItemProps,
5
- } from "@ogw_front/components/Viewer/ContextMenu/ContextMenuItem.vue";
3
+ import type { DataId } from "@geode/opengeodeweb-microservice/schema_types";
4
+ import ViewerContextMenuItem from "@ogw_front/components/Viewer/ContextMenu/ContextMenuItem.vue";
6
5
  import { useBasemapStore } from "@ogw_front/stores/basemap";
7
6
 
8
7
  interface Props {
9
- itemProps: ItemProps & { index: number };
8
+ dataId: DataId;
9
+ index: number;
10
10
  tooltip?: string;
11
11
  }
12
12
 
13
- const { itemProps, tooltip = "Crop to data" } = defineProps<Props>();
13
+ const { dataId, index, tooltip = "Crop to data" } = defineProps<Props>();
14
14
  const basemapStore = useBasemapStore();
15
15
  // A map menu crops that map, the basemap category menu crops every map
16
16
  const mapStyles = computed(() => {
17
- const mapStyle = mapStyleOf(itemProps.id);
17
+ const mapStyle = mapStyleOf(dataId);
18
18
  if (mapStyle === undefined) {
19
19
  return MAP_STYLES;
20
20
  }
@@ -28,8 +28,7 @@ const indeterminate = computed(() => new Set(cropped.value).size > 1);
28
28
  <template>
29
29
  <ViewerContextMenuItem
30
30
  data-testid="basemapCropMenu"
31
- :index="itemProps.index"
32
- :itemProps="itemProps"
31
+ :index="index"
33
32
  :tooltip="tooltip"
34
33
  btnIcon="ph-panorama"
35
34
  >
@@ -1,19 +1,19 @@
1
1
  <script setup lang="ts">
2
- import ViewerContextMenuItem, {
3
- type ItemProps,
4
- } from "@ogw_front/components/Viewer/ContextMenu/ContextMenuItem.vue";
2
+ import type { DataId } from "@geode/opengeodeweb-microservice/schema_types";
3
+ import ViewerContextMenuItem from "@ogw_front/components/Viewer/ContextMenu/ContextMenuItem.vue";
5
4
  import { mapStyleOf } from "@ogw_front/utils/basemap_tree";
6
5
  import { useBasemapStore } from "@ogw_front/stores/basemap";
7
6
 
8
7
  interface Props {
9
- itemProps: ItemProps & { index: number };
8
+ dataId: DataId;
9
+ index: number;
10
10
  tooltip?: string;
11
11
  }
12
12
 
13
- const { itemProps, tooltip = "Opacity" } = defineProps<Props>();
13
+ const { dataId, index, tooltip = "Opacity" } = defineProps<Props>();
14
14
  const basemapStore = useBasemapStore();
15
15
  const PERCENT = 100;
16
- const mapStyle = computed(() => mapStyleOf(itemProps.id));
16
+ const mapStyle = computed(() => mapStyleOf(dataId));
17
17
  // The slider works in percent, the store in 0..1
18
18
  const opacityPercent = computed({
19
19
  get: () => Math.round((mapStyle.value ? basemapStore.opacities[mapStyle.value] : 1) * PERCENT),
@@ -28,8 +28,7 @@ const opacityPercent = computed({
28
28
  <template>
29
29
  <ViewerContextMenuItem
30
30
  data-testid="basemapOpacityMenu"
31
- :index="itemProps.index"
32
- :itemProps="itemProps"
31
+ :index="index"
33
32
  :tooltip="tooltip"
34
33
  btnIcon="ph-circle-half"
35
34
  >
@@ -1,25 +1,22 @@
1
1
  <script setup lang="ts">
2
2
  import type { Component } from "vue";
3
+ import type { DataId } from "@geode/opengeodeweb-microservice/schema_types";
4
+ import { provideMenuItemCount } from "@ogw_front/composables/circular_menu";
3
5
  import { useMenuStore } from "@ogw_front/stores/menu";
4
6
 
5
7
  interface Props {
6
8
  menuItems: Component[];
7
- id: string;
8
- metaData: Record<string, unknown>;
9
+ dataId: DataId;
9
10
  menuItemCount: number;
10
11
  }
11
12
 
12
- const { menuItems, id, metaData, menuItemCount } = defineProps<Props>();
13
+ const { menuItems, dataId, menuItemCount } = defineProps<Props>();
13
14
 
14
15
  const Z_INDEX_ACTIVE_ITEM = 10;
15
16
  const Z_INDEX_BASE_ITEM = 1;
16
- const FULL_ANGLE = 360;
17
- const ANGLE_45 = 45;
18
- const ANGLE_135 = 135;
19
- const ANGLE_225 = 225;
20
- const ANGLE_315 = 315;
21
17
 
22
18
  const menuStore = useMenuStore();
19
+ provideMenuItemCount(() => menuItemCount);
23
20
 
24
21
  function getItemStyle(index: number): Record<string, string> {
25
22
  const angle = (index / menuItemCount) * 2 * Math.PI;
@@ -30,34 +27,6 @@ function getItemStyle(index: number): Record<string, string> {
30
27
  zIndex: menuStore.active_item_index === index ? Z_INDEX_ACTIVE_ITEM : Z_INDEX_BASE_ITEM,
31
28
  };
32
29
  }
33
-
34
- function getTooltipLocation(index: number): string {
35
- const angle = (index / menuItemCount) * FULL_ANGLE;
36
- if (angle < ANGLE_45 || angle >= ANGLE_315) {
37
- return "right";
38
- }
39
- if (angle >= ANGLE_45 && angle < ANGLE_135) {
40
- return "top";
41
- }
42
- if (angle >= ANGLE_135 && angle < ANGLE_225) {
43
- return "left";
44
- }
45
- return "bottom";
46
- }
47
-
48
- function getTooltipOrigin(index: number): string {
49
- const angle = (index / menuItemCount) * FULL_ANGLE;
50
- if (angle < ANGLE_45 || angle >= ANGLE_315) {
51
- return "left";
52
- }
53
- if (angle >= ANGLE_45 && angle < ANGLE_135) {
54
- return "bottom";
55
- }
56
- if (angle >= ANGLE_135 && angle < ANGLE_225) {
57
- return "right";
58
- }
59
- return "top";
60
- }
61
30
  </script>
62
31
 
63
32
  <template>
@@ -66,13 +35,7 @@ function getTooltipOrigin(index: number): string {
66
35
  :is="item"
67
36
  :key="index"
68
37
  :index="index"
69
- :itemProps="{
70
- id: id,
71
- meta_data: metaData,
72
- tooltip_location: getTooltipLocation(index),
73
- tooltip_origin: getTooltipOrigin(index),
74
- totalItems: menuItemCount,
75
- }"
38
+ :data-id="dataId"
76
39
  class="menu-item-wrapper"
77
40
  :style="getItemStyle(index)"
78
41
  @mousedown.stop
@@ -182,12 +182,7 @@ function toggleShowName(): void {
182
182
  class="circular-menu-items"
183
183
  :style="{ width: `${menuStore.menuRadius * 2}px`, height: `${menuStore.menuRadius * 2}px` }"
184
184
  >
185
- <CircularItems
186
- :menu-items="menu_items"
187
- :id="id"
188
- :meta-data="meta_data"
189
- :menu-item-count="menuItemCount"
190
- />
185
+ <CircularItems :menu-items="menu_items" :data-id="id" :menu-item-count="menuItemCount" />
191
186
 
192
187
  <CenterButton
193
188
  v-if="!isSceneMenu"
@@ -1,4 +1,10 @@
1
1
  <script setup lang="ts">
2
+ import {
3
+ type MenuSide,
4
+ OPPOSITE_SIDE,
5
+ injectMenuItemCount,
6
+ menuItemSide,
7
+ } from "@ogw_front/composables/circular_menu";
2
8
  import GlassCard from "@ogw_front/components/GlassCard.vue";
3
9
  import { useAdaptiveStyles } from "@ogw_front/composables/use_adaptive_styles";
4
10
  import { useMenuStore } from "@ogw_front/stores/menu";
@@ -14,27 +20,21 @@ const menuStore = useMenuStore();
14
20
  const theme = useTheme();
15
21
  const primaryColor = computed(() => theme.current.value.colors.primary);
16
22
 
17
- interface ItemProps {
18
- id: string;
19
- meta_data: Record<string, unknown>;
20
- tooltip_location: "right" | "top" | "left" | "bottom";
21
- tooltip_origin: "right" | "top" | "left" | "bottom";
22
- totalItems: number;
23
- }
24
-
25
23
  interface Props {
26
24
  index: number;
27
- itemProps: ItemProps;
28
25
  tooltip: string;
29
26
  // An image, or an icon name of the app icon set (ph-...)
30
27
  btnImage?: string;
31
28
  btnIcon?: string;
32
29
  }
33
30
 
34
- const { index, itemProps, tooltip, btnImage = "", btnIcon = "" } = defineProps<Props>();
31
+ const { index, tooltip, btnImage = "", btnIcon = "" } = defineProps<Props>();
32
+
33
+ const itemCount = injectMenuItemCount();
34
+ const tooltipLocation = computed<MenuSide>(() => menuItemSide(index, itemCount.value));
35
35
 
36
36
  const buttonCoords = computed(() => {
37
- const angle = (index / itemProps.totalItems) * 2 * Math.PI;
37
+ const angle = (index / itemCount.value) * 2 * Math.PI;
38
38
  const deltaX = Math.cos(angle) * menuStore.menuRadius;
39
39
  const deltaY = Math.sin(angle) * menuStore.menuRadius;
40
40
  const size = 40;
@@ -108,7 +108,7 @@ const optionsStyle = computed<Record<string, string>>(() => {
108
108
  if (!is_active.value || !optionsHeight.value) {
109
109
  return {};
110
110
  }
111
- const angle = (index / itemProps.totalItems) * 2 * Math.PI;
111
+ const angle = (index / itemCount.value) * 2 * Math.PI;
112
112
  const radius = menuStore.menuRadius;
113
113
  const absoluteButtonY = menuStore.menuY + Math.sin(angle) * radius;
114
114
  const height = optionsHeight.value;
@@ -124,7 +124,7 @@ const optionsStyle = computed<Record<string, string>>(() => {
124
124
  });
125
125
 
126
126
  const optionsClass = computed<string>(() => {
127
- const loc = itemProps.tooltip_location;
127
+ const loc = tooltipLocation.value;
128
128
  const margin = MARGIN;
129
129
  const radius = menuStore.menuRadius;
130
130
  if (loc === "right") {
@@ -138,12 +138,10 @@ const optionsClass = computed<string>(() => {
138
138
  function toggleOptions(): void {
139
139
  menuStore.toggleItemOptions(index);
140
140
  }
141
-
142
- export type { ItemProps };
143
141
  </script>
144
142
  <template>
145
143
  <v-sheet class="menu-item-container transition-swing" color="transparent">
146
- <v-tooltip :location="itemProps.tooltip_location" :origin="itemProps.tooltip_origin">
144
+ <v-tooltip :location="tooltipLocation" :origin="OPPOSITE_SIDE[tooltipLocation]">
147
145
  <template v-slot:activator="{ props: tooltipProps }">
148
146
  <v-btn
149
147
  icon
@@ -1,15 +1,16 @@
1
1
  <script setup lang="ts">
2
+ import type { DataId } from "@geode/opengeodeweb-microservice/schema_types";
2
3
  import EdgedCurvePoints from "@ogw_front/assets/viewer_svgs/edged_curve_points.svg";
3
- import type { ItemProps } from "@ogw_front/components/Viewer/ContextMenu/ContextMenuItem.vue";
4
4
  import ViewerGenericMeshPointsOptions from "@ogw_front/components/Viewer/Generic/Mesh/PointsOptions.vue";
5
5
 
6
6
  interface Props {
7
- itemProps: ItemProps & { index?: number };
7
+ dataId: DataId;
8
+ index: number;
8
9
  }
9
10
 
10
- const { itemProps } = defineProps<Props>();
11
+ const { dataId, index } = defineProps<Props>();
11
12
  </script>
12
13
 
13
14
  <template>
14
- <ViewerGenericMeshPointsOptions :itemProps="itemProps" :btnImage="EdgedCurvePoints" />
15
+ <ViewerGenericMeshPointsOptions :data-id="dataId" :index="index" :btnImage="EdgedCurvePoints" />
15
16
  </template>
@@ -1,10 +1,9 @@
1
1
  <script setup lang="ts">
2
2
  import type { EdgeWidth, Visibility } from "@geode/opengeodeweb-viewer/schema_types";
3
- import ViewerContextMenuItem, {
4
- type ItemProps,
5
- } from "@ogw_front/components/Viewer/ContextMenu/ContextMenuItem.vue";
3
+ import type { DataId } from "@geode/opengeodeweb-microservice/schema_types";
6
4
  import EdgedCurveEdges from "@ogw_front/assets/viewer_svgs/edged_curve_edges.svg";
7
5
  import type { MeshId } from "@ogw_front/types/identifiers";
6
+ import ViewerContextMenuItem from "@ogw_front/components/Viewer/ContextMenu/ContextMenuItem.vue";
8
7
  import ViewerEdgedCurveSpecificEdgesColoring from "@ogw_front/components/Viewer/EdgedCurve/SpecificEdgesColoring.vue";
9
8
  import ViewerOptionsVisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
10
9
  import ViewerOptionsWidthSlider from "@ogw_front/components/Viewer/Options/Sliders/Width.vue";
@@ -17,26 +16,25 @@ const hybridViewerStore = useHybridViewerStore();
17
16
  const { applyBatchStyle } = useBatchStyle();
18
17
 
19
18
  interface Props {
20
- itemProps: ItemProps & { index?: number };
19
+ dataId: DataId;
20
+ index: number;
21
21
  }
22
22
 
23
- const { itemProps } = defineProps<Props>();
24
-
25
- const dataId = toRef(() => itemProps.id);
23
+ const { dataId, index } = defineProps<Props>();
26
24
 
27
25
  const visibility = computed<Visibility>({
28
- get: () => dataStyleStore.meshEdgesVisibility(dataId.value),
26
+ get: () => dataStyleStore.meshEdgesVisibility(dataId),
29
27
  set: async (newValue) => {
30
- await applyBatchStyle(dataId.value, (meshId: MeshId) =>
28
+ await applyBatchStyle(dataId, (meshId: MeshId) =>
31
29
  dataStyleStore.setMeshEdgesVisibility(meshId, newValue),
32
30
  );
33
31
  hybridViewerStore.remoteRender();
34
32
  },
35
33
  });
36
34
  const width = computed<EdgeWidth>({
37
- get: () => dataStyleStore.meshEdgesWidth(dataId.value),
35
+ get: () => dataStyleStore.meshEdgesWidth(dataId),
38
36
  set: async (newValue) => {
39
- await applyBatchStyle(dataId.value, (meshId: MeshId) =>
37
+ await applyBatchStyle(dataId, (meshId: MeshId) =>
40
38
  dataStyleStore.setMeshEdgesWidth(meshId, newValue),
41
39
  );
42
40
  hybridViewerStore.remoteRender();
@@ -47,8 +45,7 @@ const width = computed<EdgeWidth>({
47
45
  <template>
48
46
  <ViewerContextMenuItem
49
47
  data-testid="meshEdgesMenu"
50
- :index="itemProps.index!"
51
- :itemProps="itemProps"
48
+ :index="index"
52
49
  :btnImage="EdgedCurveEdges"
53
50
  tooltip="Edges options"
54
51
  >
@@ -1,8 +1,7 @@
1
1
  <script setup lang="ts">
2
- import ViewerContextMenuItem, {
3
- type ItemProps,
4
- } from "@ogw_front/components/Viewer/ContextMenu/ContextMenuItem.vue";
2
+ import type { DataId } from "@geode/opengeodeweb-microservice/schema_types";
5
3
  import type { MeshId } from "@ogw_front/types/identifiers";
4
+ import ViewerContextMenuItem from "@ogw_front/components/Viewer/ContextMenu/ContextMenuItem.vue";
6
5
  import ViewerGenericMeshCellsColoring from "@ogw_front/components/Viewer/Generic/Mesh/CellsColoring.vue";
7
6
  import ViewerOptionsVisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
8
7
  import type { Visibility } from "@geode/opengeodeweb-viewer/schema_types";
@@ -15,19 +14,18 @@ const hybridViewerStore = useHybridViewerStore();
15
14
  const { applyBatchStyle } = useBatchStyle();
16
15
 
17
16
  interface Props {
18
- itemProps: ItemProps & { index?: number };
17
+ dataId: DataId;
18
+ index: number;
19
19
  btnImage: string;
20
20
  tooltip?: string;
21
21
  }
22
22
 
23
- const { itemProps, btnImage, tooltip = "Cells options" } = defineProps<Props>();
24
-
25
- const dataId = toRef(() => itemProps.id);
23
+ const { dataId, index, btnImage, tooltip = "Cells options" } = defineProps<Props>();
26
24
 
27
25
  const visibility = computed<Visibility>({
28
- get: () => dataStyleStore.meshCellsVisibility(dataId.value),
26
+ get: () => dataStyleStore.meshCellsVisibility(dataId),
29
27
  set: async (newValue) => {
30
- await applyBatchStyle(dataId.value, (meshId: MeshId) =>
28
+ await applyBatchStyle(dataId, (meshId: MeshId) =>
31
29
  dataStyleStore.setMeshCellsVisibility(meshId, newValue),
32
30
  );
33
31
  hybridViewerStore.remoteRender();
@@ -38,8 +36,7 @@ const visibility = computed<Visibility>({
38
36
  <template>
39
37
  <ViewerContextMenuItem
40
38
  data-testid="meshCellsMenu"
41
- :index="itemProps.index!"
42
- :itemProps="itemProps"
39
+ :index="index"
43
40
  :tooltip="tooltip"
44
41
  :btnImage="btnImage"
45
42
  >