ui: filter nodes/services by passing/failing statuses

This commit is contained in:
Jack Pearkes 2014-06-02 12:05:13 -04:00
parent 2ed76d0a27
commit d6ca0b12e9
1 changed files with 16 additions and 3 deletions

View File

@ -223,15 +223,28 @@ ItemBaseController = Ember.ArrayController.extend({
condensedView: true,
filter: "", // default
filterStatus: "any status", // default
statuses: ["passing", "warning", "critical", "any status"],
statuses: ["any status", "passing", "failing"],
filteredContent: function() {
var filter = this.get('filter');
var filterStatus = this.get('filterStatus');
return this.get('items').filter(function(item, index, enumerable){
var items = this.get('items').filter(function(item, index, enumerable){
return item.get('filterKey').toLowerCase().match(filter.toLowerCase());
});
}.property('filter', 'items.@each'),
switch (filterStatus) {
case "passing":
return items.filterBy('hasFailingChecks', false)
break;
case "failing":
return items.filterBy('hasFailingChecks', true)
break;
default:
return items
}
}.property('filter', 'filterStatus', 'items.@each'),
actions: {
toggleCondensed: function() {