mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-23 03:25:15 +00:00
Implement layout reset
This commit is contained in:
parent
829cb07745
commit
a7d78b7c74
|
@ -27,6 +27,7 @@
|
|||
<b-avatar button>FT</b-avatar>
|
||||
</template>
|
||||
<b-dropdown-item to="/settings">Settings</b-dropdown-item>
|
||||
<b-dropdown-item @click="resetDynamicLayout">Reset Layout</b-dropdown-item>
|
||||
<b-dropdown-item to="/" @click.native="logout()">Sign Out</b-dropdown-item>
|
||||
</b-nav-item-dropdown>
|
||||
</li>
|
||||
|
@ -48,6 +49,7 @@ import userService from '@/shared/userService';
|
|||
import BootswatchThemeSelect from '@/components/BootswatchThemeSelect.vue';
|
||||
|
||||
const ftbot = namespace('ftbot');
|
||||
const layoutNs = namespace('layout');
|
||||
|
||||
@Component({
|
||||
components: { LoginModal, BootswatchThemeSelect },
|
||||
|
@ -63,6 +65,10 @@ export default class NavBar extends Vue {
|
|||
|
||||
@ftbot.Action ping;
|
||||
|
||||
@layoutNs.Action resetDashboardLayout;
|
||||
|
||||
@layoutNs.Action resetTradingLayout;
|
||||
|
||||
mounted() {
|
||||
this.ping();
|
||||
this.pingInterval = setInterval(this.ping, 60000);
|
||||
|
@ -78,6 +84,20 @@ export default class NavBar extends Vue {
|
|||
userService.logout();
|
||||
this.setLoggedIn(false);
|
||||
}
|
||||
|
||||
resetDynamicLayout(): void {
|
||||
const route = this.$router.currentRoute.path;
|
||||
console.log(`resetLayout called for ${route}`);
|
||||
switch (route) {
|
||||
case '/trade':
|
||||
this.resetTradingLayout();
|
||||
break;
|
||||
case '/dashboard':
|
||||
this.resetDashboardLayout();
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
|
|
|
@ -18,8 +18,8 @@ const DEFAULT_DASHBOARD_LAYOUT: GridItemData[] = [
|
|||
export default {
|
||||
namespaced: true,
|
||||
state: {
|
||||
dashboardLayout: DEFAULT_DASHBOARD_LAYOUT,
|
||||
tradingLayout: DEFAULT_TRADING_LAYOUT,
|
||||
dashboardLayout: JSON.parse(JSON.stringify(DEFAULT_DASHBOARD_LAYOUT)),
|
||||
tradingLayout: JSON.parse(JSON.stringify(DEFAULT_TRADING_LAYOUT)),
|
||||
},
|
||||
|
||||
getters: {
|
||||
|
@ -43,11 +43,11 @@ export default {
|
|||
|
||||
actions: {
|
||||
resetDashboardLayout({ commit }) {
|
||||
commit('setDashboardLayout', DEFAULT_DASHBOARD_LAYOUT);
|
||||
commit('setDashboardLayout', JSON.parse(JSON.stringify(DEFAULT_DASHBOARD_LAYOUT)));
|
||||
},
|
||||
|
||||
resetTradingLayout({ commit }) {
|
||||
commit('setTradingLayout', DEFAULT_TRADING_LAYOUT);
|
||||
commit('setTradingLayout', JSON.parse(JSON.stringify(DEFAULT_TRADING_LAYOUT)));
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user