fix: when cleaning the queue, removing only downloads without errors
This commit is contained in:
parent
3a58636d36
commit
5456785f20
File diff suppressed because one or more lines are too long
@ -121,7 +121,7 @@ import QueueItem from '@components/downloads/QueueItem.vue'
|
|||||||
|
|
||||||
import { socket } from '@/utils/socket'
|
import { socket } from '@/utils/socket'
|
||||||
import { toast } from '@/utils/toasts'
|
import { toast } from '@/utils/toasts'
|
||||||
import { fetchData, sendToServer } from '@/utils/api'
|
import { fetchData } from '@/utils/api'
|
||||||
|
|
||||||
const tabMinWidth = 250
|
const tabMinWidth = 250
|
||||||
const tabMaxWidth = 500
|
const tabMaxWidth = 500
|
||||||
@ -143,7 +143,12 @@ export default {
|
|||||||
...mapGetters({
|
...mapGetters({
|
||||||
clientMode: 'getClientMode',
|
clientMode: 'getClientMode',
|
||||||
isSlim: 'getSlimDownloads'
|
isSlim: 'getSlimDownloads'
|
||||||
})
|
}),
|
||||||
|
finishedWithoutErrors() {
|
||||||
|
const isCompletedWithoutErrors = el => el.errors.length === 0
|
||||||
|
|
||||||
|
return Object.values(this.queueList).filter(isCompletedWithoutErrors)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
const checkIfToggleBar = keyEvent => {
|
const checkIfToggleBar = keyEvent => {
|
||||||
@ -170,10 +175,7 @@ export default {
|
|||||||
socket.on('removedFinishedDownloads', this.removedFinishedDownloads)
|
socket.on('removedFinishedDownloads', this.removedFinishedDownloads)
|
||||||
|
|
||||||
fetchData('getQueue')
|
fetchData('getQueue')
|
||||||
// fetch('connect')
|
|
||||||
// .then(res => res.json())
|
|
||||||
.then(res => {
|
.then(res => {
|
||||||
console.log(res)
|
|
||||||
this.initQueue(res)
|
this.initQueue(res)
|
||||||
})
|
})
|
||||||
.catch(console.error)
|
.catch(console.error)
|
||||||
@ -349,6 +351,9 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
removedFinishedDownloads() {
|
removedFinishedDownloads() {
|
||||||
|
// TODO: Make this a computed property
|
||||||
|
this.queueComplete = this.finishedWithoutErrors.map(el => el.uuid)
|
||||||
|
|
||||||
this.queueComplete.forEach(uuid => {
|
this.queueComplete.forEach(uuid => {
|
||||||
this.$delete(this.queueList, uuid)
|
this.$delete(this.queueList, uuid)
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user