Browse Source

UI: Fixed propagete form

pull/14784/head
ArtemDzhereleiko 9 months ago
parent
commit
b30ec4b123
  1. 3
      ui-ngx/src/app/modules/home/components/calculated-fields/calculated-field.component.ts
  2. 5
      ui-ngx/src/app/modules/home/components/calculated-fields/components/output/calculated-field-output.component.ts

3
ui-ngx/src/app/modules/home/components/calculated-fields/calculated-field.component.ts

@ -121,9 +121,10 @@ export class CalculatedFieldComponent extends EntityComponent<CalculatedFieldsTa
updateForm(entity: CalculatedFieldInfo) {
const { configuration = {} as CalculatedFieldConfiguration, type = CalculatedFieldType.SIMPLE, debugSettings = { failuresEnabled: true, allEnabled: true }, entityId = this.entityId, ...value } = entity ?? {};
const preparedConfig = this.cfFormService.prepareConfig(configuration);
this.entityForm.patchValue({ type }, {emitEvent: true, onlySelf: true});
this.entityForm.patchValue({ type }, {emitEvent: false, onlySelf: true});
setTimeout(() => {
this.entityForm.patchValue({ configuration: preparedConfig, debugSettings, entityId, ...value }, {emitEvent: false});
this.entityForm.get('type').updateValueAndValidity();
});
}

5
ui-ngx/src/app/modules/home/components/calculated-fields/components/output/calculated-field-output.component.ts

@ -186,6 +186,9 @@ export class CalculatedFieldOutputComponent implements ControlValueAccessor, Val
this.toggleScopeByOutputType(this.outputForm.get('type').value);
this.updatedStrategy();
this.updateTimeSeriesTtl(this.outputForm.get('strategy.saveTimeSeries').value);
if (this.outputForm.invalid) {
this.outputForm.updateValueAndValidity();
}
}
}
@ -213,7 +216,7 @@ export class CalculatedFieldOutputComponent implements ControlValueAccessor, Val
private updatedFormWithMode(): void {
if (this.simpleMode && !this.hiddenName) {
this.outputForm.get('name').enable({emitEvent: true});
this.outputForm.get('name').enable({emitEvent: false});
} else {
this.outputForm.get('name').disable({emitEvent: false});
}

Loading…
Cancel
Save