Merge branch 'master' into gh-pages

This commit is contained in:
hamza zia 2016-09-21 12:23:57 +08:00
commit e05e49bcd7
2 changed files with 97 additions and 3 deletions

View File

@ -555,6 +555,72 @@
<!-- }}} --> <!-- }}} -->
</ul> </ul>
<ul class="stats pull-left" ng-switch-when="verifing">
<!-- {{{ active download statistics -->
<li class="label label-warning hidden-phone hidden-tablet">
<span title="{{ 'Download status' | translate }}"><span class="fa fa-fw fa-play">&nbsp;</span> {{download.status}}</span>
</li>
<li class="label label-default" ng-class="{'label-active': download.downloadSpeed > 2048, 'label-warning': download.downloadSpeed <= 2048}">
<span title="{{ 'Download Speed' | translate }}"><span class="fa fa-fw fa-arrow-circle-o-down">&nbsp;</span> {{download.downloadSpeed | bspeed}}</span>
</li>
<li ng-show="download.bittorrent" class="label label-default hidden-phone" ng-class="{'label-info': download.uploadSpeed > 2048}">
<span title="{{ 'Upload Speed' | translate }}"><span class="fa fa-fw fa-arrow-circle-o-up">&nbsp;</span> {{download.uploadSpeed | bspeed}}</span>
</li>
<li class="label label-active">
<span title="{{ 'Estimated time' | translate }}"><span class="fa fa-fw fa-clock-o">&nbsp;</span> {{getEta(download) | time}}</span>
</li>
<li class="label label-active hidden-phone">
<span title="{{ 'Download Size' | translate }}"><span class="fa fa-fw fa-cloud-download">&nbsp;</span> {{download.fmtTotalLength}}</span>
</li>
<li class="label label-active hidden-phone">
<span title="{{ 'Downloaded' | translate }}"><span class="fa fa-fw fa-arrow-circle-o-down">&nbsp;</span> {{download.fmtCompletedLength}}</span>
</li>
<li class="label label-active hidden-phone hidden-tablet">
<span title="{{ 'Progress' | translate }}"><span class="fa fa-fw fa-chevron-right">&nbsp;</span> {{getProgress(download)}}%</span>
</li>
<!-- }}} -->
</ul>
<ul class="stats pull-left" ng-switch-when="verifyPending">
<!-- {{{ active download statistics -->
<li class="label label-warning hidden-phone hidden-tablet">
<span title="{{ 'Download status' | translate }}"><span class="fa fa-fw fa-play">&nbsp;</span> {{download.status}}</span>
</li>
<li class="label label-default" ng-class="{'label-active': download.downloadSpeed > 2048, 'label-warning': download.downloadSpeed <= 2048}">
<span title="{{ 'Download Speed' | translate }}"><span class="fa fa-fw fa-arrow-circle-o-down">&nbsp;</span> {{download.downloadSpeed | bspeed}}</span>
</li>
<li ng-show="download.bittorrent" class="label label-default hidden-phone" ng-class="{'label-info': download.uploadSpeed > 2048}">
<span title="{{ 'Upload Speed' | translate }}"><span class="fa fa-fw fa-arrow-circle-o-up">&nbsp;</span> {{download.uploadSpeed | bspeed}}</span>
</li>
<li class="label label-active">
<span title="{{ 'Estimated time' | translate }}"><span class="fa fa-fw fa-clock-o">&nbsp;</span> {{getEta(download) | time}}</span>
</li>
<li class="label label-active hidden-phone">
<span title="{{ 'Download Size' | translate }}"><span class="fa fa-fw fa-cloud-download">&nbsp;</span> {{download.fmtTotalLength}}</span>
</li>
<li class="label label-active hidden-phone">
<span title="{{ 'Downloaded' | translate }}"><span class="fa fa-fw fa-arrow-circle-o-down">&nbsp;</span> {{download.fmtCompletedLength}}</span>
</li>
<li class="label label-active hidden-phone hidden-tablet">
<span title="{{ 'Progress' | translate }}"><span class="fa fa-fw fa-chevron-right">&nbsp;</span> {{getProgress(download)}}%</span>
</li>
<!-- }}} -->
</ul>
<ul class="stats pull-left" ng-switch-when="paused"> <ul class="stats pull-left" ng-switch-when="paused">
<!-- {{{ paused download statistics --> <!-- {{{ paused download statistics -->

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,12 +398,24 @@ function(
animCollapsed: true, animCollapsed: true,
files: [], files: [],
}; };
if (d.verifiedLength) {
ctx.verifiedLength = d.verifiedLength;
ctx.status = "verifing";
}
if (d.verifyIntegrityPending) {
ctx.verifyIntegrityPending = d.verifyIntegrityPending;
ctx.status = "verifyPending";
}
} }
else { else {
if (ctx.gid !== d.gid) if (ctx.gid !== d.gid)
ctx.files = []; ctx.files = [];
ctx.dir = d.dir; ctx.dir = d.dir;
ctx.status = d.status; ctx.status = d.status;
if(d.verifiedLength)
ctx.status = "verifing";
if(d.verifyIntegrityPending)
ctx.status = "verifyPending"
ctx.errorCode = d.errorCode; ctx.errorCode = d.errorCode;
ctx.gid = d.gid; ctx.gid = d.gid;
ctx.followedBy = (d.followedBy && d.followedBy.length == 1 ctx.followedBy = (d.followedBy && d.followedBy.length == 1
@ -427,6 +439,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);
@ -521,6 +543,8 @@ function(
return "progress-bar-warning"; return "progress-bar-warning";
case "active": case "active":
return "active"; return "active";
case "verifing":
return "progress-bar-warning";
case "complete": case "complete":
return "progress-bar-success"; return "progress-bar-success";
default: default:
@ -530,7 +554,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;
@ -597,4 +625,4 @@ function(
rpc.once('changePosition', [d.gid, -1, 'POS_CUR']); rpc.once('changePosition', [d.gid, -1, 'POS_CUR']);
}; };
}]); }]);