mirror of
https://github.com/zitadel/zitadel.git
synced 2025-04-23 03:11:32 +00:00

* cli core * update material * imports * schematics * lint * rm ng-qrcode, ngx-quicklink * replace qr code lib * rm shared module as quicklink is removed * lazy loading imports * rm public * chore(deps): bump @grpc/grpc-js from 1.7.1 to 1.8.0 in /console (#4857) Bumps [@grpc/grpc-js](https://github.com/grpc/grpc-node) from 1.7.1 to 1.8.0. - [Release notes](https://github.com/grpc/grpc-node/releases) - [Commits](https://github.com/grpc/grpc-node/compare/v1.7.1...@grpc/grpc-js@1.8.0) --- updated-dependencies: - dependency-name: "@grpc/grpc-js" dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump libphonenumber-js from 1.10.13 to 1.10.15 in /console (#4861) Bumps [libphonenumber-js](https://gitlab.com/catamphetamine/libphonenumber-js) from 1.10.13 to 1.10.15. - [Release notes](https://gitlab.com/catamphetamine/libphonenumber-js/tags) - [Changelog](https://gitlab.com/catamphetamine/libphonenumber-js/blob/master/CHANGELOG.md) - [Commits](https://gitlab.com/catamphetamine/libphonenumber-js/compare/v1.10.13...v1.10.15) --- updated-dependencies: - dependency-name: libphonenumber-js dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * rxjs * chore(deps): bump engine.io from 6.2.0 to 6.2.1 in /console (#4734) Bumps [engine.io](https://github.com/socketio/engine.io) from 6.2.0 to 6.2.1. - [Release notes](https://github.com/socketio/engine.io/releases) - [Changelog](https://github.com/socketio/engine.io/blob/main/CHANGELOG.md) - [Commits](https://github.com/socketio/engine.io/compare/6.2.0...6.2.1) --- updated-dependencies: - dependency-name: engine.io dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * lock * lint * rm comments * tsconfig ES2022 * get rid of polyfills file * use node 18 * rm age policy, legacy components * packages * build beta prerelease * remove pre-release build Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Florian Forster <florian@zitadel.com> Co-authored-by: Livio Spring <livio.a@gmail.com>
117 lines
3.8 KiB
TypeScript
117 lines
3.8 KiB
TypeScript
import { Component } from '@angular/core';
|
|
import { MatLegacyDialog as MatDialog } from '@angular/material/legacy-dialog';
|
|
import { Router } from '@angular/router';
|
|
import { BehaviorSubject, from, Observable, of } from 'rxjs';
|
|
import { catchError, finalize, map } from 'rxjs/operators';
|
|
import { CreationType, MemberCreateDialogComponent } from 'src/app/modules/add-member-dialog/member-create-dialog.component';
|
|
import { PolicyComponentServiceType } from 'src/app/modules/policies/policy-component-types.enum';
|
|
import { InstanceDetail, State } from 'src/app/proto/generated/zitadel/instance_pb';
|
|
import { Member } from 'src/app/proto/generated/zitadel/member_pb';
|
|
import { User } from 'src/app/proto/generated/zitadel/user_pb';
|
|
import { AdminService } from 'src/app/services/admin.service';
|
|
import { Breadcrumb, BreadcrumbService, BreadcrumbType } from 'src/app/services/breadcrumb.service';
|
|
import { ToastService } from 'src/app/services/toast.service';
|
|
|
|
@Component({
|
|
selector: 'cnsl-instance',
|
|
templateUrl: './instance.component.html',
|
|
styleUrls: ['./instance.component.scss'],
|
|
})
|
|
export class InstanceComponent {
|
|
public instance?: InstanceDetail.AsObject;
|
|
public PolicyComponentServiceType: any = PolicyComponentServiceType;
|
|
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
|
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
|
public totalMemberResult: number = 0;
|
|
public membersSubject: BehaviorSubject<Member.AsObject[]> = new BehaviorSubject<Member.AsObject[]>([]);
|
|
public State: any = State;
|
|
constructor(
|
|
public adminService: AdminService,
|
|
private dialog: MatDialog,
|
|
private toast: ToastService,
|
|
breadcrumbService: BreadcrumbService,
|
|
private router: Router,
|
|
) {
|
|
this.loadMembers();
|
|
|
|
const instanceBread = new Breadcrumb({
|
|
type: BreadcrumbType.INSTANCE,
|
|
name: 'Instance',
|
|
routerLink: ['/instance'],
|
|
});
|
|
|
|
breadcrumbService.setBreadcrumb([instanceBread]);
|
|
|
|
this.adminService
|
|
.getMyInstance()
|
|
.then((instanceResp) => {
|
|
if (instanceResp.instance) {
|
|
this.instance = instanceResp.instance;
|
|
}
|
|
})
|
|
.catch((error) => {
|
|
this.toast.showError(error);
|
|
});
|
|
}
|
|
|
|
public loadMembers(): void {
|
|
this.loadingSubject.next(true);
|
|
from(this.adminService.listIAMMembers(100, 0))
|
|
.pipe(
|
|
map((resp) => {
|
|
if (resp.details?.totalResult) {
|
|
this.totalMemberResult = resp.details.totalResult;
|
|
} else {
|
|
this.totalMemberResult = 0;
|
|
}
|
|
return resp.resultList;
|
|
}),
|
|
catchError(() => of([])),
|
|
finalize(() => this.loadingSubject.next(false)),
|
|
)
|
|
.subscribe((members) => {
|
|
this.membersSubject.next(members);
|
|
});
|
|
}
|
|
|
|
public openAddMember(): void {
|
|
const dialogRef = this.dialog.open(MemberCreateDialogComponent, {
|
|
data: {
|
|
creationType: CreationType.IAM,
|
|
},
|
|
width: '400px',
|
|
});
|
|
|
|
dialogRef.afterClosed().subscribe((resp) => {
|
|
if (resp) {
|
|
const users: User.AsObject[] = resp.users;
|
|
const roles: string[] = resp.roles;
|
|
|
|
if (users && users.length && roles && roles.length) {
|
|
Promise.all(
|
|
users.map((user) => {
|
|
return this.adminService.addIAMMember(user.id, roles);
|
|
}),
|
|
)
|
|
.then(() => {
|
|
this.toast.showInfo('IAM.TOAST.MEMBERADDED', true);
|
|
setTimeout(() => {
|
|
this.loadMembers();
|
|
}, 1000);
|
|
})
|
|
.catch((error) => {
|
|
this.toast.showError(error);
|
|
setTimeout(() => {
|
|
this.loadMembers();
|
|
}, 1000);
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
public showDetail(): void {
|
|
this.router.navigate(['/instance', 'members']);
|
|
}
|
|
}
|