mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-23 03:25:15 +00:00
Add online indicator
This commit is contained in:
parent
afeec39cd5
commit
b516cae97f
|
@ -16,6 +16,11 @@
|
||||||
</b-navbar-nav>
|
</b-navbar-nav>
|
||||||
<!-- Right aligned nav items -->
|
<!-- Right aligned nav items -->
|
||||||
<b-navbar-nav class="ml-auto">
|
<b-navbar-nav class="ml-auto">
|
||||||
|
<li class="nav-item text-secondary mr-2">
|
||||||
|
<b-nav-text class="verticalCenter">
|
||||||
|
{{ isBotOnline ? 'Online' : 'Offline' }}
|
||||||
|
</b-nav-text>
|
||||||
|
</li>
|
||||||
<li class="nav-item" v-if="loggedIn">
|
<li class="nav-item" v-if="loggedIn">
|
||||||
<b-nav-item-dropdown right>
|
<b-nav-item-dropdown right>
|
||||||
<template v-slot:button-content>
|
<template v-slot:button-content>
|
||||||
|
@ -48,6 +53,8 @@ import BootswatchThemeSelect from '@/components/BootswatchThemeSelect.vue';
|
||||||
export default class NavBar extends Vue {
|
export default class NavBar extends Vue {
|
||||||
@State loggedIn!: boolean;
|
@State loggedIn!: boolean;
|
||||||
|
|
||||||
|
@State isBotOnline!: boolean;
|
||||||
|
|
||||||
@Mutation setLoggedIn;
|
@Mutation setLoggedIn;
|
||||||
|
|
||||||
logout(): void {
|
logout(): void {
|
||||||
|
@ -57,7 +64,7 @@ export default class NavBar extends Vue {
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style lang="scss" scoped>
|
||||||
.logo {
|
.logo {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
height: 30px;
|
height: 30px;
|
||||||
|
@ -74,4 +81,9 @@ export default class NavBar extends Vue {
|
||||||
.nav-link:active {
|
.nav-link:active {
|
||||||
color: white;
|
color: white;
|
||||||
}
|
}
|
||||||
|
.verticalCenter {
|
||||||
|
align-items: center;
|
||||||
|
display: inline-flex;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
@ -13,7 +13,8 @@ export default new Vuex.Store({
|
||||||
state: {
|
state: {
|
||||||
ping: '',
|
ping: '',
|
||||||
loggedIn: userService.loggedIn(),
|
loggedIn: userService.loggedIn(),
|
||||||
autoRefresh: JSON.parse(localStorage.getItem(AUTO_REFRESH) || 'false'),
|
autoRefresh: JSON.parse(localStorage.getItem(AUTO_REFRESH) || '{}'),
|
||||||
|
isBotOnline: true,
|
||||||
},
|
},
|
||||||
modules: {
|
modules: {
|
||||||
ftbot: ftbotModule,
|
ftbot: ftbotModule,
|
||||||
|
@ -31,12 +32,22 @@ export default new Vuex.Store({
|
||||||
setAutoRefresh(state, newRefreshValue: boolean) {
|
setAutoRefresh(state, newRefreshValue: boolean) {
|
||||||
state.autoRefresh = newRefreshValue;
|
state.autoRefresh = newRefreshValue;
|
||||||
},
|
},
|
||||||
|
setIsBotOnline(state, isBotOnline: boolean) {
|
||||||
|
state.isBotOnline = isBotOnline;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
setAutoRefresh({ commit }, newRefreshValue) {
|
setAutoRefresh({ commit }, newRefreshValue) {
|
||||||
commit('setAutoRefresh', newRefreshValue);
|
commit('setAutoRefresh', newRefreshValue);
|
||||||
localStorage.setItem(AUTO_REFRESH, JSON.stringify(newRefreshValue));
|
localStorage.setItem(AUTO_REFRESH, JSON.stringify(newRefreshValue));
|
||||||
},
|
},
|
||||||
|
setIsBotOnline({ commit, dispatch }, isOnline) {
|
||||||
|
commit('setIsBotOnline', isOnline);
|
||||||
|
if (isOnline === false) {
|
||||||
|
console.log('disabling autorun');
|
||||||
|
dispatch('setAutoRefresh', false);
|
||||||
|
}
|
||||||
|
},
|
||||||
refreshOnce({ dispatch }) {
|
refreshOnce({ dispatch }) {
|
||||||
dispatch('ftbot/getVersion');
|
dispatch('ftbot/getVersion');
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user