Botentry -> script setup

This commit is contained in:
Matthias 2023-05-06 15:33:29 +02:00
parent 60620a8103
commit f9ea16973c

View File

@ -54,60 +54,40 @@
</div> </div>
</template> </template>
<script lang="ts"> <script setup lang="ts">
import EditIcon from 'vue-material-design-icons/Pencil.vue'; import EditIcon from 'vue-material-design-icons/Pencil.vue';
import LoginIcon from 'vue-material-design-icons/Login.vue'; import LoginIcon from 'vue-material-design-icons/Login.vue';
import DeleteIcon from 'vue-material-design-icons/Delete.vue'; import DeleteIcon from 'vue-material-design-icons/Delete.vue';
import OnlineIcon from 'vue-material-design-icons/Circle.vue'; import OnlineIcon from 'vue-material-design-icons/Circle.vue';
import LoggedOutIcon from 'vue-material-design-icons/Cancel.vue'; import LoggedOutIcon from 'vue-material-design-icons/Cancel.vue';
import { BotDescriptor } from '@/types'; import { BotDescriptor } from '@/types';
import { defineComponent, computed, ref } from 'vue'; import { computed, ref } from 'vue';
import { useBotStore } from '@/stores/ftbotwrapper'; import { useBotStore } from '@/stores/ftbotwrapper';
export default defineComponent({ const props = defineProps({
name: 'BotEntry',
components: {
DeleteIcon,
EditIcon,
LoginIcon,
OnlineIcon,
LoggedOutIcon,
},
props: {
bot: { required: true, type: Object as () => BotDescriptor }, bot: { required: true, type: Object as () => BotDescriptor },
noButtons: { default: false, type: Boolean }, noButtons: { default: false, type: Boolean },
}, });
emits: ['edit', 'editLogin'], defineEmits(['edit', 'editLogin']);
setup(props) { const botStore = useBotStore();
const botStore = useBotStore();
const changeEvent = (v) => { const changeEvent = (v) => {
botStore.botStores[props.bot.botId].setAutoRefresh(v); botStore.botStores[props.bot.botId].setAutoRefresh(v);
}; };
const botRemoveModalVisible = ref(false); const botRemoveModalVisible = ref(false);
const confirmRemoveBot = () => { const confirmRemoveBot = () => {
botRemoveModalVisible.value = false; botRemoveModalVisible.value = false;
botStore.removeBot(props.bot.botId); botStore.removeBot(props.bot.botId);
console.log('removing bot.'); console.log('removing bot.');
}; };
const autoRefreshLoc = computed({ const autoRefreshLoc = computed({
get() { get() {
return botStore.botStores[props.bot.botId].autoRefresh; return botStore.botStores[props.bot.botId].autoRefresh;
}, },
set() { set() {
// pass // pass
}, },
});
return {
botStore,
changeEvent,
autoRefreshLoc,
confirmRemoveBot,
botRemoveModalVisible,
};
},
}); });
</script> </script>