mirror of
https://github.com/freqtrade/frequi.git
synced 2024-11-26 21:15:15 +00:00
composition: BotList
This commit is contained in:
parent
090cc3ec5e
commit
80f01ed91a
|
@ -22,36 +22,39 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Prop, Vue } from 'vue-property-decorator';
|
|
||||||
import { namespace } from 'vuex-class';
|
|
||||||
import CheckIcon from 'vue-material-design-icons/Check.vue';
|
import CheckIcon from 'vue-material-design-icons/Check.vue';
|
||||||
import CloseIcon from 'vue-material-design-icons/Close.vue';
|
import CloseIcon from 'vue-material-design-icons/Close.vue';
|
||||||
import { BotDescriptor, RenameBotPayload } from '@/types';
|
import { BotDescriptor } from '@/types';
|
||||||
import StoreModules from '@/store/storeSubModules';
|
import StoreModules from '@/store/storeSubModules';
|
||||||
|
import { defineComponent, ref } from '@vue/composition-api';
|
||||||
|
import { useNamespacedActions } from 'vuex-composition-helpers';
|
||||||
|
|
||||||
const ftbot = namespace(StoreModules.ftbot);
|
export default defineComponent({
|
||||||
|
name: 'BotRename',
|
||||||
@Component({
|
|
||||||
components: {
|
components: {
|
||||||
CheckIcon,
|
CheckIcon,
|
||||||
CloseIcon,
|
CloseIcon,
|
||||||
},
|
},
|
||||||
})
|
props: {
|
||||||
export default class BotList extends Vue {
|
bot: { type: Object as () => BotDescriptor, required: true },
|
||||||
@Prop({ required: true, type: Object }) bot!: BotDescriptor;
|
},
|
||||||
|
emits: ['saved'],
|
||||||
|
setup(props, { emit }) {
|
||||||
|
const { renameBot } = useNamespacedActions(StoreModules.ftbot, ['renameBot']);
|
||||||
|
const newName = ref<string>(props.bot.botName);
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
const save = () => {
|
||||||
@ftbot.Action renameBot!: (payload: RenameBotPayload) => Promise<void>;
|
renameBot({
|
||||||
|
botId: props.bot.botId,
|
||||||
|
botName: newName.value,
|
||||||
|
});
|
||||||
|
|
||||||
newName: string = this.bot.botName;
|
emit('saved');
|
||||||
|
};
|
||||||
save() {
|
return {
|
||||||
this.renameBot({
|
newName,
|
||||||
botId: this.bot.botId,
|
save,
|
||||||
botName: this.newName,
|
};
|
||||||
});
|
},
|
||||||
|
});
|
||||||
this.$emit('saved');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user