From 7ac755a33fd01fe56bc3e0bd6b467df481c1c705 Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Fri, 7 Aug 2015 12:30:20 +0530 Subject: [PATCH] adding group tile --- .../jaggeryapps/iotserver/api/device-api.jag | 4 +-- .../jaggeryapps/iotserver/api/policy-api.jag | 3 +- .../jaggeryapps/iotserver/api/user-api.jag | 3 +- .../iotserver/units/dashboard/dashboard.hbs | 28 +++++++++++++++++++ .../units/dashboard/public/js/dashboard.js | 3 +- 5 files changed, 34 insertions(+), 7 deletions(-) diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/api/device-api.jag b/modules/distribution/src/repository/jaggeryapps/iotserver/api/device-api.jag index 9337c8ed..e7de6454 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/api/device-api.jag +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/api/device-api.jag @@ -105,7 +105,7 @@ if (uriMatcher.match("/{context}/api/device/sketch/download/{downloadId}")) { sketchGenerateLinkEndPoint = deviceManagerService + "/device/" + sketchType + "/generate_link"; var fileId = get(sketchGenerateLinkEndPoint + "?owner=" + user.username, null, "text"); - result = "curl -k " + carbonHttpsServletTransport + constants.WEB_APP_CONTEXT + "/api/device/sketch/download/" + fileId.data + " > agent.zip"; + result = "curl -k " + carbonHttpsServletTransport + constants.WEB_APP_CONTEXT + "/api/device/sketch/download/" + fileId.data; } } @@ -193,7 +193,7 @@ if (uriMatcher.match("/{context}/api/device/sketch/download/{downloadId}")) { count++; } } - result.data = count; + result = count.toString(); } else if (uriMatcher.match("/{context}/api/devices/types")) { diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/api/policy-api.jag b/modules/distribution/src/repository/jaggeryapps/iotserver/api/policy-api.jag index d0bc221a..154ab016 100755 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/api/policy-api.jag +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/api/policy-api.jag @@ -59,8 +59,7 @@ if (uriMatcher.match("/{context}/api/policies/update")) { result = 500; } } else if (uriMatcher.match("/{context}/api/policies/count")) { - result = {} - result.data = policyModule.getPolicies().length; + result = policyModule.getPolicies().length.toString(); } // returning the result. diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/api/user-api.jag b/modules/distribution/src/repository/jaggeryapps/iotserver/api/user-api.jag index 7c7f2171..8457a67f 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/api/user-api.jag +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/api/user-api.jag @@ -141,8 +141,7 @@ if (uriMatcher.match("/{context}/api/user/login/")) { result = userModule.getUsers(); } else if (uriMatcher.match("/{context}/api/users/count")) { - result = {}; - result.data = userModule.getUsers().length; + result = userModule.getUsers().length; } // returning the result. 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 32f87c21..4a363d5e 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/dashboard.hbs +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/dashboard.hbs @@ -59,6 +59,34 @@ {{/if}} +
+
+
Groups
+
+
+ +
+
+
+
Policies
diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/public/js/dashboard.js b/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/public/js/dashboard.js index ee21fbe8..72f980f7 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/public/js/dashboard.js +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/public/js/dashboard.js @@ -2,7 +2,7 @@ var updateStats = function (serviceURL, id) { invokerUtil.get( serviceURL, function (result) { - $(id).html(JSON.parse(result).data); + $(id).html(JSON.parse(result)); }, function (message) { console.log(message); } @@ -11,6 +11,7 @@ var updateStats = function (serviceURL, id) { $(document).ready(function(){ updateStats("/iotserver/api/devices/count", "#device-count"); + updateStats("/iotserver/api/group/all/count", "#group-count"); updateStats("/iotserver/api/policies/count", "#policy-count"); updateStats("/iotserver/api/users/count", "#user-count"); }); \ No newline at end of file