code refactor
This commit is contained in:
parent
317348ebbd
commit
dc1d60821a
|
@ -2,7 +2,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('ariaNg').filter('taskStatus', function () {
|
angular.module('ariaNg').filter('taskStatus', function () {
|
||||||
return function (task) {
|
return function (task, simplify) {
|
||||||
if (!task) {
|
if (!task) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -17,11 +17,11 @@
|
||||||
return 'Waiting';
|
return 'Waiting';
|
||||||
} else if (task.status === 'paused') {
|
} else if (task.status === 'paused') {
|
||||||
return 'Paused';
|
return 'Paused';
|
||||||
} else if (task.status === 'complete') {
|
} else if (!simplify && task.status === 'complete') {
|
||||||
return 'Completed';
|
return 'Completed';
|
||||||
} else if (task.status === 'error') {
|
} else if (!simplify && task.status === 'error') {
|
||||||
return (task.errorCode ? 'format.task.error-occurred' : 'Error Occurred');
|
return (task.errorCode ? 'format.task.error-occurred' : 'Error Occurred');
|
||||||
} else if (task.status === 'removed') {
|
} else if (!simplify && task.status === 'removed') {
|
||||||
return 'Removed';
|
return 'Removed';
|
||||||
} else {
|
} else {
|
||||||
return '';
|
return '';
|
||||||
|
|
|
@ -65,13 +65,13 @@
|
||||||
<span class="task-last-time"
|
<span class="task-last-time"
|
||||||
ng-bind="task.status === 'waiting' ? '--:--:--' : (task.status === 'paused' ? '' : (task.status === 'active' ? ((0 <= task.remainTime && task.remainTime < 86400) ? (task.remainTime | dateDuration: 'second': 'HH:mm:ss') : ('More Than One Day' | translate)) : ''))"></span>
|
ng-bind="task.status === 'waiting' ? '--:--:--' : (task.status === 'paused' ? '' : (task.status === 'active' ? ((0 <= task.remainTime && task.remainTime < 86400) ? (task.remainTime | dateDuration: 'second': 'HH:mm:ss') : ('More Than One Day' | translate)) : ''))"></span>
|
||||||
<span class="task-download-speed visible-xs-inline pull-right"
|
<span class="task-download-speed visible-xs-inline pull-right"
|
||||||
ng-bind="task.status === 'waiting' ? ('Waiting' | translate) : (task.status === 'paused' ? ('Paused' | translate) : (task.status === 'active' ? (!task.seeder || task.downloadSpeed > 0 ? (task.downloadSpeed | readableVolume) + '/s' : '-') : ''))"></span>
|
ng-bind="(task.status === 'active' ? (!task.seeder || task.downloadSpeed > 0 ? (task.downloadSpeed | readableVolume) + '/s' : '-') : (task | taskStatus: true | translate: {errorcode: task.errorCode}))"></span>
|
||||||
<span class="task-seeders pull-right" ng-bind="task.status === 'active' ? ((task.numSeeders ? (task.numSeeders + '/') : '') + task.connections) : ''"></span>
|
<span class="task-seeders pull-right" ng-bind="task.status === 'active' ? ((task.numSeeders ? (task.numSeeders + '/') : '') + task.connections) : ''"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-2 col-sm-2 hidden-xs">
|
<div class="col-md-2 col-sm-2 hidden-xs">
|
||||||
<span class="task-download-speed" title="{{task.status === 'active' ? (('Download Speed' | translate) + ': ' + (task.downloadSpeed | readableVolume) + '/s') + (task.bittorrent ? ', ' + ('Upload Speed' | translate) + ': ' + (task.uploadSpeed | readableVolume) + '/s' : '') : ''}}"
|
<span class="task-download-speed" title="{{task.status === 'active' ? (('Download Speed' | translate) + ': ' + (task.downloadSpeed | readableVolume) + '/s') + (task.bittorrent ? ', ' + ('Upload Speed' | translate) + ': ' + (task.uploadSpeed | readableVolume) + '/s' : '') : ''}}"
|
||||||
ng-bind="task.status === 'waiting' ? ('Waiting' | translate) : (task.status === 'paused' ? ('Paused' | translate) : (task.status === 'active' ? (!task.seeder || task.downloadSpeed > 0 ? (task.downloadSpeed | readableVolume) + '/s' : '-') : ''))"></span>
|
ng-bind="(task.status === 'active' ? (!task.seeder || task.downloadSpeed > 0 ? (task.downloadSpeed | readableVolume) + '/s' : '-') : (task | taskStatus: true | translate: {errorcode: task.errorCode}))"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="task-right-arrow visible-md visible-lg">
|
<div class="task-right-arrow visible-md visible-lg">
|
||||||
<a ng-href="#!/task/detail/{{task.gid}}" title="{{'Click to view task detail' | translate}}">
|
<a ng-href="#!/task/detail/{{task.gid}}" title="{{'Click to view task detail' | translate}}">
|
||||||
|
|
Reference in a new issue