From 47c5d999efd68527f17887ff358c316920877b08 Mon Sep 17 00:00:00 2001 From: Akkadius Date: Tue, 30 Nov 2021 00:14:16 -0600 Subject: [PATCH] Add version to navbar --- CHANGELOG.md | 3 +++ frontend/src/views/layout/Navbar.vue | 18 ++++++++++++++++++ frontend/src/views/pages/Home.vue | 2 -- internal/http/controllers/app_controller.go | 1 - main.go | 1 + package.json | 2 +- 6 files changed, 23 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4055672cc..d4e48514a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [1.0.3] +* Add version to navbar + ## [1.0.2] * Embed the changelog you're reading into the app diff --git a/frontend/src/views/layout/Navbar.vue b/frontend/src/views/layout/Navbar.vue index 6e999fbf9..fbf7f0d17 100644 --- a/frontend/src/views/layout/Navbar.vue +++ b/frontend/src/views/layout/Navbar.vue @@ -152,6 +152,10 @@ + + @@ -218,6 +222,8 @@ import NavbarUserSettingsCog from "@/views/layout/NavbarUserSettingsCog"; import UserContext from "@/app/user/UserContext"; import NavSectionComponent from "@/views/layout/NavSectionComponent"; import {ROUTE} from "@/routes"; +import {SpireApiClient} from "@/app/api/spire-api-client"; +import * as util from "util"; export default { components: { NavSectionComponent, NavbarDropdownMenu, NavbarUserSettingsCog }, @@ -225,6 +231,7 @@ export default { return { backendBaseUrl: "", user: null, + appVersion: "", componentNavs: [ { title: "Progress Bars", to: "/components#progress-bars" }, { title: "Page Headers", to: "/components#page-headers" }, @@ -277,6 +284,17 @@ export default { }, async mounted() { + + SpireApiClient.v1().get(`/app/env`).then((response) => { + if (response.data && response.data.data) { + // console.log(response.data.data) + const env = response.data.data.env + const version = response.data.data.version + + this.appVersion = util.format("%s (%s)", env, version) + } + }) + this.backendBaseUrl = App.BACKEND_BASE_URL this.user = await UserContext.getUser() }, diff --git a/frontend/src/views/pages/Home.vue b/frontend/src/views/pages/Home.vue index beb981a9c..2ad05f1a0 100644 --- a/frontend/src/views/pages/Home.vue +++ b/frontend/src/views/pages/Home.vue @@ -63,8 +63,6 @@ export default { result = md.render(result); - console.log(result) - // doc this.changelog = "
" + result + "
" diff --git a/internal/http/controllers/app_controller.go b/internal/http/controllers/app_controller.go index e70d836f9..a14a59a4e 100644 --- a/internal/http/controllers/app_controller.go +++ b/internal/http/controllers/app_controller.go @@ -50,7 +50,6 @@ type PackageJson struct { func (d *AppController) env(c echo.Context) error { data, _ := d.cache.Get("packageJson") - pJson, ok := data.([]byte) if ok { var pkg PackageJson diff --git a/main.go b/main.go index becb368d9..afe5220b7 100644 --- a/main.go +++ b/main.go @@ -27,6 +27,7 @@ func main() { // ran via executable on desktop if len(os.Args) == 1 && runtime.GOOS == "windows" { + _ = os.Setenv("APP_ENV", "desktop") app.Desktop().Boot() } diff --git a/package.json b/package.json index 759848f47..74bda719b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "spire", - "version": "1.0.2", + "version": "1.0.3", "repository": { "type": "git", "url": "https://github.com/Akkadius/spire.git"