@geode/opengeodeweb-front 7.1.2-rc.3 → 8.0.0-rc.1

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.
@@ -19,15 +19,15 @@
19
19
 
20
20
  <script setup>
21
21
  const viewer_store = use_viewer_store()
22
- const cloud_store = use_cloud_store()
22
+ const infra_store = use_infra_store()
23
23
  const { is_captcha_validated, is_connexion_launched, is_running } =
24
- storeToRefs(cloud_store)
24
+ storeToRefs(infra_store)
25
25
 
26
26
  const site_key = useRuntimeConfig().public.RECAPTCHA_SITE_KEY
27
27
 
28
28
  watch(is_captcha_validated, async (value) => {
29
29
  if (value === true && process.client) {
30
- await cloud_store.create_connexion()
30
+ await infra_store.create_connexion()
31
31
  await viewer_store.ws_connect()
32
32
  }
33
33
  })
@@ -19,8 +19,8 @@
19
19
  </template>
20
20
 
21
21
  <script setup>
22
- const cloud_store = use_cloud_store()
23
- const { is_running } = storeToRefs(cloud_store)
22
+ const infra_store = use_infra_store()
23
+ const { is_running } = storeToRefs(infra_store)
24
24
 
25
25
  const props = defineProps({
26
26
  schema: { type: Object, required: true },
@@ -13,8 +13,8 @@
13
13
 
14
14
  <script setup>
15
15
  import { VueRecaptcha } from "vue-recaptcha"
16
- const cloud_store = use_cloud_store()
17
- const { is_captcha_validated } = storeToRefs(cloud_store)
16
+ const infra_store = use_infra_store()
17
+ const { is_captcha_validated } = storeToRefs(infra_store)
18
18
 
19
19
  const props = defineProps({
20
20
  site_key: { type: String, required: true },
@@ -25,7 +25,7 @@
25
25
  if (process.client) {
26
26
  const config = useRuntimeConfig()
27
27
  if (config.public.NODE_ENV !== "production") {
28
- cloud_store.$patch({ is_captcha_validated: true })
28
+ infra_store.$patch({ is_captcha_validated: true })
29
29
  }
30
30
  }
31
31
  })
@@ -35,7 +35,7 @@
35
35
  const response = await $fetch.raw(
36
36
  `/.netlify/functions/recaptcha?token=${token}`,
37
37
  )
38
- cloud_store.$patch({ is_captcha_validated: response.status == 200 })
38
+ infra_store.$patch({ is_captcha_validated: response.status == 200 })
39
39
  recaptcha.reset()
40
40
  } catch (error) {
41
41
  console.error(error)
@@ -15,8 +15,8 @@
15
15
  </template>
16
16
 
17
17
  <script setup>
18
- const cloud_store = use_cloud_store()
19
- const { is_running } = storeToRefs(cloud_store)
18
+ const infra_store = use_infra_store()
19
+ const { is_running } = storeToRefs(infra_store)
20
20
 
21
21
  const props = defineProps({
22
22
  versions_schema: { type: Object, required: true },
@@ -0,0 +1,15 @@
1
+ export function run_function_when_infra_running(function_to_run) {
2
+ const infra_store = use_infra_store()
3
+ const { is_running } = storeToRefs(infra_store)
4
+ if (is_running.value) {
5
+ function_to_run()
6
+ } else {
7
+ watch(is_running, (value) => {
8
+ if (value) {
9
+ function_to_run()
10
+ }
11
+ })
12
+ }
13
+ }
14
+
15
+ export default run_function_when_infra_running
package/nuxt.config.js CHANGED
@@ -1,10 +1,7 @@
1
1
  export default defineNuxtConfig({
2
2
  runtimeConfig: {
3
3
  public: {
4
- VIEWER_PROTOCOL: process.env.NODE_ENV === "production" ? "wss" : "ws",
5
- GEODE_PROTOCOL: process.env.NODE_ENV === "production" ? "https" : "http",
6
- VIEWER_PORT: process.env.NODE_ENV === "production" ? "443" : "1234",
7
- GEODE_PORT: process.env.NODE_ENV === "production" ? "443" : "5000",
4
+ API_URL: "api.geode-solutions.com",
8
5
  SITE_BRANCH:
9
6
  process.env.NODE_ENV === "production" ? process.env.SITE_BRANCH : "",
10
7
  PROJECT: process.env.NODE_ENV === "production" ? process.env.PROJECT : "",
package/package.json CHANGED
@@ -7,26 +7,26 @@
7
7
  "geode_objects": "node scripts/generate_geode_objects.js && prettier ./assets/geode_objects.js --write"
8
8
  },
9
9
  "devDependencies": {
10
- "@nuxt/test-utils": "^3.12.0",
11
- "@vitejs/plugin-vue": "^5.0.4",
12
- "@vitest/coverage-v8": "^1.4.0",
13
- "@vue/test-utils": "^2.4.5",
10
+ "@nuxt/test-utils": "^3.13.1",
11
+ "@vitejs/plugin-vue": "^5.0.5",
12
+ "@vitest/coverage-v8": "^1.6.0",
13
+ "@vue/test-utils": "^2.4.6",
14
14
  "eslint": "^8.57.0",
15
15
  "eslint-plugin-import": "^2.29.1",
16
16
  "eslint-plugin-nuxt": "^4.0.0",
17
17
  "eslint-plugin-prettier": "^5.1.3",
18
18
  "eslint-plugin-prettier-vue": "^5.0.0",
19
- "eslint-plugin-vue": "^9.24.0",
20
- "eslint-plugin-vuetify": "^2.2.0",
21
- "happy-dom": "^13.10.1",
22
- "jsdom": "^24.0.0",
23
- "nuxt": "^3.11.2",
24
- "playwright-core": "^1.43.0",
25
- "prettier": "3.2.5",
19
+ "eslint-plugin-vue": "^9.26.0",
20
+ "eslint-plugin-vuetify": "^2.4.0",
21
+ "happy-dom": "^14.12.0",
22
+ "jsdom": "^24.1.0",
23
+ "nuxt": "^3.12.1",
24
+ "playwright-core": "^1.44.1",
25
+ "prettier": "3.3.2",
26
26
  "resize-observer-polyfill": "^1.5.1",
27
- "vite": "^5.2.8",
27
+ "vite": "^5.2.13",
28
28
  "vite-plugin-vuetify": "^2.0.3",
29
- "vitest": "^1.4.0",
29
+ "vitest": "^1.6.0",
30
30
  "vitest-environment-nuxt": "^1.0.0",
31
31
  "wslink": "^1.12.4"
32
32
  },
@@ -35,24 +35,25 @@
35
35
  },
36
36
  "description": "OpenSource Vue/Vuetify framework for web applications",
37
37
  "type": "module",
38
- "version": "7.1.2-rc.3",
38
+ "version": "8.0.0-rc.1",
39
39
  "main": "./nuxt.config.js",
40
40
  "dependencies": {
41
41
  "@geode/opengeodeweb-back": "4.2.1",
42
42
  "@geode/opengeodeweb-viewer": "0.1.2",
43
- "@kitware/vtk.js": "^30.3.1",
43
+ "@kitware/vtk.js": "^30.6.2",
44
44
  "@mdi/font": "^7.4.47",
45
45
  "@pinia/nuxt": "^0.5.1",
46
- "@types/node": "^20.12.4",
47
- "@vueuse/components": "^10.9.0",
48
- "@vueuse/nuxt": "^10.9.0",
49
- "ajv": "^8.12.0",
46
+ "@types/node": "^20.14.2",
47
+ "@vueuse/components": "^10.11.0",
48
+ "@vueuse/nuxt": "^10.11.0",
49
+ "ajv": "^8.16.0",
50
+ "is-electron": "^2.2.2",
50
51
  "pinia": "^2.1.7",
51
- "sass": "^1.74.1",
52
- "semver": "^7.6.0",
52
+ "sass": "^1.77.5",
53
+ "semver": "^7.6.2",
53
54
  "vue-recaptcha": "^2.0.3",
54
55
  "vue3-carousel": "^0.3.3",
55
- "vuetify": "^3.6.8"
56
+ "vuetify": "^3.6.9"
56
57
  },
57
58
  "repository": {
58
59
  "type": "git",
package/stores/geode.js CHANGED
@@ -1,20 +1,21 @@
1
1
  export const use_geode_store = defineStore("geode", {
2
2
  state: () => ({
3
+ PROTOCOL: use_infra_store().is_cloud ? "https" : "http",
4
+ PORT: use_infra_store().is_cloud ? "443" : "5000",
3
5
  request_counter: 0,
4
6
  is_running: false,
5
7
  }),
6
8
  getters: {
7
- base_url: () => {
8
- const cloud_store = use_cloud_store()
9
- const api_url = cloud_store.api_url
9
+ base_url() {
10
+ const infra_store = use_infra_store()
11
+ const api_url = infra_store.api_url
10
12
  var geode_url = `${api_url}`
11
- const public_runtime_config = useRuntimeConfig().public
12
- if (public_runtime_config.NODE_ENV == "production") {
13
- geode_url += `/${cloud_store.ID}/geode`
13
+ if (infra_store.is_cloud) {
14
+ geode_url += `/${infra_store.ID}/geode`
14
15
  }
15
16
  return geode_url
16
17
  },
17
- is_busy: (state) => {
18
+ is_busy(state) {
18
19
  return state.request_counter > 0
19
20
  },
20
21
  },
@@ -0,0 +1,95 @@
1
+ import { useStorage } from "@vueuse/core"
2
+ import isElectron from "is-electron"
3
+
4
+ export const use_infra_store = defineStore("infra", {
5
+ state: () => ({
6
+ ID: useStorage("ID", ""),
7
+ is_captcha_validated: false,
8
+ is_connexion_launched: false,
9
+ }),
10
+ getters: {
11
+ is_cloud() {
12
+ return !isElectron() && !process.env.NODE_ENV === "development"
13
+ },
14
+ domain_name() {
15
+ if (this.is_cloud) {
16
+ return useRuntimeConfig().public.API_URL
17
+ } else {
18
+ return "localhost"
19
+ }
20
+ },
21
+
22
+ api_url() {
23
+ const geode_store = use_geode_store()
24
+ const public_runtime_config = useRuntimeConfig().public
25
+ if (public_runtime_config.NODE_ENV == "test") {
26
+ return ""
27
+ }
28
+ var api_url = `${geode_store.PROTOCOL}://${this.domain_name}:${geode_store.PORT}`
29
+ return api_url
30
+ },
31
+ is_running() {
32
+ return use_geode_store().is_running && use_viewer_store().is_running
33
+ },
34
+ is_busy() {
35
+ return use_geode_store().is_busy || use_viewer_store().is_busy
36
+ },
37
+ },
38
+ actions: {
39
+ async create_connexion() {
40
+ const geode_store = use_geode_store()
41
+ if (this.is_connexion_launched) {
42
+ return
43
+ }
44
+ this.is_connexion_launched = true
45
+ if (
46
+ this.ID === "" ||
47
+ this.ID === null ||
48
+ typeof this.ID === "undefined"
49
+ ) {
50
+ return this.create_backend()
51
+ } else {
52
+ const { data, error } = await useFetch(`${geode_store.base_url}/`, {
53
+ method: "POST",
54
+ })
55
+ if (data.value !== null) {
56
+ geode_store.is_running = true
57
+ return geode_store.ping_task()
58
+ } else {
59
+ await this.create_backend()
60
+ }
61
+ }
62
+ },
63
+ async create_backend() {
64
+ const geode_store = use_geode_store()
65
+ const viewer_store = use_viewer_store()
66
+ const errors_store = use_errors_store()
67
+
68
+ if (isElectron()) {
69
+ await window.electronAPI.run_back(geode_store.PORT)
70
+ await window.electronAPI.run_viewer(viewer_store.PORT)
71
+ // geode_store.$patch({ is_running: true })
72
+ // viewer_store.$patch({ is_running: true })
73
+ return
74
+ } else {
75
+ const public_runtime_config = useRuntimeConfig().public
76
+ const url = this.api_url.concat(
77
+ public_runtime_config.SITE_BRANCH,
78
+ public_runtime_config.PROJECT,
79
+ "/createbackend",
80
+ )
81
+ const { data, error } = await useFetch(url, {
82
+ method: "POST",
83
+ })
84
+ if (data.value !== null) {
85
+ this.ID = data.value.ID
86
+ localStorage.setItem("ID", data.value.ID)
87
+ geode_store.$patch({ is_running: true })
88
+ return geode_store.ping_task()
89
+ } else {
90
+ errors_store.server_error = true
91
+ }
92
+ }
93
+ },
94
+ },
95
+ })
package/stores/viewer.js CHANGED
@@ -5,6 +5,8 @@ import schemas from "@geode/opengeodeweb-viewer/schemas.json"
5
5
 
6
6
  export const use_viewer_store = defineStore("viewer", {
7
7
  state: () => ({
8
+ PROTOCOL: use_infra_store().is_cloud ? "wss" : "ws",
9
+ PORT: use_infra_store().is_cloud ? "443" : "1234",
8
10
  client: {},
9
11
  config: null,
10
12
  is_running: false,
@@ -13,17 +15,16 @@ export const use_viewer_store = defineStore("viewer", {
13
15
  request_counter: 0,
14
16
  }),
15
17
  getters: {
16
- base_url: () => {
17
- const cloud_store = use_cloud_store()
18
- const public_runtime_config = useRuntimeConfig().public
19
- var viewer_url = `${public_runtime_config.VIEWER_PROTOCOL}://${public_runtime_config.API_URL}:${public_runtime_config.VIEWER_PORT}`
20
- if (process.env.NODE_ENV == "production") {
21
- viewer_url += `/${cloud_store.ID}/viewer`
18
+ base_url(state) {
19
+ const infra_store = use_infra_store()
20
+ var viewer_url = `${state.PROTOCOL}://${infra_store.domain_name}:${state.PORT}`
21
+ if (infra_store.is_cloud) {
22
+ viewer_url += `/${infra_store.ID}/viewer`
22
23
  }
23
24
  viewer_url += "/ws"
24
25
  return viewer_url
25
26
  },
26
- is_busy: (state) => {
27
+ is_busy(state) {
27
28
  return state.request_counter > 0
28
29
  },
29
30
  },
@@ -15,22 +15,22 @@
15
15
  // directives,
16
16
  // })
17
17
 
18
- // const cloud_store = use_cloud_store()
18
+ // const infra_store = use_infra_store()
19
19
 
20
20
  // global.ResizeObserver = require("resize-observer-polyfill")
21
21
 
22
22
  // describe("Launcher.vue", async () => {
23
23
  // test(`Mount`, async () => {
24
- // const spy_cloud_store = vi.spyOn(cloud_store, "create_connexion")
24
+ // const spy_infra_store = vi.spyOn(infra_store, "create_connexion")
25
25
  // const wrapper = await mountSuspended(Launcher, {
26
26
  // global: {
27
27
  // plugins: [vuetify],
28
28
  // },
29
29
  // })
30
30
  // expect(wrapper.exists()).toBe(true)
31
- // await cloud_store.$patch({ is_captcha_validated: true })
31
+ // await infra_store.$patch({ is_captcha_validated: true })
32
32
  // flushPromises()
33
- // expect(spy_cloud_store).toHaveBeenCalled()
33
+ // expect(spy_infra_store).toHaveBeenCalled()
34
34
  // })
35
35
  // })
36
36
  describe("Fake", async () => {
@@ -1,6 +1,6 @@
1
1
  import { describe, expect, test, beforeEach, vi } from "vitest"
2
2
 
3
- describe("api_fetch.js", () => {
3
+ describe("run_function_when_infra_running", () => {
4
4
  const geode_store = use_geode_store()
5
5
  const viewer_store = use_viewer_store()
6
6
 
@@ -16,13 +16,13 @@ describe("api_fetch.js", () => {
16
16
  await geode_store.$patch({ is_running: true })
17
17
  await viewer_store.$patch({ is_running: true })
18
18
 
19
- await runFunctionIfCloudRunning(dumb_obj.dumb_method)
19
+ await run_function_when_infra_running(dumb_obj.dumb_method)
20
20
  expect(spy).toHaveBeenCalled()
21
21
  })
22
22
 
23
23
  test("is_running false", async () => {
24
24
  const spy = vi.spyOn(dumb_obj, "dumb_method")
25
- runFunctionIfCloudRunning(dumb_obj.dumb_method)
25
+ run_function_when_infra_running(dumb_obj.dumb_method)
26
26
  await geode_store.$patch({ is_running: true })
27
27
  await viewer_store.$patch({ is_running: true })
28
28
  expect(spy).toHaveBeenCalled()
@@ -2,7 +2,7 @@ import { describe, test, expect, beforeEach } from "vitest"
2
2
  import { registerEndpoint } from "@nuxt/test-utils/runtime"
3
3
  import { flushPromises } from "@vue/test-utils"
4
4
 
5
- const cloud_store = use_cloud_store()
5
+ const infra_store = use_infra_store()
6
6
  const geode_store = use_geode_store()
7
7
  const viewer_store = use_viewer_store()
8
8
 
@@ -14,16 +14,16 @@ describe("Cloud Store", () => {
14
14
 
15
15
  describe("getters", () => {
16
16
  test("is_running", async () => {
17
- expect(cloud_store.is_running).toBe(false)
17
+ expect(infra_store.is_running).toBe(false)
18
18
  await geode_store.$patch({ is_running: true })
19
19
  await viewer_store.$patch({ is_running: true })
20
- expect(cloud_store.is_running).toBe(true)
20
+ expect(infra_store.is_running).toBe(true)
21
21
  })
22
22
  test("is_busy", async () => {
23
- expect(cloud_store.is_busy).toBe(false)
23
+ expect(infra_store.is_busy).toBe(false)
24
24
  await geode_store.start_request()
25
25
  await viewer_store.start_request()
26
- expect(cloud_store.is_busy).toBe(true)
26
+ expect(infra_store.is_busy).toBe(true)
27
27
  })
28
28
  })
29
29
 
@@ -31,7 +31,7 @@ describe("Cloud Store", () => {
31
31
  describe("create_backend", async () => {
32
32
  test("test without end-point", async () => {
33
33
  expect(geode_store.is_running).toBe(false)
34
- await cloud_store.create_backend()
34
+ await infra_store.create_backend()
35
35
  expect(geode_store.is_running).toBe(false)
36
36
  })
37
37
  test("test with end-point", async () => {
@@ -40,7 +40,7 @@ describe("Cloud Store", () => {
40
40
  method: "POST",
41
41
  handler: () => ({ ID: "123456" }),
42
42
  })
43
- await cloud_store.create_backend()
43
+ await infra_store.create_backend()
44
44
  await flushPromises()
45
45
  })
46
46
  })
@@ -1,6 +1,6 @@
1
1
  import { setActivePinia, createPinia } from "pinia"
2
2
  import { use_geode_store } from "@/stores/geode"
3
- import { use_cloud_store } from "@/stores/cloud"
3
+ import { use_infra_store } from "@/stores/infra"
4
4
  import { describe, test, expect, beforeEach } from "vitest"
5
5
  import { registerEndpoint } from "@nuxt/test-utils/runtime"
6
6
 
@@ -12,9 +12,7 @@ describe("Geode Store", () => {
12
12
  globalThis.useRuntimeConfig = () => {
13
13
  return {
14
14
  public: {
15
- GEODE_PROTOCOL: "http",
16
15
  API_URL: "localhost",
17
- GEODE_PORT: "5000",
18
16
  NODE_ENV: "production",
19
17
  },
20
18
  }
@@ -22,8 +20,8 @@ describe("Geode Store", () => {
22
20
 
23
21
  test("base_url", () => {
24
22
  const geode_store = use_geode_store()
25
- const cloud_store = use_cloud_store()
26
- cloud_store.$patch({ ID: "123456" })
23
+ const infra_store = use_infra_store()
24
+ infra_store.$patch({ ID: "123456" })
27
25
  geode_store.start_request()
28
26
  expect(geode_store.request_counter).toBe(1)
29
27
  })
@@ -8,8 +8,8 @@ describe("Viewer Store", () => {
8
8
  describe("getters", () => {
9
9
  test("base_url", () => {
10
10
  const viewer_store = use_geode_store()
11
- const cloud_store = use_cloud_store()
12
- cloud_store.$patch({ ID: "123456" })
11
+ const infra_store = use_infra_store()
12
+ infra_store.$patch({ ID: "123456" })
13
13
  viewer_store.start_request()
14
14
  expect(viewer_store.request_counter).toBe(1)
15
15
  })
@@ -1,13 +0,0 @@
1
- export default async function (function_to_run) {
2
- const cloud_store = use_cloud_store()
3
- const { is_running } = storeToRefs(cloud_store)
4
- if (is_running.value) {
5
- function_to_run()
6
- } else {
7
- watch(is_running, (value) => {
8
- if (value) {
9
- function_to_run()
10
- }
11
- })
12
- }
13
- }
package/stores/cloud.js DELETED
@@ -1,73 +0,0 @@
1
- import { useStorage } from "@vueuse/core"
2
-
3
- export const use_cloud_store = defineStore("cloud", {
4
- state: () => ({
5
- ID: useStorage("ID", ""),
6
- is_captcha_validated: false,
7
- is_connexion_launched: false,
8
- }),
9
- getters: {
10
- api_url: () => {
11
- const public_runtime_config = useRuntimeConfig().public
12
- if (public_runtime_config.NODE_ENV == "test") {
13
- return ""
14
- }
15
- var api_url = `${public_runtime_config.GEODE_PROTOCOL}://${public_runtime_config.API_URL}:${public_runtime_config.GEODE_PORT}`
16
- return api_url
17
- },
18
- is_running: () => {
19
- return use_geode_store().is_running && use_viewer_store().is_running
20
- },
21
- is_busy: () => {
22
- return use_geode_store().is_busy || use_viewer_store().is_busy
23
- },
24
- },
25
- actions: {
26
- async create_connexion() {
27
- const geode_store = use_geode_store()
28
- if (this.is_connexion_launched) {
29
- return
30
- }
31
- this.is_connexion_launched = true
32
- if (
33
- this.ID === "" ||
34
- this.ID === null ||
35
- typeof this.ID === "undefined"
36
- ) {
37
- return this.create_backend()
38
- } else {
39
- const { data } = await useFetch(`${geode_store.base_url}/ping`, {
40
- method: "POST",
41
- })
42
- if (data.value !== null) {
43
- geode_store.is_running = true
44
- return geode_store.ping_task()
45
- } else {
46
- return this.create_backend()
47
- }
48
- }
49
- },
50
- async create_backend() {
51
- const geode_store = use_geode_store()
52
- const errors_store = use_errors_store()
53
- const public_runtime_config = useRuntimeConfig().public
54
- const url = this.api_url.concat(
55
- public_runtime_config.SITE_BRANCH,
56
- public_runtime_config.PROJECT,
57
- "/createbackend",
58
- )
59
- const { data } = await useFetch(url, {
60
- method: "POST",
61
- })
62
-
63
- if (data.value !== null) {
64
- this.ID = data.value.ID
65
- localStorage.setItem("ID", data.value.ID)
66
- geode_store.$patch({ is_running: true })
67
- return geode_store.ping_task()
68
- } else {
69
- errors_store.server_error = true
70
- }
71
- },
72
- },
73
- })