mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-23 19:45:15 +00:00
readd global refresh switch
This commit is contained in:
parent
a95ea597d0
commit
e2dc1b9b10
|
@ -1,23 +1,27 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="d-flex flex-align-center">
|
<div class="d-flex flex-align-center ml-2">
|
||||||
<b-button class="m-1 mr-3" variant="secondary" size="sm" @click="allRefreshFull(true)">
|
<b-form-checkbox
|
||||||
|
v-model="autoRefreshLoc"
|
||||||
|
class="ml-auto float-right my-auto"
|
||||||
|
title="AutoRefresh"
|
||||||
|
></b-form-checkbox>
|
||||||
|
<b-button
|
||||||
|
class="m-1"
|
||||||
|
variant="secondary"
|
||||||
|
size="sm"
|
||||||
|
title="Auto Refresh All bots"
|
||||||
|
@click="allRefreshFull(true)"
|
||||||
|
>
|
||||||
<RefreshIcon :size="16" />
|
<RefreshIcon :size="16" />
|
||||||
</b-button>
|
</b-button>
|
||||||
|
|
||||||
<!-- <b-form-checkbox
|
|
||||||
v-model="autoRefreshLoc"
|
|
||||||
class="ml-auto float-right mr-2 my-auto"
|
|
||||||
title="AutoRefresh"
|
|
||||||
variant="secondary"
|
|
||||||
>AutoRefresh</b-form-checkbox
|
|
||||||
> -->
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue } from 'vue-property-decorator';
|
import { Component, Vue } from 'vue-property-decorator';
|
||||||
import { Getter, namespace } from 'vuex-class';
|
import { namespace } from 'vuex-class';
|
||||||
import RefreshIcon from 'vue-material-design-icons/Refresh.vue';
|
import RefreshIcon from 'vue-material-design-icons/Refresh.vue';
|
||||||
|
import { MultiBotStoreGetters } from '@/store/modules/botStoreWrapper';
|
||||||
|
|
||||||
const ftbot = namespace('ftbot');
|
const ftbot = namespace('ftbot');
|
||||||
|
|
||||||
|
@ -27,37 +31,19 @@ export default class ReloadControl extends Vue {
|
||||||
|
|
||||||
refreshIntervalSlow: number | null = null;
|
refreshIntervalSlow: number | null = null;
|
||||||
|
|
||||||
created() {
|
@ftbot.Getter [MultiBotStoreGetters.globalAutoRefresh]!: boolean;
|
||||||
// if (this.loggedIn) {
|
|
||||||
// this.refreshOnce();
|
|
||||||
// this.refreshFull(true);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
mounted() {
|
|
||||||
// this.startRefresh(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
beforeDestroy() {
|
|
||||||
// this.stopRefresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO-multi: This should be per bot!
|
|
||||||
@Getter loggedIn;
|
|
||||||
|
|
||||||
@ftbot.Getter autoRefresh!: boolean;
|
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||||
@ftbot.Action setAutoRefresh!: (newValue: boolean) => void;
|
@ftbot.Action setGlobalAutoRefresh!: (newValue: boolean) => void;
|
||||||
|
|
||||||
@ftbot.Action allRefreshFull;
|
@ftbot.Action allRefreshFull;
|
||||||
|
|
||||||
get autoRefreshLoc() {
|
get autoRefreshLoc() {
|
||||||
return this.autoRefresh;
|
return this.globalAutoRefresh;
|
||||||
}
|
}
|
||||||
|
|
||||||
set autoRefreshLoc(newValue: boolean) {
|
set autoRefreshLoc(newValue: boolean) {
|
||||||
this.setAutoRefresh(newValue);
|
this.setGlobalAutoRefresh(newValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -14,6 +14,7 @@ const AUTH_SELECTED_BOT = 'ftSelectedBot';
|
||||||
interface FTMultiBotState {
|
interface FTMultiBotState {
|
||||||
selectedBot: string;
|
selectedBot: string;
|
||||||
availableBots: BotDescriptors;
|
availableBots: BotDescriptors;
|
||||||
|
globalAutoRefresh: boolean;
|
||||||
refreshing: boolean;
|
refreshing: boolean;
|
||||||
refreshInterval: number | null;
|
refreshInterval: number | null;
|
||||||
refreshIntervalSlow: number | null;
|
refreshIntervalSlow: number | null;
|
||||||
|
@ -25,6 +26,7 @@ export enum MultiBotStoreGetters {
|
||||||
nextBotId = 'nextBotId',
|
nextBotId = 'nextBotId',
|
||||||
selectedBot = 'selectedBot',
|
selectedBot = 'selectedBot',
|
||||||
selectedBotObj = 'selectedBotObj',
|
selectedBotObj = 'selectedBotObj',
|
||||||
|
globalAutoRefresh = 'globalAutoRefresh',
|
||||||
allAvailableBots = 'allAvailableBots',
|
allAvailableBots = 'allAvailableBots',
|
||||||
allAvailableBotsList = 'allAvailableBotsList',
|
allAvailableBotsList = 'allAvailableBotsList',
|
||||||
allTradesAllBots = 'allTradesAllBots',
|
allTradesAllBots = 'allTradesAllBots',
|
||||||
|
@ -57,6 +59,7 @@ export default function createBotStore(store) {
|
||||||
const state: FTMultiBotState = {
|
const state: FTMultiBotState = {
|
||||||
selectedBot: '',
|
selectedBot: '',
|
||||||
availableBots: {},
|
availableBots: {},
|
||||||
|
globalAutoRefresh: true,
|
||||||
refreshing: false,
|
refreshing: false,
|
||||||
refreshInterval: null,
|
refreshInterval: null,
|
||||||
refreshIntervalSlow: null,
|
refreshIntervalSlow: null,
|
||||||
|
@ -84,6 +87,9 @@ export default function createBotStore(store) {
|
||||||
[MultiBotStoreGetters.selectedBotObj](state: FTMultiBotState): BotDescriptor {
|
[MultiBotStoreGetters.selectedBotObj](state: FTMultiBotState): BotDescriptor {
|
||||||
return state.availableBots[state.selectedBot];
|
return state.availableBots[state.selectedBot];
|
||||||
},
|
},
|
||||||
|
[MultiBotStoreGetters.globalAutoRefresh](state: FTMultiBotState): boolean {
|
||||||
|
return state.globalAutoRefresh;
|
||||||
|
},
|
||||||
[MultiBotStoreGetters.allAvailableBots](state: FTMultiBotState): BotDescriptors {
|
[MultiBotStoreGetters.allAvailableBots](state: FTMultiBotState): BotDescriptors {
|
||||||
return state.availableBots;
|
return state.availableBots;
|
||||||
},
|
},
|
||||||
|
@ -166,7 +172,9 @@ export default function createBotStore(store) {
|
||||||
console.warn(`Botid ${botId} not available, but selected.`);
|
console.warn(`Botid ${botId} not available, but selected.`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
setGlobalAutoRefresh(state, value: boolean) {
|
||||||
|
state.globalAutoRefresh = value;
|
||||||
|
},
|
||||||
setRefreshing(state, refreshing: boolean) {
|
setRefreshing(state, refreshing: boolean) {
|
||||||
state.refreshing = refreshing;
|
state.refreshing = refreshing;
|
||||||
},
|
},
|
||||||
|
@ -224,18 +232,27 @@ export default function createBotStore(store) {
|
||||||
localStorage.setItem(AUTH_SELECTED_BOT, botId);
|
localStorage.setItem(AUTH_SELECTED_BOT, botId);
|
||||||
commit('selectBot', botId);
|
commit('selectBot', botId);
|
||||||
},
|
},
|
||||||
|
setGlobalAutoRefresh({ commit }, value: boolean) {
|
||||||
|
commit('setGlobalAutoRefresh', value);
|
||||||
|
},
|
||||||
allRefreshFrequent({ dispatch, getters }, slow: boolean) {
|
allRefreshFrequent({ dispatch, getters }, slow: boolean) {
|
||||||
getters.allAvailableBotsList.forEach((e) => {
|
getters.allAvailableBotsList.forEach((e) => {
|
||||||
if (getters[`${e}/${BotStoreGetters.refreshNow}`]) {
|
if (
|
||||||
|
getters[`${e}/${BotStoreGetters.refreshNow}`] &&
|
||||||
|
getters[MultiBotStoreGetters.globalAutoRefresh]
|
||||||
|
) {
|
||||||
// console.log('refreshing', e);
|
// console.log('refreshing', e);
|
||||||
dispatch(`${e}/${BotStoreActions.refreshFrequent}`, slow);
|
dispatch(`${e}/${BotStoreActions.refreshFrequent}`, slow);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
allRefreshSlow({ dispatch, getters }) {
|
allRefreshSlow({ dispatch, getters }, forceUpdate = false) {
|
||||||
getters.allAvailableBotsList.forEach((e) => {
|
getters.allAvailableBotsList.forEach((e) => {
|
||||||
if (getters[`${e}/${BotStoreGetters.refreshNow}`]) {
|
if (
|
||||||
dispatch(`${e}/${BotStoreActions.refreshSlow}`);
|
getters[`${e}/${BotStoreGetters.refreshNow}`] &&
|
||||||
|
getters[MultiBotStoreGetters.globalAutoRefresh]
|
||||||
|
) {
|
||||||
|
dispatch(`${e}/${BotStoreActions.refreshSlow}`, forceUpdate);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user