2022-03-10 07:57:06 +00:00
|
|
|
<template>
|
|
|
|
<form class="d-flex" @submit.prevent="save">
|
2024-07-05 10:34:14 +00:00
|
|
|
<BFormInput
|
2022-03-10 07:57:06 +00:00
|
|
|
v-model="newName"
|
|
|
|
size="sm"
|
|
|
|
class="w-100"
|
|
|
|
placeholder="Bot name"
|
|
|
|
style="border-style: solid; border-width: 1px"
|
|
|
|
autofocus
|
|
|
|
/>
|
|
|
|
|
2024-01-31 17:14:55 +00:00
|
|
|
<div class="d-flex ms-2 no-min-w">
|
2024-07-05 10:34:14 +00:00
|
|
|
<BButton type="submit" size="sm" title="Save" class="no-min-w">
|
2023-05-09 16:16:58 +00:00
|
|
|
<i-mdi-check />
|
2024-07-05 10:34:14 +00:00
|
|
|
</BButton>
|
2022-03-10 07:57:06 +00:00
|
|
|
|
2024-07-05 10:34:14 +00:00
|
|
|
<BButton class="ms-1 no-min-w" size="sm" title="Cancel" @click="$emit('cancelled')">
|
2023-05-09 16:16:58 +00:00
|
|
|
<i-mdi-close />
|
2024-07-05 10:34:14 +00:00
|
|
|
</BButton>
|
2022-03-10 07:57:06 +00:00
|
|
|
</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';
|
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();
|
2023-08-02 05:14:40 +00:00
|
|
|
const newName = ref<string>('');
|
2022-04-18 11:21:53 +00:00
|
|
|
|
2023-08-02 05:14:40 +00:00
|
|
|
onMounted(() => {
|
|
|
|
newName.value = 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>
|