mirror of
https://github.com/status-im/consul.git
synced 2025-01-09 21:35:52 +00:00
355f034822
This gives more prominence to 'Service Instances' as opposed to 'Services'. It also begins to surface Connect related 'nouns' such as 'Proxies' and 'Upstreams' and begins to interconnect them giving more visibility to operators. Various smaller changes: 1. Move healthcheck-status component to healthcheck-output 2. Create a new healthcheck-status component for showing the number of checks plus its icon 3. Create a new healthcheck-info component to group multiple statuses plus a different view if there are no checks 4. Componentize tag-list
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
import RepositoryService from 'consul-ui/services/repository';
|
|
import { get, set } from '@ember/object';
|
|
const modelName = 'service';
|
|
export default RepositoryService.extend({
|
|
getModelName: function() {
|
|
return modelName;
|
|
},
|
|
findBySlug: function(slug, dc) {
|
|
return this._super(...arguments).then(function(item) {
|
|
const nodes = get(item, 'Nodes');
|
|
const service = get(nodes, 'firstObject');
|
|
const tags = nodes
|
|
.reduce(function(prev, item) {
|
|
return prev.concat(get(item, 'Service.Tags') || []);
|
|
}, [])
|
|
.uniq();
|
|
set(service, 'Tags', tags);
|
|
set(service, 'Nodes', nodes);
|
|
return service;
|
|
});
|
|
},
|
|
findInstanceBySlug: function(id, slug, dc, configuration) {
|
|
return this.findBySlug(slug, dc, configuration).then(function(item) {
|
|
const i = item.Nodes.findIndex(function(item) {
|
|
return item.Service.ID === id;
|
|
});
|
|
if (i !== -1) {
|
|
const service = item.Nodes[i].Service;
|
|
service.Node = item.Nodes[i].Node;
|
|
service.ServiceChecks = item.Nodes[i].Checks.filter(function(item) {
|
|
return item.ServiceID != '';
|
|
});
|
|
service.NodeChecks = item.Nodes[i].Checks.filter(function(item) {
|
|
return item.ServiceID == '';
|
|
});
|
|
return service;
|
|
}
|
|
// TODO: probably need to throw a 404 here?
|
|
});
|
|
},
|
|
});
|