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,15 +1,23 @@
<template>
<div>
<h3>Available bots</h3>
<div v-for="bot in allAvailableBots" :key="bot">
{{ bot }}
<b-button class="btn-xs ml-1" size="sm" title="Delete trade" @click="clickRemoveBot(bot)">
<EditIcon :size="16" title="Delete trade" />
</b-button>
<b-button class="btn-xs ml-1" size="sm" title="Delete bot" @click="clickRemoveBot(bot)">
<DeleteIcon :size="16" title="Delete trade" />
</b-button>
</div>
<b-list-group>
<b-list-group-item
v-for="bot in allAvailableBots"
:key="bot"
button
:active="bot === selectedBot"
@click="selectBot(bot)"
>
{{ bot }}
<b-button class="btn-xs ml-1" size="sm" title="Delete trade" @click="clickRemoveBot(bot)">
<EditIcon :size="16" title="Delete trade" />
</b-button>
<b-button class="btn-xs ml-1" size="sm" title="Delete bot" @click="clickRemoveBot(bot)">
<DeleteIcon :size="16" title="Delete trade" />
</b-button>
</b-list-group-item>
</b-list-group>
<LoginModal class="mt-2" login-text="Add new bot" />
</div>
</template>
@ -26,10 +34,14 @@ const ftbot = namespace('ftbot');
@Component({ components: { LoginModal, DeleteIcon, EditIcon } })
export default class BotList extends Vue {
@ftbot.Getter [MultiBotStoreGetters.selectedBot]: string;
@ftbot.Getter [MultiBotStoreGetters.allAvailableBots]: string[];
@ftbot.Action removeBot;
@ftbot.Action selectBot;
clickRemoveBot(botId) {
//
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]);
}
},
selectBot({ commit }, botId: string) {
commit('selectBot', botId);
},
};
// Autocreate Actions
Object.keys(BotStoreActions).forEach((e) => {