Refactoring base ui app config reader

merge-requests/7/head
dilanua 8 years ago
parent 1916c4df5f
commit c12630e65c

@ -22,7 +22,7 @@ var log = new Log("api/data-tables-invoker-api.jag");
var uri = request.getRequestURI();
var uriMatcher = new URIMatcher(String(uri));
var devicemgtProps = require("/app/conf/devicemgt-props.js").config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
var serviceInvokers = require("/app/modules/backend-service-invoker.js")["backendServiceInvoker"];
function appendQueryParam (url, queryParam , value) {

@ -24,7 +24,7 @@ var log = new Log("api/device-api.jag");
var constants = require("/app/modules/constants.js");
var deviceModule = require("/app/modules/device.js").deviceModule;
var utility = require("/app/modules/utility.js").utility;
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
var userModule = require("/app/modules/user.js").userModule;
var serviceInvokers = require("/app/modules/backend-service-invoker.js").backendServiceInvoker;

@ -23,7 +23,7 @@ var uriMatcher = new URIMatcher(String(uri));
var log = new Log("api/device-api.jag");
var constants = require("/app/modules/constants.js");
var utility = require("/app/modules/utility.js").utility;
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
var serviceInvokers = require("/app/modules/backend-service-invoker.js").backendServiceInvoker;
var user = session.get(constants.USER_SESSION_KEY);

@ -23,7 +23,7 @@ var uri = request.getRequestURI();
var uriMatcher = new URIMatcher(String(uri));
var constants = require("/app/modules/constants.js");
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
var serviceInvokers = require("/app/modules/backend-service-invoker.js")["backendServiceInvoker"];
if (uriMatcher.match("/{context}/api/invoker/execute/")) {

@ -23,7 +23,7 @@ var uriMatcher = new URIMatcher(String(uri));
var log = new Log("api/operation-api.jag");
var serviceInvokers = require("/app/modules/backend-service-invoker.js")["backendServiceInvoker"];
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
if (uriMatcher.match("/{context}/api/operation/paginate")) {
var deviceType = request.getParameter("deviceType");

@ -23,7 +23,7 @@ var uriMatcher = new URIMatcher(String(uri));
var log = new Log("api/user-api.jag");
var constants = require("/app/modules/constants.js");
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
var userModule = require("/app/modules/user.js").userModule;
var deviceModule = require("/app/modules/device.js").deviceModule;
var utility = require("/app/modules/utility.js").utility;

@ -19,9 +19,9 @@
var config = function () {
var conf = application.get("UI_CONFIG");
if (!conf) {
var pinch = require("/app/modules/pinch.min.js")["pinch"];
var server = require("carbon")["server"];
var pinch = require("/app/conf/reader/pinch.min.js")["pinch"];
var config = require("/app/conf/config.json");
var server = require("carbon")["server"];
pinch(config, /^/, function (path, key, value) {
if ((typeof value === "string") && value.indexOf("%https.ip%") > -1) {
return value.replace("%https.ip%", server.address("https"));

@ -20,7 +20,7 @@ var apiWrapperUtil = function () {
var module = {};
var tokenUtil = require("/app/modules/util.js").util;
var constants = require("/app/modules/constants.js");
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
var log = new Log("/app/modules/api-wrapper-util.js");
module.refreshToken = function () {

@ -31,7 +31,7 @@ var backendServiceInvoker = function () {
var TOKEN_EXPIRED = "Access token expired";
var TOKEN_INVALID = "Invalid input. Access token validation failed";
var devicemgtProps = require("/app/conf/devicemgt-props.js").config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
var constants = require("/app/modules/constants.js");
var userModule = require("/app/modules/user.js")["userModule"];
var tokenUtil = require("/app/modules/api-wrapper-util.js")["apiWrapperUtil"];

@ -22,7 +22,7 @@ deviceModule = function () {
var utility = require('/app/modules/utility.js').utility;
var constants = require('/app/modules/constants.js');
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
var serviceInvokers = require("/app/modules/backend-service-invoker.js").backendServiceInvoker;
var ArrayList = Packages.java.util.ArrayList;

@ -22,7 +22,7 @@ var groupModule = {};
var userModule = require("/app/modules/user.js").userModule;
var constants = require('/app/modules/constants.js');
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
var utility = require("/app/modules/utility.js").utility;
var serviceInvokers = require("/app/modules/backend-service-invoker.js").backendServiceInvoker;

@ -17,7 +17,7 @@
*/
var carbonModule = require("carbon");
var devicemgtProps = require("/app/conf/devicemgt-props.js").config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
var carbonServer = new carbonModule.server.Server({
tenanted: true,
url: devicemgtProps["httpsURL"] + "/admin"

@ -33,7 +33,7 @@ var onFail;
properties = {username: context.input.username, password: context.input.password};
apiWrapperUtil.setupAccessTokenPair(constants.GRANT_TYPE_PASSWORD, properties);
}
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
var carbonServer = require("carbon").server;
(new carbonServer.Server({url: devicemgtProps["adminService"]}))
.login(context.input.username, context.input.password);

@ -20,7 +20,7 @@ var operationModule = function () {
var log = new Log("/app/modules/operation.js");
var utility = require('/app/modules/utility.js').utility;
var constants = require('/app/modules/constants.js');
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
var serviceInvokers = require("/app/modules/backend-service-invoker.js").backendServiceInvoker;
var publicMethods = {};

@ -25,7 +25,7 @@ policyModule = function () {
var constants = require('/app/modules/constants.js');
var utility = require("/app/modules/utility.js")["utility"];
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
var serviceInvokers = require("/app/modules/backend-service-invoker.js").backendServiceInvoker;
var publicMethods = {};

@ -24,7 +24,7 @@ var userModule = function () {
var constants = require("/app/modules/constants.js");
var utility = require("/app/modules/utility.js")["utility"];
var devicemgtProps = require("/app/conf/devicemgt-props.js").config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
var serviceInvokers = require("/app/modules/backend-service-invoker.js")["backendServiceInvoker"];
/* Initializing user manager */

@ -21,7 +21,7 @@ var util = function () {
var module = {};
var Base64 = Packages.org.apache.commons.codec.binary.Base64;
var String = Packages.java.lang.String;
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
var carbon = require('carbon');
var constants = require("/app/modules/constants.js");
var adminUser = devicemgtProps["adminUser"];

@ -20,7 +20,7 @@ var utility;
utility = function () {
var constants = require('/app/modules/constants.js');
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
var log = new Log("/app/modules/utility.js");
var JavaClass = Packages.java.lang.Class;
var PrivilegedCarbonContext = Packages.org.wso2.carbon.context.PrivilegedCarbonContext;

@ -21,7 +21,7 @@ function onRequest(context) {
var user = session.get(constants.USER_SESSION_KEY);
var userModule = require("/app/modules/user.js").userModule;
var permissions = userModule.getUIPermissions();
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
if (!permissions.VIEW_DASHBOARD) {
response.sendRedirect(constants.WEB_APP_CONTEXT + "/devices");

@ -23,7 +23,7 @@
* @returns {*} A context object that returns the dynamic state of this page to be presented
*/
function onRequest(context) {
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
var page = {};
page["groupNameJSRegEx"] = devicemgtProps.groupValidationConfig.groupNameJSRegEx;
page["groupNameRegExViolationErrorMsg"] = devicemgtProps.groupValidationConfig.groupNameRegExViolationErrorMsg;

@ -26,7 +26,7 @@ function onRequest(context) {
//var log = new Log("/app/pages/cdmf.page.user.create server-side js");
var userModule = require("/app/modules/user.js")["userModule"];
var devicemgtProps = require("/app/conf/devicemgt-props.js").config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
var page = {};
var response = userModule.getRolesByUserStore();

@ -20,7 +20,7 @@ function onRequest(context) {
var userModule = require("/app/modules/user.js").userModule;
var userName = request.getParameter("username");
var user = userModule.getUser(userName)["content"];
var devicemgtProps = require('/app/conf/devicemgt-props.js').config();
var devicemgtProps = require("/app/conf/reader/main.js").config();
if (user) {
var title;
if (user.firstname || user.lastname) {

@ -29,7 +29,7 @@ function onRequest(context) {
var page = {};
var userModule = require("/app/modules/user.js")["userModule"];
var deviceMgtProps = require("/app/conf/devicemgt-props.js").config();
require("/app/conf/reader/main.js").config();
page["adminUser"] = deviceMgtProps["adminUser"];
page["permissions"] = userModule.getUIPermissions();

@ -30,7 +30,7 @@ function onRequest (context) {
var userModule = require("/app/modules/user.js").userModule;
var constants = require("/app/modules/constants.js");
var permissions = userModule.getUIPermissions();
var mdmProps = require('/app/conf/devicemgt-props.js').config();
var mdmProps = require("/app/conf/reader/main.js").config();
context.permissions = permissions;
context["enrollmentURL"] = mdmProps.enrollmentURL;

@ -24,7 +24,7 @@
*/
function onRequest(context) {
var userModule = require("/app/modules/user.js")["userModule"];
var deviceMgtProps = require('/app/conf/devicemgt-props.js').config();
var deviceMgtProps = require("/app/conf/reader/main.js").config();
var response = userModule.getRoles();
if (response["status"] == "success") {
context["roles"] = response["content"];

@ -24,7 +24,7 @@
*/
function onRequest(context) {
var userModule = require("/app/modules/user.js")["userModule"];
var deviceMgtProps = require("/app/conf/devicemgt-props.js").config();
var deviceMgtProps = require("/app/conf/reader/main.js").config();
var uri = request.getRequestURI();
var uriMatcher = new URIMatcher(String(uri));
var isMatched = uriMatcher.match("/{context}/role/edit/{rolename}");

@ -30,7 +30,7 @@ function onRequest(context) {
if (userModule.isAuthorized("/permission/admin/device-mgt/roles/remove")) {
context["removePermitted"] = true;
}
var deviceMgtProps = require("/app/conf/devicemgt-props.js").config();
var deviceMgtProps = require("/app/conf/reader/main.js").config();
context["appContext"] = deviceMgtProps.appContext;
context["adminRole"] = deviceMgtProps.adminRole;
return context;

Loading…
Cancel
Save