From b514d2677df9bddacf0ff1ee847c32931635ed00 Mon Sep 17 00:00:00 2001 From: Jack Pearkes Date: Wed, 11 Jun 2014 17:14:20 -0400 Subject: [PATCH] ui: show service level tags, remove Node.nodeTags --- ui/index.html | 14 +++++++------- ui/javascripts/app/models.js | 21 +-------------------- ui/javascripts/app/routes.js | 12 ++++++++++++ 3 files changed, 20 insertions(+), 27 deletions(-) diff --git a/ui/index.html b/ui/index.html index cb848da5b..ce40de71c 100644 --- a/ui/index.html +++ b/ui/index.html @@ -345,12 +345,12 @@
Tags
- + {{#if tags}} +

{{tags}}

+ {{else}} +

No tags

+ {{/if}} +
Nodes
{{#each node in model }} @@ -466,7 +466,7 @@ diff --git a/ui/javascripts/app/models.js b/ui/javascripts/app/models.js index 84c1f8851..99249e538 100644 --- a/ui/javascripts/app/models.js +++ b/ui/javascripts/app/models.js @@ -123,26 +123,7 @@ App.Node = Ember.Object.extend({ filterKey: function() { return this.get('Node') - }.property('Node'), - - // - // Returns a combined and distinct list of the tags on the services - // running on the node - // - nodeTags: function() { - var tags = []; - - // Collect the services tags - this.get('Services').map(function(Service){ - tags.push(Service.Tags) - }) - - // strip nulls - tags = tags.filter(function(n){ return n != undefined }); - - // only keep unique tags and convert to comma sep - return tags.uniq().join(', ') - }.property('Services') + }.property('Node') }); diff --git a/ui/javascripts/app/routes.js b/ui/javascripts/app/routes.js index 2097cb1b1..78f40d60f 100644 --- a/ui/javascripts/app/routes.js +++ b/ui/javascripts/app/routes.js @@ -233,6 +233,18 @@ App.ServicesShowRoute = App.BaseRoute.extend({ }); return objs; }); + }, + setupController: function(controller, model) { + var tags = []; + model.map(function(obj){ + tags = tags.concat(obj.Service.Tags) + }); + + tags = tags.filter(function(n){ return n != undefined }); + tags = tags.uniq().join(', ') + + controller.set('content', model); + controller.set('tags', tags); } });