forked from community/product-iots
parent
fbaa9a2e2f
commit
08e30b1efb
@ -0,0 +1,9 @@
|
||||
{{authorized}}
|
||||
{{layout "fluid"}}
|
||||
{{#zone "title"}}
|
||||
Events
|
||||
{{/zone}}
|
||||
{{#zone "body"}}
|
||||
{{unit "appbar" link="events" title="My Events"}}
|
||||
{{unit "events"}}
|
||||
{{/zone}}
|
@ -0,0 +1,20 @@
|
||||
{{#zone "main"}}
|
||||
<div class="container container-bg white-bg">
|
||||
<div class=" margin-top-double">
|
||||
<div class="row row padding-top-double padding-bottom-double margin-bottom-double">
|
||||
<div class="col-lg-12 margin-top-double">
|
||||
<h1 class="grey ">Events</h1>
|
||||
<hr>
|
||||
<p class="margin-bottom-double light-grey ">Events Analyzer </p>
|
||||
</div>
|
||||
<div id="event-stream-place-holder" style="padding-top: 20px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/zone}}
|
||||
{{#zone "bottomJs"}}
|
||||
<script src="{{self.publicURL}}/js/events.js"></script>
|
||||
<script id="event-stream" src="{{self.publicURL}}/templates/event-stream.hbs"
|
||||
type="text/x-handlebars-template"></script>
|
||||
{{/zone}}
|
@ -0,0 +1,6 @@
|
||||
function onRequest(context){
|
||||
var userModule = require("/modules/user.js").userModule;
|
||||
var permissions = userModule.getUIPermissions();
|
||||
context.permissions = permissions;
|
||||
return context;
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
$(document).ready(function () {
|
||||
displayEvents();
|
||||
});
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
||||
};
|
@ -0,0 +1,27 @@
|
||||
<div class="col-lg-12 wr-secondary-bar" style="width: inherit;">
|
||||
<label class="device-id device-select" style="font-size: 20px; margin-bottom: 0px;">
|
||||
Device Events Stream
|
||||
</label>
|
||||
</div>
|
||||
<br/>
|
||||
|
||||
<div style="padding: 15px;">
|
||||
<table class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="20%">Time</th>
|
||||
<th width="20%">Device</th>
|
||||
<th>Activity</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{{#each data}}
|
||||
<tr>
|
||||
<td width="20%" class="formatDate">{{time}}</td>
|
||||
<td width="20%">{{deviceName}}</td>
|
||||
<td>{{activity}}</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
Loading…
Reference in new issue