@geode/opengeodeweb-front 10.4.1 → 10.5.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/app/components/DeleteDialog.vue +1 -1
  2. package/app/components/DragAndDrop.vue +8 -5
  3. package/app/components/FileUploader.vue +3 -3
  4. package/app/components/GlassCard.vue +4 -4
  5. package/app/components/HybridRenderingView.vue +1 -5
  6. package/app/components/Inspector/InspectionButton.vue +6 -7
  7. package/app/components/Launcher.vue +1 -1
  8. package/app/components/ObjectSelector.vue +1 -1
  9. package/app/components/PackagesVersions.vue +1 -1
  10. package/app/components/RemoteRenderingView.vue +1 -1
  11. package/app/components/Screenshot.vue +2 -2
  12. package/app/components/SearchBar.vue +10 -16
  13. package/app/components/Step.vue +3 -1
  14. package/app/components/ViewToolbar.vue +0 -1
  15. package/app/components/Viewer/ContextMenu.vue +11 -11
  16. package/app/components/Viewer/ContextMenuItem.vue +1 -1
  17. package/app/components/Viewer/Options/AttributeColorBar.vue +1 -5
  18. package/app/components/Viewer/Options/ColorMapList.vue +2 -6
  19. package/app/components/Viewer/Options/ColorMapPicker.vue +3 -3
  20. package/app/components/Viewer/Options/ColoringTypeSelector.vue +1 -1
  21. package/app/components/Viewer/Options/TextureItem.vue +2 -2
  22. package/app/components/Viewer/Options/TexturesSelector.vue +4 -4
  23. package/app/components/Viewer/Tree/ObjectTree.vue +4 -8
  24. package/app/components/ZScaling.vue +4 -4
  25. package/app/composables/project_manager.js +0 -2
  26. package/app/composables/run_function_when_microservices_connected.js +0 -2
  27. package/app/stores/data.js +68 -24
  28. package/app/stores/data_style.js +11 -11
  29. package/app/stores/geode.js +2 -2
  30. package/app/stores/hybrid_viewer.js +15 -24
  31. package/app/stores/infra.js +6 -2
  32. package/app/stores/lambda.js +1 -1
  33. package/app/stores/menu.js +1 -2
  34. package/app/stores/viewer.js +6 -6
  35. package/app/utils/colormap.js +3 -1
  36. package/app/utils/local.js +29 -34
  37. package/app/utils/status.js +1 -1
  38. package/app/utils/upload_file.js +2 -2
  39. package/app/utils/validate_schema.js +2 -2
  40. package/internal/database/database.js +23 -4
  41. package/internal/database/extended_database.js +3 -0
  42. package/internal/database/tables/model_components_relation.js +4 -0
  43. package/internal/stores/data_style/mesh/cells/cell.js +1 -1
  44. package/internal/stores/data_style/mesh/cells/common.js +1 -1
  45. package/internal/stores/data_style/mesh/cells/vertex.js +1 -1
  46. package/internal/stores/data_style/mesh/edges/common.js +1 -1
  47. package/internal/stores/data_style/mesh/edges/edge.js +2 -2
  48. package/internal/stores/data_style/mesh/edges/vertex.js +1 -1
  49. package/internal/stores/data_style/mesh/index.js +2 -2
  50. package/internal/stores/data_style/mesh/points/common.js +1 -1
  51. package/internal/stores/data_style/mesh/points/vertex.js +1 -1
  52. package/internal/stores/data_style/mesh/polygons/common.js +1 -1
  53. package/internal/stores/data_style/mesh/polygons/polygon.js +1 -1
  54. package/internal/stores/data_style/mesh/polygons/vertex.js +1 -1
  55. package/internal/stores/data_style/mesh/polyhedra/common.js +1 -1
  56. package/internal/stores/data_style/mesh/polyhedra/polyhedron.js +1 -1
  57. package/internal/stores/data_style/mesh/polyhedra/vertex.js +1 -1
  58. package/internal/stores/data_style/model/blocks/color.js +1 -4
  59. package/internal/stores/data_style/model/blocks/common.js +1 -1
  60. package/internal/stores/data_style/model/blocks/index.js +5 -3
  61. package/internal/stores/data_style/model/blocks/visibility.js +1 -3
  62. package/internal/stores/data_style/model/corners/color.js +1 -4
  63. package/internal/stores/data_style/model/corners/common.js +1 -1
  64. package/internal/stores/data_style/model/corners/index.js +5 -3
  65. package/internal/stores/data_style/model/corners/visibility.js +1 -4
  66. package/internal/stores/data_style/model/edges/common.js +1 -1
  67. package/internal/stores/data_style/model/index.js +2 -2
  68. package/internal/stores/data_style/model/lines/color.js +1 -4
  69. package/internal/stores/data_style/model/lines/common.js +1 -1
  70. package/internal/stores/data_style/model/lines/index.js +5 -3
  71. package/internal/stores/data_style/model/lines/visibility.js +1 -4
  72. package/internal/stores/data_style/model/points/common.js +1 -1
  73. package/internal/stores/data_style/model/surfaces/color.js +1 -3
  74. package/internal/stores/data_style/model/surfaces/common.js +1 -1
  75. package/internal/stores/data_style/model/surfaces/index.js +5 -3
  76. package/internal/stores/data_style/model/surfaces/visibility.js +1 -2
  77. package/internal/utils/api_fetch.js +5 -7
  78. package/internal/utils/viewer_call.js +5 -7
  79. package/nuxt.config.js +8 -1
  80. package/package.json +3 -3
  81. package/scripts/generate_geode_objects.js +1 -1
  82. package/tests/integration/microservices/back/requirements.txt +1 -1
  83. package/tests/integration/microservices/viewer/requirements.txt +1 -1
  84. package/tests/integration/setup.js +5 -5
  85. package/tests/integration/stores/data_style/mesh/cells.nuxt.test.js +2 -2
  86. package/tests/integration/stores/data_style/mesh/edges.nuxt.test.js +2 -2
  87. package/tests/integration/stores/data_style/mesh/index.nuxt.test.js +2 -2
  88. package/tests/integration/stores/data_style/mesh/points.nuxt.test.js +2 -2
  89. package/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js +2 -2
  90. package/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js +2 -2
  91. package/tests/integration/stores/data_style/model/blocks.nuxt.test.js +2 -2
  92. package/tests/integration/stores/data_style/model/corners.nuxt.test.js +2 -2
  93. package/tests/integration/stores/data_style/model/edges.nuxt.test.js +2 -2
  94. package/tests/integration/stores/data_style/model/index.nuxt.test.js +2 -2
  95. package/tests/integration/stores/data_style/model/lines.nuxt.test.js +2 -2
  96. package/tests/integration/stores/data_style/model/points.nuxt.test.js +2 -2
  97. package/tests/integration/stores/data_style/model/surfaces.nuxt.test.js +25 -25
  98. package/tests/integration/stores/viewer.nuxt.test.js +3 -3
  99. package/tests/setup_indexeddb.js +1 -1
  100. package/tests/unit/components/CrsSelector.nuxt.test.js +4 -4
  101. package/tests/unit/components/ExtensionSelector.nuxt.test.js +4 -7
  102. package/tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js +1 -1
  103. package/tests/unit/components/FeedBack/Snackers.nuxt.test.js +1 -1
  104. package/tests/unit/components/FileSelector.nuxt.test.js +1 -1
  105. package/tests/unit/components/FileUploader.nuxt.test.js +1 -1
  106. package/tests/unit/components/Inspector/InspectionButton.nuxt.test.js +1 -1
  107. package/tests/unit/components/Inspector/ResultPanel.nuxt.test.js +1 -1
  108. package/tests/unit/components/Launcher.nuxt.test.js +1 -1
  109. package/tests/unit/components/MissingFilesSelector.nuxt.test.js +1 -1
  110. package/tests/unit/components/ObjectSelector.nuxt.test.js +1 -1
  111. package/tests/unit/components/PackagesVersions.nuxt.test.js +1 -1
  112. package/tests/unit/components/Step.nuxt.test.js +1 -1
  113. package/tests/unit/components/Stepper.nuxt.test.js +1 -1
  114. package/tests/unit/composables/api_fetch.nuxt.test.js +3 -3
  115. package/tests/unit/composables/{ProjectManager.nuxt.test.js → project_manager.nuxt.test.js} +12 -13
  116. package/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js +6 -6
  117. package/tests/unit/composables/upload_file.nuxt.test.js +2 -2
  118. package/tests/unit/plugins/project_load.nuxt.test.js +4 -4
  119. package/tests/unit/stores/{App.nuxt.test.js → app.nuxt.test.js} +1 -3
  120. package/tests/unit/stores/{Feedback.nuxt.test.js → feedback.nuxt.test.js} +8 -5
  121. package/tests/unit/stores/{Geode.nuxt.test.js → geode.nuxt.test.js} +3 -3
  122. package/tests/unit/stores/{Infra.nuxt.test.js → infra.nuxt.test.js} +2 -2
  123. package/tests/unit/stores/{Lambda.nuxt.test.js → lambda.nuxt.test.js} +2 -2
  124. package/tests/unit/stores/{Treeview.nuxt.test.js → treeview.nuxt.test.js} +2 -2
  125. package/tests/unit/stores/{Viewer.nuxt.test.js → viewer.nuxt.test.js} +1 -1
  126. package/tests/unit/utils/recaptcha.nuxt.test.js +11 -7
  127. package/tests/unit/utils/validate_schema.nuxt.test.js +1 -1
  128. package/tests/utils.js +1 -0
  129. package/tests/vitest.config.js +12 -4
  130. package/vuetify_config.js +1 -1
@@ -8,7 +8,7 @@
8
8
  },
9
9
  item: {
10
10
  type: Object,
11
- default: null,
11
+ default: undefined,
12
12
  },
13
13
  selectedCount: {
14
14
  type: Number,
@@ -1,14 +1,11 @@
1
1
  <script setup>
2
2
  import GlassCard from "@ogw_front/components/GlassCard"
3
3
 
4
- const props = defineProps({
4
+ const { multiple, accept, loading, showExtensions } = defineProps({
5
5
  multiple: { type: Boolean, default: false },
6
6
  accept: { type: String, default: "" },
7
7
  loading: { type: Boolean, default: false },
8
8
  showExtensions: { type: Boolean, default: true },
9
- idleText: { type: String, default: "Click or Drag & Drop files" },
10
- dropText: { type: String, default: "Drop to upload" },
11
- loadingText: { type: String, default: "Uploading..." },
12
9
  })
13
10
 
14
11
  const emit = defineEmits(["files-selected"])
@@ -83,7 +80,13 @@
83
80
  class="text-h6 font-weight-bold justify-center pa-0 mb-1 text-white"
84
81
  style="transition: color 0.3s ease"
85
82
  >
86
- {{ loading ? loadingText : isDragging ? dropText : idleText }}
83
+ {{
84
+ loading
85
+ ? "Uploading..."
86
+ : isDragging
87
+ ? "Drop to upload"
88
+ : "Click or Drag & Drop files"
89
+ }}
87
90
  </v-card-title>
88
91
 
89
92
  <v-card-subtitle v-if="showExtensions" class="text-body-2 pa-0">
@@ -21,11 +21,11 @@
21
21
 
22
22
  const toggle_loading = useToggle(loading)
23
23
 
24
- function processSelectedFiles(files) {
24
+ function processSelectedFiles(selected_files) {
25
25
  if (multiple) {
26
- internal_files.value = [...internal_files.value, ...files]
26
+ internal_files.value = [...internal_files.value, ...selected_files]
27
27
  } else {
28
- internal_files.value = [files[0]]
28
+ internal_files.value = [selected_files[0]]
29
29
  }
30
30
  }
31
31
 
@@ -1,18 +1,18 @@
1
1
  <script setup>
2
2
  import { computed, useAttrs } from "vue"
3
- defineProps({
3
+ const { variant, rounded, padding, theme } = defineProps({
4
4
  variant: {
5
5
  type: String,
6
6
  default: "panel",
7
- validator: (v) => ["panel", "ui"].includes(v),
7
+ validator: (valid) => ["panel", "ui"].includes(valid),
8
8
  },
9
9
  rounded: { type: String, default: "xl" },
10
10
  padding: { type: String, default: "pa-6" },
11
- theme: { type: String, default: null },
11
+ theme: { type: String, default: undefined },
12
12
  })
13
13
 
14
14
  const attrs = useAttrs()
15
- const isInteractive = computed(() => !!attrs.onClick)
15
+ const isInteractive = computed(() => Boolean(attrs.onClick))
16
16
  </script>
17
17
 
18
18
  <template>
@@ -43,10 +43,6 @@
43
43
  timeout = setTimeout(later, wait)
44
44
  }
45
45
  }
46
-
47
- function get_x_y(event) {
48
- emit("click", event)
49
- }
50
46
  </script>
51
47
 
52
48
  <template>
@@ -58,7 +54,7 @@
58
54
  class="pa-0"
59
55
  ref="viewer"
60
56
  style="height: 100%; overflow: hidden; position: relative; z-index: 0"
61
- @click="get_x_y"
57
+ @click="emit('click', $event)"
62
58
  @keydown.esc="viewerStore.toggle_picking_mode(false)"
63
59
  />
64
60
  </div>
@@ -15,9 +15,12 @@
15
15
  const loading = ref(false)
16
16
  const toggle_loading = useToggle(loading)
17
17
 
18
- async function get_inspection_results(geode_object_type, filename) {
18
+ async function get_inspection_results() {
19
19
  toggle_loading()
20
- const params = { geode_object_type, filename }
20
+ const params = {
21
+ geode_object_type: geode_object_type,
22
+ filename: filename,
23
+ }
21
24
  const geodeStore = useGeodeStore()
22
25
 
23
26
  await geodeStore.request(schema, params, {
@@ -34,11 +37,7 @@
34
37
 
35
38
  <template>
36
39
  <div class="pa-0">
37
- <v-btn
38
- :loading="loading"
39
- color="primary"
40
- @click="get_inspection_results(geode_object_type, filename)"
41
- >
40
+ <v-btn :loading="loading" color="primary" @click="get_inspection_results()">
42
41
  Inspect
43
42
  <template #loader>
44
43
  <v-progress-circular indeterminate size="20" color="white" width="3" />
@@ -1,7 +1,7 @@
1
1
  <script setup>
2
2
  import Loading from "@ogw_front/components/Loading"
3
3
  import Recaptcha from "@ogw_front/components/Recaptcha"
4
- import Status from "@ogw_front/utils/status"
4
+ import { Status } from "@ogw_front/utils/status"
5
5
  import { useInfraStore } from "@ogw_front/stores/infra"
6
6
 
7
7
  const infraStore = useInfraStore()
@@ -80,7 +80,7 @@
80
80
  .map((obj) => obj[key].object_priority)
81
81
  .filter((priority) => priority !== undefined && priority !== null)
82
82
  final_object[key] = { is_loadable: Math.min(...load_scores) }
83
- if (priorities.length) {
83
+ if (priorities.length > 0) {
84
84
  final_object[key].object_priority = Math.max(...priorities)
85
85
  }
86
86
  }
@@ -1,5 +1,5 @@
1
1
  <script setup>
2
- import Status from "@ogw_front/utils/status"
2
+ import { Status } from "@ogw_front/utils/status"
3
3
  import { useGeodeStore } from "@ogw_front/stores/geode"
4
4
 
5
5
  const { schema } = defineProps({
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
2
  import { useElementSize, useWindowSize } from "@vueuse/core"
3
- import Status from "@ogw_front/utils/status"
3
+ import { Status } from "@ogw_front/utils/status"
4
4
  import ViewToolbar from "@ogw_front/components/ViewToolbar"
5
5
  import { useViewerStore } from "@ogw_front/stores/viewer"
6
6
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
@@ -1,6 +1,6 @@
1
1
  <script setup>
2
- import fileDownload from "js-file-download"
3
2
  import GlassCard from "@ogw_front/components/GlassCard"
3
+ import fileDownload from "js-file-download"
4
4
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
5
5
 
6
6
  import { useViewerStore } from "@ogw_front/stores/viewer"
@@ -29,7 +29,7 @@
29
29
  include_background: include_background.value,
30
30
  },
31
31
  {
32
- response_function: async (response) => {
32
+ response_function: (response) => {
33
33
  fileDownload(
34
34
  response.blob,
35
35
  `${filename.value}.${output_extension.value}`,
@@ -1,7 +1,16 @@
1
+ <script setup>
2
+ const { modelValue, label } = defineProps({
3
+ modelValue: { type: String, default: "" },
4
+ label: { type: String, default: "Search..." },
5
+ })
6
+
7
+ const emit = defineEmits(["update:modelValue"])
8
+ </script>
9
+
1
10
  <template>
2
11
  <v-text-field
3
12
  :model-value="modelValue"
4
- @update:model-value="$emit('update:modelValue', $event)"
13
+ @update:model-value="emit('update:modelValue', $event)"
5
14
  prepend-inner-icon="mdi-magnify"
6
15
  :label="label"
7
16
  variant="outlined"
@@ -17,18 +26,3 @@
17
26
  </template>
18
27
  </v-text-field>
19
28
  </template>
20
-
21
- <script setup>
22
- defineProps({
23
- modelValue: {
24
- type: String,
25
- default: "",
26
- },
27
- label: {
28
- type: String,
29
- default: "Search...",
30
- },
31
- })
32
-
33
- defineEmits(["update:modelValue"])
34
- </script>
@@ -10,6 +10,8 @@
10
10
  step_index: { type: Number, required: true },
11
11
  })
12
12
 
13
+ const emit = defineEmits(["reset_values"])
14
+
13
15
  const stepper_tree = inject("stepper_tree")
14
16
  const { current_step_index, steps } = toRefs(stepper_tree)
15
17
 
@@ -98,7 +100,7 @@
98
100
  @increment_step="increment_step"
99
101
  @decrement_step="decrement_step"
100
102
  @update_values="update_values_event"
101
- @reset_values="$emit('reset_values')"
103
+ @reset_values="emit('reset_values')"
102
104
  />
103
105
  </v-card-text>
104
106
  </v-stepper-vertical-item>
@@ -27,7 +27,6 @@
27
27
  tooltip: "Toggle grid scale",
28
28
  icon: "mdi-ruler-square",
29
29
  action: () => {
30
- const viewerStore = useViewerStore()
31
30
  viewerStore.request(
32
31
  schemas.opengeodeweb_viewer.viewer.grid_scale,
33
32
  { visibility: !grid_scale.value },
@@ -36,10 +36,10 @@
36
36
  watch(
37
37
  () => [x, y],
38
38
  ([newX, newY]) => {
39
- const { x, y } = clampPosition(newX, newY)
40
- menuX.value = x
41
- menuY.value = y
42
- menuStore.setMenuPosition(x, y)
39
+ const { x: clampedX, y: clampedY } = clampPosition(newX, newY)
40
+ menuX.value = clampedX
41
+ menuY.value = clampedY
42
+ menuStore.setMenuPosition(clampedX, clampedY)
43
43
  },
44
44
  { immediate: true },
45
45
  )
@@ -81,22 +81,22 @@
81
81
  event.preventDefault()
82
82
  }
83
83
 
84
- function clampPosition(x, y) {
84
+ function clampPosition(posX, posY) {
85
85
  const margin = RADIUS + MARGIN_OFFSET
86
86
  return {
87
- x: Math.min(Math.max(x, margin), containerWidth - margin),
88
- y: Math.min(Math.max(y, margin), containerHeight - margin),
87
+ x: Math.min(Math.max(posX, margin), containerWidth - margin),
88
+ y: Math.min(Math.max(posY, margin), containerHeight - margin),
89
89
  }
90
90
  }
91
91
 
92
92
  function handleDrag(event) {
93
- const { x, y } = clampPosition(
93
+ const { x: clampedX, y: clampedY } = clampPosition(
94
94
  event.clientX - dragStartX.value,
95
95
  event.clientY - dragStartY.value,
96
96
  )
97
- menuX.value = x
98
- menuY.value = y
99
- menuStore.setMenuPosition(x, y)
97
+ menuX.value = clampedX
98
+ menuY.value = clampedY
99
+ menuStore.setMenuPosition(clampedX, clampedY)
100
100
  }
101
101
 
102
102
  function stopDrag(event) {
@@ -1,7 +1,7 @@
1
1
  <script setup>
2
2
  import GlassCard from "@ogw_front/components/GlassCard"
3
- import { useTheme } from "vuetify"
4
3
  import { useMenuStore } from "@ogw_front/stores/menu"
4
+ import { useTheme } from "vuetify"
5
5
 
6
6
  const CARD_WIDTH = 320
7
7
  const CARD_HEIGHT = 500
@@ -6,10 +6,6 @@
6
6
  const minimum = defineModel("minimum", { type: Number })
7
7
  const maximum = defineModel("maximum", { type: Number })
8
8
  const colorMap = defineModel("colorMap", { type: String })
9
-
10
- function reset() {
11
- emit("reset")
12
- }
13
9
  </script>
14
10
 
15
11
  <template>
@@ -33,7 +29,7 @@
33
29
  icon="mdi-arrow-left-right"
34
30
  size="x-small"
35
31
  variant="text"
36
- @click="reset"
32
+ @click="emit('reset')"
37
33
  v-tooltip="'Reset range'"
38
34
  />
39
35
  </v-col>
@@ -55,12 +55,10 @@
55
55
  if (!preset || !preset.RGBPoints) {
56
56
  return
57
57
  }
58
-
59
58
  const ctx = canvas.getContext("2d")
60
59
  const { height, width } = canvas
61
60
  const lut = vtkColorTransferFunction()
62
61
  const rgbPoints = preset.RGBPoints
63
-
64
62
  for (let pointIdx = 0; pointIdx < rgbPoints.length; pointIdx += 4) {
65
63
  lut.addRGBPoint(
66
64
  rgbPoints[pointIdx],
@@ -69,7 +67,6 @@
69
67
  rgbPoints[pointIdx + THREE],
70
68
  )
71
69
  }
72
-
73
70
  const table = lut.getUint8Table(
74
71
  rgbPoints[0],
75
72
  rgbPoints.at(-LAST_POINT_OFFSET),
@@ -77,7 +74,6 @@
77
74
  true,
78
75
  )
79
76
  const imageData = ctx.createImageData(width, height)
80
-
81
77
  for (let xCoord = 0; xCoord < width; xCoord += 1) {
82
78
  const alpha = table[xCoord * 4 + THREE],
83
79
  blue = table[xCoord * 4 + 2],
@@ -180,7 +176,7 @@
180
176
  <v-list-item
181
177
  v-for="(child, cIdx) in item.Children"
182
178
  :key="cIdx"
183
- @click="$emit('select', child)"
179
+ @click="emit('select', child)"
184
180
  class="px-2 mb-1"
185
181
  rounded="md"
186
182
  >
@@ -202,7 +198,7 @@
202
198
 
203
199
  <v-list-item
204
200
  v-else
205
- @click="$emit('select', item)"
201
+ @click="emit('select', item)"
206
202
  class="px-2 mb-1"
207
203
  rounded="md"
208
204
  >
@@ -120,9 +120,9 @@
120
120
  watch([lutCanvas, selectedPresetName, () => min, () => max], drawLutCanvas)
121
121
  watch(
122
122
  () => modelValue,
123
- (nv) => {
124
- if (nv !== selectedPresetName.value) {
125
- selectedPresetName.value = nv
123
+ (newValue) => {
124
+ if (newValue !== selectedPresetName.value) {
125
+ selectedPresetName.value = newValue
126
126
  }
127
127
  },
128
128
  )
@@ -58,7 +58,7 @@
58
58
  value: "polyhedron",
59
59
  }
60
60
  const coloring_styles = computed(() => {
61
- let array = []
61
+ const array = []
62
62
  if (has_color.value) {
63
63
  array.push(color_dict)
64
64
  }
@@ -37,7 +37,7 @@
37
37
  }
38
38
 
39
39
  async function files_uploaded_event(value) {
40
- if (value.length) {
40
+ if (value.length > 0) {
41
41
  await geodeStore.request(
42
42
  back_schemas.opengeodeweb_back.save_viewable_file,
43
43
  {
@@ -48,7 +48,7 @@
48
48
  },
49
49
  },
50
50
  {
51
- response_function: async (response) => {
51
+ response_function: (response) => {
52
52
  texture_id.value = response.id
53
53
  },
54
54
  },
@@ -10,10 +10,10 @@
10
10
  const internal_textures = ref([])
11
11
 
12
12
  onMounted(() => {
13
- if (textures.value !== null) {
14
- internal_textures.value = textures.value
15
- } else {
13
+ if (textures.value === null) {
16
14
  internal_textures.value = [{ id: "", texture_name: "" }]
15
+ } else {
16
+ internal_textures.value = textures.value
17
17
  }
18
18
  })
19
19
 
@@ -22,7 +22,7 @@
22
22
  const filtered = internal_textures.value.filter(
23
23
  (texture) => texture.texture_name !== "" && texture.id !== "",
24
24
  )
25
- if (filtered.length !== 0) {
25
+ if (filtered.length > 0) {
26
26
  textures.value = filtered
27
27
  }
28
28
  }
@@ -9,15 +9,11 @@
9
9
  const treeviewStore = useTreeviewStore()
10
10
  const emit = defineEmits(["show-menu"])
11
11
 
12
- function handleTreeMenu({ event, itemId }) {
13
- emit("show-menu", { event, itemId })
14
- }
15
-
16
12
  function onResizeStart(event) {
17
13
  const startWidth = treeviewStore.panelWidth
18
14
  const startX = event.clientX
19
- function resize(event) {
20
- const deltaX = event.clientX - startX
15
+ function resize(move_event) {
16
+ const deltaX = move_event.clientX - startX
21
17
  const newWidth = Math.max(
22
18
  WIDTH_MIN,
23
19
  Math.min(startWidth + deltaX, window.innerWidth),
@@ -60,11 +56,11 @@
60
56
  <v-col>
61
57
  <ViewerTreeObject
62
58
  v-if="!treeviewStore.isAdditionnalTreeDisplayed"
63
- @show-menu="handleTreeMenu"
59
+ @show-menu="emit('show-menu', $event)"
64
60
  />
65
61
  <ViewerTreeComponent
66
62
  v-else
67
- @show-menu="handleTreeMenu"
63
+ @show-menu="emit('show-menu', $event)"
68
64
  :id="treeviewStore.model_id"
69
65
  />
70
66
  </v-col>
@@ -5,6 +5,8 @@
5
5
  const { width } = defineProps({
6
6
  width: { type: Number, default: 400 },
7
7
  })
8
+
9
+ const emit = defineEmits(["close"])
8
10
  </script>
9
11
  <template>
10
12
  <GlassCard
@@ -50,10 +52,8 @@
50
52
 
51
53
  <template #actions>
52
54
  <v-card-actions class="justify-center pb-4">
53
- <v-btn variant="text" color="white" @click="$emit('close')"
54
- >Close</v-btn
55
- >
56
- <v-btn variant="outlined" color="white" @click="$emit('close')"
55
+ <v-btn variant="text" color="white" @click="emit('close')">Close</v-btn>
56
+ <v-btn variant="outlined" color="white" @click="emit('close')"
57
57
  >Apply</v-btn
58
58
  >
59
59
  </v-card-actions>
@@ -108,5 +108,3 @@ export function useProjectManager() {
108
108
 
109
109
  return { exportProject, importProjectFile }
110
110
  }
111
-
112
- export default useProjectManager
@@ -14,5 +14,3 @@ export function run_function_when_microservices_connected(function_to_run) {
14
14
  })
15
15
  }
16
16
  }
17
-
18
- export default run_function_when_microservices_connected
@@ -1,6 +1,6 @@
1
1
  // Third party imports
2
2
  import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
3
- import { database } from "../../internal/database/database.js"
3
+ import { database } from "@ogw_internal/database/database.js"
4
4
  import { liveQuery } from "dexie"
5
5
  import { useObservable } from "@vueuse/rxjs"
6
6
  import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
@@ -42,13 +42,15 @@ export const useDataStore = defineStore("data", () => {
42
42
  Block: "Blocks",
43
43
  }
44
44
 
45
- const componentsByType = items.reduce((accumulator, item) => {
46
- if (componentTitles[item.type]) {
47
- if (!accumulator[item.type]) accumulator[item.type] = []
48
- accumulator[item.type].push(item)
45
+ const componentsByType = {}
46
+ for (const component_item of items) {
47
+ if (componentTitles[component_item.type]) {
48
+ if (!componentsByType[component_item.type]) {
49
+ componentsByType[component_item.type] = []
50
+ }
51
+ componentsByType[component_item.type].push(component_item)
49
52
  }
50
- return accumulator
51
- }, {})
53
+ }
52
54
 
53
55
  return Object.keys(componentTitles)
54
56
  .filter((type) => componentsByType[type])
@@ -99,20 +101,70 @@ export const useDataStore = defineStore("data", () => {
99
101
  await database.data.update(id, changes)
100
102
  }
101
103
 
102
- async function addModelComponents(values) {
104
+ async function addModelComponents(id, values) {
103
105
  if (!values || values.length === 0) {
104
- console.debug("[addModelComponents] No mesh components to add")
106
+ console.debug("[addModelComponents] No components to add")
105
107
  return
106
108
  }
107
- for (const value of values) {
108
- value.created_at = new Date().toISOString()
109
+
110
+ const { mesh_components, collection_components } = values
111
+ const allComponents = [
112
+ ...(mesh_components || []),
113
+ ...(collection_components || []),
114
+ ]
115
+
116
+ const relations = []
117
+ for (const component of allComponents) {
118
+ component.id = id
119
+ component.created_at = new Date().toISOString()
120
+
121
+ if (component.boundaries) {
122
+ for (const boundary_id of component.boundaries) {
123
+ relations.push({
124
+ id,
125
+ parent: component.geode_id,
126
+ child: boundary_id,
127
+ type: "boundary",
128
+ })
129
+ }
130
+ delete component.boundaries
131
+ }
132
+ if (component.internals) {
133
+ for (const internal_id of component.internals) {
134
+ relations.push({
135
+ id,
136
+ parent: component.geode_id,
137
+ child: internal_id,
138
+ type: "internal",
139
+ })
140
+ }
141
+ delete component.internals
142
+ }
143
+ if (component.items) {
144
+ for (const item_id of component.items) {
145
+ relations.push({
146
+ id,
147
+ parent: component.geode_id,
148
+ child: item_id,
149
+ type: "collection",
150
+ })
151
+ }
152
+ delete component.items
153
+ }
154
+ }
155
+
156
+ const serializedComponents = structuredClone(allComponents)
157
+ const serializedRelations = structuredClone(relations)
158
+
159
+ await database.model_components.bulkAdd(serializedComponents)
160
+ if (serializedRelations.length > 0) {
161
+ await database.model_components_relation.bulkAdd(serializedRelations)
109
162
  }
110
- const serializedData = structuredClone(values)
111
- await database.model_components.bulkAdd(serializedData)
112
163
  }
113
164
 
114
165
  async function deleteModelComponents(id) {
115
166
  await database.model_components.where({ id }).delete()
167
+ await database.model_components_relation.where({ id }).delete()
116
168
  }
117
169
 
118
170
  async function fetchModelComponents(id) {
@@ -122,23 +174,15 @@ export const useDataStore = defineStore("data", () => {
122
174
  { id },
123
175
  {
124
176
  response_function: async (response) => {
125
- const allComponents = [
126
- ...response.mesh_components.map(
127
- ({ boundaries, internals, ...component }) => component,
128
- ),
129
- ...response.collection_components.map(
130
- ({ items, ...component }) => component,
131
- ),
132
- ].map((component) => ({ ...component, id }))
133
- await addModelComponents(allComponents)
177
+ await addModelComponents(id, response)
134
178
  },
135
179
  },
136
180
  )
137
181
  }
138
182
 
139
- async function getMeshComponentGeodeIds(id, meshComponentType) {
183
+ async function getMeshComponentGeodeIds(id, component_type) {
140
184
  const components = await database.model_components
141
- .where({ id, type: meshComponentType })
185
+ .where({ id, type: component_type })
142
186
  .toArray()
143
187
  return components.map((component) => component.geode_id)
144
188
  }