Add page title to whitelable

traccar-v5.0.15-sync
Mohamed Rashd 3 years ago
parent 7df4aff569
commit 78546125bc

@ -689,6 +689,13 @@ public class RequestValidationUtil {
new ErrorResponse.ErrorResponseBuilder()
.setCode(HttpStatus.SC_BAD_REQUEST).setMessage(msg).build());
}
if (whiteLabelThemeCreateRequest.getPageTitle() == null) {
String msg = "Page title is required to whitelabel";
log.error(msg);
throw new InputValidationException(
new ErrorResponse.ErrorResponseBuilder()
.setCode(HttpStatus.SC_BAD_REQUEST).setMessage(msg).build());
}
try {
validateWhiteLabelImage(whiteLabelThemeCreateRequest.getFavicon());
validateWhiteLabelImage(whiteLabelThemeCreateRequest.getLogo());

@ -22,6 +22,7 @@ public class WhiteLabelTheme {
private WhiteLabelImage faviconImage;
private WhiteLabelImage logoImage;
private String footerText;
private String pageTitle;
public String getFooterText() {
return footerText;
@ -46,4 +47,12 @@ public class WhiteLabelTheme {
public void setLogoImage(WhiteLabelImage logoImage) {
this.logoImage = logoImage;
}
public String getPageTitle() {
return pageTitle;
}
public void setPageTitle(String pageTitle) {
this.pageTitle = pageTitle;
}
}

@ -22,6 +22,7 @@ public class WhiteLabelThemeCreateRequest {
private WhiteLabelImageRequestPayload favicon;
private WhiteLabelImageRequestPayload logo;
private String footerText;
private String pageTitle;
public WhiteLabelImageRequestPayload getFavicon() {
return favicon;
@ -46,4 +47,12 @@ public class WhiteLabelThemeCreateRequest {
public void setFooterText(String footerText) {
this.footerText = footerText;
}
public String getPageTitle() {
return pageTitle;
}
public void setPageTitle(String pageTitle) {
this.pageTitle = pageTitle;
}
}

@ -24,6 +24,7 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "WhiteLabelConfiguration")
public class WhiteLabelConfiguration {
private String footerText;
private String pageTitle;
private WhiteLabelImages whiteLabelImages;
@XmlElement(name = "FooterText", required = true)
@ -43,4 +44,13 @@ public class WhiteLabelConfiguration {
public void setWhiteLabelImages(WhiteLabelImages whiteLabelImages) {
this.whiteLabelImages = whiteLabelImages;
}
@XmlElement(name = "PageTitle", required = true)
public String getPageTitle() {
return pageTitle;
}
public void setPageTitle(String pageTitle) {
this.pageTitle = pageTitle;
}
}

@ -165,15 +165,27 @@ public class WhiteLabelManagementServiceImpl implements WhiteLabelManagementServ
*/
private WhiteLabelTheme getDefaultWhiteLabelTheme() {
String footerText = getDefaultFooterText();
String pageTitle = getDefaultPageTitle();
WhiteLabelImage favicon = constructDefaultFaviconImage();
WhiteLabelImage logo = constructDefaultLogoImage();
WhiteLabelTheme defaultTheme = new WhiteLabelTheme();
defaultTheme.setFooterText(footerText);
defaultTheme.setPageTitle(pageTitle);
defaultTheme.setLogoImage(logo);
defaultTheme.setFaviconImage(favicon);
return defaultTheme;
}
/**
* Get default whitelabel label page title from config
*/
private String getDefaultPageTitle() {
MetaDataConfiguration metaDataConfiguration = DeviceConfigurationManager.getInstance().
getDeviceManagementConfig().getMetaDataConfiguration();
WhiteLabelConfiguration whiteLabelConfiguration = metaDataConfiguration.getWhiteLabelConfiguration();
return whiteLabelConfiguration.getPageTitle();
}
/**
* Get default whitelabel label footer from config
*/
@ -319,6 +331,7 @@ public class WhiteLabelManagementServiceImpl implements WhiteLabelManagementServ
whiteLabelTheme.setFaviconImage(faviconImage);
whiteLabelTheme.setLogoImage(logoImage);
whiteLabelTheme.setFooterText(whiteLabelThemeCreateRequest.getFooterText());
whiteLabelTheme.setPageTitle(whiteLabelThemeCreateRequest.getPageTitle());
return whiteLabelTheme;
}

@ -187,6 +187,7 @@
IoT Server 5.0.0 | © 2022
, All Rights Reserved.
</FooterText>
<PageTitle>Entgra Endpoint Management</PageTitle>
<WhiteLabelImages>
<StoragePath>repository/resources/whitelabel</StoragePath>
<DefaultFaviconName>favicon.png</DefaultFaviconName>

@ -320,6 +320,7 @@
IoT Server 5.0.0 | &#169; 2022
, All Rights Reserved.
</FooterText>
<PageTitle>Entgra Endpoint Management</PageTitle>
<WhiteLabelImages>
<StoragePath>repository/resources/whitelabel</StoragePath>
<DefaultFaviconName>favicon.png</DefaultFaviconName>

Loading…
Cancel
Save