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

View File

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