Add page title to whitelable

improvement/fix-task-deletion^2
Mohamed Rashd 2 years ago
parent 7df4aff569
commit 78546125bc

@ -689,6 +689,13 @@ public class RequestValidationUtil {
new ErrorResponse.ErrorResponseBuilder() new ErrorResponse.ErrorResponseBuilder()
.setCode(HttpStatus.SC_BAD_REQUEST).setMessage(msg).build()); .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 { try {
validateWhiteLabelImage(whiteLabelThemeCreateRequest.getFavicon()); validateWhiteLabelImage(whiteLabelThemeCreateRequest.getFavicon());
validateWhiteLabelImage(whiteLabelThemeCreateRequest.getLogo()); validateWhiteLabelImage(whiteLabelThemeCreateRequest.getLogo());

@ -22,6 +22,7 @@ public class WhiteLabelTheme {
private WhiteLabelImage faviconImage; private WhiteLabelImage faviconImage;
private WhiteLabelImage logoImage; private WhiteLabelImage logoImage;
private String footerText; private String footerText;
private String pageTitle;
public String getFooterText() { public String getFooterText() {
return footerText; return footerText;
@ -46,4 +47,12 @@ public class WhiteLabelTheme {
public void setLogoImage(WhiteLabelImage logoImage) { public void setLogoImage(WhiteLabelImage logoImage) {
this.logoImage = 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 favicon;
private WhiteLabelImageRequestPayload logo; private WhiteLabelImageRequestPayload logo;
private String footerText; private String footerText;
private String pageTitle;
public WhiteLabelImageRequestPayload getFavicon() { public WhiteLabelImageRequestPayload getFavicon() {
return favicon; return favicon;
@ -46,4 +47,12 @@ public class WhiteLabelThemeCreateRequest {
public void setFooterText(String footerText) { public void setFooterText(String footerText) {
this.footerText = 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") @XmlRootElement(name = "WhiteLabelConfiguration")
public class WhiteLabelConfiguration { public class WhiteLabelConfiguration {
private String footerText; private String footerText;
private String pageTitle;
private WhiteLabelImages whiteLabelImages; private WhiteLabelImages whiteLabelImages;
@XmlElement(name = "FooterText", required = true) @XmlElement(name = "FooterText", required = true)
@ -43,4 +44,13 @@ public class WhiteLabelConfiguration {
public void setWhiteLabelImages(WhiteLabelImages whiteLabelImages) { public void setWhiteLabelImages(WhiteLabelImages whiteLabelImages) {
this.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() { private WhiteLabelTheme getDefaultWhiteLabelTheme() {
String footerText = getDefaultFooterText(); String footerText = getDefaultFooterText();
String pageTitle = getDefaultPageTitle();
WhiteLabelImage favicon = constructDefaultFaviconImage(); WhiteLabelImage favicon = constructDefaultFaviconImage();
WhiteLabelImage logo = constructDefaultLogoImage(); WhiteLabelImage logo = constructDefaultLogoImage();
WhiteLabelTheme defaultTheme = new WhiteLabelTheme(); WhiteLabelTheme defaultTheme = new WhiteLabelTheme();
defaultTheme.setFooterText(footerText); defaultTheme.setFooterText(footerText);
defaultTheme.setPageTitle(pageTitle);
defaultTheme.setLogoImage(logo); defaultTheme.setLogoImage(logo);
defaultTheme.setFaviconImage(favicon); defaultTheme.setFaviconImage(favicon);
return defaultTheme; 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 * Get default whitelabel label footer from config
*/ */
@ -319,6 +331,7 @@ public class WhiteLabelManagementServiceImpl implements WhiteLabelManagementServ
whiteLabelTheme.setFaviconImage(faviconImage); whiteLabelTheme.setFaviconImage(faviconImage);
whiteLabelTheme.setLogoImage(logoImage); whiteLabelTheme.setLogoImage(logoImage);
whiteLabelTheme.setFooterText(whiteLabelThemeCreateRequest.getFooterText()); whiteLabelTheme.setFooterText(whiteLabelThemeCreateRequest.getFooterText());
whiteLabelTheme.setPageTitle(whiteLabelThemeCreateRequest.getPageTitle());
return whiteLabelTheme; return whiteLabelTheme;
} }

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

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

Loading…
Cancel
Save