mirror of
https://github.com/hashicorp/vault.git
synced 2025-11-11 13:51:36 +01:00
* add routes for control groups in tools, settings, access (#4718) * UI control group - storage, request, authorization, and unwrapping (#4899) * UI control groups config (#4927)
32 lines
875 B
JavaScript
32 lines
875 B
JavaScript
import DS from 'ember-data';
|
|
import ApplicationSerializer from './application';
|
|
import Ember from 'ember';
|
|
|
|
const { get } = Ember;
|
|
|
|
export default ApplicationSerializer.extend(DS.EmbeddedRecordsMixin, {
|
|
attrs: {
|
|
requestEntity: { embedded: 'always' },
|
|
authorizations: { embedded: 'always' },
|
|
},
|
|
|
|
normalizeResponse(store, primaryModelClass, payload) {
|
|
let entity = get(payload, 'data.request_entity');
|
|
if (Array.isArray(payload.data.authorizations)) {
|
|
for (let authorization of payload.data.authorizations) {
|
|
authorization.id = authorization.entity_id;
|
|
authorization.name = authorization.entity_name;
|
|
}
|
|
}
|
|
|
|
if (entity && Object.keys(entity).length === 0) {
|
|
payload.data.request_entity = null;
|
|
}
|
|
return this._super(...arguments);
|
|
},
|
|
|
|
serialize(snapshot) {
|
|
return { accessor: snapshot.id };
|
|
},
|
|
});
|