Browse Source

Task/add loading indicator to platform and tag management of admin panel (#7982)

* Add loading indicator

* Update changelog
pull/7962/head
Thomas Kaul 1 week ago
committed by GitHub
parent
commit
a73809fff1
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      CHANGELOG.md
  2. 11
      apps/client/src/app/components/admin-platform/admin-platform.component.html
  3. 10
      apps/client/src/app/components/admin-platform/admin-platform.component.ts
  4. 11
      apps/client/src/app/components/admin-tag/admin-tag.component.html
  5. 9
      apps/client/src/app/components/admin-tag/admin-tag.component.ts

2
CHANGELOG.md

@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Added a loading indicator to the platform management of the admin control panel
- Added a loading indicator to the tag management of the admin control panel
- Added a _Refresh_ action to the user detail dialog menu in the admin control panel - Added a _Refresh_ action to the user detail dialog menu in the admin control panel
- Added the total column to the table of the tag management in the admin control panel - Added the total column to the table of the tag management in the admin control panel

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

@ -103,6 +103,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"

10
apps/client/src/app/components/admin-platform/admin-platform.component.ts

@ -36,6 +36,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 { GfCreateOrUpdatePlatformDialogComponent } from './create-or-update-platform-dialog/create-or-update-platform-dialog.component'; import { GfCreateOrUpdatePlatformDialogComponent } from './create-or-update-platform-dialog/create-or-update-platform-dialog.component';
import { CreateOrUpdatePlatformDialogParams } from './create-or-update-platform-dialog/interfaces/interfaces'; import { CreateOrUpdatePlatformDialogParams } from './create-or-update-platform-dialog/interfaces/interfaces';
@ -51,6 +52,7 @@ import { CreateOrUpdatePlatformDialogParams } from './create-or-update-platform-
MatPaginatorModule, MatPaginatorModule,
MatSortModule, MatSortModule,
MatTableModule, MatTableModule,
NgxSkeletonLoaderModule,
RouterModule RouterModule
], ],
selector: 'gf-admin-platform', selector: 'gf-admin-platform',
@ -61,6 +63,7 @@ export class GfAdminPlatformComponent implements OnInit {
public readonly locale = input(getLocale()); public readonly locale = input(getLocale());
protected dataSource = new MatTableDataSource<Platform>(); protected dataSource = new MatTableDataSource<Platform>();
protected readonly displayedColumns = [ protected readonly displayedColumns = [
'icon', 'icon',
'name', 'name',
@ -68,12 +71,15 @@ export class GfAdminPlatformComponent implements OnInit {
'accounts', 'accounts',
'actions' 'actions'
]; ];
protected isLoading = false;
protected readonly pageSize = DEFAULT_PAGE_SIZE; protected readonly pageSize = DEFAULT_PAGE_SIZE;
protected platforms: Platform[]; protected platforms: Platform[];
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);
@ -149,6 +155,8 @@ export class GfAdminPlatformComponent implements OnInit {
} }
private fetchPlatforms() { private fetchPlatforms() {
this.isLoading = true;
this.adminService this.adminService
.fetchPlatforms() .fetchPlatforms()
.pipe(takeUntilDestroyed(this.destroyRef)) .pipe(takeUntilDestroyed(this.destroyRef))
@ -162,6 +170,8 @@ export class GfAdminPlatformComponent implements OnInit {
this.dataService.updateInfo(); this.dataService.updateInfo();
this.isLoading = false;
this.changeDetectorRef.markForCheck(); this.changeDetectorRef.markForCheck();
}); });
} }

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