2021-08-29 18:17:34 +00:00
|
|
|
<template>
|
2021-08-30 05:12:46 +00:00
|
|
|
<div class="d-flex align-items-center justify-content-between w-100">
|
2021-08-29 18:17:34 +00:00
|
|
|
<span class="mr-2">{{ bot.botName || bot.botId }}</span>
|
|
|
|
|
2021-09-01 04:49:03 +00:00
|
|
|
<div class="align-items-center d-flex">
|
2021-10-24 17:46:03 +00:00
|
|
|
<span class="ml-2 mr-1 align-middle">{{
|
2021-08-29 18:17:34 +00:00
|
|
|
allIsBotOnline[bot.botId] ? '🟢' : '🔴'
|
|
|
|
}}</span>
|
2021-08-31 18:45:35 +00:00
|
|
|
<b-form-checkbox
|
|
|
|
v-model="autoRefreshLoc"
|
|
|
|
class="ml-auto float-right mr-2 my-auto"
|
|
|
|
title="AutoRefresh"
|
|
|
|
variant="secondary"
|
|
|
|
@change="changeEvent"
|
|
|
|
>
|
|
|
|
R
|
|
|
|
</b-form-checkbox>
|
2021-08-29 18:17:34 +00:00
|
|
|
<div v-if="!noButtons" class="d-flex flex-align-cent">
|
2021-10-05 04:30:17 +00:00
|
|
|
<!-- <b-button class="ml-1" size="sm" title="Edit bot">
|
2021-08-29 18:17:34 +00:00
|
|
|
<EditIcon :size="16" title="Edit Button" />
|
2021-10-05 04:30:17 +00:00
|
|
|
</b-button> -->
|
2021-08-29 18:17:34 +00:00
|
|
|
<b-button class="ml-1" size="sm" title="Delete bot" @click.prevent="clickRemoveBot(bot)">
|
|
|
|
<DeleteIcon :size="16" title="Delete Bot" />
|
|
|
|
</b-button>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import { Component, Prop, Vue } from 'vue-property-decorator';
|
|
|
|
import { namespace } from 'vuex-class';
|
|
|
|
import { MultiBotStoreGetters } from '@/store/modules/botStoreWrapper';
|
|
|
|
import LoginModal from '@/views/LoginModal.vue';
|
|
|
|
import EditIcon from 'vue-material-design-icons/Cog.vue';
|
|
|
|
import DeleteIcon from 'vue-material-design-icons/Delete.vue';
|
|
|
|
import { BotDescriptor, BotDescriptors } from '@/types';
|
|
|
|
|
|
|
|
const ftbot = namespace('ftbot');
|
|
|
|
|
|
|
|
@Component({ components: { LoginModal, DeleteIcon, EditIcon } })
|
|
|
|
export default class BotList extends Vue {
|
|
|
|
@Prop({ default: false, type: Object }) bot!: BotDescriptor;
|
|
|
|
|
|
|
|
@Prop({ default: false, type: Boolean }) noButtons!: boolean;
|
|
|
|
|
|
|
|
@ftbot.Getter [MultiBotStoreGetters.allIsBotOnline];
|
|
|
|
|
2021-08-31 18:45:35 +00:00
|
|
|
@ftbot.Getter [MultiBotStoreGetters.allAutoRefresh];
|
|
|
|
|
2021-08-29 18:17:34 +00:00
|
|
|
@ftbot.Getter [MultiBotStoreGetters.allAvailableBots]: BotDescriptors;
|
|
|
|
|
|
|
|
@ftbot.Action removeBot;
|
|
|
|
|
|
|
|
@ftbot.Action selectBot;
|
|
|
|
|
2021-08-31 18:45:35 +00:00
|
|
|
get autoRefreshLoc() {
|
|
|
|
return this.allAutoRefresh[this.bot.botId];
|
|
|
|
}
|
|
|
|
|
|
|
|
set autoRefreshLoc(v) {
|
2021-09-01 04:49:03 +00:00
|
|
|
// Dummy setter - Set via change event to avoid bouncing
|
2021-08-31 18:45:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
changeEvent(v) {
|
|
|
|
this.$store.dispatch(`ftbot/${this.bot.botId}/setAutoRefresh`, v);
|
|
|
|
}
|
|
|
|
|
2021-08-29 18:33:48 +00:00
|
|
|
clickRemoveBot(bot: BotDescriptor) {
|
2021-08-29 18:17:34 +00:00
|
|
|
//
|
2021-08-29 18:33:48 +00:00
|
|
|
this.$bvModal
|
|
|
|
.msgBoxConfirm(`Really remove (logout) from '${bot.botName}' (${bot.botId})?`)
|
|
|
|
.then((value: boolean) => {
|
|
|
|
if (value) {
|
|
|
|
this.removeBot(bot.botId);
|
|
|
|
}
|
|
|
|
});
|
2021-08-29 18:17:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped></style>
|