feat(console): delete org (#4837)

Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
Max Peintner
2022-12-22 12:56:13 +01:00
committed by GitHub
parent 0530f19d94
commit 85a0bb0523
9 changed files with 115 additions and 8 deletions

View File

@@ -28,6 +28,10 @@
<button data-e2e="rename" mat-menu-item (click)="renameOrg()">
{{ 'ORG.PAGES.RENAME.ACTION' | translate }}
</button>
<button data-e2e="delete" mat-menu-item (click)="deleteOrg()">
{{ 'ORG.PAGES.DELETE' | translate }}
</button>
</ng-container>
<cnsl-contributors
topContributors

View File

@@ -126,6 +126,44 @@ export class OrgDetailComponent implements OnInit, OnDestroy {
}
}
public deleteOrg(): void {
const mgmtUserData = {
confirmKey: 'ACTIONS.DELETE',
cancelKey: 'ACTIONS.CANCEL',
titleKey: 'ORG.DIALOG.DELETE.TITLE',
warnSectionKey: 'ORG.DIALOG.DELETE.DESCRIPTION',
hintKey: 'ORG.DIALOG.DELETE.TYPENAME',
hintParam: 'ORG.DIALOG.DELETE.DESCRIPTION',
confirmationKey: 'ORG.DIALOG.DELETE.ORGNAME',
confirmation: this.org?.name,
};
if (this.org) {
let dialogRef;
dialogRef = this.dialog.open(WarnDialogComponent, {
data: mgmtUserData,
width: '400px',
});
dialogRef.afterClosed().subscribe((resp) => {
if (resp) {
this.mgmtService
.removeOrg()
.then(() => {
setTimeout(() => {
this.router.navigate(['/orgs']);
}, 1000);
this.toast.showInfo('ORG.TOAST.DELETED', true);
})
.catch((error) => {
this.toast.showError(error);
});
}
});
}
}
private async getData(): Promise<void> {
this.mgmtService
.getMyOrg()