Skip to content

Commit a87371a

Browse files
feat: test omnect-device-service version on visit (#43)
* feat: test omnect-device-service version on visit * update packages * var to show menu moved to router meta * add docu link * bump version * link to omnect-ui docu page * update readme * remove space * fix typo * more precised name convention
1 parent 41069d7 commit a87371a

File tree

11 files changed

+176
-53
lines changed

11 files changed

+176
-53
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0"
77
name = "omnect-ui"
88
readme = "README.md"
99
repository = "git@github.com:omnect/omnect-ui.git"
10-
version = "0.14.0"
10+
version = "0.14.1"
1111
build = "src/build.rs"
1212

1313
[dependencies]

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,21 @@ This module implements a web frontend and backend to provide omnect specific fea
99
Since omnect-os is designed as generic OS, all specific or optional applications must be provided as docker images via azure iotedge deployment:
1010

1111
- deployment of omnect-ui docker image via omnect-portal to a device in field
12-
- device must be online (at least once) in order to receive the deployment
12+
- device must be online (at least once) in order to receive the deployment and to set initial password
1313
- after a factory reset omnect-ui must be deployed again what requires a connection to azure cloud
1414

1515
## Access omnect-ui
1616

1717
omnect-ui can be reached at <https://DeviceIp:1977><br>
1818

19-
Login with the configured credentials<br>
19+
Login with the configured password<br>
2020
![login](docu/login.png)<br>
2121
Watch device status<br>
2222
![login](docu/main.png)<br>
2323
Reset device and choose options to keep<br>
24-
![factory-reset](docu/factory-reset.png)
24+
![factory-reset](docu/factory-reset.png)<br>
25+
Update your device<br>
26+
![update](docu/update.png)
2527

2628
# License
2729

docu/login.png

-1.97 KB
Loading

docu/main.png

2.45 KB
Loading

docu/update.png

64.2 KB
Loading

vue/bun.lock

Lines changed: 119 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vue/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
"@mdi/font": "^7.4.47",
1919
"@vueuse/core": "^12.8.2",
2020
"axios": "^1.9.0",
21-
"centrifuge": "^5.3.4",
21+
"centrifuge": "^5.3.5",
2222
"oidc-client-ts": "^3.2.1",
23-
"vue": "^3.5.13",
24-
"vuetify": "^3.8.4"
23+
"vue": "^3.5.14",
24+
"vuetify": "^3.8.5"
2525
},
2626
"devDependencies": {
2727
"@biomejs/biome": "1.9.4",
28-
"@types/bun": "^1.2.12",
29-
"@vitejs/plugin-vue": "^5.2.3",
28+
"@types/bun": "^1.2.13",
29+
"@vitejs/plugin-vue": "^5.2.4",
3030
"@vue/tsconfig": "^0.7.0",
3131
"typescript": "~5.7.3",
3232
"unocss": "^65.5.0",

vue/src/App.vue

Lines changed: 34 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
<script setup lang="ts">
22
import axios from "axios"
3-
import { type Ref, computed, onMounted, ref } from "vue"
3+
import { type Ref, onMounted, ref } from "vue"
44
import { useRoute, useRouter } from "vue-router"
55
import { useDisplay } from "vuetify"
66
import BaseSideBar from "./components/BaseSideBar.vue"
7+
import DialogContent from "./components/DialogContent.vue"
78
import OmnectLogo from "./components/OmnectLogo.vue"
89
import OverlaySpinner from "./components/OverlaySpinner.vue"
910
import UserMenu from "./components/UserMenu.vue"
@@ -22,43 +23,64 @@ const { lgAndUp } = useDisplay()
2223
const router = useRouter()
2324
const route = useRoute()
2425
const showSideBar: Ref<boolean> = ref(lgAndUp.value)
26+
const overlay: Ref<boolean> = ref(false)
27+
const errorTitle = ref("")
28+
const errorMsg = ref("")
2529
2630
onConnected(() => {
27-
reset()
28-
router.push("/login")
31+
reset()
32+
router.push("/login")
2933
})
3034
3135
const toggleSideBar = () => {
32-
showSideBar.value = !showSideBar.value
36+
showSideBar.value = !showSideBar.value
3337
}
3438
3539
const updateSidebarVisibility = (visible: boolean) => {
36-
showSideBar.value = visible
40+
showSideBar.value = visible
3741
}
3842
3943
onMounted(async () => {
40-
initializeCentrifuge()
41-
})
42-
43-
const showBars = computed(() => {
44-
return route.path !== "/login" && route.path !== "/set-password" && route.path !== "/auth-callback"
44+
initializeCentrifuge()
45+
46+
const res = await fetch("healthcheck", {
47+
headers: {
48+
"Cache-Control": "no-cache, no-store, must-revalidate",
49+
Pragma: "no-cache",
50+
Expires: "0"
51+
}
52+
})
53+
const data = await res.json()
54+
if (!res.ok) {
55+
overlay.value = true
56+
errorTitle.value = "omnect-device-service version mismatch"
57+
errorMsg.value = `Current version: ${data.cur_ods_version}. Required version ${data.req_ods_version}. Please consider to update omnect Secure OS.`
58+
}
4559
})
4660
</script>
4761

4862
<template>
4963
<v-app>
64+
<v-dialog v-model="overlay" max-width="50vw" :no-click-animation="true" persistent fullscreen>
65+
<DialogContent :title="errorTitle" dialog-type="Error" :show-close="false">
66+
<div class="flex flex-col gap-2 mb-8">
67+
{{ errorMsg }}
68+
</div>
69+
</DialogContent>
70+
</v-dialog>
5071
<v-app-bar flat :style="{ borderBottomWidth: '1px', borderColor: '#677680' }">
5172
<template #prepend>
5273
<v-icon class="hidden-lg-and-up mr-4 cursor-pointer text-primary" @click.stop="toggleSideBar">mdi-menu</v-icon>
5374
<OmnectLogo class="h-12"></OmnectLogo>
5475
</template>
55-
<template v-if="showBars" #append>
76+
<template v-if="route.meta.showMenu" #append>
5677
<div class="flex gap-x-4 mr-4 items-center">
5778
<UserMenu />
5879
</div>
5980
</template>
6081
</v-app-bar>
61-
<BaseSideBar v-if="showBars" :showSideBar="showSideBar" @drawerVisibiltyChanged="updateSidebarVisibility">
82+
<BaseSideBar v-if="route.meta.showMenu" :showSideBar="showSideBar"
83+
@drawerVisibiltyChanged="updateSidebarVisibility">
6284
</BaseSideBar>
6385
<v-main>
6486
<RouterView></RouterView>

vue/src/components/BaseSideBar.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ onGotResponse(async (res) => {
3636
color="white" active-class="text-white bg-white/10" :to="route.path">
3737
<v-list-item-title :style="{ fontWeight: 700 }"> {{ (route.meta!.text as string) }}</v-list-item-title>
3838
</v-list-item>
39+
<v-list-item active-class="text-white bg-white/10" target="_blank" rel="noopener noreferrer"
40+
href="https://documentation.omnect.conplement.cloud/omnect-Secure-OS/omnect-ui"
41+
class="text-white hover:bg-white/10">
42+
<v-list-item-title :style="{ fontWeight: 700 }">Documentation</v-list-item-title>
43+
</v-list-item>
3944
</v-list>
4045
<template v-slot:append>
4146
<div class="flex flex-col items-center mb-4">

0 commit comments

Comments
 (0)