code refactor

This commit is contained in:
MaysWind 2019-04-22 23:06:05 +08:00
parent 317348ebbd
commit dc1d60821a
2 changed files with 6 additions and 6 deletions

View file

@ -2,7 +2,7 @@
'use strict';
angular.module('ariaNg').filter('taskStatus', function () {
return function (task) {
return function (task, simplify) {
if (!task) {
return '';
}
@ -17,11 +17,11 @@
return 'Waiting';
} else if (task.status === 'paused') {
return 'Paused';
} else if (task.status === 'complete') {
} else if (!simplify && task.status === 'complete') {
return 'Completed';
} else if (task.status === 'error') {
} else if (!simplify && task.status === 'error') {
return (task.errorCode ? 'format.task.error-occurred' : 'Error Occurred');
} else if (task.status === 'removed') {
} else if (!simplify && task.status === 'removed') {
return 'Removed';
} else {
return '';

View file

@ -65,13 +65,13 @@
<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>
<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>
</div>
</div>
<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' : '') : ''}}"
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 class="task-right-arrow visible-md visible-lg">
<a ng-href="#!/task/detail/{{task.gid}}" title="{{'Click to view task detail' | translate}}">