Skip to content

Commit c0c7b6a

Browse files
committed
feat: implement version fetching and display in footer and settings
- Added orchestrator and daemon version fetching logic in the default layout and settings page. - Updated footer component to display current versions with links to their respective release tags. - Enhanced settings page to show last refresh time and automatic update countdown for health indicators. - Refactored help button integration across various layouts for consistency.
1 parent 101b34e commit c0c7b6a

File tree

7 files changed

+234
-71
lines changed

7 files changed

+234
-71
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<template lang="pug">
2+
3+
q-btn.q-px-sm(@click="toogleDark" flat stretch icon="mdi-theme-light-dark" :size="size")
4+
q-tooltip.text-body2(anchor="top middle" self="bottom middle") Mode sombre/clair
5+
q-btn.q-px-sm(flat stretch icon="mdi-frequently-asked-questions" :href="getQAndALink" target="_blank" :size="size")
6+
q-tooltip.text-body2 Poser&nbsp;une&nbsp;question&nbsp;ou&nbsp;signaler&nbsp;un&nbsp;problème
7+
q-btn.q-px-sm(flat stretch icon="mdi-help" href="https://libertech-fr.github.io/sesame-doc/" target="_blank" :size="size")
8+
q-tooltip.text-body2 Aide&nbsp;et&nbsp;Documentation
9+
</template>
10+
11+
<script lang="ts">
12+
export default defineNuxtComponent({
13+
name: 'HelpButtonsComponent',
14+
props: {
15+
size: {
16+
type: String as PropType<'sm' | 'md' | 'lg'>,
17+
default: 'sm',
18+
},
19+
},
20+
computed: {
21+
getQAndALink(): string {
22+
return (
23+
'https://github.com/Libertech-FR/sesame-orchestrator/discussions/new?' +
24+
[
25+
'category=q-a',
26+
'title=[QUESTION]%20Votre%20titre%20ici',
27+
"body=Décrivez%20votre%20question%20ici.%0A%0A---%0A%0A*Merci%20de%20ne%20pas%20oublier%20de%20fournir%20les%20informations%20suivantes%20:%0A%20-%20Version%20de%20l'Orchestrator%20:%20" +
28+
(this.orchestratorVersion?.currentVersion || 'N/A') +
29+
'%0A%20-%20Version%20du%20Daemon%20:%20' +
30+
(this.daemonVersion?.currentVersion || 'N/A') +
31+
"%0A%20-%20Système%20d'exploitation%20:%20" +
32+
(navigator.userAgent || 'N/A'),
33+
].join('&')
34+
)
35+
},
36+
},
37+
setup() {
38+
const orchestratorVersion = inject<{
39+
currentVersion?: string
40+
lastVersion?: string
41+
updateAvailable?: boolean
42+
}>('orchestratorVersion', {})
43+
const daemonVersion = inject<{
44+
currentVersion?: string
45+
lastVersion?: string
46+
updateAvailable?: boolean
47+
}>('daemonVersion', {})
48+
49+
return {
50+
orchestratorVersion,
51+
daemonVersion,
52+
}
53+
},
54+
methods: {
55+
toogleDark() {
56+
this.$q.dark.toggle()
57+
window.sessionStorage.setItem('darkMode', this.$q.dark.isActive ? 'true' : 'false')
58+
},
59+
},
60+
})
61+
</script>
Lines changed: 19 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
<template lang="pug">
22
q-footer(:class="$q.dark.isActive ? 'bg-dark' : 'bg-white'" bordered)
33
q-bar(:class="$q.dark.isActive ? 'bg-dark' : 'bg-white text-black'")
4-
span
4+
a(
5+
:href="'https://github.com/Libertech-FR/sesame-orchestrator/releases/tag/' + (orchestratorVersion?.currentVersion || '0.0.0')"
6+
target="_blank"
7+
rel="noopener noreferrer"
8+
style="color: inherit; text-decoration: none;"
9+
)
510
small.gt-xs Orchestrator&nbsp;
611
small(v-text="'v' + (orchestratorVersion?.currentVersion || '0.0.0')")
712
small.bold &nbsp;/&nbsp;
8-
span
13+
a(
14+
:href="'https://github.com/Libertech-FR/sesame-daemon/releases/tag/' + (daemonVersion?.currentVersion || '0.0.0')"
15+
target="_blank"
16+
rel="noopener noreferrer"
17+
style="color: inherit; text-decoration: none;"
18+
)
919
small.gt-xs Daemon&nbsp;
1020
small(v-text="'v' + (daemonVersion?.currentVersion || '0.0.0')")
1121
div.q-pr-xs
@@ -28,44 +38,21 @@
2838
span(v-text="daemonVersion?.lastVersion || '0.0.0'")
2939
| )
3040
q-space
31-
q-btn.q-px-sm(@click="toogleDark" flat stretch icon="mdi-theme-light-dark")
32-
q-btn.q-px-sm(flat stretch icon="mdi-frequently-asked-questions" :href="getQAndALink" target="_blank")
33-
q-tooltip.text-body2 Poser&nbsp;une&nbsp;question&nbsp;ou&nbsp;signaler&nbsp;un&nbsp;problème
34-
q-btn.q-px-sm(flat stretch icon="mdi-help" href="https://libertech-fr.github.io/sesame-doc/" target="_blank")
35-
q-tooltip.text-body2 Aide&nbsp;et&nbsp;Documentation
41+
sesame-core-help-buttons
3642
</template>
3743

3844
<script lang="ts">
3945
export default defineNuxtComponent({
4046
name: 'LayoutsDefaultFooterComponent',
47+
inject: ['orchestratorVersion', 'daemonVersion'],
4148
setup() {
49+
const orchestratorVersion = inject('orchestratorVersion')
50+
const daemonVersion = inject('daemonVersion')
51+
4252
return {
43-
orchestratorVersion: {},
44-
daemonVersion: {},
53+
orchestratorVersion,
54+
daemonVersion,
4555
}
4656
},
47-
computed: {
48-
getQAndALink(): string {
49-
return (
50-
'https://github.com/Libertech-FR/sesame-orchestrator/discussions/new?' +
51-
[
52-
'category=q-a',
53-
'title=[QUESTION]%20Votre%20titre%20ici',
54-
"body=Décrivez%20votre%20question%20ici.%0A%0A---%0A%0A*Merci%20de%20ne%20pas%20oublier%20de%20fournir%20les%20informations%20suivantes%20:%0A%20-%20Version%20de%20l'Orchestrator%20:%20" +
55-
(this.orchestratorVersion?.currentVersion || 'N/A') +
56-
'%0A%20-%20Version%20du%20Daemon%20:%20' +
57-
(this.daemonVersion?.currentVersion || 'N/A') +
58-
"%0A%20-%20Système%20d'exploitation%20:%20" +
59-
(navigator.userAgent || 'N/A'),
60-
].join('&')
61-
)
62-
},
63-
},
64-
methods: {
65-
toogleDark() {
66-
this.$q.dark.toggle()
67-
window.sessionStorage.setItem('darkMode', this.$q.dark.isActive ? 'true' : 'false')
68-
},
69-
},
7057
})
7158
</script>

apps/web/src/layouts/default.vue

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ export default defineNuxtComponent({
2828
provide() {
2929
return {
3030
syncing: this.syncing,
31+
orchestratorVersion: this.orchestratorVersion,
32+
daemonVersion: this.daemonVersion,
3133
}
3234
},
3335
data() {
@@ -42,6 +44,16 @@ export default defineNuxtComponent({
4244
eventSeamless: false,
4345
eventSeamlessCurrent: 0,
4446
eventSeamlessCurrentJobs: {},
47+
orchestratorVersion: {
48+
currentVersion: '0.0.0',
49+
lastVersion: '0.0.0',
50+
updateAvailable: false,
51+
},
52+
daemonVersion: {
53+
currentVersion: '0.0.0',
54+
lastVersion: '0.0.0',
55+
updateAvailable: false,
56+
},
4557
}
4658
},
4759
async setup() {
@@ -72,6 +84,76 @@ export default defineNuxtComponent({
7284
},
7385
},
7486
methods: {
87+
async fetchVersions(): Promise<void> {
88+
try {
89+
const orchestratorResponse = await $http.$get('/get-update/sesame-orchestrator') as {
90+
data?: {
91+
currentVersion?: string
92+
lastVersion?: string
93+
updateAvailable?: boolean
94+
}
95+
}
96+
const orchestratorData = orchestratorResponse?.data
97+
Object.assign(this.orchestratorVersion, {
98+
currentVersion: orchestratorData?.currentVersion || '0.0.0',
99+
lastVersion: orchestratorData?.lastVersion || '0.0.0',
100+
updateAvailable: Boolean(orchestratorData?.updateAvailable),
101+
})
102+
} catch (error) {
103+
console.error(error)
104+
}
105+
106+
try {
107+
const daemonPackageResponse = await $http.$post('/core/backends/execute?async=false', {
108+
method: 'POST',
109+
body: {
110+
action: 'DUMP_PACKAGE_CONFIG',
111+
},
112+
}) as {
113+
response?: {
114+
data?: Array<{
115+
version?: string
116+
}> | {
117+
package?: {
118+
version?: string
119+
}
120+
version?: string
121+
}
122+
package?: {
123+
version?: string
124+
}
125+
version?: string
126+
}
127+
}
128+
129+
const daemonResponseData = daemonPackageResponse?.response?.data
130+
const daemonResponseDataVersion = Array.isArray(daemonResponseData)
131+
? daemonResponseData?.[0]?.version
132+
: daemonResponseData?.package?.version || daemonResponseData?.version
133+
134+
const daemonCurrentVersion =
135+
daemonResponseDataVersion ||
136+
daemonPackageResponse?.response?.package?.version ||
137+
daemonPackageResponse?.response?.version ||
138+
'0.0.0'
139+
140+
const daemonUpdateResponse = await $http.$get(`/get-update/sesame-daemon?current=${encodeURIComponent(daemonCurrentVersion)}`) as {
141+
data?: {
142+
currentVersion?: string
143+
lastVersion?: string
144+
updateAvailable?: boolean
145+
}
146+
}
147+
const daemonUpdateData = daemonUpdateResponse?.data
148+
Object.assign(this.daemonVersion, {
149+
currentVersion: daemonUpdateData?.currentVersion || daemonCurrentVersion,
150+
lastVersion: daemonUpdateData?.lastVersion || '0.0.0',
151+
updateAvailable: Boolean(daemonUpdateData?.updateAvailable),
152+
})
153+
} catch (error) {
154+
console.error(error)
155+
}
156+
},
75157
syncing(payload: { count: number }) {
76158
this.eventSeamlessTotal = payload.count
77159
this.eventSeamlessCurrent = 0
@@ -134,6 +216,8 @@ export default defineNuxtComponent({
134216
135217
this.es = new ReconnectingEventSource(esUrl)
136218
this.es.onmessage = this.onmessage.bind(this)
219+
220+
this.fetchVersions()
137221
},
138222
destroyed() {
139223
this.removeRouteBeforeEachGuard?.()

apps/web/src/layouts/empty.vue

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,20 @@ q-layout(view="hHh LpR lff" style="margin-top: -1px;")
33
q-page-container
44
nuxt-page
55
</template>
6+
7+
<script lang="ts">
8+
export default defineNuxtComponent({
9+
name: 'EmptyLayout',
10+
setup() {
11+
const $q = useQuasar()
12+
13+
$q.loadingBar.setDefaults({
14+
color: 'white',
15+
size: '3px',
16+
position: 'top'
17+
})
18+
19+
return { }
20+
},
21+
})
22+
</script>

apps/web/src/layouts/simple-centered.vue

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,22 @@ q-layout(view="lHh Lpr fff")
1111
icon="mdi-help-circle"
1212
direction='left'
1313
)
14-
q-fab-action(
15-
color="primary"
16-
icon='mdi-theme-light-dark' @click="toogleDark()"
17-
)
18-
q-fab-action(
19-
color="primary"
20-
icon='mdi-frequently-asked-questions'
21-
@click="openLink()"
22-
)
14+
q-btn-group(:class="$q.dark.isActive ? 'bg-dark' : 'bg-white'")
15+
sesame-core-help-buttons(size='sm')
2316
</template>
2417

2518
<script lang="ts">
2619
export default defineNuxtComponent({
2720
name: 'SimpleCenteredLayout',
2821
setup() {
22+
const $q = useQuasar()
23+
24+
$q.loadingBar.setDefaults({
25+
color: 'white',
26+
size: '3px',
27+
position: 'top'
28+
})
29+
2930
const getStyle = () => {
3031
return {
3132
backgroundImage: `url('/config/login-background.png'), linear-gradient(#5274C5, #9A4A9F)`,
@@ -35,31 +36,5 @@ export default defineNuxtComponent({
3536
3637
return { getStyle }
3738
},
38-
computed: {
39-
getQAndALink(): string {
40-
return (
41-
'https://github.com/Libertech-FR/sesame-orchestrator/discussions/new?' +
42-
[
43-
'category=q-a',
44-
'title=[QUESTION]%20Votre%20titre%20ici',
45-
"body=Décrivez%20votre%20question%20ici.%0A%0A---%0A%0A*Merci%20de%20ne%20pas%20oublier%20de%20fournir%20les%20informations%20suivantes%20:%0A%20-%20Version%20de%20l'Orchestrator%20:%20" +
46-
'N/A' +
47-
'%0A%20-%20Version%20du%20Daemon%20:%20' +
48-
'N/A' +
49-
"%0A%20-%20Système%20d'exploitation%20:%20" +
50-
(navigator.userAgent || 'N/A'),
51-
].join('&')
52-
)
53-
},
54-
},
55-
methods: {
56-
openLink() {
57-
window.open(this.getQAndALink, '_blank')
58-
},
59-
toogleDark() {
60-
this.$q.dark.toggle()
61-
window.sessionStorage.setItem('darkMode', this.$q.dark.isActive ? 'true' : 'false')
62-
},
63-
},
6439
})
6540
</script>

apps/web/src/pages/settings.vue

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
<template lang="pug">
2-
q-dialog(:model-value="true" transition-show='none' transition-hide='none' full-width full-height persistent)
2+
q-dialog(
3+
:model-value="true"
4+
transition-show='none'
5+
transition-hide='none'
6+
:full-width="$q.screen.gt.md"
7+
:full-height="$q.screen.gt.md"
8+
persistent
9+
:maximized="!$q.screen.gt.md"
10+
)
311
q-card.sesame-sticky-dialog
412
q-toolbar.bg-primary.text-white(flat)
513
q-btn(flat @click="drawer = !drawer" round dense icon="mdi-menu")
614
q-toolbar-title Paramètres
15+
sesame-core-help-buttons(size='sm')
16+
q-separator.q-mx-sm(vertical dark inset)
717
q-btn(icon="mdi-close" flat round dense to='/')
18+
q-tooltip.text-body2(anchor="top middle" self="bottom middle") Fermer
819
.flex.fit(:style='{ flexDirection: $q.screen.gt.sm ? "row" : "column" }')
920
.col-0
1021
q-tabs.full-height.border-right(
@@ -130,5 +141,11 @@ export default defineNuxtComponent({
130141
router,
131142
}
132143
},
144+
methods: {
145+
toogleDark() {
146+
this.$q.dark.toggle()
147+
window.sessionStorage.setItem('darkMode', this.$q.dark.isActive ? 'true' : 'false')
148+
},
149+
},
133150
})
134151
</script>

0 commit comments

Comments
 (0)