mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-10 18:23:50 +00:00
Autoselect first available Bot
This commit is contained in:
parent
9ad4fefffa
commit
79c6618b2b
|
@ -146,4 +146,5 @@ store.registerModule('ftbot', createBotStore(store));
|
|||
UserService.getAvailableBotList().forEach((e) => {
|
||||
store.dispatch('ftbot/addBot', e);
|
||||
});
|
||||
store.dispatch('ftbot/selectFirstBot');
|
||||
export default store;
|
||||
|
|
|
@ -14,7 +14,7 @@ export enum MultiBotStoreGetters {
|
|||
|
||||
export default function createBotStore(store) {
|
||||
const state: FTMultiBotState = {
|
||||
selectedBot: 'ftbot.0',
|
||||
selectedBot: '',
|
||||
availableBots: [],
|
||||
};
|
||||
|
||||
|
@ -46,7 +46,7 @@ export default function createBotStore(store) {
|
|||
|
||||
const mutations = {
|
||||
selectBot(state: FTMultiBotState, botId: string) {
|
||||
if (botId in state.availableBots) {
|
||||
if (state.availableBots.includes(botId)) {
|
||||
state.selectedBot = botId;
|
||||
} else {
|
||||
console.warn(`Botid ${botId} not available, but selected`);
|
||||
|
@ -84,6 +84,11 @@ export default function createBotStore(store) {
|
|||
console.warn(`bot ${botId} not found! could not remove`);
|
||||
}
|
||||
},
|
||||
selectFirstBot({ commit, getters }) {
|
||||
if (getters.hasBots) {
|
||||
commit('selectBot', getters.allAvailableBots[0]);
|
||||
}
|
||||
},
|
||||
};
|
||||
// Autocreate Actions
|
||||
Object.keys(BotStoreActions).forEach((e) => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user