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"
|
2021-08-29 11:54:45 +00:00
|
|
|
:key="bot.botId"
|
2021-08-29 09:07:41 +00:00
|
|
|
button
|
2021-08-29 11:54:45 +00:00
|
|
|
:active="bot.botId === selectedBot"
|
2021-08-29 11:59:39 +00:00
|
|
|
:title="`${bot.botId} - ${bot.botName} - ${bot.botUrl}`"
|
2021-08-29 11:54:45 +00:00
|
|
|
@click="selectBot(bot.botId)"
|
2021-08-29 09:07:41 +00:00
|
|
|
>
|
2021-08-29 11:54:45 +00:00
|
|
|
{{ bot.botName || bot.botId }}
|
2021-08-29 12:18:56 +00:00
|
|
|
{{ allIsBotOnline[bot.botId] ? 'Online' : 'Offline' }}
|
|
|
|
|
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';
|
2021-08-29 11:54:45 +00:00
|
|
|
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;
|
|
|
|
|
2021-08-29 12:08:32 +00:00
|
|
|
@ftbot.Getter [MultiBotStoreGetters.allIsBotOnline];
|
|
|
|
|
2021-08-29 11:54:45 +00:00
|
|
|
@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;
|
|
|
|
|
2021-08-29 11:54:45 +00:00
|
|
|
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) {
|
2021-08-29 11:54:45 +00:00
|
|
|
this.removeBot(botId.botId);
|
2021-08-29 08:54:37 +00:00
|
|
|
}
|
|
|
|
});
|
2021-08-29 08:29:53 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped></style>
|