Skip to content
Snippets Groups Projects
Commit a27c3904 authored by Fadil's avatar Fadil Committed by pybelecalo
Browse files

[FIX TRTL-625] Fix tenant selection toggle between apps

parent 36e0d7f2
No related branches found
No related tags found
No related merge requests found
......@@ -42,6 +42,7 @@ import { Observable, of, Subject } from 'rxjs';
import { catchError, map } from 'rxjs/operators';
import { ApplicationApiService } from './api/application-api.service';
import { AuthService } from './auth.service';
import { GlobalEventService } from './global-event.service';
import { ApplicationInfo } from './models/application/application.interface';
import { Application } from './models/application/application.interface';
import { Category } from './models/application/category.interface';
......@@ -93,7 +94,7 @@ export class ApplicationService {
private appMap$ = new BehaviorSubject(undefined);
constructor(private applicationApi: ApplicationApiService, private authService: AuthService,
private tenantService: TenantSelectionService) { }
private tenantService: TenantSelectionService, private globalEventService: GlobalEventService) { }
/**
* Get Applications list for an user and save it in a property.
......
......@@ -32,7 +32,7 @@
</vitamui-common-item-select>
</div>
<div class="d-flex align-items-center mx-4 account" [matMenuTriggerFor]="accountMenu">
<div class="d-flex align-items-center pl-3 mr-4 account" [matMenuTriggerFor]="accountMenu">
<vitamui-common-user-photo class="mr-2" [photo]="currentUser?.photo"></vitamui-common-user-photo>
<div class="mx-2">
<div class="text caption bold">{{'HEADER.PROFILE' | translate}}</div>
......
......@@ -44,7 +44,6 @@ vitamui-common-select-language, .select-tenant {
width: 18%;
min-width: 200px;
border-left: 1px solid var(--vitamui-header-footer-font);
border-right: 1px solid var(--vitamui-header-footer-font);
}
.username {
......@@ -55,6 +54,8 @@ vitamui-common-select-language, .select-tenant {
.account {
cursor: pointer;
height: $header-height;
border-left: 1px solid var(--vitamui-header-footer-font);
.text {
color: var(--vitamui-header-footer-font);
......
......@@ -31,7 +31,6 @@ export class HeaderComponent implements OnInit, OnDestroy {
public trustedInlineLogoUrl: SafeUrl;
public hasTenantSelection = false;
public hasCustomerSelection = false;
public hasLangSelection = false;
public portalUrl: string;
public currentUser: AuthUser;
public selectedTenant: MenuOption;
......@@ -121,7 +120,7 @@ export class HeaderComponent implements OnInit, OnDestroy {
let eventsObsRef: Subscription;
// Show or hide the tenant selection component from the header when needed
this.tenantService.hasTenantSelection().subscribe((result: boolean) => {
this.applicationService.hasTenantList().subscribe((result: boolean) => {
this.hasTenantSelection = result;
if (this.hasTenantSelection && !eventsObsRef) {
eventsObsRef = this.router.events.pipe(takeUntil(this.destroyer$)).subscribe((data: any) => {
......
......@@ -22,7 +22,7 @@ export class SelectLanguageComponent implements OnInit, OnDestroy {
*/
@Input() displayMode: 'select' | 'button' = 'button';
public hasLangSelection = true;
public hasLangSelection = false;
public currentLang = '';
private destroyer$ = new Subject();
......
......@@ -147,16 +147,4 @@ export class TenantSelectionService {
});
});
}
public hasTenantSelection(url?: string): Observable<boolean> {
return new Observable((observer) => {
if (!url) {
url = window.location.href;
}
this.currentAppId$.subscribe((appId: ApplicationId) => {
observer.next((url.includes(TENANT_SELECTION_URL_CONDITION) || appId === ApplicationId.PORTAL_APP));
});
});
}
}
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment