adding changes

application-manager-new
Rasika 10 years ago
parent f435d6d1b4
commit 15534b789f

@ -38,6 +38,7 @@ var FEATURE_DESCRIPTION = "featureDescription";
var PLATFORM_ANDROID = "android"; var PLATFORM_ANDROID = "android";
var PLATFORM_IOS = "ios"; var PLATFORM_IOS = "ios";
var DEVICE_ENROLLMENT = "enrollment";
var VENDOR_APPLE = "Apple"; var VENDOR_APPLE = "Apple";
var ERRORS = { var ERRORS = {

@ -167,6 +167,7 @@ deviceModule = function () {
var data = {}; var data = {};
//XMLHTTPRequest's GET //XMLHTTPRequest's GET
log.info(removeDeviceEndpoint);
return del(removeDeviceEndpoint, data, "text"); return del(removeDeviceEndpoint, data, "text");
}; };
@ -177,6 +178,7 @@ deviceModule = function () {
var data = {}; var data = {};
//XMLHTTPRequest's POST //XMLHTTPRequest's POST
log.info(updateDeviceEndpoint+ "?name="+device.name);
return post(updateDeviceEndpoint+ "?name="+device.name, data, "text"); return post(updateDeviceEndpoint+ "?name="+device.name, data, "text");
}; };
@ -264,7 +266,7 @@ deviceModule = function () {
properties[constants.DEVICE_VENDOR] = constants.VENDOR_APPLE; properties[constants.DEVICE_VENDOR] = constants.VENDOR_APPLE;
} }
deviceObject[constants.DEVICE_PROPERTIES] = properties; deviceObject[constants.DEVICE_PROPERTIES] = properties;
deviceObject[constants.DEVICE_ENROLLMENT] = device.getDateOfEnrolment();
return deviceObject; return deviceObject;
} }
}; };

@ -4,6 +4,6 @@
WSO2 DC | FireAlarm WSO2 DC | FireAlarm
{{/zone}} {{/zone}}
{{#zone "body"}} {{#zone "body"}}
{{unit "appbar" link="device-mgt" title="Device Management"}} {{unit "appbar" link="analytics" title="Device Analytics"}}
{{unit "analytics"}} {{unit "analytics"}}
{{/zone}} {{/zone}}

@ -9,7 +9,7 @@ function onRequest(context) {
"device-mgt": [], "device-mgt": [],
"store": [], "store": [],
"dashboard": [], "dashboard": [],
"statistics" : [] "analytics" : []
}; };
var dashboardLink = { var dashboardLink = {
title: "Go back to Dashboard", title: "Go back to Dashboard",
@ -35,7 +35,7 @@ function onRequest(context) {
links.profiles.push(dashboardLink); links.profiles.push(dashboardLink);
links.store.push(dashboardLink); links.store.push(dashboardLink);
links.store.push(storeLink); links.store.push(storeLink);
links.statistics.push(deviceMgtLink); links.analytics.push(deviceMgtLink);
links['device-mgt'].push(dashboardLink); links['device-mgt'].push(dashboardLink);
if (user) { if (user) {

@ -4,7 +4,9 @@
<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}} Device {{device.name}}
<span class="lbl-device"> <span class="lbl-device">
{{#if device.viewModel.vendor}}
({{device.viewModel.vendor}} {{device.viewModel.model}}) ({{device.viewModel.vendor}} {{device.viewModel.model}})
{{/if}}
</span> </span>
</label> </label>
</div> </div>
@ -26,11 +28,13 @@
<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>
<div class="col-lg-12 col-sm-4 ast-desc"> <div class="col-lg-12 col-sm-4 ast-desc">
<div class="ast-device-desc"><b>Device:</b> {{device.viewModel.vendor}} {{device.properties.model}}</div> <div class="ast-device-desc"><b>Owner:</b> {{device.owner}}</div>
<div class="ast-device-desc"><b>Model:</b> {{device.viewModel.model}}</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>IMEI:</b> {{device.viewModel.imei}}</div> <!--<div class="ast-device-desc"><b>Device:</b> {{device.viewModel.vendor}} {{device.properties.model}}</div>-->
{{#if device.viewModel.udid}}<div class="ast-device-desc"><b>UDID:</b> {{device.viewModel.udid}}</div>{{/if}} <!--<div class="ast-device-desc"><b>Model:</b> {{device.viewModel.model}}</div>-->
{{#if device.viewModel.phoneNumber}}<div class="ast-device-desc"><b>Phone Number:</b> {{device.viewModel.phoneNumber}}</div>{{/if}} <!--<div class="ast-device-desc"><b>IMEI:</b> {{device.viewModel.imei}}</div>-->
<!--{{#if device.viewModel.udid}}<div class="ast-device-desc"><b>UDID:</b> {{device.viewModel.udid}}</div>{{/if}}-->
<!--{{#if device.viewModel.phoneNumber}}<div class="ast-device-desc"><b>Phone Number:</b> {{device.viewModel.phoneNumber}}</div>{{/if}}-->
</div> </div>
</div> </div>
</div> </div>
@ -93,25 +97,46 @@
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<!-- device location --> <!-- statistics -->
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingOne"> <div class="panel-heading" role="tab" id="headingFour">
<h2 class="sub-title panel-title"> <h2 class="sub-title panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> <a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseFour" aria-expanded="false" aria-controls="collapseFour">
<span class="fw-stack"> <span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i> <i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
</span> </span>
Device Location Device Statistics
</a> </a>
</h2> </h2>
</div> </div>
<div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne"> <div id="collapseFour" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingFour">
<div id="device-location" style="height:400px" class="panel-body"> <div class="panel-body">
<a href="../../devices/analytics?deviceId={{deviceId}}&deviceType={{deviceType}}" ><i class="fw fw-charts"></i> Show Statistics</a>
</div> </div>
</div> </div>
</div> </div>
<!-- /statistics -->
<!-- device location -->
<!--<div class="panel panel-default">-->
<!--<div class="panel-heading" role="tab" id="headingOne">-->
<!--<h2 class="sub-title panel-title">-->
<!--<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">-->
<!--<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>-->
<!--</span>-->
<!--Device Location-->
<!--</a>-->
<!--</h2>-->
<!--</div>-->
<!--<div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">-->
<!--<div id="device-location" style="height:400px" class="panel-body">-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!-- /device location --> <!-- /device location -->
<!-- policies --> <!-- policies -->
@ -136,46 +161,27 @@
<!-- /policies --> <!-- /policies -->
<!-- installed applications --> <!-- installed applications -->
<div class="panel panel-default"> <!--<div class="panel panel-default">-->
<div class="panel-heading" role="tab" id="headingThree"> <!--<div class="panel-heading" role="tab" id="headingThree">-->
<h2 class="sub-title panel-title"> <!--<h2 class="sub-title panel-title">-->
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree"> <!--<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">-->
<span class="fw-stack"> <!--<span class="fw-stack">-->
<i class="fw fw-ring fw-stack-2x"></i> <!--<i class="fw fw-ring fw-stack-2x"></i>-->
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i> <!--<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>-->
</span> <!--</span>-->
Installed Applications <!--Installed Applications-->
</a> <!--</a>-->
</h2> <!--</h2>-->
</div> <!--</div>-->
<div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree"> <!--<div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">-->
<div class="panel-body"> <!--<div class="panel-body">-->
Not available yet <!--Not available yet-->
</div> <!--</div>-->
</div> <!--</div>-->
</div> <!--</div>-->
<!-- /installed applications --> <!-- /installed applications -->
<!-- statistics -->
<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">
<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>
</span>
Device Statistics
</a>
</h2>
</div>
<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>
</div>
</div>
</div>
<!-- /statistics -->
</div> </div>

@ -13,7 +13,6 @@ function onRequest(context) {
if (device){ if (device){
var viewModel = {}; var viewModel = {};
var deviceInfo = device.properties.DEVICE_INFO; var deviceInfo = device.properties.DEVICE_INFO;
log.info(deviceInfo);
if (deviceInfo != undefined && String(deviceInfo.toString()).length > 0){ if (deviceInfo != undefined && String(deviceInfo.toString()).length > 0){
deviceInfo = JSON.parse(deviceInfo); deviceInfo = JSON.parse(deviceInfo);
if (device.type == "ios"){ if (device.type == "ios"){
@ -28,7 +27,6 @@ function onRequest(context) {
viewModel.DeviceCapacityPercentage = Math.round(viewModel.DeviceCapacityUsed viewModel.DeviceCapacityPercentage = Math.round(viewModel.DeviceCapacityUsed
/ viewModel.DeviceCapacity * 10000) /100; / viewModel.DeviceCapacity * 10000) /100;
}else if(device.type == "android"){ }else if(device.type == "android"){
viewModel.imei = device.properties.IMEI; viewModel.imei = device.properties.IMEI;
viewModel.model = device.properties.DEVICE_MODEL; viewModel.model = device.properties.DEVICE_MODEL;
viewModel.vendor = device.properties.VENDOR; viewModel.vendor = device.properties.VENDOR;
@ -48,6 +46,7 @@ function onRequest(context) {
viewModel.external_memory.DeviceCapacityPercentage = Math.round(deviceInfo.EXTERNAL_AVAILABLE_MEMORY viewModel.external_memory.DeviceCapacityPercentage = Math.round(deviceInfo.EXTERNAL_AVAILABLE_MEMORY
/deviceInfo.EXTERNAL_TOTAL_MEMORY * 10000) /100; /deviceInfo.EXTERNAL_TOTAL_MEMORY * 10000) /100;
} }
viewModel.enrollment = device.enrollment;
device.viewModel = viewModel; device.viewModel = viewModel;
} }
} }

@ -16,6 +16,13 @@
* under the License. * under the License.
*/ */
function formatDates(){
$(".formatDate").each(function(){
var timeStamp = $(this).html();
$(this).html(new Date(parseInt(timeStamp)).toUTCString());
});
}
(function () { (function () {
var deviceId = $(".device-id"); var deviceId = $(".device-id");
var deviceIdentifier = deviceId.data("deviceid"); var deviceIdentifier = deviceId.data("deviceid");
@ -35,6 +42,7 @@
$(document).ready(function(){ $(document).ready(function(){
loadOperationBar(deviceType); loadOperationBar(deviceType);
loadMap(); loadMap();
formatDates();
}); });
function loadMap(){ function loadMap(){
var map; var map;

@ -168,6 +168,7 @@ function loadDevices(searchType, searchParam) {
addDeviceSelectedClass(this); addDeviceSelectedClass(this);
}); });
attachEvents(); attachEvents();
formatDates();
} }
}; };
invokerUtil.get(serviceURL, invokerUtil.get(serviceURL,
@ -180,6 +181,12 @@ $(document).ready(function () {
loadDevices(); loadDevices();
}); });
function formatDates(){
$(".formatDate").each(function(){
var timeStamp = $(this).html();
$(this).html(new Date(parseInt(timeStamp)).toUTCString());
});
}
/** /**
* Sorting function of users * Sorting function of users

@ -8,15 +8,16 @@
</label> </label>
</div> </div>
<div class="itm-ast"> <div class="itm-ast">
<a href="device/{{type}}/{{id}}"> <a href="device/{{type}}/{{deviceIdentifier}}">
<div class="ast-img"><img src="{{../imageLocation}}{{type}}.png"/></div> <div class="ast-img"><img src="{{../imageLocation}}{{type}}.png"/></div>
<div class="ast-desc"> <div class="ast-desc">
<div class="ast-title"> <div class="ast-title">
<h3 class="ast-name">Device {{name}}</h3> <h3 class="ast-name">Device {{name}}</h3>
<span class="ast-auth">Owner: {{owner}}</span> <span class="ast-auth">Device Type: {{type}}</span>
<span class="ast-auth">Date of Enrollment: <span class="formatDate">{{dateOfEnrolment}}</span></span>
</div> </div>
<div class="ast-model"> <div class="ast-model">
<span class="ast-ver">{{type}}</span> <span class="ast-ver">{{owner}}</span>
<span class="ast-published">{{status}}</span> <span class="ast-published">{{status}}</span>
<div class="ast-btn-group"> <div class="ast-btn-group">

Loading…
Cancel
Save