285962b25b
* Refactor grid styling for Topology page * Crate TopologyMetrics Button component and move styling * Create intention ID * fixup button styling * Return a link to the create intention page * Rename Button to Popover component * Fixup serializer test * ui: Inline Topology Intention Actions (#9153) * Add arrow and dot to/from metrics back in * Add addional space to have metrics wrap and show in smaller screens * Move logic for finding positioning * Use color variables Co-authored-by: John Cowen <johncowen@users.noreply.github.com>
37 lines
1.3 KiB
JavaScript
37 lines
1.3 KiB
JavaScript
import Serializer from './application';
|
|
import { PRIMARY_KEY, SLUG_KEY } from 'consul-ui/models/topology';
|
|
import { inject as service } from '@ember/service';
|
|
|
|
export default class TopologySerializer extends Serializer {
|
|
@service('store') store;
|
|
|
|
primaryKey = PRIMARY_KEY;
|
|
slugKey = SLUG_KEY;
|
|
|
|
respondForQueryRecord(respond, query) {
|
|
const intentionSerializer = this.store.serializerFor('intention');
|
|
return super.respondForQueryRecord(function(cb) {
|
|
return respond(function(headers, body) {
|
|
body.Downstreams.forEach(item => {
|
|
item.Intention.SourceName = item.Name;
|
|
item.Intention.SourceNS = item.Namespace;
|
|
item.Intention.DestinationName = query.id;
|
|
item.Intention.DestinationNS = query.ns || 'default';
|
|
intentionSerializer.ensureID(item.Intention);
|
|
});
|
|
body.Upstreams.forEach(item => {
|
|
item.Intention.SourceName = query.id;
|
|
item.Intention.SourceNS = query.ns || 'default';
|
|
item.Intention.DestinationName = item.Name;
|
|
item.Intention.DestinationNS = item.Namespace;
|
|
intentionSerializer.ensureID(item.Intention);
|
|
});
|
|
return cb(headers, {
|
|
...body,
|
|
[SLUG_KEY]: query.id,
|
|
});
|
|
});
|
|
}, query);
|
|
}
|
|
}
|