Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
f935557
feat(DataStyle_Dexie): Add DataStyle into Dexie
SpliiT Mar 5, 2026
e09493d
Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWe…
SpliiT Mar 5, 2026
4e6bc3e
datastyle state
SpliiT Mar 5, 2026
b92eb71
styling persistence and advanced model component picking
SpliiT Mar 5, 2026
50bb1d6
implement persistent DataStyle in Dexie and optimize viewer picking
SpliiT Mar 6, 2026
c511290
rm useless function
SpliiT Mar 6, 2026
409fa0d
add clear tables
SpliiT Mar 6, 2026
7c6053a
Merge branch 'next' into feat/datastyle_dexie
SpliiT Mar 16, 2026
3b99880
Apply prepare changes
SpliiT Mar 16, 2026
9ff86e1
big changes, resolve merge conflicts and other
SpliiT Mar 16, 2026
4cf90a6
Merge branch 'feat/datastyle_dexie' of https://github.com/Geode-solut…
SpliiT Mar 16, 2026
b12f51d
Apply prepare changes
SpliiT Mar 16, 2026
06425b9
fix imports
SpliiT Mar 16, 2026
22914c2
improve reactivity, color scaling, and test stability
SpliiT Mar 16, 2026
25a37e2
Apply prepare changes
SpliiT Mar 16, 2026
9e3577f
Added sleep because the assertions execute before the componentStyles…
SpliiT Mar 16, 2026
346d301
Apply prepare changes
SpliiT Mar 16, 2026
c79bb7e
define used sleep
SpliiT Mar 16, 2026
c31486a
Merge branch 'feat/datastyle_dexie' of https://github.com/Geode-solut…
SpliiT Mar 16, 2026
deb6cf8
first comments edit
SpliiT Mar 16, 2026
171c5a3
Merge branch 'next' into feat/datastyle_dexie
SpliiT Mar 16, 2026
67c70a7
Apply prepare changes
SpliiT Mar 16, 2026
f909836
remove useless import
SpliiT Mar 16, 2026
6da8bea
Fix mutate and updatestyle
SpliiT Mar 17, 2026
2651e40
Apply prepare changes
SpliiT Mar 17, 2026
b9ff928
rm useless then
SpliiT Mar 17, 2026
044c026
revert menu js
SpliiT Mar 17, 2026
f856219
Merge branch 'feat/datastyle_dexie' of https://github.com/Geode-solut…
SpliiT Mar 17, 2026
188b138
Apply prepare changes
SpliiT Mar 17, 2026
9dd23e7
remove if else
SpliiT Mar 18, 2026
ed3b7d1
resolve imports
SpliiT Mar 18, 2026
ad81e80
fix comments
SpliiT Mar 18, 2026
2a74aa2
Apply prepare changes
SpliiT Mar 18, 2026
bfab407
rm line jumped
SpliiT Mar 18, 2026
b6b5ecf
Merge branch 'feat/datastyle_dexie' of https://github.com/Geode-solut…
SpliiT Mar 18, 2026
da48fa2
fix comments
SpliiT Mar 18, 2026
ff990cf
Apply prepare changes
SpliiT Mar 18, 2026
847235b
fix and simplify
SpliiT Mar 18, 2026
fbdb161
Apply prepare changes
SpliiT Mar 18, 2026
e6ae33f
edges changes
SpliiT Mar 19, 2026
e074ece
Apply prepare changes
SpliiT Mar 19, 2026
4b42ac8
changes with deep merge
SpliiT Mar 19, 2026
90e91df
Merge branch 'feat/datastyle_dexie' of https://github.com/Geode-solut…
SpliiT Mar 19, 2026
f53283b
use lodash merge
SpliiT Mar 19, 2026
5054aab
Apply prepare changes
SpliiT Mar 19, 2026
aba7a14
apply design for everyone, centralization of lodash/merge in state.js
SpliiT Mar 19, 2026
c61c814
Merge branch 'feat/datastyle_dexie' of https://github.com/Geode-solut…
SpliiT Mar 19, 2026
c93c8bb
Update app/components/Viewer/TreeComponent.vue
SpliiT Mar 19, 2026
0d0625d
Apply prepare changes
SpliiT Mar 19, 2026
a87fa2a
Apply prepare changes
JulienChampagnol Mar 19, 2026
5982cb2
color and format changes
SpliiT Mar 19, 2026
efe9a20
Merge branch 'feat/datastyle_dexie' of https://github.com/Geode-solut…
SpliiT Mar 19, 2026
0640a9b
Apply prepare changes
SpliiT Mar 19, 2026
af13338
trigger
SpliiT Mar 20, 2026
b8e135c
revert breadcrumb
SpliiT Mar 20, 2026
ca1c200
edit filter
SpliiT Mar 20, 2026
86a483a
rm || ...
SpliiT Mar 20, 2026
2ce565f
erro management
SpliiT Mar 20, 2026
7a2653d
rm useless function
SpliiT Mar 20, 2026
a8765c9
rm useless import
SpliiT Mar 20, 2026
7d8c881
more specialized mutate
SpliiT Mar 20, 2026
24c9332
Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWe…
SpliiT Mar 20, 2026
48071e3
Apply prepare changes
SpliiT Mar 20, 2026
4078f32
Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWe…
SpliiT Mar 23, 2026
7cfcf98
Merge branch 'feat/datastyle_dexie' of https://github.com/Geode-solut…
SpliiT Mar 23, 2026
5817c46
local import
SpliiT Mar 23, 2026
890e681
local import v2
SpliiT Mar 23, 2026
7591190
update test for new feature
SpliiT Mar 23, 2026
65d6c24
Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWe…
SpliiT Mar 23, 2026
7ff386a
Apply prepare changes
SpliiT Mar 23, 2026
1336841
oxlint fix
SpliiT Mar 23, 2026
f5254db
path
SpliiT Mar 23, 2026
0ad2776
Apply prepare changes
SpliiT Mar 23, 2026
3a9aebc
oxlint fix
SpliiT Mar 23, 2026
0a59cd7
Apply prepare changes
SpliiT Mar 23, 2026
a46c045
edit infra
SpliiT Mar 23, 2026
02aa4c1
Merge branch 'feat/datastyle_dexie' of https://github.com/Geode-solut…
SpliiT Mar 23, 2026
2492eea
Apply prepare changes
SpliiT Mar 23, 2026
0f3f1e8
fix microservices
SpliiT Mar 23, 2026
9e3e7c1
Merge branch 'feat/datastyle_dexie' of https://github.com/Geode-solut…
SpliiT Mar 23, 2026
7cf2444
Apply prepare changes
SpliiT Mar 23, 2026
d5d8c64
oxlint
SpliiT Mar 23, 2026
10ba6a5
Merge branch 'feat/datastyle_dexie' of https://github.com/Geode-solut…
SpliiT Mar 23, 2026
57ae4f8
Apply prepare changes
SpliiT Mar 23, 2026
dcc16d6
oxlint
SpliiT Mar 23, 2026
22fa7e0
Apply prepare changes
SpliiT Mar 23, 2026
7eeb6b7
oxlint
SpliiT Mar 23, 2026
9f1a56a
Merge branch 'feat/datastyle_dexie' of https://github.com/Geode-solut…
SpliiT Mar 23, 2026
8be2542
Apply prepare changes
SpliiT Mar 23, 2026
a43a19e
eoxlint
SpliiT Mar 23, 2026
f436778
Merge branch 'feat/datastyle_dexie' of https://github.com/Geode-solut…
SpliiT Mar 23, 2026
aec209f
Apply prepare changes
SpliiT Mar 23, 2026
a2db106
oxlint fix error
SpliiT Mar 23, 2026
f295855
Merge branch 'feat/datastyle_dexie' of https://github.com/Geode-solut…
SpliiT Mar 23, 2026
1c51b04
Apply prepare changes
SpliiT Mar 23, 2026
c89d7ac
trigger
SpliiT Mar 23, 2026
31f0822
add sleep against timeout
SpliiT Mar 24, 2026
10a5b0b
Apply prepare changes
SpliiT Mar 24, 2026
87b3245
vérification de l'existence du répertoire dans cleanupBackend pour év…
SpliiT Mar 24, 2026
46fe2e6
tobetrue
SpliiT Mar 24, 2026
6df9d25
discard
SpliiT Mar 24, 2026
3db8c3a
Merge branch 'feat/datastyle_dexie' of https://github.com/Geode-solut…
SpliiT Mar 24, 2026
2a45922
toBeTruthy
SpliiT Mar 24, 2026
64d3d28
toBeFalsy
SpliiT Mar 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions app/components/ObjectSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { useGeodeStore } from "@ogw_front/stores/geode";
const schema = schemas.opengeodeweb_back.allowed_objects;

const emit = defineEmits(["update_values", "increment_step"]);
console.log("ObjectSelector");

const { filenames } = defineProps({
filenames: { type: Array, required: true },
Expand Down Expand Up @@ -78,7 +77,6 @@ async function get_allowed_objects() {
}

function set_geode_object(geode_object_type) {
console.log("set_geode_object", { geode_object_type });
if (geode_object_type) {
emit("update_values", { geode_object_type });
emit("increment_step");
Expand Down
7 changes: 6 additions & 1 deletion app/components/Viewer/BreadCrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ function goBackToFileTree() {

const model_id = computed(() => treeviewStore.model_id);

const metaDatas = dataStore.refItem(model_id.value);
const metaDatas = computed(() => {
if (!model_id.value) {
return {};
}
return dataStore.refItem(model_id.value).value || {};
});
</script>

<template>
Expand Down
17 changes: 8 additions & 9 deletions app/components/Viewer/TreeComponent.vue
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
<script setup>
import { compareSelections } from "@ogw_front/utils/treeview";
import { useDataStore } from "@ogw_front/stores/data";
import { useDataStyleStore } from "@ogw_front/stores/data_style";
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";

import { compareSelections } from "@ogw_front/utils/treeview";

const dataStyleStore = useDataStyleStore();
const dataStore = useDataStore();
const hybridViewerStore = useHybridViewerStore();

const { id } = defineProps({ id: { type: String, required: true } });

const emit = defineEmits(["show-menu"]);

const items = ref([]);
const mesh_components_selection = dataStyleStore.visibleMeshComponents(id);

watchEffect(async () => {
items.value = await dataStore.formatedMeshComponents(id);
});
const items = dataStore.refFormatedMeshComponents(id);
const mesh_components_selection = computed(() => dataStyleStore.visibleMeshComponents(id));

watch(
mesh_components_selection,
Expand All @@ -28,6 +22,11 @@ watch(
}

const { added, removed } = compareSelections(current, previous);
console.log("TreeComponent selection change:", {
id: props.id,
added,
removed,
});

if (added.length > 0) {
await dataStyleStore.setModelMeshComponentsVisibility(id, added, true);
Expand Down
1 change: 1 addition & 0 deletions app/stores/app.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Local imports
import { api_fetch } from "@ogw_internal/utils/api_fetch.js";
import { upload_file } from "@ogw_internal/utils/upload_file.js";

Expand Down
19 changes: 16 additions & 3 deletions app/stores/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@ const viewer_generic_schemas = viewer_schemas.opengeodeweb_viewer.generic;
export const useDataStore = defineStore("data", () => {
const viewerStore = useViewerStore();

function item(id) {
return database.data.get(id);
async function item(id) {
const data_item = await database.data.get(id);
if (!data_item) {
throw new Error(`Item not found: ${id}`);
}
return data_item;
}

function refItem(id) {
Expand Down Expand Up @@ -62,6 +66,13 @@ export const useDataStore = defineStore("data", () => {
}));
}

function refFormatedMeshComponents(id) {
return useObservable(
liveQuery(() => formatedMeshComponents(id)),
{ initialValue: [] },
);
}

async function meshComponentType(modelId, geode_id) {
const component = await database.model_components.where({ id: modelId, geode_id }).first();
return component?.type;
Expand Down Expand Up @@ -176,7 +187,7 @@ export const useDataStore = defineStore("data", () => {
.where("[id+geode_id]")
.anyOf(meshComponentGeodeIds.map((geode_id) => [modelId, geode_id]))
.toArray();
return components.map((component) => component.viewer_id);
return components.map((component) => Number.parseInt(component.viewer_id, 10));
}

async function exportStores() {
Expand All @@ -198,6 +209,7 @@ export const useDataStore = defineStore("data", () => {
refItem,
meshComponentType,
formatedMeshComponents,
refFormatedMeshComponents,
registerObject,
deregisterObject,
addItem,
Expand All @@ -210,6 +222,7 @@ export const useDataStore = defineStore("data", () => {
getSurfacesGeodeIds,
getBlocksGeodeIds,
getMeshComponentsViewerIds,

exportStores,
importStores,
clear,
Expand Down
53 changes: 28 additions & 25 deletions app/stores/data_style.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { database } from "@ogw_internal/database/database.js";
import { getDefaultStyle } from "@ogw_front/utils/default_styles";
import { useDataStore } from "@ogw_front/stores/data";
import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state";
Expand All @@ -10,16 +11,13 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
const modelStyleStore = useModelStyle();
const dataStore = useDataStore();

function addDataStyle(id, geode_object) {
dataStyleState.styles[id] = getDefaultStyle(geode_object);
async function addDataStyle(id, geode_object) {
await database.data_style.put(structuredClone({ id, ...getDefaultStyle(geode_object) }));
}

async function setVisibility(id, visibility) {
const item = await dataStore.item(id);
const viewer_type = item?.viewer_type;
if (!viewer_type) {
throw new Error(`Item not found or not loaded: ${id}`);
}
const { viewer_type } = item;

if (viewer_type === "mesh") {
return meshStyleStore.setMeshVisibility(id, visibility);
Expand All @@ -32,10 +30,8 @@ export const useDataStyleStore = defineStore("dataStyle", () => {

async function applyDefaultStyle(id) {
const item = await dataStore.item(id);
const viewer_type = item?.viewer_type;
if (!viewer_type) {
throw new Error(`Item not found or not loaded: ${id}`);
}
const { viewer_type } = item;

if (viewer_type === "mesh") {
return meshStyleStore.applyMeshStyle(id);
}
Expand All @@ -46,29 +42,36 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
}

function exportStores() {
return { styles: dataStyleState.styles };
return {
styles: dataStyleState.styles,
componentStyles: dataStyleState.componentStyles,
};
}

function importStores(snapshot) {
const stylesSnapshot = snapshot.styles || {};
for (const id of Object.keys(dataStyleState.styles)) {
delete dataStyleState.styles[id];
}
for (const [id, style] of Object.entries(stylesSnapshot)) {
dataStyleState.styles[id] = style;
}
async function importStores(snapshot) {
const stylesSnapshot = snapshot.styles;
const componentStylesSnapshot = snapshot.componentStyles;

await dataStyleState.clear();

const style_promises = Object.entries(stylesSnapshot).map(([id, style]) =>
database.data_style.put(structuredClone({ id, ...style })),
);
const component_style_promises = Object.values(componentStylesSnapshot).map((style) =>
database.model_component_datastyle.put(structuredClone(style)),
);

await Promise.all([...style_promises, ...component_style_promises]);
}

function applyAllStylesFromState() {
const ids = Object.keys(dataStyleState.styles || {});
const ids = Object.keys(dataStyleState.styles);
const promises = ids.map(async (id) => {
const meta = await dataStore.item(id);
const viewerType = meta?.viewer_type;
const style = dataStyleState.styles[id];
if (style && viewerType === "mesh") {
const viewerType = meta.viewer_type;
if (viewerType === "mesh") {
return meshStyleStore.applyMeshStyle(id);
}
if (style && viewerType === "model") {
} else if (viewerType === "model") {
return modelStyleStore.applyModelStyle(id);
}
});
Expand Down
1 change: 0 additions & 1 deletion app/stores/hybrid_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
return;
}
const value = await dataStore.item(id);
console.log("hybridViewerStore.addItem", { value });
const reader = vtkXMLPolyDataReader();
const textEncoder = new TextEncoder();
await reader.parseAsArrayBuffer(textEncoder.encode(value.binary_light_viewable));
Expand Down
1 change: 1 addition & 0 deletions app/utils/file_import_workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ async function importWorkflow(files) {
function buildImportItemFromPayloadApi(value, geode_object_type) {
console.log("buildImportItemFromPayloadApi", { value, geode_object_type });
return {
geode_object_type,
...value,
};
}
Expand Down
6 changes: 5 additions & 1 deletion app/utils/local/cleanup.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ function projectMicroservices(projectFolderPath) {
}

async function cleanupBackend(projectFolderPath) {
if (!fs.existsSync(projectFolderPath)) {
console.log(`Folder ${projectFolderPath} does not exist. Skipping cleanup.`);
return;
}
const microservices = projectMicroservices(projectFolderPath);
await killMicroservices(microservices);
await deleteFolderRecursive(projectFolderPath);
Expand All @@ -142,4 +146,4 @@ function microservicesMetadatasPath(projectFolderPath) {
return path.join(projectFolderPath, "microservices.json");
}

export { cleanupBackend, microservicesMetadatasPath };
export { cleanupBackend, microservicesMetadatasPath, projectMicroservices };
14 changes: 1 addition & 13 deletions app/utils/local/microservices.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import pTimeout from "p-timeout";
// Local imports
import { commandExistsSync, waitForReady } from "./scripts.js";
import { executableName, executablePath } from "./path.js";
import { microservicesMetadatasPath } from "./cleanup.js";
import { microservicesMetadatasPath, projectMicroservices } from "./cleanup.js";

const DEFAULT_TIMEOUT_SECONDS = 30;
const MILLISECONDS_PER_SECOND = 1000;
Expand Down Expand Up @@ -112,18 +112,6 @@ async function runViewer(execName, execPath, args = {}) {
return port;
}

function projectMicroservices(projectFolderPath) {
console.log("projectMicroservices", { projectFolderPath });
const filePath = microservicesMetadatasPath(projectFolderPath);

if (!fs.existsSync(filePath)) {
const microservicesMetadatas = { microservices: [] };
fs.writeFileSync(filePath, JSON.stringify(microservicesMetadatas, undefined, 2), "utf8");
}
const content = JSON.parse(fs.readFileSync(filePath, "utf8"));
return content.microservices;
}

function addMicroserviceMetadatas(projectFolderPath, serviceObj) {
const microservices = projectMicroservices(projectFolderPath);
if (serviceObj.type === "back") {
Expand Down
22 changes: 22 additions & 0 deletions internal/database/base_database.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { Dexie } from "dexie";
import { dataStyleTable } from "./tables/data_style";
import { dataTable } from "./tables/data";
import { modelComponentDataStyleTable } from "./tables/model_component_datastyle";
import { modelComponentsRelationTable } from "./tables/model_components_relation";
import { modelComponentsTable } from "./tables/model_components";

export class BaseDatabase extends Dexie {
static get initialStores() {
return {
[dataTable.name]: dataTable.schema,
[modelComponentsTable.name]: modelComponentsTable.schema,
[dataStyleTable.name]: dataStyleTable.schema,
[modelComponentDataStyleTable.name]: modelComponentDataStyleTable.schema,
[modelComponentsRelationTable.name]: modelComponentsRelationTable.schema,
};
}

clear() {
return Promise.all(this.tables.map((table) => table.clear()));
}
}
25 changes: 5 additions & 20 deletions internal/database/database.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
import { Dexie } from "dexie";
import { BaseDatabase } from "./base_database";
import { ExtendedDatabase } from "./extended_database";
import { dataTable } from "./tables/data";
import { modelComponentsRelationTable } from "./tables/model_components_relation";
import { modelComponentsTable } from "./tables/model_components";

class Database extends Dexie {
class Database extends BaseDatabase {
constructor() {
super("Database");

this.version(1).stores({
[dataTable.name]: dataTable.schema,
[modelComponentsTable.name]: modelComponentsTable.schema,
[modelComponentsRelationTable.name]: modelComponentsRelationTable.schema,
});
this.version(1).stores(BaseDatabase.initialStores);
}

static async addTable(tableName, schemaDefinition) {
Expand All @@ -24,11 +17,7 @@ class Database extends Dexie {
await tempDb.open();

const currentVersion = tempDb.verno;
const currentStores = {
[dataTable.name]: dataTable.schema,
[modelComponentsTable.name]: modelComponentsTable.schema,
[modelComponentsRelationTable.name]: modelComponentsRelationTable.schema,
};
const currentStores = { ...BaseDatabase.initialStores };

for (const table of tempDb.tables) {
const keyPath = table.schema.primKey.src;
Expand All @@ -47,11 +36,7 @@ class Database extends Dexie {
const existingDb = new Dexie("Database");
for (let version = 1; version <= currentVersion; version += 1) {
if (version === 1) {
existingDb.version(1).stores({
[dataTable.name]: dataTable.schema,
[modelComponentsTable.name]: modelComponentsTable.schema,
[modelComponentsRelationTable.name]: modelComponentsRelationTable.schema,
});
existingDb.version(1).stores(BaseDatabase.initialStores);
} else {
existingDb.version(version).stores(currentStores);
}
Expand Down
13 changes: 3 additions & 10 deletions internal/database/extended_database.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
import { Dexie } from "dexie";
import { dataTable } from "./tables/data";
import { modelComponentsRelationTable } from "./tables/model_components_relation";
import { modelComponentsTable } from "./tables/model_components";
import { BaseDatabase } from "./base_database";

export class ExtendedDatabase extends Dexie {
export class ExtendedDatabase extends BaseDatabase {
constructor(currentVersion, currentStores, newTables) {
super("Database");

for (let version = 1; version <= currentVersion; version += 1) {
if (version === 1) {
this.version(1).stores({
[dataTable.name]: dataTable.schema,
[modelComponentsTable.name]: modelComponentsTable.schema,
[modelComponentsRelationTable.name]: modelComponentsRelationTable.schema,
});
this.version(1).stores(BaseDatabase.initialStores);
} else {
this.version(version).stores(currentStores);
}
Expand Down
4 changes: 4 additions & 0 deletions internal/database/tables/data_style.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const dataStyleTable = {
name: "data_style",
schema: "id",
};
4 changes: 4 additions & 0 deletions internal/database/tables/model_component_datastyle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export const modelComponentDataStyleTable = {
name: "model_component_datastyle",
schema: "[id_model+id_component], id_model",
};
Loading
Loading