From e5ca86cc6692b113d590429dd86740fe02fc52de Mon Sep 17 00:00:00 2001 From: megala21 Date: Thu, 14 Sep 2017 14:45:29 +0530 Subject: [PATCH] Renaming variables and adding comment --- .../pom.xml | 2 +- .../src/main/resources/publisher/src/App.jsx | 8 ++++++-- .../src/components/Application/ApplicationCreate.jsx | 4 ++-- .../src/components/Application/ApplicationListing.jsx | 4 ++-- .../src/components/Application/CreateSteps/Step1.jsx | 4 ++-- .../src/components/Application/CreateSteps/Step2.jsx | 4 ++-- .../src/components/Application/CreateSteps/Step3.jsx | 4 ++-- .../publisher/src/components/Base/BaseLayout.jsx | 4 ++-- .../publisher/src/components/Platform/PlatformCreate.jsx | 4 ++-- .../publisher/src/components/Platform/PlatformListing.jsx | 4 ++-- .../publisher/src/components/UIComponents/DataTable.jsx | 4 ++-- .../src/components/UIComponents/DataTableHeader.jsx | 4 ++-- .../src/components/UIComponents/DataTableRow.jsx | 4 ++-- .../src/main/resources/publisher/src/theme.js | 6 +++--- 14 files changed, 32 insertions(+), 28 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/pom.xml index 3398d23ce2..a95ca6c8dd 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/pom.xml @@ -97,7 +97,7 @@ false npm - build_dev + build_prod ./src/main/ diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/App.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/App.jsx index b3cac96869..4798f122cd 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/App.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/App.jsx @@ -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, diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationCreate.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationCreate.jsx index 6e0d91f93e..48aa9549e0 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationCreate.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationCreate.jsx @@ -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. diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.jsx index f5825bb635..60ee588a81 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/ApplicationListing.jsx @@ -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. diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/CreateSteps/Step1.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/CreateSteps/Step1.jsx index 1bb540ac0c..d2c615057d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/CreateSteps/Step1.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/CreateSteps/Step1.jsx @@ -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. diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/CreateSteps/Step2.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/CreateSteps/Step2.jsx index 8c047853c1..968891111b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/CreateSteps/Step2.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/CreateSteps/Step2.jsx @@ -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. diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/CreateSteps/Step3.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/CreateSteps/Step3.jsx index c974c89094..548e680658 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/CreateSteps/Step3.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Application/CreateSteps/Step3.jsx @@ -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. diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Base/BaseLayout.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Base/BaseLayout.jsx index 8e772a8c63..b1cf9c5f76 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Base/BaseLayout.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Base/BaseLayout.jsx @@ -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. diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformCreate.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformCreate.jsx index 5d26b067d9..a5053e6819 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformCreate.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformCreate.jsx @@ -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. diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformListing.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformListing.jsx index 8cd4eb358a..bd6325f616 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformListing.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/Platform/PlatformListing.jsx @@ -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 () { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTable.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTable.jsx index f3eb9a065c..461d4790c8 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTable.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTable.jsx @@ -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. diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTableHeader.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTableHeader.jsx index bacd63d5d9..1fbf4f9679 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTableHeader.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTableHeader.jsx @@ -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. diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTableRow.jsx b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTableRow.jsx index 98c680789a..073a37aacb 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTableRow.jsx +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/components/UIComponents/DataTableRow.jsx @@ -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. diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/theme.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/theme.js index 02b3f19964..c2a3028b21 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/theme.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.ui/src/main/resources/publisher/src/theme.js @@ -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