mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-23 19:45:15 +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) => {
|
UserService.getAvailableBotList().forEach((e) => {
|
||||||
store.dispatch('ftbot/addBot', e);
|
store.dispatch('ftbot/addBot', e);
|
||||||
});
|
});
|
||||||
|
store.dispatch('ftbot/selectFirstBot');
|
||||||
export default store;
|
export default store;
|
||||||
|
|
|
@ -14,7 +14,7 @@ export enum MultiBotStoreGetters {
|
||||||
|
|
||||||
export default function createBotStore(store) {
|
export default function createBotStore(store) {
|
||||||
const state: FTMultiBotState = {
|
const state: FTMultiBotState = {
|
||||||
selectedBot: 'ftbot.0',
|
selectedBot: '',
|
||||||
availableBots: [],
|
availableBots: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ export default function createBotStore(store) {
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
selectBot(state: FTMultiBotState, botId: string) {
|
selectBot(state: FTMultiBotState, botId: string) {
|
||||||
if (botId in state.availableBots) {
|
if (state.availableBots.includes(botId)) {
|
||||||
state.selectedBot = botId;
|
state.selectedBot = botId;
|
||||||
} else {
|
} else {
|
||||||
console.warn(`Botid ${botId} not available, but selected`);
|
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`);
|
console.warn(`bot ${botId} not found! could not remove`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
selectFirstBot({ commit, getters }) {
|
||||||
|
if (getters.hasBots) {
|
||||||
|
commit('selectBot', getters.allAvailableBots[0]);
|
||||||
|
}
|
||||||
|
},
|
||||||
};
|
};
|
||||||
// Autocreate Actions
|
// Autocreate Actions
|
||||||
Object.keys(BotStoreActions).forEach((e) => {
|
Object.keys(BotStoreActions).forEach((e) => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user