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">
|
2023-05-09 16:16:58 +00:00
|
|
|
<i-mdi-check />
|
2022-03-10 07:57:06 +00:00
|
|
|
</b-button>
|
|
|
|
|
2022-11-18 18:48:15 +00:00
|
|
|
<b-button class="ms-1" size="sm" title="Cancel" @click="$emit('cancelled')">
|
2023-05-09 16:16:58 +00:00
|
|
|
<i-mdi-close />
|
2022-03-10 07:57:06 +00:00
|
|
|
</b-button>
|
|
|
|
</div>
|
|
|
|
</form>
|
|
|
|
</template>
|
|
|
|
|
2023-05-09 16:17:34 +00:00
|
|
|
<script setup lang="ts">
|
2023-05-09 04:49:13 +00:00
|
|
|
import { useBotStore } from '@/stores/ftbotwrapper';
|
2022-04-15 17:35:14 +00:00
|
|
|
import { BotDescriptor } from '@/types';
|
2023-05-09 16:17:34 +00:00
|
|
|
import { ref } from 'vue';
|
2022-03-10 07:57:06 +00:00
|
|
|
|
2023-05-09 16:17:34 +00:00
|
|
|
const props = defineProps({
|
|
|
|
bot: { type: Object as () => BotDescriptor, required: true },
|
|
|
|
});
|
|
|
|
const emit = defineEmits(['cancelled', 'saved']);
|
|
|
|
const botStore = useBotStore();
|
2022-04-18 11:21:53 +00:00
|
|
|
|
2023-05-09 16:17:34 +00:00
|
|
|
const newName = ref<string>(props.bot.botName);
|
2022-04-15 17:35:14 +00:00
|
|
|
|
2023-05-09 16:17:34 +00:00
|
|
|
const save = () => {
|
|
|
|
botStore.updateBot(props.bot.botId, {
|
|
|
|
botName: newName.value,
|
|
|
|
});
|
2022-04-15 17:35:14 +00:00
|
|
|
|
2023-05-09 16:17:34 +00:00
|
|
|
emit('saved');
|
|
|
|
};
|
2022-03-10 07:57:06 +00:00
|
|
|
</script>
|