Skip to content

Commit af50113

Browse files
Merge pull request #108 from Geode-solutions/feat/electron_refactor
Feat/electron refactor
2 parents efff30d + 6c731e1 commit af50113

17 files changed

+179
-157
lines changed

components/Launcher.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919

2020
<script setup>
2121
const viewer_store = use_viewer_store()
22-
const cloud_store = use_cloud_store()
22+
const infra_store = use_infra_store()
2323
const { is_captcha_validated, is_connexion_launched, is_running } =
24-
storeToRefs(cloud_store)
24+
storeToRefs(infra_store)
2525
2626
const site_key = useRuntimeConfig().public.RECAPTCHA_SITE_KEY
2727
2828
watch(is_captcha_validated, async (value) => {
2929
if (value === true && process.client) {
30-
await cloud_store.create_connexion()
30+
await infra_store.create_connexion()
3131
await viewer_store.ws_connect()
3232
}
3333
})

components/PackagesVersions.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
</template>
2020

2121
<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)
2424
2525
const props = defineProps({
2626
schema: { type: Object, required: true },

components/Recaptcha.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313

1414
<script setup>
1515
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)
1818
1919
const props = defineProps({
2020
site_key: { type: String, required: true },
@@ -25,7 +25,7 @@
2525
if (process.client) {
2626
const config = useRuntimeConfig()
2727
if (config.public.NODE_ENV !== "production") {
28-
cloud_store.$patch({ is_captcha_validated: true })
28+
infra_store.$patch({ is_captcha_validated: true })
2929
}
3030
}
3131
})
@@ -35,7 +35,7 @@
3535
const response = await $fetch.raw(
3636
`/.netlify/functions/recaptcha?token=${token}`,
3737
)
38-
cloud_store.$patch({ is_captcha_validated: response.status == 200 })
38+
infra_store.$patch({ is_captcha_validated: response.status == 200 })
3939
recaptcha.reset()
4040
} catch (error) {
4141
console.error(error)

components/Wrapper.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
</template>
1616

1717
<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)
2020
2121
const props = defineProps({
2222
versions_schema: { type: Object, required: true },

composables/runFunctionIfCloudRunning.js

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

nuxt.config.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
export default defineNuxtConfig({
22
runtimeConfig: {
33
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",
85
SITE_BRANCH:
96
process.env.NODE_ENV === "production" ? process.env.SITE_BRANCH : "",
107
PROJECT: process.env.NODE_ENV === "production" ? process.env.PROJECT : "",

package.json

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,26 @@
77
"geode_objects": "node scripts/generate_geode_objects.js && prettier ./assets/geode_objects.js --write"
88
},
99
"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",
1414
"eslint": "^8.57.0",
1515
"eslint-plugin-import": "^2.29.1",
1616
"eslint-plugin-nuxt": "^4.0.0",
1717
"eslint-plugin-prettier": "^5.1.3",
1818
"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",
2626
"resize-observer-polyfill": "^1.5.1",
27-
"vite": "^5.2.8",
27+
"vite": "^5.2.13",
2828
"vite-plugin-vuetify": "^2.0.3",
29-
"vitest": "^1.4.0",
29+
"vitest": "^1.6.0",
3030
"vitest-environment-nuxt": "^1.0.0",
3131
"wslink": "^1.12.4"
3232
},
@@ -40,19 +40,20 @@
4040
"dependencies": {
4141
"@geode/opengeodeweb-back": "4.2.1",
4242
"@geode/opengeodeweb-viewer": "0.1.2",
43-
"@kitware/vtk.js": "^30.3.1",
43+
"@kitware/vtk.js": "^30.6.2",
4444
"@mdi/font": "^7.4.47",
4545
"@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",
5051
"pinia": "^2.1.7",
51-
"sass": "^1.74.1",
52-
"semver": "^7.6.0",
52+
"sass": "^1.77.5",
53+
"semver": "^7.6.2",
5354
"vue-recaptcha": "^2.0.3",
5455
"vue3-carousel": "^0.3.3",
55-
"vuetify": "^3.6.8"
56+
"vuetify": "^3.6.9"
5657
},
5758
"repository": {
5859
"type": "git",

stores/cloud.js

Lines changed: 0 additions & 73 deletions
This file was deleted.

stores/geode.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
export const use_geode_store = defineStore("geode", {
22
state: () => ({
3+
PROTOCOL: use_infra_store().is_cloud ? "https" : "http",
4+
PORT: use_infra_store().is_cloud ? "443" : "5000",
35
request_counter: 0,
46
is_running: false,
57
}),
68
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
1012
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`
1415
}
1516
return geode_url
1617
},
17-
is_busy: (state) => {
18+
is_busy(state) {
1819
return state.request_counter > 0
1920
},
2021
},

0 commit comments

Comments
 (0)