open-vault/ui/app/serializers/identity/_base.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

27 lines
676 B
JavaScript

import { assign } from '@ember/polyfills';
import ApplicationSerializer from '../application';
export default ApplicationSerializer.extend({
normalizeItems(payload) {
if (payload.data.keys && Array.isArray(payload.data.keys)) {
return payload.data.keys;
}
assign(payload, payload.data);
delete payload.data;
return payload;
},
extractLazyPaginatedData(payload) {
let list;
list = payload.data.keys.map(key => {
let model = payload.data.key_info[key];
model.id = key;
return model;
});
delete payload.data.key_info;
return list.sort((a, b) => {
return a.name.localeCompare(b.name);
});
},
});