Update BotList to be a proper list

This commit is contained in:
Matthias 2021-08-29 11:07:41 +02:00
parent 79c6618b2b
commit a330a39fe0
2 changed files with 24 additions and 9 deletions

View File

@ -1,7 +1,14 @@
<template> <template>
<div> <div>
<h3>Available bots</h3> <h3>Available bots</h3>
<div v-for="bot in allAvailableBots" :key="bot"> <b-list-group>
<b-list-group-item
v-for="bot in allAvailableBots"
:key="bot"
button
:active="bot === selectedBot"
@click="selectBot(bot)"
>
{{ bot }} {{ bot }}
<b-button class="btn-xs ml-1" size="sm" title="Delete trade" @click="clickRemoveBot(bot)"> <b-button class="btn-xs ml-1" size="sm" title="Delete trade" @click="clickRemoveBot(bot)">
<EditIcon :size="16" title="Delete trade" /> <EditIcon :size="16" title="Delete trade" />
@ -9,7 +16,8 @@
<b-button class="btn-xs ml-1" size="sm" title="Delete bot" @click="clickRemoveBot(bot)"> <b-button class="btn-xs ml-1" size="sm" title="Delete bot" @click="clickRemoveBot(bot)">
<DeleteIcon :size="16" title="Delete trade" /> <DeleteIcon :size="16" title="Delete trade" />
</b-button> </b-button>
</div> </b-list-group-item>
</b-list-group>
<LoginModal class="mt-2" login-text="Add new bot" /> <LoginModal class="mt-2" login-text="Add new bot" />
</div> </div>
</template> </template>
@ -26,10 +34,14 @@ const ftbot = namespace('ftbot');
@Component({ components: { LoginModal, DeleteIcon, EditIcon } }) @Component({ components: { LoginModal, DeleteIcon, EditIcon } })
export default class BotList extends Vue { export default class BotList extends Vue {
@ftbot.Getter [MultiBotStoreGetters.selectedBot]: string;
@ftbot.Getter [MultiBotStoreGetters.allAvailableBots]: string[]; @ftbot.Getter [MultiBotStoreGetters.allAvailableBots]: string[];
@ftbot.Action removeBot; @ftbot.Action removeBot;
@ftbot.Action selectBot;
clickRemoveBot(botId) { clickRemoveBot(botId) {
// //
this.$bvModal.msgBoxConfirm(`Really remove (logout) from ${botId}?`).then((value: boolean) => { this.$bvModal.msgBoxConfirm(`Really remove (logout) from ${botId}?`).then((value: boolean) => {

View File

@ -89,6 +89,9 @@ export default function createBotStore(store) {
commit('selectBot', getters.allAvailableBots[0]); commit('selectBot', getters.allAvailableBots[0]);
} }
}, },
selectBot({ commit }, botId: string) {
commit('selectBot', botId);
},
}; };
// Autocreate Actions // Autocreate Actions
Object.keys(BotStoreActions).forEach((e) => { Object.keys(BotStoreActions).forEach((e) => {