Browse Source

UI: Fixed calculated fields panel dirty state

pull/14691/head
Vladyslav_Prykhodko 9 months ago
parent
commit
e083aaa4c3
  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/calculated-field-arguments/calculated-field-arguments-table.component.ts
  3. 4
      ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-table.component.ts
  4. 4
      ui-ngx/src/app/modules/home/components/calculated-fields/components/metrics/calculated-field-metrics-table.component.ts
  5. 2
      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

@ -116,10 +116,9 @@ 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: false});
this.entityForm.patchValue({ type }, {emitEvent: false, onlySelf: true});
setTimeout(() => {
this.entityForm.patchValue({ configuration: preparedConfig, debugSettings, entityId, ...value }, {emitEvent: false});
this.entityForm.get('type').updateValueAndValidity({onlySelf: true});
});
}

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

@ -239,7 +239,7 @@ export class CalculatedFieldArgumentsTableComponent implements ControlValueAcces
}
writeValue(argumentsObj: Record<string, CalculatedFieldArgument>): void {
this.argumentsFormArray.clear();
this.argumentsFormArray.clear({emitEvent: false});
this.populateArgumentsFormArray(argumentsObj);
this.updateEntityNameMap(this.argumentsFormArray.value);
}
@ -264,7 +264,8 @@ export class CalculatedFieldArgumentsTableComponent implements ControlValueAcces
};
this.argumentsFormArray.push(this.fb.control(value), { emitEvent: false });
});
this.argumentsFormArray.updateValueAndValidity();
this.updateDataSource(this.argumentsFormArray.value);
// this.argumentsFormArray.updateValueAndValidity({emitEvent: false});
}
private updateEntityNameMap(values: CalculatedFieldArgumentValue[]): void {

4
ui-ngx/src/app/modules/home/components/calculated-fields/components/geofencing-configuration/calculated-field-geofencing-zone-groups-table.component.ts

@ -214,7 +214,7 @@ export class CalculatedFieldGeofencingZoneGroupsTableComponent implements Contro
}
writeValue(zonesObj: Record<string, CalculatedFieldGeofencing>): void {
this.zoneGroupsFormArray.clear();
this.zoneGroupsFormArray.clear({emitEvent: false});
this.populateZonesFormArray(zonesObj);
this.updateEntityNameMap(this.zoneGroupsFormArray.value);
}
@ -231,7 +231,7 @@ export class CalculatedFieldGeofencingZoneGroupsTableComponent implements Contro
};
this.zoneGroupsFormArray.push(this.fb.control(value), { emitEvent: false });
});
this.zoneGroupsFormArray.updateValueAndValidity();
this.updateDataSource(this.zoneGroupsFormArray.value);
}
private updateEntityNameMap(values: CalculatedFieldGeofencingValue[]): void {

4
ui-ngx/src/app/modules/home/components/calculated-fields/components/metrics/calculated-field-metrics-table.component.ts

@ -218,7 +218,7 @@ export class CalculatedFieldMetricsTableComponent implements OnInit, ControlValu
}
writeValue(metrics: Record<string, CalculatedFieldAggMetric>): void {
this.metricsFormArray.clear();
this.metricsFormArray.clear({emitEvent: false});
this.populateZonesFormArray(metrics);
}
@ -230,7 +230,7 @@ export class CalculatedFieldMetricsTableComponent implements OnInit, ControlValu
};
this.metricsFormArray.push(this.fb.control(value), { emitEvent: false });
});
this.metricsFormArray.updateValueAndValidity();
this.updateDataSource(this.metricsFormArray.value);
}
private getSortValue(metric: CalculatedFieldAggMetricValue, column: string): string {

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

@ -253,7 +253,7 @@ export class CalculatedFieldOutputComponent implements ControlValueAccessor, Val
private updateTimeSeriesTtl(value: boolean) {
if (value) {
this.outputForm.get('strategy.useCustomTtl').enable({emitEvent: true});
this.outputForm.get('strategy.useCustomTtl').enable({emitEvent: false});
} else {
this.outputForm.get('strategy.useCustomTtl').disable({emitEvent: false});
this.outputForm.get('strategy.ttl').disable({emitEvent: false});

Loading…
Cancel
Save