Skip to content

Conversation

@MaxNumerique
Copy link
Contributor

…persistence

create project manager plugin for import/export operations update tests for new functionality and async loading

…persistence

create project manager plugin for import/export operations
update tests for new functionality and async loading
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quel est l'objectif de ce plug-in, c'est pas déjà le rôle de l'app store?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pour moi l'app_store ne fait que de la gestion d'état sans créer de fichier ni réseau. Il permet de créer un snapshot avec le save() sous forme d'objet.
Le plugin utilise les méthode de l'appStore pour transformer le snapshot en JSON et créé un Blob, enfin lance un téléchargement pour le save.

Pour moi, le plugin utilise app_store comme moteur de snapshot et ne réimplémente pas le save & load

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je crois que je comprends, dans l'idée il faudrait :
exporter : compresser l'état de Project_folder_path et lui passer aussi le snapshot pour restaurer le style, etc. et ziper le tout
importer : recoit le zip, remplace le project_folder actuel et utilise aussi le snapshot qui sera utilisé par les stores dans le Front

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Un plug-in de pinia, c'est globalement l'idée d'ajouter une fonctionalité à tous les stores ou certains. Là, ce que tu veux ajouter ces pas vraiment en line avec pinia et les stores mais plutôt une action spécifique de l'app store. Qui en effet est un peu plus complexe que juste l'app store, ta question est pertinente.

Peut-être qu'il faut mettre la logique de ton plug-in dans un composable qui utiliserait l'app store et le geode store ? @JulienChampagnol qu'en penses tu ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je vais voir pour porter project_manager en tant que composable et non en tant que plugin Pinia et en même temps utiliser le store geode.js

@MaxNumerique MaxNumerique changed the title feat(save_and_load): add save/load methods to all stores for project … feat(save_and_load): add import/export methods to all stores for project … Oct 30, 2025
@MaxNumerique MaxNumerique changed the title feat(save_and_load): add import/export methods to all stores for project … feat(save_and_load): add import/export methods Oct 30, 2025
@MaxNumerique MaxNumerique requested a review from BotellaA October 30, 2025 15:40
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JulienChampagnol que penses tu de cette proposition ?

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit


reported by reviewdog 🐶
Expected a function expression.

async function importStores(snapshot) {


reported by reviewdog 🐶
Expected a function expression.

async function applyAllStylesFromState() {


reported by reviewdog 🐶
Unexpected await inside a loop.

await meshStyleStore.applyMeshStyle(id)


reported by reviewdog 🐶
Unexpected await inside a loop.

await modelStyleStore.applyModelStyle(id)


reported by reviewdog 🐶
Unexpected console statement.

console.warn("[DataStyle] setVisibility skipped: unknown id", id)


reported by reviewdog 🐶
Unexpected use of continue statement.

if (!style || !objectType) continue


reported by reviewdog 🐶
Use Object destructuring.

const object_type = meta.object_type


reported by reviewdog 🐶
Async function has no 'await' expression.

async function importStores(snapshot) {


reported by reviewdog 🐶
async is not allowed

async function importStores(snapshot) {


reported by reviewdog 🐶
async is not allowed

async function applyAllStylesFromState() {


reported by reviewdog 🐶
Optional chaining is not allowed.

const stylesSnapshot = snapshot?.styles || {}


reported by reviewdog 🐶
Optional chaining is not allowed.

const objectType = meta?.object_type


reported by reviewdog 🐶
Expected { after 'if' condition.

if (cam.focal_point) camera.setFocalPoint(cam.focal_point)


reported by reviewdog 🐶
Expected { after 'if' condition.

if (cam.view_up) camera.setViewUp(cam.view_up)


reported by reviewdog 🐶
Expected { after 'if' condition.

if (cam.position) camera.setPosition(cam.position)


reported by reviewdog 🐶
Expected { after 'if' condition.

if (cam.view_angle != null) camera.setViewAngle(cam.view_angle)


reported by reviewdog 🐶
Expected { after 'if' condition.

if (cam.clipping_range) camera.setClippingRange(cam.clipping_range)


reported by reviewdog 🐶
Expected !== and instead saw !=

if (z_scale != null) {


reported by reviewdog 🐶
Expected !== and instead saw !=

if (cam.view_angle != null) camera.setViewAngle(cam.view_angle)


reported by reviewdog 🐶
Expected a function expression.

function clear() {


reported by reviewdog 🐶
Expected a function expression.

function exportStores() {


reported by reviewdog 🐶
Expected a function expression.

async function importStores(snapshot) {


reported by reviewdog 🐶
Require for-in loops to include an if statement

for (const key in cam) {


reported by reviewdog 🐶
Do not use null comparisons without type-checking operators.

if (z_scale != null) {


reported by reviewdog 🐶
Do not use null comparisons without type-checking operators.

if (cam.view_angle != null) camera.setViewAngle(cam.view_angle)


reported by reviewdog 🐶
async is not allowed

async function importStores(snapshot) {


reported by reviewdog 🐶
Optional chaining is not allowed.

const renderer = genericRenderWindow.value?.getRenderer?.()


reported by reviewdog 🐶
Optional chaining is not allowed.

const camera = renderer?.getActiveCamera?.()


reported by reviewdog 🐶
Optional chaining is not allowed.

const z_scale = snapshot?.zScale


reported by reviewdog 🐶
Optional chaining is not allowed.

const cam = snapshot?.camera_options


reported by reviewdog 🐶
Do not use Array#forEach

actors.forEach((actor) => renderer.removeActor(actor))


reported by reviewdog 🐶
Do not use Array#forEach

Object.keys(db).forEach((id) => delete db[id])


reported by reviewdog 🐶
Do not use null literals

if (z_scale != null) {


reported by reviewdog 🐶
Do not use null literals

if (cam.view_angle != null) camera.setViewAngle(cam.view_angle)


reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

focal_point: Array.from(camera.getFocalPoint()),


reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

view_up: Array.from(camera.getViewUp()),


reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

position: Array.from(camera.getPosition()),


reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

clipping_range: Array.from(camera.getClippingRange()),

}

export { importFile, importWorkflow }
async function importWorkflowFromSnapshot(items) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Expected a function expression.

}

export { importFile, importWorkflow }
async function importWorkflowFromSnapshot(items) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
async is not allowed

viewer_call: vi.fn(),
}))

beforeEach(async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
async is not allowed

},
}))
vi.mock("@/composables/api_fetch.js", () => ({
api_fetch: vi.fn(async (_req, options = {}) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
async is not allowed

}))
vi.stubGlobal(
"$fetch",
vi.fn(async () => ({ snapshot: {} })),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
async is not allowed

@@ -0,0 +1,129 @@
import { beforeEach, describe, expect, test, vi } from "vitest"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Filename should be in snake case

const response = {
_data: new Blob(["zipcontent"], { type: "application/zip" }),
headers: {
get: (k) => (k === "new-file-name" ? "project_123.zip" : null),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Do not use null literals

snapshot[storeId] = store.save()
savedCount++
snapshot[storeId] = store.exportStores()
exportCount++
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Unary operator '++' used.

store.load(snapshot[storeId])
loadedCount++
await store.importStores(snapshot[storeId])
importedCount++
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Unary operator '++' used.

}

function load(snapshot) {
async function importStores(snapshot) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
async is not allowed

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit


reported by reviewdog 🐶
Unexpected console statement.

console.warn("[DataStyle] setVisibility skipped: unknown id", id)


reported by reviewdog 🐶
Unexpected use of continue statement.

if (!style || !objectType) continue


reported by reviewdog 🐶
Use Object destructuring.

const object_type = meta.object_type


reported by reviewdog 🐶
Async function has no 'await' expression.

async function importStores(snapshot) {


reported by reviewdog 🐶
async is not allowed

async function importStores(snapshot) {


reported by reviewdog 🐶
async is not allowed

async function applyAllStylesFromState() {


reported by reviewdog 🐶
Optional chaining is not allowed.

const stylesSnapshot = snapshot?.styles || {}


reported by reviewdog 🐶
Optional chaining is not allowed.

const objectType = meta?.object_type


reported by reviewdog 🐶
Expected { after 'if' condition.

if (status.value !== Status.NOT_CREATED) return


reported by reviewdog 🐶
Expected { after 'if' condition.

if (is_moving.value) return


reported by reviewdog 🐶
Expected { after 'if' condition.


reported by reviewdog 🐶
Expected === and instead saw ==

if (event.button == 0) {


reported by reviewdog 🐶
Expected a function expression.

async function initHybridViewer() {


reported by reviewdog 🐶
Expected a function expression.

async function addItem(id) {


reported by reviewdog 🐶
Expected a function expression.

async function setVisibility(id, visibility) {


reported by reviewdog 🐶
Expected a function expression.

async function setZScaling(z_scale) {


reported by reviewdog 🐶
Expected a function expression.

function syncRemoteCamera() {


reported by reviewdog 🐶
Expected a function expression.

function remoteRender() {


reported by reviewdog 🐶
Expected a function expression.

function setContainer(container) {


reported by reviewdog 🐶
Expected a function expression.

async function resize(width, height) {


reported by reviewdog 🐶
Require for-in loops to include an if statement

for (const key in params.camera_options) {


reported by reviewdog 🐶
Identifier name is too short (< 2).

viewStream.onImageReady((e) => {


reported by reviewdog 🐶
Variable 'viewStream' should be initialized on declaration.


reported by reviewdog 🐶
The function has too many lines (205). Maximum allowed is 50.

export const useHybridViewerStore = defineStore("hybridViewer", () => {


reported by reviewdog 🐶
Unexpected console statement.

console.log("hybridViewerStore.addItem", { value })


reported by reviewdog 🐶
Unexpected console statement.

console.log("syncRemoteCamera")


reported by reviewdog 🐶
Unexpected console statement.

console.log("setContainer", container.value.$el)


reported by reviewdog 🐶
Unexpected console statement.

console.log("onPressed")


reported by reviewdog 🐶
Unexpected console statement.

console.log("onReleased")


reported by reviewdog 🐶
1.0

const zScale = ref(1.0)


reported by reviewdog 🐶
180

background: [180 / 255, 180 / 255, 180 / 255],


reported by reviewdog 🐶
255

background: [180 / 255, 180 / 255, 180 / 255],


reported by reviewdog 🐶
180

background: [180 / 255, 180 / 255, 180 / 255],


reported by reviewdog 🐶
255

background: [180 / 255, 180 / 255, 180 / 255],


reported by reviewdog 🐶
180

background: [180 / 255, 180 / 255, 180 / 255],


reported by reviewdog 🐶
255

background: [180 / 255, 180 / 255, 180 / 255],


reported by reviewdog 🐶
0

const polydata = reader.getOutputData(0)


reported by reviewdog 🐶
20

actor.getProperty().setColor(20 / 255, 20 / 255, 20 / 255)


reported by reviewdog 🐶
255

actor.getProperty().setColor(20 / 255, 20 / 255, 20 / 255)


reported by reviewdog 🐶
20

actor.getProperty().setColor(20 / 255, 20 / 255, 20 / 255)


reported by reviewdog 🐶
255

actor.getProperty().setColor(20 / 255, 20 / 255, 20 / 255)


reported by reviewdog 🐶
20

actor.getProperty().setColor(20 / 255, 20 / 255, 20 / 255)


reported by reviewdog 🐶
255

actor.getProperty().setColor(20 / 255, 20 / 255, 20 / 255)


reported by reviewdog 🐶
0

actor.setScale(scale[0], scale[1], z_scale)


reported by reviewdog 🐶
1

actor.setScale(scale[0], scale[1], z_scale)


reported by reviewdog 🐶
0

if (event.button == 0) {


reported by reviewdog 🐶
600


reported by reviewdog 🐶
Async function has no 'await' expression.

async function setVisibility(id, visibility) {


reported by reviewdog 🐶
Imports should be sorted alphabetically.

import vtkMapper from "@kitware/vtk.js/Rendering/Core/Mapper"


reported by reviewdog 🐶
Imports should be sorted alphabetically.

import vtkActor from "@kitware/vtk.js/Rendering/Core/Actor"


reported by reviewdog 🐶
Imports should be sorted alphabetically.

import Status from "@ogw_f/utils/status.js"


reported by reviewdog 🐶
Named exports are not allowed.

export const useHybridViewerStore = defineStore("hybridViewer", () => {


reported by reviewdog 🐶
Imported module should be assigned

import "@kitware/vtk.js/Rendering/Profiles/Geometry"


reported by reviewdog 🐶
Prefer default export on a file with single export.

export const useHybridViewerStore = defineStore("hybridViewer", () => {


reported by reviewdog 🐶
async is not allowed

async function initHybridViewer() {


reported by reviewdog 🐶
async is not allowed

async function addItem(id) {


reported by reviewdog 🐶
async is not allowed

async function setVisibility(id, visibility) {


reported by reviewdog 🐶
async is not allowed

async function setZScaling(z_scale) {


reported by reviewdog 🐶
async is not allowed

async function resize(width, height) {


reported by reviewdog 🐶
Optional chaining is not allowed.

const schema = viewer_schemas?.opengeodeweb_viewer?.viewer?.set_z_scaling


reported by reviewdog 🐶
Do not use Array#forEach

actors.forEach((actor) => {


reported by reviewdog 🐶
Do not use null literals


reported by reviewdog 🐶
Do not use null literals

let wheelEventEndTimeout = null


reported by reviewdog 🐶
Don't use a zero fraction in the number.

const zScale = ref(1.0)

return new Promise((resolve, reject) => {
if (!client) {
reject()
if (!client?.getConnection) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Optional chaining is not allowed.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit


reported by reviewdog 🐶
Identifier name is too short (< 2).

const n = a.map((x) => Number(x))


reported by reviewdog 🐶
Identifier name is too short (< 2).

return n.every((x) => Number.isFinite(x)) ? n : null


reported by reviewdog 🐶
Identifier name is too short (< 2).


reported by reviewdog 🐶
Identifier name is too short (< 2).

w: container.value?.$el?.offsetWidth,


reported by reviewdog 🐶
Identifier name is too short (< 2).

h: container.value?.$el?.offsetHeight,


reported by reviewdog 🐶
The async function importStores has too many lines (76). Maximum allowed is 50.

async function importStores(snapshot) {


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] initHybridViewer: status", status.value)


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] ws_connect done")


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] viewStream created (-1)")


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] onImageReady", {


reported by reviewdog 🐶
Unexpected console statement.


reported by reviewdog 🐶
Unexpected console statement.


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] addItem render done")


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] syncRemoteCamera")


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] camera raw", {


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] camera normalized", normalized)


reported by reviewdog 🐶
Unexpected console statement.


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] viewer.update_camera request", params)


reported by reviewdog 🐶
Unexpected console statement.


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] viewer.render request")


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] setContainer attach", {


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] bgImage style before", {


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] onPressed", {


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] onPressed applied", {


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] onReleased", {


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] onReleased -> syncRemoteCamera")


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] wheel", { bg_opacity: imageStyle.opacity })


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] wheel end -> syncRemoteCamera")


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] resize", {


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] resize applied", {


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] importStores snapshot camera", cam)


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] importStores normalized camera", {


reported by reviewdog 🐶
Unexpected console statement.


reported by reviewdog 🐶
Unexpected console statement.

console.log("[hybrid_viewer] importStores -> viewer.update_camera", {


reported by reviewdog 🐶
Do not use null comparisons without type-checking operators.

if (z_scale != null) {


reported by reviewdog 🐶
3

const fp = toNumArray(raw.focal_point, 3)


reported by reviewdog 🐶
3

const vu = toNumArray(raw.view_up, 3)


reported by reviewdog 🐶
3

const pos = toNumArray(raw.position, 3)


reported by reviewdog 🐶
2

const cr = toNumArray(raw.clipping_range, 2)


reported by reviewdog 🐶
3

const fp = toNumArray(cam.focal_point, 3)


reported by reviewdog 🐶
3

const vu = toNumArray(cam.view_up, 3)


reported by reviewdog 🐶
3

const pos = toNumArray(cam.position, 3)


reported by reviewdog 🐶
2

const cr = toNumArray(cam.clipping_range, 2)


reported by reviewdog 🐶
Catch parameter '_' is caught but never used.


reported by reviewdog 🐶
async is not allowed

async function importStores(snapshot) {


reported by reviewdog 🐶
Optional chaining is not allowed.

image: typeof e?.image,


reported by reviewdog 🐶
Optional chaining is not allowed.

polydata?.getBounds?.(),


reported by reviewdog 🐶
Optional chaining is not allowed.

el: container.value?.$el,


reported by reviewdog 🐶
Optional chaining is not allowed.

w: container.value?.$el?.offsetWidth,


reported by reviewdog 🐶
Optional chaining is not allowed.

h: container.value?.$el?.offsetHeight,


reported by reviewdog 🐶
Optional chaining is not allowed.

const renderer = genericRenderWindow.value?.getRenderer?.()


reported by reviewdog 🐶
Optional chaining is not allowed.

const camera = renderer?.getActiveCamera?.()


reported by reviewdog 🐶
Optional chaining is not allowed.

const z_scale = snapshot?.zScale


reported by reviewdog 🐶
Optional chaining is not allowed.

const cam = snapshot?.camera_options


reported by reviewdog 🐶
Function toNumArray does not capture any variables from its parent scope

function toNumArray(arrLike, expectedLen) {


reported by reviewdog 🐶
Do not use Array#forEach

actors.forEach((actor) => renderer.removeActor(actor))


reported by reviewdog 🐶
Do not use Array#forEach

Object.keys(db).forEach((id) => delete db[id])


reported by reviewdog 🐶
Do not use null literals

if (a.length !== expectedLen) return null


reported by reviewdog 🐶
Do not use null literals

return n.every((x) => Number.isFinite(x)) ? n : null


reported by reviewdog 🐶
Do not use null literals


reported by reviewdog 🐶
Do not use null literals

if (z_scale != null) {


reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

const a = Array.from(arrLike ?? [])


reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

focal_point: Array.from(camera.getFocalPoint()),


reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

view_up: Array.from(camera.getViewUp()),


reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

position: Array.from(camera.getPosition()),


reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

clipping_range: Array.from(camera.getClippingRange()),


reported by reviewdog 🐶
The function is equivalent to Number. Call Number directly.

const n = a.map((x) => Number(x))


reported by reviewdog 🐶
Prefer omitting the catch binding parameter if it is unused

}

export { importFile, importWorkflow }
async function importWorkflowFromSnapshot(items) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
The async function importWorkflowFromSnapshot has too many lines (69). Maximum allowed is 50.

displayed_name: item.displayed_name,
})

await dataBaseStore.registerObject(item.id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Unexpected await inside a loop.

await dataBaseStore.registerObject(item.id)
console.log("[importWorkflowFromSnapshot] registerObject ok", item.id)

await dataBaseStore.addItem(item.id, {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Unexpected await inside a loop.

})
console.log("[importWorkflowFromSnapshot] addItem ok", item.id)

await treeviewStore.addItem(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Unexpected await inside a loop.

)
console.log("[importWorkflowFromSnapshot] treeview.addItem ok", item.id)

await hybridViewerStore.addItem(item.id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Unexpected await inside a loop.

}

await dataStyleStore.applyDefaultStyle(item.id)
console.log(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Unexpected console statement.

ids.push(item.id)
}
hybridViewerStore.remoteRender()
console.log("[importWorkflowFromSnapshot] remoteRender called")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Unexpected console statement.

}
hybridViewerStore.remoteRender()
console.log("[importWorkflowFromSnapshot] remoteRender called")
console.log("[importWorkflowFromSnapshot] done", { ids })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Unexpected console statement.

return ids
}

export { importFile, importWorkflow, importWorkflowFromSnapshot }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Named exports are not allowed.


export { importFile, importWorkflow }
async function importWorkflowFromSnapshot(items) {
console.log("[importWorkflowFromSnapshot] start", { count: items?.length })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Optional chaining is not allowed.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit


reported by reviewdog 🐶
Optional chaining is not allowed.

const renderer = genericRenderWindow.value?.getRenderer?.()


reported by reviewdog 🐶
Optional chaining is not allowed.

const camera = renderer?.getActiveCamera?.()


reported by reviewdog 🐶
Optional chaining is not allowed.

const z_scale = snapshot?.zScale


reported by reviewdog 🐶
Optional chaining is not allowed.

const cam = snapshot?.camera_options


reported by reviewdog 🐶
Function sanitizeCameraOptions does not capture any variables from its parent scope

function sanitizeCameraOptions(opts) {


reported by reviewdog 🐶
Function toNums does not capture any variables from its parent scope

function sanitizeCameraOptions(opts) {


reported by reviewdog 🐶
Function logCameraOptions does not capture any variables from its parent scope

function logCameraOptions(label, opts) {


reported by reviewdog 🐶
Function types does not capture any variables from its parent scope

function logCameraOptions(label, opts) {


reported by reviewdog 🐶
Do not use Array#forEach

actors.forEach((actor) => renderer.removeActor(actor))


reported by reviewdog 🐶
Do not use Array#forEach

Object.keys(db).forEach((id) => delete db[id])


reported by reviewdog 🐶
Do not use null literals

if (!opts) return null


reported by reviewdog 🐶
Do not use null literals

if (z_scale != null) {


reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

Array.from(arr || [])


reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

const types = (arr) => Array.from(arr || []).map((v) => typeof v)


reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

focal_point: Array.from(camera.getFocalPoint()),


reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

view_up: Array.from(camera.getViewUp()),


reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

position: Array.from(camera.getPosition()),


reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

clipping_range: Array.from(camera.getClippingRange()),


reported by reviewdog 🐶
The function is equivalent to Number. Call Number directly.

.map((n) => Number(n))

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit


reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

view_up: Array.from(camera.getViewUp()),


reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

position: Array.from(camera.getPosition()),


reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

clipping_range: Array.from(camera.getClippingRange()),


reported by reviewdog 🐶
Expected { after 'if' condition.

if (!item) continue


reported by reviewdog 🐶
Expected a function expression.

function exportStores() {


reported by reviewdog 🐶
Expected a function expression.

async function importStores(snapshot) {


reported by reviewdog 🐶
Expected a function expression.

function clear() {


reported by reviewdog 🐶
Unexpected await inside a loop.

await registerObject(id)


reported by reviewdog 🐶
Unexpected await inside a loop.

await addItem(id, item)


reported by reviewdog 🐶
Unexpected console statement.


reported by reviewdog 🐶
Unexpected use of continue statement.

if (!item) continue


reported by reviewdog 🐶
async is not allowed

async function importStores(snapshot) {


reported by reviewdog 🐶
Optional chaining is not allowed.

binary_light_viewable: item?.vtk_js?.binary_light_viewable,


reported by reviewdog 🐶
Optional chaining is not allowed.

Object.keys(snapshot?.db || {}),


reported by reviewdog 🐶
Optional chaining is not allowed.

for (const [id, item] of Object.entries(snapshot?.db || {})) {

import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
import fileDownload from "js-file-download"

export function useProjectManager() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
The function useProjectManager has too many lines (97). Maximum allowed is 50.

}
}

async function importProjectFile(file) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
The async function importProjectFile has too many lines (66). Maximum allowed is 50.

return { exportProject, importProjectFile }
}

export default useProjectManager
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Prefer named exports


const schemaImport = back_schemas.opengeodeweb_back.import_project
const form = new FormData()
form.append("file", file, file?.name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Optional chaining is not allowed.

method: "POST",
body: form,
})
const snapshot = result?.snapshot ?? {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Optional chaining is not allowed.

}

async function importStores(snapshot) {
const z_scale = snapshot?.zScale
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Optional chaining is not allowed.

function clear() {
const renderer = genericRenderWindow.value.getRenderer()
const actors = renderer.getActors()
actors.forEach((actor) => renderer.removeActor(actor))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Do not use Array#forEach

const actors = renderer.getActors()
actors.forEach((actor) => renderer.removeActor(actor))
genericRenderWindow.value.getRenderWindow().render()
Object.keys(db).forEach((id) => delete db[id])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Do not use Array#forEach


async function importStores(snapshot) {
const z_scale = snapshot?.zScale
if (z_scale != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Do not use null literals

const camera = renderer?.getActiveCamera?.()
const cameraSnapshot = camera
? {
focal_point: Array.from(camera.getFocalPoint()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit


reported by reviewdog 🐶
Unexpected await inside a loop.

await registerObject(id)


reported by reviewdog 🐶
Unexpected await inside a loop.

await addItem(id, item)


reported by reviewdog 🐶
Unexpected console statement.


reported by reviewdog 🐶
Unexpected use of continue statement.

if (!item) continue


reported by reviewdog 🐶
async is not allowed

async function importStores(snapshot) {


reported by reviewdog 🐶
Optional chaining is not allowed.

binary_light_viewable: item?.vtk_js?.binary_light_viewable,


reported by reviewdog 🐶
Optional chaining is not allowed.

Object.keys(snapshot?.db || {}),


reported by reviewdog 🐶
Optional chaining is not allowed.

for (const [id, item] of Object.entries(snapshot?.db || {})) {

const lines_defaultColor = { r: 20, g: 20, b: 20 }
const surfaces_defaultVisibility = true
const surfaces_defaultColor = { r: 20, g: 20, b: 20 }
const surfaces_defaultColor = { r: 255, g: 255, b: 255 }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Identifier name is too short (< 2).

const lines_defaultColor = { r: 20, g: 20, b: 20 }
const surfaces_defaultVisibility = true
const surfaces_defaultColor = { r: 20, g: 20, b: 20 }
const surfaces_defaultColor = { r: 255, g: 255, b: 255 }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Identifier name is too short (< 2).

const lines_defaultColor = { r: 20, g: 20, b: 20 }
const surfaces_defaultVisibility = true
const surfaces_defaultColor = { r: 20, g: 20, b: 20 }
const surfaces_defaultColor = { r: 255, g: 255, b: 255 }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Identifier name is too short (< 2).

const surfaces_defaultColor = { r: 255, g: 255, b: 255 }
const blocks_defaultVisibility = true
const blocks_defaultColor = { r: 20, g: 20, b: 20 }
const blocks_defaultColor = { r: 255, g: 255, b: 255 }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Identifier name is too short (< 2).

const surfaces_defaultColor = { r: 255, g: 255, b: 255 }
const blocks_defaultVisibility = true
const blocks_defaultColor = { r: 20, g: 20, b: 20 }
const blocks_defaultColor = { r: 255, g: 255, b: 255 }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Identifier name is too short (< 2).

view_up: Array.from(camera.getViewUp()),
position: Array.from(camera.getPosition()),
view_angle: camera.getViewAngle(),
clipping_range: Array.from(camera.getClippingRange()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Prefer the spread operator (...) over Array.from()

function exportStores() {
const snapshotDb = {}
for (const [id, item] of Object.entries(db)) {
if (!item) continue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Expected { after 'if' condition.

return flat_indexes
}

function exportStores() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Expected a function expression.

return { db: snapshotDb }
}

async function importStores(snapshot) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Expected a function expression.

}
}

function clear() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Expected a function expression.

}

const camera_options = snapshot?.camera_options
if (!camera_options) return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Expected { after 'if' condition.

await setZScaling(z_scale)
}

const camera_options = snapshot?.camera_options
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Optional chaining is not allowed.

Object.keys(snapshot?.db || {}),
)
for (const [id, item] of Object.entries(snapshot?.db || {})) {
await registerObject(id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Unexpected await inside a loop.

)
for (const [id, item] of Object.entries(snapshot?.db || {})) {
await registerObject(id)
await addItem(id, item)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Unexpected await inside a loop.

async function importStores(snapshot) {
await hybridViewerStore.initHybridViewer()
hybridViewerStore.clear()
console.log(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Unexpected console statement.

function exportStores() {
const snapshotDb = {}
for (const [id, item] of Object.entries(db)) {
if (!item) continue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Unexpected use of continue statement.

return { db: snapshotDb }
}

async function importStores(snapshot) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
async is not allowed

viewable_filename: item.viewable_filename,
displayed_name: item.displayed_name,
vtk_js: {
binary_light_viewable: item?.vtk_js?.binary_light_viewable,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Optional chaining is not allowed.

hybridViewerStore.clear()
console.log(
"[DataBase] importStores entries:",
Object.keys(snapshot?.db || {}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Optional chaining is not allowed.

"[DataBase] importStores entries:",
Object.keys(snapshot?.db || {}),
)
for (const [id, item] of Object.entries(snapshot?.db || {})) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Optional chaining is not allowed.

async function importStores(snapshot) {
const stylesSnapshot = snapshot?.styles || {}
for (const id of Object.keys(dataStyleState.styles))
delete dataStyleState.styles[id]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Expected { after 'for-of'.

const meta = dataBaseStore.itemMetaDatas(id)
const objectType = meta?.object_type
const style = dataStyleState.styles[id]
if (!style || !objectType) continue
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Expected { after 'if' condition.

return Promise.resolve([])
}

function setModelEdgesVisibility(id, visibility) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Expected a function expression.

return modelStyleStore.setModelEdgesVisibility(id, visibility)
}

function modelEdgesVisibility(id) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Expected a function expression.

return modelStyleStore.modelEdgesVisibility(id)
}

function exportStores() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Expected a function expression.

import useDataStyleState from "../internal_stores/data_style_state.js"
import useMeshStyle from "../internal_stores/mesh/index.js"
import useModelStyle from "../internal_stores/model/index.js"
import { getDefaultStyle } from "../utils/default_styles.js"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Imports should be sorted alphabetically.

return { styles: dataStyleState.styles }
}

async function importStores(snapshot) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
async is not allowed

}
}

async function applyAllStylesFromState() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
async is not allowed

}

async function importStores(snapshot) {
const stylesSnapshot = snapshot?.styles || {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Optional chaining is not allowed.

const ids = Object.keys(dataStyleState.styles || {})
for (const id of ids) {
const meta = dataBaseStore.itemMetaDatas(id)
const objectType = meta?.object_type
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reported by reviewdog 🐶
Optional chaining is not allowed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants