feat(console): delete org (#4837)

Co-authored-by: Livio Spring <[email protected]>
This commit is contained in:
Max Peintner
2022-12-22 11:56:13 +00:00
committed by GitHub
co-authored by Livio Spring
parent 0530f19d94
commit 85a0bb0523
9 changed files with 115 additions and 8 deletions
@@ -3,6 +3,7 @@ import { Component, Input, ViewChild } from '@angular/core';
import { MatSort, Sort } from '@angular/material/sort';
import { MatTableDataSource } from '@angular/material/table';
import { Router } from '@angular/router';
import { TranslateService } from '@ngx-translate/core';
import { Timestamp } from 'google-protobuf/google/protobuf/timestamp_pb';
import { BehaviorSubject, catchError, finalize, from, map, Observable, of, Subject, switchMap, take, takeUntil } from 'rxjs';
import { Org, OrgFieldName, OrgQuery, OrgState } from 'src/app/proto/generated/zitadel/org_pb';
@@ -56,6 +57,7 @@ export class OrgTableComponent {
private router: Router,
private toast: ToastService,
private _liveAnnouncer: LiveAnnouncer,
private translate: TranslateService,
) {
this.requestOrgs$.next({ limit: this.initialLimit, offset: 0, queries: this.searchQueries });
this.authService.getActiveOrg().then((org) => (this.activeOrg = org));
@@ -134,8 +136,14 @@ export class OrgTableComponent {
}
public setAndNavigateToOrg(org: Org.AsObject): void {
this.authService.setActiveOrg(org);
this.router.navigate(['/org']);
if (org.state !== OrgState.ORG_STATE_REMOVED) {
this.authService.setActiveOrg(org);
this.router.navigate(['/org']);
} else {
this.translate.get('ORG.TOAST.ORG_WAS_DELETED').subscribe((data) => {
this.toast.showInfo(data);
});
}
}
public changePage(): void {