frequi_origin/src/components/BotList.vue

45 lines
1.3 KiB
Vue
Raw Normal View History

2021-08-29 08:29:53 +00:00
<template>
<div>
2021-08-29 18:17:34 +00:00
<h3 v-if="!small">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"
:active="bot.botId === selectedBot"
button
2021-08-29 11:59:39 +00:00
:title="`${bot.botId} - ${bot.botName} - ${bot.botUrl}`"
@click="selectBot(bot.botId)"
2021-08-29 09:07:41 +00:00
>
2021-08-29 18:17:34 +00:00
<bot-entry :bot="bot" :no-buttons="small" />
2021-08-29 09:07:41 +00:00
</b-list-group-item>
</b-list-group>
2021-08-29 18:17:34 +00:00
<LoginModal v-if="!small" class="mt-2" login-text="Add new bot" />
2021-08-29 08:29:53 +00:00
</div>
</template>
<script lang="ts">
2021-08-29 18:17:34 +00:00
import { Component, Prop, Vue } from 'vue-property-decorator';
2021-08-29 08:29:53 +00:00
import { namespace } from 'vuex-class';
import { MultiBotStoreGetters } from '@/store/modules/botStoreWrapper';
import LoginModal from '@/views/LoginModal.vue';
2021-08-29 18:17:34 +00:00
import BotEntry from '@/components/BotEntry.vue';
import { BotDescriptors } from '@/types';
2021-08-29 08:29:53 +00:00
const ftbot = namespace('ftbot');
2021-08-29 18:17:34 +00:00
@Component({ components: { LoginModal, BotEntry } })
2021-08-29 08:29:53 +00:00
export default class BotList extends Vue {
2021-08-29 18:17:34 +00:00
@Prop({ default: false, type: Boolean }) small!: boolean;
2021-08-29 09:07:41 +00:00
@ftbot.Getter [MultiBotStoreGetters.selectedBot]: string;
2021-09-04 08:35:00 +00:00
@ftbot.Getter [MultiBotStoreGetters.allIsBotOnline]: Record<string, boolean>;
2021-08-29 12:08:32 +00:00
@ftbot.Getter [MultiBotStoreGetters.allAvailableBots]: BotDescriptors;
2021-08-29 08:29:53 +00:00
2021-08-29 09:07:41 +00:00
@ftbot.Action selectBot;
2021-08-29 08:29:53 +00:00
}
</script>
<style scoped></style>