@geode/opengeodeweb-front 10.4.0-rc.2 → 10.4.0

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.
@@ -34,27 +34,32 @@ export const useDataStore = defineStore("data", () => {
34
34
 
35
35
  async function formatedMeshComponents(id) {
36
36
  const items = await database.model_components.where({ id }).toArray()
37
- const distinctTypes = [...new Set(items.map((item) => item.type))]
38
-
39
- const formated_mesh_components = await Promise.all(
40
- distinctTypes.map(async (type) => {
41
- const meshComponents = await database.model_components
42
- .where({ id, type })
43
- .toArray()
44
-
45
- return {
46
- id: type,
47
- title: type,
48
- children: meshComponents.map((meshComponent) => ({
49
- id: meshComponent.geode_id,
50
- title: meshComponent.name,
51
- category: meshComponent.type,
52
- })),
53
- }
54
- }),
55
- )
37
+ const componentTitles = {
38
+ Corner: "Corners",
39
+ Line: "Lines",
40
+ Surface: "Surfaces",
41
+ Block: "Blocks",
42
+ }
56
43
 
57
- return formated_mesh_components
44
+ const componentsByType = items.reduce((accumulator, item) => {
45
+ if (componentTitles[item.type]) {
46
+ if (!accumulator[item.type]) accumulator[item.type] = []
47
+ accumulator[item.type].push(item)
48
+ }
49
+ return accumulator
50
+ }, {})
51
+
52
+ return Object.keys(componentTitles)
53
+ .filter((type) => componentsByType[type])
54
+ .map((type) => ({
55
+ id: type,
56
+ title: componentTitles[type],
57
+ children: componentsByType[type].map((meshComponent) => ({
58
+ id: meshComponent.geode_id,
59
+ title: meshComponent.name,
60
+ category: meshComponent.type,
61
+ })),
62
+ }))
58
63
  }
59
64
 
60
65
  async function meshComponentType(id, geode_id) {
@@ -109,15 +114,22 @@ export const useDataStore = defineStore("data", () => {
109
114
  await database.model_components.where({ id }).delete()
110
115
  }
111
116
 
112
- async function fetchMeshComponents(id) {
117
+ async function fetchModelComponents(id) {
113
118
  const geodeStore = useGeodeStore()
114
119
  return await geodeStore.request(
115
- back_model_schemas.mesh_components,
120
+ back_model_schemas.model_components,
116
121
  { id },
117
122
  {
118
123
  response_function: async (response) => {
119
- const { mesh_components } = response
120
- await addModelComponents(mesh_components)
124
+ const allComponents = [
125
+ ...response.mesh_components.map(
126
+ ({ boundaries, internals, ...component }) => component,
127
+ ),
128
+ ...response.collection_components.map(
129
+ ({ items, ...component }) => component,
130
+ ),
131
+ ].map((component) => ({ ...component, id }))
132
+ await addModelComponents(allComponents)
121
133
  },
122
134
  },
123
135
  )
@@ -178,7 +190,7 @@ export const useDataStore = defineStore("data", () => {
178
190
  addItem,
179
191
  deleteItem,
180
192
  updateItem,
181
- fetchMeshComponents,
193
+ fetchModelComponents,
182
194
  getCornersGeodeIds,
183
195
  getLinesGeodeIds,
184
196
  getSurfacesGeodeIds,
@@ -50,7 +50,7 @@ async function importItem(item) {
50
50
  await dataStyleStore.addDataStyle(item.id, item.geode_object_type)
51
51
 
52
52
  if (item.viewer_type === "model") {
53
- await dataStore.fetchMeshComponents(item.id)
53
+ await dataStore.fetchModelComponents(item.id)
54
54
  }
55
55
 
56
56
  await dataStyleStore.applyDefaultStyle(item.id)
@@ -1,4 +1,4 @@
1
1
  export const modelComponentsTable = {
2
2
  name: "model_components",
3
- schema: "[id+geode_id], [id+type], viewer_id, type, name, created_at",
3
+ schema: "[id+geode_id], [id+type], viewer_id, name",
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
- "version": "10.4.0-rc.2",
3
+ "version": "10.4.0",
4
4
  "description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
5
5
  "homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Front",
6
6
  "bugs": {
@@ -31,8 +31,8 @@
31
31
  "build": ""
32
32
  },
33
33
  "dependencies": {
34
- "@geode/opengeodeweb-back": "next",
35
- "@geode/opengeodeweb-viewer": "next",
34
+ "@geode/opengeodeweb-back": "latest",
35
+ "@geode/opengeodeweb-viewer": "latest",
36
36
  "@kitware/vtk.js": "33.3.0",
37
37
  "@mdi/font": "7.4.47",
38
38
  "@pinia/nuxt": "0.11.3",
@@ -5,4 +5,4 @@
5
5
  # pip-compile --output-file=tests/integration/microservices/back/requirements.txt tests/integration/microservices/back/requirements.in
6
6
  #
7
7
 
8
- opengeodeweb-back==6.*,>=6.1.4rc1
8
+ opengeodeweb-back==6.*,>=6.2.0rc2
@@ -5,4 +5,4 @@
5
5
  # pip-compile --output-file=tests/integration/microservices/viewer/requirements.txt tests/integration/microservices/viewer/requirements.in
6
6
  #
7
7
 
8
- opengeodeweb-viewer==1.*,>=1.15.3
8
+ opengeodeweb-viewer==1.*,>=1.15.4rc1