2018-08-28 00:54:30 +00:00
|
|
|
import ApplicationSerializer from './application';
|
|
|
|
export default ApplicationSerializer.extend({
|
2018-04-03 14:16:57 +00:00
|
|
|
extractLazyPaginatedData(payload) {
|
|
|
|
let ret;
|
2021-12-17 03:44:29 +00:00
|
|
|
ret = payload.data.keys.map((key) => {
|
2018-04-03 14:16:57 +00:00
|
|
|
let model = {
|
|
|
|
id: key,
|
|
|
|
};
|
|
|
|
if (payload.backend) {
|
|
|
|
model.backend = payload.backend;
|
|
|
|
}
|
|
|
|
return model;
|
|
|
|
});
|
|
|
|
return ret;
|
|
|
|
},
|
|
|
|
|
2018-08-28 00:54:30 +00:00
|
|
|
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];
|
2018-04-03 14:16:57 +00:00
|
|
|
}
|
2018-08-28 00:54:30 +00:00
|
|
|
return normalized;
|
2018-04-03 14:16:57 +00:00
|
|
|
},
|
|
|
|
});
|