From c63a3f17e32ea579f685880ab18688c336e9885a Mon Sep 17 00:00:00 2001 From: SpliiT Date: Mon, 29 Dec 2025 16:16:42 +0100 Subject: [PATCH 01/17] feat(DataManager): New datamanager feature --- components/InfraConnected.vue | 12 ++ composables/db.js | 26 ++++ composables/project_manager.js | 6 +- plugins/auto_store_register.js | 18 ++- stores/app.js | 4 +- stores/data_base.js | 275 ++++++++++++++++++++++++++------- stores/data_style.js | 11 +- stores/import_queue.js | 50 ++++++ stores/treeview.js | 8 +- utils/local.js | 16 +- 10 files changed, 353 insertions(+), 73 deletions(-) create mode 100644 components/InfraConnected.vue create mode 100644 composables/db.js create mode 100644 stores/import_queue.js diff --git a/components/InfraConnected.vue b/components/InfraConnected.vue new file mode 100644 index 00000000..39029852 --- /dev/null +++ b/components/InfraConnected.vue @@ -0,0 +1,12 @@ + + + diff --git a/composables/db.js b/composables/db.js new file mode 100644 index 00000000..0f6d6630 --- /dev/null +++ b/composables/db.js @@ -0,0 +1,26 @@ +import Dexie from "dexie" + +export class ImportedDataDB extends Dexie { + constructor() { + super("ImportedDataDB") + + this.version(1).stores({ + importedData: + "id, name, viewer_type, geode_object_type, visible, created_at", + }) + + this.version(2).stores({ + importedData: + "id, name, viewer_type, geode_object_type, visible, created_at, folder_id, *tags", + folders: "++id, name, parent_id, created_at", + }) + + this.version(3).stores({ + importedData: + "id, name, viewer_type, geode_object_type, visible, created_at, folder_id, *tags, pinned", + folders: "++id, name, parent_id, created_at", + }) + } +} + +export const db = new ImportedDataDB() diff --git a/composables/project_manager.js b/composables/project_manager.js index 4fa258d9..ebaf9968 100644 --- a/composables/project_manager.js +++ b/composables/project_manager.js @@ -3,12 +3,12 @@ import fileDownload from "js-file-download" import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json" export function useProjectManager() { - const exportProject = async function () { - console.log("[export triggered]") + const exportProject = async function (params = {}) { + console.log("[export triggered]", params) const appStore = useAppStore() const geode = useGeodeStore() const infraStore = useInfraStore() - const snapshot = appStore.exportStores() + const snapshot = appStore.exportStores(params) const schema = back_schemas.opengeodeweb_back.export_project const defaultName = "project.vease" diff --git a/plugins/auto_store_register.js b/plugins/auto_store_register.js index 71826218..04777793 100644 --- a/plugins/auto_store_register.js +++ b/plugins/auto_store_register.js @@ -1,3 +1,6 @@ +import { getActivePinia } from "pinia" +import { useAppStore } from "../stores/app.js" + const autoStoreRegister = ({ store }) => { if (store.$id === "app") { return @@ -9,8 +12,15 @@ const autoStoreRegister = ({ store }) => { } export default defineNuxtPlugin((nuxtApp) => { - nuxtApp.$pinia.use(autoStoreRegister) - console.log( - "[AUTOREGISTER PLUGIN] Loaded automatically from OpenGeodeWeb-Front", - ) + const pinia = nuxtApp.$pinia || getActivePinia() + if (pinia) { + pinia.use(autoStoreRegister) + console.log( + "[AUTOREGISTER PLUGIN] Loaded automatically from OpenGeodeWeb-Front", + ) + } else { + console.warn( + "[AUTOREGISTER PLUGIN] Pinia instance not found, skipping registration", + ) + } }) diff --git a/stores/app.js b/stores/app.js index 4fb94817..94feb875 100644 --- a/stores/app.js +++ b/stores/app.js @@ -15,7 +15,7 @@ export const useAppStore = defineStore("app", () => { stores.push(store) } - function exportStores() { + function exportStores(params = {}) { const snapshot = {} let exportCount = 0 @@ -23,7 +23,7 @@ export const useAppStore = defineStore("app", () => { if (!store.exportStores) continue const storeId = store.$id try { - snapshot[storeId] = store.exportStores() + snapshot[storeId] = store.exportStores(params) exportCount++ } catch (error) { console.error(`[AppStore] Error exporting store "${storeId}":`, error) diff --git a/stores/data_base.js b/stores/data_base.js index 7db27343..4b2244d4 100644 --- a/stores/data_base.js +++ b/stores/data_base.js @@ -1,20 +1,34 @@ // Third party imports import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json" import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json" +import { db } from "@ogw_f/composables/db.js" // Local constants const back_model_schemas = back_schemas.opengeodeweb_back.models const viewer_generic_schemas = viewer_schemas.opengeodeweb_viewer.generic export const useDataBaseStore = defineStore("dataBase", () => { - const db = reactive({}) + const db_cache = reactive({}) - function itemMetaDatas(id) { - return db[id] + async function itemMetaDatas(id) { + if (db_cache[id]) { + return db_cache[id] + } + const item = await db.importedData.get(id) + if (item) { + db_cache[id] = item + } + return item + } + + function itemMetaDatasSync(id) { + return db_cache[id] } function formatedMeshComponents(id) { - const { mesh_components } = itemMetaDatas(id) + const item = itemMetaDatasSync(id) + if (!item || !item.mesh_components) return [] + const { mesh_components } = item const formated_mesh_components = ref([]) for (const [category, uuids] of Object.entries(mesh_components)) { @@ -32,7 +46,9 @@ export const useDataBaseStore = defineStore("dataBase", () => { } function meshComponentType(id, uuid) { - const { mesh_components } = itemMetaDatas(id) + const item = itemMetaDatasSync(id) + if (!item || !item.mesh_components) return null + const { mesh_components } = item if (mesh_components["Corner"]?.includes(uuid)) return "corner" else if (mesh_components["Line"]?.includes(uuid)) return "line" @@ -48,18 +64,126 @@ export const useDataBaseStore = defineStore("dataBase", () => { }) } - async function addItem( - id, - value = { - object_type, - geode_object, - native_filename, - viewable_filename, - displayed_name, - vtk_js: { binary_light_viewable }, - }, - ) { - db[id] = value + async function deregisterObject(id) { + return viewer_call({ + schema: viewer_generic_schemas.deregister, + params: { id }, + }) + } + + async function addItem(id, value) { + const itemData = { + id, + visible: true, + created_at: new Date().toISOString(), + ...value, + } + + await db.importedData.put(itemData) + db_cache[id] = itemData + } + + async function getAllItems() { + const items = await db.importedData.toArray() + items.forEach((item) => { + db_cache[item.id] = item + }) + return items + } + + async function deleteItem(id) { + await db.importedData.delete(id) + delete db_cache[id] + } + + async function updateItem(id, changes) { + await db.importedData.update(id, changes) + if (db_cache[id]) { + Object.assign(db_cache[id], changes) + } + } + + // Folder management + async function createFolder(name, parent_id = null) { + const folder = { + name, + parent_id, + created_at: new Date().toISOString(), + } + const id = await db.folders.add(folder) + return { ...folder, id } + } + + async function deleteFolder(id) { + await db.folders.delete(id) + await db.importedData.where("folder_id").equals(id).modify({ folder_id: null }) + Object.values(db_cache).forEach((item) => { + if (item.folder_id === id) item.folder_id = null + }) + } + + async function getAllFolders() { + return await db.folders.toArray() + } + + async function updateFolder(id, changes) { + await db.folders.update(id, changes) + } + + // Tag management + async function addTag(itemId, tag) { + const item = await itemMetaDatas(itemId) + const tags = item.tags || [] + if (!tags.includes(tag)) { + tags.push(tag) + await updateItem(itemId, { tags }) + } + } + + async function removeTag(itemId, tag) { + const item = await itemMetaDatas(itemId) + const tags = (item.tags || []).filter((t) => t !== tag) + await updateItem(itemId, { tags }) + } + + async function togglePin(itemId) { + const item = await db.importedData.get(itemId) + if (item) { + await updateItem(itemId, { pinned: !item.pinned }) + } + } + + async function batchAddTags(itemIds, tags) { + for (const id of itemIds) { + const item = await db.importedData.get(id) + if (item) { + const newTags = [...new Set([...(item.tags || []), ...tags])] + await updateItem(id, { tags: newTags }) + } + } + } + + async function batchRemoveTags(itemIds, tags) { + for (const id of itemIds) { + const item = await db.importedData.get(id) + if (item) { + const newTags = (item.tags || []).filter(t => !tags.includes(t)) + await updateItem(id, { tags: newTags }) + } + } + } + + async function batchMoveToFolder(itemIds, folderId) { + for (const id of itemIds) { + await updateItem(id, { folder_id: folderId }) + } + } + + async function batchUpdateColor(itemIds, color) { + const dataStyleStore = useDataStyleStore() + for (const id of itemIds) { + await dataStyleStore.updateStyle(id, { color }) + } } async function fetchMeshComponents(id) { @@ -72,14 +196,14 @@ export const useDataBaseStore = defineStore("dataBase", () => { }, { response_function: async (response) => { - db[id].mesh_components = response._data.uuid_dict + const mesh_components = response._data.uuid_dict + await updateItem(id, { mesh_components }) }, }, ) } async function fetchUuidToFlatIndexDict(id) { - console.log("fetchUuidToFlatIndexDict", id) return api_fetch( { schema: back_model_schemas.vtm_component_indices, @@ -87,83 +211,130 @@ export const useDataBaseStore = defineStore("dataBase", () => { }, { response_function: async (response) => { - db[id]["uuid_to_flat_index"] = response._data.uuid_to_flat_index + const uuid_to_flat_index = response._data.uuid_to_flat_index + await updateItem(id, { uuid_to_flat_index }) }, }, ) } function getCornersUuids(id) { - const { mesh_components } = itemMetaDatas(id) - return Object.values(mesh_components["Corner"]) + const item = itemMetaDatasSync(id) + if (!item || !item.mesh_components) return [] + const { mesh_components } = item + return Object.values(mesh_components["Corner"] || {}) } function getLinesUuids(id) { - const { mesh_components } = itemMetaDatas(id) - return Object.values(mesh_components["Line"]) + const item = itemMetaDatasSync(id) + if (!item || !item.mesh_components) return [] + const { mesh_components } = item + return Object.values(mesh_components["Line"] || {}) } function getSurfacesUuids(id) { - const { mesh_components } = itemMetaDatas(id) - return Object.values(mesh_components["Surface"]) + const item = itemMetaDatasSync(id) + if (!item || !item.mesh_components) return [] + const { mesh_components } = item + return Object.values(mesh_components["Surface"] || {}) } function getBlocksUuids(id) { - const { mesh_components } = itemMetaDatas(id) - return Object.values(mesh_components["Block"]) + const item = itemMetaDatasSync(id) + if (!item || !item.mesh_components) return [] + const { mesh_components } = item + return Object.values(mesh_components["Block"] || {}) } function getFlatIndexes(id, mesh_component_ids) { - const { uuid_to_flat_index } = itemMetaDatas(id) + const item = itemMetaDatasSync(id) + if (!item || !item.uuid_to_flat_index) return [] + const { uuid_to_flat_index } = item const flat_indexes = [] for (const mesh_component_id of mesh_component_ids) { - flat_indexes.push(uuid_to_flat_index[mesh_component_id]) + if (uuid_to_flat_index[mesh_component_id] !== undefined) { + flat_indexes.push(uuid_to_flat_index[mesh_component_id]) + } } return flat_indexes } - function exportStores() { + async function exportSelectedItems(itemIds) { + const { exportProject } = useProjectManager() + await exportProject({ itemIds }) + } + + async function exportStores(params = {}) { + const items = await db.importedData.toArray() + const folders = await db.folders.toArray() const snapshotDb = {} - for (const [id, item] of Object.entries(db)) { - if (!item) continue - snapshotDb[id] = { - object_type: item.object_type, - geode_object: item.geode_object, - native_filename: item.native_filename, - viewable_filename: item.viewable_filename, - displayed_name: item.displayed_name, - vtk_js: { - binary_light_viewable: item?.vtk_js?.binary_light_viewable, - }, + + const filteredItems = params.itemIds + ? items.filter(item => params.itemIds.includes(item.id)) + : items + + for (const item of filteredItems) { + if (!item || !item.id) continue + snapshotDb[item.id] = { + ...item, } } - return { db: snapshotDb } + + const filteredFolders = params.itemIds + ? folders.filter(f => filteredItems.some(i => i.folder_id === f.id)) + : folders + + return { db: snapshotDb, folders: filteredFolders } } async function importStores(snapshot) { + const hybridViewerStore = useHybridViewerStore() await hybridViewerStore.initHybridViewer() hybridViewerStore.clear() - console.log( - "[DataBase] importStores entries:", - Object.keys(snapshot?.db || {}), - ) + + await db.importedData.clear() + await db.folders.clear() + Object.keys(db_cache).forEach((key) => delete db_cache[key]) + + if (snapshot?.folders) { + for (const folder of snapshot.folders) { + await db.folders.put(folder) + } + } + for (const [id, item] of Object.entries(snapshot?.db || {})) { await registerObject(id) await addItem(id, item) } } - function clear() { - for (const id of Object.keys(db)) { - delete db[id] - } + async function clear() { + await db.importedData.clear() + Object.keys(db_cache).forEach((key) => delete db_cache[key]) } return { - db, + db: db_cache, itemMetaDatas, + itemMetaDatasSync, meshComponentType, formatedMeshComponents, registerObject, + deregisterObject, addItem, + getAllItems, + deleteItem, + updateItem, + createFolder, + deleteFolder, + getAllFolders, + updateFolder, + addTag, + removeTag, + togglePin, + batchAddTags, + batchRemoveTags, + batchMoveToFolder, + batchUpdateColor, + exportSelectedItems, fetchUuidToFlatIndexDict, fetchMeshComponents, getCornersUuids, diff --git a/stores/data_style.js b/stores/data_style.js index 9a672e23..f3913937 100644 --- a/stores/data_style.js +++ b/stores/data_style.js @@ -39,7 +39,16 @@ export const useDataStyleStore = defineStore("dataStyle", () => { } } - const exportStores = () => { + const exportStores = (params = {}) => { + if (params.itemIds) { + const filteredStyles = {} + for (const id of params.itemIds) { + if (dataStyleState.styles[id]) { + filteredStyles[id] = dataStyleState.styles[id] + } + } + return { styles: filteredStyles } + } return { styles: dataStyleState.styles } } diff --git a/stores/import_queue.js b/stores/import_queue.js new file mode 100644 index 00000000..45845c8d --- /dev/null +++ b/stores/import_queue.js @@ -0,0 +1,50 @@ +import { defineStore } from 'pinia' + +export const useImportQueueStore = defineStore('importQueue', () => { + const queue = ref([]) + + function addToQueue(name) { + const id = Date.now() + Math.random().toString(36).substr(2, 9) + queue.value.push({ + id, + name, + status: 'pending', + progress: 0, + error: null + }) + return id + } + + function updateStatus(id, status, progress = 0, error = null) { + const item = queue.value.find(i => i.id === id) + if (item) { + item.status = status + item.progress = progress + item.error = error + } + } + + function removeFromQueue(id) { + const index = queue.value.findIndex(i => i.id === id) + if (index !== -1) { + queue.value.splice(index, 1) + } + } + + function clearCompleted() { + queue.value = queue.value.filter(i => i.status !== 'success' && i.status !== 'error') + } + + const activeImportsCount = computed(() => + queue.value.filter(i => i.status === 'pending' || i.status === 'importing').length + ) + + return { + queue, + addToQueue, + updateStatus, + removeFromQueue, + clearCompleted, + activeImportsCount + } +}) diff --git a/stores/treeview.js b/stores/treeview.js index 0cb2b000..d518374d 100644 --- a/stores/treeview.js +++ b/stores/treeview.js @@ -52,14 +52,18 @@ export const useTreeviewStore = defineStore("treeview", () => { panelWidth.value = width } - function exportStores() { + function exportStores(params = {}) { + let selectionIds = selection.value.map((c) => c.id) + if (params.itemIds) { + selectionIds = selectionIds.filter(id => params.itemIds.includes(id)) + } return { isAdditionnalTreeDisplayed: isAdditionnalTreeDisplayed.value, panelWidth: panelWidth.value, model_id: model_id.value, isTreeCollection: isTreeCollection.value, selectedTree: selectedTree.value, - selectionIds: selection.value.map((c) => c.id), + selectionIds, } } diff --git a/utils/local.js b/utils/local.js index 13534f8c..8026c285 100644 --- a/utils/local.js +++ b/utils/local.js @@ -77,16 +77,16 @@ async function run_script( reject("Timed out after " + timeout_seconds + " seconds") }, timeout_seconds * 1000) - const command = commandExistsSync(executable_name) - ? executable_name - : path.join(executable_path, executable_name) + const local_command = path.join(executable_path, executable_name) + const command = fs.existsSync(local_command) + ? local_command + : executable_name console.log("run_script", command, args) const child = child_process.spawn(command, args, { encoding: "utf8", shell: true, }) - // You can also use a variable to save the output for when the script closes later child.stderr.setEncoding("utf8") child.on("error", (error) => { dialog.showMessageBox({ @@ -97,7 +97,6 @@ async function run_script( }) child.stdout.setEncoding("utf8") child.stdout.on("data", (data) => { - //Here is the output data = data.toString() if (data.includes(expected_response)) { resolve(child) @@ -110,7 +109,6 @@ async function run_script( }) child.on("close", (_code) => { - //Here you can get the exit code of the script console.log("Child Process exited with code " + _code) }) child.on("kill", () => { @@ -193,9 +191,9 @@ function kill_back(back_port) { return new Promise((resolve, reject) => { fetch( "http://localhost:" + - back_port + - "/" + - back_schemas.opengeodeweb_back.kill.$id, + back_port + + "/" + + back_schemas.opengeodeweb_back.kill.$id, { method: back_schemas.opengeodeweb_back.kill.methods[0], }, From cfd3957e2fefa74845ad2b155672a3ac8e343ea4 Mon Sep 17 00:00:00 2001 From: SpliiT <106495600+SpliiT@users.noreply.github.com> Date: Mon, 29 Dec 2025 15:43:47 +0000 Subject: [PATCH 02/17] Apply prepare changes --- app/components/InfraConnected.vue | 2 +- app/composables/project_manager.js | 2 +- app/plugins/auto_store_register.js | 2 +- app/stores/data_base.js | 11 ++- app/stores/import_queue.js | 85 ++++++++++--------- app/stores/treeview.js | 2 +- app/utils/local.js | 6 +- composables/db.js | 34 ++++---- stores/import_queue.js | 85 ++++++++++--------- .../microservices/back/requirements.txt | 1 - .../microservices/viewer/requirements.txt | 1 - 11 files changed, 121 insertions(+), 110 deletions(-) diff --git a/app/components/InfraConnected.vue b/app/components/InfraConnected.vue index 480383ac..83996316 100644 --- a/app/components/InfraConnected.vue +++ b/app/components/InfraConnected.vue @@ -6,4 +6,4 @@ import { useInfraStore } from "@ogw_front/stores/infra" const infraStore = useInfraStore() console.log("TEST", { infraStore }) - \ No newline at end of file + diff --git a/app/composables/project_manager.js b/app/composables/project_manager.js index 5d6acddd..e54463a5 100644 --- a/app/composables/project_manager.js +++ b/app/composables/project_manager.js @@ -119,4 +119,4 @@ export function useProjectManager() { return { exportProject, importProjectFile } } -export default useProjectManager \ No newline at end of file +export default useProjectManager diff --git a/app/plugins/auto_store_register.js b/app/plugins/auto_store_register.js index b99c6b5e..e5dd599c 100644 --- a/app/plugins/auto_store_register.js +++ b/app/plugins/auto_store_register.js @@ -21,4 +21,4 @@ export default defineNuxtPlugin((nuxtApp) => { console.log( "[AUTOREGISTER PLUGIN] Loaded automatically from OpenGeodeWeb-Front", ) -}) \ No newline at end of file +}) diff --git a/app/stores/data_base.js b/app/stores/data_base.js index 4b2244d4..8dc48203 100644 --- a/app/stores/data_base.js +++ b/app/stores/data_base.js @@ -116,7 +116,10 @@ export const useDataBaseStore = defineStore("dataBase", () => { async function deleteFolder(id) { await db.folders.delete(id) - await db.importedData.where("folder_id").equals(id).modify({ folder_id: null }) + await db.importedData + .where("folder_id") + .equals(id) + .modify({ folder_id: null }) Object.values(db_cache).forEach((item) => { if (item.folder_id === id) item.folder_id = null }) @@ -167,7 +170,7 @@ export const useDataBaseStore = defineStore("dataBase", () => { for (const id of itemIds) { const item = await db.importedData.get(id) if (item) { - const newTags = (item.tags || []).filter(t => !tags.includes(t)) + const newTags = (item.tags || []).filter((t) => !tags.includes(t)) await updateItem(id, { tags: newTags }) } } @@ -268,7 +271,7 @@ export const useDataBaseStore = defineStore("dataBase", () => { const snapshotDb = {} const filteredItems = params.itemIds - ? items.filter(item => params.itemIds.includes(item.id)) + ? items.filter((item) => params.itemIds.includes(item.id)) : items for (const item of filteredItems) { @@ -279,7 +282,7 @@ export const useDataBaseStore = defineStore("dataBase", () => { } const filteredFolders = params.itemIds - ? folders.filter(f => filteredItems.some(i => i.folder_id === f.id)) + ? folders.filter((f) => filteredItems.some((i) => i.folder_id === f.id)) : folders return { db: snapshotDb, folders: filteredFolders } diff --git a/app/stores/import_queue.js b/app/stores/import_queue.js index 45845c8d..7b399e0f 100644 --- a/app/stores/import_queue.js +++ b/app/stores/import_queue.js @@ -1,50 +1,55 @@ -import { defineStore } from 'pinia' +import { defineStore } from "pinia" -export const useImportQueueStore = defineStore('importQueue', () => { - const queue = ref([]) +export const useImportQueueStore = defineStore("importQueue", () => { + const queue = ref([]) - function addToQueue(name) { - const id = Date.now() + Math.random().toString(36).substr(2, 9) - queue.value.push({ - id, - name, - status: 'pending', - progress: 0, - error: null - }) - return id - } - - function updateStatus(id, status, progress = 0, error = null) { - const item = queue.value.find(i => i.id === id) - if (item) { - item.status = status - item.progress = progress - item.error = error - } - } + function addToQueue(name) { + const id = Date.now() + Math.random().toString(36).substr(2, 9) + queue.value.push({ + id, + name, + status: "pending", + progress: 0, + error: null, + }) + return id + } - function removeFromQueue(id) { - const index = queue.value.findIndex(i => i.id === id) - if (index !== -1) { - queue.value.splice(index, 1) - } + function updateStatus(id, status, progress = 0, error = null) { + const item = queue.value.find((i) => i.id === id) + if (item) { + item.status = status + item.progress = progress + item.error = error } + } - function clearCompleted() { - queue.value = queue.value.filter(i => i.status !== 'success' && i.status !== 'error') + function removeFromQueue(id) { + const index = queue.value.findIndex((i) => i.id === id) + if (index !== -1) { + queue.value.splice(index, 1) } + } - const activeImportsCount = computed(() => - queue.value.filter(i => i.status === 'pending' || i.status === 'importing').length + function clearCompleted() { + queue.value = queue.value.filter( + (i) => i.status !== "success" && i.status !== "error", ) + } - return { - queue, - addToQueue, - updateStatus, - removeFromQueue, - clearCompleted, - activeImportsCount - } + const activeImportsCount = computed( + () => + queue.value.filter( + (i) => i.status === "pending" || i.status === "importing", + ).length, + ) + + return { + queue, + addToQueue, + updateStatus, + removeFromQueue, + clearCompleted, + activeImportsCount, + } }) diff --git a/app/stores/treeview.js b/app/stores/treeview.js index 157345db..1396ad56 100644 --- a/app/stores/treeview.js +++ b/app/stores/treeview.js @@ -61,7 +61,7 @@ export const useTreeviewStore = defineStore("treeview", () => { function exportStores(params = {}) { let selectionIds = selection.value.map((c) => c.id) if (params.itemIds) { - selectionIds = selectionIds.filter(id => params.itemIds.includes(id)) + selectionIds = selectionIds.filter((id) => params.itemIds.includes(id)) } return { isAdditionnalTreeDisplayed: isAdditionnalTreeDisplayed.value, diff --git a/app/utils/local.js b/app/utils/local.js index 00f4a902..a7fefd06 100644 --- a/app/utils/local.js +++ b/app/utils/local.js @@ -194,9 +194,9 @@ function kill_back(back_port) { return new Promise((resolve, reject) => { fetch( "http://localhost:" + - back_port + - "/" + - back_schemas.opengeodeweb_back.kill.$id, + back_port + + "/" + + back_schemas.opengeodeweb_back.kill.$id, { method: back_schemas.opengeodeweb_back.kill.methods[0], }, diff --git a/composables/db.js b/composables/db.js index 0f6d6630..480f68eb 100644 --- a/composables/db.js +++ b/composables/db.js @@ -1,26 +1,26 @@ import Dexie from "dexie" export class ImportedDataDB extends Dexie { - constructor() { - super("ImportedDataDB") + constructor() { + super("ImportedDataDB") - this.version(1).stores({ - importedData: - "id, name, viewer_type, geode_object_type, visible, created_at", - }) + this.version(1).stores({ + importedData: + "id, name, viewer_type, geode_object_type, visible, created_at", + }) - this.version(2).stores({ - importedData: - "id, name, viewer_type, geode_object_type, visible, created_at, folder_id, *tags", - folders: "++id, name, parent_id, created_at", - }) + this.version(2).stores({ + importedData: + "id, name, viewer_type, geode_object_type, visible, created_at, folder_id, *tags", + folders: "++id, name, parent_id, created_at", + }) - this.version(3).stores({ - importedData: - "id, name, viewer_type, geode_object_type, visible, created_at, folder_id, *tags, pinned", - folders: "++id, name, parent_id, created_at", - }) - } + this.version(3).stores({ + importedData: + "id, name, viewer_type, geode_object_type, visible, created_at, folder_id, *tags, pinned", + folders: "++id, name, parent_id, created_at", + }) + } } export const db = new ImportedDataDB() diff --git a/stores/import_queue.js b/stores/import_queue.js index 45845c8d..7b399e0f 100644 --- a/stores/import_queue.js +++ b/stores/import_queue.js @@ -1,50 +1,55 @@ -import { defineStore } from 'pinia' +import { defineStore } from "pinia" -export const useImportQueueStore = defineStore('importQueue', () => { - const queue = ref([]) +export const useImportQueueStore = defineStore("importQueue", () => { + const queue = ref([]) - function addToQueue(name) { - const id = Date.now() + Math.random().toString(36).substr(2, 9) - queue.value.push({ - id, - name, - status: 'pending', - progress: 0, - error: null - }) - return id - } - - function updateStatus(id, status, progress = 0, error = null) { - const item = queue.value.find(i => i.id === id) - if (item) { - item.status = status - item.progress = progress - item.error = error - } - } + function addToQueue(name) { + const id = Date.now() + Math.random().toString(36).substr(2, 9) + queue.value.push({ + id, + name, + status: "pending", + progress: 0, + error: null, + }) + return id + } - function removeFromQueue(id) { - const index = queue.value.findIndex(i => i.id === id) - if (index !== -1) { - queue.value.splice(index, 1) - } + function updateStatus(id, status, progress = 0, error = null) { + const item = queue.value.find((i) => i.id === id) + if (item) { + item.status = status + item.progress = progress + item.error = error } + } - function clearCompleted() { - queue.value = queue.value.filter(i => i.status !== 'success' && i.status !== 'error') + function removeFromQueue(id) { + const index = queue.value.findIndex((i) => i.id === id) + if (index !== -1) { + queue.value.splice(index, 1) } + } - const activeImportsCount = computed(() => - queue.value.filter(i => i.status === 'pending' || i.status === 'importing').length + function clearCompleted() { + queue.value = queue.value.filter( + (i) => i.status !== "success" && i.status !== "error", ) + } - return { - queue, - addToQueue, - updateStatus, - removeFromQueue, - clearCompleted, - activeImportsCount - } + const activeImportsCount = computed( + () => + queue.value.filter( + (i) => i.status === "pending" || i.status === "importing", + ).length, + ) + + return { + queue, + addToQueue, + updateStatus, + removeFromQueue, + clearCompleted, + activeImportsCount, + } }) diff --git a/tests/integration/microservices/back/requirements.txt b/tests/integration/microservices/back/requirements.txt index c8f45967..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==5.*,>=5.14.3 diff --git a/tests/integration/microservices/viewer/requirements.txt b/tests/integration/microservices/viewer/requirements.txt index 147e1750..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.13.2 From c7413708e7c100afaafe83d72581681f961d9652 Mon Sep 17 00:00:00 2001 From: SpliiT Date: Tue, 30 Dec 2025 16:26:07 +0100 Subject: [PATCH 03/17] check comments & other --- app/components/Viewer/Tree/ObjectTree.vue | 6 +- {composables => app/composables}/db.js | 6 + app/plugins/auto_store_register.js | 2 +- app/stores/data_base.js | 173 +++------------------- app/stores/data_style.js | 6 +- app/stores/treeview.js | 23 +++ 6 files changed, 60 insertions(+), 156 deletions(-) rename {composables => app/composables}/db.js (82%) diff --git a/app/components/Viewer/Tree/ObjectTree.vue b/app/components/Viewer/Tree/ObjectTree.vue index ad9c2af5..fafcbb8a 100644 --- a/app/components/Viewer/Tree/ObjectTree.vue +++ b/app/components/Viewer/Tree/ObjectTree.vue @@ -42,9 +42,9 @@