Skip to content
This repository has been archived by the owner on Jul 6, 2024. It is now read-only.

Commit

Permalink
Merge pull request #110 from SkywardAI/info-page
Browse files Browse the repository at this point in the history
Added information page for display frontend and backend version
  • Loading branch information
cbh778899 authored Jun 30, 2024
2 parents bbb5db1 + 82eeb6b commit 6b6f11a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 1 deletion.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FRONTEND_APP_VERSION = '0.1.3'
8 changes: 7 additions & 1 deletion components/Layout/sidebar/sidebarItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {
AdjustmentsHorizontalIcon,
LayoutDashboardIcon,
MessageCircleIcon,
SettingsIcon
SettingsIcon,
InfoCircleIcon

} from 'vue-tabler-icons';

Expand Down Expand Up @@ -60,6 +61,11 @@ const sidebarItem: menu[] = [
title: 'Analytics',
icon: MessageCircleIcon,
to: '/ui-components/analytics'
},
{
title: 'Information',
icon: InfoCircleIcon,
to: '/ui-components/information'
}
];

Expand Down
5 changes: 5 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ export default defineNuxtConfig({
// })
// }
],
runtimeConfig: {
public: {
FRONTEND_APP_VERSION: process.env.FRONTEND_APP_VERSION
}
},
css: [
'@/assets/css/unit.css'
],
Expand Down
15 changes: 15 additions & 0 deletions pages/ui-components/Information.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script setup>
import getVersions from '~/tools/getVersions';
const frontendVersion = ref('Loading');
const backendVersion = ref('Loading');
getVersions('frontend').then(version=>frontendVersion.value = version);
getVersions('backend').then(version=>backendVersion.value = version);
</script>
<template>
<div class="p-10 pb-5">
<p class="mb-5">Frontend Version: v{{ frontendVersion }}</p>
<p class="mb-5">Backend Version: v{{ backendVersion }}</p>
</div>
</template>
11 changes: 11 additions & 0 deletions tools/getVersions.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import request from "./request";

async function getVersions(ofEnd:'frontend'|'backend') {
if(ofEnd === 'frontend') {
return useRuntimeConfig().public.FRONTEND_APP_VERSION
} else if(ofEnd === 'backend') {
return (await request('/version')).version
}
}

export default getVersions;

0 comments on commit 6b6f11a

Please sign in to comment.