Resolve data inconsistencies in advanced metadata fetch UI (#1243)
This commit is contained in:
+18
-5
@@ -62,7 +62,7 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
|
|||||||
this.mergeCategories = this.currentMetadataOptions.mergeCategories || false;
|
this.mergeCategories = this.currentMetadataOptions.mergeCategories || false;
|
||||||
this.reviewBeforeApply = this.currentMetadataOptions.reviewBeforeApply || false;
|
this.reviewBeforeApply = this.currentMetadataOptions.reviewBeforeApply || false;
|
||||||
|
|
||||||
const backendFieldOptions = this.currentMetadataOptions.fieldOptions as FieldOptions || {};
|
const backendFieldOptions = this.deepCloneFieldOptions(this.currentMetadataOptions.fieldOptions as FieldOptions || {});
|
||||||
for (const field of this.fields) {
|
for (const field of this.fields) {
|
||||||
if (!backendFieldOptions[field]) {
|
if (!backendFieldOptions[field]) {
|
||||||
backendFieldOptions[field] = {p1: null, p2: null, p3: null, p4: null};
|
backendFieldOptions[field] = {p1: null, p2: null, p3: null, p4: null};
|
||||||
@@ -72,13 +72,26 @@ export class MetadataAdvancedFetchOptionsComponent implements OnChanges {
|
|||||||
}
|
}
|
||||||
this.fieldOptions = backendFieldOptions;
|
this.fieldOptions = backendFieldOptions;
|
||||||
|
|
||||||
this.allP1.value = this.currentMetadataOptions.allP1 || null;
|
this.allP1 = {placeholder: 'Set All', value: this.currentMetadataOptions.allP1 || null};
|
||||||
this.allP2.value = this.currentMetadataOptions.allP2 || null;
|
this.allP2 = {placeholder: 'Set All', value: this.currentMetadataOptions.allP2 || null};
|
||||||
this.allP3.value = this.currentMetadataOptions.allP3 || null;
|
this.allP3 = {placeholder: 'Set All', value: this.currentMetadataOptions.allP3 || null};
|
||||||
this.allP4.value = this.currentMetadataOptions.allP4 || null;
|
this.allP4 = {placeholder: 'Set All', value: this.currentMetadataOptions.allP4 || null};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private deepCloneFieldOptions(fieldOptions: FieldOptions): FieldOptions {
|
||||||
|
const cloned = {} as FieldOptions;
|
||||||
|
for (const field of this.fields) {
|
||||||
|
cloned[field] = {
|
||||||
|
p1: fieldOptions[field]?.p1 || null,
|
||||||
|
p2: fieldOptions[field]?.p2 || null,
|
||||||
|
p3: fieldOptions[field]?.p3 || null,
|
||||||
|
p4: fieldOptions[field]?.p4 || null
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return cloned;
|
||||||
|
}
|
||||||
|
|
||||||
syncProvider(event: SelectChangeEvent, providerType: keyof FieldProvider) {
|
syncProvider(event: SelectChangeEvent, providerType: keyof FieldProvider) {
|
||||||
for (const field of Object.keys(this.fieldOptions)) {
|
for (const field of Object.keys(this.fieldOptions)) {
|
||||||
this.fieldOptions[field as keyof FieldOptions][providerType] = event.value;
|
this.fieldOptions[field as keyof FieldOptions][providerType] = event.value;
|
||||||
|
|||||||
Reference in New Issue
Block a user