Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ venv
__snapshots__
coverage
*.db
package-lock.json
package-lock.json
VTK.txt
15 changes: 3 additions & 12 deletions utils/file_import_workflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,87 +4,78 @@

// Local imports

async function importWorkflow(files) {

Check warning on line 7 in utils/file_import_workflow.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(require-await)

Async function has no 'await' expression.
console.log("importWorkflow", { files })

Check failure on line 8 in utils/file_import_workflow.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(no-console)

Unexpected console statement.
const promise_array = []
for (const file of files) {
const { filename, geode_object } = file
console.log({ filename }, { geode_object })

Check failure on line 12 in utils/file_import_workflow.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(no-console)

Unexpected console statement.
promise_array.push(importFile(filename, geode_object))
}
return Promise.all(promise_array)
}

Check failure on line 16 in utils/file_import_workflow.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(func-style)

Expected a function expression.

function buildImportItemFromPayloadApi(value, geode_object) {
return {
id: value.id,
object_type: value.object_type,
geode_object,
native_filename: value.native_file_name,
viewable_filename: value.viewable_file_name,
displayed_name: value.name,
vtk_js: { binary_light_viewable: value.binary_light_viewable },
}
}

Check failure on line 28 in utils/file_import_workflow.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(func-style)

Expected a function expression.

async function importItem(item) {
const dataBaseStore = useDataBaseStore()
const dataStyleStore = useDataStyleStore()
const hybridViewerStore = useHybridViewerStore()
const treeviewStore = useTreeviewStore()
await dataBaseStore.registerObject(item.id)
await dataBaseStore.addItem(item.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: item.vtk_js,
...item,
})

await treeviewStore.addItem(
item.geode_object,
item.displayed_name,
item.id,
item.object_type,
)

await hybridViewerStore.addItem(item.id)
await dataStyleStore.addDataStyle(item.id, item.geode_object)

if (item.object_type === "model") {
await Promise.all([
dataBaseStore.fetchMeshComponents(item.id),
dataBaseStore.fetchUuidToFlatIndexDict(item.id),
])
}

await dataStyleStore.applyDefaultStyle(item.id)
hybridViewerStore.remoteRender()
return item.id
}

Check failure on line 60 in utils/file_import_workflow.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(func-style)

Expected a function expression.

async function importFile(filename, geode_object) {
const { data } = await api_fetch({
schema: back_schemas.opengeodeweb_back.save_viewable_file,
params: {
input_geode_object: geode_object,
filename: filename,
},
})

console.log("data.value", data.value)

Check failure on line 71 in utils/file_import_workflow.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(no-console)

Unexpected console statement.

const item = buildImportItemFromPayloadApi(data._value, geode_object)
return importItem(item)
}

Check failure on line 75 in utils/file_import_workflow.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(func-style)

Expected a function expression.

async function importItemFromSnapshot(item) {
return importItem(item)
}

async function importWorkflowFromSnapshot(items) {
console.log("[importWorkflowFromSnapshot] start", { count: items?.length })

Check failure on line 78 in utils/file_import_workflow.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(no-console)

Unexpected console statement.
const dataBaseStore = useDataBaseStore()
const treeviewStore = useTreeviewStore()
const dataStyleStore = useDataStyleStore()
Expand All @@ -92,7 +83,7 @@

const ids = []
for (const item of items) {
const id = await importItemFromSnapshot(
const id = await importItem(

Check failure on line 86 in utils/file_import_workflow.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(no-await-in-loop)

Unexpected `await` inside a loop.
item,
dataBaseStore,
treeviewStore,
Expand All @@ -106,4 +97,4 @@
return ids
}

Check failure on line 98 in utils/file_import_workflow.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(func-style)

Expected a function expression.

export { importFile, importWorkflow, importWorkflowFromSnapshot }
export { importFile, importWorkflow, importWorkflowFromSnapshot, importItem }
Loading