Skip to content
Snippets Groups Projects
Commit 819f292f authored by BLANCHET Ludovic's avatar BLANCHET Ludovic Committed by Makhtar DIAGNE
Browse files

Add app logo configuration


Signed-off-by: default avatarMakhtar DIAGNE <makhtar.diagne@teamdlab.com>
parent a4f81e34
No related branches found
No related tags found
1 merge request!1Feature/design/1
Showing
with 53 additions and 6 deletions
......@@ -183,6 +183,8 @@ public class CommonConstants {
public static final String UI_URL = "UI_URL";
public static final String ASSET_FOLDER = "ASSET_FOLDER";
public static final String THEME_COLORS = "THEME_COLORS";
/**
......@@ -258,4 +260,5 @@ public class CommonConstants {
public static final String MULTIPART_FILE_PARAM_NAME = "uploadedFile";
public static final String LOGO = "LOGO";
}
......@@ -50,4 +50,6 @@ public interface UIProperties {
public Map<String, String> getThemeColors();
public String getLogoURI();
}
......@@ -118,13 +118,25 @@ public class ApplicationService extends AbstractCrudService<ApplicationDto> {
public Map<String, Object> getConf() {
final Map<String, Object> configurationData = new HashMap<>();
configurationData.put(CommonConstants.PORTAL_URL, properties.getBaseUrl().getPortal());
// TODO check if it s used
configurationData.put(CommonConstants.CAS_LOGIN_URL, getCasLoginUrl());
configurationData.put(CommonConstants.CAS_LOGOUT_URL, casLogoutUrl.getValue());
configurationData.put(CommonConstants.UI_URL, uiUrl);
configurationData.put(CommonConstants.LOGOUT_REDIRECT_UI_URL, casLogoutUrl.getValueWithRedirection(uiRedirectUrl));
configurationData.put(CommonConstants.THEME_COLORS, properties.getThemeColors());
final Path logoPath = Paths.get(properties.getLogoURI());
String base64Logo = null;
try {
base64Logo = DatatypeConverter.printBase64Binary(Files.readAllBytes(logoPath));
}
catch (IOException e) {
LOGGER.warn("Error while resolve application logo");
e.printStackTrace();
}
if (base64Logo != null) {
configurationData.put(CommonConstants.LOGO, base64Logo);
}
return configurationData;
}
......
<nav class="vitamui-navbar">
<a href="{{portalUrl}}" class="vitamui-navbar-logo"><img src="../../../../assets/navbar-logo-vitamui.png"></a>
<a href="{{portalUrl}}" class="vitamui-navbar-logo">
<img *ngIf="base64Logo" [src]="trustedAppLogoUrl">
<img *ngIf="!base64Logo" src="../../../../assets/navbar-logo.svg">
</a>
<ul class="menu">
......
......@@ -68,9 +68,11 @@ export class NavbarComponent {
@Output() customerSelect = new EventEmitter<string>();
portalUrl: string;
base64Logo: string;
currentUser: AuthUser;
hasAccountProfile = false;
trustedInlineLogoUrl: SafeUrl;
trustedAppLogoUrl: SafeUrl;
constructor(
public authService: AuthService,
......@@ -78,6 +80,12 @@ export class NavbarComponent {
private subrogationService: SubrogationService,
private domSanitizer: DomSanitizer) {
this.portalUrl = startupService.getPortalUrl();
this.base64Logo = startupService.getLogo();
if (this.base64Logo) {
this.trustedAppLogoUrl = this.domSanitizer.bypassSecurityTrustUrl('data:image/*;base64,' + this.base64Logo);
}
if (this.authService.user) {
this.currentUser = this.authService.user;
if (this.currentUser.basicCustomer) {
......
......@@ -42,6 +42,7 @@ export interface AppConfiguration {
LOGOUT_REDIRECT_UI_URL: string;
SEARCH_URL?: string;
THEME_COLORS: any;
LOGO: any;
[key: string]: string;
}
......@@ -93,7 +93,6 @@ export class StartupService {
const applicationColorMap = this.configurationData.THEME_COLORS;
const customerColorMap = this.authService.user.basicCustomer.graphicIdentity.themeColors;
const themeColors = {
'--vitamui-primary': getColorFromMaps('vitamui-primary', '#fe4f02', applicationColorMap, customerColorMap),
'--vitamui-primary-light': getColorFromMaps('vitamui-primary-light', '#ff8559', applicationColorMap, customerColorMap),
......@@ -104,7 +103,8 @@ export class StartupService {
'--vitamui-secondary-dark-5': getColorFromMaps('vitamui-secondary-dark', '#52aa9a', applicationColorMap, customerColorMap)
};
console.log('Theme colors: ', themeColors);
const logo64 = this.configurationData.LOGO;
console.log('Logo: ', logo64);
for (const themeColorsKey in themeColors) {
if (themeColors.hasOwnProperty(themeColorsKey)) {
......@@ -152,6 +152,12 @@ export class StartupService {
}
}
getLogo(): string {
if (this.configurationLoaded()) {
return this.configurationData.LOGO;
}
}
getPortalUrl(): string {
if (this.configurationLoaded()) {
return this.configurationData.PORTAL_URL;
......
diff a/ui/ui-frontend/package.json b/ui/ui-frontend/package.json (rejected hunks)
@@ -59,7 +59,7 @@
"moment": "^2.24.0",
"rxjs": "^6.5.2",
"tslib": "^1.9.0",
- "ui-frontend-common": "file:../ui-frontend-common/ui-frontend-common-0.0.25.tgz",
+ "ui-frontend-common": "file:../ui-frontend-common/ui-frontend-common-0.0.26.tgz",
"underscore": "^1.9.1",
"web-animations-js": "github:angular/web-animations-js#release_pr208",
"zone.js": "~0.9.1"
......@@ -197,8 +197,6 @@ export class GraphicIdentityUpdateComponent implements OnInit {
isGraphicIdentityFormValid() {
return this.graphicIdentityForm.get('hasCustomGraphicIdentity').value === false ||
(this.graphicIdentityForm.get('hasCustomGraphicIdentity').value === true && this.imageUrl);
// TODO: Update me to add themeColors !
// FIXME: What if we dont want to update imageURL ? Can we test image OR themeColors updates
}
}
......@@ -16,6 +16,8 @@ ui-identity:
vitamui-primary-light-20: "#ba52d1"
vitamui-secondary: "#7FA1D4"
logoURI: "/home/lubla/vitamui/test_logo.png"
iam-external-client:
server-host: localhost
server-port: 8083
......
......@@ -31,6 +31,8 @@ ui-portal:
vitamui-primary-light-20: "#ba52d1"
vitamui-secondary: "#7FA1D4"
logoURI: "/home/lubla/vitamui/test_logo.png"
iam-external-client:
server-host: localhost
server-port: 8083
......
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