Renaming variables and adding comment

feature/appm-store/pbac
megala21 7 years ago
parent 237f4cbc6c
commit e5ca86cc66

@ -97,7 +97,7 @@
<properties> <properties>
<maven.test.skip>false</maven.test.skip> <maven.test.skip>false</maven.test.skip>
<npm.executable>npm</npm.executable> <npm.executable>npm</npm.executable>
<npm.build.command>build_dev</npm.build.command> <npm.build.command>build_prod</npm.build.command>
<npm.working.dir>./src/main/</npm.working.dir> <npm.working.dir>./src/main/</npm.working.dir>
</properties> </properties>
</project> </project>

@ -106,13 +106,17 @@ class Publisher extends Component {
/** /**
*Loading the theme files based on the the user-preference. *Loading the theme files based on the the user-preference.
*/ */
let promisedConfig = Theme.loadThemeProperties(); let themeConfig = Theme.loadThemeConfigs();
promisedConfig.then(this.setTheme).catch(function (error) { themeConfig.then(this.setTheme).catch(function (error) {
console.log(error); console.log(error);
}); });
} }
/**
* To set the theme based on the configuration file.
* @param response Configuration file data.
*/
setTheme(response) { setTheme(response) {
this.setState({ this.setState({
selectedType: response.data.theme.type, selectedType: response.data.theme.type,

@ -60,7 +60,7 @@ class ApplicationCreate extends Component {
const applicationCreateStepCss = "application-create.css"; const applicationCreateStepCss = "application-create.css";
const applicationCreateStepId = "application-create"; const applicationCreateStepId = "application-create";
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + applicationCreateStepCss; let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + applicationCreateStepCss;
let promisedConfig = Theme.loadThemeFiles(themePath); let themeFilefig = Theme.loadThemeFiles(themePath);
let styleSheet = document.getElementById(applicationCreateStepId); let styleSheet = document.getElementById(applicationCreateStepId);
let head = document.getElementsByTagName("head")[0]; let head = document.getElementsByTagName("head")[0];
let link = document.createElement("link"); let link = document.createElement("link");
@ -73,7 +73,7 @@ class ApplicationCreate extends Component {
styleSheet.disabled = true; styleSheet.disabled = true;
styleSheet.parentNode.removeChild(styleSheet); styleSheet.parentNode.removeChild(styleSheet);
} }
promisedConfig.then(function () { themeFilefig.then(function () {
head.appendChild(link); head.appendChild(link);
}).catch(function () { }).catch(function () {
// If there is no customized css file, load the default one. // If there is no customized css file, load the default one.

@ -121,7 +121,7 @@ class ApplicationListing extends Component {
const applicationListingCss = "application-listing.css"; const applicationListingCss = "application-listing.css";
const applicationListingId = "application-listing"; const applicationListingId = "application-listing";
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + applicationListingCss; let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + applicationListingCss;
let promisedConfig = Theme.loadThemeFiles(themePath); let themeFilefig = Theme.loadThemeFiles(themePath);
let styleSheet = document.getElementById(applicationListingId); let styleSheet = document.getElementById(applicationListingId);
let head = document.getElementsByTagName("head")[0]; let head = document.getElementsByTagName("head")[0];
let link = document.createElement("link"); let link = document.createElement("link");
@ -134,7 +134,7 @@ class ApplicationListing extends Component {
styleSheet.disabled = true; styleSheet.disabled = true;
styleSheet.parentNode.removeChild(styleSheet); styleSheet.parentNode.removeChild(styleSheet);
} }
promisedConfig.then(function () { themeFilefig.then(function () {
head.appendChild(link); head.appendChild(link);
}).catch(function () { }).catch(function () {
// If there is no customized css file, load the default one. // If there is no customized css file, load the default one.

@ -59,7 +59,7 @@ class Step1 extends Component {
const applicationCreateStep1Css = "application-create-step1.css"; const applicationCreateStep1Css = "application-create-step1.css";
const applicationCreateStep1Id = "application-create-step1"; const applicationCreateStep1Id = "application-create-step1";
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + applicationCreateStep1Css; let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + applicationCreateStep1Css;
let promisedConfig = Theme.loadThemeFiles(themePath); let themeFilefig = Theme.loadThemeFiles(themePath);
let styleSheet = document.getElementById(applicationCreateStep1Id); let styleSheet = document.getElementById(applicationCreateStep1Id);
let head = document.getElementsByTagName("head")[0]; let head = document.getElementsByTagName("head")[0];
let link = document.createElement("link"); let link = document.createElement("link");
@ -72,7 +72,7 @@ class Step1 extends Component {
styleSheet.parentNode.removeChild(styleSheet); styleSheet.parentNode.removeChild(styleSheet);
} }
promisedConfig.then(function () { themeFilefig.then(function () {
head.appendChild(link); head.appendChild(link);
}).catch(function () { }).catch(function () {
// If there is no customized css file, load the default one. // If there is no customized css file, load the default one.

@ -78,7 +78,7 @@ class Step2 extends Component {
const applicationCreateStep2Css = "application-create-step2.css"; const applicationCreateStep2Css = "application-create-step2.css";
const applicationCreateStep2Id = "application-create-step2"; const applicationCreateStep2Id = "application-create-step2";
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + applicationCreateStep2Css; let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + applicationCreateStep2Css;
let promisedConfig = Theme.loadThemeFiles(themePath); let themeFilefig = Theme.loadThemeFiles(themePath);
let styleSheet = document.getElementById(applicationCreateStep2Id); let styleSheet = document.getElementById(applicationCreateStep2Id);
let head = document.getElementsByTagName("head")[0]; let head = document.getElementsByTagName("head")[0];
let link = document.createElement("link"); let link = document.createElement("link");
@ -92,7 +92,7 @@ class Step2 extends Component {
styleSheet.parentNode.removeChild(styleSheet); styleSheet.parentNode.removeChild(styleSheet);
} }
promisedConfig.then(function() { themeFilefig.then(function() {
head.appendChild(link); head.appendChild(link);
}).catch(function () { }).catch(function () {
// If there is no customized css file, load the default one. // If there is no customized css file, load the default one.

@ -67,7 +67,7 @@ class Step3 extends Component {
const applicationCreateStep3Css = "application-create-step3.css"; const applicationCreateStep3Css = "application-create-step3.css";
const applicationCreateStep3Id = "application-create-step3"; const applicationCreateStep3Id = "application-create-step3";
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + applicationCreateStep3Css; let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + applicationCreateStep3Css;
let promisedConfig = Theme.loadThemeFiles(themePath); let themeFilefig = Theme.loadThemeFiles(themePath);
let styleSheet = document.getElementById(applicationCreateStep3Id); let styleSheet = document.getElementById(applicationCreateStep3Id);
let head = document.getElementsByTagName("head")[0]; let head = document.getElementsByTagName("head")[0];
let link = document.createElement("link"); let link = document.createElement("link");
@ -81,7 +81,7 @@ class Step3 extends Component {
styleSheet.parentNode.removeChild(styleSheet); styleSheet.parentNode.removeChild(styleSheet);
} }
promisedConfig.then(function() { themeFilefig.then(function() {
head.appendChild(link); head.appendChild(link);
}).catch(function () { }).catch(function () {
// If there is no customized css file, load the default one. // If there is no customized css file, load the default one.

@ -59,7 +59,7 @@ class BaseLayout extends Component {
const basicLayoutCss = "basic-layout.css"; const basicLayoutCss = "basic-layout.css";
const basicLayoutId = "basic-layout"; const basicLayoutId = "basic-layout";
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + basicLayoutCss; let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + basicLayoutCss;
let promisedConfig = Theme.loadThemeFiles(themePath); let themeFilefig = Theme.loadThemeFiles(themePath);
let styleSheet = document.getElementById(basicLayoutId); let styleSheet = document.getElementById(basicLayoutId);
let head = document.getElementsByTagName("head")[0]; let head = document.getElementsByTagName("head")[0];
let link = document.createElement("link"); let link = document.createElement("link");
@ -73,7 +73,7 @@ class BaseLayout extends Component {
styleSheet.parentNode.removeChild(styleSheet); styleSheet.parentNode.removeChild(styleSheet);
} }
promisedConfig.then(function() { themeFilefig.then(function() {
head.appendChild(link); head.appendChild(link);
}).catch(function () { }).catch(function () {
// If there is no customized css file, load the default one. // If there is no customized css file, load the default one.

@ -74,7 +74,7 @@ class PlatformCreate extends Component {
const platformCreateCss = "platform-create.css"; const platformCreateCss = "platform-create.css";
const platformCreateId = "application-listing"; const platformCreateId = "application-listing";
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + platformCreateCss; let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + platformCreateCss;
let promisedConfig = Theme.loadThemeFiles(themePath); let themeFilefig = Theme.loadThemeFiles(themePath);
let styleSheet = document.getElementById(platformCreateId); let styleSheet = document.getElementById(platformCreateId);
let head = document.getElementsByTagName("head")[0]; let head = document.getElementsByTagName("head")[0];
let link = document.createElement("link"); let link = document.createElement("link");
@ -88,7 +88,7 @@ class PlatformCreate extends Component {
styleSheet.parentNode.removeChild(styleSheet); styleSheet.parentNode.removeChild(styleSheet);
} }
promisedConfig.then(function(){ themeFilefig.then(function(){
head.appendChild(link); head.appendChild(link);
}).catch(function () { }).catch(function () {
// If there is no customized css file, load the default one. // If there is no customized css file, load the default one.

@ -50,7 +50,7 @@ class PlatformListing extends Component {
const platformListingCss = "platform-listing.css"; const platformListingCss = "platform-listing.css";
const platformListingId = "platform-listing"; const platformListingId = "platform-listing";
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + platformListingCss; let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + platformListingCss;
let promisedConfig = Theme.loadThemeFiles(themePath); let themeFilefig = Theme.loadThemeFiles(themePath);
let styleSheet = document.getElementById(platformListingId); let styleSheet = document.getElementById(platformListingId);
let head = document.getElementsByTagName("head")[0]; let head = document.getElementsByTagName("head")[0];
let link = document.createElement("link"); let link = document.createElement("link");
@ -63,7 +63,7 @@ class PlatformListing extends Component {
styleSheet.parentNode.removeChild(styleSheet); styleSheet.parentNode.removeChild(styleSheet);
} }
promisedConfig.then(function () { themeFilefig.then(function () {
link.href = Theme.baseURL + "/" + Theme.appContext + themePath; link.href = Theme.baseURL + "/" + Theme.appContext + themePath;
head.appendChild(link); head.appendChild(link);
}).catch(function () { }).catch(function () {

@ -70,7 +70,7 @@ class DataTable extends Component {
const dataTableCss = "data-table.css"; const dataTableCss = "data-table.css";
const dataTableId = "data-table"; const dataTableId = "data-table";
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + dataTableCss; let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + dataTableCss;
let promisedConfig = Theme.loadThemeFiles(themePath); let themeFilefig = Theme.loadThemeFiles(themePath);
let styleSheet = document.getElementById(dataTableId); let styleSheet = document.getElementById(dataTableId);
let head = document.getElementsByTagName("head")[0]; let head = document.getElementsByTagName("head")[0];
let link = document.createElement("link"); link.type = Theme.styleSheetType; let link = document.createElement("link"); link.type = Theme.styleSheetType;
@ -82,7 +82,7 @@ class DataTable extends Component {
styleSheet.disabled = true; styleSheet.disabled = true;
styleSheet.parentNode.removeChild(styleSheet); styleSheet.parentNode.removeChild(styleSheet);
} }
promisedConfig.then(function() { themeFilefig.then(function() {
head.appendChild(link); head.appendChild(link);
}).catch(function () { }).catch(function () {
// If there is no customized css file, load the default one. // If there is no customized css file, load the default one.

@ -41,7 +41,7 @@ class DataTableHeader extends Component {
const dataTableCss = "data-table.css"; const dataTableCss = "data-table.css";
const dataTableId = "data-table"; const dataTableId = "data-table";
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + dataTableCss; let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + dataTableCss;
let promisedConfig = Theme.loadThemeFiles(themePath); let themeFilefig = Theme.loadThemeFiles(themePath);
let styleSheet = document.getElementById(dataTableId); let styleSheet = document.getElementById(dataTableId);
let head = document.getElementsByTagName("head")[0]; let head = document.getElementsByTagName("head")[0];
let link = document.createElement("link"); let link = document.createElement("link");
@ -54,7 +54,7 @@ class DataTableHeader extends Component {
styleSheet.parentNode.removeChild(styleSheet); styleSheet.parentNode.removeChild(styleSheet);
} }
promisedConfig.then(function() { themeFilefig.then(function() {
head.appendChild(link); head.appendChild(link);
}).catch(function () { }).catch(function () {
// If there is no customized css file, load the default one. // If there is no customized css file, load the default one.

@ -45,7 +45,7 @@ class DataTableRow extends Component {
const dataTableCss = "data-table.css"; const dataTableCss = "data-table.css";
const dataTableId = "data-table"; const dataTableId = "data-table";
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + dataTableCss; let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + dataTableCss;
let promisedConfig = Theme.loadThemeFiles(themePath); let themeFilefig = Theme.loadThemeFiles(themePath);
let styleSheet = document.getElementById(dataTableId); let styleSheet = document.getElementById(dataTableId);
let head = document.getElementsByTagName("head")[0]; let head = document.getElementsByTagName("head")[0];
let link = document.createElement("link"); let link = document.createElement("link");
@ -58,7 +58,7 @@ class DataTableRow extends Component {
styleSheet.parentNode.removeChild(styleSheet); styleSheet.parentNode.removeChild(styleSheet);
} }
promisedConfig.then(function() { themeFilefig.then(function() {
head.appendChild(link); head.appendChild(link);
}).catch(function () { }).catch(function () {
// If there is no customized css file, load the default one. // If there is no customized css file, load the default one.

@ -34,15 +34,15 @@ class Theme {
//TODO Need to get the app context properly when the server is ready //TODO Need to get the app context properly when the server is ready
this.baseURL = window.location.origin; this.baseURL = window.location.origin;
this.appContext = window.location.pathname.split("/")[1]; this.appContext = window.location.pathname.split("/")[1];
this.loadThemeProperties.bind(this); this.loadThemeConfigs.bind(this);
this.loadThemeFiles.bind(this); this.loadThemeFiles.bind(this);
} }
/** /**
* To load the theme files from the configuration file. * To load the theme related configurations from the configuration file.
* @returns the http response. * @returns the http response.
*/ */
loadThemeProperties () { loadThemeConfigs () {
let httpClient = axios.create({ let httpClient = axios.create({
baseURL: this.baseURL + "/" + this.appContext + "/config.json", baseURL: this.baseURL + "/" + this.appContext + "/config.json",
timeout: 2000 timeout: 2000

Loading…
Cancel
Save