open-vault/ui/app/serializers/role.js
Matthew Irish d509588cd2
Ember update (#5386)
Ember update - update ember-cli, ember-data, and ember to 3.4 series
2018-09-25 11:28:26 -05:00

28 lines
798 B
JavaScript

import ApplicationSerializer from './application';
export default ApplicationSerializer.extend({
extractLazyPaginatedData(payload) {
let ret;
if (payload.zero_address_roles) {
payload.zero_address_roles.forEach(role => {
// mutate key_info object to add zero_address info
payload.data.key_info[role].zero_address = true;
});
}
if (!payload.data.key_info) return payload.data.keys;
ret = payload.data.keys.map(key => {
let model = {
id: key,
key_type: payload.data.key_info[key].key_type,
zero_address: payload.data.key_info[key].zero_address,
};
if (payload.backend) {
model.backend = payload.backend;
}
return model;
});
delete payload.data.key_info;
return ret;
},
});