Merge pull request #447 from ruwany/release-2.0.x

Adding android operations bar related changes
revert-70aa11f8
Charitha Goonetilleke 8 years ago committed by GitHub
commit e1d2d8a73f

@ -20,6 +20,7 @@
var deviceId = $(".device-id"); var deviceId = $(".device-id");
var deviceIdentifier = deviceId.data("deviceid"); var deviceIdentifier = deviceId.data("deviceid");
var deviceType = deviceId.data("type"); var deviceType = deviceId.data("type");
var deviceOwner = deviceId.data("owner");
$(document).ready(function () { $(document).ready(function () {
$(".panel-body").removeClass("hidden"); $(".panel-body").removeClass("hidden");
@ -45,7 +46,7 @@
}); });
}); });
function loadOperationsLog(update) { function loadOperationsLog(update) {
var operationsLogTable = "#operations-log-table"; var operationsLogTable = "#operations-log-table";
if (update) { if (update) {
@ -54,76 +55,78 @@
return; return;
} }
operationTable = $(operationsLogTable).datatables_extended({ operationTable = $(operationsLogTable).datatables_extended({
serverSide: true, serverSide: true,
processing: false, processing: false,
searching: false, searching: false,
ordering: false, ordering: false,
pageLength : 10, pageLength : 10,
order: [], order: [],
ajax: { ajax: {
url: context + "/api/operation/paginate",
data: {deviceId : deviceIdentifier, deviceType: deviceType}, url: "/devicemgt/api/operation/paginate",
dataSrc: function (json) { data: {deviceId : deviceIdentifier, deviceType: deviceType, owner: deviceOwner},
$("#operations-spinner").addClass("hidden"); dataSrc: function (json) {
$("#operations-log-container").empty(); $("#operations-spinner").addClass("hidden");
return json.data; $("#operations-log-container").empty();
} return json.data;
}, }
columnDefs: [ },
{targets: 0, data: "code" }, columnDefs: [
{targets: 1, data: "status", render: {targets: 0, data: "code" },
function (status) { {targets: 1, data: "status", render:
var html; function (status) {
switch (status) { var html;
case "COMPLETED" : switch (status) {
html = "<span><i class='fw fw-ok icon-success'></i> Completed</span>"; case "COMPLETED" :
break; html = "<span><i class='fw fw-ok icon-success'></i> Completed</span>";
case "PENDING" : break;
html = "<span><i class='fw fw-warning icon-warning'></i> Pending</span>"; case "PENDING" :
break; html = "<span><i class='fw fw-warning icon-warning'></i> Pending</span>";
case "ERROR" : break;
html = "<span><i class='fw fw-error icon-danger'></i> Error</span>"; case "ERROR" :
break; html = "<span><i class='fw fw-error icon-danger'></i> Error</span>";
case "IN_PROGRESS" : break;
html = "<span><i class='fw fw-ok icon-warning'></i> In Progress</span>"; case "IN_PROGRESS" :
break; html = "<span><i class='fw fw-ok icon-warning'></i> In Progress</span>";
case "REPEATED" : break;
html = "<span><i class='fw fw-ok icon-warning'></i> Repeated</span>"; case "REPEATED" :
break; html = "<span><i class='fw fw-ok icon-warning'></i> Repeated</span>";
} break;
return html; }
} return html;
}, }
{targets: 2, data: "createdTimeStamp", render: },
function (date) { {targets: 2, data: "createdTimeStamp", render:
var value = String(date); function (date) {
return value.slice(0, 16); var value = String(date);
} return value.slice(0, 16);
} }
], }
"createdRow": function(row, data) { ],
$(row).attr("data-type", "selectable"); "createdRow": function(row, data) {
$(row).attr("data-id", data["id"]);
$.each($("td", row), $(row).attr("data-type", "selectable");
function(colIndex) { $(row).attr("data-id", data["id"]);
switch(colIndex) { $.each($("td", row),
case 1: function(colIndex) {
$(this).attr("data-grid-label", "Code"); switch(colIndex) {
$(this).attr("data-display", data["code"]); case 1:
break; $(this).attr("data-grid-label", "Code");
case 2: $(this).attr("data-display", data["code"]);
$(this).attr("data-grid-label", "Status"); break;
$(this).attr("data-display", data["status"]); case 2:
break; $(this).attr("data-grid-label", "Status");
case 3: $(this).attr("data-display", data["status"]);
$(this).attr("data-grid-label", "Created Timestamp"); break;
$(this).attr("data-display", data["createdTimeStamp"]); case 3:
break; $(this).attr("data-grid-label", "Created Timestamp");
} $(this).attr("data-display", data["createdTimeStamp"]);
} break;
); }
} }
}); );
}
});
} }
function loadPolicyCompliance() { function loadPolicyCompliance() {
@ -175,7 +178,7 @@
} else { } else {
$("#policy-list-container"). $("#policy-list-container").
html("<div class='panel-body'><br><p class='fw-warning'> This device " + html("<div class='panel-body'><br><p class='fw-warning'> This device " +
"has no policy applied.<p></div>"); "has no policy applied.<p></div>");
} }
} }
}, },
@ -183,7 +186,7 @@
function () { function () {
$("#policy-list-container"). $("#policy-list-container").
html("<div class='panel-body'><br><p class='fw-warning'> Loading policy compliance related data " + html("<div class='panel-body'><br><p class='fw-warning'> Loading policy compliance related data " +
"was not successful. please try refreshing data in a while.<p></div>"); "was not successful. please try refreshing data in a while.<p></div>");
} }
); );
} }
@ -193,7 +196,7 @@
function () { function () {
$("#policy-list-container"). $("#policy-list-container").
html("<div class='panel-body'><br><p class='fw-warning'> Loading policy compliance related data " + html("<div class='panel-body'><br><p class='fw-warning'> Loading policy compliance related data " +
"was not successful. please try refreshing data in a while.<p></div>"); "was not successful. please try refreshing data in a while.<p></div>");
} }
); );
} }

@ -1,24 +0,0 @@
<table class="table table-striped table-hover table-bordered display data-table" id="operations-log-table">
<thead>
<tr class="sort-row">
<th>Operation Code</th>
<th>Status</th>
<th>Request created at</th>
</tr>
</thead>
<tbody>
{{#each operations}}
<tr data-type="selectable" data-id="{{id}}">
<td data-display="{{code}}" data-grid-label="Code">{{code}}</td>
<td data-display="{{status}}" data-grid-label="Status">
{{#equal status "COMPLETED"}}<span><i class="fw fw-ok icon-success"></i> Completed</span>{{/equal}}
{{#equal status "PENDING"}}<span><i class="fw fw-warning icon-warning"></i> Pending</span>{{/equal}}
{{#equal status "ERROR"}}<span><i class="fw fw-error icon-danger"></i> Error</span>{{/equal}}
{{#equal status "IN_PROGRESS"}}<span><i class="fw fw-ok icon-warning"></i> In Progress</span>{{/equal}}
</td>
<td data-display="{{createdTimeStamp}}" data-grid-label="Created Timestamp">{{createdTimeStamp}}</td>
</tr>
{{/each}}
<br class="c-both" />
</tbody>
</table>

@ -59,141 +59,108 @@
</div> </div>
</div> </div>
{{#defineZone "device-detail-properties"}} <div class="media tab-responsive">
<div class="media"> <div class="media-left col-xs-1 col-sm-1 col-md-2 col-lg-2 hidden-xs">
<ul class="list-group nav nav-pills nav-stacked" role="tablist">
<div class="media-left col-xs-12 col-sm-2 col-md-2 col-lg-2"> {{#defineZone "device-view-tabs"}}
<ul class="list-group" role="tablist"> {{#defineZone "device-details-tab"}}
<li class="active"><a class="list-group-item" <li role="presentation" class="list-group-item active">
href="#device_details" <a href="#device_details_tab" role="tab" data-toggle="tab"
role="tab" data-toggle="tab" aria-controls="device_details_tab">
aria-controls="device_details">Device <i class="icon fw fw-mobile"></i><span class="hidden-sm">Device Details</span>
Details</a> </a>
</li> </li>
<li><a class="list-group-item" href="#policies" {{/defineZone}}
role="tab" {{#defineZone "device-details-tab-injected"}}
data-toggle="tab" aria-controls="policies">Policies</a> {{/defineZone}}
</li> {{#defineZone "device-details-tab-operations"}}
<li><a class="list-group-item" href="#policy_compliance" <li role="presentation" class="list-group-item">
role="tab" <a href="#event_log_tab" role="tab" data-toggle="tab" aria-controls="event_log_tab">
data-toggle="tab" aria-controls="policy_compliance">Policy <i class="icon fw fw-text"></i><span class="hidden-sm">Operations Log</span>
Compliance</a> </a>
</li> </li>
<li><a class="list-group-item" href="#device_location" {{/defineZone}}
role="tab" {{/defineZone}}
data-toggle="tab" aria-controls="device_location">Device </ul>
Location</a> </div>
</li> <div class="media-body add-padding-left-5x remove-padding-xs">
<li><a class="list-group-item" href="#event_log" role="tab" <div class="panel-group tab-content remove-padding" id="tabs" role="tablist"
data-toggle="tab" aria-controls="event_log">Operations data-status="{{device.isNotRemoved}}" aria-multiselectable="true">
Log</a></li> <div class="arrow-left hidden-xs"></div>
</ul>
</div> {{#defineZone "device-view-tab-contents"}}
{{#defineZone "device-details-tab-contents"}}
<div class="media-body add-padding-left-5x remove-padding-xs tab-content"> <div class="message message-info">
<div class="panel-group tab-content"> <h4 class="remove-margin">
<i class="icon fw fw-info"></i>
<div class="panel panel-default tab-pane active" No Device details avaialbe yet.
id="device_details" role="tabpanel" </h4>
aria-labelledby="device_details">
{{unit "cdmf.unit.device.details" device=device}}
</div>
<div class="panel panel-default tab-pane" id="policies" role="tabpanel"
aria-labelledby="policies">
<div class="panel-heading">Policies</div>
<div class="panel-body">
<div id="policy-spinner" class="wr-advance-operations-init hidden">
<br>
<i class="fw fw-settings fw-spin fw-2x"></i>
Loading Policies . . .
<br>
<br>
</div>
<div id="policy-list-container">
<div class="panel-body">
No policies found
</div>
<br class="c-both" />
</div>
</div> </div>
<a class="padding-left" {{/defineZone}}
href="{{@app.context}}/policy/add/{{device.type}}?deviceId={{device.deviceIdentifier}}">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-policy fw-stack-1x"></i>
</span> Add device specific policy</a>
</div>
<div class="panel panel-default tab-pane" id="policy_compliance"
role="tabpanel" aria-labelledby="policy_compliance">
<div class="panel-heading">Policy Compliance <span><a
href="#" id="refresh-policy"><i
class="fw fw-refresh"></i></a></span></div>
<div class="panel-body">
<div id="policy-spinner"
class="wr-advance-operations-init hidden">
<br>
<i class="fw fw-settings fw-spin fw-2x"></i> {{#defineZone "device-view-tab-injected-conents"}}
{{/defineZone}}
Loading Policy Compliance . . . {{#defineZone "device-view-tab-operations-log-conents"}}
<br> <div class="panel panel-default visible-xs-block" role="tabpanel" id="event_log_tab">
<br> <div class="panel-heading visible-xs collapsed" id="event_log">
<h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#tabs"
href="#collapseFive" aria-expanded="true" aria-controls="collapseFive">
<i class="fw fw-text fw-2x"></i>
Operations Log
<i class="caret-updown fw fw-down"></i>
</a>
</h4>
</div> </div>
<div id="policy-list-container"> <div class="panel-heading display-none-xs">
<div class="panel-body"> Operations Log
Not available yet <span>
</div> <a href="javascript:void(0);" id="refresh-operations">
<br class="c-both" /> <i class="fw fw-refresh"></i>
</div> </a>
</div> </span>
</div>
<div class="panel panel-default tab-pane" id="device_location"
role="tabpanel" aria-labelledby="device_location">
<div class="panel-heading">Device Location</div>
<div class="panel-body">
<div id="device-location"
data-lat="{{device.viewModel.location.latitude}}"
data-long="{{device.viewModel.location.longitude}}"
style="height:450px" class="panel-body">
</div>
<div id="map-error" class="panel-body">
Not available yet
</div>
<br class="c-both" />
</div>
</div>
<div class="panel panel-default tab-pane" id="event_log"
role="tabpanel" aria-labelledby="event_log">
<div class="panel-heading">Operations Log <span><a href="#"
id="refresh-operations"><i
class="fw fw-refresh"></i></a></span></div>
<div class="panel-body">
<div id="operations-spinner"
class="wr-advance-operations-init hidden">
<br>
<i class="fw fw-settings fw-spin fw-2x"></i>
Loading Operations Log . . .
<br>
<br>
</div> </div>
<div id="operations-log-container"> <div id="collapseFive" class="panel-collapse collapse in" role="tabpanel"
aria-labelledby="event_log">
<div class="panel-body"> <div class="panel-body">
Not available yet <span class="visible-xs add-padding-2x text-right">
<a href="javascript:void(0);" id="refresh-operations">
<i class="fw fw-refresh"></i>
</a>
</span>
<div id="operations-spinner" class="wr-advance-operations-init hidden">
<i class="fw fw-settings fw-spin fw-2x"></i> Loading Operations Log...
</div>
<div id="operations-log-container">
<div class="message message-info">
<h4 class="remove-margin">
<i class="icon fw fw-info"></i>
There are no operations, performed yet on this device.
</h4>
</div>
</div>
<table class="table table-striped table-hover table-bordered display data-table"
id="operations-log-table">
<thead>
<tr class="sort-row">
<th>Operation Code</th>
<th>Status</th>
<th>Request created at</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div> </div>
<br class="c-both" />
</div> </div>
</div> </div>
</div> {{/defineZone}}
</div> {{/defineZone}}
</div> </div>
</div> </div>
</div>
{{/defineZone}}
</div> </div>
{{else}} {{else}}
<h1 class="page-sub-title"> <h1 class="page-sub-title">
@ -206,6 +173,7 @@
<h1 class="page-sub-title"> <h1 class="page-sub-title">
Device not found Device not found
</h1> </h1>
</h1>
<br> <br>
You have tried to access either a removed or non-existing device. You have tried to access either a removed or non-existing device.
{{/if}} {{/if}}
@ -221,7 +189,4 @@
<script id="applications-list" src="{{@unit.publicUri}}/templates/applications-list.hbs" <script id="applications-list" src="{{@unit.publicUri}}/templates/applications-list.hbs"
data-device-id="{{device.deviceIdentifier}}" data-device-type="{{device.type}}" data-device-id="{{device.deviceIdentifier}}" data-device-type="{{device.type}}"
type="text/x-handlebars-template"></script> type="text/x-handlebars-template"></script>
<script id="operations-log" src="{{@unit.publicUri}}/templates/operations-log.hbs"
data-device-id="{{device.deviceIdentifier}}" data-device-type="{{device.type}}"
type="text/x-handlebars-template"></script>
{{/zone}} {{/zone}}

@ -95,8 +95,8 @@ function onRequest(context) {
if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_TOTAL_MEMORY"] != 0) { if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_TOTAL_MEMORY"] != 0) {
viewModel["internalMemory"]["usage"] = Math. viewModel["internalMemory"]["usage"] = Math.
round((filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_TOTAL_MEMORY"] - round((filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_TOTAL_MEMORY"] -
filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_AVAILABLE_MEMORY"]) filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_AVAILABLE_MEMORY"])
/ filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_TOTAL_MEMORY"] * 10000) / 100; / filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["INTERNAL_TOTAL_MEMORY"] * 10000) / 100;
} else { } else {
viewModel["internalMemory"]["usage"] = 0; viewModel["internalMemory"]["usage"] = 0;
} }
@ -107,8 +107,8 @@ function onRequest(context) {
if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_TOTAL_MEMORY"] != 0) { if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_TOTAL_MEMORY"] != 0) {
viewModel["externalMemory"]["usage"] = Math. viewModel["externalMemory"]["usage"] = Math.
round((filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_TOTAL_MEMORY"] - round((filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_TOTAL_MEMORY"] -
filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_AVAILABLE_MEMORY"]) filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_AVAILABLE_MEMORY"])
/ filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_TOTAL_MEMORY"] * 10000) / 100; / filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["EXTERNAL_TOTAL_MEMORY"] * 10000) / 100;
} else { } else {
viewModel["externalMemory"]["usage"] = 0; viewModel["externalMemory"]["usage"] = 0;
} }
@ -122,8 +122,8 @@ function onRequest(context) {
if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["DeviceCapacity"] != 0) { if (filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["DeviceCapacity"] != 0) {
viewModel["internalMemory"]["usage"] = Math. viewModel["internalMemory"]["usage"] = Math.
round((filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["DeviceCapacity"] - round((filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["DeviceCapacity"] -
filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["AvailableDeviceCapacity"]) filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["AvailableDeviceCapacity"])
/ filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["DeviceCapacity"] * 10000) / 100; / filteredDeviceData["initialDeviceInfo"]["DEVICE_INFO"]["DeviceCapacity"] * 10000) / 100;
} else { } else {
viewModel["internalMemory"]["usage"] = 0; viewModel["internalMemory"]["usage"] = 0;
} }
@ -162,8 +162,8 @@ function onRequest(context) {
if (filteredDeviceData["latestDeviceInfo"]["totalRAMMemory"] != 0) { if (filteredDeviceData["latestDeviceInfo"]["totalRAMMemory"] != 0) {
viewModel["ramUsage"]["value"] = Math. viewModel["ramUsage"]["value"] = Math.
round((filteredDeviceData["latestDeviceInfo"]["totalRAMMemory"] - round((filteredDeviceData["latestDeviceInfo"]["totalRAMMemory"] -
filteredDeviceData["latestDeviceInfo"]["availableRAMMemory"]) filteredDeviceData["latestDeviceInfo"]["availableRAMMemory"])
/ filteredDeviceData["latestDeviceInfo"]["totalRAMMemory"] * 10000) / 100; / filteredDeviceData["latestDeviceInfo"]["totalRAMMemory"] * 10000) / 100;
} else { } else {
viewModel["ramUsage"]["value"] = 0; viewModel["ramUsage"]["value"] = 0;
} }
@ -174,8 +174,8 @@ function onRequest(context) {
if (filteredDeviceData["latestDeviceInfo"]["internalTotalMemory"] != 0) { if (filteredDeviceData["latestDeviceInfo"]["internalTotalMemory"] != 0) {
viewModel["internalMemory"]["usage"] = Math. viewModel["internalMemory"]["usage"] = Math.
round((filteredDeviceData["latestDeviceInfo"]["internalTotalMemory"] - round((filteredDeviceData["latestDeviceInfo"]["internalTotalMemory"] -
filteredDeviceData["latestDeviceInfo"]["internalAvailableMemory"]) filteredDeviceData["latestDeviceInfo"]["internalAvailableMemory"])
/ filteredDeviceData["latestDeviceInfo"]["internalTotalMemory"] * 10000) / 100; / filteredDeviceData["latestDeviceInfo"]["internalTotalMemory"] * 10000) / 100;
} else { } else {
viewModel["internalMemory"]["usage"] = 0; viewModel["internalMemory"]["usage"] = 0;
} }
@ -186,8 +186,8 @@ function onRequest(context) {
if (filteredDeviceData["latestDeviceInfo"]["externalTotalMemory"] != 0) { if (filteredDeviceData["latestDeviceInfo"]["externalTotalMemory"] != 0) {
viewModel["externalMemory"]["usage"] = Math. viewModel["externalMemory"]["usage"] = Math.
round((filteredDeviceData["latestDeviceInfo"]["externalTotalMemory"] - round((filteredDeviceData["latestDeviceInfo"]["externalTotalMemory"] -
filteredDeviceData["latestDeviceInfo"]["externalAvailableMemory"]) filteredDeviceData["latestDeviceInfo"]["externalAvailableMemory"])
/ filteredDeviceData["latestDeviceInfo"]["externalTotalMemory"] * 10000) / 100; / filteredDeviceData["latestDeviceInfo"]["externalTotalMemory"] * 10000) / 100;
} else { } else {
viewModel["externalMemory"]["usage"] = 0; viewModel["externalMemory"]["usage"] = 0;
} }
@ -196,7 +196,7 @@ function onRequest(context) {
viewModel["deviceInfoAvailable"] = false; viewModel["deviceInfoAvailable"] = false;
} }
deviceViewData["deviceView"] = viewModel; deviceViewData["device"] = viewModel;
} else if (response["status"] == "unauthorized") { } else if (response["status"] == "unauthorized") {
deviceViewData["deviceFound"] = true; deviceViewData["deviceFound"] = true;
deviceViewData["isAuthorized"] = false; deviceViewData["isAuthorized"] = false;

Loading…
Cancel
Save