Allow to filter for running downloads
i.e. downloads with some speed.
This commit is contained in:
parent
d634994d99
commit
f4c5810518
|
@ -245,6 +245,10 @@
|
||||||
<input id="download-filter" type="text" ng-model="downloadFilter" autocomplete="off" ng-change="onDownloadFilter()" class="input-large"/>
|
<input id="download-filter" type="text" ng-model="downloadFilter" autocomplete="off" ng-change="onDownloadFilter()" class="input-large"/>
|
||||||
<button ng-click="clearFilter()" class="btn btn-default btn-mini">Clear</button>
|
<button ng-click="clearFilter()" class="btn btn-default btn-mini">Clear</button>
|
||||||
<br>
|
<br>
|
||||||
|
<label for="filter-speed">
|
||||||
|
<input type="checkbox" ng-model="filterSpeed" id="filter-speed">
|
||||||
|
running
|
||||||
|
</label>
|
||||||
<label for="filter-active">
|
<label for="filter-active">
|
||||||
<input type="checkbox" ng-model="filterActive" id="filter-active">
|
<input type="checkbox" ng-model="filterActive" id="filter-active">
|
||||||
active
|
active
|
||||||
|
|
|
@ -144,6 +144,7 @@ function(
|
||||||
};
|
};
|
||||||
|
|
||||||
scope.toggleStateFilters = function() {
|
scope.toggleStateFilters = function() {
|
||||||
|
scope.filterSpeed = !scope.filterSpeed;
|
||||||
scope.filterActive = !scope.filterActive;
|
scope.filterActive = !scope.filterActive;
|
||||||
scope.filterWaiting = !scope.filterWaiting;
|
scope.filterWaiting = !scope.filterWaiting;
|
||||||
scope.filterComplete = !scope.filterComplete;
|
scope.filterComplete = !scope.filterComplete;
|
||||||
|
@ -153,7 +154,8 @@ function(
|
||||||
};
|
};
|
||||||
|
|
||||||
scope.resetFilters = function() {
|
scope.resetFilters = function() {
|
||||||
scope.filterActive =
|
scope.filterSpeed =
|
||||||
|
scope.filterActive =
|
||||||
scope.filterWaiting =
|
scope.filterWaiting =
|
||||||
scope.filterComplete =
|
scope.filterComplete =
|
||||||
scope.filterError =
|
scope.filterError =
|
||||||
|
@ -183,7 +185,19 @@ function(
|
||||||
scope.getDownloads = function() {
|
scope.getDownloads = function() {
|
||||||
var downloads = [];
|
var downloads = [];
|
||||||
if (scope.filterActive) {
|
if (scope.filterActive) {
|
||||||
downloads = scope.active;
|
if (!scope.filterSpeed) {
|
||||||
|
downloads = _.filter(scope.active, function (e) {
|
||||||
|
return !+e.uploadSpeed && !+e.downloadSpeed;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
downloads = scope.active;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (scope.filterSpeed) {
|
||||||
|
downloads = _.filter(scope.active, function (e) {
|
||||||
|
return +e.uploadSpeed || +e.downloadSpeed;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
if (scope.filterWaiting) {
|
if (scope.filterWaiting) {
|
||||||
downloads = downloads.concat(_.filter(scope.waiting, function (e) {
|
downloads = downloads.concat(_.filter(scope.waiting, function (e) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user