@geode/opengeodeweb-front 10.27.1 → 10.28.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,39 +5,67 @@ import { Status } from "@ogw_front/utils/status";
5
5
  import { appMode } from "@ogw_front/utils/local/app_mode";
6
6
  import { useInfraStore } from "@ogw_front/stores/infra";
7
7
 
8
- const { logo, appName } = defineProps({
9
- logo: {
10
- type: String,
11
- required: false,
12
- default: "",
13
- },
14
- appName: {
15
- type: String,
16
- required: true,
17
- },
8
+ const { appName, email, isUserAuthenticated, logo } = defineProps({
9
+ appName: { type: String, required: true },
10
+ email: { type: String, default: undefined },
11
+ isUserAuthenticated: { type: Boolean, default: false },
12
+ logo: { type: String, required: false, default: "" },
18
13
  });
19
14
 
20
15
  const infraStore = useInfraStore();
21
16
  if (infraStore.app_mode !== appMode.CLOUD) {
22
17
  infraStore.create_backend();
23
18
  }
19
+
20
+ function cloudCreateBackend() {
21
+ return infraStore.create_backend(email);
22
+ }
24
23
  </script>
25
24
 
26
25
  <template>
27
- <v-container class="justify">
28
- <v-row align-content="center" align="center">
29
- <v-col
30
- v-if="infraStore.status === Status.NOT_CREATED"
31
- class="align"
26
+ <VContainer class="justify">
27
+ <VRow align-content="center" align="center" justify="center">
28
+ <VCol cols="12" align-self="center">
29
+ <slot name="auth" />
30
+ </VCol>
31
+ <VCol
32
+ v-if="isUserAuthenticated && infraStore.status === Status.NOT_CREATED"
33
+ class="d-flex justify-center align-center"
32
34
  cols="12"
33
35
  align-self="center"
34
36
  z-index="4"
35
37
  >
36
- <Recaptcha :button_color="'secondary'" />
37
- </v-col>
38
- <v-col v-else-if="infraStore.status === Status.CREATING">
38
+ <VBtn
39
+ data-testid="loadAppButton"
40
+ class="load-btn"
41
+ text="Load the app"
42
+ size="x-large"
43
+ color="white"
44
+ @click="cloudCreateBackend"
45
+ />
46
+ </VCol>
47
+ <VCol v-else-if="infraStore.status === Status.CREATING">
39
48
  <Loading :logo="logo" :app-name="appName" />
40
- </v-col>
41
- </v-row>
42
- </v-container>
49
+ </VCol>
50
+ </VRow>
51
+ </VContainer>
43
52
  </template>
53
+
54
+ <style scoped>
55
+ .load-btn {
56
+ padding: 0 40px !important;
57
+ height: 50px !important;
58
+ border-radius: 8px;
59
+ text-transform: none !important;
60
+ font-weight: 600;
61
+ letter-spacing: 0.5px;
62
+ transition:
63
+ transform 0.2s ease,
64
+ box-shadow 0.2s ease !important;
65
+ }
66
+
67
+ .load-btn:hover {
68
+ transform: translateY(-2px);
69
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
70
+ }
71
+ </style>
@@ -1,17 +1,20 @@
1
1
  import { useInfraStore } from "@ogw_front/stores/infra";
2
2
 
3
- export function run_function_when_microservices_connected(function_to_run) {
3
+ export function runFunctionWhenMicroservicesConnected(functionToRun) {
4
4
  const infraStore = useInfraStore();
5
5
  const { microservices_connected } = storeToRefs(infraStore);
6
6
  console.log("inside microservices_connected", microservices_connected.value);
7
7
  if (microservices_connected.value) {
8
- function_to_run();
9
- } else {
10
- watch(microservices_connected, (value) => {
8
+ functionToRun();
9
+ }
10
+ watch(
11
+ microservices_connected,
12
+ (value) => {
11
13
  if (value) {
12
14
  console.log("watch microservices_connected", value);
13
- function_to_run();
15
+ functionToRun();
14
16
  }
15
- });
16
- }
17
+ },
18
+ { once: true },
19
+ );
17
20
  }
@@ -8,7 +8,7 @@ export const useCloudStore = defineStore("cloud", {
8
8
  status: Status.NOT_CONNECTED,
9
9
  }),
10
10
  actions: {
11
- launch(name, email, launch) {
11
+ launch(email) {
12
12
  this.status = Status.CONNECTING;
13
13
  console.log("[CLOUD] Launching cloud backend...");
14
14
  const schema = {
@@ -16,18 +16,12 @@ export const useCloudStore = defineStore("cloud", {
16
16
  methods: ["POST"],
17
17
  type: "object",
18
18
  properties: {
19
- name: { type: "string" },
20
19
  email: { type: "string" },
21
- launch: { type: "boolean" },
22
20
  },
23
- required: ["name", "email", "launch"],
21
+ required: ["email"],
24
22
  additionalProperties: true,
25
23
  };
26
- const params = {
27
- name,
28
- email,
29
- launch,
30
- };
24
+ const params = { email };
31
25
  console.log("[CLOUD] params", params);
32
26
  const appStore = useAppStore();
33
27
  const feedbackStore = useFeedbackStore();
@@ -37,7 +37,7 @@ export const useInfraStore = defineStore("infra", {
37
37
  );
38
38
  console.log("[INFRA] Microservice unregistered:", microserviceId);
39
39
  },
40
- create_backend(name, email, launch) {
40
+ create_backend(email) {
41
41
  console.log("[INFRA] Starting create_backend - Mode:", this.app_mode);
42
42
  console.log(
43
43
  "[INFRA] Registered microservices:",
@@ -54,7 +54,7 @@ export const useInfraStore = defineStore("infra", {
54
54
  console.log("[INFRA] Lock granted for create_backend");
55
55
  if (this.app_mode === appMode.CLOUD) {
56
56
  const cloudStore = useCloudStore();
57
- await cloudStore.launch(name, email, launch);
57
+ await cloudStore.launch(email);
58
58
  } else {
59
59
  const appStore = useAppStore();
60
60
  await appStore.createProjectFolder();
@@ -27,14 +27,14 @@ function extensionsConf(projectName) {
27
27
  return extensionsConfig;
28
28
  }
29
29
 
30
- function addExtensionToConf(projectName, { extensionID, extensionPath }) {
30
+ function addExtensionToConf(projectName, { extensionId, extensionPath }) {
31
31
  const projectConfig = projectConf(projectName);
32
- projectConfig.set(`extensions.${extensionID}.path`, extensionPath);
32
+ projectConfig.set(`extensions.${extensionId}.path`, extensionPath);
33
33
  }
34
34
 
35
- async function removeExtensionFromConf(projectName, extensionID) {
35
+ async function removeExtensionFromConf(projectName, extensionId) {
36
36
  const projectConfig = projectConf(projectName);
37
- const extensionArchivePath = extensionPathFromConf(projectName, extensionID);
37
+ const extensionArchivePath = extensionPathFromConf(projectName, extensionId);
38
38
 
39
39
  await unlink(extensionArchivePath, (error) => {
40
40
  if (error) {
@@ -42,13 +42,13 @@ async function removeExtensionFromConf(projectName, extensionID) {
42
42
  }
43
43
  console.log(`${extensionArchivePath} was deleted`);
44
44
  });
45
- projectConfig.delete(`extensions.${extensionID}`);
46
- console.log(`${extensionID} was deleted from ${projectName} config`);
45
+ projectConfig.delete(`extensions.${extensionId}`);
46
+ console.log(`${extensionId} was deleted from ${projectName} config`);
47
47
  }
48
48
 
49
- function extensionPathFromConf(projectName, extensionID) {
49
+ function extensionPathFromConf(projectName, extensionId) {
50
50
  const projectConfig = projectConf(projectName);
51
- return projectConfig.get(`extensions.${extensionID}.path`);
51
+ return projectConfig.get(`extensions.${extensionId}.path`);
52
52
  }
53
53
 
54
54
  export {
@@ -55,8 +55,8 @@ function generateProjectFolderPath(projectName) {
55
55
  return path.join(os.tmpdir(), projectName.replaceAll("/", "_"), uuidv4());
56
56
  }
57
57
 
58
- function extensionFolderPath(projectFolderPath, extensionID) {
59
- return path.join(projectFolderPath, "extensions", extensionID);
58
+ function extensionFolderPath(projectFolderPath, extensionId) {
59
+ return path.join(projectFolderPath, "extensions", extensionId);
60
60
  }
61
61
 
62
62
  async function lookForLocalExtensionDistPath(rootPath, extentionRepoName, frontendFile) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
- "version": "10.27.1",
3
+ "version": "10.28.0-rc.2",
4
4
  "description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
5
5
  "homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Front",
6
6
  "bugs": {
@@ -34,8 +34,8 @@
34
34
  "build": ""
35
35
  },
36
36
  "dependencies": {
37
- "@geode/opengeodeweb-back": "latest",
38
- "@geode/opengeodeweb-viewer": "latest",
37
+ "@geode/opengeodeweb-back": "next",
38
+ "@geode/opengeodeweb-viewer": "next",
39
39
  "@google-cloud/run": "3.2.0",
40
40
  "@kitware/vtk.js": "33.3.0",
41
41
  "@mdi/font": "7.4.47",
@@ -6,17 +6,12 @@ import { GoogleAuth } from "google-auth-library";
6
6
  import { ServicesClient } from "@google-cloud/run";
7
7
 
8
8
  // Local imports
9
- import { artifactImages, checkRecaptchaParams, requestConfig } from "@ogw_server/utils/cloud";
9
+ import { artifactImages, requestConfig } from "@ogw_server/utils/cloud";
10
10
 
11
11
  export default defineEventHandler(async (event) => {
12
12
  try {
13
- const { name, email, launch } = await readBody(event);
14
- if (!checkRecaptchaParams(name, email, launch)) {
15
- return {
16
- statusCode: 500,
17
- body: JSON.stringify({ message: "INTERNAL_ERROR" }),
18
- };
19
- }
13
+ const { email } = await readBody(event);
14
+ console.log("[RUN CLOUD] Received request to create backend for email:", email);
20
15
  const credentials = JSON.parse(process.env.GOOGLE_CLOUD_KEY);
21
16
  const location = "europe-west9";
22
17
  const projectId = process.env.GOOGLE_CLOUD_PROJECT;
@@ -25,11 +25,11 @@ export default defineEventHandler(async (event) => {
25
25
  const extensionsConfig = extensionsConf(projectName);
26
26
 
27
27
  const extensionsArray = await Promise.all(
28
- Object.keys(extensionsConfig).map(async (extensionID) => {
29
- const extensionPath = extensionsConfig[extensionID].path;
28
+ Object.keys(extensionsConfig).map(async (extensionId) => {
29
+ const extensionPath = extensionsConfig[extensionId].path;
30
30
  const unzippedExtensionPath = await unzipFile(
31
31
  extensionPath,
32
- extensionFolderPath(projectFolderPath, extensionID),
32
+ extensionFolderPath(projectFolderPath, extensionId),
33
33
  );
34
34
  const metadataPath = path.join(unzippedExtensionPath, "metadata.json");
35
35
  const metadataContent = await fs.promises.readFile(metadataPath, "utf8");
@@ -83,7 +83,7 @@ export default defineEventHandler(async (event) => {
83
83
  const metadata = JSON.parse(metadataJson);
84
84
  const { id } = metadata;
85
85
  await addExtensionToConf(projectName, {
86
- extensionID: id,
86
+ extensionId: id,
87
87
  extensionPath: file,
88
88
  });
89
89
  }),
@@ -5,11 +5,6 @@ import { google } from "googleapis";
5
5
 
6
6
  // Local imports
7
7
 
8
- function checkRecaptchaParams(name, email, launch) {
9
- console.log("check_recaptcha_params", { name, email, launch });
10
- return name === "" && email === "" && launch === false;
11
- }
12
-
13
8
  async function artifactImage(registry, parent, repo) {
14
9
  const branch = process.env.NETLIFY_BRANCH;
15
10
  const [_, projectId] = parent.split("/");
@@ -110,4 +105,4 @@ function requestConfig(parent, routerImage, backImage, viewerImage) {
110
105
  };
111
106
  }
112
107
 
113
- export { checkRecaptchaParams, artifactImages, requestConfig };
108
+ export { artifactImages, requestConfig };
@@ -4,7 +4,7 @@ import { flushPromises } from "@vue/test-utils";
4
4
 
5
5
  // Local imports
6
6
  import { Status } from "@ogw_front/utils/status";
7
- import { run_function_when_microservices_connected } from "@ogw_front/composables/run_function_when_microservices_connected";
7
+ import { runFunctionWhenMicroservicesConnected } from "@ogw_front/composables/run_function_when_microservices_connected";
8
8
  import { setupActivePinia } from "@ogw_tests/utils";
9
9
  import { useBackStore } from "@ogw_front/stores/back";
10
10
  import { useInfraStore } from "@ogw_front/stores/infra";
@@ -40,7 +40,7 @@ describe("when_microservices_connected_run_function", () => {
40
40
 
41
41
  test("microservices not connected", () => {
42
42
  const spy = vi.spyOn(dumb_obj, "dumb_method");
43
- run_function_when_microservices_connected(dumb_obj.dumb_method);
43
+ runFunctionWhenMicroservicesConnected(dumb_obj.dumb_method);
44
44
  backStore.$patch({ status: Status.NOT_CONNECTED });
45
45
  viewerStore.$patch({ status: Status.NOT_CONNECTED });
46
46
  expect(spy).not.toHaveBeenCalled();
@@ -48,7 +48,7 @@ describe("when_microservices_connected_run_function", () => {
48
48
 
49
49
  test("microservices connected", async () => {
50
50
  const spy = vi.spyOn(dumb_obj, "dumb_method");
51
- run_function_when_microservices_connected(dumb_obj.dumb_method);
51
+ runFunctionWhenMicroservicesConnected(dumb_obj.dumb_method);
52
52
  backStore.$patch({ status: Status.CONNECTED });
53
53
  viewerStore.$patch({ status: Status.CONNECTED });
54
54
  await flushPromises();