a1b3f00a69
* Add `Local` property to Datacenters * If you have not previous datacenter, redirect the user to the local dc * Add an `is-local` class to the local datacenter in the DC picker
28 lines
622 B
JavaScript
28 lines
622 B
JavaScript
import { inject as service } from '@ember/service';
|
|
import Serializer from './application';
|
|
|
|
export default class DcSerializer extends Serializer {
|
|
@service('env') env;
|
|
|
|
primaryKey = 'Name';
|
|
|
|
respondForQuery(respond, query) {
|
|
return respond(function(headers, body) {
|
|
return body;
|
|
});
|
|
}
|
|
|
|
normalizePayload(payload, id, requestType) {
|
|
switch (requestType) {
|
|
case 'query':
|
|
return payload.map(item => {
|
|
return {
|
|
Local: this.env.var('CONSUL_DATACENTER_LOCAL') === item,
|
|
[this.primaryKey]: item,
|
|
};
|
|
});
|
|
}
|
|
return payload;
|
|
}
|
|
}
|