From 62345f37c14946c70040ff9073718a153d894efd Mon Sep 17 00:00:00 2001 From: Ludovic Dehon Date: Tue, 23 May 2023 12:55:13 +0200 Subject: [PATCH] feat(ui): display latest version on top bar close #1188 --- ui/src/components/layout/TopNavBar.vue | 14 +++++++++++++- ui/src/stores/api.js | 9 +++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/ui/src/components/layout/TopNavBar.vue b/ui/src/components/layout/TopNavBar.vue index cdfdc20c918..72a23917531 100644 --- a/ui/src/components/layout/TopNavBar.vue +++ b/ui/src/components/layout/TopNavBar.vue @@ -19,6 +19,11 @@
+ + 🎉 New release v{{ version.latest }} + @@ -43,6 +48,7 @@ }, computed: { ...mapState("layout", ["topNavbar"]), + ...mapState("api", ["version"]), title() { return this.topNavbar.title; }, @@ -125,6 +131,7 @@ } } + .is-text { font-weight: bold; border: 1px solid var(--bs-border-color); @@ -133,9 +140,14 @@ background-color: var(--bs-white) !important; html.dark & { - color: var(--bs-white); + color: var(--bs-white) !important; background-color: var(--bs-gray-500) !important; } + + &.version, html.dark &.version { + background: var(--el-color-primary) !important; + border-color: var(--el-color-primary-dark-2) !important; + } } } } diff --git a/ui/src/stores/api.js b/ui/src/stores/api.js index 560d0ee9b94..87fcaccf7db 100644 --- a/ui/src/stores/api.js +++ b/ui/src/stores/api.js @@ -7,18 +7,20 @@ export default { namespaced: true, state: { feeds: [], + version: undefined, }, actions: { loadFeeds({commit}, options) { - return axios.get(API_URL + "/v1/feeds/latest", { + return axios.get(API_URL + "/v1/feeds", { params: { iid: options.iid, uid: options.uid, version: options.version } }).then(response => { - commit("setFeeds", response.data) + commit("setFeeds", response.data.feeds) + commit("setVersion", response.data.version) return response.data; }) @@ -45,6 +47,9 @@ export default { mutations: { setFeeds(state, feeds) { state.feeds = feeds + }, + setVersion(state, version) { + state.version = version } } }