open-vault/ui/app/serializers/transform.js
Chelsea Shaw e61da5a662
Ui/transform role edit updates transformations (#9910)
* Update transform role delete button to be ConfirmAction with dropdown

* Set backend on fetched record so that it saves correctly

* Update transformation after role transformations changed works

* Clean up transform adapter

* Add role to allowed_roles on added transformations and remove from removed transformations on role save, with flash message

* Add backend to transform role model, and update serializer to add backend to paginated results

* Clean up error message handling

* Connect backend to transform roles list response

* Capabilities on transform roles is correct

* Fix cancel button on transform role edit location

* Fix model path

* Remove unnecessary tab param from controller

* Add backend to transform model
2020-09-11 12:29:20 -05:00

34 lines
907 B
JavaScript

import ApplicationSerializer from './application';
export default ApplicationSerializer.extend({
normalizeResponse(store, primaryModelClass, payload, id, requestType) {
if (payload.data.masking_character) {
payload.data.masking_character = String.fromCharCode(payload.data.masking_character);
}
return this._super(store, primaryModelClass, payload, id, requestType);
},
serialize() {
let json = this._super(...arguments);
if (json.template && Array.isArray(json.template)) {
// Transformations should only ever have one template
json.template = json.template[0];
}
return json;
},
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;
},
});