Browse Source

OPC-UA Data mapping crushing on creating empty connector fix

pull/11174/head
mpetrov 2 years ago
parent
commit
474162bb05
  1. 16
      ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/mapping-table/mapping-table.component.ts

16
ui-ngx/src/app/modules/home/components/widget/lib/gateway/connectors-configuration/mapping-table/mapping-table.component.ts

@ -33,6 +33,7 @@ import { debounceTime, distinctUntilChanged, map, take, takeUntil } from 'rxjs/o
import {
ControlValueAccessor,
FormBuilder,
FormGroup,
NG_VALIDATORS,
NG_VALUE_ACCESSOR,
UntypedFormArray,
@ -206,13 +207,26 @@ export class MappingTableComponent implements ControlValueAccessor, Validator, A
if (isDefinedAndNotNull(index)) {
this.mappingFormGroup.at(index).patchValue(res);
} else {
this.mappingFormGroup.push(this.fb.group(res));
this.mappingFormGroup.push(this.getMappedDialogDataFormGroup(res));
}
this.mappingFormGroup.markAsDirty();
}
});
}
private getMappedDialogDataFormGroup(mappingValue: MappingValue): FormGroup {
Object.keys(mappingValue).forEach(key => {
if (Array.isArray(mappingValue[key])) {
mappingValue = {
...mappingValue,
[key]: this.fb.control(mappingValue[key]),
};
}
});
return this.fb.group(mappingValue);
}
private updateTableData(value: ConnectorMapping[], textSearch?: string): void {
let tableValue = value.map(mappingValue => this.getMappingValue(mappingValue));
if (textSearch) {

Loading…
Cancel
Save