mirror of
https://github.com/status-im/consul.git
synced 2025-01-09 21:35:52 +00:00
6589cbbd0d
* ui: Add the most basic workspace root in /ui * We already have a LICENSE file in the repository root * Change directory path in build scripts ui-v2 -> ui * Make yarn install flags configurable from elsewhere * Minimal workspace root makefile * Call the new docker specific target * Update yarn in the docker build image * Reconfigure the netlify target and move to the higher makefile * Move ui-v2 -> ui/packages/consul-ui * Change repo root to refleect new folder structure * Temporarily don't hoist consul-api-double * Fixup CI configuration * Fixup lint errors * Fixup Netlify target
59 lines
1.8 KiB
JavaScript
59 lines
1.8 KiB
JavaScript
import Serializer from './application';
|
|
import { PRIMARY_KEY, SLUG_KEY } from 'consul-ui/models/service';
|
|
import { get } from '@ember/object';
|
|
|
|
export default Serializer.extend({
|
|
primaryKey: PRIMARY_KEY,
|
|
slugKey: SLUG_KEY,
|
|
respondForQuery: function(respond, query) {
|
|
return this._super(
|
|
cb =>
|
|
respond((headers, body) => {
|
|
// Services and proxies all come together in the same list
|
|
// Here we map the proxies to their related services on a Service.Proxy
|
|
// property for easy access later on
|
|
const services = {};
|
|
body
|
|
.filter(function(item) {
|
|
return item.Kind !== 'connect-proxy';
|
|
})
|
|
.forEach(item => {
|
|
services[item.Name] = item;
|
|
});
|
|
body
|
|
.filter(function(item) {
|
|
return item.Kind === 'connect-proxy';
|
|
})
|
|
.forEach(item => {
|
|
// Iterating to cover the usecase of a proxy being
|
|
// used by more than one service
|
|
if (item.ProxyFor) {
|
|
item.ProxyFor.forEach(service => {
|
|
if (typeof services[service] !== 'undefined') {
|
|
services[service].Proxy = item;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
return cb(headers, body);
|
|
}),
|
|
query
|
|
);
|
|
},
|
|
respondForQueryRecord: function(respond, query) {
|
|
// Name is added here from the query, which is used to make the uid
|
|
// Datacenter gets added in the ApplicationSerializer
|
|
return this._super(
|
|
cb =>
|
|
respond((headers, body) => {
|
|
return cb(headers, {
|
|
Name: query.id,
|
|
Namespace: get(body, 'firstObject.Service.Namespace'),
|
|
Nodes: body,
|
|
});
|
|
}),
|
|
query
|
|
);
|
|
},
|
|
});
|