Skip to content
Merged

Next #184

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6e3b3ef
fix(ping): bad request if body empty
JulienChampagnol Mar 27, 2025
ee92d5a
refactor stores wip
JulienChampagnol Apr 3, 2025
5a97467
wip unit tests
JulienChampagnol Apr 8, 2025
423d31f
JulienChampagnol Apr 8, 2025
8767e5a
feat(feedback timeout): auto customisable timeout
JulienChampagnol Apr 14, 2025
780b625
feat(microservices status): passing tests
JulienChampagnol Apr 14, 2025
e89cf39
code cleanup
JulienChampagnol Apr 14, 2025
ad05157
pr comments / coverage
JulienChampagnol Apr 15, 2025
c1bf4fb
Merge pull request #178 from Geode-solutions/feat/microservices_status
JulienChampagnol Apr 15, 2025
689fc03
fix(test): log
JulienChampagnol Apr 15, 2025
869dbd4
Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWe…
JulienChampagnol Apr 15, 2025
4b74caf
fix(watches): stores props
JulienChampagnol Apr 16, 2025
200f504
Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWe…
JulienChampagnol Apr 16, 2025
1d8e60d
microservices
JulienChampagnol Apr 16, 2025
8757780
pr comments
JulienChampagnol Apr 16, 2025
139eae9
fixes
JulienChampagnol Apr 16, 2025
23df5fa
Merge pull request #179 from Geode-solutions/fix/refactor_watches
JulienChampagnol Apr 16, 2025
395b70b
Merge branch 'next' of https://github.com/Geode-solutions/OpenGeodeWe…
JulienChampagnol Apr 16, 2025
4429319
fix(feddbackId): add id for callback feedback delete
JulienChampagnol Apr 16, 2025
970aa99
test eslint-plugin-vue 9.33.0"
JulienChampagnol Apr 16, 2025
59b31ae
Apply prepare changes
JulienChampagnol Apr 16, 2025
457168e
Apply prepare changes
JulienChampagnol Apr 16, 2025
10d7343
Merge pull request #180 from Geode-solutions/feat/feedbacks_timeout
JulienChampagnol Apr 16, 2025
de18f6c
fix(launcher): remove on mounted
JulienChampagnol Apr 16, 2025
43fedda
cleanup log
JulienChampagnol Apr 16, 2025
954b343
Merge pull request #182 from Geode-solutions/fix/remove_launcher_on_m…
JulienChampagnol Apr 16, 2025
392c352
fix(client): remove value
JulienChampagnol Apr 16, 2025
c962f21
Merge pull request #183 from Geode-solutions/fix/viewer_client
JulienChampagnol Apr 16, 2025
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
2 changes: 1 addition & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
},
extends: [
"eslint:recommended",
"plugin:vue/vue3-recommended",
"plugin:vue/recommended",
"plugin:vuetify/recommended",
"plugin:nuxt/recommended",
],
Expand Down
2 changes: 1 addition & 1 deletion components/FeedBack/Snackers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
variant="flat"
size="20"
:color="feedback.type"
@click="feedback_store.delete_feedback(index)"
@click="feedback_store.delete_feedback(feedback.id)"
>
<v-icon icon="mdi-close" size="20" color="white" />
</v-btn>
Expand Down
24 changes: 12 additions & 12 deletions components/Launcher.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<v-container class="justify">
<v-row align-content="center" align="center">
<v-col
v-if="!is_captcha_validated"
v-if="!infra_store.is_captcha_validated"
class="align"
cols="12"
align-self="center"
Expand All @@ -11,25 +11,25 @@
<h4 class="pb-3">Please complete the recaptcha to launch the app</h4>
<Recaptcha :site_key="site_key" />
</v-col>
<v-col v-else-if="!is_running && is_connexion_launched">
<v-col v-else-if="infra_store.status == Status.CREATING">
<Loading />
</v-col>
</v-row>
</v-container>
</template>

<script setup>
const viewer_store = use_viewer_store()
const infra_store = use_infra_store()
const { is_captcha_validated, is_connexion_launched, is_running } =
storeToRefs(infra_store)
import Status from "@/utils/status.js"

const infra_store = use_infra_store()
const site_key = useRuntimeConfig().public.RECAPTCHA_SITE_KEY

watch(is_captcha_validated, async (value) => {
if (value === true && process.client) {
await infra_store.create_connexion()
await viewer_store.ws_connect()
}
})
watch(
() => infra_store.is_captcha_validated,
(value, oldValue) => {
if (value && !oldValue && process.client) {
infra_store.create_backend()
}
},
)
</script>
6 changes: 3 additions & 3 deletions components/Loading.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
<v-col cols="12" class="ma-3">
<v-card loading>
<v-card-title class="text-center">
Cloud instance is starting...
Microservices are starting...
</v-card-title>
<v-card-subtitle class="text-center">
Why do you have to wait?
</v-card-subtitle>
<v-card-text class="text-center">
We start our server only on demand... and this takes a few minutes
before you can use our free app.
We start our microservices only on demand... and this takes a few
minutes before you can use our free app.
<br />
This is aligned with our energy sobriety policy. So be patient
<v-icon color="primary" size="20">
Expand Down
16 changes: 9 additions & 7 deletions components/PackagesVersions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,21 @@
</template>

<script setup>
const infra_store = use_infra_store()
const { is_running } = storeToRefs(infra_store)
import Status from "@/utils/status.js"

const props = defineProps({
schema: { type: Object, required: true },
})
const { schema } = props

const geode_store = use_geode_store()
const packages_versions = ref([])

async function get_packages_versions() {
const array_promise = []

const promise = new Promise((resolve, reject) => {
api_fetch(
{ schema },
{ schema: props.schema },
{
request_error_function: () => {
reject()
Expand All @@ -53,9 +52,12 @@
await Promise.all(array_promise)
}

watch(is_running, () => {
get_packages_versions()
})
watch(
() => geode_store.status,
(value) => {
if (value == Status.CONNECTED) get_packages_versions()
},
)

await get_packages_versions()
</script>
6 changes: 2 additions & 4 deletions components/Recaptcha.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
<ClientOnly>
<vue-recaptcha
ref="recaptcha"
:sitekey="site_key"
:sitekey="props.site_key"
:load-recaptcha-script="true"
align-self="center"
@expired="is_captcha_validated = false"
@expired="infra_store.is_captcha_validated = false"
@verify="submit_recaptcha"
/>
</ClientOnly>
Expand All @@ -14,12 +14,10 @@
<script setup>
import { VueRecaptcha } from "vue-recaptcha"
const infra_store = use_infra_store()
const { is_captcha_validated } = storeToRefs(infra_store)

const props = defineProps({
site_key: { type: String, required: true },
})
const { site_key } = props

onMounted(() => {
if (process.client) {
Expand Down
62 changes: 34 additions & 28 deletions components/RemoteRenderingView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"
class="pa-0"
@click="get_x_y"
@keydown.esc="app_store.toggle_picking_mode(false)"
@keydown.esc="viewer_store.toggle_picking_mode(false)"
/>
</div>
</ClientOnly>
Expand All @@ -24,17 +24,20 @@
import vtkRemoteView from "@kitware/vtk.js/Rendering/Misc/RemoteView"
import { useElementSize, useWindowSize } from "@vueuse/core"
import viewer_schemas from "@geode/opengeodeweb-viewer/schemas.json"
import Status from "@/utils/status.js"

const viewer_store = use_viewer_store()
const { client, is_running, picking_mode } = storeToRefs(viewer_store)
const props = defineProps({
viewId: { type: String, default: "-1" },
})

const viewer = ref(null)
const viewer_store = use_viewer_store()
const viewer = useTemplateRef("viewer")
const { width, height } = useElementSize(viewer)

const { width: windowWidth, height: windowHeight } = useWindowSize()

function get_x_y(event) {
if (picking_mode.value === true) {
if (viewer_store.picking_mode.value === true) {
const { offsetX, offsetY } = event
viewer_store.set_picked_point(offsetX, offsetY)
viewer_call({
Expand All @@ -44,13 +47,7 @@
}
}

const props = defineProps({
viewId: { type: String, default: "-1" },
})

const { viewId } = toRefs(props)
const connected = ref(false)

const view = vtkRemoteView.newInstance({
rpcWheelEvent: "viewport.mouse.zoom.wheel",
})
Expand All @@ -70,33 +67,42 @@
resize()
})

watch(picking_mode, (value) => {
const cursor = value ? "crosshair" : "pointer"
view.getCanvasView().setCursor(cursor)
})
watch(
() => viewer_store.picking_mode,
(value) => {
const cursor = value ? "crosshair" : "pointer"
view.getCanvasView().setCursor(cursor)
},
)

watch([width, height], () => {
resize()
})

watch(client, () => {
connect()
})

watch(viewId, (id) => {
if (connected.value) {
view.setViewId(id)
view.render()
}
})
watch(
() => viewer_store.client,
() => {
connect()
},
)

watch(
() => props.viewId,
(id) => {
if (connected.value) {
view.setViewId(id)
view.render()
}
},
)

function connect() {
if (!is_running.value) {
if (viewer_store.status !== Status.CONNECTED) {
return
}
const session = client.value.getConnection().getSession()
const session = viewer_store.client.getConnection().getSession()
view.setSession(session)
view.setViewId(viewId.value)
view.setViewId(props.viewId)
connected.value = true
view.render()
}
Expand Down
21 changes: 11 additions & 10 deletions components/Wrapper.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
<template>
<v-container>
<v-row class="flex-column">
<v-col v-if="!is_running">
<Launcher />
</v-col>
<v-col v-if="is_running">
<Stepper />
</v-col>
<v-col v-if="is_running">
<PackagesVersions :schema="versions_schema" />
</v-col>
<template v-if="!infra_store.microservices_connected">
<v-col>
<Launcher />
</v-col>
</template>
<template v-else>
<v-col>
<Stepper />
</v-col>
<v-col> <PackagesVersions :schema="versions_schema" /> </v-col>
</template>
</v-row>
</v-container>
</template>

<script setup>
const infra_store = use_infra_store()
const { is_running } = storeToRefs(infra_store)

const props = defineProps({
versions_schema: { type: Object, required: true },
Expand Down
15 changes: 0 additions & 15 deletions composables/run_function_when_infra_running.js

This file was deleted.

15 changes: 15 additions & 0 deletions composables/run_function_when_microservices_connected.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export function run_function_when_microservices_connected(function_to_run) {
const infra_store = use_infra_store()
const { microservices_connected } = storeToRefs(infra_store)
if (microservices_connected.value) {
function_to_run()
} else {
watch(microservices_connected, (value) => {
if (value) {
function_to_run()
}
})
}
}

export default run_function_when_microservices_connected
1 change: 1 addition & 0 deletions nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default defineNuxtConfig({
"ajv",
"fast-deep-equal",
"globalthis",
"h3",
"is-electron",
"js-file-download",
"lodash",
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
"@nuxt/test-utils": "^3.15.1",
"@pinia/testing": "^0.1.7",
"@vitejs/plugin-vue": "^5.2.1",
"@vitest/coverage-v8": "^3.0.8",
"@vue/test-utils": "^2.4.6",
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-nuxt": "^4.0.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-prettier-vue": "^5.0.0",
"eslint-plugin-vue": "^9.26.0",
"eslint-plugin-vue": "^9.33.0",
"eslint-plugin-vuetify": "^2.4.0",
"happy-dom": "^15.11.7",
"jsdom": "^24.1.3",
Expand Down Expand Up @@ -53,6 +54,7 @@
"pinia": "^2.2.2",
"sass": "^1.77.8",
"semver": "^7.6.3",
"uuid": "^11.1.0",
"vue-recaptcha": "^2.0.3",
"vue3-carousel": "^0.3.3"
},
Expand Down
19 changes: 17 additions & 2 deletions stores/feedback.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,41 @@
import { v4 as uuidv4 } from "uuid"

export const use_feedback_store = defineStore("feedback", {
state: () => ({
feedbacks: [],
server_error: false,
feedbacks_timeout_miliseconds: 5000,
}),
actions: {
async add_error(code, route, name, description) {
const feedbackId = uuidv4()
await this.feedbacks.push({
id: feedbackId,
type: "error",
code,
route,
name,
description,
})
setTimeout(() => {
this.delete_feedback(feedbackId)
}, this.feedbacks_timeout_miliseconds)
},
async add_success(description) {
const feedbackId = uuidv4()
await this.feedbacks.push({
id: feedbackId,
type: "success",
description,
})
setTimeout(() => {
this.delete_feedback(feedbackId)
}, this.feedbacks_timeout_miliseconds)
},
async delete_feedback(feedback_index) {
await this.feedbacks.splice(feedback_index, 1)
async delete_feedback(feedbackId) {
this.feedbacks = this.feedbacks.filter(
(feedback) => feedback.id !== feedbackId,
)
},
async delete_server_error() {
this.server_error = false
Expand Down
Loading