Entity model, workflow updates

This commit is contained in:
Adina Țeudan 2021-11-01 15:21:39 +02:00
parent defdc2af4e
commit 2c3eb9a005
3 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,13 @@
import { IListable } from './listable';
export abstract class Entity<I> implements IListable {
abstract readonly id: string;
abstract readonly routerLink?: string;
abstract readonly searchKey: string;
protected constructor(private readonly _interface: I) {}
isEqual(entity: Entity<I>): boolean {
return JSON.stringify(this._interface) === JSON.stringify(entity?._interface);
}
}

View File

@ -1,3 +1,4 @@
export * from './listable';
export * from './entity.model';
export * from './table-column-config.model';
export * from './listing-modes';

View File

@ -1,5 +1,6 @@
import {
ChangeDetectionStrategy,
ChangeDetectorRef,
Component,
EventEmitter,
forwardRef,
@ -63,6 +64,7 @@ export class WorkflowComponent<T extends IListable, K extends string> extends Au
constructor(
@Inject(forwardRef(() => ListingComponent)) readonly listingComponent: ListingComponent<T>,
private readonly _loadingService: LoadingService,
private readonly _changeRef: ChangeDetectorRef,
readonly listingService: ListingService<T>,
readonly entitiesService: EntitiesService<T>,
) {
@ -152,6 +154,8 @@ export class WorkflowComponent<T extends IListable, K extends string> extends Au
this._addEntity(entity);
}
});
this._changeRef.detectChanges();
}
private _addEntity(entity: T): void {