mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-07 07:16:54 +00:00
fix(console): simplify instance page (#7274)
* move settings, rm nav for single org * move instance pages to settings * i18n * revalidate orgs on create * Update bg.json * show custome portal link * Update console/src/app/modules/settings-list/settings.ts Co-authored-by: Livio Spring <livio.a@gmail.com> * Update console/src/app/modules/settings-list/settings.ts Co-authored-by: Livio Spring <livio.a@gmail.com> * Update console/src/app/modules/settings-list/settings.ts Co-authored-by: Livio Spring <livio.a@gmail.com> * add org page to instance settings * iam.read for org list * i18n * instance imgs, cleanup * rm unused imgs * remove unused imgs, replace default settings imgs * event image * e2e url * instance url --------- Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
@@ -140,14 +140,13 @@ export class GrpcAuthService {
|
||||
public zitadelPermissions: BehaviorSubject<string[]> = new BehaviorSubject<string[]>([]);
|
||||
public readonly fetchedZitadelPermissions: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||
|
||||
private cachedOrgs: Org.AsObject[] = [];
|
||||
public cachedOrgs: BehaviorSubject<Org.AsObject[]> = new BehaviorSubject<Org.AsObject[]>([]);
|
||||
private cachedLabelPolicies: { [orgId: string]: LabelPolicy.AsObject } = {};
|
||||
|
||||
constructor(
|
||||
private readonly grpcService: GrpcService,
|
||||
private oauthService: OAuthService,
|
||||
private storage: StorageService,
|
||||
themeService: ThemeService,
|
||||
) {
|
||||
this.zitadelPermissions$.subscribe(this.zitadelPermissions);
|
||||
|
||||
@@ -221,15 +220,14 @@ export class GrpcAuthService {
|
||||
|
||||
public async getActiveOrg(id?: string): Promise<Org.AsObject> {
|
||||
if (id) {
|
||||
const find = this.cachedOrgs.find((tmp) => tmp.id === id);
|
||||
const find = this.cachedOrgs.getValue().find((tmp) => tmp.id === id);
|
||||
if (find) {
|
||||
this.setActiveOrg(find);
|
||||
return Promise.resolve(find);
|
||||
} else {
|
||||
const orgs = (await this.listMyProjectOrgs(10, 0)).resultList;
|
||||
this.cachedOrgs = orgs;
|
||||
|
||||
const toFind = this.cachedOrgs.find((tmp) => tmp.id === id);
|
||||
this.cachedOrgs.next(orgs);
|
||||
const toFind = orgs.find((tmp) => tmp.id === id);
|
||||
if (toFind) {
|
||||
this.setActiveOrg(toFind);
|
||||
return Promise.resolve(toFind);
|
||||
@@ -238,10 +236,10 @@ export class GrpcAuthService {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let orgs = this.cachedOrgs;
|
||||
let orgs = this.cachedOrgs.getValue();
|
||||
if (orgs.length === 0) {
|
||||
orgs = (await this.listMyProjectOrgs()).resultList;
|
||||
this.cachedOrgs = orgs;
|
||||
this.cachedOrgs.next(orgs);
|
||||
}
|
||||
|
||||
const org = this.storage.getItem<Org.AsObject>(StorageKey.organization, StorageLocation.local);
|
||||
@@ -373,6 +371,11 @@ export class GrpcAuthService {
|
||||
return this.grpcService.auth.listMyAuthFactors(new ListMyAuthFactorsRequest(), null).then((resp) => resp.toObject());
|
||||
}
|
||||
|
||||
public async revalidateOrgs() {
|
||||
const orgs = (await this.listMyProjectOrgs()).resultList;
|
||||
this.cachedOrgs.next(orgs);
|
||||
}
|
||||
|
||||
public listMyProjectOrgs(
|
||||
limit?: number,
|
||||
offset?: number,
|
||||
|
||||
Reference in New Issue
Block a user