fix(TRC): Use all selected torrents for transfer limits (#1329)

This commit is contained in:
Rémi Marseault 2023-11-20 08:53:02 +01:00 committed by GitHub
parent 179af5a1d6
commit 3614081f19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 14 deletions

View file

@ -94,15 +94,15 @@ async function copyValue(valueToCopy: string) {
}
function setDownloadLimit() {
dialogStore.createDialog(SpeedLimitDialog, { hash: hash.value, mode: 'download' })
dialogStore.createDialog(SpeedLimitDialog, { hashes: hashes.value, mode: 'download' })
}
function setUploadLimit() {
dialogStore.createDialog(SpeedLimitDialog, { hash: hash.value, mode: 'upload' })
dialogStore.createDialog(SpeedLimitDialog, { hashes: hashes.value, mode: 'upload' })
}
function setShareLimit() {
dialogStore.createDialog(ShareLimitDialog, { hash: hash.value })
dialogStore.createDialog(ShareLimitDialog, { hashes: hashes.value })
}
async function exportTorrents() {

View file

@ -9,7 +9,7 @@ const DISABLED = -1
const props = defineProps<{
guid: string
hash: string
hashes: string[]
}>()
const { isOpened } = useDialog(props.guid)
@ -38,13 +38,13 @@ function close() {
async function submit() {
switch (shareType.value) {
case 'global':
await maindataStore.setShareLimit([props.hash], GLOBAL, GLOBAL, GLOBAL)
await maindataStore.setShareLimit(props.hashes, GLOBAL, GLOBAL, GLOBAL)
break
case 'disabled':
await maindataStore.setShareLimit([props.hash], DISABLED, DISABLED, DISABLED)
await maindataStore.setShareLimit(props.hashes, DISABLED, DISABLED, DISABLED)
break
case 'enabled':
await maindataStore.setShareLimit([props.hash],
await maindataStore.setShareLimit(props.hashes,
ratioLimitEnabled.value ? ratioLimit.value : DISABLED,
seedingTimeLimitEnabled.value ? seedingTimeLimit.value : DISABLED,
inactiveSeedingTimeLimitEnabled.value ? inactiveSeedingTimeLimit.value : DISABLED)
@ -54,7 +54,7 @@ async function submit() {
}
onBeforeMount(async () => {
const torrent = torrentStore.getTorrentByHash(props.hash)
const torrent = torrentStore.getTorrentByHash(props.hashes[0])
if (!torrent) {
return close()
}
@ -131,4 +131,4 @@ onBeforeMount(async () => {
<style scoped>
</style>
</style>

View file

@ -5,7 +5,7 @@ import { onBeforeMount, ref } from 'vue'
const props = defineProps<{
guid: string
hash: string
hashes: string[]
mode: 'download' | 'upload'
}>()
@ -24,17 +24,17 @@ async function submit() {
const formattedValue = Math.max(0, value.value) * 1000
switch (props.mode) {
case 'download':
await maindataStore.setDownloadLimit(formattedValue, [props.hash])
await maindataStore.setDownloadLimit(formattedValue, props.hashes)
break
case 'upload':
await maindataStore.setUploadLimit(formattedValue, [props.hash])
await maindataStore.setUploadLimit(formattedValue, props.hashes)
break
}
close()
}
onBeforeMount(async () => {
const torrent = torrentStore.getTorrentByHash(props.hash)
const torrent = torrentStore.getTorrentByHash(props.hashes[0])
if (!torrent) {
return close()
}
@ -76,4 +76,4 @@ onBeforeMount(async () => {
<style scoped>
</style>
</style>