[AAE-3273] Manage empty option in retrieve content metadata dropdowns (#6024)

* AAE-3273 Manage empty option in retrieve content metadata dropdowns

* AAE-3273 Add unit tests

* AAE-3273 Refactor add not present fields

* AAE-3273 Add unit test in core
This commit is contained in:
Pablo Martinez Garcia
2020-08-25 01:36:22 +02:00
committed by GitHub
parent a7af27cfad
commit c1435c53e0
5 changed files with 226 additions and 24 deletions

View File

@@ -116,15 +116,7 @@ export class FormCloudComponent extends FormBaseComponent implements OnChanges,
this.formService.updateFormValuesRequested
.pipe(takeUntil(this.onDestroy$))
.subscribe((valuesToSetIfNotPresent) => {
const keys = Object.keys(valuesToSetIfNotPresent);
keys.forEach(key => {
if (!this.form.values[key]) {
this.form.values[key] = valuesToSetIfNotPresent[key];
}
});
this.data = [];
const fields = Object.keys(this.form.values);
fields.forEach(field => this.data.push({ name: field, value: this.form.values[field] }));
this.data = this.form.addValuesNotPresent(valuesToSetIfNotPresent);
this.refreshFormData();
});
}