From 0ed24f4c8812a267c7b663f9900fbd5e5303d743 Mon Sep 17 00:00:00 2001 From: charithag Date: Mon, 24 Aug 2015 11:01:14 +0530 Subject: [PATCH] Add app context path to urls --- .../iotserver/units/group-add/group-add.hbs | 3 ++- .../iotserver/units/group-add/group-add.js | 3 ++- .../units/group-add/public/js/group-add.js | 2 +- .../units/group-listing/group-listing.hbs | 3 ++- .../units/group-listing/group-listing.js | 4 ++++ .../group-listing/public/js/group-listing.js | 15 +++++++++------ .../public/templates/group-listing.hbs | 6 +++--- 7 files changed, 23 insertions(+), 13 deletions(-) diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-add/group-add.hbs b/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-add/group-add.hbs index 620a9a50..0732d8fc 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-add/group-add.hbs +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-add/group-add.hbs @@ -10,8 +10,9 @@
+ -
+
diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-add/group-add.js b/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-add/group-add.js index 10097811..e8b55a2b 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-add/group-add.js +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-add/group-add.js @@ -1,4 +1,5 @@ function onRequest(context){ - context.registerPath = "api/user/register"; + var dcProps = require('/config/dc-props.js').config(); + context.appContext = dcProps.appContext; return context; } diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-add/public/js/group-add.js b/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-add/public/js/group-add.js index 527c83dd..942fc00b 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-add/public/js/group-add.js +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-add/public/js/group-add.js @@ -10,7 +10,7 @@ $(function () { return false; } else { - var addGroupAPI = "/iotserver/api/group/add"; + var addGroupAPI = $("#group-api-ep").val(); var group = {"name": name, "description": description}; invokerUtil.post( diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-listing/group-listing.hbs b/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-listing/group-listing.hbs index 2374c191..c78aa158 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-listing/group-listing.hbs +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-listing/group-listing.hbs @@ -1,6 +1,7 @@ {{#zone "main"}} +
@@ -18,7 +19,7 @@

You don't have any Groups registered at the moment.

- + diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-listing/group-listing.js b/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-listing/group-listing.js index fc048f66..9773392b 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-listing/group-listing.js +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-listing/group-listing.js @@ -1,6 +1,10 @@ var log = new Log("modules/group-listing.js"); function onRequest(context){ + + var dcProps = require('/config/dc-props.js').config(); + context.appContext = dcProps.appContext; + var constants = require("/modules/constants.js"); var permissions = []; //var userModule = require("/modules/user.js").userModule; diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-listing/public/js/group-listing.js b/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-listing/public/js/group-listing.js index 7abd030f..120ebd2f 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-listing/public/js/group-listing.js +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-listing/public/js/group-listing.js @@ -42,6 +42,8 @@ var groupCheckbox = "#ast-container .ctrl-wr-asset .itm-select input[type='checkbox']"; var assetContainer = "#ast-container"; +var app_context = $("#app-context").val(); + /* * DOM ready functions. */ @@ -130,7 +132,7 @@ function loadGroups(searchType, searchParam) { $.template("group-listing", groupListingSrc, function (template) { var serviceURL; if ($.hasPermission("LIST_GROUPS")) { - serviceURL = "/iotserver/api/group/all"; + serviceURL = app_context + "api/group/all"; } else { $("#ast-container").html("Permission denied"); return; @@ -148,6 +150,7 @@ function loadGroups(searchType, searchParam) { data = JSON.parse(data); var viewModel = {}; viewModel.groups = data; + viewModel.appContext = app_context; viewModel.imageLocation = imageResource; if (!data || data.length <= 0) { $("#ast-container").html($("#no-groups-div-content").html()); @@ -248,7 +251,7 @@ function attachEvents() { $('#user-names').html('Loading...'); showPopup(); $("a#share-group-next-link").hide(); - invokerUtil.get("/iotserver/api/users", + invokerUtil.get(app_context+ "api/users", function (data, txtStatus, jqxhr) { var users = JSON.parse(data); var status = jqxhr.status; @@ -274,7 +277,7 @@ function attachEvents() { $(modalPopupContent).html($('#share-group-w2-modal-content').html()); $('#user-roles').html('Loading...'); $("a#share-group-yes-link").hide(); - invokerUtil.get("/iotserver/api/group/id/" + groupId + "/" + selectedUser + "/rolemapping", + invokerUtil.get(app_context+"api/group/id/" + groupId + "/" + selectedUser + "/rolemapping", function (data, txtStatus, jqxhr) { var roleMap = JSON.parse(data); var status = jqxhr.status; @@ -304,7 +307,7 @@ function attachEvents() { updatedRoleMap.push(roleMap[role]); } } - invokerUtil.post("/iotserver/api/group/id/" + groupId + "/" + selectedUser + "/roleupdate", + invokerUtil.post(app_context+ "api/group/id/" + groupId + "/" + selectedUser + "/roleupdate", updatedRoleMap, function (data, txtStatus, jqxhr) { var status = jqxhr.status; @@ -354,7 +357,7 @@ function attachEvents() { */ $("a.remove-group-link").click(function () { var groupId = $(this).data("groupid"); - var removeGroupApi = "/iotserver/api/group/id/" + groupId + "/remove"; + var removeGroupApi = app_context+ "api/group/id/" + groupId + "/remove"; $(modalPopupContent).html($('#remove-group-modal-content').html()); showPopup(); @@ -395,7 +398,7 @@ function attachEvents() { var groupId = $(this).data("groupid"); var groupName = $(this).data("groupname"); var groupDescription = $(this).data("groupdescription"); - var editGroupApi = "/iotserver/api/group/id/" + groupId + "/update"; + var editGroupApi = app_context + "api/group/id/" + groupId + "/update"; $(modalPopupContent).html($('#edit-group-modal-content').html()); $('#edit-group-name').val(groupName); diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-listing/public/templates/group-listing.hbs b/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-listing/public/templates/group-listing.hbs index d85363af..e8f17a43 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-listing/public/templates/group-listing.hbs +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/group-listing/public/templates/group-listing.hbs @@ -1,6 +1,6 @@ {{#each groups}} {{groupMap this}} - + @@ -38,14 +38,14 @@ View - + Devices - +