ui: show service level tags, remove Node.nodeTags

This commit is contained in:
Jack Pearkes 2014-06-11 17:14:20 -04:00
parent 0f7adbf639
commit b514d2677d
3 changed files with 20 additions and 27 deletions

View file

@ -345,12 +345,12 @@
<hr> <hr>
<h5>Tags</h5> <h5>Tags</h5>
<ul class="list-inline"> {{#if tags}}
{{#each tag in model.service.Tags}} <p>{{tags}}</p>
{{serviceTag tag}} {{else}}
{{/each}} <p>No tags</p>
{{serviceTagMessage service.Tags}} {{/if}}
</ul>
<h5>Nodes</h5> <h5>Nodes</h5>
{{#each node in model }} {{#each node in model }}
@ -466,7 +466,7 @@
</div> </div>
<ul class="list-inline sub"> <ul class="list-inline sub">
{{#each tag in service.Tags}} {{#each tag in service.Tags}}
{{serviceTag tag}} <li>{{tag}}</li>
{{/each}} {{/each}}
{{serviceTagMessage service.Tags}} {{serviceTagMessage service.Tags}}
</ul> </ul>

View file

@ -123,26 +123,7 @@ App.Node = Ember.Object.extend({
filterKey: function() { filterKey: function() {
return this.get('Node') return this.get('Node')
}.property('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')
}); });

View file

@ -233,6 +233,18 @@ App.ServicesShowRoute = App.BaseRoute.extend({
}); });
return objs; 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);
} }
}); });