mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'release-2.0.x' of https://github.com/wso2/carbon-device-mgt into release-2.0.x
This commit is contained in:
commit
d9b670ef19
@ -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">
|
||||||
|
{{#defineZone "device-view-tabs"}}
|
||||||
|
{{#defineZone "device-details-tab"}}
|
||||||
|
<li role="presentation" class="list-group-item active">
|
||||||
|
<a href="#device_details_tab" role="tab" data-toggle="tab"
|
||||||
|
aria-controls="device_details_tab">
|
||||||
|
<i class="icon fw fw-mobile"></i><span class="hidden-sm">Device Details</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{{/defineZone}}
|
||||||
|
{{#defineZone "device-details-tab-injected"}}
|
||||||
|
{{/defineZone}}
|
||||||
|
{{#defineZone "device-details-tab-operations"}}
|
||||||
|
<li role="presentation" class="list-group-item">
|
||||||
|
<a href="#event_log_tab" role="tab" data-toggle="tab" aria-controls="event_log_tab">
|
||||||
|
<i class="icon fw fw-text"></i><span class="hidden-sm">Operations Log</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{{/defineZone}}
|
||||||
|
{{/defineZone}}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="media-body add-padding-left-5x remove-padding-xs">
|
||||||
|
<div class="panel-group tab-content remove-padding" id="tabs" role="tablist"
|
||||||
|
data-status="{{device.isNotRemoved}}" aria-multiselectable="true">
|
||||||
|
<div class="arrow-left hidden-xs"></div>
|
||||||
|
|
||||||
<div class="media-left col-xs-12 col-sm-2 col-md-2 col-lg-2">
|
{{#defineZone "device-view-tab-contents"}}
|
||||||
<ul class="list-group" role="tablist">
|
{{#defineZone "device-details-tab-contents"}}
|
||||||
<li class="active"><a class="list-group-item"
|
<div class="message message-info">
|
||||||
href="#device_details"
|
<h4 class="remove-margin">
|
||||||
role="tab" data-toggle="tab"
|
<i class="icon fw fw-info"></i>
|
||||||
aria-controls="device_details">Device
|
No Device details avaialbe yet.
|
||||||
Details</a>
|
</h4>
|
||||||
</li>
|
</div>
|
||||||
<li><a class="list-group-item" href="#policies"
|
{{/defineZone}}
|
||||||
role="tab"
|
|
||||||
data-toggle="tab" aria-controls="policies">Policies</a>
|
|
||||||
</li>
|
|
||||||
<li><a class="list-group-item" href="#policy_compliance"
|
|
||||||
role="tab"
|
|
||||||
data-toggle="tab" aria-controls="policy_compliance">Policy
|
|
||||||
Compliance</a>
|
|
||||||
</li>
|
|
||||||
<li><a class="list-group-item" href="#device_location"
|
|
||||||
role="tab"
|
|
||||||
data-toggle="tab" aria-controls="device_location">Device
|
|
||||||
Location</a>
|
|
||||||
</li>
|
|
||||||
<li><a class="list-group-item" href="#event_log" role="tab"
|
|
||||||
data-toggle="tab" aria-controls="event_log">Operations
|
|
||||||
Log</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="media-body add-padding-left-5x remove-padding-xs tab-content">
|
{{#defineZone "device-view-tab-injected-conents"}}
|
||||||
<div class="panel-group tab-content">
|
{{/defineZone}}
|
||||||
|
|
||||||
<div class="panel panel-default tab-pane active"
|
{{#defineZone "device-view-tab-operations-log-conents"}}
|
||||||
id="device_details" role="tabpanel"
|
<div class="panel panel-default visible-xs-block" role="tabpanel" id="event_log_tab">
|
||||||
aria-labelledby="device_details">
|
<div class="panel-heading visible-xs collapsed" id="event_log">
|
||||||
{{unit "cdmf.unit.device.details" device=device}}
|
<h4 class="panel-title">
|
||||||
</div>
|
<a role="button" data-toggle="collapse" data-parent="#tabs"
|
||||||
<div class="panel panel-default tab-pane" id="policies" role="tabpanel"
|
href="#collapseFive" aria-expanded="true" aria-controls="collapseFive">
|
||||||
aria-labelledby="policies">
|
<i class="fw fw-text fw-2x"></i>
|
||||||
<div class="panel-heading">Policies</div>
|
Operations Log
|
||||||
<div class="panel-body">
|
<i class="caret-updown fw fw-down"></i>
|
||||||
<div id="policy-spinner" class="wr-advance-operations-init hidden">
|
</a>
|
||||||
<br>
|
</h4>
|
||||||
|
|
||||||
<i class="fw fw-settings fw-spin fw-2x"></i>
|
|
||||||
|
|
||||||
Loading Policies . . .
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
</div>
|
</div>
|
||||||
<div id="policy-list-container">
|
<div class="panel-heading display-none-xs">
|
||||||
|
Operations Log
|
||||||
|
<span>
|
||||||
|
<a href="javascript:void(0);" id="refresh-operations">
|
||||||
|
<i class="fw fw-refresh"></i>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div id="collapseFive" class="panel-collapse collapse in" role="tabpanel"
|
||||||
|
aria-labelledby="event_log">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
No policies found
|
<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>
|
||||||
<a class="padding-left"
|
{{/defineZone}}
|
||||||
href="{{@app.context}}/policy/add/{{device.type}}?deviceId={{device.deviceIdentifier}}">
|
{{/defineZone}}
|
||||||
<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>
|
|
||||||
|
|
||||||
Loading Policy Compliance . . .
|
|
||||||
<br>
|
|
||||||
<br>
|
|
||||||
</div>
|
|
||||||
<div id="policy-list-container">
|
|
||||||
<div class="panel-body">
|
|
||||||
Not available yet
|
|
||||||
</div>
|
|
||||||
<br class="c-both" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</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 id="operations-log-container">
|
|
||||||
<div class="panel-body">
|
|
||||||
Not available yet
|
|
||||||
</div>
|
|
||||||
<br class="c-both" />
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</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;
|
||||||
|
|||||||
@ -59,6 +59,11 @@ var disableInlineError = function (inputField, errorMsg, errorSign) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load all device groups.
|
||||||
|
*
|
||||||
|
* @param callback function to call on loading completion.
|
||||||
|
*/
|
||||||
function loadGroups(callback) {
|
function loadGroups(callback) {
|
||||||
invokerUtil.get(
|
invokerUtil.get(
|
||||||
"/api/device-mgt/v1.0/groups",
|
"/api/device-mgt/v1.0/groups",
|
||||||
@ -68,6 +73,12 @@ function loadGroups(callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates DeviceGroupWrapper object from selected groups.
|
||||||
|
*
|
||||||
|
* @param selectedGroups
|
||||||
|
* @returns {Array} DeviceGroupWrapper list.
|
||||||
|
*/
|
||||||
var createDeviceGroupWrapper = function (selectedGroups) {
|
var createDeviceGroupWrapper = function (selectedGroups) {
|
||||||
var groupObjects = [];
|
var groupObjects = [];
|
||||||
loadGroups(function (deviceGroups) {
|
loadGroups(function (deviceGroups) {
|
||||||
@ -136,7 +147,6 @@ stepForwardFrom["policy-platform"] = function (actionButton) {
|
|||||||
$.template(policyOperationsTemplateCacheKey, policyOperationsTemplateSrc, function (template) {
|
$.template(policyOperationsTemplateCacheKey, policyOperationsTemplateSrc, function (template) {
|
||||||
var content = template();
|
var content = template();
|
||||||
$("#device-type-policy-operations").html(content).removeClass("hidden");
|
$("#device-type-policy-operations").html(content).removeClass("hidden");
|
||||||
// $("#device-type-policy-operations").removeClass("hidden");
|
|
||||||
$(".policy-platform").addClass("hidden");
|
$(".policy-platform").addClass("hidden");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -63,7 +63,7 @@
|
|||||||
<div id="policy-naming-main-error-msg" class="alert alert-danger hidden" role="alert">
|
<div id="policy-naming-main-error-msg" class="alert alert-danger hidden" role="alert">
|
||||||
<i class="icon fw fw-error"></i><span></span>
|
<i class="icon fw fw-error"></i><span></span>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="clearfix">
|
||||||
<label class="wr-input-label">
|
<label class="wr-input-label">
|
||||||
Set a name * to your policy<br>
|
Set a name * to your policy<br>
|
||||||
( should be 1-to-30 characters long )
|
( should be 1-to-30 characters long )
|
||||||
|
|||||||
@ -63,6 +63,11 @@ var disableInlineError = function (inputField, errorMsg, errorSign) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load all device groups.
|
||||||
|
*
|
||||||
|
* @param callback function to call on loading completion.
|
||||||
|
*/
|
||||||
function loadGroups(callback) {
|
function loadGroups(callback) {
|
||||||
invokerUtil.get(
|
invokerUtil.get(
|
||||||
"/api/device-mgt/v1.0/groups",
|
"/api/device-mgt/v1.0/groups",
|
||||||
@ -72,12 +77,18 @@ function loadGroups(callback) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates DeviceGroupWrapper object from selected groups.
|
||||||
|
*
|
||||||
|
* @param selectedGroups
|
||||||
|
* @returns {Array} DeviceGroupWrapper list.
|
||||||
|
*/
|
||||||
var createDeviceGroupWrapper = function (selectedGroups) {
|
var createDeviceGroupWrapper = function (selectedGroups) {
|
||||||
var groupObjects = [];
|
var groupObjects = [];
|
||||||
loadGroups(function (deviceGroups) {
|
loadGroups(function (deviceGroups) {
|
||||||
var tenantId = $("#logged-in-user").data("tenant-id");
|
var tenantId = $("#logged-in-user").data("tenant-id");
|
||||||
for (var index in deviceGroups) {
|
for (var index in deviceGroups) {
|
||||||
if(deviceGroups.hasOwnProperty(index)) {
|
if (deviceGroups.hasOwnProperty(index)) {
|
||||||
var deviceGroupWrapper = {};
|
var deviceGroupWrapper = {};
|
||||||
if (selectedGroups.indexOf(deviceGroups[index].name) > -1) {
|
if (selectedGroups.indexOf(deviceGroups[index].name) > -1) {
|
||||||
deviceGroupWrapper.id = deviceGroups[index].id;
|
deviceGroupWrapper.id = deviceGroups[index].id;
|
||||||
@ -132,7 +143,18 @@ skipStep["policy-platform"] = function (policyPayloadObj) {
|
|||||||
|
|
||||||
currentlyEffected["roles"] = policyPayloadObj.roles;
|
currentlyEffected["roles"] = policyPayloadObj.roles;
|
||||||
currentlyEffected["users"] = policyPayloadObj.users;
|
currentlyEffected["users"] = policyPayloadObj.users;
|
||||||
currentlyEffected["groups"] = policyPayloadObj.deviceGroups;
|
currentlyEffected["groups"] = [];
|
||||||
|
|
||||||
|
if (policyPayloadObj.deviceGroups) {
|
||||||
|
var deviceGroups = policyPayloadObj.deviceGroups;
|
||||||
|
for (var index in deviceGroups) {
|
||||||
|
if (deviceGroups.hasOwnProperty(index)) {
|
||||||
|
currentlyEffected["groups"].push(deviceGroups[index].name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
currentlyEffected["groups"].push("NONE");
|
||||||
|
}
|
||||||
|
|
||||||
if (currentlyEffected["roles"].length > 0) {
|
if (currentlyEffected["roles"].length > 0) {
|
||||||
$("#user-roles-radio-btn").prop("checked", true);
|
$("#user-roles-radio-btn").prop("checked", true);
|
||||||
@ -145,8 +167,8 @@ skipStep["policy-platform"] = function (policyPayloadObj) {
|
|||||||
$("#user-roles-select-field").hide();
|
$("#user-roles-select-field").hide();
|
||||||
userInput.val(currentlyEffected["users"]).trigger("change");
|
userInput.val(currentlyEffected["users"]).trigger("change");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(currentlyEffected["groups"].length > 0) {
|
if (currentlyEffected["groups"].length > 0) {
|
||||||
groupsInput.val(currentlyEffected["groups"]).trigger("change");
|
groupsInput.val(currentlyEffected["groups"]).trigger("change");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,8 +200,8 @@ skipStep["policy-platform"] = function (policyPayloadObj) {
|
|||||||
script.type = 'text/javascript';
|
script.type = 'text/javascript';
|
||||||
script.src = policyOperationsScriptSrc;
|
script.src = policyOperationsScriptSrc;
|
||||||
$(".wr-advance-operations").prepend(script);
|
$(".wr-advance-operations").prepend(script);
|
||||||
var configuredOperations = operationModule.
|
var configuredOperations = operationModule.populateProfile(policy["platform"],
|
||||||
populateProfile(policy["platform"], policyPayloadObj["profile"]["profileFeaturesList"]);
|
policyPayloadObj["profile"]["profileFeaturesList"]);
|
||||||
polulateProfileOperations(configuredOperations);
|
polulateProfileOperations(configuredOperations);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -222,7 +244,7 @@ stepForwardFrom["policy-criteria"] = function () {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
policy["selectedGroups"] = $("#groups-input").val();
|
policy["selectedGroups"] = $("#groups-input").val();
|
||||||
if (policy["selectedGroups"].length > 1 || policy["selectedGroups"][0] !== "NONE") {
|
if (policy["selectedGroups"] && (policy["selectedGroups"].length > 1 || policy["selectedGroups"][0] !== "NONE")) {
|
||||||
policy["selectedGroups"] = createDeviceGroupWrapper(policy["selectedGroups"]);
|
policy["selectedGroups"] = createDeviceGroupWrapper(policy["selectedGroups"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,7 +444,7 @@ var updatePolicy = function (policy, state) {
|
|||||||
payload["roles"] = [];
|
payload["roles"] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(policy["selectedGroups"]) {
|
if (policy["selectedGroups"]) {
|
||||||
payload["deviceGroups"] = policy["selectedGroups"];
|
payload["deviceGroups"] = policy["selectedGroups"];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user