-
+
Inspect
diff --git a/app/components/Launcher.vue b/app/components/Launcher.vue
index b85f3f57..297bb88b 100644
--- a/app/components/Launcher.vue
+++ b/app/components/Launcher.vue
@@ -1,7 +1,7 @@
+
-
-
diff --git a/app/components/Step.vue b/app/components/Step.vue
index da379e80..b95b4c9b 100644
--- a/app/components/Step.vue
+++ b/app/components/Step.vue
@@ -10,6 +10,8 @@
step_index: { type: Number, required: true },
})
+ const emit = defineEmits(["reset_values"])
+
const stepper_tree = inject("stepper_tree")
const { current_step_index, steps } = toRefs(stepper_tree)
@@ -98,7 +100,7 @@
@increment_step="increment_step"
@decrement_step="decrement_step"
@update_values="update_values_event"
- @reset_values="$emit('reset_values')"
+ @reset_values="emit('reset_values')"
/>
diff --git a/app/components/Viewer/ContextMenu.vue b/app/components/Viewer/ContextMenu.vue
index c1b58a02..43b6d2bf 100644
--- a/app/components/Viewer/ContextMenu.vue
+++ b/app/components/Viewer/ContextMenu.vue
@@ -36,10 +36,10 @@
watch(
() => [x, y],
([newX, newY]) => {
- const { x, y } = clampPosition(newX, newY)
- menuX.value = x
- menuY.value = y
- menuStore.setMenuPosition(x, y)
+ const { x: clampedX, y: clampedY } = clampPosition(newX, newY)
+ menuX.value = clampedX
+ menuY.value = clampedY
+ menuStore.setMenuPosition(clampedX, clampedY)
},
{ immediate: true },
)
@@ -81,22 +81,22 @@
event.preventDefault()
}
- function clampPosition(x, y) {
+ function clampPosition(posX, posY) {
const margin = RADIUS + MARGIN_OFFSET
return {
- x: Math.min(Math.max(x, margin), containerWidth - margin),
- y: Math.min(Math.max(y, margin), containerHeight - margin),
+ x: Math.min(Math.max(posX, margin), containerWidth - margin),
+ y: Math.min(Math.max(posY, margin), containerHeight - margin),
}
}
function handleDrag(event) {
- const { x, y } = clampPosition(
+ const { x: clampedX, y: clampedY } = clampPosition(
event.clientX - dragStartX.value,
event.clientY - dragStartY.value,
)
- menuX.value = x
- menuY.value = y
- menuStore.setMenuPosition(x, y)
+ menuX.value = clampedX
+ menuY.value = clampedY
+ menuStore.setMenuPosition(clampedX, clampedY)
}
function stopDrag(event) {
diff --git a/app/components/Viewer/ContextMenuItem.vue b/app/components/Viewer/ContextMenuItem.vue
index 709ea80e..78583635 100644
--- a/app/components/Viewer/ContextMenuItem.vue
+++ b/app/components/Viewer/ContextMenuItem.vue
@@ -1,7 +1,7 @@
@@ -33,7 +29,7 @@
icon="mdi-arrow-left-right"
size="x-small"
variant="text"
- @click="reset"
+ @click="emit('reset')"
v-tooltip="'Reset range'"
/>
diff --git a/app/components/Viewer/Options/ColorMapList.vue b/app/components/Viewer/Options/ColorMapList.vue
index 816917a3..dcfcb968 100644
--- a/app/components/Viewer/Options/ColorMapList.vue
+++ b/app/components/Viewer/Options/ColorMapList.vue
@@ -55,12 +55,10 @@
if (!preset || !preset.RGBPoints) {
return
}
-
const ctx = canvas.getContext("2d")
const { height, width } = canvas
const lut = vtkColorTransferFunction()
const rgbPoints = preset.RGBPoints
-
for (let pointIdx = 0; pointIdx < rgbPoints.length; pointIdx += 4) {
lut.addRGBPoint(
rgbPoints[pointIdx],
@@ -69,7 +67,6 @@
rgbPoints[pointIdx + THREE],
)
}
-
const table = lut.getUint8Table(
rgbPoints[0],
rgbPoints.at(-LAST_POINT_OFFSET),
@@ -77,7 +74,6 @@
true,
)
const imageData = ctx.createImageData(width, height)
-
for (let xCoord = 0; xCoord < width; xCoord += 1) {
const alpha = table[xCoord * 4 + THREE],
blue = table[xCoord * 4 + 2],
@@ -180,7 +176,7 @@
@@ -202,7 +198,7 @@
diff --git a/app/components/Viewer/Options/ColorMapPicker.vue b/app/components/Viewer/Options/ColorMapPicker.vue
index d70b9eeb..87651175 100644
--- a/app/components/Viewer/Options/ColorMapPicker.vue
+++ b/app/components/Viewer/Options/ColorMapPicker.vue
@@ -120,9 +120,9 @@
watch([lutCanvas, selectedPresetName, () => min, () => max], drawLutCanvas)
watch(
() => modelValue,
- (nv) => {
- if (nv !== selectedPresetName.value) {
- selectedPresetName.value = nv
+ (newValue) => {
+ if (newValue !== selectedPresetName.value) {
+ selectedPresetName.value = newValue
}
},
)
diff --git a/app/components/Viewer/Options/ColoringTypeSelector.vue b/app/components/Viewer/Options/ColoringTypeSelector.vue
index b3fdef78..4a140cf6 100644
--- a/app/components/Viewer/Options/ColoringTypeSelector.vue
+++ b/app/components/Viewer/Options/ColoringTypeSelector.vue
@@ -58,7 +58,7 @@
value: "polyhedron",
}
const coloring_styles = computed(() => {
- let array = []
+ const array = []
if (has_color.value) {
array.push(color_dict)
}
diff --git a/app/components/Viewer/Options/TextureItem.vue b/app/components/Viewer/Options/TextureItem.vue
index c04bf6ea..054e90f4 100644
--- a/app/components/Viewer/Options/TextureItem.vue
+++ b/app/components/Viewer/Options/TextureItem.vue
@@ -37,7 +37,7 @@
}
async function files_uploaded_event(value) {
- if (value.length) {
+ if (value.length > 0) {
await geodeStore.request(
back_schemas.opengeodeweb_back.save_viewable_file,
{
@@ -48,7 +48,7 @@
},
},
{
- response_function: async (response) => {
+ response_function: (response) => {
texture_id.value = response.id
},
},
diff --git a/app/components/Viewer/Options/TexturesSelector.vue b/app/components/Viewer/Options/TexturesSelector.vue
index 7f125f34..31a303cd 100644
--- a/app/components/Viewer/Options/TexturesSelector.vue
+++ b/app/components/Viewer/Options/TexturesSelector.vue
@@ -10,10 +10,10 @@
const internal_textures = ref([])
onMounted(() => {
- if (textures.value !== null) {
- internal_textures.value = textures.value
- } else {
+ if (textures.value === null) {
internal_textures.value = [{ id: "", texture_name: "" }]
+ } else {
+ internal_textures.value = textures.value
}
})
@@ -22,7 +22,7 @@
const filtered = internal_textures.value.filter(
(texture) => texture.texture_name !== "" && texture.id !== "",
)
- if (filtered.length !== 0) {
+ if (filtered.length > 0) {
textures.value = filtered
}
}
diff --git a/app/components/Viewer/Tree/ObjectTree.vue b/app/components/Viewer/Tree/ObjectTree.vue
index 6eeba20f..57ae2ed5 100644
--- a/app/components/Viewer/Tree/ObjectTree.vue
+++ b/app/components/Viewer/Tree/ObjectTree.vue
@@ -9,15 +9,11 @@
const treeviewStore = useTreeviewStore()
const emit = defineEmits(["show-menu"])
- function handleTreeMenu({ event, itemId }) {
- emit("show-menu", { event, itemId })
- }
-
function onResizeStart(event) {
const startWidth = treeviewStore.panelWidth
const startX = event.clientX
- function resize(event) {
- const deltaX = event.clientX - startX
+ function resize(move_event) {
+ const deltaX = move_event.clientX - startX
const newWidth = Math.max(
WIDTH_MIN,
Math.min(startWidth + deltaX, window.innerWidth),
@@ -60,11 +56,11 @@
diff --git a/app/components/ZScaling.vue b/app/components/ZScaling.vue
index 45d8ef56..b79c020e 100644
--- a/app/components/ZScaling.vue
+++ b/app/components/ZScaling.vue
@@ -5,6 +5,8 @@
const { width } = defineProps({
width: { type: Number, default: 400 },
})
+
+ const emit = defineEmits(["close"])
- Close
- Close
+ Apply
diff --git a/app/composables/project_manager.js b/app/composables/project_manager.js
index 39c7d8ad..120fc82a 100644
--- a/app/composables/project_manager.js
+++ b/app/composables/project_manager.js
@@ -108,5 +108,3 @@ export function useProjectManager() {
return { exportProject, importProjectFile }
}
-
-export default useProjectManager
diff --git a/app/composables/run_function_when_microservices_connected.js b/app/composables/run_function_when_microservices_connected.js
index a261a03a..62ffc49e 100644
--- a/app/composables/run_function_when_microservices_connected.js
+++ b/app/composables/run_function_when_microservices_connected.js
@@ -14,5 +14,3 @@ export function run_function_when_microservices_connected(function_to_run) {
})
}
}
-
-export default run_function_when_microservices_connected
diff --git a/app/stores/data.js b/app/stores/data.js
index 92a7e1ff..7c23ceef 100644
--- a/app/stores/data.js
+++ b/app/stores/data.js
@@ -1,6 +1,6 @@
// Third party imports
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
-import { database } from "../../internal/database/database.js"
+import { database } from "@ogw_internal/database/database.js"
import { liveQuery } from "dexie"
import { useObservable } from "@vueuse/rxjs"
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
@@ -42,13 +42,15 @@ export const useDataStore = defineStore("data", () => {
Block: "Blocks",
}
- const componentsByType = items.reduce((accumulator, item) => {
- if (componentTitles[item.type]) {
- if (!accumulator[item.type]) accumulator[item.type] = []
- accumulator[item.type].push(item)
+ const componentsByType = {}
+ for (const component_item of items) {
+ if (componentTitles[component_item.type]) {
+ if (!componentsByType[component_item.type]) {
+ componentsByType[component_item.type] = []
+ }
+ componentsByType[component_item.type].push(component_item)
}
- return accumulator
- }, {})
+ }
return Object.keys(componentTitles)
.filter((type) => componentsByType[type])
@@ -124,21 +126,21 @@ export const useDataStore = defineStore("data", () => {
response_function: async (response) => {
const allComponents = [
...response.mesh_components.map(
- ({ boundaries, internals, ...component }) => component,
+ ({ _boundaries, _internals, ...component }) => component,
),
...response.collection_components.map(
- ({ items, ...component }) => component,
+ ({ _items, ...component }) => component,
),
- ].map((component) => ({ ...component, id }))
+ ].map((component) => Object.assign(component, { id }))
await addModelComponents(allComponents)
},
},
)
}
- async function getMeshComponentGeodeIds(id, meshComponentType) {
+ async function getMeshComponentGeodeIds(id, component_type) {
const components = await database.model_components
- .where({ id, type: meshComponentType })
+ .where({ id, type: component_type })
.toArray()
return components.map((component) => component.geode_id)
}
diff --git a/app/stores/data_style.js b/app/stores/data_style.js
index 059c1f73..f111b818 100644
--- a/app/stores/data_style.js
+++ b/app/stores/data_style.js
@@ -1,9 +1,9 @@
+import { database } from "@ogw_internal/database/database.js"
import { getDefaultStyle } from "@ogw_front/utils/default_styles"
-import { database } from "../../internal/database/database.js"
import { useDataStore } from "@ogw_front/stores/data"
-import { useDataStyleStateStore } from "../../internal/stores/data_style/state"
-import useMeshStyle from "../../internal/stores/data_style/mesh/index"
-import useModelStyle from "../../internal/stores/data_style/model/index"
+import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state"
+import { useMeshStyle } from "@ogw_internal/stores/data_style/mesh/index"
+import { useModelStyle } from "@ogw_internal/stores/data_style/model/index"
export const useDataStyleStore = defineStore("dataStyle", () => {
const dataStyleState = useDataStyleStateStore()
@@ -61,19 +61,19 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
}
}
- async function applyAllStylesFromState() {
+ function applyAllStylesFromState() {
const ids = Object.keys(dataStyleState.styles || {})
- const promises = []
- for (const id of ids) {
+ 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") {
- promises.push(meshStyleStore.applyMeshStyle(id))
- } else if (style && viewerType === "model") {
- promises.push(modelStyleStore.applyModelStyle(id))
+ return meshStyleStore.applyMeshStyle(id)
}
- }
+ if (style && viewerType === "model") {
+ return modelStyleStore.applyModelStyle(id)
+ }
+ })
return Promise.all(promises)
}
diff --git a/app/stores/geode.js b/app/stores/geode.js
index 7970713c..173a79a2 100644
--- a/app/stores/geode.js
+++ b/app/stores/geode.js
@@ -1,5 +1,5 @@
-import Status from "@ogw_front/utils/status"
-import { api_fetch } from "../../internal/utils/api_fetch"
+import { Status } from "@ogw_front/utils/status"
+import { api_fetch } from "@ogw_internal/utils/api_fetch"
import { appMode } from "@ogw_front/utils/app_mode"
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
import { useFeedbackStore } from "@ogw_front/stores/feedback"
diff --git a/app/stores/hybrid_viewer.js b/app/stores/hybrid_viewer.js
index 6ac88356..7ea243ce 100644
--- a/app/stores/hybrid_viewer.js
+++ b/app/stores/hybrid_viewer.js
@@ -5,9 +5,8 @@ import { newInstance as vtkGenericRenderWindow } from "@kitware/vtk.js/Rendering
import { newInstance as vtkMapper } from "@kitware/vtk.js/Rendering/Core/Mapper"
import { newInstance as vtkXMLPolyDataReader } from "@kitware/vtk.js/IO/XML/XMLPolyDataReader"
-import Status from "@ogw_front/utils/status"
-import { database } from "../../internal/database/database.js"
-import { useDataStore } from "@ogw_front/stores/data"
+import { Status } from "@ogw_front/utils/status"
+import { database } from "@ogw_internal/database/database.js"
import { useViewerStore } from "@ogw_front/stores/viewer"
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
@@ -28,7 +27,6 @@ const WHEEL_TIME_OUT_MS = 600
export const useHybridViewerStore = defineStore("hybridViewer", () => {
const viewerStore = useViewerStore()
- const dataStore = useDataStore()
const hybridDb = reactive({})
const status = ref(Status.NOT_CREATED)
const camera_options = reactive({})
@@ -36,7 +34,7 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
const is_moving = ref(false)
const zScale = ref(1)
let viewStream = undefined
- let gridActor = undefined
+ const gridActor = undefined
async function initHybridViewer() {
if (status.value !== Status.NOT_CREATED) {
@@ -60,9 +58,6 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
if (is_moving.value) {
return
}
- const webGLRenderWindow =
- genericRenderWindow.value.getApiSpecificRenderWindow()
- const imageStyle = webGLRenderWindow.getReferenceByName("bgImage").style
webGLRenderWindow.setBackgroundImage(event.image)
imageStyle.opacity = 1
})
@@ -126,7 +121,6 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
if (!schema) {
return
}
- const viewerStore = useViewerStore()
await viewerStore.request(schema, {
z_scale,
})
@@ -147,7 +141,6 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
distance: camera.getDistance(),
},
}
- const viewerStore = useViewerStore()
viewerStore.request(
viewer_schemas.opengeodeweb_viewer.viewer.update_camera,
params,
@@ -165,7 +158,6 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
}
function remoteRender() {
- const viewerStore = useViewerStore()
return viewerStore.request(viewer_schemas.opengeodeweb_viewer.viewer.render)
}
@@ -256,32 +248,31 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
const z_scale = snapshot.zScale
function applyCamera() {
- const { camera_options } = snapshot
- if (!camera_options) {
+ const { camera_options: snapshot_camera_options } = snapshot
+ if (!snapshot_camera_options) {
return
}
const renderer = genericRenderWindow.value.getRenderer()
const camera = renderer.getActiveCamera()
- camera.setFocalPoint(...camera_options.focal_point)
- camera.setViewUp(...camera_options.view_up)
- camera.setPosition(...camera_options.position)
- camera.setViewAngle(camera_options.view_angle)
- camera.setClippingRange(...camera_options.clipping_range)
+ camera.setFocalPoint(...snapshot_camera_options.focal_point)
+ camera.setViewUp(...snapshot_camera_options.view_up)
+ camera.setPosition(...snapshot_camera_options.position)
+ camera.setViewAngle(snapshot_camera_options.view_angle)
+ camera.setClippingRange(...snapshot_camera_options.clipping_range)
genericRenderWindow.value.getRenderWindow().render()
const payload = {
camera_options: {
- focal_point: [...camera_options.focal_point],
- view_up: [...camera_options.view_up],
- position: [...camera_options.position],
- view_angle: camera_options.view_angle,
- clipping_range: [...camera_options.clipping_range],
+ focal_point: [...snapshot_camera_options.focal_point],
+ view_up: [...snapshot_camera_options.view_up],
+ position: [...snapshot_camera_options.position],
+ view_angle: snapshot_camera_options.view_angle,
+ clipping_range: [...snapshot_camera_options.clipping_range],
},
}
- const viewerStore = useViewerStore()
return viewerStore.request(
viewer_schemas.opengeodeweb_viewer.viewer.update_camera,
payload,
diff --git a/app/stores/infra.js b/app/stores/infra.js
index eafb9af8..9314dd97 100644
--- a/app/stores/infra.js
+++ b/app/stores/infra.js
@@ -1,5 +1,5 @@
import { appMode, getAppMode } from "@ogw_front/utils/app_mode"
-import Status from "@ogw_front/utils/status"
+import { Status } from "@ogw_front/utils/status"
import { useLambdaStore } from "@ogw_front/stores/lambda"
export const useInfraStore = defineStore("infra", {
@@ -32,7 +32,11 @@ export const useInfraStore = defineStore("infra", {
const store_name = store.$id
console.log("[INFRA] Registering microservice:", store_name)
- if (!this.microservices.find((store) => store.$id === store_name)) {
+ if (
+ !this.microservices.find(
+ (microservice) => microservice.$id === store_name,
+ )
+ ) {
this.microservices.push(store)
console.log("[INFRA] Microservice registered:", store_name)
}
diff --git a/app/stores/lambda.js b/app/stores/lambda.js
index 1bcb07cd..d5e59744 100644
--- a/app/stores/lambda.js
+++ b/app/stores/lambda.js
@@ -1,4 +1,4 @@
-import Status from "@ogw_front/utils/status"
+import { Status } from "@ogw_front/utils/status"
import { useFeedbackStore } from "@ogw_front/stores/feedback"
export const useLambdaStore = defineStore("lambda", {
diff --git a/app/stores/menu.js b/app/stores/menu.js
index 747c1943..910da4f5 100644
--- a/app/stores/menu.js
+++ b/app/stores/menu.js
@@ -21,10 +21,9 @@ import Grid2DEdgesOptions from "@ogw_front/components/Viewer/Grid/2D/EdgesOption
import Grid2DPointsOptions from "@ogw_front/components/Viewer/Grid/2D/PointsOptions"
// Grid 3D components
+import Grid3DCellsOptions from "@ogw_front/components/Viewer/Grid/3D/CellsOptions"
import Grid3DEdgesOptions from "@ogw_front/components/Viewer/Grid/3D/EdgesOptions"
import Grid3DPointsOptions from "@ogw_front/components/Viewer/Grid/3D/PointsOptions"
-// import Grid3DFacetsOptions from "@ogw_front/components/Viewer/Grid/3D/FacetsOptions"
-import Grid3DCellsOptions from "@ogw_front/components/Viewer/Grid/3D/CellsOptions"
// Solid components
import SolidEdgesOptions from "@ogw_front/components/Viewer/Solid/EdgesOptions"
diff --git a/app/stores/viewer.js b/app/stores/viewer.js
index b70a48ff..70cacc4e 100644
--- a/app/stores/viewer.js
+++ b/app/stores/viewer.js
@@ -5,11 +5,11 @@ import vtkWSLinkClient, {
import _ from "lodash"
// oxlint-disable-next-line no-unassigned-import
import "@kitware/vtk.js/Rendering/OpenGL/Profiles/Geometry"
-import Status from "@ogw_front/utils/status"
+import { Status } from "@ogw_front/utils/status"
import { appMode } from "@ogw_front/utils/app_mode"
import schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
import { useInfraStore } from "@ogw_front/stores/infra"
-import { viewer_call } from "../../internal/utils/viewer_call"
+import { viewer_call } from "@ogw_internal/utils/viewer_call"
const MS_PER_SECOND = 1000
const SECONDS_PER_REQUEST = 10
@@ -19,7 +19,6 @@ export const useViewerStore = defineStore(
"viewer",
() => {
const infraStore = useInfraStore()
-
const default_local_port = ref("1234")
const client = ref({})
const config = ref(undefined)
@@ -151,10 +150,11 @@ export const useViewerStore = defineStore(
}
async function launch() {
+ status.value = Status.CREATING
console.log("[VIEWER] Launching viewer microservice...")
- const port = await globalThis.electronAPI.run_viewer()
- console.log("[VIEWER] Viewer launched on port:", port)
- return port
+ const launched_port = await globalThis.electronAPI.run_viewer()
+ console.log("[VIEWER] Viewer launched on port:", launched_port)
+ return launched_port
}
async function connect() {
diff --git a/app/utils/colormap.js b/app/utils/colormap.js
index da86a7fe..2bac1194 100644
--- a/app/utils/colormap.js
+++ b/app/utils/colormap.js
@@ -1,5 +1,7 @@
import vtkColorMaps from "@kitware/vtk.js/Rendering/Core/ColorTransferFunction/ColorMaps"
-export function getRGBPointsFromPreset(presetName) {
+function getRGBPointsFromPreset(presetName) {
return vtkColorMaps.getPresetByName(presetName).RGBPoints
}
+
+export { getRGBPointsFromPreset }
diff --git a/app/utils/local.js b/app/utils/local.js
index fd3183b2..783ac1bf 100644
--- a/app/utils/local.js
+++ b/app/utils/local.js
@@ -1,9 +1,9 @@
-import { on, once } from "node:events"
import child_process from "node:child_process"
import fs from "node:fs"
+import { on } from "node:events"
import path from "node:path"
-import { setTimeout } from "timers/promises"
import { rimraf } from "rimraf"
+import { setTimeout } from "node:timers/promises"
// Third party imports
import { WebSocket } from "ws"
@@ -11,7 +11,6 @@ import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.jso
import { getPort } from "get-port-please"
import isElectron from "is-electron"
import pTimeout from "p-timeout"
-import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json" with { type: "json" }
const MAX_DELETE_FOLDER_RETRIES = 5
const DEFAULT_TIMEOUT_SECONDS = 30
@@ -48,12 +47,12 @@ function executable_name(name) {
return name
}
-function create_path(path) {
- if (!fs.existsSync(path)) {
- fs.mkdirSync(path, { recursive: true })
- console.log(`${path} directory created successfully!`)
+function create_path(dir_path) {
+ if (!fs.existsSync(dir_path)) {
+ fs.mkdirSync(dir_path, { recursive: true })
+ console.log(`${dir_path} directory created successfully!`)
}
- return path
+ return dir_path
}
function get_available_port() {
@@ -63,10 +62,10 @@ function get_available_port() {
})
}
-function commandExistsSync(executable_name) {
+function commandExistsSync(exec_name) {
const envPath = process.env.PATH || ""
return envPath.split(path.delimiter).some((dir) => {
- const filePath = path.join(dir, executable_name)
+ const filePath = path.join(dir, exec_name)
return fs.existsSync(filePath) && fs.statSync(filePath).isFile()
})
}
@@ -81,15 +80,15 @@ async function wait_for_ready(child, expected_response) {
}
async function run_script(
- executable_name,
- executable_path,
+ exec_name,
+ exec_path,
args,
expected_response,
timeout_seconds = DEFAULT_TIMEOUT_SECONDS,
) {
- const command = commandExistsSync(executable_name)
- ? executable_name
- : path.join(executable_path, executable_name)
+ const command = commandExistsSync(exec_name)
+ ? exec_name
+ : path.join(exec_path, exec_name)
console.log("run_script", command, args)
const child = child_process.spawn(command, args, {
encoding: "utf8",
@@ -126,8 +125,10 @@ async function run_script(
}
}
-async function run_back(executable_name, executable_path, args = {}) {
- let { project_folder_path, upload_folder_path } = args
+async function run_back(exec_name, exec_path, args = {}) {
+ const { project_folder_path, upload_folder_path: upload_folder_path_arg } =
+ args
+ let upload_folder_path = upload_folder_path_arg
if (!project_folder_path) {
throw new Error("project_folder_path is required")
}
@@ -145,17 +146,12 @@ async function run_back(executable_name, executable_path, args = {}) {
if (process.env.NODE_ENV === "development" || !process.env.NODE_ENV) {
back_args.push("--debug")
}
- console.log("run_back", executable_name, executable_path, back_args)
- await run_script(
- executable_name,
- executable_path,
- back_args,
- "Serving Flask app",
- )
+ console.log("run_back", exec_name, exec_path, back_args)
+ await run_script(exec_name, exec_path, back_args, "Serving Flask app")
return port
}
-async function run_viewer(executable_name, executable_path, args = {}) {
+async function run_viewer(exec_name, exec_path, args = {}) {
if (!args.project_folder_path) {
throw new Error("project_folder_path is required")
}
@@ -165,13 +161,8 @@ async function run_viewer(executable_name, executable_path, args = {}) {
`--data_folder_path ${args.project_folder_path}`,
`--timeout ${0}`,
]
- console.log("run_viewer", executable_name, executable_path, viewer_args)
- await run_script(
- executable_name,
- executable_path,
- viewer_args,
- "Starting factory",
- )
+ console.log("run_viewer", exec_name, exec_path, viewer_args)
+ await run_script(exec_name, exec_path, viewer_args, "Starting factory")
return port
}
@@ -183,13 +174,16 @@ async function delete_folder_recursive(data_folder_path) {
for (let i = 0; i <= MAX_DELETE_FOLDER_RETRIES; i += 1) {
try {
console.log(`Deleting folder: ${data_folder_path}`)
+ // oxlint-disable-next-line no-await-in-loop
await rimraf(data_folder_path)
console.log(`Deleted folder: ${data_folder_path}`)
return
} catch (error) {
console.error(`Error deleting folder ${data_folder_path}:`, error)
// Wait before retrying
- const DELAY = 1000 * (i + 1)
+ const MILLISECONDS_PER_RETRY = 1000
+ const DELAY = MILLISECONDS_PER_RETRY * (i + 1)
+ // oxlint-disable-next-line no-await-in-loop
await setTimeout(DELAY)
console.log("Retrying delete folder")
}
@@ -218,8 +212,9 @@ function kill_back(back_port) {
function kill_viewer(viewer_port) {
function do_kill() {
+ // oxlint-disable-next-line avoid-new
return new Promise((resolve) => {
- const socket = new WebSocket("ws://localhost:" + viewer_port + "/ws")
+ const socket = new WebSocket(`ws://localhost:${viewer_port}/ws`)
socket.on("open", () => {
console.log("Connected to WebSocket server")
socket.send(
diff --git a/app/utils/status.js b/app/utils/status.js
index 7532411e..f7809d29 100644
--- a/app/utils/status.js
+++ b/app/utils/status.js
@@ -7,4 +7,4 @@ const Status = {
CONNECTED: "CONNECTED",
}
-export default Status
+export { Status }
diff --git a/app/utils/upload_file.js b/app/utils/upload_file.js
index 456a8aed..65ccf14b 100644
--- a/app/utils/upload_file.js
+++ b/app/utils/upload_file.js
@@ -1,7 +1,7 @@
import { useFeedbackStore } from "@ogw_front/stores/feedback"
import { useGeodeStore } from "@ogw_front/stores/geode"
-export async function upload_file(
+async function upload_file(
{ route, file },
{ request_error_function, response_function, response_error_function } = {},
) {
@@ -52,4 +52,4 @@ export async function upload_file(
})
}
-export default upload_file
+export { upload_file }
diff --git a/app/utils/validate_schema.js b/app/utils/validate_schema.js
index 8dce56bc..f68e9c09 100644
--- a/app/utils/validate_schema.js
+++ b/app/utils/validate_schema.js
@@ -1,6 +1,6 @@
import Ajv from "ajv"
-export function validate_schema(schema, body) {
+function validate_schema(schema, body) {
const ajv = new Ajv()
const list_keywords = ["methods", "route", "max_retry", "rpc"]
for (const keyword of list_keywords) {
@@ -10,4 +10,4 @@ export function validate_schema(schema, body) {
return { valid, error: ajv.errorsText() }
}
-export default validate_schema
+export { validate_schema }
diff --git a/internal/database/database.js b/internal/database/database.js
index 11c81856..a1fd0434 100644
--- a/internal/database/database.js
+++ b/internal/database/database.js
@@ -40,7 +40,7 @@ class Database extends Dexie {
(tableName) => currentStores[tableName],
)
- database.close()
+ databaseContainer.instance.close()
if (allExisting) {
const existingDb = new Dexie("Database")
@@ -55,7 +55,7 @@ class Database extends Dexie {
}
}
await existingDb.open()
- database = existingDb
+ databaseContainer.instance = existingDb
} else {
const newDb = new ExtendedDatabase(
currentVersion,
@@ -63,11 +63,24 @@ class Database extends Dexie {
newTables,
)
await newDb.open()
- database = newDb
+ databaseContainer.instance = newDb
}
}
}
-let database = new Database()
+const databaseContainer = { instance: new Database() }
+
+const database = new Proxy(
+ {},
+ {
+ get(target, prop) {
+ const value = databaseContainer.instance[prop]
+ if (typeof value === "function") {
+ return value.bind(databaseContainer.instance)
+ }
+ return value
+ },
+ },
+)
export { Database, database }
diff --git a/internal/stores/data_style/mesh/cells/cell.js b/internal/stores/data_style/mesh/cells/cell.js
index c1fd27a0..40132c77 100644
--- a/internal/stores/data_style/mesh/cells/cell.js
+++ b/internal/stores/data_style/mesh/cells/cell.js
@@ -35,7 +35,7 @@ export function useMeshCellsCellAttributeStyle() {
name,
{ minimum, maximum, colorMap },
) {
- const storedConfigs = meshCellsCellAttribute(id).storedConfigs
+ const { storedConfigs } = meshCellsCellAttribute(id)
storedConfigs[name] = { minimum, maximum, colorMap }
return storedConfigs[name]
}
diff --git a/internal/stores/data_style/mesh/cells/common.js b/internal/stores/data_style/mesh/cells/common.js
index 169077e9..e6bdeaf3 100644
--- a/internal/stores/data_style/mesh/cells/common.js
+++ b/internal/stores/data_style/mesh/cells/common.js
@@ -1,4 +1,4 @@
-import { useDataStyleStateStore } from "../../state"
+import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state"
export function useMeshCellsCommonStyle() {
const dataStyleStateStore = useDataStyleStateStore()
diff --git a/internal/stores/data_style/mesh/cells/vertex.js b/internal/stores/data_style/mesh/cells/vertex.js
index dbb85665..775db33f 100644
--- a/internal/stores/data_style/mesh/cells/vertex.js
+++ b/internal/stores/data_style/mesh/cells/vertex.js
@@ -35,7 +35,7 @@ export function useMeshCellsVertexAttributeStyle() {
name,
{ minimum, maximum, colorMap },
) {
- const storedConfigs = meshCellsVertexAttribute(id).storedConfigs
+ const { storedConfigs } = meshCellsVertexAttribute(id)
storedConfigs[name] = { minimum, maximum, colorMap }
return storedConfigs[name]
}
diff --git a/internal/stores/data_style/mesh/edges/common.js b/internal/stores/data_style/mesh/edges/common.js
index 0da2d26a..9b0c7462 100644
--- a/internal/stores/data_style/mesh/edges/common.js
+++ b/internal/stores/data_style/mesh/edges/common.js
@@ -1,4 +1,4 @@
-import { useDataStyleStateStore } from "../../state"
+import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state"
export function useMeshEdgesCommonStyle() {
const dataStyleStateStore = useDataStyleStateStore()
diff --git a/internal/stores/data_style/mesh/edges/edge.js b/internal/stores/data_style/mesh/edges/edge.js
index f4e7aa1a..4f630bd0 100644
--- a/internal/stores/data_style/mesh/edges/edge.js
+++ b/internal/stores/data_style/mesh/edges/edge.js
@@ -19,7 +19,7 @@ export function useMeshEdgesEdgeAttributeStyle() {
}
function meshEdgesEdgeAttributeStoredConfig(id, name) {
- const storedConfigs = meshEdgesEdgeAttribute(id).storedConfigs
+ const { storedConfigs } = meshEdgesEdgeAttribute(id)
if (name in storedConfigs) {
return storedConfigs[name]
}
@@ -35,7 +35,7 @@ export function useMeshEdgesEdgeAttributeStyle() {
name,
{ minimum, maximum, colorMap },
) {
- const storedConfigs = meshEdgesEdgeAttribute(id).storedConfigs
+ const { storedConfigs } = meshEdgesEdgeAttribute(id)
storedConfigs[name] = { minimum, maximum, colorMap }
return storedConfigs[name]
}
diff --git a/internal/stores/data_style/mesh/edges/vertex.js b/internal/stores/data_style/mesh/edges/vertex.js
index f32ec35e..1dba58d5 100644
--- a/internal/stores/data_style/mesh/edges/vertex.js
+++ b/internal/stores/data_style/mesh/edges/vertex.js
@@ -35,7 +35,7 @@ export function useMeshEdgesVertexAttributeStyle() {
name,
{ minimum, maximum, colorMap },
) {
- const storedConfigs = meshEdgesVertexAttribute(id).storedConfigs
+ const { storedConfigs } = meshEdgesVertexAttribute(id)
storedConfigs[name] = { minimum, maximum, colorMap }
return storedConfigs[name]
}
diff --git a/internal/stores/data_style/mesh/index.js b/internal/stores/data_style/mesh/index.js
index c7e00a24..b5055f6a 100644
--- a/internal/stores/data_style/mesh/index.js
+++ b/internal/stores/data_style/mesh/index.js
@@ -5,7 +5,7 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer"
import { useViewerStore } from "@ogw_front/stores/viewer"
-import { useDataStyleStateStore } from "../state"
+import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state"
import { useMeshCellsStyle } from "./cells"
import { useMeshEdgesStyle } from "./edges"
import { useMeshPointsStyle } from "./points"
@@ -15,7 +15,7 @@ import { useMeshPolyhedraStyle } from "./polyhedra"
// Local constants
const meshSchemas = viewer_schemas.opengeodeweb_viewer.mesh
-export default function useMeshStyle() {
+export function useMeshStyle() {
const hybridViewerStore = useHybridViewerStore()
const viewerStore = useViewerStore()
const dataStyleState = useDataStyleStateStore()
diff --git a/internal/stores/data_style/mesh/points/common.js b/internal/stores/data_style/mesh/points/common.js
index a97307e3..20a2d313 100644
--- a/internal/stores/data_style/mesh/points/common.js
+++ b/internal/stores/data_style/mesh/points/common.js
@@ -1,4 +1,4 @@
-import { useDataStyleStateStore } from "../../state"
+import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state"
export function useMeshPointsCommonStyle() {
const dataStyleStateStore = useDataStyleStateStore()
diff --git a/internal/stores/data_style/mesh/points/vertex.js b/internal/stores/data_style/mesh/points/vertex.js
index 854fda78..4c964b9a 100644
--- a/internal/stores/data_style/mesh/points/vertex.js
+++ b/internal/stores/data_style/mesh/points/vertex.js
@@ -35,7 +35,7 @@ export function useMeshPointsVertexAttributeStyle() {
name,
{ minimum, maximum, colorMap },
) {
- const storedConfigs = meshPointsVertexAttribute(id).storedConfigs
+ const { storedConfigs } = meshPointsVertexAttribute(id)
storedConfigs[name] = { minimum, maximum, colorMap }
return storedConfigs[name]
}
diff --git a/internal/stores/data_style/mesh/polygons/common.js b/internal/stores/data_style/mesh/polygons/common.js
index 831d46c9..8b7164ab 100644
--- a/internal/stores/data_style/mesh/polygons/common.js
+++ b/internal/stores/data_style/mesh/polygons/common.js
@@ -1,4 +1,4 @@
-import { useDataStyleStateStore } from "../../state"
+import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state"
export function useMeshPolygonsCommonStyle() {
const dataStyleStateStore = useDataStyleStateStore()
diff --git a/internal/stores/data_style/mesh/polygons/polygon.js b/internal/stores/data_style/mesh/polygons/polygon.js
index de482105..60deff1b 100644
--- a/internal/stores/data_style/mesh/polygons/polygon.js
+++ b/internal/stores/data_style/mesh/polygons/polygon.js
@@ -35,7 +35,7 @@ export function useMeshPolygonsPolygonAttributeStyle() {
name,
{ minimum, maximum, colorMap },
) {
- const storedConfigs = meshPolygonsPolygonAttribute(id).storedConfigs
+ const { storedConfigs } = meshPolygonsPolygonAttribute(id)
storedConfigs[name] = { minimum, maximum, colorMap }
return storedConfigs[name]
}
diff --git a/internal/stores/data_style/mesh/polygons/vertex.js b/internal/stores/data_style/mesh/polygons/vertex.js
index afb0ba02..6c70ffe1 100644
--- a/internal/stores/data_style/mesh/polygons/vertex.js
+++ b/internal/stores/data_style/mesh/polygons/vertex.js
@@ -35,7 +35,7 @@ export function useMeshPolygonsVertexAttributeStyle() {
name,
{ minimum, maximum, colorMap },
) {
- const storedConfigs = meshPolygonsVertexAttribute(id).storedConfigs
+ const { storedConfigs } = meshPolygonsVertexAttribute(id)
storedConfigs[name] = { minimum, maximum, colorMap }
return storedConfigs[name]
}
diff --git a/internal/stores/data_style/mesh/polyhedra/common.js b/internal/stores/data_style/mesh/polyhedra/common.js
index 43ab982a..b521fab4 100644
--- a/internal/stores/data_style/mesh/polyhedra/common.js
+++ b/internal/stores/data_style/mesh/polyhedra/common.js
@@ -1,4 +1,4 @@
-import { useDataStyleStateStore } from "../../state"
+import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state"
export function useMeshPolyhedraCommonStyle() {
const dataStyleStateStore = useDataStyleStateStore()
diff --git a/internal/stores/data_style/mesh/polyhedra/polyhedron.js b/internal/stores/data_style/mesh/polyhedra/polyhedron.js
index 20a0e95a..45fea324 100644
--- a/internal/stores/data_style/mesh/polyhedra/polyhedron.js
+++ b/internal/stores/data_style/mesh/polyhedra/polyhedron.js
@@ -35,7 +35,7 @@ export function useMeshPolyhedraPolyhedronAttributeStyle() {
name,
{ minimum, maximum, colorMap },
) {
- const storedConfigs = meshPolyhedraPolyhedronAttribute(id).storedConfigs
+ const { storedConfigs } = meshPolyhedraPolyhedronAttribute(id)
storedConfigs[name] = { minimum, maximum, colorMap }
return storedConfigs[name]
}
diff --git a/internal/stores/data_style/mesh/polyhedra/vertex.js b/internal/stores/data_style/mesh/polyhedra/vertex.js
index d2985935..fa2a49fb 100644
--- a/internal/stores/data_style/mesh/polyhedra/vertex.js
+++ b/internal/stores/data_style/mesh/polyhedra/vertex.js
@@ -35,7 +35,7 @@ export function useMeshPolyhedraVertexAttributeStyle() {
name,
{ minimum, maximum, colorMap },
) {
- const storedConfigs = meshPolyhedraVertexAttribute(id).storedConfigs
+ const { storedConfigs } = meshPolyhedraVertexAttribute(id)
storedConfigs[name] = { minimum, maximum, colorMap }
return storedConfigs[name]
}
diff --git a/internal/stores/data_style/model/blocks/color.js b/internal/stores/data_style/model/blocks/color.js
index 7892f121..962ded14 100644
--- a/internal/stores/data_style/model/blocks/color.js
+++ b/internal/stores/data_style/model/blocks/color.js
@@ -2,8 +2,8 @@
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
// Local imports
-import { useModelBlocksCommonStyle } from "./common"
import { useDataStore } from "@ogw_front/stores/data"
+import { useModelBlocksCommonStyle } from "./common"
import { useViewerStore } from "@ogw_front/stores/viewer"
// Local constants
@@ -17,11 +17,9 @@ export function useModelBlocksColorStyle() {
function modelBlockColor(id, block_id) {
return modelBlocksCommonStyle.modelBlockStyle(id, block_id).color
}
-
function saveModelBlockColor(id, block_id, color) {
modelBlocksCommonStyle.modelBlockStyle(id, block_id).color = color
}
-
async function setModelBlocksColor(id, block_ids, color) {
if (!block_ids || block_ids.length === 0) {
return
@@ -45,7 +43,6 @@ export function useModelBlocksColorStyle() {
for (const block_id of block_ids) {
saveModelBlockColor(id, block_id, color)
}
-
console.log(
setModelBlocksColor.name,
{ id },
diff --git a/internal/stores/data_style/model/blocks/common.js b/internal/stores/data_style/model/blocks/common.js
index a57d425c..c6bd19a5 100644
--- a/internal/stores/data_style/model/blocks/common.js
+++ b/internal/stores/data_style/model/blocks/common.js
@@ -1,4 +1,4 @@
-import { useDataStyleStateStore } from "../../state"
+import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state"
export function useModelBlocksCommonStyle() {
const dataStyleStateStore = useDataStyleStateStore()
diff --git a/internal/stores/data_style/model/blocks/index.js b/internal/stores/data_style/model/blocks/index.js
index 51968f50..9eead7af 100644
--- a/internal/stores/data_style/model/blocks/index.js
+++ b/internal/stores/data_style/model/blocks/index.js
@@ -1,8 +1,12 @@
// Local imports
+import { useDataStore } from "@ogw_front/stores/data"
import { useModelBlocksColorStyle } from "./color"
import { useModelBlocksCommonStyle } from "./common"
import { useModelBlocksVisibilityStyle } from "./visibility"
-import { useDataStore } from "@ogw_front/stores/data"
+
+async function setModelBlocksDefaultStyle(_id) {
+ // Placeholder for oxlint
+}
export function useModelBlocksStyle() {
const dataStore = useDataStore()
@@ -23,8 +27,6 @@ export function useModelBlocksStyle() {
])
}
- async function setModelBlocksDefaultStyle(id) {}
-
return {
applyModelBlocksStyle,
setModelBlocksDefaultStyle,
diff --git a/internal/stores/data_style/model/blocks/visibility.js b/internal/stores/data_style/model/blocks/visibility.js
index 9644cd04..fafeea90 100644
--- a/internal/stores/data_style/model/blocks/visibility.js
+++ b/internal/stores/data_style/model/blocks/visibility.js
@@ -2,8 +2,8 @@
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
// Local imports
-import { useModelBlocksCommonStyle } from "./common"
import { useDataStore } from "@ogw_front/stores/data"
+import { useModelBlocksCommonStyle } from "./common"
import { useViewerStore } from "@ogw_front/stores/viewer"
// Local constants
@@ -13,11 +13,9 @@ export function useModelBlocksVisibilityStyle() {
const dataStore = useDataStore()
const viewerStore = useViewerStore()
const modelBlocksCommonStyle = useModelBlocksCommonStyle()
-
function modelBlockVisibility(id, block_id) {
return modelBlocksCommonStyle.modelBlockStyle(id, block_id).visibility
}
-
function saveModelBlockVisibility(id, block_id, visibility) {
modelBlocksCommonStyle.modelBlockStyle(id, block_id).visibility = visibility
}
diff --git a/internal/stores/data_style/model/corners/color.js b/internal/stores/data_style/model/corners/color.js
index 380aef8b..7c4ddb5b 100644
--- a/internal/stores/data_style/model/corners/color.js
+++ b/internal/stores/data_style/model/corners/color.js
@@ -2,8 +2,8 @@
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
// Local imports
-import { useModelCornersCommonStyle } from "./common"
import { useDataStore } from "@ogw_front/stores/data"
+import { useModelCornersCommonStyle } from "./common"
import { useViewerStore } from "@ogw_front/stores/viewer"
// Local constants
@@ -13,15 +13,12 @@ export function useModelCornersColorStyle() {
const dataStore = useDataStore()
const viewerStore = useViewerStore()
const modelCornersCommonStyle = useModelCornersCommonStyle()
-
function modelCornerColor(id, corner_id) {
return modelCornersCommonStyle.modelCornerStyle(id, corner_id).color
}
-
function saveModelCornerColor(id, corner_id, color) {
modelCornersCommonStyle.modelCornerStyle(id, corner_id).color = color
}
-
async function setModelCornersColor(id, corner_ids, color) {
if (!corner_ids || corner_ids.length === 0) {
return
diff --git a/internal/stores/data_style/model/corners/common.js b/internal/stores/data_style/model/corners/common.js
index bba6b013..6cbebe27 100644
--- a/internal/stores/data_style/model/corners/common.js
+++ b/internal/stores/data_style/model/corners/common.js
@@ -1,4 +1,4 @@
-import { useDataStyleStateStore } from "../../state"
+import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state"
export function useModelCornersCommonStyle() {
const dataStyleStateStore = useDataStyleStateStore()
diff --git a/internal/stores/data_style/model/corners/index.js b/internal/stores/data_style/model/corners/index.js
index c62e0c96..6408522f 100644
--- a/internal/stores/data_style/model/corners/index.js
+++ b/internal/stores/data_style/model/corners/index.js
@@ -1,8 +1,12 @@
// Local imports
+import { useDataStore } from "@ogw_front/stores/data"
import { useModelCornersColorStyle } from "./color"
import { useModelCornersCommonStyle } from "./common"
import { useModelCornersVisibilityStyle } from "./visibility"
-import { useDataStore } from "@ogw_front/stores/data"
+
+async function setModelCornersDefaultStyle(_id) {
+ // Placeholder for oxlint
+}
export function useModelCornersStyle() {
const dataStore = useDataStore()
@@ -24,8 +28,6 @@ export function useModelCornersStyle() {
])
}
- async function setModelCornersDefaultStyle(id) {}
-
return {
applyModelCornersStyle,
setModelCornersDefaultStyle,
diff --git a/internal/stores/data_style/model/corners/visibility.js b/internal/stores/data_style/model/corners/visibility.js
index 442ac004..b40f7cef 100644
--- a/internal/stores/data_style/model/corners/visibility.js
+++ b/internal/stores/data_style/model/corners/visibility.js
@@ -2,8 +2,8 @@
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
// Local imports
-import { useModelCornersCommonStyle } from "./common"
import { useDataStore } from "@ogw_front/stores/data"
+import { useModelCornersCommonStyle } from "./common"
import { useViewerStore } from "@ogw_front/stores/viewer"
// Local constants
@@ -13,16 +13,13 @@ export function useModelCornersVisibilityStyle() {
const dataStore = useDataStore()
const viewerStore = useViewerStore()
const modelCornersCommonStyle = useModelCornersCommonStyle()
-
function modelCornerVisibility(id, corner_id) {
return modelCornersCommonStyle.modelCornerStyle(id, corner_id).visibility
}
-
function saveModelCornerVisibility(id, corner_id, visibility) {
modelCornersCommonStyle.modelCornerStyle(id, corner_id).visibility =
visibility
}
-
async function setModelCornersVisibility(id, corner_ids, visibility) {
if (!corner_ids || corner_ids.length === 0) {
return
diff --git a/internal/stores/data_style/model/edges/common.js b/internal/stores/data_style/model/edges/common.js
index 416dfb92..9dc0a700 100644
--- a/internal/stores/data_style/model/edges/common.js
+++ b/internal/stores/data_style/model/edges/common.js
@@ -1,4 +1,4 @@
-import { useDataStyleStateStore } from "../../state"
+import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state"
export function useModelEdgesCommonStyle() {
const dataStyleStateStore = useDataStyleStateStore()
diff --git a/internal/stores/data_style/model/index.js b/internal/stores/data_style/model/index.js
index 7a85d417..8d5cc543 100644
--- a/internal/stores/data_style/model/index.js
+++ b/internal/stores/data_style/model/index.js
@@ -3,7 +3,7 @@ import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schem
// Local imports
import { useDataStore } from "@ogw_front/stores/data"
-import { useDataStyleStateStore } from "../state"
+import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state"
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer"
import { useModelBlocksStyle } from "./blocks"
import { useModelCornersStyle } from "./corners"
@@ -16,7 +16,7 @@ import { useViewerStore } from "@ogw_front/stores/viewer"
// Local constants
const model_schemas = viewer_schemas.opengeodeweb_viewer.model
-export default function useModelStyle() {
+export function useModelStyle() {
const dataStore = useDataStore()
const dataStyleStateStore = useDataStyleStateStore()
const modelCornersStyleStore = useModelCornersStyle()
diff --git a/internal/stores/data_style/model/lines/color.js b/internal/stores/data_style/model/lines/color.js
index a8273fc9..fd9de94d 100644
--- a/internal/stores/data_style/model/lines/color.js
+++ b/internal/stores/data_style/model/lines/color.js
@@ -2,8 +2,8 @@
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
// Local imports
-import { useModelLinesCommonStyle } from "./common"
import { useDataStore } from "@ogw_front/stores/data"
+import { useModelLinesCommonStyle } from "./common"
import { useViewerStore } from "@ogw_front/stores/viewer"
// Local constants
@@ -13,15 +13,12 @@ export function useModelLinesColorStyle() {
const dataStore = useDataStore()
const viewerStore = useViewerStore()
const modelLinesCommonStyle = useModelLinesCommonStyle()
-
function modelLineColor(id, line_id) {
return modelLinesCommonStyle.modelLineStyle(id, line_id).color
}
-
function saveModelLineColor(id, line_id, color) {
modelLinesCommonStyle.modelLineStyle(id, line_id).color = color
}
-
async function setModelLinesColor(id, line_ids, color) {
if (!line_ids || line_ids.length === 0) {
return
diff --git a/internal/stores/data_style/model/lines/common.js b/internal/stores/data_style/model/lines/common.js
index d85907a8..6ed96220 100644
--- a/internal/stores/data_style/model/lines/common.js
+++ b/internal/stores/data_style/model/lines/common.js
@@ -1,4 +1,4 @@
-import { useDataStyleStateStore } from "../../state"
+import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state"
export function useModelLinesCommonStyle() {
const dataStyleStateStore = useDataStyleStateStore()
diff --git a/internal/stores/data_style/model/lines/index.js b/internal/stores/data_style/model/lines/index.js
index f1cf8a85..eff26416 100644
--- a/internal/stores/data_style/model/lines/index.js
+++ b/internal/stores/data_style/model/lines/index.js
@@ -1,8 +1,12 @@
// Local imports
+import { useDataStore } from "@ogw_front/stores/data"
import { useModelLinesColorStyle } from "./color"
import { useModelLinesCommonStyle } from "./common"
import { useModelLinesVisibilityStyle } from "./visibility"
-import { useDataStore } from "@ogw_front/stores/data"
+
+async function setModelLinesDefaultStyle(_id) {
+ // Placeholder for oxlint
+}
export function useModelLinesStyle() {
const dataStore = useDataStore()
@@ -23,8 +27,6 @@ export function useModelLinesStyle() {
])
}
- async function setModelLinesDefaultStyle(id) {}
-
return {
applyModelLinesStyle,
setModelLinesDefaultStyle,
diff --git a/internal/stores/data_style/model/lines/visibility.js b/internal/stores/data_style/model/lines/visibility.js
index f93b4917..8d8e181f 100644
--- a/internal/stores/data_style/model/lines/visibility.js
+++ b/internal/stores/data_style/model/lines/visibility.js
@@ -2,8 +2,8 @@
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
// Local imports
-import { useModelLinesCommonStyle } from "./common"
import { useDataStore } from "@ogw_front/stores/data"
+import { useModelLinesCommonStyle } from "./common"
import { useViewerStore } from "@ogw_front/stores/viewer"
// Local constants
@@ -13,15 +13,12 @@ export function useModelLinesVisibilityStyle() {
const dataStore = useDataStore()
const viewerStore = useViewerStore()
const modelLinesCommonStyle = useModelLinesCommonStyle()
-
function modelLineVisibility(id, line_id) {
return modelLinesCommonStyle.modelLineStyle(id, line_id).visibility
}
-
function saveModelLineVisibility(id, line_id, visibility) {
modelLinesCommonStyle.modelLineStyle(id, line_id).visibility = visibility
}
-
async function setModelLinesVisibility(id, line_ids, visibility) {
if (!line_ids || line_ids.length === 0) {
return
diff --git a/internal/stores/data_style/model/points/common.js b/internal/stores/data_style/model/points/common.js
index ffd5b1e1..4b05ea0e 100644
--- a/internal/stores/data_style/model/points/common.js
+++ b/internal/stores/data_style/model/points/common.js
@@ -1,4 +1,4 @@
-import { useDataStyleStateStore } from "../../state"
+import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state"
export function useModelPointsCommonStyle() {
const dataStyleStateStore = useDataStyleStateStore()
diff --git a/internal/stores/data_style/model/surfaces/color.js b/internal/stores/data_style/model/surfaces/color.js
index 90fb08a9..98a7ad45 100644
--- a/internal/stores/data_style/model/surfaces/color.js
+++ b/internal/stores/data_style/model/surfaces/color.js
@@ -2,8 +2,8 @@
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
// Local imports
-import { useModelSurfacesCommonStyle } from "./common"
import { useDataStore } from "@ogw_front/stores/data"
+import { useModelSurfacesCommonStyle } from "./common"
import { useViewerStore } from "@ogw_front/stores/viewer"
// Local constants
@@ -13,14 +13,12 @@ export function useModelSurfacesColorStyle() {
const dataStore = useDataStore()
const viewerStore = useViewerStore()
const modelSurfacesCommonStyle = useModelSurfacesCommonStyle()
-
function modelSurfaceColor(id, surface_id) {
return modelSurfacesCommonStyle.modelSurfaceStyle(id, surface_id).color
}
function saveModelSurfaceColor(id, surface_id, color) {
modelSurfacesCommonStyle.modelSurfaceStyle(id, surface_id).color = color
}
-
async function setModelSurfacesColor(id, surface_ids, color) {
if (!surface_ids || surface_ids.length === 0) {
return
diff --git a/internal/stores/data_style/model/surfaces/common.js b/internal/stores/data_style/model/surfaces/common.js
index 9883d623..c278ac14 100644
--- a/internal/stores/data_style/model/surfaces/common.js
+++ b/internal/stores/data_style/model/surfaces/common.js
@@ -1,4 +1,4 @@
-import { useDataStyleStateStore } from "../../state"
+import { useDataStyleStateStore } from "@ogw_internal/stores/data_style/state"
export function useModelSurfacesCommonStyle() {
const dataStyleStateStore = useDataStyleStateStore()
diff --git a/internal/stores/data_style/model/surfaces/index.js b/internal/stores/data_style/model/surfaces/index.js
index b35ee80c..7ad39e2f 100644
--- a/internal/stores/data_style/model/surfaces/index.js
+++ b/internal/stores/data_style/model/surfaces/index.js
@@ -1,8 +1,12 @@
// Local imports
+import { useDataStore } from "@ogw_front/stores/data"
import { useModelSurfacesColorStyle } from "./color"
import { useModelSurfacesCommonStyle } from "./common"
import { useModelSurfacesVisibilityStyle } from "./visibility"
-import { useDataStore } from "@ogw_front/stores/data"
+
+async function setModelSurfacesDefaultStyle(_id) {
+ // Placeholder for oxlint
+}
export function useModelSurfacesStyle() {
const dataStore = useDataStore()
@@ -27,8 +31,6 @@ export function useModelSurfacesStyle() {
])
}
- async function setModelSurfacesDefaultStyle(id) {}
-
return {
applyModelSurfacesStyle,
setModelSurfacesDefaultStyle,
diff --git a/internal/stores/data_style/model/surfaces/visibility.js b/internal/stores/data_style/model/surfaces/visibility.js
index 2a65f9fc..0bc29551 100644
--- a/internal/stores/data_style/model/surfaces/visibility.js
+++ b/internal/stores/data_style/model/surfaces/visibility.js
@@ -2,8 +2,8 @@
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_schemas.json"
// Local imports
-import { useModelSurfacesCommonStyle } from "./common"
import { useDataStore } from "@ogw_front/stores/data"
+import { useModelSurfacesCommonStyle } from "./common"
import { useViewerStore } from "@ogw_front/stores/viewer"
// Local constants
@@ -13,7 +13,6 @@ export function useModelSurfacesVisibilityStyle() {
const dataStore = useDataStore()
const viewerStore = useViewerStore()
const modelSurfacesCommonStyle = useModelSurfacesCommonStyle()
-
function modelSurfaceVisibility(id, surface_id) {
return modelSurfacesCommonStyle.modelSurfaceStyle(id, surface_id).visibility
}
diff --git a/internal/utils/api_fetch.js b/internal/utils/api_fetch.js
index 0955c516..f37ebcde 100644
--- a/internal/utils/api_fetch.js
+++ b/internal/utils/api_fetch.js
@@ -1,7 +1,7 @@
// oxlint-disable-next-line id-length
import _ from "lodash"
import { useFeedbackStore } from "@ogw_front/stores/feedback"
-import validate_schema from "@ogw_front/utils/validate_schema"
+import { validate_schema } from "@ogw_front/utils/validate_schema"
const ERROR_400 = 400
@@ -14,14 +14,14 @@ export function api_fetch(
const body = params || {}
- const { valid, error } = validate_schema(schema, body)
+ const { valid, error: schema_error } = validate_schema(schema, body)
if (!valid) {
if (process.env.NODE_ENV !== "production") {
- console.log("Bad request", error, schema, params)
+ console.log("Bad request", schema_error, schema, params)
}
- feedbackStore.add_error(ERROR_400, schema.$id, "Bad request", error)
- throw new Error(`${schema.$id}: ${error}`)
+ feedbackStore.add_error(ERROR_400, schema.$id, "Bad request", schema_error)
+ throw new Error(`${schema.$id}: ${schema_error}`)
}
microservice.start_request()
@@ -74,5 +74,3 @@ export function api_fetch(
},
})
}
-
-export default api_fetch
diff --git a/internal/utils/viewer_call.js b/internal/utils/viewer_call.js
index 632e6169..ecaa3dea 100644
--- a/internal/utils/viewer_call.js
+++ b/internal/utils/viewer_call.js
@@ -1,6 +1,6 @@
import pTimeout from "p-timeout"
import { useFeedbackStore } from "@ogw_front/stores/feedback"
-import validate_schema from "@ogw_front/utils/validate_schema"
+import { validate_schema } from "@ogw_front/utils/validate_schema"
const ERROR_400 = 400
@@ -16,14 +16,14 @@ export async function viewer_call(
) {
const feedbackStore = useFeedbackStore()
- const { valid, error } = validate_schema(schema, params)
+ const { valid, error: schema_error } = validate_schema(schema, params)
if (!valid) {
if (process.env.NODE_ENV !== "production") {
- console.log("Bad request", error, schema, params)
+ console.log("Bad request", schema_error, schema, params)
}
- feedbackStore.add_error(ERROR_400, schema.$id, "Bad request", error)
- throw new Error(`${schema.$id}: ${error}`)
+ feedbackStore.add_error(ERROR_400, schema.$id, "Bad request", schema_error)
+ throw new Error(`${schema.$id}: ${schema_error}`)
}
const { client } = microservice
@@ -71,5 +71,3 @@ export async function viewer_call(
return await performCall()
}
-
-export default viewer_call
diff --git a/nuxt.config.js b/nuxt.config.js
index c9ef0257..48062d72 100644
--- a/nuxt.config.js
+++ b/nuxt.config.js
@@ -1,3 +1,8 @@
+import path, { dirname } from "node:path"
+import { fileURLToPath } from "node:url"
+
+const __dirname = dirname(fileURLToPath(import.meta.url))
+
export default defineNuxtConfig({
runtimeConfig: {
public: {
@@ -20,7 +25,9 @@ export default defineNuxtConfig({
},
alias: {
- "@ogw_front": `${__dirname}/app/`,
+ "@ogw_front": path.resolve(__dirname, "app"),
+ "@ogw_internal": path.resolve(__dirname, "internal"),
+ "@ogw_tests": path.resolve(__dirname, "tests"),
},
// ** Global CSS
diff --git a/scripts/generate_geode_objects.js b/scripts/generate_geode_objects.js
index c3b2392c..91890d45 100644
--- a/scripts/generate_geode_objects.js
+++ b/scripts/generate_geode_objects.js
@@ -1,4 +1,4 @@
-// oxlint-disable-next-line id-length
+/* oxlint-disable vitest/require-hook */
import fs from "node:fs"
import path from "node:path"
import process from "node:process"
diff --git a/tests/integration/microservices/back/requirements.txt b/tests/integration/microservices/back/requirements.txt
index a0944c7a..bd3a3ef5 100644
--- a/tests/integration/microservices/back/requirements.txt
+++ b/tests/integration/microservices/back/requirements.txt
@@ -5,4 +5,3 @@
# pip-compile --output-file=tests/integration/microservices/back/requirements.txt tests/integration/microservices/back/requirements.in
#
-opengeodeweb-back==6.*,>=6.3.1rc1
diff --git a/tests/integration/microservices/viewer/requirements.txt b/tests/integration/microservices/viewer/requirements.txt
index f28481e9..4d097394 100644
--- a/tests/integration/microservices/viewer/requirements.txt
+++ b/tests/integration/microservices/viewer/requirements.txt
@@ -5,4 +5,3 @@
# pip-compile --output-file=tests/integration/microservices/viewer/requirements.txt tests/integration/microservices/viewer/requirements.in
#
-opengeodeweb-viewer==1.*,>=1.15.5rc1
diff --git a/tests/integration/setup.js b/tests/integration/setup.js
index 4f4827be..b9f95ddd 100644
--- a/tests/integration/setup.js
+++ b/tests/integration/setup.js
@@ -1,6 +1,7 @@
// Node.js imports
+import path, { dirname } from "node:path"
import { WebSocket } from "ws"
-import path from "node:path"
+import { fileURLToPath } from "node:url"
import { v4 as uuidv4 } from "uuid"
// Third party imports
@@ -16,15 +17,16 @@ import {
run_back,
run_viewer,
} from "@ogw_front/utils/local"
-import Status from "@ogw_front/utils/status"
+import { Status } from "@ogw_front/utils/status"
import { appMode } from "@ogw_front/utils/app_mode"
import { importFile } from "@ogw_front/utils/file_import_workflow"
-import { setupActivePinia } from "../utils"
+import { setupActivePinia } from "@ogw_tests/utils"
import { useGeodeStore } from "@ogw_front/stores/geode"
import { useInfraStore } from "@ogw_front/stores/infra"
import { useViewerStore } from "@ogw_front/stores/viewer"
// Local constants
+const __dirname = dirname(fileURLToPath(import.meta.url))
const data_folder = path.join("tests", "integration", "data")
async function runMicroservices() {
@@ -64,11 +66,9 @@ async function runMicroservices() {
async function setupIntegrationTests(file_name, geode_object) {
setupActivePinia()
const viewerStore = useViewerStore()
-
const { back_port, viewer_port, project_folder_path } =
await runMicroservices()
await viewerStore.ws_connect()
-
const id = await importFile(file_name, geode_object)
expect(viewerStore.status).toBe(Status.CONNECTED)
console.log("end of setupIntegrationTests")
diff --git a/tests/integration/stores/data_style/mesh/cells.nuxt.test.js b/tests/integration/stores/data_style/mesh/cells.nuxt.test.js
index c76d20bd..9cc6b48a 100644
--- a/tests/integration/stores/data_style/mesh/cells.nuxt.test.js
+++ b/tests/integration/stores/data_style/mesh/cells.nuxt.test.js
@@ -8,8 +8,8 @@ import {
kill_back,
kill_viewer,
} from "@ogw_front/utils/local"
-import Status from "@ogw_front/utils/status"
-import { setupIntegrationTests } from "../../../setup"
+import { Status } from "@ogw_front/utils/status"
+import { setupIntegrationTests } from "@ogw_tests/integration/setup"
import { useDataStyleStore } from "@ogw_front/stores/data_style"
import { useViewerStore } from "@ogw_front/stores/viewer"
diff --git a/tests/integration/stores/data_style/mesh/edges.nuxt.test.js b/tests/integration/stores/data_style/mesh/edges.nuxt.test.js
index dfc1b215..c9c99a3c 100644
--- a/tests/integration/stores/data_style/mesh/edges.nuxt.test.js
+++ b/tests/integration/stores/data_style/mesh/edges.nuxt.test.js
@@ -8,8 +8,8 @@ import {
kill_back,
kill_viewer,
} from "@ogw_front/utils/local"
-import Status from "@ogw_front/utils/status"
-import { setupIntegrationTests } from "../../../setup"
+import { Status } from "@ogw_front/utils/status"
+import { setupIntegrationTests } from "@ogw_tests/integration/setup"
import { useDataStyleStore } from "@ogw_front/stores/data_style"
import { useViewerStore } from "@ogw_front/stores/viewer"
diff --git a/tests/integration/stores/data_style/mesh/index.nuxt.test.js b/tests/integration/stores/data_style/mesh/index.nuxt.test.js
index 2f3283ba..d3a472de 100644
--- a/tests/integration/stores/data_style/mesh/index.nuxt.test.js
+++ b/tests/integration/stores/data_style/mesh/index.nuxt.test.js
@@ -8,8 +8,8 @@ import {
kill_back,
kill_viewer,
} from "@ogw_front/utils/local"
-import Status from "@ogw_front/utils/status"
-import { setupIntegrationTests } from "../../../setup"
+import { Status } from "@ogw_front/utils/status"
+import { setupIntegrationTests } from "@ogw_tests/integration/setup"
import { useDataStyleStore } from "@ogw_front/stores/data_style"
import { useViewerStore } from "@ogw_front/stores/viewer"
diff --git a/tests/integration/stores/data_style/mesh/points.nuxt.test.js b/tests/integration/stores/data_style/mesh/points.nuxt.test.js
index d9a3a003..20f03aba 100644
--- a/tests/integration/stores/data_style/mesh/points.nuxt.test.js
+++ b/tests/integration/stores/data_style/mesh/points.nuxt.test.js
@@ -8,8 +8,8 @@ import {
kill_back,
kill_viewer,
} from "@ogw_front/utils/local"
-import Status from "@ogw_front/utils/status"
-import { setupIntegrationTests } from "../../../setup"
+import { Status } from "@ogw_front/utils/status"
+import { setupIntegrationTests } from "@ogw_tests/integration/setup"
import { useDataStyleStore } from "@ogw_front/stores/data_style"
import { useViewerStore } from "@ogw_front/stores/viewer"
diff --git a/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js b/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js
index d9c470a1..ddc60996 100644
--- a/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js
+++ b/tests/integration/stores/data_style/mesh/polygons.nuxt.test.js
@@ -8,8 +8,8 @@ import {
kill_back,
kill_viewer,
} from "@ogw_front/utils/local"
-import Status from "@ogw_front/utils/status"
-import { setupIntegrationTests } from "../../../setup"
+import { Status } from "@ogw_front/utils/status"
+import { setupIntegrationTests } from "@ogw_tests/integration/setup"
import { useDataStyleStore } from "@ogw_front/stores/data_style"
import { useViewerStore } from "@ogw_front/stores/viewer"
diff --git a/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js b/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js
index 68554808..30f3662f 100644
--- a/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js
+++ b/tests/integration/stores/data_style/mesh/polyhedra.nuxt.test.js
@@ -8,8 +8,8 @@ import {
kill_back,
kill_viewer,
} from "@ogw_front/utils/local"
-import Status from "@ogw_front/utils/status"
-import { setupIntegrationTests } from "../../../setup"
+import { Status } from "@ogw_front/utils/status"
+import { setupIntegrationTests } from "@ogw_tests/integration/setup"
import { useDataStyleStore } from "@ogw_front/stores/data_style"
import { useViewerStore } from "@ogw_front/stores/viewer"
diff --git a/tests/integration/stores/data_style/model/blocks.nuxt.test.js b/tests/integration/stores/data_style/model/blocks.nuxt.test.js
index 38e725ac..394a0c7b 100644
--- a/tests/integration/stores/data_style/model/blocks.nuxt.test.js
+++ b/tests/integration/stores/data_style/model/blocks.nuxt.test.js
@@ -8,8 +8,8 @@ import {
kill_back,
kill_viewer,
} from "@ogw_front/utils/local"
-import Status from "@ogw_front/utils/status"
-import { setupIntegrationTests } from "../../../setup"
+import { Status } from "@ogw_front/utils/status"
+import { setupIntegrationTests } from "@ogw_tests/integration/setup"
import { useDataStore } from "@ogw_front/stores/data"
import { useDataStyleStore } from "@ogw_front/stores/data_style"
import { useViewerStore } from "@ogw_front/stores/viewer"
diff --git a/tests/integration/stores/data_style/model/corners.nuxt.test.js b/tests/integration/stores/data_style/model/corners.nuxt.test.js
index 53446779..b4f0c8a9 100644
--- a/tests/integration/stores/data_style/model/corners.nuxt.test.js
+++ b/tests/integration/stores/data_style/model/corners.nuxt.test.js
@@ -8,8 +8,8 @@ import {
kill_back,
kill_viewer,
} from "@ogw_front/utils/local"
-import Status from "@ogw_front/utils/status"
-import { setupIntegrationTests } from "../../../setup"
+import { Status } from "@ogw_front/utils/status"
+import { setupIntegrationTests } from "@ogw_tests/integration/setup"
import { useDataStore } from "@ogw_front/stores/data"
import { useDataStyleStore } from "@ogw_front/stores/data_style"
import { useViewerStore } from "@ogw_front/stores/viewer"
diff --git a/tests/integration/stores/data_style/model/edges.nuxt.test.js b/tests/integration/stores/data_style/model/edges.nuxt.test.js
index a44c535d..f5b5e728 100644
--- a/tests/integration/stores/data_style/model/edges.nuxt.test.js
+++ b/tests/integration/stores/data_style/model/edges.nuxt.test.js
@@ -8,8 +8,8 @@ import {
kill_back,
kill_viewer,
} from "@ogw_front/utils/local"
-import Status from "@ogw_front/utils/status"
-import { setupIntegrationTests } from "../../../setup"
+import { Status } from "@ogw_front/utils/status"
+import { setupIntegrationTests } from "@ogw_tests/integration/setup"
import { useDataStyleStore } from "@ogw_front/stores/data_style"
import { useViewerStore } from "@ogw_front/stores/viewer"
diff --git a/tests/integration/stores/data_style/model/index.nuxt.test.js b/tests/integration/stores/data_style/model/index.nuxt.test.js
index 21df4f81..20acaf39 100644
--- a/tests/integration/stores/data_style/model/index.nuxt.test.js
+++ b/tests/integration/stores/data_style/model/index.nuxt.test.js
@@ -8,8 +8,8 @@ import {
kill_back,
kill_viewer,
} from "@ogw_front/utils/local"
-import Status from "@ogw_front/utils/status"
-import { setupIntegrationTests } from "../../../setup"
+import { Status } from "@ogw_front/utils/status"
+import { setupIntegrationTests } from "@ogw_tests/integration/setup"
import { useDataStyleStore } from "@ogw_front/stores/data_style"
import { useViewerStore } from "@ogw_front/stores/viewer"
diff --git a/tests/integration/stores/data_style/model/lines.nuxt.test.js b/tests/integration/stores/data_style/model/lines.nuxt.test.js
index 33c90950..58b3e555 100644
--- a/tests/integration/stores/data_style/model/lines.nuxt.test.js
+++ b/tests/integration/stores/data_style/model/lines.nuxt.test.js
@@ -8,8 +8,8 @@ import {
kill_back,
kill_viewer,
} from "@ogw_front/utils/local"
-import Status from "@ogw_front/utils/status"
-import { setupIntegrationTests } from "../../../setup"
+import { Status } from "@ogw_front/utils/status"
+import { setupIntegrationTests } from "@ogw_tests/integration/setup"
import { useDataStore } from "@ogw_front/stores/data"
import { useDataStyleStore } from "@ogw_front/stores/data_style"
import { useViewerStore } from "@ogw_front/stores/viewer"
diff --git a/tests/integration/stores/data_style/model/points.nuxt.test.js b/tests/integration/stores/data_style/model/points.nuxt.test.js
index 15c77f50..318e6cb4 100644
--- a/tests/integration/stores/data_style/model/points.nuxt.test.js
+++ b/tests/integration/stores/data_style/model/points.nuxt.test.js
@@ -8,8 +8,8 @@ import {
kill_back,
kill_viewer,
} from "@ogw_front/utils/local"
-import Status from "@ogw_front/utils/status"
-import { setupIntegrationTests } from "../../../setup"
+import { Status } from "@ogw_front/utils/status"
+import { setupIntegrationTests } from "@ogw_tests/integration/setup"
import { useDataStyleStore } from "@ogw_front/stores/data_style"
import { useViewerStore } from "@ogw_front/stores/viewer"
diff --git a/tests/integration/stores/data_style/model/surfaces.nuxt.test.js b/tests/integration/stores/data_style/model/surfaces.nuxt.test.js
index b213e57c..3285eec8 100644
--- a/tests/integration/stores/data_style/model/surfaces.nuxt.test.js
+++ b/tests/integration/stores/data_style/model/surfaces.nuxt.test.js
@@ -8,8 +8,8 @@ import {
kill_back,
kill_viewer,
} from "@ogw_front/utils/local"
-import Status from "@ogw_front/utils/status"
-import { setupIntegrationTests } from "../../../setup"
+import { Status } from "@ogw_front/utils/status"
+import { setupIntegrationTests } from "@ogw_tests/integration/setup"
import { useDataStore } from "@ogw_front/stores/data"
import { useDataStyleStore } from "@ogw_front/stores/data_style"
import { useViewerStore } from "@ogw_front/stores/viewer"
@@ -20,30 +20,30 @@ const model_surfaces_schemas = viewer_schemas.opengeodeweb_viewer.model.surfaces
const file_name = "test.og_brep"
const geode_object = "BRep"
-let back_port = 0,
- id = "",
- project_folder_path = "",
- viewer_port = 0
+describe("model surfaces", () => {
+ let back_port = 0,
+ id = "",
+ project_folder_path = "",
+ viewer_port = 0
-beforeEach(async () => {
- ;({ id, back_port, viewer_port, project_folder_path } =
- await setupIntegrationTests(file_name, geode_object))
-}, INTERVAL_TIMEOUT)
+ beforeEach(async () => {
+ ;({ id, back_port, viewer_port, project_folder_path } =
+ await setupIntegrationTests(file_name, geode_object))
+ }, INTERVAL_TIMEOUT)
-afterEach(async () => {
- console.log(
- "afterEach model surfaces kill",
- back_port,
- viewer_port,
- project_folder_path,
- )
- await Promise.all([kill_back(back_port), kill_viewer(viewer_port)])
- delete_folder_recursive(project_folder_path)
-})
+ afterEach(async () => {
+ console.log(
+ "afterEach model surfaces kill",
+ back_port,
+ viewer_port,
+ project_folder_path,
+ )
+ await Promise.all([kill_back(back_port), kill_viewer(viewer_port)])
+ delete_folder_recursive(project_folder_path)
+ })
-describe("Model surfaces", () => {
- describe("Surfaces visibility", () => {
- test("Visibility true", async () => {
+ describe("surfaces visibility", () => {
+ test("visibility true", async () => {
const dataStyleStore = useDataStyleStore()
const viewerStore = useViewerStore()
const dataStore = useDataStore()
@@ -78,8 +78,8 @@ describe("Model surfaces", () => {
})
})
- describe("Surfaces color", () => {
- test("Color red", async () => {
+ describe("surfaces color", () => {
+ test("color red", async () => {
const dataStyleStore = useDataStyleStore()
const viewerStore = useViewerStore()
const dataStore = useDataStore()
diff --git a/tests/integration/stores/viewer.nuxt.test.js b/tests/integration/stores/viewer.nuxt.test.js
index c8d50900..af06be4e 100644
--- a/tests/integration/stores/viewer.nuxt.test.js
+++ b/tests/integration/stores/viewer.nuxt.test.js
@@ -8,9 +8,9 @@ import opengeodeweb_viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb
import {
runMicroservices,
teardownIntegrationTests,
-} from "../../integration/setup"
-import Status from "@ogw_front/utils/status"
-import { setupActivePinia } from "../../utils"
+} from "@ogw_tests/integration/setup"
+import { Status } from "@ogw_front/utils/status"
+import { setupActivePinia } from "@ogw_tests/utils"
import { useViewerStore } from "@ogw_front/stores/viewer"
const CONNECT_TIMEOUT = 25_000
diff --git a/tests/setup_indexeddb.js b/tests/setup_indexeddb.js
index 7132d02a..364011a9 100644
--- a/tests/setup_indexeddb.js
+++ b/tests/setup_indexeddb.js
@@ -1,4 +1,4 @@
import { setup } from "vitest-indexeddb"
-// eslint-disable-next-line jest/require-hook
+// oxlint-disable-next-line jest/require-hook
setup()
diff --git a/tests/unit/components/CrsSelector.nuxt.test.js b/tests/unit/components/CrsSelector.nuxt.test.js
index 2cf59fa8..41c09066 100644
--- a/tests/unit/components/CrsSelector.nuxt.test.js
+++ b/tests/unit/components/CrsSelector.nuxt.test.js
@@ -1,17 +1,17 @@
// Third party imports
-import { mountSuspended } from "@nuxt/test-utils/runtime"
import { beforeEach, describe, expect, test, vi } from "vitest"
+import { mountSuspended } from "@nuxt/test-utils/runtime"
// Local imports
+import { setupActivePinia, vuetify } from "@ogw_tests/utils"
import CrsSelector from "@ogw_front/components/CrsSelector"
import { useGeodeStore } from "@ogw_front/stores/geode"
-import { setupActivePinia, vuetify } from "../../utils"
const EXPECTED_LENGTH = 1
const FIRST_INDEX = 0
-let pinia
-let geodeStore
+let pinia = undefined
+let geodeStore = undefined
beforeEach(() => {
pinia = setupActivePinia()
diff --git a/tests/unit/components/ExtensionSelector.nuxt.test.js b/tests/unit/components/ExtensionSelector.nuxt.test.js
index 4ebe7e93..6d269b3f 100644
--- a/tests/unit/components/ExtensionSelector.nuxt.test.js
+++ b/tests/unit/components/ExtensionSelector.nuxt.test.js
@@ -1,12 +1,12 @@
// Third party imports
import * as components from "vuetify/components"
-import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
-import { mountSuspended, registerEndpoint } from "@nuxt/test-utils/runtime"
import { beforeEach, describe, expect, test, vi } from "vitest"
+import { mountSuspended, registerEndpoint } from "@nuxt/test-utils/runtime"
import { nextTick } from "vue"
+import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
// Local imports
-import { setupActivePinia, vuetify } from "../../utils"
+import { setupActivePinia, vuetify } from "@ogw_tests/utils"
import ExtensionSelector from "@ogw_front/components/ExtensionSelector"
import { useGeodeStore } from "@ogw_front/stores/geode"
@@ -22,15 +22,12 @@ const geodeStore = useGeodeStore()
beforeEach(() => {
geodeStore.base_url = ""
- geodeStore.request = vi.fn((schema, params, callbacks) => {
+ geodeStore.request = vi.fn(() => {
const response = {
geode_objects_and_output_extensions: {
BRep: { msh: { is_saveable: true } },
},
}
- if (callbacks?.response_function) {
- callbacks.response_function(response)
- }
return Promise.resolve(response)
})
})
diff --git a/tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js b/tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js
index 1665aee4..fc2db317 100644
--- a/tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js
+++ b/tests/unit/components/FeedBack/ErrorsBanner.nuxt.test.js
@@ -3,7 +3,7 @@ import { describe, expect, test, vi } from "vitest"
import { mount } from "@vue/test-utils"
// Local imports
-import { setupActivePinia, vuetify } from "../../../utils"
+import { setupActivePinia, vuetify } from "@ogw_tests/utils"
import FeedBackErrorBanner from "@ogw_front/components/FeedBack/ErrorBanner"
import { useFeedbackStore } from "@ogw_front/stores/feedback"
diff --git a/tests/unit/components/FeedBack/Snackers.nuxt.test.js b/tests/unit/components/FeedBack/Snackers.nuxt.test.js
index db7f957d..6b615476 100644
--- a/tests/unit/components/FeedBack/Snackers.nuxt.test.js
+++ b/tests/unit/components/FeedBack/Snackers.nuxt.test.js
@@ -4,7 +4,7 @@ import { describe, expect, test, vi } from "vitest"
import { mount } from "@vue/test-utils"
// Local imports
-import { setupActivePinia, vuetify } from "../../../utils"
+import { setupActivePinia, vuetify } from "@ogw_tests/utils"
import FeedBackSnackers from "@ogw_front/components/FeedBack/Snackers"
import { useFeedbackStore } from "@ogw_front/stores/feedback"
diff --git a/tests/unit/components/FileSelector.nuxt.test.js b/tests/unit/components/FileSelector.nuxt.test.js
index f0ece676..88afde3a 100644
--- a/tests/unit/components/FileSelector.nuxt.test.js
+++ b/tests/unit/components/FileSelector.nuxt.test.js
@@ -6,7 +6,7 @@ import { flushPromises } from "@vue/test-utils"
import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
// Local imports
-import { setupActivePinia, vuetify } from "../../utils"
+import { setupActivePinia, vuetify } from "@ogw_tests/utils"
import FileSelector from "@ogw_front/components/FileSelector"
import FileUploader from "@ogw_front/components/FileUploader"
import { useGeodeStore } from "@ogw_front/stores/geode"
diff --git a/tests/unit/components/FileUploader.nuxt.test.js b/tests/unit/components/FileUploader.nuxt.test.js
index ea3c49e8..665dbe99 100644
--- a/tests/unit/components/FileUploader.nuxt.test.js
+++ b/tests/unit/components/FileUploader.nuxt.test.js
@@ -6,7 +6,7 @@ import { flushPromises } from "@vue/test-utils"
import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
// Local imports
-import { setupActivePinia, vuetify } from "../../utils"
+import { setupActivePinia, vuetify } from "@ogw_tests/utils"
import FileUploader from "@ogw_front/components/FileUploader"
import { useGeodeStore } from "@ogw_front/stores/geode"
diff --git a/tests/unit/components/Inspector/InspectionButton.nuxt.test.js b/tests/unit/components/Inspector/InspectionButton.nuxt.test.js
index 79057dcf..d4eb3cd0 100644
--- a/tests/unit/components/Inspector/InspectionButton.nuxt.test.js
+++ b/tests/unit/components/Inspector/InspectionButton.nuxt.test.js
@@ -5,7 +5,7 @@ import { flushPromises } from "@vue/test-utils"
import { mountSuspended } from "@nuxt/test-utils/runtime"
// Local imports
-import { setupActivePinia, vuetify } from "../../../utils"
+import { setupActivePinia, vuetify } from "@ogw_tests/utils"
import InspectorInspectionButton from "@ogw_front/components/Inspector/InspectionButton"
import { useGeodeStore } from "@ogw_front/stores/geode"
diff --git a/tests/unit/components/Inspector/ResultPanel.nuxt.test.js b/tests/unit/components/Inspector/ResultPanel.nuxt.test.js
index 3b771a84..bedbc646 100644
--- a/tests/unit/components/Inspector/ResultPanel.nuxt.test.js
+++ b/tests/unit/components/Inspector/ResultPanel.nuxt.test.js
@@ -4,7 +4,7 @@ import { mountSuspended } from "@nuxt/test-utils/runtime"
// Local imports
import InspectorResultPanel from "@ogw_front/components/Inspector/ResultPanel"
-import { vuetify } from "../../../utils"
+import { vuetify } from "@ogw_tests/utils"
describe("Inspector/ResultPanel", async () => {
test(`Test with issues`, async () => {
diff --git a/tests/unit/components/Launcher.nuxt.test.js b/tests/unit/components/Launcher.nuxt.test.js
index d556ed8a..41e57df6 100644
--- a/tests/unit/components/Launcher.nuxt.test.js
+++ b/tests/unit/components/Launcher.nuxt.test.js
@@ -5,8 +5,8 @@ import ResizeObserver from "resize-observer-polyfill"
import { flushPromises } from "@vue/test-utils"
import { mountSuspended } from "@nuxt/test-utils/runtime"
+import { setupActivePinia, vuetify } from "@ogw_tests/utils"
import { useInfraStore } from "@ogw_front/stores/infra"
-import { setupActivePinia, vuetify } from "../../utils"
// Mock navigator.locks API
const mockLockRequest = vi
diff --git a/tests/unit/components/MissingFilesSelector.nuxt.test.js b/tests/unit/components/MissingFilesSelector.nuxt.test.js
index ad26de0e..0de9e216 100644
--- a/tests/unit/components/MissingFilesSelector.nuxt.test.js
+++ b/tests/unit/components/MissingFilesSelector.nuxt.test.js
@@ -6,7 +6,7 @@ import { flushPromises } from "@vue/test-utils"
import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
// Local imports
-import { setupActivePinia, vuetify } from "../../utils"
+import { setupActivePinia, vuetify } from "@ogw_tests/utils"
import FileUploader from "@ogw_front/components/FileUploader"
import MissingFilesSelector from "@ogw_front/components/MissingFilesSelector"
import { useGeodeStore } from "@ogw_front/stores/geode"
diff --git a/tests/unit/components/ObjectSelector.nuxt.test.js b/tests/unit/components/ObjectSelector.nuxt.test.js
index a7d0c6e1..9ce76e69 100644
--- a/tests/unit/components/ObjectSelector.nuxt.test.js
+++ b/tests/unit/components/ObjectSelector.nuxt.test.js
@@ -3,7 +3,7 @@ import { describe, expect, test } from "vitest"
import { mountSuspended, registerEndpoint } from "@nuxt/test-utils/runtime"
import { flushPromises } from "@vue/test-utils"
-import { setupActivePinia, vuetify } from "../../utils"
+import { setupActivePinia, vuetify } from "@ogw_tests/utils"
import ObjectSelector from "@ogw_front/components/ObjectSelector"
import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
import { useGeodeStore } from "@ogw_front/stores/geode"
diff --git a/tests/unit/components/PackagesVersions.nuxt.test.js b/tests/unit/components/PackagesVersions.nuxt.test.js
index 2a5d7a6c..7e7a19ef 100644
--- a/tests/unit/components/PackagesVersions.nuxt.test.js
+++ b/tests/unit/components/PackagesVersions.nuxt.test.js
@@ -1,7 +1,7 @@
import { describe, expect, test } from "vitest"
import { mountSuspended, registerEndpoint } from "@nuxt/test-utils/runtime"
-import { setupActivePinia, vuetify } from "../../utils"
+import { setupActivePinia, vuetify } from "@ogw_tests/utils"
import PackagesVersions from "@ogw_front/components/PackagesVersions"
import { useGeodeStore } from "@ogw_front/stores/geode"
diff --git a/tests/unit/components/Step.nuxt.test.js b/tests/unit/components/Step.nuxt.test.js
index 81ccb58e..3dc58b5c 100644
--- a/tests/unit/components/Step.nuxt.test.js
+++ b/tests/unit/components/Step.nuxt.test.js
@@ -6,14 +6,14 @@ import { mount } from "@vue/test-utils"
import ObjectSelector from "@ogw_front/components/ObjectSelector"
import Step from "@ogw_front/components/Step"
-import { vuetify } from "../../utils"
+import { vuetify } from "@ogw_tests/utils"
globalThis.ResizeObserver = ResizeObserver
describe(Step, () => {
test(`BRep`, async () => {
const geode_object_type = ref("BRep")
- const files = ref([])
+ const stepper_files = ref([])
const stepper_tree = reactive({
current_step_index: ref(0),
geode_object_type,
@@ -23,7 +23,9 @@ describe(Step, () => {
component: {
component_name: shallowRef(ObjectSelector),
component_options: {
- filenames: computed(() => files.value.map((file) => file.name)),
+ filenames: computed(() =>
+ stepper_files.value.map((file) => file.name),
+ ),
key: "",
},
},
diff --git a/tests/unit/components/Stepper.nuxt.test.js b/tests/unit/components/Stepper.nuxt.test.js
index 1fd5f3ca..306fe033 100644
--- a/tests/unit/components/Stepper.nuxt.test.js
+++ b/tests/unit/components/Stepper.nuxt.test.js
@@ -7,7 +7,7 @@ import { mountSuspended } from "@nuxt/test-utils/runtime"
// Local imports
import ObjectSelector from "@ogw_front/components/ObjectSelector"
import Stepper from "@ogw_front/components/Stepper"
-import { vuetify } from "../../utils"
+import { vuetify } from "@ogw_tests/utils"
const FIRST_INDEX = 0
diff --git a/tests/unit/composables/api_fetch.nuxt.test.js b/tests/unit/composables/api_fetch.nuxt.test.js
index 77142723..a620a3a6 100644
--- a/tests/unit/composables/api_fetch.nuxt.test.js
+++ b/tests/unit/composables/api_fetch.nuxt.test.js
@@ -3,7 +3,7 @@ import { beforeEach, describe, expect, test } from "vitest"
import { registerEndpoint } from "@nuxt/test-utils/runtime"
// Local imports
-import { setupActivePinia } from "../../utils"
+import { setupActivePinia } from "@ogw_tests/utils"
import { useFeedbackStore } from "@ogw_front/stores/feedback"
import { useGeodeStore } from "@ogw_front/stores/geode"
@@ -35,7 +35,7 @@ describe("geodeStore.request()", () => {
})
test("invalid schema", async () => {
- const schema = {
+ const invalid_schema = {
$id: "/test",
type: "object",
methods: ["POST"],
@@ -48,7 +48,7 @@ describe("geodeStore.request()", () => {
additionalProperties: false,
}
const params = { test: "hello" }
- expect(() => geodeStore.request(schema, params)).toThrow(
+ expect(() => geodeStore.request(invalid_schema, params)).toThrow(
"data/test must be number",
)
})
diff --git a/tests/unit/composables/ProjectManager.nuxt.test.js b/tests/unit/composables/project_manager.nuxt.test.js
similarity index 91%
rename from tests/unit/composables/ProjectManager.nuxt.test.js
rename to tests/unit/composables/project_manager.nuxt.test.js
index fb15af11..d9b115cf 100644
--- a/tests/unit/composables/ProjectManager.nuxt.test.js
+++ b/tests/unit/composables/project_manager.nuxt.test.js
@@ -3,7 +3,7 @@ import { beforeEach, describe, expect, test, vi } from "vitest"
// Local imports
import { appMode } from "@ogw_front/utils/app_mode"
-import { setupActivePinia } from "../../utils"
+import { setupActivePinia } from "@ogw_tests/utils"
import { useProjectManager } from "@ogw_front/composables/project_manager"
// Constants
@@ -135,11 +135,11 @@ const hybridViewerStoreMock = {
// MOCKS
vi.stubGlobal("$fetch", vi.fn().mockResolvedValue({ snapshot: snapshotMock }))
-vi.mock("../../../internal/utils/viewer_call", () => ({
+vi.mock(import("@ogw_internal/utils/viewer_call"), () => ({
viewer_call: viewer_call_mock_fn,
}))
-vi.mock("@ogw_front/composables/api_fetch", () => ({
+vi.mock(import("@ogw_front/composables/api_fetch"), () => ({
api_fetch: vi.fn(async (_req, options = {}) => {
const response = {
_data: new Blob(["zipcontent"], { type: "application/zip" }),
@@ -153,29 +153,29 @@ vi.mock("@ogw_front/composables/api_fetch", () => ({
return response
}),
}))
-vi.mock("js-file-download", () => ({ default: vi.fn() }))
-vi.mock("@ogw_front/stores/infra", () => ({
+vi.mock(import("js-file-download"), () => ({ default: vi.fn() }))
+vi.mock(import("@ogw_front/stores/infra"), () => ({
useInfraStore: () => infraStoreMock,
}))
-vi.mock("@ogw_front/stores/viewer", () => ({
+vi.mock(import("@ogw_front/stores/viewer"), () => ({
useViewerStore: () => viewerStoreMock,
}))
-vi.mock("@ogw_front/stores/treeview", () => ({
+vi.mock(import("@ogw_front/stores/treeview"), () => ({
useTreeviewStore: () => treeviewStoreMock,
}))
-vi.mock("@ogw_front/stores/data", () => ({
+vi.mock(import("@ogw_front/stores/data"), () => ({
useDataStore: () => dataStoreMock,
}))
-vi.mock("@ogw_front/stores/data_style", () => ({
+vi.mock(import("@ogw_front/stores/data_style"), () => ({
useDataStyleStore: () => dataStyleStoreMock,
}))
-vi.mock("@ogw_front/stores/hybrid_viewer", () => ({
+vi.mock(import("@ogw_front/stores/hybrid_viewer"), () => ({
useHybridViewerStore: () => hybridViewerStoreMock,
}))
-vi.mock("@ogw_front/stores/geode", () => ({
+vi.mock(import("@ogw_front/stores/geode"), () => ({
useGeodeStore: () => geodeStoreMock,
}))
-vi.mock("@ogw_front/stores/app", () => ({
+vi.mock(import("@ogw_front/stores/app"), () => ({
useAppStore: () => ({
exportStores: vi.fn(() => ({ projectName: "mockedProject" })),
}),
@@ -242,7 +242,6 @@ function verifyRemaining() {
beforeEach(() => {
setupActivePinia()
- // reset spies
const storesList = [
viewerStoreMock,
treeviewStoreMock,
diff --git a/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js b/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js
index 6b04c237..a46ba4b5 100644
--- a/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js
+++ b/tests/unit/composables/run_function_when_microservices_connected.nuxt.test.js
@@ -1,19 +1,19 @@
// Third party imports
-import { flushPromises } from "@vue/test-utils"
import { beforeEach, describe, expect, test, vi } from "vitest"
+import { flushPromises } from "@vue/test-utils"
// Local imports
+import { Status } from "@ogw_front/utils/status"
import { run_function_when_microservices_connected } from "@ogw_front/composables/run_function_when_microservices_connected"
-import { setupActivePinia } from "../../utils"
-import Status from "@ogw_front/utils/status"
+import { setupActivePinia } from "@ogw_tests/utils"
import { useGeodeStore } from "@ogw_front/stores/geode"
import { useInfraStore } from "@ogw_front/stores/infra"
import { useViewerStore } from "@ogw_front/stores/viewer"
const dumb_obj = { dumb_method: () => true }
-let infraStore
-let geodeStore
-let viewerStore
+let infraStore = undefined
+let geodeStore = undefined
+let viewerStore = undefined
beforeEach(() => {
setupActivePinia()
diff --git a/tests/unit/composables/upload_file.nuxt.test.js b/tests/unit/composables/upload_file.nuxt.test.js
index 0e2a8775..e88bcff8 100644
--- a/tests/unit/composables/upload_file.nuxt.test.js
+++ b/tests/unit/composables/upload_file.nuxt.test.js
@@ -4,8 +4,8 @@ import { registerEndpoint } from "@nuxt/test-utils/runtime"
import schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
// Local imports
-import { setupActivePinia } from "../../utils"
-import upload_file from "@ogw_front/utils/upload_file"
+import { setupActivePinia } from "@ogw_tests/utils"
+import { upload_file } from "@ogw_front/utils/upload_file"
import { useFeedbackStore } from "@ogw_front/stores/feedback"
import { useGeodeStore } from "@ogw_front/stores/geode"
diff --git a/tests/unit/plugins/project_load.nuxt.test.js b/tests/unit/plugins/project_load.nuxt.test.js
index 2510f1c6..b4bdd7e9 100644
--- a/tests/unit/plugins/project_load.nuxt.test.js
+++ b/tests/unit/plugins/project_load.nuxt.test.js
@@ -6,19 +6,19 @@ import { useDataStyleStore } from "@ogw_front/stores/data_style"
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer"
import { useTreeviewStore } from "@ogw_front/stores/treeview"
-import { database } from "../../../internal/database/database.js"
-import { setupActivePinia } from "../../utils"
+import { database } from "@ogw_internal/database/database.js"
+import { setupActivePinia } from "@ogw_tests/utils"
const PANEL_WIDTH = 320
const Z_SCALE = 1.5
const STORES_SLICE_START = 1
-vi.mock("../../../internal/utils/viewer_call", () => ({
+vi.mock(import("@ogw_internal/utils/viewer_call"), () => ({
viewer_call: vi.fn(async () => {
await Promise.resolve()
}),
}))
-vi.mock("../../../app/stores/hybrid_viewer", () => ({
+vi.mock(import("@ogw_front/stores/hybrid_viewer"), () => ({
useHybridViewerStore: () => ({
$id: "hybridViewer",
initHybridViewer: vi.fn(),
diff --git a/tests/unit/stores/App.nuxt.test.js b/tests/unit/stores/app.nuxt.test.js
similarity index 97%
rename from tests/unit/stores/App.nuxt.test.js
rename to tests/unit/stores/app.nuxt.test.js
index 823cc68c..4d07cc0e 100644
--- a/tests/unit/stores/App.nuxt.test.js
+++ b/tests/unit/stores/app.nuxt.test.js
@@ -1,10 +1,8 @@
import { beforeEach, describe, expect, expectTypeOf, test, vi } from "vitest"
-import { createTestingPinia } from "@pinia/testing"
-import { setActivePinia } from "pinia"
import { useAppStore } from "@ogw_front/stores/app"
-import { setupActivePinia } from "../../utils"
+import { setupActivePinia } from "@ogw_tests/utils"
// Constants
const SINGLE_STORE_LENGTH = 1
diff --git a/tests/unit/stores/Feedback.nuxt.test.js b/tests/unit/stores/feedback.nuxt.test.js
similarity index 91%
rename from tests/unit/stores/Feedback.nuxt.test.js
rename to tests/unit/stores/feedback.nuxt.test.js
index 8158ad9b..63721148 100644
--- a/tests/unit/stores/Feedback.nuxt.test.js
+++ b/tests/unit/stores/feedback.nuxt.test.js
@@ -2,9 +2,12 @@
import { beforeEach, describe, expect, expectTypeOf, test } from "vitest"
// Local imports
-import { setupActivePinia } from "../../utils"
+import { setupActivePinia } from "@ogw_tests/utils"
import { useFeedbackStore } from "@ogw_front/stores/feedback"
+const ERROR_500 = 500
+const MILISECONDS_TIMEOUT = 1000
+
beforeEach(() => {
setupActivePinia()
})
@@ -23,7 +26,7 @@ describe("Feedback Store", () => {
test("test add_error", () => {
const feedbackStore = useFeedbackStore()
feedbackStore.add_error(
- 500,
+ ERROR_500,
"/test",
"test message",
"test description",
@@ -36,7 +39,7 @@ describe("Feedback Store", () => {
const feedbackStore = useFeedbackStore()
feedbackStore.feedbacks_timeout_miliseconds = 500
feedbackStore.add_error(
- 500,
+ ERROR_500,
"/test",
"test message",
"test description",
@@ -44,7 +47,7 @@ describe("Feedback Store", () => {
expect(feedbackStore.feedbacks).toHaveLength(1)
setTimeout(() => {
expect(feedbackStore.feedbacks).toHaveLength(0)
- }, 1000)
+ }, MILISECONDS_TIMEOUT)
})
})
@@ -58,7 +61,7 @@ describe("Feedback Store", () => {
setTimeout(() => {
expect(feedbackStore.feedbacks).toHaveLength(0)
- }, 1000)
+ }, MILISECONDS_TIMEOUT)
})
})
diff --git a/tests/unit/stores/Geode.nuxt.test.js b/tests/unit/stores/geode.nuxt.test.js
similarity index 96%
rename from tests/unit/stores/Geode.nuxt.test.js
rename to tests/unit/stores/geode.nuxt.test.js
index 46c6d90a..c2ce5ab9 100644
--- a/tests/unit/stores/Geode.nuxt.test.js
+++ b/tests/unit/stores/geode.nuxt.test.js
@@ -1,12 +1,12 @@
// Third party imports
+import { beforeEach, describe, expect, expectTypeOf, test, vi } from "vitest"
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json"
import { registerEndpoint } from "@nuxt/test-utils/runtime"
-import { describe, expect, expectTypeOf, test, vi } from "vitest"
// Local imports
+import { Status } from "@ogw_front/utils/status"
import { appMode } from "@ogw_front/utils/app_mode"
-import { setupActivePinia } from "../../utils"
-import Status from "@ogw_front/utils/status"
+import { setupActivePinia } from "@ogw_tests/utils"
import { useGeodeStore } from "@ogw_front/stores/geode"
import { useInfraStore } from "@ogw_front/stores/infra"
diff --git a/tests/unit/stores/Infra.nuxt.test.js b/tests/unit/stores/infra.nuxt.test.js
similarity index 83%
rename from tests/unit/stores/Infra.nuxt.test.js
rename to tests/unit/stores/infra.nuxt.test.js
index c4c48273..08076ea4 100644
--- a/tests/unit/stores/Infra.nuxt.test.js
+++ b/tests/unit/stores/infra.nuxt.test.js
@@ -3,9 +3,9 @@ import { beforeEach, describe, expect, expectTypeOf, test, vi } from "vitest"
import { registerEndpoint } from "@nuxt/test-utils/runtime"
// Local imports
-import Status from "@ogw_front/utils/status"
+import { Status } from "@ogw_front/utils/status"
import { appMode } from "@ogw_front/utils/app_mode"
-import { setupActivePinia } from "../../utils"
+import { setupActivePinia } from "@ogw_tests/utils"
import { useGeodeStore } from "@ogw_front/stores/geode"
import { useInfraStore } from "@ogw_front/stores/infra"
import { useLambdaStore } from "@ogw_front/stores/lambda"
@@ -70,81 +70,81 @@ describe("Infra Store", () => {
test("test geode false & viewer false", () => {
const infraStore = useInfraStore()
const geodeStore = useGeodeStore()
- const viewerStore = useViewerStore()
+ const viewer_store = useViewerStore()
infraStore.register_microservice(geodeStore, {
request: vi.fn(),
connect: vi.fn(),
launch: vi.fn(),
})
- infraStore.register_microservice(viewerStore, {
+ infraStore.register_microservice(viewer_store, {
request: vi.fn(),
connect: vi.fn(),
launch: vi.fn(),
})
geodeStore.$patch({ status: Status.NOT_CONNECTED })
- viewerStore.$patch({ status: Status.NOT_CONNECTED })
+ viewer_store.$patch({ status: Status.NOT_CONNECTED })
expect(infraStore.microservices_connected).toBeFalsy()
})
test("test geode true & viewer false", () => {
const infraStore = useInfraStore()
const geodeStore = useGeodeStore()
- const viewerStore = useViewerStore()
+ const viewer_store = useViewerStore()
infraStore.register_microservice(geodeStore, {
request: vi.fn(),
connect: vi.fn(),
launch: vi.fn(),
})
- infraStore.register_microservice(viewerStore, {
+ infraStore.register_microservice(viewer_store, {
request: vi.fn(),
connect: vi.fn(),
launch: vi.fn(),
})
geodeStore.$patch({ status: Status.CONNECTED })
- viewerStore.$patch({ status: Status.NOT_CONNECTED })
+ viewer_store.$patch({ status: Status.NOT_CONNECTED })
expect(infraStore.microservices_connected).toBeFalsy()
})
test("test geode false & viewer true", () => {
const infraStore = useInfraStore()
const geodeStore = useGeodeStore()
- const viewerStore = useViewerStore()
+ const viewer_store = useViewerStore()
infraStore.register_microservice(geodeStore, {
request: vi.fn(),
connect: vi.fn(),
launch: vi.fn(),
})
- infraStore.register_microservice(viewerStore, {
+ infraStore.register_microservice(viewer_store, {
request: vi.fn(),
connect: vi.fn(),
launch: vi.fn(),
})
geodeStore.$patch({ status: Status.NOT_CONNECTED })
- viewerStore.$patch({ status: Status.CONNECTED })
+ viewer_store.$patch({ status: Status.CONNECTED })
expect(infraStore.microservices_connected).toBeFalsy()
})
test("test geode true & viewer true", () => {
const infraStore = useInfraStore()
const geodeStore = useGeodeStore()
- const viewerStore = useViewerStore()
+ const viewer_store = useViewerStore()
infraStore.register_microservice(geodeStore, {
request: vi.fn(),
connect: vi.fn(),
launch: vi.fn(),
})
- infraStore.register_microservice(viewerStore, {
+ infraStore.register_microservice(viewer_store, {
request: vi.fn(),
connect: vi.fn(),
launch: vi.fn(),
})
geodeStore.$patch({ status: Status.CONNECTED })
- viewerStore.$patch({ status: Status.CONNECTED })
+ viewer_store.$patch({ status: Status.CONNECTED })
expect(infraStore.microservices_connected).toBeTruthy()
})
})
@@ -157,81 +157,81 @@ describe("Infra Store", () => {
test("test geode false & viewer false", () => {
const infraStore = useInfraStore()
const geodeStore = useGeodeStore()
- const viewerStore = useViewerStore()
+ const viewer_store = useViewerStore()
infraStore.register_microservice(geodeStore, {
request: vi.fn(),
connect: vi.fn(),
launch: vi.fn(),
})
- infraStore.register_microservice(viewerStore, {
+ infraStore.register_microservice(viewer_store, {
request: vi.fn(),
connect: vi.fn(),
launch: vi.fn(),
})
geodeStore.$patch({ request_counter: 0 })
- viewerStore.$patch({ request_counter: 0 })
+ viewer_store.$patch({ request_counter: 0 })
expect(infraStore.microservices_busy).toBeFalsy()
})
test("test geode true & viewer false", () => {
const infraStore = useInfraStore()
const geodeStore = useGeodeStore()
- const viewerStore = useViewerStore()
+ const viewer_store = useViewerStore()
infraStore.register_microservice(geodeStore, {
request: vi.fn(),
connect: vi.fn(),
launch: vi.fn(),
})
- infraStore.register_microservice(viewerStore, {
+ infraStore.register_microservice(viewer_store, {
request: vi.fn(),
connect: vi.fn(),
launch: vi.fn(),
})
geodeStore.$patch({ request_counter: 1 })
- viewerStore.$patch({ request_counter: 0 })
+ viewer_store.$patch({ request_counter: 0 })
expect(infraStore.microservices_busy).toBeTruthy()
})
test("test geode false & viewer true", () => {
const infraStore = useInfraStore()
const geodeStore = useGeodeStore()
- const viewerStore = useViewerStore()
+ const viewer_store = useViewerStore()
infraStore.register_microservice(geodeStore, {
request: vi.fn(),
connect: vi.fn(),
launch: vi.fn(),
})
- infraStore.register_microservice(viewerStore, {
+ infraStore.register_microservice(viewer_store, {
request: vi.fn(),
connect: vi.fn(),
launch: vi.fn(),
})
geodeStore.$patch({ request_counter: 0 })
- viewerStore.$patch({ request_counter: 1 })
+ viewer_store.$patch({ request_counter: 1 })
expect(infraStore.microservices_busy).toBeTruthy()
})
test("test geode true & viewer true", () => {
const infraStore = useInfraStore()
const geodeStore = useGeodeStore()
- const viewerStore = useViewerStore()
+ const viewer_store = useViewerStore()
infraStore.register_microservice(geodeStore, {
request: vi.fn(),
connect: vi.fn(),
launch: vi.fn(),
})
- infraStore.register_microservice(viewerStore, {
+ infraStore.register_microservice(viewer_store, {
request: vi.fn(),
connect: vi.fn(),
launch: vi.fn(),
})
geodeStore.$patch({ request_counter: 1 })
- viewerStore.$patch({ request_counter: 1 })
+ viewer_store.$patch({ request_counter: 1 })
expect(infraStore.microservices_busy).toBeTruthy()
})
})
@@ -256,7 +256,7 @@ describe("Infra Store", () => {
test("register multiple microservices", () => {
const infraStore = useInfraStore()
const geodeStore = useGeodeStore()
- const viewerStore = useViewerStore()
+ const viewer_store = useViewerStore()
infraStore.register_microservice(geodeStore, {
request: vi.fn(),
@@ -264,7 +264,7 @@ describe("Infra Store", () => {
launch: vi.fn(),
})
- infraStore.register_microservice(viewerStore, {
+ infraStore.register_microservice(viewer_store, {
request: vi.fn(),
connect: vi.fn(),
launch: vi.fn(),
@@ -284,7 +284,7 @@ describe("Infra Store", () => {
test("test with end-point", async () => {
const infraStore = useInfraStore()
const geodeStore = useGeodeStore()
- const viewerStore = useViewerStore()
+ const viewer_store = useViewerStore()
const lambdaStore = useLambdaStore()
infraStore.app_mode = appMode.CLOUD
@@ -298,7 +298,7 @@ describe("Infra Store", () => {
expect(infraStore.ID).toBe(ID)
expect(geodeStore.status).toBe(Status.NOT_CONNECTED)
- expect(viewerStore.status).toBe(Status.NOT_CONNECTED)
+ expect(viewer_store.status).toBe(Status.NOT_CONNECTED)
})
})
})
diff --git a/tests/unit/stores/Lambda.nuxt.test.js b/tests/unit/stores/lambda.nuxt.test.js
similarity index 97%
rename from tests/unit/stores/Lambda.nuxt.test.js
rename to tests/unit/stores/lambda.nuxt.test.js
index ffe936cc..cded4549 100644
--- a/tests/unit/stores/Lambda.nuxt.test.js
+++ b/tests/unit/stores/lambda.nuxt.test.js
@@ -3,8 +3,8 @@ import { beforeEach, describe, expect, expectTypeOf, test, vi } from "vitest"
import { registerEndpoint } from "@nuxt/test-utils/runtime"
// Local imports
-import Status from "@ogw_front/utils/status"
-import { setupActivePinia } from "../../utils"
+import { Status } from "@ogw_front/utils/status"
+import { setupActivePinia } from "@ogw_tests/utils"
import { useFeedbackStore } from "@ogw_front/stores/feedback"
import { useLambdaStore } from "@ogw_front/stores/lambda"
diff --git a/tests/unit/stores/Treeview.nuxt.test.js b/tests/unit/stores/treeview.nuxt.test.js
similarity index 92%
rename from tests/unit/stores/Treeview.nuxt.test.js
rename to tests/unit/stores/treeview.nuxt.test.js
index cfcb1fea..60ed0c5d 100644
--- a/tests/unit/stores/Treeview.nuxt.test.js
+++ b/tests/unit/stores/treeview.nuxt.test.js
@@ -1,8 +1,8 @@
// Third party imports
-import { describe, expect, expectTypeOf, test } from "vitest"
+import { beforeEach, describe, expect, expectTypeOf, test } from "vitest"
// Local imports
-import { setupActivePinia } from "../../utils"
+import { setupActivePinia } from "@ogw_tests/utils"
import { useTreeviewStore } from "@ogw_front/stores/treeview"
// CONSTANTS
diff --git a/tests/unit/stores/Viewer.nuxt.test.js b/tests/unit/stores/viewer.nuxt.test.js
similarity index 99%
rename from tests/unit/stores/Viewer.nuxt.test.js
rename to tests/unit/stores/viewer.nuxt.test.js
index 31cca9eb..4c7e34fb 100644
--- a/tests/unit/stores/Viewer.nuxt.test.js
+++ b/tests/unit/stores/viewer.nuxt.test.js
@@ -13,7 +13,7 @@ import {
import { WebSocket } from "ws"
// Local imports
import { appMode } from "@ogw_front/utils/app_mode"
-import { setupActivePinia } from "../../utils"
+import { setupActivePinia } from "@ogw_tests/utils"
import { useInfraStore } from "@ogw_front/stores/infra"
import { useViewerStore } from "@ogw_front/stores/viewer"
diff --git a/tests/unit/utils/recaptcha.nuxt.test.js b/tests/unit/utils/recaptcha.nuxt.test.js
index e51185c7..c40b1df3 100644
--- a/tests/unit/utils/recaptcha.nuxt.test.js
+++ b/tests/unit/utils/recaptcha.nuxt.test.js
@@ -5,35 +5,39 @@ import { describe, expect, test } from "vitest"
import { check_recaptcha_params } from "@ogw_front/utils/recaptcha"
describe("recaptcha", () => {
- const name = ""
- const email = ""
- const launch = false
+ const default_name = ""
+ const default_email = ""
+ const default_launch = false
const internal_error = 500
const success = 200
describe("wrong params", () => {
test("name", () => {
const name = "test"
- const result = check_recaptcha_params(name, email, launch)
+ const result = check_recaptcha_params(name, default_email, default_launch)
expect(result.statusCode).toBe(internal_error)
})
test("email", () => {
const email = "test"
- const result = check_recaptcha_params(name, email, launch)
+ const result = check_recaptcha_params(default_name, email, default_launch)
expect(result.statusCode).toBe(internal_error)
})
test("launch", () => {
const launch = true
- const result = check_recaptcha_params(name, email, launch)
+ const result = check_recaptcha_params(default_name, default_email, launch)
expect(result.statusCode).toBe(internal_error)
})
})
describe("right params", () => {
test("name", () => {
- const result = check_recaptcha_params(name, email, launch)
+ const result = check_recaptcha_params(
+ default_name,
+ default_email,
+ default_launch,
+ )
expect(result.statusCode).toBe(success)
})
})
diff --git a/tests/unit/utils/validate_schema.nuxt.test.js b/tests/unit/utils/validate_schema.nuxt.test.js
index 3c619f3f..475e9837 100644
--- a/tests/unit/utils/validate_schema.nuxt.test.js
+++ b/tests/unit/utils/validate_schema.nuxt.test.js
@@ -2,7 +2,7 @@
import { describe, expect, test } from "vitest"
// Local imports
-import validate_schema from "@ogw_front/utils/validate_schema"
+import { validate_schema } from "@ogw_front/utils/validate_schema"
// CONSTANTS
const MIN_0 = 0
diff --git a/tests/utils.js b/tests/utils.js
index 9630d127..9a7ec075 100644
--- a/tests/utils.js
+++ b/tests/utils.js
@@ -4,6 +4,7 @@ import * as directives from "vuetify/directives"
import { createTestingPinia } from "@pinia/testing"
import { createVuetify } from "vuetify"
import { setActivePinia } from "pinia"
+import { vi } from "vitest"
const vuetify = createVuetify({ components, directives })
diff --git a/tests/vitest.config.js b/tests/vitest.config.js
index 674af6e4..18fe9c8d 100644
--- a/tests/vitest.config.js
+++ b/tests/vitest.config.js
@@ -1,22 +1,30 @@
import { defineConfig } from "vitest/config"
import { defineVitestProject } from "@nuxt/test-utils/config"
+import { fileURLToPath } from "node:url"
import path from "node:path"
+const __dirname = path.dirname(fileURLToPath(import.meta.url))
+
const RETRIES = 3
const DEFAULT_RETRY = 0
const globalRetry = process.env.CI ? RETRIES : DEFAULT_RETRY
-// eslint-disable-next-line import/no-default-export
+// oxlint-disable-next-line import/no-default-export
export default defineConfig({
+ resolve: {
+ alias: {
+ "@ogw_tests": path.resolve(__dirname, "."),
+ },
+ },
test: {
- globals: true,
+ globals: false,
setupFiles: [path.resolve(__dirname, "./setup_indexeddb.js")],
projects: [
await defineVitestProject({
test: {
name: "unit",
- globals: true,
+ globals: false,
include: ["tests/unit/**/*.test.js"],
environment: "nuxt",
setupFiles: [path.resolve(__dirname, "./setup_indexeddb.js")],
@@ -31,7 +39,7 @@ export default defineConfig({
await defineVitestProject({
test: {
name: "integration",
- globals: true,
+ globals: false,
include: ["tests/integration/**/*.test.js"],
environment: "nuxt",
fileParallelism: false,
diff --git a/vuetify_config.js b/vuetify_config.js
index 7eb78d56..9d7a1e59 100644
--- a/vuetify_config.js
+++ b/vuetify_config.js
@@ -19,4 +19,4 @@ const vuetify = {
},
}
-export default vuetify
+export { vuetify }