Add Sonar graph to analytics. Fix undefined content issue in device details

application-manager-new
charithag 9 years ago
parent 019f077ea4
commit d7c6c083a0

@ -79,6 +79,7 @@ function getFireAlarmData(user, deviceId, from, to) {
result['temperatureData'] = getSensorData("DEVICE_TEMPERATURE_SUMMARY", "TEMPERATURE", user, deviceId, from, to);
result['fanData'] = getSensorData("DEVICE_FAN_USAGE_SUMMARY", "status", user, deviceId, from, to);
result['bulbData'] = getSensorData("DEVICE_BULB_USAGE_SUMMARY", "status", user, deviceId, from, to);
result['sonarData'] = getSensorData("SONAR_SENSOR_SUMMARY", "sonar", user, deviceId, from, to);
return result;
}

@ -0,0 +1,9 @@
{{authorized}}
{{layout "fluid"}}
{{#zone "title"}}
WSO2 DC | Analytics
{{/zone}}
{{#zone "body"}}
{{unit "appbar" link="analytics" title="Group Analytics"}}
{{unit "analytics"}}
{{/zone}}

@ -1,9 +1,10 @@
{{#zone "main"}}
<span id="request-group-id" data-groupId="{{groupId}}"></span>
<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 ">Device Statistics</h1>
<h1 class="grey ">{{title}}</h1>
<hr>
</div>
</div>

@ -1,4 +1,13 @@
function onRequest(context){
context.sketchPath = "api/device/sketch";
var groupId = request.getParameter("groupId");
if (groupId){
context.groupId = groupId;
context.title = "Group Analytics";
}else{
context.groupId = 0;
context.title = "Device Analytics";
}
return context;
}

@ -1,7 +1,8 @@
{{#zone "main"}}
<div class="row wr-device-board">
<div class="col-lg-12 wr-secondary-bar">
<label class="device-id device-select" data-deviceid="{{device.deviceIdentifier}}" data-type="{{device.type}}">
<label class="device-id device-select" data-deviceid="{{device.deviceIdentifier}}"
data-type="{{device.type}}">
Device {{device.name}}
<span class="lbl-device">
{{#if device.viewModel.vendor}}
@ -13,7 +14,6 @@
</div>
<div class="wr-device-list row">
<div class="wr-hidden-operations wr-advance-operations">
</div>
<div class="col-md-12 wr-page-content">
{{unit "operation-bar" deviceType=device.type}}
@ -25,11 +25,12 @@
<div class="col-lg-2 ast-desc-image">
<div class="row">
<div class="col-lg-12 col-sm-4">
<img src="{{self.publicURL}}/img/device_icons/{{device.type}}.png" style="width:200px" />
<img src="{{self.publicURL}}/img/device_icons/{{device.type}}.png" style="width:200px"/>
</div>
<div class="col-lg-12 col-sm-4 ast-desc">
<div class="ast-device-desc"><b>Owner:</b> {{device.owner}}</div>
<div class="ast-device-desc"><b>Date of Enrollment:</b><br/> <span class="formatDate">{{device.enrollment}}</span></div>
<div class="ast-device-desc"><b>Date of Enrollment:</b><br/> <span
class="formatDate">{{device.dateOfEnrolment}}</span></div>
<!--<div class="ast-device-desc"><b>Device:</b> {{device.viewModel.vendor}} {{device.properties.model}}</div>-->
<!--<div class="ast-device-desc"><b>Model:</b> {{device.viewModel.model}}</div>-->
<!--<div class="ast-device-desc"><b>IMEI:</b> {{device.viewModel.imei}}</div>-->
@ -63,7 +64,9 @@
<div class="tile-name">STORAGE</div>
<div>
<div class="tile-icon"><i class="fw fw-hdd"></i></div>
<div class="tile-stats">{{device.viewModel.DeviceCapacityPercentage}}%<span class="tile-stats-free">{{device.viewModel.DeviceCapacityUsed}} GB Free</span></div>
<div class="tile-stats">{{device.viewModel.DeviceCapacityPercentage}}
%<span class="tile-stats-free">{{device.viewModel.DeviceCapacityUsed}}
GB Free</span></div>
</div>
</div>
</div>
@ -74,7 +77,9 @@
<div class="tile-name">LOCAL STORAGE</div>
<div>
<div class="tile-icon"><i class="fw fw-hdd"></i></div>
<div class="tile-stats">{{device.viewModel.internal_memory.DeviceCapacityPercentage}}%<span class="tile-stats-free">{{device.viewModel.internal_memory.FreeCapacity}} GB Free</span></div>
<div class="tile-stats">{{device.viewModel.internal_memory.DeviceCapacityPercentage}}
%<span class="tile-stats-free">{{device.viewModel.internal_memory.FreeCapacity}}
GB Free</span></div>
</div>
</div>
</div>
@ -85,7 +90,9 @@
<div class="tile-name">EXTERNAL STORAGE</div>
<div>
<div class="tile-icon"><i class="fw fw-hdd"></i></div>
<div class="tile-stats">{{device.viewModel.external_memory.DeviceCapacityPercentage}}%<span class="tile-stats-free">{{device.viewModel.external_memory.FreeCapacity}} GB Free</span></div>
<div class="tile-stats">{{device.viewModel.external_memory.DeviceCapacityPercentage}}
%<span class="tile-stats-free">{{device.viewModel.external_memory.FreeCapacity}}
GB Free</span></div>
</div>
</div>
</div>
@ -101,7 +108,8 @@
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingFour">
<h2 class="sub-title panel-title">
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseFour" aria-expanded="false" aria-controls="collapseFour">
<a class="collapsed" data-toggle="collapse" data-parent="#accordion"
href="#collapseFour" aria-expanded="false" aria-controls="collapseFour">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
@ -110,9 +118,11 @@
</a>
</h2>
</div>
<div id="collapseFour" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingFour">
<div id="collapseFour" class="panel-collapse collapse" role="tabpanel"
aria-labelledby="headingFour">
<div class="panel-body">
<a href="../../devices/analytics?deviceId={{deviceId}}&deviceType={{deviceType}}" ><i class="fw fw-charts"></i> Show Statistics</a>
<a href="../../devices/analytics?deviceId={{deviceId}}&deviceType={{deviceType}}"><i
class="fw fw-charts"></i> Show Statistics</a>
</div>
</div>
</div>
@ -143,7 +153,8 @@
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingTwo">
<h2 class="sub-title panel-title">
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
<a class="collapsed" data-toggle="collapse" data-parent="#accordion"
href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
@ -152,7 +163,8 @@
</a>
</h2>
</div>
<div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
<div id="collapseTwo" class="panel-collapse collapse" role="tabpanel"
aria-labelledby="headingTwo">
<div class="panel-body">
Not available yet
</div>
@ -182,7 +194,6 @@
<!-- /installed applications -->
</div>
</div>

@ -16,54 +16,13 @@
* under the License.
*/
function formatDates(){
$(".formatDate").each(function(){
function formatDates() {
$(".formatDate").each(function () {
var timeStamp = $(this).html();
$(this).html(new Date(parseInt(timeStamp)).toUTCString());
});
}
(function () {
var deviceId = $(".device-id");
var deviceIdentifier = deviceId.data("deviceid");
var deviceType = deviceId.data("type");
var payload = [deviceIdentifier];
if (deviceType == "ios") {
var serviceUrl = "/ios/operation/deviceinfo";
} else if (deviceType == "android") {
var serviceUrl = "/mdm-android-agent/operation/device-info";
}
invokerUtil.post(serviceUrl, payload,
function(message){
console.log(message);
}, function (message) {
console.log(message);
});
$(document).ready(function(){
loadOperationBar(deviceType);
loadMap();
$(document).ready(function () {
formatDates();
});
function loadMap(){
var map;
function initialize() {
var mapOptions = {
zoom: 18
};
var lat = 6.9098591;
var long = 79.8523753;
map = new google.maps.Map(document.getElementById('device-location'),
mapOptions);
var pos = new google.maps.LatLng(lat,
long);
var marker = new google.maps.Marker({
position: pos,
map: map
});
map.setCenter(pos);
}
google.maps.event.addDomListener(window, 'load', initialize);
}
}());
});

@ -187,7 +187,7 @@ function loadDevices(searchType, searchParam) {
addDeviceSelectedClass(this);
});
attachEvents();
//formatDates();
formatDates();
}
};
invokerUtil.get(serviceURL,
@ -374,6 +374,9 @@ function attachEvents() {
* when a user clicks on "Group" link
* on Device Management page in WSO2 MDM Console.
*/
if (groupId && groupId != "0") {
$("a.group-device-link").remove();
}else{
$("a.group-device-link").click(function () {
var deviceId = $(this).data("deviceid");
var deviceType = $(this).data("devicetype");
@ -451,4 +454,6 @@ function attachEvents() {
hidePopup();
});
});
}
}

@ -14,10 +14,10 @@
<div class="ast-title">
<h3 class="ast-name">{{name}}</h3>
<span class="ast-auth">Device Type: {{type}}</span>
<span class="ast-auth">Date of Enrollment: <span class="formatDate">{{dateOfEnrolment}}</span></span>
<span class="ast-auth">Date of Enrollment: <span class="formatDate">{{enrolmentInfo.dateOfEnrolment}}</span></span>
</div>
<div class="ast-model">
<span class="ast-ver">{{owner}}</span>
<span class="ast-ver">{{enrolmentInfo.owner}}</span>
<span class="ast-published">{{status}}</span>
<div class="ast-btn-group">

Loading…
Cancel
Save