From b15e53298332e5cc018211beff97bb3f2ae817fa Mon Sep 17 00:00:00 2001 From: sinthuja Date: Fri, 6 Oct 2017 11:35:52 +0530 Subject: [PATCH] Fixing the store retrieve the backend details from config file. --- .../mgt/auth/handler/util/Constants.java | 18 +++++++++--------- .../store/src/common/configuration.js | 4 ++-- .../src/main/resources/store/src/config.json | 6 ------ .../src/main/resources/store/src/index.js | 6 +++--- 4 files changed, 14 insertions(+), 20 deletions(-) delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/config.json diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.authhandler/src/main/java/org/wso2/carbon/device/application/mgt/auth/handler/util/Constants.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.authhandler/src/main/java/org/wso2/carbon/device/application/mgt/auth/handler/util/Constants.java index 5837fd2d68..f413a5aaac 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.authhandler/src/main/java/org/wso2/carbon/device/application/mgt/auth/handler/util/Constants.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.authhandler/src/main/java/org/wso2/carbon/device/application/mgt/auth/handler/util/Constants.java @@ -20,16 +20,16 @@ package org.wso2.carbon.device.application.mgt.auth.handler.util; //TODO: Remove hardcoded localhost and ports public class Constants { - public static String SCOPES = "perm:application:get perm:application:create perm:application:update " + + public static final String SCOPES = "perm:application:get perm:application:create perm:application:update " + "perm:application-mgt:login perm:application:delete perm:platform:add perm:platform:remove " + "perm:roles:view perm:devices:view perm:platform:get"; - public static String[] TAGS = {"device_management"}; - public static String USER_NAME = "userName"; - public static String APPLICATION_NAME = "applicationmgt_publisher"; - public static String TOKEN_ENDPOINT = "https://localhost:8243"; - public static String PASSWORD_GRANT_TYPE = "password"; - public static String REFRESH_GRANT_TYPE = "refresh_token"; - public static String API_APPLICATION_ENDPOINT = "https://localhost:9443/api-application-registration/"; - public static String APPLICATION_INFO = "application_info"; + public static final String[] TAGS = {"device_management"}; + public static final String USER_NAME = "userName"; + public static final String APPLICATION_NAME = "applicationmgt_publisher"; + public static final String TOKEN_ENDPOINT = "https://localhost:8243"; + public static final String PASSWORD_GRANT_TYPE = "password"; + public static final String REFRESH_GRANT_TYPE = "refresh_token"; + public static final String API_APPLICATION_ENDPOINT = "https://localhost:9443/api-application-registration/"; + public static final String APPLICATION_INFO = "application_info"; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/common/configuration.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/common/configuration.js index a7781af3c4..0d6367a3ad 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/common/configuration.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/common/configuration.js @@ -34,7 +34,7 @@ class Configuration { loadConfiguration(callback) { let thisObject = this; - axios.get(thisObject.hostConstants.baseURL + "/config.json").then(function (response) { + axios.get(thisObject.hostConstants.baseURL + '/' + thisObject.hostConstants.appContext + "/config.json").then(function (response) { thisObject.serverConfig = response.data.config; Constants.load(); callback(); @@ -45,4 +45,4 @@ class Configuration { } -export default (new Configuration); +export default (new Configuration()); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/config.json b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/config.json deleted file mode 100644 index 3be10b8ce9..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/config.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "theme": { - "type": "default", - "value": "lightBaseTheme" - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/index.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/index.js index e414703ec3..b9bc86bba4 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/index.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/src/main/resources/store/src/index.js @@ -28,9 +28,8 @@ import Configuration from './common/configuration'; function loadStore() { const possibleLocale = navigator.language.split("-")[0]; - //TODO: baseURL: Configuration.hostConstants.baseURL + "/" + Configuration.hostConstants.appContext + "/locales/" let loadLocaleFile = Axios.create({ - baseURL: Configuration.hostConstants.baseURL + "/locales/" + baseURL: Configuration.hostConstants.baseURL + "/" + Configuration.hostConstants.appContext + "/locales/" + possibleLocale + ".json" }).get(); @@ -47,7 +46,8 @@ function loadStore() { }).catch(error => { addLocaleData(require('react-intl/locale-data/en')); let defaultLocale = Axios.create({ - baseURL: Configuration.hostConstants.baseURL + "/" + "locales/" + Constants.defaultLocale + ".json" + baseURL: Configuration.hostConstants.baseURL + "/" + Configuration.hostConstants.appContext + "/locales" + + Constants.defaultLocale + ".json" }).get(); defaultLocale.then(response => { const messages = defineMessages(response.data);