Skip to content
Snippets Groups Projects
Commit 6c843660 authored by Makhtar DIAGNE's avatar Makhtar DIAGNE
Browse files

[TECH] Fix theme default logo

parent 092cf087
No related branches found
No related tags found
1 merge request!1Feature/design/1
Showing with 52 additions and 11 deletions
<nav class="vitamui-navbar">
<a href="{{portalUrl}}" class="vitamui-navbar-logo">
<img [src]="trustedAppLogoUrl">
<img [src]="trustedAppLogoUrl ? trustedAppLogoUrl : '/assets/logo.png'">
</a>
<ul class="menu">
......
......@@ -108,7 +108,7 @@ describe('NavbarComponent', () => {
beforeEach(async(() => {
const authServiceStub = { logout: () => { } };
const startupServiceStub = { getPortalUrl: () => { }, getLogo: () => { } };
const startupServiceStub = { getPortalUrl: () => { }, getLogo: () => { }, getAppLogoURL: () => { } , getCustomerLogoURL: () => { } };
TestBed.configureTestingModule({
imports: [
......
......@@ -82,16 +82,13 @@ export class NavbarComponent {
this.portalUrl = startupService.getPortalUrl();
this.base64Logo = startupService.getLogo();
if (this.base64Logo) {
this.trustedAppLogoUrl = this.domSanitizer.bypassSecurityTrustUrl('data:image/*;base64,' + this.base64Logo);
}
this.trustedAppLogoUrl = startupService.getAppLogoURL() ?
this.domSanitizer.bypassSecurityTrustUrl('data:image/*;base64,' + startupService.getAppLogoURL()) : null;
if (this.authService.user) {
this.currentUser = this.authService.user;
if (this.currentUser.basicCustomer) {
this.trustedInlineLogoUrl = this.domSanitizer.bypassSecurityTrustUrl('data:image/*;base64,' +
this.currentUser.basicCustomer.graphicIdentity.logoDataBase64);
}
this.trustedInlineLogoUrl = startupService.getCustomerLogoURL() ?
this.domSanitizer.bypassSecurityTrustUrl('data:image/*;base64,' + startupService.getCustomerLogoURL()) : null;
this.hasAccountProfile = this.authService.user.profileGroup.profiles.find((profile) =>
profile.applicationName === ApplicationId.ACCOUNTS_APP) !== undefined;
}
......
<div class="error-message">
<img class="vitamui-logo" src="/assets/vitamui-logo.png">
<img class="vitamui-logo" [src]="trustedAppLogoUrl ? trustedAppLogoUrl : '/assets/logo.png'">
<h2 i18n="@@serverErrorTitle">Erreur serveur interne (500)</h2>
<p i18n="@@serverErrorMessage">Une erreur interne s'est produite. Veuillez contacter un administrateur si le problème persiste.</p>
......
......@@ -36,6 +36,8 @@
*/
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { MatDialogRef } from '@angular/material/dialog';
import { LoggerModule } from './../logger/logger.module';
import { StartupService } from './../startup.service';
import { ErrorDialogComponent } from './error-dialog.component';
......@@ -44,10 +46,16 @@ describe('ErrorDialogComponent', () => {
let fixture: ComponentFixture<ErrorDialogComponent>;
beforeEach(async(() => {
const startupServiceStub = { getPortalUrl: () => { }, getLogo: () => { }, getAppLogoURL: () => { } , getCustomerLogoURL: () => { } };
TestBed.configureTestingModule({
imports: [
LoggerModule.forRoot()
],
declarations: [ ErrorDialogComponent ],
providers: [
{ provide: MatDialogRef, useValue: {} },
{ provide: StartupService, useValue: startupServiceStub },
]
})
.compileComponents();
......
......@@ -36,6 +36,9 @@
*/
import { Component, OnInit } from '@angular/core';
import { MatDialogRef } from '@angular/material/dialog';
import { DomSanitizer } from '@angular/platform-browser';
import { SafeUrl } from '@angular/platform-browser';
import { StartupService } from './../startup.service';
@Component({
selector: 'vitamui-common-error-dialog',
......@@ -44,7 +47,15 @@ import { MatDialogRef } from '@angular/material/dialog';
})
export class ErrorDialogComponent implements OnInit {
constructor(private matDialogRef: MatDialogRef<ErrorDialogComponent>) { }
trustedAppLogoUrl: SafeUrl;
constructor(private matDialogRef: MatDialogRef<ErrorDialogComponent>,
startupService: StartupService,
private domSanitizer: DomSanitizer) {
this.trustedAppLogoUrl = startupService.getAppLogoURL() ?
this.domSanitizer.bypassSecurityTrustUrl('data:image/*;base64,' + startupService.getAppLogoURL()) : null;
}
ngOnInit() {
}
......
......@@ -153,6 +153,30 @@ export class StartupService {
}
}
getAppLogoURL(): string {
let trustedAppLogoUrl = null;
const base64Logo = this.getLogo();
if (base64Logo) {
trustedAppLogoUrl = base64Logo;
}
return trustedAppLogoUrl;
}
getCustomerLogoURL(): string {
let trustedInlineLogoUrl = null;
if (this.authService.user) {
const currentUser = this.authService.user;
if (currentUser.basicCustomer) {
trustedInlineLogoUrl = currentUser.basicCustomer.graphicIdentity.logoDataBase64;
}
}
return trustedInlineLogoUrl;
}
getPortalUrl(): string {
if (this.configurationLoaded()) {
return this.configurationData.PORTAL_URL;
......
ui/ui-frontend/projects/identity/src/assets/logo.png

6.18 KiB

ui/ui-frontend/projects/portal/src/assets/logo.png

6.18 KiB

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