Add app context path to urls

merge-requests/1/head
charithag 9 years ago
parent 11a4966f1b
commit 0ed24f4c88

@ -10,8 +10,9 @@
</span> </span>
<hr /> <hr />
<input type="hidden" id="group-api-ep" value="{{appContext}}api/group/add">
<form method="GET" class="form-login-box" action="/iotserver/groups"> <form method="GET" class="form-login-box" action="{{appContext}}groups">
<label class="wr-input-label">Group Name</label> <label class="wr-input-label">Group Name</label>
<div class="wr-input-control"> <div class="wr-input-control">
<input type="text right" id="name" placeholder="Group Name"> <input type="text right" id="name" placeholder="Group Name">

@ -1,4 +1,5 @@
function onRequest(context){ function onRequest(context){
context.registerPath = "api/user/register"; var dcProps = require('/config/dc-props.js').config();
context.appContext = dcProps.appContext;
return context; return context;
} }

@ -10,7 +10,7 @@ $(function () {
return false; return false;
} else { } else {
var addGroupAPI = "/iotserver/api/group/add"; var addGroupAPI = $("#group-api-ep").val();
var group = {"name": name, "description": description}; var group = {"name": name, "description": description};
invokerUtil.post( invokerUtil.post(

@ -1,6 +1,7 @@
{{#zone "main"}} {{#zone "main"}}
<span id="permission" data-permission="{{permissions}}"></span> <span id="permission" data-permission="{{permissions}}"></span>
<span id="user-details" data-username="{{user.username}}"></span> <span id="user-details" data-username="{{user.username}}"></span>
<input type="hidden" id="app-context" value="{{appContext}}">
<!-- form content placeholder --> <!-- form content placeholder -->
<div id="ast-container" class="ast-container list-view"> <div id="ast-container" class="ast-container list-view">
<!-- no devices found --> <!-- no devices found -->
@ -18,7 +19,7 @@
<div class="ctrl-info-panel col-md-6 col-centered"> <div class="ctrl-info-panel col-md-6 col-centered">
<h2>You don't have any Groups registered at the moment.</h2> <h2>You don't have any Groups registered at the moment.</h2>
<p> <p>
<a href="/iotserver/groups/add-group" class="cu-btn add-group-link"> <a href="{{appContext}}groups/add-group" class="cu-btn add-group-link">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i> <i class="fw fw-add fw-stack-1x"></i>

@ -1,6 +1,10 @@
var log = new Log("modules/group-listing.js"); var log = new Log("modules/group-listing.js");
function onRequest(context){ function onRequest(context){
var dcProps = require('/config/dc-props.js').config();
context.appContext = dcProps.appContext;
var constants = require("/modules/constants.js"); var constants = require("/modules/constants.js");
var permissions = []; var permissions = [];
//var userModule = require("/modules/user.js").userModule; //var userModule = require("/modules/user.js").userModule;

@ -42,6 +42,8 @@
var groupCheckbox = "#ast-container .ctrl-wr-asset .itm-select input[type='checkbox']"; var groupCheckbox = "#ast-container .ctrl-wr-asset .itm-select input[type='checkbox']";
var assetContainer = "#ast-container"; var assetContainer = "#ast-container";
var app_context = $("#app-context").val();
/* /*
* DOM ready functions. * DOM ready functions.
*/ */
@ -130,7 +132,7 @@ function loadGroups(searchType, searchParam) {
$.template("group-listing", groupListingSrc, function (template) { $.template("group-listing", groupListingSrc, function (template) {
var serviceURL; var serviceURL;
if ($.hasPermission("LIST_GROUPS")) { if ($.hasPermission("LIST_GROUPS")) {
serviceURL = "/iotserver/api/group/all"; serviceURL = app_context + "api/group/all";
} else { } else {
$("#ast-container").html("Permission denied"); $("#ast-container").html("Permission denied");
return; return;
@ -148,6 +150,7 @@ function loadGroups(searchType, searchParam) {
data = JSON.parse(data); data = JSON.parse(data);
var viewModel = {}; var viewModel = {};
viewModel.groups = data; viewModel.groups = data;
viewModel.appContext = app_context;
viewModel.imageLocation = imageResource; viewModel.imageLocation = imageResource;
if (!data || data.length <= 0) { if (!data || data.length <= 0) {
$("#ast-container").html($("#no-groups-div-content").html()); $("#ast-container").html($("#no-groups-div-content").html());
@ -248,7 +251,7 @@ function attachEvents() {
$('#user-names').html('Loading...'); $('#user-names').html('Loading...');
showPopup(); showPopup();
$("a#share-group-next-link").hide(); $("a#share-group-next-link").hide();
invokerUtil.get("/iotserver/api/users", invokerUtil.get(app_context+ "api/users",
function (data, txtStatus, jqxhr) { function (data, txtStatus, jqxhr) {
var users = JSON.parse(data); var users = JSON.parse(data);
var status = jqxhr.status; var status = jqxhr.status;
@ -274,7 +277,7 @@ function attachEvents() {
$(modalPopupContent).html($('#share-group-w2-modal-content').html()); $(modalPopupContent).html($('#share-group-w2-modal-content').html());
$('#user-roles').html('Loading...'); $('#user-roles').html('Loading...');
$("a#share-group-yes-link").hide(); $("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) { function (data, txtStatus, jqxhr) {
var roleMap = JSON.parse(data); var roleMap = JSON.parse(data);
var status = jqxhr.status; var status = jqxhr.status;
@ -304,7 +307,7 @@ function attachEvents() {
updatedRoleMap.push(roleMap[role]); updatedRoleMap.push(roleMap[role]);
} }
} }
invokerUtil.post("/iotserver/api/group/id/" + groupId + "/" + selectedUser + "/roleupdate", invokerUtil.post(app_context+ "api/group/id/" + groupId + "/" + selectedUser + "/roleupdate",
updatedRoleMap, updatedRoleMap,
function (data, txtStatus, jqxhr) { function (data, txtStatus, jqxhr) {
var status = jqxhr.status; var status = jqxhr.status;
@ -354,7 +357,7 @@ function attachEvents() {
*/ */
$("a.remove-group-link").click(function () { $("a.remove-group-link").click(function () {
var groupId = $(this).data("groupid"); 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()); $(modalPopupContent).html($('#remove-group-modal-content').html());
showPopup(); showPopup();
@ -395,7 +398,7 @@ function attachEvents() {
var groupId = $(this).data("groupid"); var groupId = $(this).data("groupid");
var groupName = $(this).data("groupname"); var groupName = $(this).data("groupname");
var groupDescription = $(this).data("groupdescription"); 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()); $(modalPopupContent).html($('#edit-group-modal-content').html());
$('#edit-group-name').val(groupName); $('#edit-group-name').val(groupName);

@ -1,6 +1,6 @@
{{#each groups}} {{#each groups}}
{{groupMap this}} {{groupMap this}}
<form id="group-data-form-{{id}}" action="/iotserver/group/{{id}}" method="POST"> <form id="group-data-form-{{id}}" action="{{../appContext}}group/{{id}}" method="POST">
<input type="hidden" name="name" value="{{name}}"> <input type="hidden" name="name" value="{{name}}">
<input type="hidden" name="deviceCount" value="{{deviceCount}}"> <input type="hidden" name="deviceCount" value="{{deviceCount}}">
<input type="hidden" name="dateOfCreation" value="{{dateOfCreation}}"> <input type="hidden" name="dateOfCreation" value="{{dateOfCreation}}">
@ -38,14 +38,14 @@
</span> </span>
<span class="lbl-action">View</span> <span class="lbl-action">View</span>
</a> </a>
<a href="/iotserver/devices?groupId={{id}}"> <a href="{{../appContext}}devices?groupId={{id}}">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-devices fw-stack-1x"></i> <i class="fw fw-devices fw-stack-1x"></i>
</span> </span>
<span class="lbl-action">Devices</span> <span class="lbl-action">Devices</span>
</a> </a>
<a href="/iotserver/analytics?groupId={{id}}&name={{name}}"> <a href="{{../appContext}}analytics?groupId={{id}}&name={{name}}">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-statistics fw-stack-1x"></i> <i class="fw fw-statistics fw-stack-1x"></i>

Loading…
Cancel
Save