mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-07 06:42:15 +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
+5
-3
@@ -26,6 +26,8 @@ export enum UserTarget {
|
||||
EXTERNAL = 'external',
|
||||
}
|
||||
|
||||
const USER_LIMIT = 25;
|
||||
|
||||
@Component({
|
||||
selector: 'cnsl-search-user-autocomplete',
|
||||
templateUrl: './search-user-autocomplete.component.html',
|
||||
@@ -67,9 +69,9 @@ export class SearchUserAutocompleteComponent implements OnInit, AfterContentChec
|
||||
// feat-3916 show users as soon as I am in the input field of the user
|
||||
const query = new SearchQuery();
|
||||
const lnQuery = new LoginNameQuery();
|
||||
lnQuery.setMethod(TextQueryMethod.TEXT_QUERY_METHOD_CONTAINS_IGNORE_CASE);
|
||||
lnQuery.setMethod(TextQueryMethod.TEXT_QUERY_METHOD_STARTS_WITH_IGNORE_CASE);
|
||||
query.setLoginNameQuery(lnQuery);
|
||||
this.userService.listUsers(10, 0, [query]).then((users) => {
|
||||
this.userService.listUsers(USER_LIMIT, 0, [query]).then((users) => {
|
||||
this.filteredUsers = users.resultList;
|
||||
});
|
||||
|
||||
@@ -97,7 +99,7 @@ export class SearchUserAutocompleteComponent implements OnInit, AfterContentChec
|
||||
query.setLoginNameQuery(lnQuery);
|
||||
|
||||
if (this.target === UserTarget.SELF) {
|
||||
return from(this.userService.listUsers(10, 0, [query]));
|
||||
return from(this.userService.listUsers(USER_LIMIT, 0, [query]));
|
||||
} else {
|
||||
return of();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import { PageEvent, PaginatorComponent } from '../paginator/paginator.component'
|
||||
import { UserGrantRoleDialogComponent } from '../user-grant-role-dialog/user-grant-role-dialog.component';
|
||||
import { WarnDialogComponent } from '../warn-dialog/warn-dialog.component';
|
||||
import { UserGrantContext, UserGrantsDataSource } from './user-grants-datasource';
|
||||
import { Org, OrgState } from 'src/app/proto/generated/zitadel/org_pb';
|
||||
import { Org, OrgIDQuery, OrgQuery, OrgState } from 'src/app/proto/generated/zitadel/org_pb';
|
||||
|
||||
export enum UserGrantListSearchKey {
|
||||
DISPLAY_NAME,
|
||||
@@ -306,17 +306,15 @@ export class UserGrantsComponent implements OnInit, AfterViewInit {
|
||||
}
|
||||
}
|
||||
|
||||
public showUser(grant: UserGrant.AsObject) {
|
||||
const org: Org.AsObject = {
|
||||
id: grant.grantedOrgId,
|
||||
name: grant.grantedOrgName,
|
||||
state: OrgState.ORG_STATE_ACTIVE,
|
||||
primaryDomain: grant.grantedOrgDomain,
|
||||
};
|
||||
public async showUser(grant: UserGrant.AsObject) {
|
||||
const orgQuery = new OrgQuery();
|
||||
const orgIdQuery = new OrgIDQuery();
|
||||
orgIdQuery.setId(grant.grantedOrgId);
|
||||
orgQuery.setIdQuery(orgIdQuery);
|
||||
|
||||
// Check if user has permissions for that org before changing active org
|
||||
if (this.myOrgs.find((org) => org.id === grant.grantedOrgId)) {
|
||||
this.authService.setActiveOrg(org);
|
||||
const orgs = (await this.authService.listMyProjectOrgs(1, 0, [orgQuery])).resultList;
|
||||
if (orgs.length === 1) {
|
||||
this.authService.setActiveOrg(orgs[0]);
|
||||
this.router.navigate(['/users', grant.userId]);
|
||||
} else {
|
||||
this.toast.showInfo('GRANTS.TOAST.CANTSHOWINFO', true);
|
||||
|
||||
Reference in New Issue
Block a user