From 1c3d96d2b769029f87124104e11a4806f9013614 Mon Sep 17 00:00:00 2001 From: MaxNumerique Date: Tue, 24 Feb 2026 16:41:14 +0100 Subject: [PATCH 1/4] fix(CollectionComponents): Rename fetchMeshComponents to fetchModelComponents and update related references --- app/stores/data.js | 13 ++++++++----- app/utils/file_import_workflow.js | 2 +- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/stores/data.js b/app/stores/data.js index 7b46e1f2..a8159fae 100644 --- a/app/stores/data.js +++ b/app/stores/data.js @@ -120,15 +120,18 @@ export const useDataStore = defineStore("data", () => { await database.model_components.where({ id }).delete() } - async function fetchMeshComponents(id) { + async function fetchModelComponents(id) { const geodeStore = useGeodeStore() return await geodeStore.request( - back_model_schemas.mesh_components, + back_model_schemas.model_components, { id }, { response_function: async (response) => { - const { mesh_components } = response - await addModelComponents(mesh_components) + const { mesh_components, collection_components } = response + await addModelComponents([ + ...mesh_components, + ...collection_components, + ]) }, }, ) @@ -189,7 +192,7 @@ export const useDataStore = defineStore("data", () => { addItem, deleteItem, updateItem, - fetchMeshComponents, + fetchModelComponents, getCornersGeodeIds, getLinesGeodeIds, getSurfacesGeodeIds, diff --git a/app/utils/file_import_workflow.js b/app/utils/file_import_workflow.js index c1e52dc9..c7cc40c8 100644 --- a/app/utils/file_import_workflow.js +++ b/app/utils/file_import_workflow.js @@ -50,7 +50,7 @@ async function importItem(item) { await dataStyleStore.addDataStyle(item.id, item.geode_object_type) if (item.viewer_type === "model") { - await dataStore.fetchMeshComponents(item.id) + await dataStore.fetchModelComponents(item.id) } await dataStyleStore.applyDefaultStyle(item.id) From 8024e4c4393f55361d19fef0dcad6eae061e7731 Mon Sep 17 00:00:00 2001 From: MaxNumerique <144453705+MaxNumerique@users.noreply.github.com> Date: Tue, 24 Feb 2026 15:46:59 +0000 Subject: [PATCH 2/4] Apply prepare changes --- tests/integration/microservices/back/requirements.txt | 1 - tests/integration/microservices/viewer/requirements.txt | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/integration/microservices/back/requirements.txt b/tests/integration/microservices/back/requirements.txt index c4caed69..bd3a3ef5 100644 --- a/tests/integration/microservices/back/requirements.txt +++ b/tests/integration/microservices/back/requirements.txt @@ -5,4 +5,3 @@ # pip-compile --output-file=tests/integration/microservices/back/requirements.txt tests/integration/microservices/back/requirements.in # -opengeodeweb-back==6.*,>=6.1.3 diff --git a/tests/integration/microservices/viewer/requirements.txt b/tests/integration/microservices/viewer/requirements.txt index 5922c2c7..4d097394 100644 --- a/tests/integration/microservices/viewer/requirements.txt +++ b/tests/integration/microservices/viewer/requirements.txt @@ -5,4 +5,3 @@ # pip-compile --output-file=tests/integration/microservices/viewer/requirements.txt tests/integration/microservices/viewer/requirements.in # -opengeodeweb-viewer==1.*,>=1.15.3 From 78d04815e06e02d28d36cc3a00418b0c92a3f922 Mon Sep 17 00:00:00 2001 From: MaxNumerique Date: Wed, 25 Feb 2026 09:24:42 +0100 Subject: [PATCH 3/4] specifying distinctTypes Lines, Surfaces, Blocks, Corners --- app/stores/data.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/stores/data.js b/app/stores/data.js index 663ede64..c093777d 100644 --- a/app/stores/data.js +++ b/app/stores/data.js @@ -34,7 +34,16 @@ export const useDataStore = defineStore("data", () => { async function formatedMeshComponents(id) { const items = await database.model_components.where({ id }).toArray() - const distinctTypes = [...new Set(items.map((item) => item.type))] + const componentTitles = { + Corner: "Corners", + Line: "Lines", + Surface: "Surfaces", + Block: "Blocks", + } + + const distinctTypes = Object.keys(componentTitles).filter((type) => + items.some((item) => item.type === type), + ) const formated_mesh_components = await Promise.all( distinctTypes.map(async (type) => { @@ -44,7 +53,7 @@ export const useDataStore = defineStore("data", () => { return { id: type, - title: type, + title: componentTitles[type], children: meshComponents.map((meshComponent) => ({ id: meshComponent.geode_id, title: meshComponent.name, @@ -117,10 +126,11 @@ export const useDataStore = defineStore("data", () => { { response_function: async (response) => { const { mesh_components, collection_components } = response - await addModelComponents([ + const allComponents = [ ...mesh_components, ...collection_components, - ]) + ].map((component) => ({ ...component, id })) + await addModelComponents(allComponents) }, }, ) From 18ce0051907656b0c61ad4e6123efca62e529a11 Mon Sep 17 00:00:00 2001 From: MaxNumerique Date: Wed, 25 Feb 2026 11:05:18 +0100 Subject: [PATCH 4/4] rm type, created_At columns --- app/stores/data.js | 42 +++++++++----------- internal/database/tables/model_components.js | 2 +- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/app/stores/data.js b/app/stores/data.js index c093777d..c0970b41 100644 --- a/app/stores/data.js +++ b/app/stores/data.js @@ -41,29 +41,25 @@ export const useDataStore = defineStore("data", () => { Block: "Blocks", } - const distinctTypes = Object.keys(componentTitles).filter((type) => - items.some((item) => item.type === type), - ) - - const formated_mesh_components = await Promise.all( - distinctTypes.map(async (type) => { - const meshComponents = await database.model_components - .where({ id, type }) - .toArray() - - return { - id: type, - title: componentTitles[type], - children: meshComponents.map((meshComponent) => ({ - id: meshComponent.geode_id, - title: meshComponent.name, - category: meshComponent.type, - })), - } - }), - ) - - return formated_mesh_components + const componentsByType = items.reduce((acc, item) => { + if (componentTitles[item.type]) { + if (!acc[item.type]) acc[item.type] = [] + acc[item.type].push(item) + } + return acc + }, {}) + + return Object.keys(componentTitles) + .filter((type) => componentsByType[type]) + .map((type) => ({ + id: type, + title: componentTitles[type], + children: componentsByType[type].map((meshComponent) => ({ + id: meshComponent.geode_id, + title: meshComponent.name, + category: meshComponent.type, + })), + })) } async function meshComponentType(id, geode_id) { diff --git a/internal/database/tables/model_components.js b/internal/database/tables/model_components.js index 4bf4601f..cfb9041c 100644 --- a/internal/database/tables/model_components.js +++ b/internal/database/tables/model_components.js @@ -1,4 +1,4 @@ export const modelComponentsTable = { name: "model_components", - schema: "[id+geode_id], [id+type], viewer_id, type, name, created_at", + schema: "[id+geode_id], [id+type], viewer_id, name", }