mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Renaming variables and adding comment
This commit is contained in:
parent
237f4cbc6c
commit
e5ca86cc66
@ -97,7 +97,7 @@
|
||||
<properties>
|
||||
<maven.test.skip>false</maven.test.skip>
|
||||
<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>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
@ -106,13 +106,17 @@ class Publisher extends Component {
|
||||
/**
|
||||
*Loading the theme files based on the the user-preference.
|
||||
*/
|
||||
let promisedConfig = Theme.loadThemeProperties();
|
||||
promisedConfig.then(this.setTheme).catch(function (error) {
|
||||
let themeConfig = Theme.loadThemeConfigs();
|
||||
themeConfig.then(this.setTheme).catch(function (error) {
|
||||
console.log(error);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* To set the theme based on the configuration file.
|
||||
* @param response Configuration file data.
|
||||
*/
|
||||
setTheme(response) {
|
||||
this.setState({
|
||||
selectedType: response.data.theme.type,
|
||||
|
||||
@ -60,7 +60,7 @@ class ApplicationCreate extends Component {
|
||||
const applicationCreateStepCss = "application-create.css";
|
||||
const applicationCreateStepId = "application-create";
|
||||
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + applicationCreateStepCss;
|
||||
let promisedConfig = Theme.loadThemeFiles(themePath);
|
||||
let themeFilefig = Theme.loadThemeFiles(themePath);
|
||||
let styleSheet = document.getElementById(applicationCreateStepId);
|
||||
let head = document.getElementsByTagName("head")[0];
|
||||
let link = document.createElement("link");
|
||||
@ -73,7 +73,7 @@ class ApplicationCreate extends Component {
|
||||
styleSheet.disabled = true;
|
||||
styleSheet.parentNode.removeChild(styleSheet);
|
||||
}
|
||||
promisedConfig.then(function () {
|
||||
themeFilefig.then(function () {
|
||||
head.appendChild(link);
|
||||
}).catch(function () {
|
||||
// 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 applicationListingId = "application-listing";
|
||||
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + applicationListingCss;
|
||||
let promisedConfig = Theme.loadThemeFiles(themePath);
|
||||
let themeFilefig = Theme.loadThemeFiles(themePath);
|
||||
let styleSheet = document.getElementById(applicationListingId);
|
||||
let head = document.getElementsByTagName("head")[0];
|
||||
let link = document.createElement("link");
|
||||
@ -134,7 +134,7 @@ class ApplicationListing extends Component {
|
||||
styleSheet.disabled = true;
|
||||
styleSheet.parentNode.removeChild(styleSheet);
|
||||
}
|
||||
promisedConfig.then(function () {
|
||||
themeFilefig.then(function () {
|
||||
head.appendChild(link);
|
||||
}).catch(function () {
|
||||
// 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 applicationCreateStep1Id = "application-create-step1";
|
||||
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + applicationCreateStep1Css;
|
||||
let promisedConfig = Theme.loadThemeFiles(themePath);
|
||||
let themeFilefig = Theme.loadThemeFiles(themePath);
|
||||
let styleSheet = document.getElementById(applicationCreateStep1Id);
|
||||
let head = document.getElementsByTagName("head")[0];
|
||||
let link = document.createElement("link");
|
||||
@ -72,7 +72,7 @@ class Step1 extends Component {
|
||||
styleSheet.parentNode.removeChild(styleSheet);
|
||||
}
|
||||
|
||||
promisedConfig.then(function () {
|
||||
themeFilefig.then(function () {
|
||||
head.appendChild(link);
|
||||
}).catch(function () {
|
||||
// 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 applicationCreateStep2Id = "application-create-step2";
|
||||
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + applicationCreateStep2Css;
|
||||
let promisedConfig = Theme.loadThemeFiles(themePath);
|
||||
let themeFilefig = Theme.loadThemeFiles(themePath);
|
||||
let styleSheet = document.getElementById(applicationCreateStep2Id);
|
||||
let head = document.getElementsByTagName("head")[0];
|
||||
let link = document.createElement("link");
|
||||
@ -92,7 +92,7 @@ class Step2 extends Component {
|
||||
styleSheet.parentNode.removeChild(styleSheet);
|
||||
}
|
||||
|
||||
promisedConfig.then(function() {
|
||||
themeFilefig.then(function() {
|
||||
head.appendChild(link);
|
||||
}).catch(function () {
|
||||
// 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 applicationCreateStep3Id = "application-create-step3";
|
||||
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + applicationCreateStep3Css;
|
||||
let promisedConfig = Theme.loadThemeFiles(themePath);
|
||||
let themeFilefig = Theme.loadThemeFiles(themePath);
|
||||
let styleSheet = document.getElementById(applicationCreateStep3Id);
|
||||
let head = document.getElementsByTagName("head")[0];
|
||||
let link = document.createElement("link");
|
||||
@ -81,7 +81,7 @@ class Step3 extends Component {
|
||||
styleSheet.parentNode.removeChild(styleSheet);
|
||||
}
|
||||
|
||||
promisedConfig.then(function() {
|
||||
themeFilefig.then(function() {
|
||||
head.appendChild(link);
|
||||
}).catch(function () {
|
||||
// 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 basicLayoutId = "basic-layout";
|
||||
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + basicLayoutCss;
|
||||
let promisedConfig = Theme.loadThemeFiles(themePath);
|
||||
let themeFilefig = Theme.loadThemeFiles(themePath);
|
||||
let styleSheet = document.getElementById(basicLayoutId);
|
||||
let head = document.getElementsByTagName("head")[0];
|
||||
let link = document.createElement("link");
|
||||
@ -73,7 +73,7 @@ class BaseLayout extends Component {
|
||||
styleSheet.parentNode.removeChild(styleSheet);
|
||||
}
|
||||
|
||||
promisedConfig.then(function() {
|
||||
themeFilefig.then(function() {
|
||||
head.appendChild(link);
|
||||
}).catch(function () {
|
||||
// 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 platformCreateId = "application-listing";
|
||||
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + platformCreateCss;
|
||||
let promisedConfig = Theme.loadThemeFiles(themePath);
|
||||
let themeFilefig = Theme.loadThemeFiles(themePath);
|
||||
let styleSheet = document.getElementById(platformCreateId);
|
||||
let head = document.getElementsByTagName("head")[0];
|
||||
let link = document.createElement("link");
|
||||
@ -88,7 +88,7 @@ class PlatformCreate extends Component {
|
||||
styleSheet.parentNode.removeChild(styleSheet);
|
||||
}
|
||||
|
||||
promisedConfig.then(function(){
|
||||
themeFilefig.then(function(){
|
||||
head.appendChild(link);
|
||||
}).catch(function () {
|
||||
// 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 platformListingId = "platform-listing";
|
||||
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + platformListingCss;
|
||||
let promisedConfig = Theme.loadThemeFiles(themePath);
|
||||
let themeFilefig = Theme.loadThemeFiles(themePath);
|
||||
let styleSheet = document.getElementById(platformListingId);
|
||||
let head = document.getElementsByTagName("head")[0];
|
||||
let link = document.createElement("link");
|
||||
@ -63,7 +63,7 @@ class PlatformListing extends Component {
|
||||
styleSheet.parentNode.removeChild(styleSheet);
|
||||
}
|
||||
|
||||
promisedConfig.then(function () {
|
||||
themeFilefig.then(function () {
|
||||
link.href = Theme.baseURL + "/" + Theme.appContext + themePath;
|
||||
head.appendChild(link);
|
||||
}).catch(function () {
|
||||
|
||||
@ -70,7 +70,7 @@ class DataTable extends Component {
|
||||
const dataTableCss = "data-table.css";
|
||||
const dataTableId = "data-table";
|
||||
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + dataTableCss;
|
||||
let promisedConfig = Theme.loadThemeFiles(themePath);
|
||||
let themeFilefig = Theme.loadThemeFiles(themePath);
|
||||
let styleSheet = document.getElementById(dataTableId);
|
||||
let head = document.getElementsByTagName("head")[0];
|
||||
let link = document.createElement("link"); link.type = Theme.styleSheetType;
|
||||
@ -82,7 +82,7 @@ class DataTable extends Component {
|
||||
styleSheet.disabled = true;
|
||||
styleSheet.parentNode.removeChild(styleSheet);
|
||||
}
|
||||
promisedConfig.then(function() {
|
||||
themeFilefig.then(function() {
|
||||
head.appendChild(link);
|
||||
}).catch(function () {
|
||||
// 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 dataTableId = "data-table";
|
||||
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + dataTableCss;
|
||||
let promisedConfig = Theme.loadThemeFiles(themePath);
|
||||
let themeFilefig = Theme.loadThemeFiles(themePath);
|
||||
let styleSheet = document.getElementById(dataTableId);
|
||||
let head = document.getElementsByTagName("head")[0];
|
||||
let link = document.createElement("link");
|
||||
@ -54,7 +54,7 @@ class DataTableHeader extends Component {
|
||||
styleSheet.parentNode.removeChild(styleSheet);
|
||||
}
|
||||
|
||||
promisedConfig.then(function() {
|
||||
themeFilefig.then(function() {
|
||||
head.appendChild(link);
|
||||
}).catch(function () {
|
||||
// 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 dataTableId = "data-table";
|
||||
let themePath = "/" + Theme.themeFolder + "/" + selected + "/" + dataTableCss;
|
||||
let promisedConfig = Theme.loadThemeFiles(themePath);
|
||||
let themeFilefig = Theme.loadThemeFiles(themePath);
|
||||
let styleSheet = document.getElementById(dataTableId);
|
||||
let head = document.getElementsByTagName("head")[0];
|
||||
let link = document.createElement("link");
|
||||
@ -58,7 +58,7 @@ class DataTableRow extends Component {
|
||||
styleSheet.parentNode.removeChild(styleSheet);
|
||||
}
|
||||
|
||||
promisedConfig.then(function() {
|
||||
themeFilefig.then(function() {
|
||||
head.appendChild(link);
|
||||
}).catch(function () {
|
||||
// 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
|
||||
this.baseURL = window.location.origin;
|
||||
this.appContext = window.location.pathname.split("/")[1];
|
||||
this.loadThemeProperties.bind(this);
|
||||
this.loadThemeConfigs.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.
|
||||
*/
|
||||
loadThemeProperties () {
|
||||
loadThemeConfigs () {
|
||||
let httpClient = axios.create({
|
||||
baseURL: this.baseURL + "/" + this.appContext + "/config.json",
|
||||
timeout: 2000
|
||||
|
||||
Loading…
Reference in New Issue
Block a user