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> <template>
<div> <div>
<h3>Available bots</h3> <h3>Available bots</h3>
<div v-for="bot in allAvailableBots" :key="bot"> <b-list-group>
{{ bot }} <b-list-group-item
<b-button class="btn-xs ml-1" size="sm" title="Delete trade" @click="clickRemoveBot(bot)"> v-for="bot in allAvailableBots"
<EditIcon :size="16" title="Delete trade" /> :key="bot"
</b-button> button
<b-button class="btn-xs ml-1" size="sm" title="Delete bot" @click="clickRemoveBot(bot)"> :active="bot === selectedBot"
<DeleteIcon :size="16" title="Delete trade" /> @click="selectBot(bot)"
</b-button> >
</div> {{ 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" /> <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) => {