* feat: 🎸 Update models for vault ssh cert feature (#1591) ✅ Closes: ICU-7546 * feat: 🎸 Setup types in cred library forms and use HDS component (#1597) * feat: 🎸 Setup types in cred library forms and use HDS component ✅ Closes: ICU-7673 * feat: 🎸 Add vault ssh cert type for credential library (#1608) * feat: 🎸 Add vault ssh cert type for credential library ✅ Closes: ICU-7678 * feat: 🎸 Enable feature flag for vault ssh cert work (#1614) * fix: 🐛 Change fields to optional as they get default by backend (#1615) * Chore/cleanup vault ssh cert (#1616)
23 lines
541 B
JavaScript
23 lines
541 B
JavaScript
import Transform from '@ember-data/serializer/transform';
|
|
|
|
export default class ObjectAsArrayTransform extends Transform {
|
|
deserialize(serialized) {
|
|
const obj = serialized || {};
|
|
return Object.entries(obj).map(([key, value]) => ({ key, value }));
|
|
}
|
|
serialize(deserialized) {
|
|
const array = deserialized || [];
|
|
|
|
if (!array.length) {
|
|
return null;
|
|
}
|
|
|
|
return array.reduce((result, currentValue) => {
|
|
const { key, value } = currentValue;
|
|
result[key] = value;
|
|
|
|
return result;
|
|
}, {});
|
|
}
|
|
}
|