diff --git a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html index c751531881..bad9561383 100644 --- a/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html +++ b/ui-ngx/src/app/modules/home/components/entity/entities-table.component.html @@ -225,9 +225,12 @@ 'tb-current-entity': dataSource.isCurrentEntity(entity)}" *matRowDef="let entity; columns: displayedColumns;" (click)="onRowClick($event, entity)"> - {{ translations.noEntities | translate }} + {{ 'common.loading' | translate }} { if (entity) { this.updateData(); + this.entitiesTableConfig.entityAdded(entity); } } ); @@ -352,6 +353,7 @@ export class EntitiesTableComponent extends PageComponent implements AfterViewIn onEntityUpdated(entity: BaseData) { this.updateData(false); + this.entitiesTableConfig.entityUpdated(entity); } onEntityAction(action: EntityAction>) { @@ -375,6 +377,7 @@ export class EntitiesTableComponent extends PageComponent implements AfterViewIn this.entitiesTableConfig.deleteEntity(entity.id).subscribe( () => { this.updateData(); + this.entitiesTableConfig.entitiesDeleted([entity.id]); } ); } @@ -402,6 +405,7 @@ export class EntitiesTableComponent extends PageComponent implements AfterViewIn forkJoin(tasks).subscribe( () => { this.updateData(); + this.entitiesTableConfig.entitiesDeleted(entities.map((e) => e.id)); } ); } diff --git a/ui-ngx/src/app/modules/home/models/datasource/entity-datasource.ts b/ui-ngx/src/app/modules/home/models/datasource/entity-datasource.ts index 53ca40ebbb..4593ed2822 100644 --- a/ui-ngx/src/app/modules/home/models/datasource/entity-datasource.ts +++ b/ui-ngx/src/app/modules/home/models/datasource/entity-datasource.ts @@ -35,6 +35,8 @@ export class EntitiesDataSource, P extends PageLink = public currentEntity: T = null; + public dataLoading = true; + constructor(private fetchFunction: EntitiesFetchFunction, protected selectionEnabledFunction: EntityBooleanFunction, protected dataLoadedFunction: (col?: number, row?: number) => void) {} @@ -56,6 +58,7 @@ export class EntitiesDataSource, P extends PageLink = } loadEntities(pageLink: P): Observable> { + this.dataLoading = true; const result = new ReplaySubject>(); this.fetchFunction(pageLink).pipe( tap(() => { @@ -68,6 +71,7 @@ export class EntitiesDataSource, P extends PageLink = this.pageDataSubject.next(pageData); result.next(pageData); this.dataLoadedFunction(); + this.dataLoading = false; } ); return result; diff --git a/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts b/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts index 13b9c5eacc..9a75cf8ee9 100644 --- a/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts +++ b/ui-ngx/src/app/modules/home/models/entity/entities-table-config.models.ts @@ -33,6 +33,8 @@ import { EntityTabsComponent } from '../../components/entity/entity-tabs.compone export type EntityBooleanFunction> = (entity: T) => boolean; export type EntityStringFunction> = (entity: T) => string; +export type EntityVoidFunction> = (entity: T) => void; +export type EntityIdsVoidFunction> = (ids: HasUUID[]) => void; export type EntityCountStringFunction = (count: number) => string; export type EntityTwoWayOperation> = (entity: T) => Observable; export type EntityByIdOperation> = (id: HasUUID) => Observable; @@ -175,6 +177,9 @@ export class EntityTableConfig, P extends PageLink = P onEntityAction: EntityActionFunction = () => false; handleRowClick: EntityRowClickFunction = () => false; entityTitle: EntityStringFunction = (entity) => entity?.name; + entityAdded: EntityVoidFunction = () => {}; + entityUpdated: EntityVoidFunction = () => {}; + entitiesDeleted: EntityIdsVoidFunction = () => {}; } export function checkBoxCell(value: boolean): string { diff --git a/ui-ngx/src/app/shared/components/nav-tree.component.ts b/ui-ngx/src/app/shared/components/nav-tree.component.ts index 59ccd8b52f..fb1efa4b9e 100644 --- a/ui-ngx/src/app/shared/components/nav-tree.component.ts +++ b/ui-ngx/src/app/shared/components/nav-tree.component.ts @@ -43,7 +43,7 @@ export interface NavTreeEditCallbacks { nodeIsLoaded?: (id: string) => boolean; refreshNode?: (id: string) => void; updateNode?: (id: string, newName: string) => void; - createNode?: (parentId: string, node: NavTreeNode, pos: number) => void; + createNode?: (parentId: string, node: NavTreeNode, pos: number | string) => void; deleteNode?: (id: string) => void; disableNode?: (id: string) => void; enableNode?: (id: string) => void; diff --git a/ui-ngx/src/assets/locale/locale.constant-en_US.json b/ui-ngx/src/assets/locale/locale.constant-en_US.json index 6c475a25e0..3112cba1af 100644 --- a/ui-ngx/src/assets/locale/locale.constant-en_US.json +++ b/ui-ngx/src/assets/locale/locale.constant-en_US.json @@ -380,7 +380,8 @@ "enter-username": "Enter username", "enter-password": "Enter password", "enter-search": "Enter search", - "created-time": "Created time" + "created-time": "Created time", + "loading": "Loading..." }, "content-type": { "json": "Json",