Browse Source

Implemented set entityId

pull/12509/head
mpetrov 2 years ago
parent
commit
ea7e6797ed
  1. 22
      ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table.component.ts
  2. 5
      ui-ngx/src/app/shared/models/calculated-field.models.ts

22
ui-ngx/src/app/modules/home/components/calculated-fields/calculated-fields-table.component.ts

@ -47,14 +47,23 @@ import { CalculatedFieldsService } from '@core/http/calculated-fields.service';
}) })
export class CalculatedFieldsTableComponent implements OnInit { export class CalculatedFieldsTableComponent implements OnInit {
@Input() entityId: EntityId; @Input()
set entityId(entityId: EntityId) {
if (this.entityIdValue !== entityId) {
this.entityIdValue = entityId;
this.entitiesTable.resetSortAndFilter(this.activeValue);
if (!this.activeValue) {
this.hasInitialized = true;
}
}
}
@Input() @Input()
set active(active: boolean) { set active(active: boolean) {
if (this.activeValue !== active) { if (this.activeValue !== active) {
this.activeValue = active; this.activeValue = active;
if (this.activeValue && this.dirtyValue) { if (this.activeValue && this.hasInitialized) {
this.dirtyValue = false; this.hasInitialized = false;
this.entitiesTable.updateData(); this.entitiesTable.updateData();
} }
} }
@ -65,7 +74,8 @@ export class CalculatedFieldsTableComponent implements OnInit {
calculatedFieldsTableConfig: CalculatedFieldsTableConfig; calculatedFieldsTableConfig: CalculatedFieldsTableConfig;
private activeValue = false; private activeValue = false;
private dirtyValue = false; private hasInitialized = false;
private entityIdValue: EntityId;
constructor(private calculatedFieldsService: CalculatedFieldsService, constructor(private calculatedFieldsService: CalculatedFieldsService,
private entityService: EntityService, private entityService: EntityService,
@ -83,7 +93,7 @@ export class CalculatedFieldsTableComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.dirtyValue = !this.activeValue; this.hasInitialized = !this.activeValue;
this.calculatedFieldsTableConfig = new CalculatedFieldsTableConfig( this.calculatedFieldsTableConfig = new CalculatedFieldsTableConfig(
this.calculatedFieldsService, this.calculatedFieldsService,
@ -91,7 +101,7 @@ export class CalculatedFieldsTableComponent implements OnInit {
this.dialogService, this.dialogService,
this.translate, this.translate,
this.dialog, this.dialog,
this.entityId, this.entityIdValue,
this.store, this.store,
this.viewContainerRef, this.viewContainerRef,
this.overlay, this.overlay,

5
ui-ngx/src/app/shared/models/calculated-field.models.ts

@ -17,13 +17,10 @@ import { EntityDebugSettings, HasTenantId, HasVersion } from '@shared/models/ent
import { BaseData } from '@shared/models/base-data'; import { BaseData } from '@shared/models/base-data';
import { CalculatedFieldId } from '@shared/models/id/calculated-field-id'; import { CalculatedFieldId } from '@shared/models/id/calculated-field-id';
export interface CalculatedField extends BaseData<CalculatedFieldId>, HasVersion, HasTenantId { export interface CalculatedField extends Omit<BaseData<CalculatedFieldId>, 'label'>, HasVersion, HasTenantId {
entityId: string;
type: CalculatedFieldType; type: CalculatedFieldType;
name: string;
debugSettings?: EntityDebugSettings; debugSettings?: EntityDebugSettings;
externalId?: string; externalId?: string;
createdTime?: number;
configuration: CalculatedFieldConfiguration; configuration: CalculatedFieldConfiguration;
} }

Loading…
Cancel
Save