mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-20 03:48:47 +00:00
fix(console): reduce initial load time (#8273)
This reduces the initial payload of the `listMyProjectOrgs` to get the active org by setting the limit of the initial orgs to 100. Partial of #8272 --------- Co-authored-by: Livio Spring <[email protected]>
This commit is contained in:
co-authored by
Livio Spring
parent
0e99c8356a
commit
215dbf0cf6
+3
-3
@@ -4,7 +4,7 @@
|
||||
<cnsl-refresh-table
|
||||
[loading]="dataSource.loading$ | async"
|
||||
*ngIf="projectId"
|
||||
(refreshed)="loadGrantsPage()"
|
||||
(refreshed)="refreshPage()"
|
||||
[dataSize]="dataSource.totalResult"
|
||||
[selection]="selection"
|
||||
[timestamp]="dataSource.viewTimestamp"
|
||||
@@ -154,11 +154,11 @@
|
||||
<cnsl-paginator
|
||||
class="paginator"
|
||||
#paginator
|
||||
[pageSize]="50"
|
||||
[pageSize]="INITIAL_PAGESIZE"
|
||||
[timestamp]="dataSource.viewTimestamp"
|
||||
[pageSizeOptions]="[25, 50, 100, 250]"
|
||||
[length]="dataSource.totalResult"
|
||||
(page)="loadGrantsPage($event.pageIndex, $event.pageSize)"
|
||||
(page)="loadGrantsPage($event)"
|
||||
>
|
||||
</cnsl-paginator>
|
||||
</cnsl-refresh-table>
|
||||
|
||||
+12
-11
@@ -6,7 +6,7 @@ import { MatSelectChange } from '@angular/material/select';
|
||||
import { MatTable } from '@angular/material/table';
|
||||
import { Router } from '@angular/router';
|
||||
import { tap } from 'rxjs/operators';
|
||||
import { PaginatorComponent } from 'src/app/modules/paginator/paginator.component';
|
||||
import { PageEvent, PaginatorComponent } from 'src/app/modules/paginator/paginator.component';
|
||||
import { WarnDialogComponent } from 'src/app/modules/warn-dialog/warn-dialog.component';
|
||||
import { GrantedProject, ProjectGrantState, Role } from 'src/app/proto/generated/zitadel/project_pb';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
@@ -14,8 +14,6 @@ import { ToastService } from 'src/app/services/toast.service';
|
||||
|
||||
import { ProjectGrantsDataSource } from './project-grants-datasource';
|
||||
|
||||
const ROUTEPARAM = 'projectid';
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-project-grants',
|
||||
templateUrl: './project-grants.component.html',
|
||||
@@ -28,7 +26,9 @@ const ROUTEPARAM = 'projectid';
|
||||
]),
|
||||
],
|
||||
})
|
||||
export class ProjectGrantsComponent implements OnInit, AfterViewInit {
|
||||
export class ProjectGrantsComponent implements OnInit {
|
||||
public INITIAL_PAGESIZE: number = 10;
|
||||
|
||||
@Input() public projectId: string = '';
|
||||
@ViewChild(PaginatorComponent) public paginator!: PaginatorComponent;
|
||||
@ViewChild(MatTable) public table!: MatTable<GrantedProject.AsObject>;
|
||||
@@ -51,16 +51,12 @@ export class ProjectGrantsComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
|
||||
public ngOnInit(): void {
|
||||
this.dataSource.loadGrants(this.projectId, 0, 25, 'asc');
|
||||
this.dataSource.loadGrants(this.projectId, 0, this.INITIAL_PAGESIZE);
|
||||
this.getRoleOptions(this.projectId);
|
||||
}
|
||||
|
||||
public ngAfterViewInit(): void {
|
||||
this.paginator.page.pipe(tap(() => this.loadGrantsPage())).subscribe();
|
||||
}
|
||||
|
||||
public loadGrantsPage(pageIndex?: number, pageSize?: number): void {
|
||||
this.dataSource.loadGrants(this.projectId, pageIndex ?? this.paginator.pageIndex, pageSize ?? this.paginator.pageSize);
|
||||
public loadGrantsPage(event: PageEvent): void {
|
||||
this.dataSource.loadGrants(this.projectId, event.pageIndex, event.pageSize);
|
||||
}
|
||||
|
||||
public isAllSelected(): boolean {
|
||||
@@ -92,6 +88,11 @@ export class ProjectGrantsComponent implements OnInit, AfterViewInit {
|
||||
});
|
||||
}
|
||||
|
||||
public refreshPage(): void {
|
||||
this.selection.clear();
|
||||
this.dataSource.loadGrants(this.projectId, this.paginator.pageSize, this.paginator.pageIndex * this.paginator.pageSize);
|
||||
}
|
||||
|
||||
public deleteGrant(grant: GrantedProject.AsObject): void {
|
||||
const dialogRef = this.dialog.open(WarnDialogComponent, {
|
||||
data: {
|
||||
|
||||
Reference in New Issue
Block a user