mirror of
https://github.com/zitadel/zitadel.git
synced 2025-03-01 03:07:22 +00:00
feat(console): delete org (#4837)
Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
parent
0530f19d94
commit
85a0bb0523
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
@ -312,6 +312,7 @@ import {
|
||||
RemoveOrgMemberResponse,
|
||||
RemoveOrgMetadataRequest,
|
||||
RemoveOrgMetadataResponse,
|
||||
RemoveOrgRequest,
|
||||
RemovePersonalAccessTokenRequest,
|
||||
RemovePersonalAccessTokenResponse,
|
||||
RemoveProjectGrantMemberRequest,
|
||||
@ -1469,6 +1470,11 @@ export class ManagementService {
|
||||
return this.grpcService.mgmt.removeUser(req, null).then((resp) => resp.toObject());
|
||||
}
|
||||
|
||||
public removeOrg(): Promise<RemoveUserResponse.AsObject> {
|
||||
const req = new RemoveOrgRequest();
|
||||
return this.grpcService.mgmt.removeOrg(req, null).then((resp) => resp.toObject());
|
||||
}
|
||||
|
||||
public listProjectMembers(
|
||||
projectId: string,
|
||||
limit: number,
|
||||
|
@ -779,6 +779,7 @@
|
||||
"ORGDETAIL_TITLE": "Gebe den Namen und die Domain für die neue Organisation ein.",
|
||||
"ORGDETAIL_TITLE_WITHOUT_DOMAIN": "Geben Sie den Namen der neuen Organisation ein.",
|
||||
"ORGDETAILUSER_TITLE": "Organisationsbesitzer hinzufügen",
|
||||
"DELETE": "Organisation löschen",
|
||||
"RENAME": {
|
||||
"ACTION": "Umbenennen",
|
||||
"TITLE": "Organisation umbenennen",
|
||||
@ -845,7 +846,9 @@
|
||||
"MEMBERADDED": "Manager hinzugefügt.",
|
||||
"MEMBERREMOVED": "Manager entfernt.",
|
||||
"MEMBERCHANGED": "Manager geändert.",
|
||||
"SETPRIMARY": "Primäre Domain gesetzt."
|
||||
"SETPRIMARY": "Primäre Domain gesetzt.",
|
||||
"DELETED": "Organisation erfolgreich gelöscht",
|
||||
"ORG_WAS_DELETED": "Organisation wurde gelöscht."
|
||||
},
|
||||
"DIALOG": {
|
||||
"DEACTIVATE": {
|
||||
@ -855,6 +858,13 @@
|
||||
"REACTIVATE": {
|
||||
"TITLE": "Organisation reaktivieren",
|
||||
"DESCRIPTION": "Sie sind im Begriff Ihre Organisation zu reaktivieren. User können Sich danach wieder anmelden? Wollen Sie fortfahren?"
|
||||
},
|
||||
"DELETE": {
|
||||
"TITLE": "Organisation löschen",
|
||||
"DESCRIPTION": "Sie sind im Begriff Ihre Organisation endgültig zu löschen. Damit wird ein Prozess eingeleitet, bei dem alle organisationsbezogenen Daten gelöscht werden. Diese Aktion kann vorerst nicht rückgängig gemacht werden!",
|
||||
"TYPENAME": "Wiederholen Sie '{{value}}', um den Benutzer zu löschen.",
|
||||
"ORGNAME": "Loginname",
|
||||
"BTN": "Endgültig löschen"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -779,6 +779,7 @@
|
||||
"ORGDETAIL_TITLE": "Enter the name and domain of your new organization.",
|
||||
"ORGDETAIL_TITLE_WITHOUT_DOMAIN": "Enter the name of your new organization.",
|
||||
"ORGDETAILUSER_TITLE": "Configure Organization Owner",
|
||||
"DELETE": "Delete organization",
|
||||
"RENAME": {
|
||||
"ACTION": "Rename",
|
||||
"TITLE": "Rename Organization",
|
||||
@ -845,7 +846,9 @@
|
||||
"MEMBERADDED": "Manager added.",
|
||||
"MEMBERREMOVED": "Manager removed.",
|
||||
"MEMBERCHANGED": "Manager changed.",
|
||||
"SETPRIMARY": "Primary domain set."
|
||||
"SETPRIMARY": "Primary domain set.",
|
||||
"DELETED": "Organisation deleted successfully",
|
||||
"ORG_WAS_DELETED": "Organisation has been deleted."
|
||||
},
|
||||
"DIALOG": {
|
||||
"DEACTIVATE": {
|
||||
@ -855,6 +858,13 @@
|
||||
"REACTIVATE": {
|
||||
"TITLE": "Reactivate organization",
|
||||
"DESCRIPTION": "You are about to reactivate your organization. Users will be able to login again. Are you sure to proceed?"
|
||||
},
|
||||
"DELETE": {
|
||||
"TITLE": "Delete organization",
|
||||
"DESCRIPTION": "You are about to delete your organization. This initiates a process where all organization related data will be deleted. You can not revert this action as for now.",
|
||||
"TYPENAME": "Type '{{value}}', to delete your organization.",
|
||||
"ORGNAME": "Name",
|
||||
"BTN": "Delete"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -779,6 +779,7 @@
|
||||
"ORGDETAIL_TITLE": "Saisissez le nom et le domaine de votre nouvelle organisation.",
|
||||
"ORGDETAIL_TITLE_WITHOUT_DOMAIN": "Saisissez le nom de votre nouvelle organisation.",
|
||||
"ORGDETAILUSER_TITLE": "Configurer le propriétaire de l'organisation",
|
||||
"DELETE": "Supprimer l'organisation",
|
||||
"RENAME": {
|
||||
"ACTION": "Renommer",
|
||||
"TITLE": "Renommer l'organisation",
|
||||
@ -845,7 +846,9 @@
|
||||
"MEMBERADDED": "Gestionnaire ajouté.",
|
||||
"MEMBERREMOVED": "Gestionnaire supprimé.",
|
||||
"MEMBERCHANGED": "Gestionnaire modifié.",
|
||||
"SETPRIMARY": "Domaine primaire défini."
|
||||
"SETPRIMARY": "Domaine primaire défini.",
|
||||
"DELETED": "Organisation supprimée avec succès",
|
||||
"ORG_WAS_DELETED": "L'organisation a été supprimée"
|
||||
},
|
||||
"DIALOG": {
|
||||
"DEACTIVATE": {
|
||||
@ -855,6 +858,13 @@
|
||||
"REACTIVATE": {
|
||||
"TITLE": "Réactiver l'organisation",
|
||||
"DESCRIPTION": "Vous êtes sur le point de réactiver votre organisation. Les utilisateurs peuvent ensuite se reconnecter ? Voulez-vous continuer ?"
|
||||
},
|
||||
"DELETE": {
|
||||
"TITLE": "Supprimer l'organisation",
|
||||
"DESCRIPTION": "Vous êtes sur le point de supprimer votre organisation. Cela déclenche un processus au cours duquel toutes les données relatives à l'organisation seront supprimées. Vous ne pouvez pas revenir sur cette action pour le moment.",
|
||||
"TYPENAME": "Tapez '{{value}}', pour supprimer votre organisation.",
|
||||
"ORGNAME": "Nom",
|
||||
"BTN": "Supprimer"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -757,7 +757,8 @@
|
||||
"ROLEREMOVED": "Ruolo rimosso.",
|
||||
"ROLECHANGED": "Ruolo cambiato.",
|
||||
"REACTIVATED": "Riattivato",
|
||||
"DEACTIVATED": "Disattivato"
|
||||
"DEACTIVATED": "Disattivato",
|
||||
"DELETED": "Organizzazione cancellata con successo"
|
||||
}
|
||||
},
|
||||
"ORG": {
|
||||
@ -779,6 +780,7 @@
|
||||
"ORGDETAIL_TITLE": "Inserisci il nome e il dominio della tua nuova organizzazione.",
|
||||
"ORGDETAIL_TITLE_WITHOUT_DOMAIN": "Inserisci il nome della tua nuova organizzazione.",
|
||||
"ORGDETAILUSER_TITLE": "Configurare il proprietario dell'organizzazione",
|
||||
"DELETE": "Elimina organizzazione",
|
||||
"RENAME": {
|
||||
"ACTION": "Rinomina",
|
||||
"TITLE": "Rinomina organizzazione",
|
||||
@ -845,7 +847,9 @@
|
||||
"MEMBERADDED": "Manager aggiunto con successo",
|
||||
"MEMBERREMOVED": "Manager rimosso con successo",
|
||||
"MEMBERCHANGED": "Manager cambiato con successo",
|
||||
"SETPRIMARY": "Dominio primario cambiato con successo"
|
||||
"SETPRIMARY": "Dominio primario cambiato con successo",
|
||||
"DELETED": "Organizzazione eliminata con successo",
|
||||
"ORG_WAS_DELETED": "Organizzazione è stata eliminata"
|
||||
},
|
||||
"DIALOG": {
|
||||
"DEACTIVATE": {
|
||||
@ -855,6 +859,13 @@
|
||||
"REACTIVATE": {
|
||||
"TITLE": "Riattivare l'organizzazione",
|
||||
"DESCRIPTION": "Stai per riattivare la tua organizzazione. Utenti dell' organizzazione possono accedere nuovamente dopo l'attivazione. Vuoi procedere?"
|
||||
},
|
||||
"DELETE": {
|
||||
"TITLE": "Elimina organizzazione",
|
||||
"DESCRIPTION": "Si sta per eliminare l'organizzazione. In questo modo si avvia un processo di eliminazione di tutti i dati relativi all'organizzazione. Per il momento non è possibile annullare questa azione.",
|
||||
"TYPENAME": "Inserisci '{{value}}' nel campo, per cancellare l'organizzazione.",
|
||||
"ORGNAME": "Nome",
|
||||
"BTN": "Elimina"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -779,6 +779,7 @@
|
||||
"ORGDETAIL_TITLE": "输入新组织的名称和域名。",
|
||||
"ORGDETAIL_TITLE_WITHOUT_DOMAIN": "输入新组织的名称。",
|
||||
"ORGDETAILUSER_TITLE": "配置组织所有者",
|
||||
"DELETE": "删除组织",
|
||||
"RENAME": {
|
||||
"ACTION": "改名",
|
||||
"TITLE": "重命名组织",
|
||||
@ -845,7 +846,9 @@
|
||||
"MEMBERADDED": "管理者已添加。",
|
||||
"MEMBERREMOVED": "管理者已删除。",
|
||||
"MEMBERCHANGED": "管理者以改变。",
|
||||
"SETPRIMARY": "已设为主域名。"
|
||||
"SETPRIMARY": "已设为主域名。",
|
||||
"DELETED": "成功删除的组织",
|
||||
"ORG_WAS_DELETED": "组织被删除"
|
||||
},
|
||||
"DIALOG": {
|
||||
"DEACTIVATE": {
|
||||
@ -855,6 +858,13 @@
|
||||
"REACTIVATE": {
|
||||
"TITLE": "重新启用组织",
|
||||
"DESCRIPTION": "您即将重新启用您的组织。用户将能够再次登录。你确定要继续吗?"
|
||||
},
|
||||
"DELETE": {
|
||||
"TITLE": "删除组织",
|
||||
"DESCRIPTION": "你即将删除你的组织。这将启动一个过程,所有与组织有关的数据将被删除。你现在还不能恢复这一行动。",
|
||||
"TYPENAME": "键入'{价值}',以删除您的组织。",
|
||||
"ORGNAME": "组织名称",
|
||||
"BTN": "删除"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user