ui: show service level tags, remove Node.nodeTags

This commit is contained in:
Jack Pearkes 2014-06-11 17:14:20 -04:00
parent 25db24ef75
commit 1c9275f37e
3 changed files with 20 additions and 27 deletions

View File

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

View File

@ -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')
});

View File

@ -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);
}
});