From 7bed9eef12321e06bb143d96f02326d967e6f739 Mon Sep 17 00:00:00 2001 From: Ievgen Sobko Date: Tue, 2 Mar 2021 16:37:53 +0200 Subject: [PATCH] feat: improved per-torrent speed limits modal (#172) Co-authored-by: Ievgen Sobko --- src/components/Modals/SpeedLimitModal.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/Modals/SpeedLimitModal.vue b/src/components/Modals/SpeedLimitModal.vue index cb98cd4136..92366d8eff 100644 --- a/src/components/Modals/SpeedLimitModal.vue +++ b/src/components/Modals/SpeedLimitModal.vue @@ -23,6 +23,9 @@ :prepend-icon="mdiSpeedometer" suffix="KB/s" clearable + autofocus + @focus="$event.target.select()" + @keydown.enter="setLimit" /> @@ -80,24 +83,23 @@ export default { created() { switch (this.mode) { case 'download': - this.limit = this.torrent.dl_limit / 1024 + this.limit = this.torrent.dl_limit > 0 ? this.limit = this.torrent.dl_limit / 1024 : '∞' break case 'upload': - this.limit = this.torrent.up_limit / 1024 + this.limit = this.torrent.up_limit > 0 ? this.torrent.up_limit / 1024 : '∞' break default: break } - }, methods: { setLimit() { switch (this.mode) { case 'download': - qbit.setDownloadLimit([this.hash], this.limit * 1024 ?? -1) + qbit.setDownloadLimit([this.hash], this.limit > 0 ? this.limit * 1024 : NaN) break case 'upload': - qbit.setUploadLimit([this.hash], this.limit * 1024 ?? -1) + qbit.setUploadLimit([this.hash], this.limit > 0 ? this.limit * 1024 : NaN) break default: break