Report hash verification progress

This commit is contained in:
Kurt Kartaltepe 2016-09-19 23:34:20 -05:00
parent d8015e12f8
commit ddc69c1807

View File

@ -318,7 +318,7 @@ function(
} }
else if (scope.filterSpeed) { else if (scope.filterSpeed) {
downloads = _.filter(scope.active, function (e) { downloads = _.filter(scope.active, function (e) {
return +e.uploadSpeed || +e.downloadSpeed; return +e.uploadSpeed || +e.downloadSpeed;
}); });
} }
if (scope.filterWaiting) { if (scope.filterWaiting) {
@ -398,6 +398,10 @@ function(
animCollapsed: true, animCollapsed: true,
files: [], files: [],
}; };
if (d.verifiedLength)
ctx.verifiedLength = d.verifiedLength;
if (d.verifyIntegrityPending)
ctx.verifyIntegrityPending = d.verifyIntegrityPending;
} }
else { else {
if (ctx.gid !== d.gid) if (ctx.gid !== d.gid)
@ -427,6 +431,16 @@ function(
ctx.completedLength = d.completedLength; ctx.completedLength = d.completedLength;
ctx.fmtCompletedLength = utils.fmtsize(d.completedLength); ctx.fmtCompletedLength = utils.fmtsize(d.completedLength);
} }
if (!d.verifiedLength) {
delete ctx.verifiedLength
} else if (ctx.verifiedLength !== d.verifiedLength) {
ctx.verifiedLength = d.verifiedLength;
}
if (!d.verifyIntegrityPending) {
delete ctx.verifyIntegrityPending
} else if (ctx.verifyIntegrityPending !== d.verifyIntegrityPending) {
ctx.verifyIntegrityPending = d.verifyIntegrityPending;
}
if (ctx.uploadLength !== d.uploadength) { if (ctx.uploadLength !== d.uploadength) {
ctx.uploadLength = d.uploadlength; ctx.uploadLength = d.uploadlength;
ctx.fmtUploadLength = utils.fmtsize(d.uploadLength); ctx.fmtUploadLength = utils.fmtsize(d.uploadLength);
@ -520,7 +534,10 @@ function(
case "removed": case "removed":
return "progress-bar-warning"; return "progress-bar-warning";
case "active": case "active":
return "active"; if (d.verifyIntegrityPending || d.verifiedLength)
return "progress-bar-warning"
else
return "active";
case "complete": case "complete":
return "progress-bar-success"; return "progress-bar-success";
default: default:
@ -530,7 +547,11 @@ function(
// gets the progress in percentages // gets the progress in percentages
scope.getProgress = function(d) { scope.getProgress = function(d) {
var percentage = (d.completedLength / d.totalLength)*100 || 0; var percentage = 0
if (d.verifiedLength)
percentage = (d.verifiedLength / d.totalLength) * 100 || 0;
else
percentage = (d.completedLength / d.totalLength) * 100 || 0;
percentage = percentage.toFixed(2); percentage = percentage.toFixed(2);
if(!percentage) percentage = 0; if(!percentage) percentage = 0;