github.com/outbrain/consul@v1.4.5/ui-v2/app/services/repository/service.js (about) 1 import RepositoryService from 'consul-ui/services/repository'; 2 import { get, set } from '@ember/object'; 3 const modelName = 'service'; 4 export default RepositoryService.extend({ 5 getModelName: function() { 6 return modelName; 7 }, 8 findBySlug: function(slug, dc) { 9 return this._super(...arguments).then(function(item) { 10 const nodes = get(item, 'Nodes'); 11 const service = get(nodes, 'firstObject'); 12 const tags = nodes 13 .reduce(function(prev, item) { 14 return prev.concat(get(item, 'Service.Tags') || []); 15 }, []) 16 .uniq(); 17 set(service, 'Tags', tags); 18 set(service, 'Nodes', nodes); 19 return service; 20 }); 21 }, 22 });