From 534dc72d5af6cab2ebc5db260806d0c468371ffe Mon Sep 17 00:00:00 2001 From: Jack Pearkes Date: Mon, 2 Jun 2014 12:05:13 -0400 Subject: [PATCH] ui: filter nodes/services by passing/failing statuses --- ui/javascripts/app/controllers.js | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/ui/javascripts/app/controllers.js b/ui/javascripts/app/controllers.js index a7da924e8..1b054bd8d 100644 --- a/ui/javascripts/app/controllers.js +++ b/ui/javascripts/app/controllers.js @@ -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() {