open-vault/ui/app/serializers/role-aws.js
Matthew Irish 331b6ce6f5
refactor aws secret ui (#5193)
Update UI for AWS secret backend refactor

* Support empty AWS policy documents
* Try to make ARN input multiple
* move aws-role serializer to use the application serializer as the base
* support editing strings as JSON in the form field component
* update model, form and show to use form-component component, and swap fields based on credential type
* fix tests
* unify credential generation for aws and remove the STS specific action in the UI
* add label to the new json string form field
2018-08-27 19:54:30 -05:00

29 lines
791 B
JavaScript

import ApplicationSerializer from './application';
export default ApplicationSerializer.extend({
extractLazyPaginatedData(payload) {
let ret;
ret = payload.data.keys.map(key => {
let model = {
id: key,
};
if (payload.backend) {
model.backend = payload.backend;
}
return model;
});
return ret;
},
normalizeItems() {
let normalized = this._super(...arguments);
// most roles will only have one in this array,
// we'll default to the first, and keep the array on the
// model and show a warning if there's more than one so that
// they don't inadvertently save
if (normalized.credential_types) {
normalized.credential_type = normalized.credential_types[0];
}
return normalized;
},
});