Fixing download queue

This commit is contained in:
RemixDev 2020-04-14 11:40:03 +02:00
parent 5521ca864c
commit 5e7e53c30a
2 changed files with 28 additions and 20 deletions

View File

@ -260,10 +260,12 @@ div#download_tab{
}
#download_list > .download_object .download_info_data{
width: 100%;
padding-left: 8px;
margin-left: 8px;
}
#download_list > .download_object .download_info_status{
margin-left: 8px;
width: 80px;
text-align: right;
}
#download_list.slim > .download_object .download_info img{
display: none;
@ -275,12 +277,12 @@ div#download_tab{
display: inline-block;
}
#download_list.slim > .download_object .download_info_data{
width: auto;
width: calc(80% - 8px);
display: inline-block;
padding-left: 0px;
}
#download_list.slim > .download_object .download_info_status{
width: auto;
width: 20%;
display: inline-block;
float: right;
}
@ -288,6 +290,10 @@ div#download_tab{
display: block;
}
.download_object > .download_bar > .queue_icon{
margin-left: 8px;
}
.download_object > .download_bar{
display: flex;
align-items: center;

View File

@ -58,23 +58,25 @@ socket.on("startDownload", function(uuid){
})
socket.on("finishDownload", function(uuid){
toast(`${queueList[uuid].title} finished downloading.`, 'done')
$('#bar_' + uuid).css('width', '100%')
let result_icon = $('#download_'+uuid).find('.queue_icon')
if (queueList[uuid].failed == 0){
result_icon.text("done")
}else if (queueList[uuid].failed >= queueList[uuid].size){
result_icon.text("error")
}else{
result_icon.text("warning")
}
let index = queue.indexOf(uuid)
if (index > -1){
queue.splice(index, 1)
delete queueList[uuid]
}
if (queue.length <= 0){
toast('All downloads completed!', 'all_done')
if (queue.indexOf(uuid) > -1){
toast(`${queueList[uuid].title} finished downloading.`, 'done')
$('#bar_' + uuid).css('width', '100%')
let result_icon = $('#download_'+uuid).find('.queue_icon')
if (queueList[uuid].failed == 0){
result_icon.text("done")
}else if (queueList[uuid].failed >= queueList[uuid].size){
result_icon.text("error")
}else{
result_icon.text("warning")
}
let index = queue.indexOf(uuid)
if (index > -1){
queue.splice(index, 1)
delete queueList[uuid]
}
if (queue.length <= 0){
toast('All downloads completed!', 'all_done')
}
}
})