refactor: 💡 update credential-library form for password type (#3060)

* refactor: 💡 update credential-library form for password type

* style: 💄 fix display issue

* test: 💍 add test cases
This commit is contained in:
Lisbet Alvarez authored and Lisbet Alvarez committed 2025-11-18 11:20:49 -08:00
1 parent 6bb237e78c
commit accf9faf60
15 files changed
+186 -322

No files matched your search

@@ -81,9 +81,10 @@ export default class GeneratedCredentialLibraryModel extends BaseModel {
})
credential_type;
@attr('object-as-array', {
@attr('object', {
for: 'vault-generic',
description: 'It indicates the credential mapping overrides.',
emptyObjectIfMissing: true,
})
credential_mapping_overrides;
@@ -68,7 +68,9 @@ export default class CredentialLibrarySerializer extends ApplicationSerializer {
*/
handleCredentialMappingOverrides(serialized, isNew) {
const { credential_type, credential_mapping_overrides } = serialized;
if (Object.keys(credential_mapping_overrides).length === 0) {
serialized.credential_mapping_overrides = null;
}
// API expects to send null to fields if it is undefined or deleted
if (credential_mapping_overrides && !isNew) {
serialized.credential_mapping_overrides = options.mapping_overrides[