Add app context path to urls

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

@ -10,8 +10,9 @@
</span>
<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>
<div class="wr-input-control">
<input type="text right" id="name" placeholder="Group Name">

@ -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;
}

@ -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(

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

@ -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;

@ -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);

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

Loading…
Cancel
Save