@geode/opengeodeweb-front 10.8.0-rc.1 → 10.8.0-rc.3

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 (105) hide show
  1. package/app/components/Launcher.vue +8 -1
  2. package/app/components/Loading/EcoMessages.vue +77 -0
  3. package/app/components/Loading/Footer.vue +13 -0
  4. package/app/components/Loading/Header.vue +41 -0
  5. package/app/components/Loading/Progress.vue +26 -0
  6. package/app/components/Loading.vue +71 -75
  7. package/app/components/ObjectSelector.vue +0 -2
  8. package/app/components/Viewer/BreadCrumb.vue +6 -1
  9. package/app/components/Viewer/TreeComponent.vue +8 -9
  10. package/app/components/Viewer/Ui.vue +47 -0
  11. package/app/stores/app.js +1 -0
  12. package/app/stores/data.js +16 -3
  13. package/app/stores/data_style.js +28 -25
  14. package/app/stores/hybrid_viewer.js +0 -1
  15. package/app/utils/file_import_workflow.js +1 -0
  16. package/app/utils/local/cleanup.js +5 -1
  17. package/app/utils/local/microservices.js +1 -13
  18. package/internal/database/base_database.js +22 -0
  19. package/internal/database/database.js +5 -20
  20. package/internal/database/extended_database.js +3 -10
  21. package/internal/database/tables/data_style.js +4 -0
  22. package/internal/database/tables/model_component_datastyle.js +4 -0
  23. package/internal/stores/data_style/mesh/cells/cell.js +12 -39
  24. package/internal/stores/data_style/mesh/cells/color.js +4 -4
  25. package/internal/stores/data_style/mesh/cells/common.js +19 -3
  26. package/internal/stores/data_style/mesh/cells/index.js +16 -10
  27. package/internal/stores/data_style/mesh/cells/textures.js +4 -4
  28. package/internal/stores/data_style/mesh/cells/vertex.js +35 -42
  29. package/internal/stores/data_style/mesh/cells/visibility.js +1 -4
  30. package/internal/stores/data_style/mesh/edges/color.js +4 -4
  31. package/internal/stores/data_style/mesh/edges/common.js +12 -3
  32. package/internal/stores/data_style/mesh/edges/edge.js +40 -40
  33. package/internal/stores/data_style/mesh/edges/index.js +18 -19
  34. package/internal/stores/data_style/mesh/edges/vertex.js +37 -44
  35. package/internal/stores/data_style/mesh/edges/visibility.js +1 -5
  36. package/internal/stores/data_style/mesh/edges/width.js +1 -5
  37. package/internal/stores/data_style/mesh/index.js +32 -5
  38. package/internal/stores/data_style/mesh/points/color.js +4 -4
  39. package/internal/stores/data_style/mesh/points/common.js +12 -3
  40. package/internal/stores/data_style/mesh/points/index.js +34 -32
  41. package/internal/stores/data_style/mesh/points/size.js +1 -4
  42. package/internal/stores/data_style/mesh/points/vertex.js +79 -65
  43. package/internal/stores/data_style/mesh/points/visibility.js +1 -4
  44. package/internal/stores/data_style/mesh/polygons/color.js +4 -4
  45. package/internal/stores/data_style/mesh/polygons/common.js +12 -3
  46. package/internal/stores/data_style/mesh/polygons/index.js +35 -24
  47. package/internal/stores/data_style/mesh/polygons/polygon.js +40 -34
  48. package/internal/stores/data_style/mesh/polygons/textures.js +4 -4
  49. package/internal/stores/data_style/mesh/polygons/vertex.js +35 -42
  50. package/internal/stores/data_style/mesh/polygons/visibility.js +4 -4
  51. package/internal/stores/data_style/mesh/polyhedra/color.js +4 -4
  52. package/internal/stores/data_style/mesh/polyhedra/common.js +12 -3
  53. package/internal/stores/data_style/mesh/polyhedra/index.js +21 -11
  54. package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +80 -60
  55. package/internal/stores/data_style/mesh/polyhedra/vertex.js +79 -65
  56. package/internal/stores/data_style/mesh/polyhedra/visibility.js +4 -4
  57. package/internal/stores/data_style/model/blocks/color.js +17 -29
  58. package/internal/stores/data_style/model/blocks/common.js +14 -4
  59. package/internal/stores/data_style/model/blocks/index.js +38 -8
  60. package/internal/stores/data_style/model/blocks/visibility.js +19 -30
  61. package/internal/stores/data_style/model/corners/color.js +16 -29
  62. package/internal/stores/data_style/model/corners/common.js +14 -4
  63. package/internal/stores/data_style/model/corners/index.js +42 -8
  64. package/internal/stores/data_style/model/corners/visibility.js +16 -29
  65. package/internal/stores/data_style/model/edges/common.js +8 -1
  66. package/internal/stores/data_style/model/edges/index.js +2 -5
  67. package/internal/stores/data_style/model/edges/visibility.js +7 -5
  68. package/internal/stores/data_style/model/index.js +102 -133
  69. package/internal/stores/data_style/model/lines/color.js +20 -29
  70. package/internal/stores/data_style/model/lines/common.js +14 -4
  71. package/internal/stores/data_style/model/lines/index.js +35 -6
  72. package/internal/stores/data_style/model/lines/visibility.js +19 -29
  73. package/internal/stores/data_style/model/points/common.js +7 -0
  74. package/internal/stores/data_style/model/points/size.js +1 -4
  75. package/internal/stores/data_style/model/points/visibility.js +4 -4
  76. package/internal/stores/data_style/model/surfaces/color.js +16 -29
  77. package/internal/stores/data_style/model/surfaces/common.js +14 -4
  78. package/internal/stores/data_style/model/surfaces/index.js +37 -6
  79. package/internal/stores/data_style/model/surfaces/visibility.js +17 -29
  80. package/internal/stores/data_style/state.js +126 -5
  81. package/internal/utils/viewer_call.js +1 -1
  82. package/package.json +1 -2
  83. package/tests/integration/microservices/back/requirements.txt +7 -0
  84. package/tests/integration/microservices/viewer/requirements.txt +7 -0
  85. package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +3 -1
  86. package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +10 -0
  87. package/tests/integration/stores/data_style/model/corners.nuxt.test.js +10 -0
  88. package/tests/integration/stores/data_style/model/edges.nuxt.test.js +9 -0
  89. package/tests/integration/stores/data_style/model/index.nuxt.test.js +9 -0
  90. package/tests/integration/stores/data_style/model/lines.nuxt.test.js +10 -0
  91. package/tests/integration/stores/data_style/model/points.nuxt.test.js +10 -0
  92. package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +10 -0
  93. package/tests/unit/plugins/project_load.nuxt.test.js +13 -6
  94. package/app/assets/img/energy_sobriety/chemin.png +0 -0
  95. package/app/assets/img/energy_sobriety/collegue.png +0 -0
  96. package/app/assets/img/energy_sobriety/derniere.png +0 -0
  97. package/app/assets/img/energy_sobriety/etincelle.png +0 -0
  98. package/app/assets/img/energy_sobriety/geste.png +0 -0
  99. package/app/assets/img/energy_sobriety/lampadaire.png +0 -0
  100. package/app/assets/img/energy_sobriety/salon.png +0 -0
  101. package/app/assets/img/energy_sobriety/sobene.png +0 -0
  102. package/app/assets/img/energy_sobriety/socle.png +0 -0
  103. package/app/assets/img/energy_sobriety/vert.png +0 -0
  104. package/app/assets/img/energy_sobriety/ying_yang.png +0 -0
  105. package/app/components/Carousel.vue +0 -89
@@ -4,6 +4,13 @@ import Recaptcha from "@ogw_front/components/Recaptcha";
4
4
  import { Status } from "@ogw_front/utils/status";
5
5
  import { useInfraStore } from "@ogw_front/stores/infra";
6
6
 
7
+ const { logo } = defineProps({
8
+ logo: {
9
+ type: String,
10
+ required: true,
11
+ },
12
+ });
13
+
7
14
  const infraStore = useInfraStore();
8
15
 
9
16
  watch(
@@ -29,7 +36,7 @@ watch(
29
36
  <Recaptcha :button_color="'secondary'" />
30
37
  </v-col>
31
38
  <v-col v-else-if="infraStore.status == Status.CREATING">
32
- <Loading />
39
+ <Loading :logo="logo" />
33
40
  </v-col>
34
41
  </v-row>
35
42
  </v-container>
@@ -0,0 +1,77 @@
1
+ <script setup>
2
+ const ecoMessages = [
3
+ {
4
+ icon: "mdi-leaf",
5
+ title: "Why the wait?",
6
+ message: "Your workspace starts on demand, no idle servers running 24/7.",
7
+ },
8
+ {
9
+ icon: "mdi-lightning-bolt-outline",
10
+ title: "Lower carbon footprint",
11
+ message: "On-demand computing uses up to 70% less energy than always-on servers.",
12
+ },
13
+ {
14
+ icon: "mdi-earth",
15
+ title: "Your choice matters",
16
+ message: "By using Vease, you're part of a more sustainable way to work with data.",
17
+ },
18
+ ];
19
+
20
+ const MESSAGE_INTERVAL_MS = 3000;
21
+ const currentMessage = ref(0);
22
+ let interval = undefined;
23
+
24
+ onMounted(() => {
25
+ interval = setInterval(() => {
26
+ currentMessage.value = (currentMessage.value + 1) % ecoMessages.length;
27
+ }, MESSAGE_INTERVAL_MS);
28
+ });
29
+
30
+ onUnmounted(() => {
31
+ clearInterval(interval);
32
+ });
33
+ </script>
34
+
35
+ <template>
36
+ <v-sheet color="transparent" height="160" class="position-relative overflow-visible mb-4">
37
+ <v-scroll-y-reverse-transition mode="out-in">
38
+ <v-card
39
+ :key="currentMessage"
40
+ rounded="lg"
41
+ class="pa-6 border mx-auto"
42
+ color="rgba(255, 255, 255, 0.05)"
43
+ elevation="0"
44
+ style="border-color: rgba(255, 255, 255, 0.1) !important"
45
+ >
46
+ <v-card-title
47
+ class="d-flex align-center ga-3 pa-0 mb-3 text-subtitle-1 font-weight-bold text-white text-wrap"
48
+ >
49
+ <v-icon
50
+ :icon="ecoMessages[currentMessage].icon"
51
+ color="white"
52
+ size="22"
53
+ style="filter: drop-shadow(0 0 6px rgba(var(--v-theme-primary), 0.6))"
54
+ />
55
+ {{ ecoMessages[currentMessage].title }}
56
+ </v-card-title>
57
+ <v-card-text
58
+ class="pa-0 text-body-2 text-white text-left"
59
+ style="opacity: 0.85; line-height: 1.7"
60
+ >
61
+ {{ ecoMessages[currentMessage].message }}
62
+ </v-card-text>
63
+ </v-card>
64
+ </v-scroll-y-reverse-transition>
65
+
66
+ <v-row justify="center" class="ga-3 mt-6">
67
+ <v-icon
68
+ v-for="(_, index) in ecoMessages"
69
+ :key="index"
70
+ size="10"
71
+ :color="index <= currentMessage ? 'white' : 'white'"
72
+ :icon="index === currentMessage ? 'mdi-circle' : 'mdi-circle-outline'"
73
+ :style="{ opacity: index <= currentMessage ? 1 : 0.25 }"
74
+ />
75
+ </v-row>
76
+ </v-sheet>
77
+ </template>
@@ -0,0 +1,13 @@
1
+ <template>
2
+ <v-card
3
+ color="transparent"
4
+ elevation="0"
5
+ class="mt-8 d-flex align-center justify-center ga-2 text-white"
6
+ style="opacity: 0.6; letter-spacing: 0.08em"
7
+ >
8
+ <v-icon icon="mdi-leaf" size="14" />
9
+ <v-card-text class="pa-0 text-caption font-weight-medium" style="flex: none">
10
+ On-demand infrastructure greener by design
11
+ </v-card-text>
12
+ </v-card>
13
+ </template>
@@ -0,0 +1,41 @@
1
+ <script setup>
2
+ const { logo } = defineProps({
3
+ logo: {
4
+ type: String,
5
+ default: "",
6
+ },
7
+ });
8
+ </script>
9
+
10
+ <template>
11
+ <v-row justify="center" class="mb-8">
12
+ <v-img
13
+ :src="logo"
14
+ height="180"
15
+ width="180"
16
+ style="filter: drop-shadow(0 0 20px rgba(var(--v-theme-primary), 0.4))"
17
+ />
18
+ </v-row>
19
+
20
+ <v-card color="transparent" elevation="0" class="mb-8 overflow-visible">
21
+ <v-card-title
22
+ class="text-h2 font-weight-black text-white text-wrap pa-0 d-block"
23
+ style="text-shadow: 0 0 20px rgba(255, 255, 255, 0.3)"
24
+ >
25
+ STARTING UP
26
+ </v-card-title>
27
+ <v-divider thickness="3" class="border-opacity-100 mx-auto my-4" color="primary" width="60" />
28
+ <v-card-subtitle
29
+ class="text-subtitle-2 font-weight-bold text-white ls-widest pa-0 text-wrap"
30
+ style="opacity: 0.9"
31
+ >
32
+ YOUR WORKSPACE IS WAKING UP...
33
+ </v-card-subtitle>
34
+ </v-card>
35
+ </template>
36
+
37
+ <style scoped>
38
+ .ls-widest {
39
+ letter-spacing: 0.6em !important;
40
+ }
41
+ </style>
@@ -0,0 +1,26 @@
1
+ <script setup>
2
+ const { progress } = defineProps({
3
+ progress: {
4
+ type: Number,
5
+ required: true,
6
+ },
7
+ });
8
+ </script>
9
+
10
+ <template>
11
+ <v-progress-linear
12
+ color="white"
13
+ height="10"
14
+ indeterminate
15
+ rounded
16
+ bg-color="white"
17
+ bg-opacity="0.15"
18
+ class="custom-progress-glow mt-8"
19
+ />
20
+ </template>
21
+
22
+ <style scoped>
23
+ .custom-progress-glow :deep(.v-progress-linear__indeterminate) {
24
+ box-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
25
+ }
26
+ </style>
@@ -1,82 +1,78 @@
1
1
  <script setup>
2
- import chemin from "@ogw_front/assets/img/energy_sobriety/chemin.png";
3
- import collegue from "@ogw_front/assets/img/energy_sobriety/collegue.png";
4
- import derniere from "@ogw_front/assets/img/energy_sobriety/derniere.png";
5
- import etincelle from "@ogw_front/assets/img/energy_sobriety/etincelle.png";
6
- import geste from "@ogw_front/assets/img/energy_sobriety/geste.png";
7
- import lampadaire from "@ogw_front/assets/img/energy_sobriety/lampadaire.png";
8
- import salon from "@ogw_front/assets/img/energy_sobriety/salon.png";
9
- import sobene from "@ogw_front/assets/img/energy_sobriety/sobene.png";
10
- import socle from "@ogw_front/assets/img/energy_sobriety/socle.png";
11
- import vert from "@ogw_front/assets/img/energy_sobriety/vert.png";
12
- import ying_yang from "@ogw_front/assets/img/energy_sobriety/ying_yang.png";
2
+ const { logo } = defineProps({
3
+ logo: {
4
+ type: String,
5
+ default: "",
6
+ },
7
+ });
13
8
 
14
- import Carousel from "@ogw_front/components/Carousel";
9
+ const show = ref(false);
10
+ const progress = ref(0);
15
11
 
16
- const users_list = [
17
- {
18
- name: "YING YANG",
19
- logo: ying_yang,
20
- },
21
- {
22
- name: "CHEMIN",
23
- logo: chemin,
24
- },
25
- {
26
- name: "SOBRIETE ENERGETIQUE",
27
- logo: sobene,
28
- },
29
- {
30
- name: "VERT",
31
- logo: vert,
32
- },
33
- {
34
- name: "LAMPADAIRE",
35
- logo: lampadaire,
36
- },
37
- {
38
- name: "COLLEGUE",
39
- logo: collegue,
40
- },
41
- {
42
- name: "ETINCELLE",
43
- logo: etincelle,
44
- },
45
- {
46
- name: "GESTE",
47
- logo: geste,
48
- },
49
- {
50
- name: "SOCLE",
51
- logo: socle,
52
- },
53
- {
54
- name: "DERNIERE",
55
- logo: derniere,
56
- },
57
- {
58
- name: "SALON",
59
- logo: salon,
60
- },
61
- ];
12
+ let progressInterval = undefined;
13
+
14
+ const PROGRESS_THRESHOLD = 90;
15
+ const MAX_PROGRESS = 99;
16
+ const PROGRESS_INCREMENT_SCALE = 5;
17
+ const UPDATE_INTERVAL_MS = 500;
18
+ const SLOW_INCREMENT = 0.5;
19
+
20
+ onMounted(() => {
21
+ show.value = true;
22
+ progressInterval = setInterval(() => {
23
+ if (progress.value < PROGRESS_THRESHOLD) {
24
+ progress.value += Math.random() * PROGRESS_INCREMENT_SCALE;
25
+ } else if (progress.value < MAX_PROGRESS) {
26
+ progress.value += SLOW_INCREMENT;
27
+ }
28
+ }, UPDATE_INTERVAL_MS);
29
+ });
30
+
31
+ onUnmounted(() => {
32
+ if (progressInterval) {
33
+ clearInterval(progressInterval);
34
+ }
35
+ });
62
36
  </script>
63
37
 
64
38
  <template>
65
- <v-row justify="center">
66
- <v-col cols="12" class="ma-3">
67
- <v-card loading>
68
- <v-card-title class="text-center"> Microservices are starting... </v-card-title>
69
- <v-card-subtitle class="text-center"> Why do you have to wait? </v-card-subtitle>
70
- <v-card-text class="text-center">
71
- We start our microservices only on demand... and this takes a few minutes before you can
72
- use our free app.
73
- <br />
74
- This is aligned with our energy sobriety policy. So be patient
75
- <v-icon color="primary" size="20"> mdi-emoticon-excited-outline </v-icon>
76
- <br />
77
- <Carousel :items="users_list" />
78
- </v-card-text>
79
- </v-card>
80
- </v-col>
81
- </v-row>
39
+ <div v-bind="$attrs">
40
+ <Teleport to="body">
41
+ <div
42
+ v-if="show"
43
+ class="d-flex align-center justify-center transition-swing"
44
+ style="
45
+ position: fixed;
46
+ inset: 0;
47
+ width: 100vw;
48
+ height: 100vh;
49
+ background: rgba(0, 0, 0, 0.45);
50
+ backdrop-filter: blur(10px);
51
+ z-index: 2400;
52
+ pointer-events: auto;
53
+ "
54
+ >
55
+ <div
56
+ style="
57
+ position: absolute;
58
+ inset: 0;
59
+ background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 0);
60
+ background-size: 40px 40px;
61
+ background-position: center;
62
+ pointer-events: none;
63
+ "
64
+ />
65
+
66
+ <div
67
+ class="d-flex flex-column align-center text-center"
68
+ style="max-width: 650px; width: 100%; padding: 0 24px; gap: 1.5rem"
69
+ >
70
+ <LoadingHeader :logo="logo" />
71
+ <LoadingEcoMessages />
72
+ <LoadingProgress :progress="progress" />
73
+ <LoadingFooter />
74
+ </div>
75
+ </div>
76
+ </Teleport>
77
+ </div>
82
78
  </template>
@@ -7,7 +7,6 @@ import { useGeodeStore } from "@ogw_front/stores/geode";
7
7
  const schema = schemas.opengeodeweb_back.allowed_objects;
8
8
 
9
9
  const emit = defineEmits(["update_values", "increment_step"]);
10
- console.log("ObjectSelector");
11
10
 
12
11
  const { filenames } = defineProps({
13
12
  filenames: { type: Array, required: true },
@@ -78,7 +77,6 @@ async function get_allowed_objects() {
78
77
  }
79
78
 
80
79
  function set_geode_object(geode_object_type) {
81
- console.log("set_geode_object", { geode_object_type });
82
80
  if (geode_object_type) {
83
81
  emit("update_values", { geode_object_type });
84
82
  emit("increment_step");
@@ -13,7 +13,12 @@ function goBackToFileTree() {
13
13
 
14
14
  const model_id = computed(() => treeviewStore.model_id);
15
15
 
16
- const metaDatas = dataStore.refItem(model_id.value);
16
+ const metaDatas = computed(() => {
17
+ if (!model_id.value) {
18
+ return {};
19
+ }
20
+ return dataStore.refItem(model_id.value).value || {};
21
+ });
17
22
  </script>
18
23
 
19
24
  <template>
@@ -1,24 +1,18 @@
1
1
  <script setup>
2
+ import { compareSelections } from "@ogw_front/utils/treeview";
2
3
  import { useDataStore } from "@ogw_front/stores/data";
3
4
  import { useDataStyleStore } from "@ogw_front/stores/data_style";
4
5
  import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
5
6
 
6
- import { compareSelections } from "@ogw_front/utils/treeview";
7
-
8
7
  const dataStyleStore = useDataStyleStore();
9
8
  const dataStore = useDataStore();
10
9
  const hybridViewerStore = useHybridViewerStore();
11
10
 
12
11
  const { id } = defineProps({ id: { type: String, required: true } });
13
-
14
12
  const emit = defineEmits(["show-menu"]);
15
13
 
16
- const items = ref([]);
17
- const mesh_components_selection = dataStyleStore.visibleMeshComponents(id);
18
-
19
- watchEffect(async () => {
20
- items.value = await dataStore.formatedMeshComponents(id);
21
- });
14
+ const items = dataStore.refFormatedMeshComponents(id);
15
+ const mesh_components_selection = computed(() => dataStyleStore.visibleMeshComponents(id));
22
16
 
23
17
  watch(
24
18
  mesh_components_selection,
@@ -28,6 +22,11 @@ watch(
28
22
  }
29
23
 
30
24
  const { added, removed } = compareSelections(current, previous);
25
+ console.log("TreeComponent selection change:", {
26
+ id: props.id,
27
+ added,
28
+ removed,
29
+ });
31
30
 
32
31
  if (added.length > 0) {
33
32
  await dataStyleStore.setModelMeshComponentsVisibility(id, added, true);
@@ -0,0 +1,47 @@
1
+ <script setup>
2
+ import ViewerContextMenu from "@ogw_front/components/Viewer/ContextMenu";
3
+ import ViewerTreeObjectTree from "@ogw_front/components/Viewer/Tree/ObjectTree";
4
+ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json";
5
+
6
+ const { id, displayMenu, menuStore, containerWidth, containerHeight, dataStyleStore, viewerStore } =
7
+ defineProps({
8
+ id: { type: String, required: true },
9
+ displayMenu: { type: Boolean, required: true },
10
+ menuStore: { type: Object, required: true },
11
+ containerWidth: { type: Number, required: true },
12
+ containerHeight: { type: Number, required: true },
13
+ dataStyleStore: { type: Object, required: true },
14
+ viewerStore: { type: Object, required: true },
15
+ });
16
+
17
+ const emit = defineEmits(["show-menu", "set-id"]);
18
+
19
+ async function get_viewer_id(x, y) {
20
+ const ids = Object.keys(dataStyleStore.styles);
21
+ await viewerStore.request(
22
+ viewer_schemas.opengeodeweb_viewer.viewer.picked_ids,
23
+ { x, y, ids },
24
+ {
25
+ response_function: (response) => {
26
+ const { array_ids } = response;
27
+ const [first_id] = array_ids;
28
+ emit("set-id", first_id);
29
+ },
30
+ },
31
+ );
32
+ }
33
+
34
+ defineExpose({ get_viewer_id });
35
+ </script>
36
+
37
+ <template>
38
+ <ViewerTreeObjectTree @show-menu="(args) => emit('show-menu', args)" />
39
+ <ViewerContextMenu
40
+ v-if="displayMenu"
41
+ :id="menuStore.current_id || id"
42
+ :x="menuStore.menuX"
43
+ :y="menuStore.menuY"
44
+ :container-width="containerWidth"
45
+ :container-height="containerHeight"
46
+ />
47
+ </template>
package/app/stores/app.js CHANGED
@@ -1,3 +1,4 @@
1
+ // Local imports
1
2
  import { api_fetch } from "@ogw_internal/utils/api_fetch.js";
2
3
  import { upload_file } from "@ogw_internal/utils/upload_file.js";
3
4
 
@@ -12,8 +12,12 @@ const viewer_generic_schemas = viewer_schemas.opengeodeweb_viewer.generic;
12
12
  export const useDataStore = defineStore("data", () => {
13
13
  const viewerStore = useViewerStore();
14
14
 
15
- function item(id) {
16
- return database.data.get(id);
15
+ async function item(id) {
16
+ const data_item = await database.data.get(id);
17
+ if (!data_item) {
18
+ throw new Error(`Item not found: ${id}`);
19
+ }
20
+ return data_item;
17
21
  }
18
22
 
19
23
  function refItem(id) {
@@ -62,6 +66,13 @@ export const useDataStore = defineStore("data", () => {
62
66
  }));
63
67
  }
64
68
 
69
+ function refFormatedMeshComponents(id) {
70
+ return useObservable(
71
+ liveQuery(() => formatedMeshComponents(id)),
72
+ { initialValue: [] },
73
+ );
74
+ }
75
+
65
76
  async function meshComponentType(modelId, geode_id) {
66
77
  const component = await database.model_components.where({ id: modelId, geode_id }).first();
67
78
  return component?.type;
@@ -176,7 +187,7 @@ export const useDataStore = defineStore("data", () => {
176
187
  .where("[id+geode_id]")
177
188
  .anyOf(meshComponentGeodeIds.map((geode_id) => [modelId, geode_id]))
178
189
  .toArray();
179
- return components.map((component) => component.viewer_id);
190
+ return components.map((component) => Number.parseInt(component.viewer_id, 10));
180
191
  }
181
192
 
182
193
  async function exportStores() {
@@ -198,6 +209,7 @@ export const useDataStore = defineStore("data", () => {
198
209
  refItem,
199
210
  meshComponentType,
200
211
  formatedMeshComponents,
212
+ refFormatedMeshComponents,
201
213
  registerObject,
202
214
  deregisterObject,
203
215
  addItem,
@@ -210,6 +222,7 @@ export const useDataStore = defineStore("data", () => {
210
222
  getSurfacesGeodeIds,
211
223
  getBlocksGeodeIds,
212
224
  getMeshComponentsViewerIds,
225
+
213
226
  exportStores,
214
227
  importStores,
215
228
  clear,
@@ -1,3 +1,4 @@
1
+ import { database } from "@ogw_internal/database/database.js";
1
2
  import { getDefaultStyle } from "@ogw_front/utils/default_styles";
2
3
  import { useDataStore } from "@ogw_front/stores/data";
3
4
  import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state";
@@ -10,16 +11,13 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
10
11
  const modelStyleStore = useModelStyle();
11
12
  const dataStore = useDataStore();
12
13
 
13
- function addDataStyle(id, geode_object) {
14
- dataStyleState.styles[id] = getDefaultStyle(geode_object);
14
+ async function addDataStyle(id, geode_object) {
15
+ await database.data_style.put(structuredClone({ id, ...getDefaultStyle(geode_object) }));
15
16
  }
16
17
 
17
18
  async function setVisibility(id, visibility) {
18
19
  const item = await dataStore.item(id);
19
- const viewer_type = item?.viewer_type;
20
- if (!viewer_type) {
21
- throw new Error(`Item not found or not loaded: ${id}`);
22
- }
20
+ const { viewer_type } = item;
23
21
 
24
22
  if (viewer_type === "mesh") {
25
23
  return meshStyleStore.setMeshVisibility(id, visibility);
@@ -32,10 +30,8 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
32
30
 
33
31
  async function applyDefaultStyle(id) {
34
32
  const item = await dataStore.item(id);
35
- const viewer_type = item?.viewer_type;
36
- if (!viewer_type) {
37
- throw new Error(`Item not found or not loaded: ${id}`);
38
- }
33
+ const { viewer_type } = item;
34
+
39
35
  if (viewer_type === "mesh") {
40
36
  return meshStyleStore.applyMeshStyle(id);
41
37
  }
@@ -46,29 +42,36 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
46
42
  }
47
43
 
48
44
  function exportStores() {
49
- return { styles: dataStyleState.styles };
45
+ return {
46
+ styles: dataStyleState.styles,
47
+ componentStyles: dataStyleState.componentStyles,
48
+ };
50
49
  }
51
50
 
52
- function importStores(snapshot) {
53
- const stylesSnapshot = snapshot.styles || {};
54
- for (const id of Object.keys(dataStyleState.styles)) {
55
- delete dataStyleState.styles[id];
56
- }
57
- for (const [id, style] of Object.entries(stylesSnapshot)) {
58
- dataStyleState.styles[id] = style;
59
- }
51
+ async function importStores(snapshot) {
52
+ const stylesSnapshot = snapshot.styles;
53
+ const componentStylesSnapshot = snapshot.componentStyles;
54
+
55
+ await dataStyleState.clear();
56
+
57
+ const style_promises = Object.entries(stylesSnapshot).map(([id, style]) =>
58
+ database.data_style.put(structuredClone({ id, ...style })),
59
+ );
60
+ const component_style_promises = Object.values(componentStylesSnapshot).map((style) =>
61
+ database.model_component_datastyle.put(structuredClone(style)),
62
+ );
63
+
64
+ await Promise.all([...style_promises, ...component_style_promises]);
60
65
  }
61
66
 
62
67
  function applyAllStylesFromState() {
63
- const ids = Object.keys(dataStyleState.styles || {});
68
+ const ids = Object.keys(dataStyleState.styles);
64
69
  const promises = ids.map(async (id) => {
65
70
  const meta = await dataStore.item(id);
66
- const viewerType = meta?.viewer_type;
67
- const style = dataStyleState.styles[id];
68
- if (style && viewerType === "mesh") {
71
+ const viewerType = meta.viewer_type;
72
+ if (viewerType === "mesh") {
69
73
  return meshStyleStore.applyMeshStyle(id);
70
- }
71
- if (style && viewerType === "model") {
74
+ } else if (viewerType === "model") {
72
75
  return modelStyleStore.applyModelStyle(id);
73
76
  }
74
77
  });
@@ -70,7 +70,6 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
70
70
  return;
71
71
  }
72
72
  const value = await dataStore.item(id);
73
- console.log("hybridViewerStore.addItem", { value });
74
73
  const reader = vtkXMLPolyDataReader();
75
74
  const textEncoder = new TextEncoder();
76
75
  await reader.parseAsArrayBuffer(textEncoder.encode(value.binary_light_viewable));
@@ -30,6 +30,7 @@ async function importWorkflow(files) {
30
30
  function buildImportItemFromPayloadApi(value, geode_object_type) {
31
31
  console.log("buildImportItemFromPayloadApi", { value, geode_object_type });
32
32
  return {
33
+ geode_object_type,
33
34
  ...value,
34
35
  };
35
36
  }
@@ -133,6 +133,10 @@ function projectMicroservices(projectFolderPath) {
133
133
  }
134
134
 
135
135
  async function cleanupBackend(projectFolderPath) {
136
+ if (!fs.existsSync(projectFolderPath)) {
137
+ console.log(`Folder ${projectFolderPath} does not exist. Skipping cleanup.`);
138
+ return;
139
+ }
136
140
  const microservices = projectMicroservices(projectFolderPath);
137
141
  await killMicroservices(microservices);
138
142
  await deleteFolderRecursive(projectFolderPath);
@@ -142,4 +146,4 @@ function microservicesMetadatasPath(projectFolderPath) {
142
146
  return path.join(projectFolderPath, "microservices.json");
143
147
  }
144
148
 
145
- export { cleanupBackend, microservicesMetadatasPath };
149
+ export { cleanupBackend, microservicesMetadatasPath, projectMicroservices };
@@ -11,7 +11,7 @@ import pTimeout from "p-timeout";
11
11
  // Local imports
12
12
  import { commandExistsSync, waitForReady } from "./scripts.js";
13
13
  import { executableName, executablePath } from "./path.js";
14
- import { microservicesMetadatasPath } from "./cleanup.js";
14
+ import { microservicesMetadatasPath, projectMicroservices } from "./cleanup.js";
15
15
 
16
16
  const DEFAULT_TIMEOUT_SECONDS = 30;
17
17
  const MILLISECONDS_PER_SECOND = 1000;
@@ -112,18 +112,6 @@ async function runViewer(execName, execPath, args = {}) {
112
112
  return port;
113
113
  }
114
114
 
115
- function projectMicroservices(projectFolderPath) {
116
- console.log("projectMicroservices", { projectFolderPath });
117
- const filePath = microservicesMetadatasPath(projectFolderPath);
118
-
119
- if (!fs.existsSync(filePath)) {
120
- const microservicesMetadatas = { microservices: [] };
121
- fs.writeFileSync(filePath, JSON.stringify(microservicesMetadatas, undefined, 2), "utf8");
122
- }
123
- const content = JSON.parse(fs.readFileSync(filePath, "utf8"));
124
- return content.microservices;
125
- }
126
-
127
115
  function addMicroserviceMetadatas(projectFolderPath, serviceObj) {
128
116
  const microservices = projectMicroservices(projectFolderPath);
129
117
  if (serviceObj.type === "back") {