From f435d6d1b4c711707e2792ec214f99b2c8e94d91 Mon Sep 17 00:00:00 2001 From: Rasika Date: Mon, 6 Jul 2015 13:58:41 +0530 Subject: [PATCH] fixing errors --- .../src/repository/jaggeryapps/iotserver/modules/device.js | 2 +- .../jaggeryapps/iotserver/units/dashboard/dashboard.hbs | 4 +++- .../jaggeryapps/iotserver/units/dashboard/dashboard.js | 3 +++ .../units/device-listing/public/js/device-listing.js | 3 +-- .../device-listing/public/templates/device-listing.hbs | 6 +++--- 5 files changed, 11 insertions(+), 7 deletions(-) diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/modules/device.js b/modules/distribution/src/repository/jaggeryapps/iotserver/modules/device.js index f29aaeb9..bf69621c 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/modules/device.js +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/modules/device.js @@ -177,7 +177,7 @@ deviceModule = function () { var data = {}; //XMLHTTPRequest's POST - return post(updateDeviceEndpoint+ "?name="+device.name, data, "json"); + return post(updateDeviceEndpoint+ "?name="+device.name, data, "text"); }; /* diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/dashboard.hbs b/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/dashboard.hbs index c2f9870e..07e7116b 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/dashboard.hbs +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/dashboard.hbs @@ -11,7 +11,7 @@
Loading... - + @@ -23,6 +23,7 @@
+ {{#if permissions.ADD_USER}}
Users
@@ -50,6 +51,7 @@
+ {{/if}}
Policies
diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/dashboard.js b/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/dashboard.js index 688371b4..a28530c1 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/dashboard.js +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/dashboard.js @@ -1,3 +1,6 @@ function onRequest(context){ + var userModule = require("/modules/user.js").userModule; + var permissions = userModule.getUIPermissions(); + context.permissions = permissions; return context; } diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/units/device-listing/public/js/device-listing.js b/modules/distribution/src/repository/jaggeryapps/iotserver/units/device-listing/public/js/device-listing.js index 5e4565d5..9f91dd7e 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/units/device-listing/public/js/device-listing.js +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/device-listing/public/js/device-listing.js @@ -301,8 +301,7 @@ function attachEvents() { showPopup(); $("a#edit-device-yes-link").click(function () { - device={}; - device.name = $('#edit-device-name').val(); + var device={"device":{"name" : $('#edit-device-name').val()}}; invokerUtil.post( editDeviceAPI, device, diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/units/device-listing/public/templates/device-listing.hbs b/modules/distribution/src/repository/jaggeryapps/iotserver/units/device-listing/public/templates/device-listing.hbs index e7d40e4c..58b12d9b 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/units/device-listing/public/templates/device-listing.hbs +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/device-listing/public/templates/device-listing.hbs @@ -20,21 +20,21 @@ {{status}}