From e5e2e2a5bbe6fa26348ba8d83ec9c7e02a9e8762 Mon Sep 17 00:00:00 2001 From: Janis Streib <janis.streib@kit.edu> Date: Sat, 16 Nov 2024 16:00:17 +0100 Subject: [PATCH] ADD: offline indicator --- src/App.vue | 2 ++ src/components/Navbar.vue | 4 ++++ src/icons/NETVSIcon.vue | 1 + src/locales/de.json | 1 + src/locales/en.json | 1 + src/vuex.js | 4 ++++ 6 files changed, 13 insertions(+) diff --git a/src/App.vue b/src/App.vue index e9174039b..6d3a7930b 100644 --- a/src/App.vue +++ b/src/App.vue @@ -219,7 +219,9 @@ export default { checkVersion() { SystemInfoService.getAlerts().then((alerts) => { this.$store.commit('updateSystemAlerts', alerts.data) + this.$store.commit('setOnline', true) }).catch(() => { + this.$store.commit('setOnline', false) }) // Fail silently SystemInfoService.getMaintenance(this.$store.state).then((items) => { const alerts = [] diff --git a/src/components/Navbar.vue b/src/components/Navbar.vue index 4dc7158f7..19c69a97c 100644 --- a/src/components/Navbar.vue +++ b/src/components/Navbar.vue @@ -8,6 +8,10 @@ src="/logo.webp"/> <img v-else class="d-inline-block align-top scc-img" alt="NETTVS" src="@/assets/img/netvs_logo.png"/> </b-navbar-brand> + <b-nav-text class="ml-3 text-danger" v-if="!$store.state.netvs_online"> + <netvs-icon size="1x" class="pr-1 text-danger" :beat_fade="true" icon="offline"/> + {{ $t('system.offline') }} + </b-nav-text> <template v-if="$store.state.impersonate_user"> <b-nav-text class="ml-3"> <netvs-icon size="1x" class="pr-1 text-danger" :beat_fade="true" icon="warning"/> diff --git a/src/icons/NETVSIcon.vue b/src/icons/NETVSIcon.vue index 55ee7e9f7..502291238 100644 --- a/src/icons/NETVSIcon.vue +++ b/src/icons/NETVSIcon.vue @@ -14,6 +14,7 @@ export default { data() { return { map: { + offline: 'fa-solid fa-link-slash', home: 'fa-solid fa-home', dnsvs: 'fa-solid fa-signs-post', record: 'fa-solid fa-signs-post', diff --git a/src/locales/de.json b/src/locales/de.json index 2f0e329f1..ec83b1f73 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -423,6 +423,7 @@ } }, "system": { + "offline": "NETVS Offline", "OE": "OE", "account": "Account", "accounts_tokens": "Accounts & Tokens", diff --git a/src/locales/en.json b/src/locales/en.json index c23eaf05a..f32c04be0 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -420,6 +420,7 @@ } }, "system": { + "offline": "NETVS Offline", "OE": "OU", "account": "Account", "accounts_tokens": "Accounts & Tokens", diff --git a/src/vuex.js b/src/vuex.js index e58583560..cd447f6ca 100644 --- a/src/vuex.js +++ b/src/vuex.js @@ -32,6 +32,7 @@ function getTaListFromLocalStorage() { const NetvsVuex = new Vuex.Store({ state: { + netvs_online: true, current_api_version: null, home_grid: window.localStorage.getItem('home_grid') ? JSON.parse(window.localStorage.getItem('home_grid')) : true, refreshHandleGPK: null, @@ -219,6 +220,9 @@ const NetvsVuex = new Vuex.Store({ this.dispatch('refresh_session_info') } }, + setOnline(state, payload) { + state.netvs_online = payload + }, update_session_info(state, payload) { state.xup_perm = payload.xup_perm state.user = payload.user -- GitLab