This repository has been archived on 2022-01-02. You can view files and clone it, but cannot push or open issues/pull-requests.
AriaNg/src/scripts/filters/taskStatus.js

32 lines
1008 B
JavaScript
Raw Normal View History

2016-05-23 19:06:50 +02:00
(function () {
'use strict';
2016-06-11 12:52:40 +02:00
angular.module('ariaNg').filter('taskStatus', function () {
2016-05-23 19:06:50 +02:00
return function (task) {
if (!task) {
return '';
}
2016-08-01 19:26:10 +02:00
if (task.status === 'active') {
2016-05-23 19:06:50 +02:00
if (task.seeder === true || task.seeder === 'true') {
2016-06-04 08:05:37 +02:00
return 'Seeding';
2016-05-23 19:06:50 +02:00
} else {
2016-06-04 08:05:37 +02:00
return 'Downloading';
2016-05-23 19:06:50 +02:00
}
2016-08-01 19:26:10 +02:00
} else if (task.status === 'waiting') {
2016-06-04 08:05:37 +02:00
return 'Waiting';
2016-08-01 19:26:10 +02:00
} else if (task.status === 'paused') {
2016-06-04 08:05:37 +02:00
return 'Paused';
2016-08-01 19:26:10 +02:00
} else if (task.status === 'complete') {
2016-06-04 08:05:37 +02:00
return 'Completed';
2016-08-01 19:26:10 +02:00
} else if (task.status === 'error') {
2016-06-04 08:05:37 +02:00
return (task.errorCode ? 'format.task.error-occurred' : 'Error Occurred');
2016-08-01 19:26:10 +02:00
} else if (task.status === 'removed') {
2016-06-04 08:05:37 +02:00
return 'Removed';
2016-05-23 19:06:50 +02:00
} else {
return '';
}
2016-12-10 18:50:25 +01:00
};
2016-06-04 08:05:37 +02:00
});
2016-08-01 16:49:16 +02:00
}());