Browse Source

Add loading indicator

pull/7982/head
Thomas Kaul 2 weeks ago
parent
commit
0b343f65c5
  1. 11
      apps/client/src/app/components/admin-tag/admin-tag.component.html
  2. 9
      apps/client/src/app/components/admin-tag/admin-tag.component.ts

11
apps/client/src/app/components/admin-tag/admin-tag.component.html

@ -141,6 +141,17 @@
</table> </table>
</div> </div>
@if (isLoading) {
<ngx-skeleton-loader
animation="pulse"
class="px-4 py-3"
[theme]="{
height: '1.5rem',
width: '100%'
}"
/>
}
<mat-paginator <mat-paginator
[class.d-none]="dataSource.data.length <= pageSize" [class.d-none]="dataSource.data.length <= pageSize"
[hidePageSize]="true" [hidePageSize]="true"

9
apps/client/src/app/components/admin-tag/admin-tag.component.ts

@ -40,6 +40,7 @@ import {
trashOutline trashOutline
} from 'ionicons/icons'; } from 'ionicons/icons';
import { DeviceDetectorService } from 'ngx-device-detector'; import { DeviceDetectorService } from 'ngx-device-detector';
import { NgxSkeletonLoaderModule } from 'ngx-skeleton-loader';
import { GfCreateOrUpdateTagDialogComponent } from './create-or-update-tag-dialog/create-or-update-tag-dialog.component'; import { GfCreateOrUpdateTagDialogComponent } from './create-or-update-tag-dialog/create-or-update-tag-dialog.component';
import { CreateOrUpdateTagDialogParams } from './create-or-update-tag-dialog/interfaces/interfaces'; import { CreateOrUpdateTagDialogParams } from './create-or-update-tag-dialog/interfaces/interfaces';
@ -54,6 +55,7 @@ import { CreateOrUpdateTagDialogParams } from './create-or-update-tag-dialog/int
MatPaginatorModule, MatPaginatorModule,
MatSortModule, MatSortModule,
MatTableModule, MatTableModule,
NgxSkeletonLoaderModule,
RouterModule RouterModule
], ],
selector: 'gf-admin-tag', selector: 'gf-admin-tag',
@ -74,6 +76,8 @@ export class GfAdminTagComponent implements OnInit {
'total', 'total',
'actions' 'actions'
]; ];
protected isLoading = false;
protected readonly isSystemTag = isSystemTag; protected readonly isSystemTag = isSystemTag;
protected readonly pageSize = DEFAULT_PAGE_SIZE; protected readonly pageSize = DEFAULT_PAGE_SIZE;
protected tags: TagWithAccountAndActivityCount[]; protected tags: TagWithAccountAndActivityCount[];
@ -82,6 +86,7 @@ export class GfAdminTagComponent implements OnInit {
private readonly deviceType = computed( private readonly deviceType = computed(
() => this.deviceDetectorService.deviceInfo().deviceType () => this.deviceDetectorService.deviceInfo().deviceType
); );
private readonly paginator = viewChild.required(MatPaginator); private readonly paginator = viewChild.required(MatPaginator);
private readonly sort = viewChild.required(MatSort); private readonly sort = viewChild.required(MatSort);
@ -163,6 +168,8 @@ export class GfAdminTagComponent implements OnInit {
} }
private fetchTags() { private fetchTags() {
this.isLoading = true;
this.dataService this.dataService
.fetchTags() .fetchTags()
.pipe(takeUntilDestroyed(this.destroyRef)) .pipe(takeUntilDestroyed(this.destroyRef))
@ -185,6 +192,8 @@ export class GfAdminTagComponent implements OnInit {
this.dataService.updateInfo(); this.dataService.updateInfo();
this.isLoading = false;
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();
}); });
} }

Loading…
Cancel
Save