Improved error handling
This commit is contained in:
parent
b19c472709
commit
e9f1c21406
@ -119,3 +119,14 @@
|
|||||||
.upload_message .rows .row a.status.success {
|
.upload_message .rows .row a.status.success {
|
||||||
color: rgb(42, 213, 0);
|
color: rgb(42, 213, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.upload_message .rows .row p.notice {
|
||||||
|
display: none;
|
||||||
|
float: left;
|
||||||
|
padding: 2px 10px 5px;
|
||||||
|
width: calc(100% - 20px);
|
||||||
|
color: rgba(255,255,255,.5);
|
||||||
|
font-size: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
line-height: 16px;
|
||||||
|
}
|
@ -220,22 +220,15 @@ build = {
|
|||||||
|
|
||||||
if (files[i].name.length>40) files[i].name = files[i].name.substr(0, 17) + "..." + files[i].name.substr(files[i].name.length-20, 20);
|
if (files[i].name.length>40) files[i].name = files[i].name.substr(0, 17) + "..." + files[i].name.substr(files[i].name.length-20, 20);
|
||||||
|
|
||||||
if (files[i].supported===true) {
|
modal += "<div class='row'>";
|
||||||
|
modal += "<a class='name'>" + lychee.escapeHTML(files[i].name) + "</a>";
|
||||||
|
|
||||||
modal += "<div class='row'>"
|
if (files[i].supported===true) modal += "<a class='status'></a>";
|
||||||
modal += "<a class='name'>" + lychee.escapeHTML(files[i].name) + "</a>"
|
else modal += "<a class='status error'>Not supported</a>";
|
||||||
modal += "<a class='status'></a>"
|
|
||||||
|
modal += "<p class='notice'></p>";
|
||||||
modal += "</div>";
|
modal += "</div>";
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
modal += "<div class='row'>"
|
|
||||||
modal += "<a class='name'>" + lychee.escapeHTML(files[i].name) + "</a>"
|
|
||||||
modal += "<a class='status error'>Not supported</a>"
|
|
||||||
modal += "</div>";
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
modal += "</div>";
|
modal += "</div>";
|
||||||
|
@ -69,6 +69,7 @@ upload = {
|
|||||||
$("#upload_files").val("");
|
$("#upload_files").val("");
|
||||||
|
|
||||||
upload.close();
|
upload.close();
|
||||||
|
upload.notify("Upload complete");
|
||||||
|
|
||||||
if (album.getID()===false) lychee.goto("0");
|
if (album.getID()===false) lychee.goto("0");
|
||||||
else album.load(albumID);
|
else album.load(albumID);
|
||||||
@ -112,18 +113,29 @@ upload = {
|
|||||||
|
|
||||||
xhr.onload = function() {
|
xhr.onload = function() {
|
||||||
|
|
||||||
// On success
|
var wait = false;
|
||||||
if (xhr.status===200) {
|
|
||||||
|
|
||||||
var wait;
|
file.ready = true;
|
||||||
|
|
||||||
// Set status to finished
|
// Set status
|
||||||
|
if (xhr.status===200&&xhr.responseText==="1") {
|
||||||
|
|
||||||
|
// Success
|
||||||
$(".upload_message .rows .row:nth-child(" + (file.num+1) + ") .status")
|
$(".upload_message .rows .row:nth-child(" + (file.num+1) + ") .status")
|
||||||
.html("Finished")
|
.html("Finished")
|
||||||
.addClass("success");
|
.addClass("success");
|
||||||
|
|
||||||
file.ready = true;
|
} else {
|
||||||
wait = false;
|
|
||||||
|
// Error
|
||||||
|
$(".upload_message .rows .row:nth-child(" + (file.num+1) + ") .status")
|
||||||
|
.html("Error")
|
||||||
|
.addClass("error");
|
||||||
|
$(".upload_message .rows .row:nth-child(" + (file.num+1) + ") p.notice")
|
||||||
|
.html("Server returned the status code " + xhr.status)
|
||||||
|
.show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Check if there are file which are not finished
|
// Check if there are file which are not finished
|
||||||
for (var i = 0; i < files.length; i++) {
|
for (var i = 0; i < files.length; i++) {
|
||||||
@ -138,8 +150,6 @@ upload = {
|
|||||||
// Finish upload when all files are finished
|
// Finish upload when all files are finished
|
||||||
if (wait===false) finish();
|
if (wait===false) finish();
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
xhr.upload.onprogress = function(e) {
|
xhr.upload.onprogress = function(e) {
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user