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">{{
|
2022-04-21 18:18:28 +00:00
|
|
|
botStore.botStores[bot.botId].isBotOnline ? '🟢' : '🔴'
|
2021-08-29 18:17:34 +00:00
|
|
|
}}</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">
|
2022-03-10 07:57:06 +00:00
|
|
|
<b-button class="ml-1" size="sm" title="Delete bot" @click="$emit('edit')">
|
|
|
|
<EditIcon :size="16" />
|
|
|
|
</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">
|
2022-03-10 07:57:06 +00:00
|
|
|
import EditIcon from 'vue-material-design-icons/Pencil.vue';
|
2021-08-29 18:17:34 +00:00
|
|
|
import DeleteIcon from 'vue-material-design-icons/Delete.vue';
|
2022-04-16 05:18:40 +00:00
|
|
|
import { BotDescriptor } from '@/types';
|
|
|
|
import { defineComponent, computed } from '@vue/composition-api';
|
2022-04-18 11:21:53 +00:00
|
|
|
import { useBotStore } from '@/stores/ftbotwrapper';
|
2021-08-29 18:17:34 +00:00
|
|
|
|
2022-04-16 05:18:40 +00:00
|
|
|
export default defineComponent({
|
|
|
|
name: 'BotEntry',
|
2022-03-10 07:57:06 +00:00
|
|
|
components: {
|
|
|
|
DeleteIcon,
|
|
|
|
EditIcon,
|
|
|
|
},
|
2022-04-16 05:18:40 +00:00
|
|
|
props: {
|
|
|
|
bot: { required: true, type: Object },
|
|
|
|
noButtons: { default: false, type: Boolean },
|
|
|
|
},
|
|
|
|
emits: ['edit'],
|
|
|
|
setup(props, { root }) {
|
2022-04-18 11:21:53 +00:00
|
|
|
const botStore = useBotStore();
|
2021-08-31 18:45:35 +00:00
|
|
|
|
2022-04-16 05:18:40 +00:00
|
|
|
const changeEvent = (v) => {
|
2022-04-18 11:21:53 +00:00
|
|
|
botStore.botStores[props.bot.botId].setAutoRefresh(v);
|
2022-04-16 05:18:40 +00:00
|
|
|
};
|
2021-08-31 18:45:35 +00:00
|
|
|
|
2022-04-16 05:18:40 +00:00
|
|
|
const clickRemoveBot = (bot: BotDescriptor) => {
|
|
|
|
//
|
|
|
|
root.$bvModal
|
|
|
|
.msgBoxConfirm(`Really remove (logout) from '${bot.botName}' (${bot.botId})?`)
|
|
|
|
.then((value: boolean) => {
|
|
|
|
if (value) {
|
2022-04-18 11:21:53 +00:00
|
|
|
botStore.removeBot(bot.botId);
|
2022-04-16 05:18:40 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
const autoRefreshLoc = computed({
|
|
|
|
get() {
|
2022-04-18 11:21:53 +00:00
|
|
|
return botStore.botStores[props.bot.botId].autoRefresh;
|
2022-04-16 05:18:40 +00:00
|
|
|
},
|
2022-04-21 04:37:57 +00:00
|
|
|
set() {
|
2022-04-16 05:18:40 +00:00
|
|
|
// pass
|
|
|
|
},
|
|
|
|
});
|
2021-08-31 18:45:35 +00:00
|
|
|
|
2022-04-16 05:18:40 +00:00
|
|
|
return {
|
2022-04-18 11:21:53 +00:00
|
|
|
botStore,
|
2022-04-16 05:18:40 +00:00
|
|
|
changeEvent,
|
|
|
|
clickRemoveBot,
|
|
|
|
autoRefreshLoc,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|
2021-08-29 18:17:34 +00:00
|
|
|
</script>
|