You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
consul/ui-v2/app/services/services.js

29 lines
752 B

import Service, { inject as service } from '@ember/service';
import { get, set } from '@ember/object';
export default Service.extend({
store: service('store'),
findAllByDatacenter: function(dc) {
return get(this, 'store')
.query('service', { dc: dc })
.then(function(items) {
return items.forEach(function(item) {
set(item, 'Datacenter', dc);
});
});
},
findBySlug: function(slug, dc) {
return get(this, 'store')
.queryRecord('service', {
id: slug,
dc: dc,
})
.then(function(item) {
const nodes = get(item, 'Nodes');
const service = get(nodes, 'firstObject');
set(service, 'Nodes', nodes);
return service;
});
},
});