2022-03-10 07:57:06 +00:00
|
|
|
<template>
|
|
|
|
<form class="d-flex" @submit.prevent="save">
|
|
|
|
<b-form-input
|
|
|
|
v-model="newName"
|
|
|
|
size="sm"
|
|
|
|
class="w-100"
|
|
|
|
placeholder="Bot name"
|
|
|
|
style="border-style: solid; border-width: 1px"
|
|
|
|
autofocus
|
|
|
|
/>
|
|
|
|
|
2022-11-18 18:48:15 +00:00
|
|
|
<div class="d-flex ms-2">
|
2022-03-10 07:57:06 +00:00
|
|
|
<b-button type="submit" size="sm" title="Save">
|
|
|
|
<CheckIcon :size="16" />
|
|
|
|
</b-button>
|
|
|
|
|
2022-11-18 18:48:15 +00:00
|
|
|
<b-button class="ms-1" size="sm" title="Cancel" @click="$emit('cancelled')">
|
2022-03-10 07:57:06 +00:00
|
|
|
<CloseIcon :size="16" />
|
|
|
|
</b-button>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import CheckIcon from 'vue-material-design-icons/Check.vue';
|
|
|
|
import CloseIcon from 'vue-material-design-icons/Close.vue';
|
2022-04-15 17:35:14 +00:00
|
|
|
import { BotDescriptor } from '@/types';
|
2022-07-07 18:44:19 +00:00
|
|
|
import { defineComponent, ref } from 'vue';
|
2022-04-18 11:21:53 +00:00
|
|
|
import { useBotStore } from '@/stores/ftbotwrapper';
|
2022-03-10 07:57:06 +00:00
|
|
|
|
2022-04-15 17:35:14 +00:00
|
|
|
export default defineComponent({
|
|
|
|
name: 'BotRename',
|
2022-03-10 07:57:06 +00:00
|
|
|
components: {
|
|
|
|
CheckIcon,
|
|
|
|
CloseIcon,
|
|
|
|
},
|
2022-04-15 17:35:14 +00:00
|
|
|
props: {
|
|
|
|
bot: { type: Object as () => BotDescriptor, required: true },
|
|
|
|
},
|
2022-07-07 18:44:19 +00:00
|
|
|
emits: ['cancelled', 'saved'],
|
2022-04-15 17:35:14 +00:00
|
|
|
setup(props, { emit }) {
|
2022-04-18 11:21:53 +00:00
|
|
|
const botStore = useBotStore();
|
|
|
|
|
2022-04-15 17:35:14 +00:00
|
|
|
const newName = ref<string>(props.bot.botName);
|
|
|
|
|
|
|
|
const save = () => {
|
2022-04-18 11:21:53 +00:00
|
|
|
botStore.renameBot({
|
2022-04-15 17:35:14 +00:00
|
|
|
botId: props.bot.botId,
|
|
|
|
botName: newName.value,
|
|
|
|
});
|
|
|
|
|
|
|
|
emit('saved');
|
|
|
|
};
|
|
|
|
return {
|
|
|
|
newName,
|
|
|
|
save,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
});
|
2022-03-10 07:57:06 +00:00
|
|
|
</script>
|