frequi_origin/src/components/BotList.vue

58 lines
1.7 KiB
Vue
Raw Normal View History

2021-08-29 08:29:53 +00:00
<template>
<div>
<h3>Available bots</h3>
2021-08-29 09:07:41 +00:00
<b-list-group>
<b-list-group-item
v-for="bot in allAvailableBots"
:key="bot.botId"
2021-08-29 09:07:41 +00:00
button
:active="bot.botId === selectedBot"
@click="selectBot(bot.botId)"
2021-08-29 09:07:41 +00:00
>
{{ bot.botName || bot.botId }}
2021-08-29 09:07:41 +00:00
<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>
2021-08-29 08:54:37 +00:00
<LoginModal class="mt-2" login-text="Add new bot" />
2021-08-29 08:29:53 +00:00
</div>
</template>
<script lang="ts">
import { Component, Vue } from 'vue-property-decorator';
import { namespace } from 'vuex-class';
import { MultiBotStoreGetters } from '@/store/modules/botStoreWrapper';
import LoginModal from '@/views/LoginModal.vue';
2021-08-29 08:54:37 +00:00
import EditIcon from 'vue-material-design-icons/Cog.vue';
import DeleteIcon from 'vue-material-design-icons/Delete.vue';
import { BotDescriptor, BotDescriptors } from '@/types';
2021-08-29 08:29:53 +00:00
const ftbot = namespace('ftbot');
2021-08-29 08:54:37 +00:00
@Component({ components: { LoginModal, DeleteIcon, EditIcon } })
2021-08-29 08:29:53 +00:00
export default class BotList extends Vue {
2021-08-29 09:07:41 +00:00
@ftbot.Getter [MultiBotStoreGetters.selectedBot]: string;
@ftbot.Getter [MultiBotStoreGetters.allAvailableBots]: BotDescriptors;
2021-08-29 08:29:53 +00:00
2021-08-29 08:54:37 +00:00
@ftbot.Action removeBot;
2021-08-29 09:07:41 +00:00
@ftbot.Action selectBot;
clickRemoveBot(botId: BotDescriptor) {
2021-08-29 08:29:53 +00:00
//
2021-08-29 08:54:37 +00:00
this.$bvModal.msgBoxConfirm(`Really remove (logout) from ${botId}?`).then((value: boolean) => {
if (value) {
this.removeBot(botId.botId);
2021-08-29 08:54:37 +00:00
}
});
2021-08-29 08:29:53 +00:00
}
}
</script>
<style scoped></style>