mirror of
https://github.com/zitadel/zitadel.git
synced 2025-05-02 19:10:57 +00:00
fix(console): orgs list is shown empty when org is removed (#7781)
fix:active orgs not shown when org is removed Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
parent
d016379e2a
commit
207b20ff0f
@ -15,6 +15,7 @@ import { Member } from 'src/app/proto/generated/zitadel/member_pb';
|
||||
import { Metadata } from 'src/app/proto/generated/zitadel/metadata_pb';
|
||||
import { Org, OrgState } from 'src/app/proto/generated/zitadel/org_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 { GrpcAuthService } from 'src/app/services/grpc-auth.service';
|
||||
import { ManagementService } from 'src/app/services/mgmt.service';
|
||||
@ -48,6 +49,7 @@ export class OrgDetailComponent implements OnInit, OnDestroy {
|
||||
private auth: GrpcAuthService,
|
||||
private dialog: MatDialog,
|
||||
public mgmtService: ManagementService,
|
||||
private adminService: AdminService,
|
||||
private toast: ToastService,
|
||||
private router: Router,
|
||||
breadcrumbService: BreadcrumbService,
|
||||
@ -146,15 +148,34 @@ export class OrgDetailComponent implements OnInit, OnDestroy {
|
||||
width: '400px',
|
||||
});
|
||||
|
||||
// Before we remove the org we get the current default org
|
||||
// we have to query before the current org is removed
|
||||
dialogRef.afterClosed().subscribe((resp) => {
|
||||
if (resp) {
|
||||
this.mgmtService
|
||||
.removeOrg()
|
||||
.then(() => {
|
||||
setTimeout(() => {
|
||||
this.router.navigate(['/orgs']);
|
||||
}, 1000);
|
||||
this.toast.showInfo('ORG.TOAST.DELETED', true);
|
||||
this.adminService
|
||||
.getDefaultOrg()
|
||||
.then((response) => {
|
||||
const org = response?.org;
|
||||
if (org) {
|
||||
// We now remove the org
|
||||
this.mgmtService
|
||||
.removeOrg()
|
||||
.then(() => {
|
||||
setTimeout(() => {
|
||||
// We change active org to default org as
|
||||
// current org was deleted to avoid Organization doesn't exist
|
||||
this.auth.setActiveOrg(org);
|
||||
// Now we visit orgs
|
||||
this.router.navigate(['/orgs']);
|
||||
}, 1000);
|
||||
this.toast.showInfo('ORG.TOAST.DELETED', true);
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toast.showError(error);
|
||||
});
|
||||
} else {
|
||||
this.toast.showError('ORG.TOAST.DEFAULTORGNOTFOUND', false, true);
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
this.toast.showError(error);
|
||||
|
@ -90,6 +90,8 @@ import {
|
||||
GetDefaultLanguageResponse,
|
||||
GetDefaultLoginTextsRequest,
|
||||
GetDefaultLoginTextsResponse,
|
||||
GetDefaultOrgRequest,
|
||||
GetDefaultOrgResponse,
|
||||
GetDefaultPasswordChangeMessageTextRequest,
|
||||
GetDefaultPasswordChangeMessageTextResponse,
|
||||
GetDefaultPasswordlessRegistrationMessageTextRequest,
|
||||
@ -429,6 +431,11 @@ export class AdminService {
|
||||
this.storageService.getItem('onboarding-dismissed', StorageLocation.local) === 'true' ? true : false;
|
||||
}
|
||||
|
||||
public getDefaultOrg(): Promise<GetDefaultOrgResponse.AsObject> {
|
||||
const req = new GetDefaultOrgRequest();
|
||||
return this.grpcService.admin.getDefaultOrg(req, null).then((resp) => resp.toObject());
|
||||
}
|
||||
|
||||
public setDefaultOrg(orgId: string): Promise<SetDefaultOrgResponse.AsObject> {
|
||||
const req = new SetDefaultOrgRequest();
|
||||
req.setOrgId(orgId);
|
||||
|
@ -353,6 +353,7 @@ import {
|
||||
RemoveOrgMetadataRequest,
|
||||
RemoveOrgMetadataResponse,
|
||||
RemoveOrgRequest,
|
||||
RemoveOrgResponse,
|
||||
RemovePersonalAccessTokenRequest,
|
||||
RemovePersonalAccessTokenResponse,
|
||||
RemoveProjectGrantMemberRequest,
|
||||
@ -1749,7 +1750,7 @@ export class ManagementService {
|
||||
return this.grpcService.mgmt.removeUser(req, null).then((resp) => resp.toObject());
|
||||
}
|
||||
|
||||
public removeOrg(): Promise<RemoveUserResponse.AsObject> {
|
||||
public removeOrg(): Promise<RemoveOrgResponse.AsObject> {
|
||||
const req = new RemoveOrgRequest();
|
||||
return this.grpcService.mgmt.removeOrg(req, null).then((resp) => resp.toObject());
|
||||
}
|
||||
|
@ -1285,6 +1285,7 @@
|
||||
"MEMBERCHANGED": "Сменен управител.",
|
||||
"SETPRIMARY": "Основен набор от домейни.",
|
||||
"DELETED": "Организацията е изтрита успешно",
|
||||
"DEFAULTORGNOTFOUND": "Организацията по подразбиране не беше намерена",
|
||||
"ORG_WAS_DELETED": "Организацията е изтрита."
|
||||
},
|
||||
"DIALOG": {
|
||||
|
@ -1292,6 +1292,7 @@
|
||||
"MEMBERCHANGED": "Manažer změněn.",
|
||||
"SETPRIMARY": "Nastavena primární doména.",
|
||||
"DELETED": "Organizace úspěšně smazána",
|
||||
"DEFAULTORGNOTFOUND": "Výchozí organizace nebyla nalezena",
|
||||
"ORG_WAS_DELETED": "Organizace byla smazána."
|
||||
},
|
||||
"DIALOG": {
|
||||
|
@ -1291,6 +1291,7 @@
|
||||
"MEMBERCHANGED": "Manager geändert.",
|
||||
"SETPRIMARY": "Primäre Domain gesetzt.",
|
||||
"DELETED": "Organisation erfolgreich gelöscht",
|
||||
"DEFAULTORGNOTFOUND": "Die Standardorganisation wurde nicht gefunden",
|
||||
"ORG_WAS_DELETED": "Organisation wurde gelöscht."
|
||||
},
|
||||
"DIALOG": {
|
||||
|
@ -1291,8 +1291,9 @@
|
||||
"MEMBERREMOVED": "Manager removed.",
|
||||
"MEMBERCHANGED": "Manager changed.",
|
||||
"SETPRIMARY": "Primary domain set.",
|
||||
"DELETED": "Organisation deleted successfully",
|
||||
"ORG_WAS_DELETED": "Organisation has been deleted."
|
||||
"DELETED": "Organization deleted successfully",
|
||||
"DEFAULTORGNOTFOUND": "The default organization was not found",
|
||||
"ORG_WAS_DELETED": "Organization has been deleted."
|
||||
},
|
||||
"DIALOG": {
|
||||
"DEACTIVATE": {
|
||||
|
@ -1293,6 +1293,7 @@
|
||||
"MEMBERCHANGED": "Mánager modificado.",
|
||||
"SETPRIMARY": "Dominio primario establecido.",
|
||||
"DELETED": "Organización borrada con éxito",
|
||||
"DEFAULTORGNOTFOUND": "No se encontró la organización por defecto",
|
||||
"ORG_WAS_DELETED": "La organización ha sido borrada."
|
||||
},
|
||||
"DIALOG": {
|
||||
|
@ -1291,6 +1291,7 @@
|
||||
"MEMBERCHANGED": "Gestionnaire modifié.",
|
||||
"SETPRIMARY": "Domaine primaire défini.",
|
||||
"DELETED": "Organisation supprimée avec succès",
|
||||
"DEFAULTORGNOTFOUND": "L'organisation par défaut est introuvable",
|
||||
"ORG_WAS_DELETED": "L'organisation a été supprimée"
|
||||
},
|
||||
"DIALOG": {
|
||||
|
@ -1291,6 +1291,7 @@
|
||||
"MEMBERCHANGED": "Manager cambiato con successo",
|
||||
"SETPRIMARY": "Dominio primario cambiato con successo",
|
||||
"DELETED": "Organizzazione eliminata con successo",
|
||||
"DEFAULTORGNOTFOUND": "Impossibile trovare l'organizzazione predefinita",
|
||||
"ORG_WAS_DELETED": "Organizzazione è stata eliminata"
|
||||
},
|
||||
"DIALOG": {
|
||||
|
@ -1292,6 +1292,7 @@
|
||||
"MEMBERCHANGED": "マネージャーが変更されました。",
|
||||
"SETPRIMARY": "プライマリドメインが設定されました。",
|
||||
"DELETED": "組織が正常に削除されました。",
|
||||
"DEFAULTORGNOTFOUND": "デフォルトの組織が見つかりませんでした",
|
||||
"ORG_WAS_DELETED": "組織が削除されました。"
|
||||
},
|
||||
"DIALOG": {
|
||||
|
@ -1293,6 +1293,7 @@
|
||||
"MEMBERCHANGED": "Променет менаџер.",
|
||||
"SETPRIMARY": "Поставен основен домен.",
|
||||
"DELETED": "Организацијата успешно избришана",
|
||||
"DEFAULTORGNOTFOUND": "Стандардната организација не беше пронајдена",
|
||||
"ORG_WAS_DELETED": "Организацијата е избришана."
|
||||
},
|
||||
"DIALOG": {
|
||||
|
@ -1292,6 +1292,7 @@
|
||||
"MEMBERCHANGED": "Beheerder gewijzigd.",
|
||||
"SETPRIMARY": "Primaire domein ingesteld.",
|
||||
"DELETED": "Organisatie succesvol verwijderd",
|
||||
"DEFAULTORGNOTFOUND": "De standaardorganisatie is niet gevonden",
|
||||
"ORG_WAS_DELETED": "Organisatie is verwijderd."
|
||||
},
|
||||
"DIALOG": {
|
||||
|
@ -1291,6 +1291,7 @@
|
||||
"MEMBERCHANGED": "Zmieniono managera.",
|
||||
"SETPRIMARY": "Ustawiono domenę podstawową.",
|
||||
"DELETED": "Organizacja została usunięta pomyślnie",
|
||||
"DEFAULTORGNOTFOUND": "Nie znaleziono organizacji domyślnej",
|
||||
"ORG_WAS_DELETED": "Organizacja została usunięta."
|
||||
},
|
||||
"DIALOG": {
|
||||
|
@ -1293,6 +1293,7 @@
|
||||
"MEMBERCHANGED": "Gerente alterado.",
|
||||
"SETPRIMARY": "Domínio principal definido.",
|
||||
"DELETED": "Organização excluída com sucesso",
|
||||
"DEFAULTORGNOTFOUND": "A organização padrão não foi encontrada",
|
||||
"ORG_WAS_DELETED": "Organização foi excluída."
|
||||
},
|
||||
"DIALOG": {
|
||||
|
@ -1335,6 +1335,7 @@
|
||||
"MEMBERCHANGED": "Менеджер изменён.",
|
||||
"SETPRIMARY": "Установлен основной домен.",
|
||||
"DELETED": "Организация успешно удалена",
|
||||
"DEFAULTORGNOTFOUND": "Организация по умолчанию не найдена",
|
||||
"ORG_WAS_DELETED": "Организация удалена."
|
||||
},
|
||||
"DIALOG": {
|
||||
|
@ -1291,6 +1291,7 @@
|
||||
"MEMBERCHANGED": "管理者以改变。",
|
||||
"SETPRIMARY": "已设为主域名。",
|
||||
"DELETED": "成功删除的组织",
|
||||
"DEFAULTORGNOTFOUND": "未找到默认组织",
|
||||
"ORG_WAS_DELETED": "组织被删除"
|
||||
},
|
||||
"DIALOG": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user