Skip to content
Closed
4 changes: 2 additions & 2 deletions app/components/ObjectSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const toggle_loading = useToggle(loading);

function select_geode_object(object_map) {
const object_keys = Object.keys(object_map);
if (object_keys.length === 0) {
if (!object_keys.length) {
return undefined;
}
if (object_keys.length === 1 && object_map[object_keys[0]].is_loadable > 0) {
Expand Down Expand Up @@ -56,7 +56,7 @@ async function get_allowed_objects() {
const promise_array = filenames.map((filename) => geodeStore.request(schema, { filename }));
const responses = await Promise.all(promise_array);
const allowed_objects_list = responses.map((response) => response.allowed_objects);
const all_keys = [...new Set(allowed_objects_list.flatMap((obj) => Object.keys(obj)))];
const all_keys = [...new Set(allowed_objects_list.flatMap(Object.keys))];
const common_keys = all_keys.filter((key) => allowed_objects_list.every((obj) => key in obj));
const final_object = {};
for (const key of common_keys) {
Expand Down
9 changes: 4 additions & 5 deletions app/components/Recaptcha.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,10 @@ const emailRules = [
];

onMounted(() => {
if (
import.meta.client &&
(process.env.NODE_ENV !== "production" || infraStore.app_mode !== appMode.CLOUD)
) {
infraStore.$patch({ is_captcha_validated: true });
if (import.meta.client) {
if (process.env.NODE_ENV !== "production" || infraStore.app_mode !== appMode.CLOUD) {
infraStore.$patch({ is_captcha_validated: true });
}
}
});
async function submit_recaptcha() {
Expand Down
39 changes: 19 additions & 20 deletions app/stores/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ export const useAppStore = defineStore("app", () => {
});
finalURL = URL.createObjectURL(newBlob);
}
// oxlint-disable-next-line no-inline-comments
const extensionModule = await import(/* @vite-ignore */ finalURL);

if (finalURL !== path && finalURL.startsWith("blob:")) {
Expand All @@ -122,25 +121,25 @@ export const useAppStore = defineStore("app", () => {
throw new Error("Extension API not initialized");
}

if (typeof extensionModule.install !== "function") {
throw new TypeError("Extension must export an install function");
if (typeof extensionModule.install === "function") {
await extensionModule.install(extensionAPI.value, backendPath);

const extensionData = {
module: extensionModule,
id: extensionId,
path,
backendPath,
loadedAt: new Date().toISOString(),
metadata: extensionModule.metadata,
enabled: true,
};
loadedExtensions.value.set(extensionId, extensionData);

console.log(`[AppStore] Extension loaded successfully: ${extensionId}`);
return extensionModule;
} else {
throw new Error("Extension must export an install function");
}

await extensionModule.install(extensionAPI.value, backendPath);

const extensionData = {
module: extensionModule,
id: extensionId,
path,
backendPath,
loadedAt: new Date().toISOString(),
metadata: extensionModule.metadata,
enabled: true,
};
loadedExtensions.value.set(extensionId, extensionData);

console.log(`[AppStore] Extension loaded successfully: ${extensionId}`);
return extensionModule;
} catch (error) {
console.error(`[AppStore] Failed to load extension from ${path}:`, error);
throw error;
Expand Down Expand Up @@ -258,7 +257,7 @@ export const useAppStore = defineStore("app", () => {
schema,
{},
{
response_function: (response) => {
response_function: async (response) => {
console.log(`[APP] ${response.projectFolderPath} created`);
projectFolderPath.value = response.projectFolderPath;
},
Expand Down
4 changes: 2 additions & 2 deletions app/stores/feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ export const useFeedbackStore = defineStore("feedback", {
this.delete_feedback(feedbackId);
}, this.feedbacks_timeout_miliseconds);
},
delete_feedback(feedbackId) {
async delete_feedback(feedbackId) {
this.feedbacks = this.feedbacks.filter((feedback) => feedback.id !== feedbackId);
},
delete_server_error() {
async delete_server_error() {
this.server_error = false;
},
},
Expand Down
7 changes: 4 additions & 3 deletions app/stores/geode.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,23 @@ export const useGeodeStore = defineStore("geode", {
}, DEFAULT_PING_INTERVAL_SECONDS * MILLISECONDS_IN_SECOND);
},
ping() {
const geodeStore = this;
const feedbackStore = useFeedbackStore();
return this.request(
back_schemas.opengeodeweb_back.ping,
{},
{
request_error_function: () => {
feedbackStore.$patch({ server_error: true });
this.status = Status.NOT_CONNECTED;
geodeStore.status = Status.NOT_CONNECTED;
},
response_function: () => {
feedbackStore.$patch({ server_error: false });
this.status = Status.CONNECTED;
geodeStore.status = Status.CONNECTED;
},
response_error_function: () => {
feedbackStore.$patch({ server_error: true });
this.status = Status.NOT_CONNECTED;
geodeStore.status = Status.NOT_CONNECTED;
},
},
);
Expand Down
5 changes: 1 addition & 4 deletions app/stores/hybrid_viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,7 @@ export const useHybridViewerStore = defineStore("hybridViewer", () => {
delete hybridDb[id];
}

function setVisibility(id, visibility) {
if (!hybridDb[id]) {
return;
}
async function setVisibility(id, visibility) {
hybridDb[id].actor.setVisibility(visibility);
const renderWindow = genericRenderWindow.value.getRenderWindow();
renderWindow.render();
Expand Down
4 changes: 2 additions & 2 deletions app/stores/infra.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ export const useInfraStore = defineStore("infra", {
const store_name = store.$id;
console.log("[INFRA] Registering microservice:", store_name);

if (!this.microservices.some((microservice) => microservice.$id === store_name)) {
if (!this.microservices.find((microservice) => microservice.$id === store_name)) {
this.microservices.push(store);
console.log("[INFRA] Microservice registered:", store_name);
}
},
create_backend() {
async create_backend() {
console.log("[INFRA] Starting create_backend - Mode:", this.app_mode);
console.log(
"[INFRA] Registered microservices:",
Expand Down
2 changes: 1 addition & 1 deletion app/stores/lambda.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const useLambdaStore = defineStore("lambda", {
console.log("[LAMBDA] Lambda launched, ID:", id);
return id;
},
connect() {
async connect() {
console.log("[LAMBDA] Lambda connected");
this.status = Status.CONNECTED;
return Promise.resolve();
Expand Down
4 changes: 2 additions & 2 deletions app/stores/treeview.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const useTreeviewStore = defineStore("treeview", () => {
};
}

function importStores(snapshot) {
async function importStores(snapshot) {
isAdditionnalTreeDisplayed.value = snapshot?.isAdditionnalTreeDisplayed || false;
panelWidth.value = snapshot?.panelWidth || PANEL_WIDTH;
model_id.value = snapshot?.model_id || "";
Expand All @@ -83,7 +83,7 @@ export const useTreeviewStore = defineStore("treeview", () => {
function finalizeImportSelection() {
const ids = pendingSelectionIds.value || [];
const rebuilt = [];
if (ids.length === 0) {
if (!ids.length) {
for (const group of items.value) {
for (const child of group.children) {
rebuilt.push(child);
Expand Down
2 changes: 1 addition & 1 deletion app/stores/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export const useViewerStore = defineStore(
request_counter.value -= 1;
}

function launch(args = ({ projectFolderPath } = {})) {
function launch(args = { projectFolderPath }) {
console.log("[VIEWER] Launching viewer microservice...", { args });
const appStore = useAppStore();
const schema = {
Expand Down
6 changes: 3 additions & 3 deletions app/utils/local/cleanup.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ function killWebsocketMicroservice(microservice) {
function killMicroservice(microservice) {
if (microservice.type === "back") {
return killHttpMicroservice(microservice);
}
if (microservice.type === "viewer") {
} else if (microservice.type === "viewer") {
return killWebsocketMicroservice(microservice);
} else {
throw new Error(`Unknown microservice type: ${microservice.type}`);
}
throw new Error(`Unknown microservice type: ${microservice.type}`);
}

function killMicroservices(microservices) {
Expand Down
2 changes: 1 addition & 1 deletion app/utils/local/path.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function createPath(dirPath) {
}

function generateProjectFolderPath(projectName) {
return path.join(os.tmpdir(), projectName.replaceAll("/", "_"), uuidv4());
return path.join(os.tmpdir(), projectName.replace(/\//g, "_"), uuidv4());
}

export { createPath, executablePath, executableName, generateProjectFolderPath };
5 changes: 4 additions & 1 deletion app/utils/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import path from "node:path";
// Third party imports
import JSZip from "jszip";

async function unzipFile(zipFilePath, outputDir = zipFilePath.replace(/\.[^/.]+$/, "")) {
async function unzipFile(
zipFilePath,
outputDir = zipFilePath.replace(/\.[^/.]+$/, ""), // Remove the file extension
) {
console.log("Unzipping file...", zipFilePath, outputDir);
try {
const data = await fs.promises.readFile(zipFilePath);
Expand Down
10 changes: 5 additions & 5 deletions internal/database/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ class Database extends Dexie {
await tempDb.open();

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

currentStores[dataTable.name] = dataTable.schema;
currentStores[modelComponentsTable.name] = modelComponentsTable.schema;
currentStores[modelComponentsRelationTable.name] = modelComponentsRelationTable.schema;

for (const table of tempDb.tables) {
const keyPath = table.schema.primKey.src;
Expand Down
18 changes: 8 additions & 10 deletions internal/stores/data_style/mesh/cells/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,28 @@
);
if (type === "color") {
return meshCellsColorStyle.setMeshCellsColor(id, meshCellsColorStyle.meshCellsColor(id));
}
if (type === "textures") {
} else if (type === "textures") {
const textures = meshCellsTexturesStore.meshCellsTextures(id);
if (textures === undefined) {
return;
return Promise.resolve();
}
return meshCellsTexturesStore.setMeshCellsTextures(id, textures);
}
if (type === "vertex") {
} else if (type === "vertex") {
const name = meshCellsVertexAttributeStyle.meshCellsVertexAttributeName(id);
if (name === undefined) {
return;
return Promise.resolve();
}
return meshCellsVertexAttributeStyle.setMeshCellsVertexAttributeName(id, name);
}
if (type === "cell") {
} else if (type === "cell") {
const name = meshCellsCellAttributeStyle.meshCellsCellAttributeName(id);
if (name === undefined) {
return;
return Promise.resolve();
}
await meshCellsCellAttributeStyle.setMeshCellsCellAttributeName(id, name);
return;
} else {
throw new Error(`Unknown mesh cells coloring type: ${type}`);
}
throw new Error(`Unknown mesh cells coloring type: ${type}`);

Check failure on line 52 in internal/stores/data_style/mesh/cells/index.js

View workflow job for this annotation

GitHub Actions / test / test-repository / test-integration (ubuntu-22.04)

[integration] ../tests/integration/stores/data_style/mesh/cells.nuxt.test.js > Mesh cells > Cells active coloring > test coloring

Error: Unknown mesh cells coloring type: cell ❯ Proxy.setMeshCellsActiveColoring ../internal/stores/data_style/mesh/cells/index.js:52:11

Check failure on line 52 in internal/stores/data_style/mesh/cells/index.js

View workflow job for this annotation

GitHub Actions / test / test-repository / test-integration (ubuntu-22.04)

[integration] ../tests/integration/stores/data_style/mesh/cells.nuxt.test.js > Mesh cells > Cells active coloring > test coloring

Error: Unknown mesh cells coloring type: cell ❯ Proxy.setMeshCellsActiveColoring ../internal/stores/data_style/mesh/cells/index.js:52:11

Check failure on line 52 in internal/stores/data_style/mesh/cells/index.js

View workflow job for this annotation

GitHub Actions / test / test-repository / test-integration (ubuntu-22.04)

[integration] ../tests/integration/stores/data_style/mesh/cells.nuxt.test.js > Mesh cells > Cells active coloring > test coloring

Error: Unknown mesh cells coloring type: cell ❯ Proxy.setMeshCellsActiveColoring ../internal/stores/data_style/mesh/cells/index.js:52:11

Check failure on line 52 in internal/stores/data_style/mesh/cells/index.js

View workflow job for this annotation

GitHub Actions / test / test-repository / test-integration (ubuntu-22.04)

[integration] ../tests/integration/stores/data_style/mesh/cells.nuxt.test.js > Mesh cells > Cells active coloring > test coloring

Error: Unknown mesh cells coloring type: cell ❯ Proxy.setMeshCellsActiveColoring ../internal/stores/data_style/mesh/cells/index.js:52:11
}

function applyMeshCellsStyle(id) {
Expand Down
13 changes: 6 additions & 7 deletions internal/stores/data_style/mesh/edges/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export function useMeshEdgesStyle() {
const meshEdgesVertexAttributeStyle = useMeshEdgesVertexAttributeStyle();
const meshEdgesEdgeAttributeStyle = useMeshEdgesEdgeAttributeStyle();

function setMeshEdgesActiveColoring(id, type) {
async function setMeshEdgesActiveColoring(id, type) {
const coloring = meshEdgesCommonStyle.meshEdgesColoring(id);
coloring.active = type;
console.log(
Expand All @@ -28,27 +28,26 @@ export function useMeshEdgesStyle() {
);
if (type === "color") {
return meshEdgesColorStyle.setMeshEdgesColor(id, meshEdgesColorStyle.meshEdgesColor(id));
}
if (type === "textures") {
} else if (type === "textures") {
const textures = meshEdgesTexturesStore.meshEdgesTextures(id);
if (textures === undefined) {
return Promise.resolve();
}
return meshEdgesTexturesStore.setMeshEdgesTextures(id, textures);
}
if (type === "vertex") {
} else if (type === "vertex") {
const name = meshEdgesVertexAttributeStyle.meshEdgesVertexAttributeName(id);
if (name === undefined) {
return Promise.resolve();
}
return meshEdgesVertexAttributeStyle.setMeshEdgesVertexAttributeName(id, name);
}
if (type === "edge") {
} else if (type === "edge") {
const name = meshEdgesEdgeAttributeStyle.meshEdgesEdgeAttributeName(id);
if (name === undefined) {
return Promise.resolve();
}
return meshEdgesEdgeAttributeStyle.setMeshEdgesEdgeAttributeName(id, name);
} else {
throw new Error(`Unknown mesh edges coloring type: ${type}`);
}
throw new Error(`Unknown mesh edges coloring type: ${type}`);
}
Expand Down
19 changes: 8 additions & 11 deletions internal/stores/data_style/mesh/points/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,67 +9,64 @@

// Local constants

export function useMeshPointsStyle() {
const meshPointsCommonStyle = useMeshPointsCommonStyle();
const meshPointsVisibility = useMeshPointsVisibilityStyle();
const meshPointsColorStyle = useMeshPointsColorStyle();
const meshPointsSizeStyle = useMeshPointsSizeStyle();
const meshPointsVertexAttributeStyle = useMeshPointsVertexAttributeStyle();

async function setMeshPointsActiveColoring(id, type) {
const coloring = meshPointsCommonStyle.meshPointsColoring(id);
coloring.active = type;
console.log(
setMeshPointsActiveColoring.name,
{ id },
meshPointsCommonStyle.meshPointsActiveColoring(id),
);
if (type === "color") {
return meshPointsColorStyle.setMeshPointsColor(id, meshPointsColorStyle.meshPointsColor(id));
}
if (type === "textures") {
} else if (type === "textures") {
const textures = meshPointsTexturesStore.meshPointsTextures(id);
if (textures === undefined) {
return;
return Promise.resolve();
}
return meshPointsTexturesStore.setMeshPointsTextures(id, textures);
}
if (type === "vertex") {
} else if (type === "vertex") {
const name = meshPointsVertexAttributeStyle.meshPointsVertexAttributeName(id);
if (name === undefined) {
return;
return Promise.resolve();
}
return meshPointsVertexAttributeStyle.setMeshPointsVertexAttributeName(id, name);
}
if (type === "polygon") {
} else if (type === "polygon") {
const name = meshPointsPolygonAttributeStyleStore.meshPointsPolygonAttributeName(id);
if (name === undefined) {
return;
return Promise.resolve();
}
await meshPointsPolygonAttributeStyleStore.setMeshPointsPolygonAttributeName(id, name);
return;
} else {
throw new Error(`Unknown mesh points coloring type: ${type}`);
}
throw new Error(`Unknown mesh points coloring type: ${type}`);
}

function applyMeshPointsStyle(id) {
return Promise.all([
meshPointsVisibility.setMeshPointsVisibility(
id,
meshPointsVisibility.meshPointsVisibility(id),
),
meshPointsSizeStyle.setMeshPointsSize(id, meshPointsSizeStyle.meshPointsSize(id)),
setMeshPointsActiveColoring(id, meshPointsCommonStyle.meshPointsActiveColoring(id)),
]);
}

return {
setMeshPointsActiveColoring,
applyMeshPointsStyle,
...meshPointsCommonStyle,
...meshPointsVisibility,
...meshPointsColorStyle,
...meshPointsSizeStyle,
...meshPointsVertexAttributeStyle,
};
}

Check warning on line 72 in internal/stores/data_style/mesh/points/index.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(max-lines-per-function)

The function `useMeshPointsStyle` has too many lines (58). Maximum allowed is 50.
Loading
Loading