diff --git a/apps/red-ui/src/app/components/tenants-menu/tenants-menu.component.html b/apps/red-ui/src/app/components/tenants-menu/tenants-menu.component.html
index f7d745275..66bf2b5f3 100644
--- a/apps/red-ui/src/app/components/tenants-menu/tenants-menu.component.html
+++ b/apps/red-ui/src/app/components/tenants-menu/tenants-menu.component.html
@@ -14,7 +14,6 @@
-
diff --git a/apps/red-ui/src/app/components/tenants-menu/tenants-menu.component.ts b/apps/red-ui/src/app/components/tenants-menu/tenants-menu.component.ts
index dce7ac47b..c2cd0fc77 100644
--- a/apps/red-ui/src/app/components/tenants-menu/tenants-menu.component.ts
+++ b/apps/red-ui/src/app/components/tenants-menu/tenants-menu.component.ts
@@ -1,7 +1,8 @@
import { Component, inject } from '@angular/core';
-import { BASE_HREF, getCurrentUser, IStoredTenant, TenantsService } from '@iqser/common-ui';
+import { BASE_HREF, getConfig, getCurrentUser, IStoredTenant, KeycloakStatusService, TenantsService } from '@iqser/common-ui';
import { User } from '@red/domain';
import { KeyValue } from '@angular/common';
+import { KeycloakService } from 'keycloak-angular';
@Component({
selector: 'app-tenants-menu',
@@ -12,7 +13,10 @@ export class TenantsMenuComponent {
readonly tenantsService = inject(TenantsService);
readonly storedTenants: Map;
readonly #baseHref = inject(BASE_HREF);
+ readonly #keycloakService = inject(KeycloakService);
+ readonly #keycloakStatusService = inject(KeycloakStatusService);
readonly #currentUser = getCurrentUser();
+ readonly #config = getConfig();
constructor() {
this.storedTenants = this.#getStoredTenants();
@@ -22,11 +26,21 @@ export class TenantsMenuComponent {
return item.key;
}
- selectTenant(tenantId?: string, email?: string) {
- let tenantUrl = tenantId ? '/' + tenantId + '/main' : '/';
+ async selectTenant(tenantId?: string, email?: string) {
+ let tenantUrl = tenantId ? '/' + tenantId : '/';
if (email) {
tenantUrl += '?username=' + email;
}
+
+ if (tenantId === this.tenantsService.activeTenantId) {
+ const url = this.#keycloakService.getKeycloakInstance().createLoginUrl({
+ redirectUri: this.#keycloakStatusService.createLoginUrl(),
+ idpHint: this.#config.OAUTH_IDP_HINT,
+ loginHint: email ?? undefined,
+ });
+ return this.#keycloakService.logout(url);
+ }
+
window.open(window.location.origin + this.#baseHref + tenantUrl, '_blank');
}
diff --git a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.html b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.html
index 72e3a0349..387651e5e 100644
--- a/apps/red-ui/src/app/modules/file-preview/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.html
+++ b/apps/red-ui/src/app/modules/file-preview/dialogs/remove-annotations-dialog/remove-annotations-dialog.component.html
@@ -1,23 +1,9 @@