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 e8cf3aa4..8d897e66 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/dashboard.hbs +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/dashboard.hbs @@ -118,9 +118,11 @@ -
+
{{/zone}} {{#zone "bottomJs"}} + {{/zone}} \ No newline at end of file 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 3ea1cb56..7662c29c 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 @@ -9,11 +9,37 @@ var updateStats = function (serviceURL, id) { ); }; -$(document).ready(function(){ +$(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"); + displayEvents(); +}); -}); \ No newline at end of file +var displayEvents = function () { + var eventListing = $("#event-stream"); + var eventListingSrc = eventListing.attr("src"); + $.template("event-stream", eventListingSrc, function (template) { + var serviceURL = "/iotserver/api/event/list"; + var successCallback = function (data) { + var viewModel = {}; + viewModel.data = JSON.parse(data); + var content = template(viewModel); + $("#event-stream-place-holder").html(content); + formatDates(); + }; + invokerUtil.get(serviceURL, + successCallback, function (message) { + console.log(message); + }); + }); +} + +function formatDates() { + $(".formatDate").each(function () { + var timeStamp = $(this).html(); + $(this).html(new Date(parseInt(timeStamp)).toUTCString()); + }); +} diff --git a/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/public/templates/event-stream.hbs b/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/public/templates/event-stream.hbs index 35e004c4..accd43dc 100644 --- a/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/public/templates/event-stream.hbs +++ b/modules/distribution/src/repository/jaggeryapps/iotserver/units/dashboard/public/templates/event-stream.hbs @@ -1,6 +1,6 @@

@@ -17,8 +17,8 @@ {{#each data}} - {{time}} - {{deviceIdentifier}} + {{time}} + {{deviceName}} {{activity}} {{/each}}