compositionApi: PairLockList

This commit is contained in:
Matthias 2022-04-15 20:20:14 +02:00
parent 68321bec28
commit bbf80305e1

View File

@ -23,47 +23,49 @@
<script lang="ts"> <script lang="ts">
import { timestampms } from '@/shared/formatters'; import { timestampms } from '@/shared/formatters';
import { BotStoreGetters } from '@/store/modules/ftbot';
import { Lock } from '@/types'; import { Lock } from '@/types';
import { Component, Vue } from 'vue-property-decorator';
import { namespace } from 'vuex-class';
import DeleteIcon from 'vue-material-design-icons/Delete.vue'; import DeleteIcon from 'vue-material-design-icons/Delete.vue';
import { showAlert } from '@/stores/alerts'; import { showAlert } from '@/stores/alerts';
import StoreModules from '@/store/storeSubModules'; import StoreModules from '@/store/storeSubModules';
import { defineComponent } from '@vue/composition-api';
import { useNamespacedActions, useNamespacedGetters } from 'vuex-composition-helpers';
const ftbot = namespace(StoreModules.ftbot); export default defineComponent({
name: 'PairLockList',
@Component({
components: { DeleteIcon }, components: { DeleteIcon },
}) setup() {
export default class PairLockList extends Vue { const { currentLocks } = useNamespacedGetters(StoreModules.ftbot, ['currentLocks']);
@ftbot.Action getLocks; const { getLocks, deleteLock } = useNamespacedActions(StoreModules.ftbot, [
'getLocks',
@ftbot.Getter [BotStoreGetters.currentLocks]!: Lock[]; 'deleteLock',
]);
// eslint-disable-next-line @typescript-eslint/no-unused-vars const tableFields = [
@ftbot.Action deleteLock!: (lockid: string) => Promise<string>;
timestampms = timestampms;
get tableFields() {
return [
{ key: 'pair', label: 'Pair' }, { key: 'pair', label: 'Pair' },
{ key: 'lock_end_timestamp', label: 'Until', formatter: 'timestampms' }, { key: 'lock_end_timestamp', label: 'Until', formatter: 'timestampms' },
{ key: 'reason', label: 'Reason' }, { key: 'reason', label: 'Reason' },
{ key: 'actions' }, { key: 'actions' },
]; ];
}
removePairLock(item: Lock) { const removePairLock = (item: Lock) => {
console.log(item); console.log(item);
if (item.id !== undefined) { if (item.id !== undefined) {
this.deleteLock(item.id); deleteLock(item.id);
} else { } else {
showAlert('This Freqtrade version does not support deleting locks.'); showAlert('This Freqtrade version does not support deleting locks.');
} }
} };
}
return {
timestampms,
tableFields,
removePairLock,
currentLocks,
getLocks,
deleteLock,
};
},
});
</script> </script>
<style scoped></style> <style scoped></style>