mirror of
https://github.com/andwati/zitadel.git
synced 2026-11-12 00:55:12 +00:00
* show app redirect issues, action layout * refactor pagination * tos, privacy * new paginator everywhere * layout width and table optim * lint pt1 * lint config, ts * stylelint * chore(deps-dev): bump @angular/cli from 11.2.7 to 11.2.8 in /console (#1566) * fix: remove app name check on ChangeAPIApplication (#1561) * fix: remove app name check on ChangeAPIApplication * fix APIConfigInvalid message * chore(workflow): ignore tags for docs and codecov flows (#1564) * chore(deps-dev): bump @angular/cli from 11.2.7 to 11.2.8 in /console Bumps [@angular/cli](https://github.com/angular/angular-cli) from 11.2.7 to 11.2.8. - [Release notes](https://github.com/angular/angular-cli/releases) - [Commits](https://github.com/angular/angular-cli/compare/v11.2.7...v11.2.8) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Livio Amstutz <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump jasmine-spec-reporter from 6.0.0 to 7.0.0 in /console (#1573) * fix: remove app name check on ChangeAPIApplication (#1561) * fix: remove app name check on ChangeAPIApplication * fix APIConfigInvalid message * chore(workflow): ignore tags for docs and codecov flows (#1564) * chore(deps-dev): bump jasmine-spec-reporter in /console Bumps [jasmine-spec-reporter](https://github.com/bcaudan/jasmine-spec-reporter) from 6.0.0 to 7.0.0. - [Release notes](https://github.com/bcaudan/jasmine-spec-reporter/releases) - [Changelog](https://github.com/bcaudan/jasmine-spec-reporter/blob/master/CHANGELOG.md) - [Commits](https://github.com/bcaudan/jasmine-spec-reporter/compare/v6.0.0...v7.0.0) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Livio Amstutz <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump @angular-devkit/build-angular from 0.1102.7 to 0.1102.8 in /console (#1574) * fix: remove app name check on ChangeAPIApplication (#1561) * fix: remove app name check on ChangeAPIApplication * fix APIConfigInvalid message * chore(workflow): ignore tags for docs and codecov flows (#1564) * chore(deps-dev): bump @angular-devkit/build-angular in /console Bumps [@angular-devkit/build-angular](https://github.com/angular/angular-cli) from 0.1102.7 to 0.1102.8. - [Release notes](https://github.com/angular/angular-cli/releases) - [Commits](https://github.com/angular/angular-cli/commits) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Livio Amstutz <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Max Peintner <[email protected]> * chore(deps): bump @types/file-saver from 2.0.1 to 2.0.2 in /console (#1576) * fix: remove app name check on ChangeAPIApplication (#1561) * fix: remove app name check on ChangeAPIApplication * fix APIConfigInvalid message * chore(workflow): ignore tags for docs and codecov flows (#1564) * chore(deps): bump @types/file-saver from 2.0.1 to 2.0.2 in /console Bumps [@types/file-saver](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/file-saver) from 2.0.1 to 2.0.2. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/file-saver) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Livio Amstutz <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump @angular/language-service from 11.2.8 to 11.2.9 in /console (#1567) * fix: remove app name check on ChangeAPIApplication (#1561) * fix: remove app name check on ChangeAPIApplication * fix APIConfigInvalid message * chore(workflow): ignore tags for docs and codecov flows (#1564) * chore(deps-dev): bump @angular/language-service in /console Bumps [@angular/language-service](https://github.com/angular/angular/tree/HEAD/packages/language-service) from 11.2.8 to 11.2.9. - [Release notes](https://github.com/angular/angular/releases) - [Changelog](https://github.com/angular/angular/blob/master/CHANGELOG.md) - [Commits](https://github.com/angular/angular/commits/11.2.9/packages/language-service) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: Livio Amstutz <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * update protobuf, libphone * chore(deps): bump rxjs from 6.6.3 to 6.6.7 in /console (#1488) Bumps [rxjs](https://github.com/reactivex/rxjs) from 6.6.3 to 6.6.7. - [Release notes](https://github.com/reactivex/rxjs/releases) - [Changelog](https://github.com/ReactiveX/rxjs/blob/6.6.7/CHANGELOG.md) - [Commits](https://github.com/reactivex/rxjs/compare/6.6.3...6.6.7) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump @types/jasmine from 3.6.3 to 3.6.9 in /console (#1485) Bumps [@types/jasmine](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jasmine) from 3.6.3 to 3.6.9. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jasmine) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Max Peintner <[email protected]> * chore(deps-dev): bump jasmine-core from 3.6.0 to 3.7.1 in /console (#1445) Bumps [jasmine-core](https://github.com/jasmine/jasmine) from 3.6.0 to 3.7.1. - [Release notes](https://github.com/jasmine/jasmine/releases) - [Changelog](https://github.com/jasmine/jasmine/blob/main/RELEASE.md) - [Commits](https://github.com/jasmine/jasmine/compare/v3.6.0...v3.7.1) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Max Peintner <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Livio Amstutz <[email protected]>
122 lines
4.9 KiB
TypeScript
122 lines
4.9 KiB
TypeScript
import { SelectionModel } from '@angular/cdk/collections';
|
|
import { Component, Input, OnInit, ViewChild } from '@angular/core';
|
|
import { MatDialog } from '@angular/material/dialog';
|
|
import { MatTableDataSource } from '@angular/material/table';
|
|
import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
|
|
import { BehaviorSubject, Observable } from 'rxjs';
|
|
import { PageEvent, PaginatorComponent } from 'src/app/modules/paginator/paginator.component';
|
|
import { WarnDialogComponent } from 'src/app/modules/warn-dialog/warn-dialog.component';
|
|
import { IDPUserLink } from 'src/app/proto/generated/zitadel/idp_pb';
|
|
|
|
import { GrpcAuthService } from '../../../../services/grpc-auth.service';
|
|
import { ManagementService } from '../../../../services/mgmt.service';
|
|
import { ToastService } from '../../../../services/toast.service';
|
|
|
|
@Component({
|
|
selector: 'app-external-idps',
|
|
templateUrl: './external-idps.component.html',
|
|
styleUrls: ['./external-idps.component.scss'],
|
|
})
|
|
export class ExternalIdpsComponent implements OnInit {
|
|
@Input() service!: GrpcAuthService | ManagementService;
|
|
@Input() userId!: string;
|
|
@ViewChild(PaginatorComponent) public paginator!: PaginatorComponent;
|
|
public totalResult: number = 0;
|
|
public viewTimestamp!: Timestamp.AsObject;
|
|
public dataSource: MatTableDataSource<IDPUserLink.AsObject>
|
|
= new MatTableDataSource<IDPUserLink.AsObject>();
|
|
public selection: SelectionModel<IDPUserLink.AsObject>
|
|
= new SelectionModel<IDPUserLink.AsObject>(true, []);
|
|
private loadingSubject: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
|
public loading$: Observable<boolean> = this.loadingSubject.asObservable();
|
|
@Input() public displayedColumns: string[] = ['idpConfigId', 'idpName', 'externalUserId', 'externalUserDisplayName', 'actions'];
|
|
|
|
constructor(private toast: ToastService, private dialog: MatDialog) { }
|
|
|
|
ngOnInit(): void {
|
|
this.getData(10, 0);
|
|
}
|
|
|
|
public isAllSelected(): boolean {
|
|
const numSelected = this.selection.selected.length;
|
|
const numRows = this.dataSource.data.length;
|
|
return numSelected === numRows;
|
|
}
|
|
|
|
public masterToggle(): void {
|
|
this.isAllSelected() ?
|
|
this.selection.clear() :
|
|
this.dataSource.data.forEach(row => this.selection.select(row));
|
|
}
|
|
|
|
public changePage(event: PageEvent): void {
|
|
this.getData(event.pageSize, event.pageIndex * event.pageSize);
|
|
}
|
|
|
|
private async getData(limit: number, offset: number): Promise<void> {
|
|
this.loadingSubject.next(true);
|
|
|
|
let promise;
|
|
if (this.service instanceof ManagementService) {
|
|
promise = (this.service as ManagementService).listHumanLinkedIDPs(this.userId, limit, offset);
|
|
} else if (this.service instanceof GrpcAuthService) {
|
|
promise = (this.service as GrpcAuthService).listMyLinkedIDPs(limit, offset);
|
|
}
|
|
|
|
if (promise) {
|
|
promise.then(resp => {
|
|
this.dataSource.data = resp.resultList;
|
|
if (resp.details?.viewTimestamp) {
|
|
this.viewTimestamp = resp.details.viewTimestamp;
|
|
}
|
|
if (resp.details?.totalResult) {
|
|
this.totalResult = resp.details?.totalResult;
|
|
}
|
|
this.loadingSubject.next(false);
|
|
}).catch((error: any) => {
|
|
this.toast.showError(error);
|
|
this.loadingSubject.next(false);
|
|
});
|
|
}
|
|
}
|
|
|
|
public refreshPage(): void {
|
|
this.getData(this.paginator.pageSize, this.paginator.pageIndex * this.paginator.pageSize);
|
|
}
|
|
|
|
public removeExternalIdp(idp: IDPUserLink.AsObject): void {
|
|
const dialogRef = this.dialog.open(WarnDialogComponent, {
|
|
data: {
|
|
confirmKey: 'ACTIONS.REMOVE',
|
|
cancelKey: 'ACTIONS.CANCEL',
|
|
titleKey: 'USER.EXTERNALIDP.DIALOG.DELETE_TITLE',
|
|
descriptionKey: 'USER.EXTERNALIDP.DIALOG.DELETE_DESCRIPTION',
|
|
},
|
|
width: '400px',
|
|
});
|
|
|
|
dialogRef.afterClosed().subscribe(resp => {
|
|
if (resp) {
|
|
let promise;
|
|
if (this.service instanceof ManagementService) {
|
|
promise = (this.service as ManagementService)
|
|
.removeHumanLinkedIDP(idp.providedUserId, idp.idpId, idp.userId);
|
|
} else if (this.service instanceof GrpcAuthService) {
|
|
promise = (this.service as GrpcAuthService)
|
|
.removeMyLinkedIDP(idp.providedUserId, idp.idpId);
|
|
}
|
|
|
|
if (promise) {
|
|
promise.then(_ => {
|
|
setTimeout(() => {
|
|
this.refreshPage();
|
|
}, 1000);
|
|
}).catch((error: any) => {
|
|
this.toast.showError(error);
|
|
});
|
|
}
|
|
}
|
|
});
|
|
}
|
|
}
|