frequi_origin/src/components/BotList.vue

57 lines
1.6 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"
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>
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';
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;
2021-08-29 08:29:53 +00:00
@ftbot.Getter [MultiBotStoreGetters.allAvailableBots]: string[];
2021-08-29 08:54:37 +00:00
@ftbot.Action removeBot;
2021-08-29 09:07:41 +00:00
@ftbot.Action selectBot;
2021-08-29 08:54:37 +00:00
clickRemoveBot(botId) {
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);
}
});
2021-08-29 08:29:53 +00:00
}
}
</script>
<style scoped></style>