Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions app/stores/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,25 +245,22 @@ export const useAppStore = defineStore("app", () => {

const projectFolderPath = ref("");
function createProjectFolder() {
const { PROJECT } = useRuntimeConfig().public;
const schema = {
$id: "/api/app/project_folder_path",
methods: ["POST"],
type: "object",
properties: {},
required: [],
properties: { PROJECT: { type: "string" } },
required: ["PROJECT"],
additionalProperties: true,
};

return request(
schema,
{},
{
response_function: (response) => {
console.log(`[APP] ${response.projectFolderPath} created`);
projectFolderPath.value = response.projectFolderPath;
},
const params = { PROJECT };
return request(schema, params, {
response_function: (response) => {
console.log(`[APP] ${response.projectFolderPath} created`);
projectFolderPath.value = response.projectFolderPath;
},
);
});
}

return {
Expand Down
11 changes: 7 additions & 4 deletions app/stores/geode.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,34 +79,37 @@
this.request_counter -= 1;
},
launch(args) {
console.log("[GEODE] Launching back microservice...", { args });

Check warning on line 82 in app/stores/geode.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(no-console)

Unexpected console statement.
const appStore = useAppStore();
const { COMMAND_BACK, NUXT_ROOT_PATH } = useRuntimeConfig().public;
const schema = {
$id: "/api/app/run_back",
methods: ["POST"],
type: "object",
properties: {},
required: [],
properties: {
COMMAND_BACK: { type: "string" },
NUXT_ROOT_PATH: { type: "string" },
},
required: ["COMMAND_BACK", "NUXT_ROOT_PATH"],
additionalProperties: true,
};

const params = { args };
const params = { COMMAND_BACK, NUXT_ROOT_PATH, args };

console.log("[GEODE] params", params);

Check warning on line 98 in app/stores/geode.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(no-console)

Unexpected console statement.
return appStore.request(schema, params, {
response_function: (response) => {
console.log(`[GEODE] Back launched on port ${response.port}`);

Check warning on line 101 in app/stores/geode.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(no-console)

Unexpected console statement.
this.default_local_port = response.port;
},
});
},
connect() {
console.log("[GEODE] Connecting to geode microservice...");

Check warning on line 107 in app/stores/geode.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(no-console)

Unexpected console statement.
this.set_ping();
return Promise.resolve();
},
request(schema, params, callbacks = {}) {
console.log("[GEODE] Request:", schema.$id);

Check warning on line 112 in app/stores/geode.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(no-console)

Unexpected console statement.
const start = Date.now();

return api_fetch(
Expand All @@ -115,7 +118,7 @@
{
...callbacks,
response_function: async (response) => {
console.log(

Check warning on line 121 in app/stores/geode.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(no-console)

Unexpected console statement.
"[GEODE] Request completed:",
schema.$id,
"in",
Expand All @@ -140,7 +143,7 @@
{
...callbacks,
response_function: async (response) => {
console.log("[GEODE] Request completed:", route);

Check warning on line 146 in app/stores/geode.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(no-console)

Unexpected console statement.
if (callbacks.response_function) {
await callbacks.response_function(response);
}
Expand Down
8 changes: 5 additions & 3 deletions app/stores/viewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,18 @@ export const useViewerStore = defineStore(
function launch(args = ({ projectFolderPath } = {})) {
console.log("[VIEWER] Launching viewer microservice...", { args });
const appStore = useAppStore();

const { COMMAND_VIEWER, NUXT_ROOT_PATH } = useRuntimeConfig().public;
const schema = {
$id: "/api/app/run_viewer",
methods: ["POST"],
type: "object",
properties: {},
required: [],
properties: { COMMAND_VIEWER: { type: "string" }, NUXT_ROOT_PATH: { type: "string" } },
required: ["COMMAND_VIEWER", "NUXT_ROOT_PATH"],
additionalProperties: true,
};

const params = { args };
const params = { COMMAND_VIEWER, NUXT_ROOT_PATH, args };
console.log("[VIEWER] params", params);

return appStore.request(schema, params, {
Expand Down
7 changes: 2 additions & 5 deletions server/api/app/project_folder_path.post.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
// Node imports

// Third party imports
import { createError, defineEventHandler } from "h3";
import { createError, defineEventHandler, readBody } from "h3";

// Local imports
import {
createPath,
generateProjectFolderPath,
} from "@geode/opengeodeweb-front/app/utils/local/path.js";

import { useRuntimeConfig } from "nitropack/runtime";

export default defineEventHandler(async (event) => {
try {
const config = useRuntimeConfig(event).public;
const { PROJECT } = config;
const { PROJECT } = await readBody(event);
const projectFolderPath = generateProjectFolderPath(PROJECT);
await createPath(projectFolderPath);

Expand All @@ -23,7 +20,7 @@
projectFolderPath,
};
} catch (error) {
console.log(error);

Check warning on line 23 in server/api/app/project_folder_path.post.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(no-console)

Unexpected console statement.
throw createError({
statusCode: 500,
statusMessage: error.message,
Expand Down
6 changes: 1 addition & 5 deletions server/api/app/run_back.post.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@
runBack,
} from "@geode/opengeodeweb-front/app/utils/local/microservices.js";

import { useRuntimeConfig } from "nitropack/runtime";

export default defineEventHandler(async (event) => {
try {
const config = useRuntimeConfig(event).public;
const { COMMAND_BACK, NUXT_ROOT_PATH } = config;
const { args } = await readBody(event);
const { COMMAND_BACK, NUXT_ROOT_PATH, args } = await readBody(event);
const port = await runBack(COMMAND_BACK, NUXT_ROOT_PATH, args);
await addMicroserviceMetadatas(args.projectFolderPath, {
type: "back",
Expand All @@ -28,7 +24,7 @@
port,
};
} catch (error) {
console.log(error);

Check warning on line 27 in server/api/app/run_back.post.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(no-console)

Unexpected console statement.
throw createError({
statusCode: 500,
statusMessage: error.message,
Expand Down
6 changes: 1 addition & 5 deletions server/api/app/run_viewer.post.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@
runViewer,
} from "@geode/opengeodeweb-front/app/utils/local/microservices.js";

import { useRuntimeConfig } from "nitropack/runtime";

export default defineEventHandler(async (event) => {
try {
const config = useRuntimeConfig(event).public;
const { COMMAND_VIEWER, NUXT_ROOT_PATH } = config;
const { args } = await readBody(event);
const { COMMAND_VIEWER, NUXT_ROOT_PATH, args } = await readBody(event);
const port = await runViewer(COMMAND_VIEWER, NUXT_ROOT_PATH, args);
await addMicroserviceMetadatas(args.projectFolderPath, {
type: "viewer",
Expand All @@ -28,7 +24,7 @@
port,
};
} catch (error) {
console.log(error);

Check warning on line 27 in server/api/app/run_viewer.post.js

View workflow job for this annotation

GitHub Actions / test / oxlint

eslint(no-console)

Unexpected console statement.
throw createError({
statusCode: 500,
statusMessage: error.message,
Expand Down
Loading