resolving conflicts

revert-dabc3590
thusithakalugamage 8 years ago
commit 1fb8781f75

@ -26,6 +26,7 @@
</a> </a>
</li> </li>
<li> <li>
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/devices"> <a href="{{@app.context}}/devices">
Devices Devices
</a> </a>
@ -38,7 +39,15 @@
{{/zone}} {{/zone}}
{{#zone "content"}} {{#zone "content"}}
{{unit "cdmf.unit.lib.data-table"}} {{#if isAuthorized}}
{{unit "cdmf.unit.device.operation-mod"}} {{unit "cdmf.unit.lib.data-table"}}
{{unit "cdmf.unit.device.view"}} {{unit "cdmf.unit.device.operation-mod"}}
{{unit "cdmf.unit.device.view"}}
{{else}}
<h1 class="page-sub-title">
Permission Denied
</h1>
<br>
You are not authorized to view any enrolled device in the system.
{{/if}}
{{/zone}} {{/zone}}

@ -17,17 +17,24 @@
*/ */
function onRequest(context){ function onRequest(context){
var utility = require("/app/modules/utility.js").utility; var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
context.handlebars.registerHelper('equal', function (lvalue, rvalue, options) { var viewModel = {};
if (arguments.length < 3)
throw new Error("Handlebars Helper equal needs 2 parameters");
if( lvalue!=rvalue ) {
return options.inverse(this);
} else {
return options.fn(this);
}
});
var deviceType = context.uriParams.deviceType; // permission checks
return {"deviceViewUnitName": utility.getTenantedDeviceUnitName(deviceType, "device-view")}; // [1] checking viewing devices permission
viewModel["isAuthorized"] = userModule.isAuthorized("/permission/admin/device-mgt/devices/owning/view");
if (viewModel["isAuthorized"]) {
context.handlebars.registerHelper('equal', function (lvalue, rvalue, options) {
if (arguments.length < 3)
throw new Error("Handlebars Helper equal needs 2 parameters");
if( lvalue!=rvalue ) {
return options.inverse(this);
} else {
return options.fn(this);
}
});
}
return viewModel;
} }

@ -156,6 +156,12 @@
</p> </p>
</div> </div>
</div> </div>
{{else}}
<h1 class="page-sub-title">
Permission Denied
</h1>
<br>
You are not authorized to view any enrolled device in the system.
{{/if}} {{/if}}
{{/zone}} {{/zone}}

@ -3,22 +3,25 @@
{{unit "mdm.unit.device.qr-modal"}} {{unit "mdm.unit.device.qr-modal"}}
{{#zone "contentTitle"}} {{#zone "contentTitle"}}
<div class="row wr-device-board"> {{#if isAuthorized}}
<div class="col-lg-12 wr-secondary-bar"> <div class="row wr-device-board">
<label class="device-id device-select" data-deviceid="{{device.deviceIdentifier}}" <div class="col-lg-12 wr-secondary-bar">
data-type="{{device.type}}"> <label class="device-id device-select" data-deviceid="{{device.deviceIdentifier}}"
Device {{device.name}} data-type="{{device.type}}">
{{#if device.viewModel.model}} Device {{device.name}}
<span class="lbl-device"> {{#if device.viewModel.model}}
( {{device.viewModel.vendor}} {{device.viewModel.model}} ) <span class="lbl-device">
</span> ( {{device.viewModel.vendor}} {{device.viewModel.model}} )
{{/if}} </span>
</label> {{/if}}
</label>
</div>
</div> </div>
</div> {{/if}}
{{/zone}} {{/zone}}
{{#zone "content"}} {{#zone "content"}}
{{#if isAuthorized}}
<div class="row no-gutter add-padding-5x add-margin-top-5x" style="border: 1px solid #e4e4e4;"> <div class="row no-gutter add-padding-5x add-margin-top-5x" style="border: 1px solid #e4e4e4;">
<div class="media"> <div class="media">
<div class="media-left media-middle asset-image col-xs-2 col-sm-2 col-md-2 col-lg-2"> <div class="media-left media-middle asset-image col-xs-2 col-sm-2 col-md-2 col-lg-2">
@ -82,63 +85,66 @@
<div class="media tab-responsive"> <div class="media tab-responsive">
<div class="media-left col-xs-1 col-sm-1 col-md-2 col-lg-2 hidden-xs"> <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"> <ul class="list-group nav nav-pills nav-stacked" role="tablist">
<li role="presentation" class="list-group-item active"> <li class="list-group-item active">
<a href="#device_details_tab" role="tab" data-toggle="tab" aria-controls="device_details_tab"> <a href="#device_details" role="tab" data-toggle="tab" aria-controls="device_details">
<i class="icon fw fw-mobile"></i><span class="hidden-sm">Device Details</span> <i class="icon fw fw-mobile"></i>Device Details
</a> </a>
</li> </li>
<li role="presentation" class="list-group-item"> <li class="list-group-item">
<a href="#policy_compliance_tab" role="tab" data-toggle="tab" aria-controls="policy_compliance_tab"> <a href="#policy_compliance" role="tab" data-toggle="tab" aria-controls="policy_compliance">
<i class="icon fw fw-policy"></i><span class="hidden-sm">Policy Compliance</span> <i class="icon fw fw-policy"></i>Policy Compliance
</a> </a>
</li> </li>
<li role="presentation" class="list-group-item"> <li class="list-group-item">
<a href="#device_location_tab" role="tab" data-toggle="tab" <a href="#device_location" role="tab" data-toggle="tab"
data-lat="{{device.viewModel.location.latitude}}" data-lat="{{device.viewModel.location.latitude}}"
data-long="{{device.viewModel.location.longitude}}" data-long="{{device.viewModel.location.longitude}}"
aria-controls="device_location_tab"> aria-controls="device_location">
<i class="icon fw fw-map-location"></i><span class="hidden-sm">Device Location</span> <i class="icon fw fw-map-location"></i> Device Location
</a> </a>
</li> </li>
<li role="presentation" class="list-group-item"> <li class="list-group-item">
<a href="#installed_applications_tab" role="tab" data-toggle="tab" aria-controls="installed_applications_tab"> <a href="#installed_applications" role="tab" data-toggle="tab" aria-controls="installed_applications">
<i class="icon fw fw-application"></i><span class="hidden-sm">Installed Applications</span> <i class="icon fw fw-application"></i> Installed Applications
</a> </a>
</li> </li>
<li role="presentation" class="list-group-item"> <li class="list-group-item">
<a href="#event_log_tab" role="tab" data-toggle="tab" aria-controls="event_log_tab"> <a href="#event_log" role="tab" data-toggle="tab" aria-controls="event_log">
<i class="icon fw fw-text"></i><span class="hidden-sm">Operations Log</span> <i class="icon fw fw-text"></i> Operations Log
</a> </a>
</li> </li>
</ul> </ul>
</div> </div>
<div class="media-body remove-padding-xs">
{{#defineZone "device-detail-properties"}} {{#defineZone "device-detail-properties"}}
<div class="media-body add-padding-left-5x remove-padding-xs"> <div class="media-body add-padding-left-5x remove-padding-xs">
<div class="panel-group tab-content remove-padding" id="tabs" role="tablist" aria-multiselectable="true"> <div class="panel-group tab-content" id="tabs">
<div class="arrow-left hidden-xs"></div> <div class="arrow-left hidden-xs"></div>
<div class="panel panel-default" role="tabpanel" id="device_details_tab"> <div class="panel panel-default tab-pane fade in active fade-in-xs visible-block"
<div class="panel-heading visible-xs collapsed" id="device_details"> id="device_details" role="tabpanel"
aria-labelledby="device_details">
<div class="panel-heading dropup visible-xs" role="tab" id="tab1" data-toggle="collapse"
data-target="#tabContent1" aria-expanded="false" data-parent="#tabs">
<h4 class="panel-title"> <h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#tabs" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> <i class="fw fw-map-location fw-2x"></i>
<i class="fw fw-mobile fw-2x"></i> Device Details
Device Details <i class="caret-updown fw fw-sort-up"></i>
<i class="caret-updown fw fw-down"></i>
</a>
</h4> </h4>
</div> </div>
<div class="panel-heading display-none-xs">Device Details</div> <div class="panel-heading display-none-xs">Device Details</div>
<div id="loading-content" class="col-centered"> <div id="loading-content" class="col-centered">
<i class="fw fw-settings fw-spin fw-2x"></i> Loading Device Details... <br><br>&nbsp;&nbsp;&nbsp;&nbsp;<i class="fw fw-settings fw-spin fw-2x"></i>&nbsp;&nbsp;&nbsp;Loading Device Details . . .<br>
</div> </div>
<div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="device_details"> <div class="panel-body collapse display-block-sm display-block-md display-block-lg in"
<div class="panel-body "> id="tabContent1">
<div class="device-detail-body"> <div class="device-detail-body hidden">
<!-- device summary --> <!-- device summary -->
{{#equal device.type "windows"}} {{#equal device.type "windows"}}
<div class="message message-info"> <div class="panel-body">
<h4 class="remove-margin"><i class="icon fw fw-info"></i>Not available yet</h4> Not available yet
</div> </div>
<br class="c-both"/>
{{/equal}} {{/equal}}
{{#if device.viewModel.BatteryLevel}} {{#if device.viewModel.BatteryLevel}}
<div class="col-xs-12 col-sm-6 col-md-6 col-lg-6"> <div class="col-xs-12 col-sm-6 col-md-6 col-lg-6">
@ -209,160 +215,170 @@
</div> </div>
</div> </div>
{{/if}} {{/if}}
</div>
</div> </div>
</div> </div>
</div> </div>
<div class="panel panel-default visible-xs-block" role="tabpanel" id="policy_compliance_tab"> <div class="panel panel-default tab-pane fade fade-in-xs visible-block"
<div class="panel-heading visible-xs collapsed" id="policy_compliance"> id="policy_compliance">
<h4 class="panel-title"> <div class="panel-heading dropdown visible-xs collapsed" role="tab" id="tab2"
<a role="button" data-toggle="collapse" data-parent="#tabs" href="#collapseTwo" aria-expanded="true" aria-controls="collapseTwo"> data-toggle="collapse" data-target="#tabContent2" aria-expanded="false"
<i class="fw fw-policy fw-2x"></i> data-parent="#tabs">
Policy Compliance <h4 class="panel-title"><i class="fw fw-text fw-2x"></i>
<i class="caret-updown fw fw-down"></i> Policy Compliance
</a> <i class="caret-updown fw fw-sort-down"></i>
</h4> </h4>
</div> </div>
<div class="panel-heading display-none-xs"> <div class="panel-heading display-none-xs">
Policy Compliance Policy Compliance
&nbsp;&nbsp;
<span> <span>
<a href="#" id="refresh-policy"> <a href="#" id="refresh-policy">
<i class="fw fw-refresh"></i> <i class="fw fw-refresh"></i>
</a> </a>
</span> </span>
</div> </div>
<div id="collapseTwo" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="policy_compliance"> <div id="policy-spinner" class="wr-advance-operations-init hidden">
<div class="panel-body "> <br><br>
<span class="visible-xs add-padding-2x text-right"> &nbsp;&nbsp;&nbsp;&nbsp;
<a href="#" id="refresh-policy"> <i class="fw fw-settings fw-spin fw-2x"></i>
<i class="fw fw-refresh"></i> &nbsp;&nbsp;&nbsp;
</a> Loading Policy Compliance . . .
</span> <br>
<div id="policy-spinner" class="wr-advance-operations-init hidden"> <br>
<i class="fw fw-settings fw-spin fw-2x"></i> Loading Policy Compliance... </div>
</div> <div class="panel-body collapse display-block-sm display-block-md display-block-lg" id="tabContent2">
<div id="policy-list-container"> <div id="policy-list-container">
<div class="message message-info"> <div class="panel-body">
<h4 class="remove-margin"><i class="icon fw fw-info"></i>There is no active policy for this device.</h4> There is no active policy for this device.
</div>
</div> </div>
<br class="c-both"/>
</div> </div>
</div> </div>
</div> </div>
<div class="panel panel-default visible-xs-block" role="tabpanel" id="device_location_tab"> <div class="panel panel-default tab-pane fade fade-in-xs visible-block"
<div class="panel-heading visible-xs collapsed" id="device_location"> id="device_location">
<div class="panel-heading dropdown visible-xs collapsed" role="tab" id="tab3"
data-toggle="collapse" data-target="#tabContent3" aria-expanded="false"
data-parent="#tabs">
<h4 class="panel-title"> <h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#tabs" href="#collapseThree" aria-expanded="true" aria-controls="collapseThree"> <i class="fw fw-text fw-2x"></i>
<i class="fw fw-map-location fw-2x"></i>
Device Location Device Location
<i class="caret-updown fw fw-down"></i> <i class="caret-updown fw fw-sort-down"></i>
</a>
</h4> </h4>
</div> </div>
<div class="panel-heading display-none-xs">Device Location</div> <div class="panel-heading display-none-xs">Device Location</div>
<div id="collapseThree" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="device_location"> <div class="panel-body collapse display-block-sm display-block-md display-block-lg"
<div class="panel-body"> id="tabContent3">
<div id="map-error" class="message message-danger"> <div id="device-location"
<h4 class="remove-margin"><i class="icon fw fw-error"></i>Device location cannot be retrieved.</h4> data-lat="{{device.viewModel.location.latitude}}"
</div> data-long="{{device.viewModel.location.longitude}}"
<div id="device-location" class="panel-body">
data-lat="{{device.viewModel.location.latitude}}" </div>
data-long="{{device.viewModel.location.longitude}}"> <div id="map-error" class="panel-body" style="margin: auto;">
</div> Device location cannot be retrieved.
</div> </div>
<br class="c-both"/>
</div> </div>
</div> </div>
<div class="panel panel-default visible-xs-block" role="tabpanel" id="installed_applications_tab"> <div class="panel panel-default tab-pane fade fade-in-xs visible-block"
<div class="panel-heading visible-xs collapsed" id="installed_applications"> id="installed_applications">
<div class="panel-heading dropdown visible-xs collapsed" role="tab" id="tab4"
data-toggle="collapse" data-target="#tabContent4" aria-expanded="false"
data-parent="#tabs">
<h4 class="panel-title"> <h4 class="panel-title">
<a role="button" data-toggle="collapse" data-parent="#tabs" href="#collapseFour" aria-expanded="true" aria-controls="collapseFour"> <i class="fw fw-text fw-2x"></i>
<i class="fw fw-application fw-2x"></i> Installed Applications
Installed Applications <i class="caret-updown fw fw-sort-down"></i></h4>
<i class="caret-updown fw fw-down"></i>
</a>
</h4>
</div> </div>
<div class="panel-heading display-none-xs"> <div class="panel-heading display-none-xs">
Installed Applications Installed Applications
&nbsp;&nbsp;
<span> <span>
<a href="#" id="refresh-apps"> <a href="#" id="refresh-apps">
<i class="fw fw-refresh"></i> <i class="fw fw-refresh"></i>
</a> </a>
</span> </span>
</div> </div>
<div id="collapseFour" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="installed_applications"> <div class="panel-body collapse display-block-sm display-block-md display-block-lg"
<div class="panel-body "> id="tabContent4">
<span class="visible-xs add-padding-2x text-right"> <div id="apps-spinner" class="wr-advance-operations-init hidden">
<a href="#" id="refresh-apps"> <br><br>
<i class="fw fw-refresh"></i> &nbsp;&nbsp;&nbsp;&nbsp;<i class="fw fw-settings fw-spin fw-2x"></i>
</a> &nbsp;&nbsp;&nbsp;Loading Applications List . . .<br><br>
</span> </div>
<div id="apps-spinner" class="wr-advance-operations-init hidden"> <div id="applications-list-container">
<i class="fw fw-settings fw-spin fw-2x"></i> Loading Applications List... <div class="panel-body">
</div> <br>
<div id="applications-list-container"> <p class="fw-warning">
<div class="message message-info"> No applications found. please try refreshing the list in a while.
<h4><i class="icon fw fw-info"></i>No applications found.</h4> <p>
<p>Please try refreshing the list in a while.</p>
</div>
</div> </div>
<br class="c-both"/>
</div> </div>
</div> </div>
</div> </div>
<div class="panel panel-default visible-xs-block" role="tabpanel" id="event_log_tab"> <div class="panel panel-default tab-pane fade fade-in-xs visible-block" id="event_log">
<div class="panel-heading visible-xs collapsed" id="event_log"> <div class="panel-heading dropdown visible-xs collapsed" role="tab" id="tab5"
data-toggle="collapse" data-target="#tabContent5" aria-expanded="false"
data-parent="#tabs">
<h4 class="panel-title"> <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>
<i class="fw fw-text fw-2x"></i> Operations Logs
Operations Logs <i class="caret-updown fw fw-sort-down"></i>
<i class="caret-updown fw fw-down"></i>
</a>
</h4> </h4>
</div> </div>
<div class="panel-heading display-none-xs"> <div class="panel-heading display-none-xs">
Operations Logs Operations Logs
&nbsp;&nbsp;
<span> <span>
<a href="#" id="refresh-operations"> <a href="#" id="refresh-operations">
<i class="fw fw-refresh"></i> <i class="fw fw-refresh"></i>
</a> </a>
</span> </span>
</div> </div>
<div id="collapseFive" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="event_log"> <div class="panel-body collapse display-block-sm display-block-md display-block-lg"
<div class="panel-body"> id="tabContent5">
<span class="visible-xs add-padding-2x text-right"> <div id="operations-spinner" class="wr-advance-operations-init hidden">
<a href="#" id="refresh-operations"> <br><br>&nbsp;&nbsp;&nbsp;&nbsp;<i class="fw fw-settings fw-spin fw-2x"></i>&nbsp;&nbsp;&nbsp;
<i class="fw fw-refresh"></i> Loading Operations Log . . .
</a> <br><br>
</span> </div>
<div id="operations-spinner" class="wr-advance-operations-init hidden"> <div id="operations-log-container">
<i class="fw fw-settings fw-spin fw-2x"></i> Loading Operations Log... <div class="panel-body">
</div> There are no operations, performed yet on this device.
<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> </div>
<table class="table table-striped table-hover table-bordered display data-table" id="operations-log-table"> <br class="c-both"/>
<thead>
<tr class="sort-row">
<th>Operation Code</th>
<th>Status</th>
<th>Request created at</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</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>
</div> </div>
</div> </div>
</div> </div>
</div>
{{/defineZone}} {{/defineZone}}
</div> </div>
</div> </div>
{{else}}
<h1 class="page-sub-title">
Permission Denied
</h1>
<br>
You are not authorized to view specified device in the system.
{{/if}}
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
{{#if isAuthorized}}
<script id="policy-view" src="{{@unit.publicUri}}/templates/policy-compliance.hbs" <script id="policy-view" src="{{@unit.publicUri}}/templates/policy-compliance.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>
@ -375,4 +391,5 @@
{{js "js/device-detail.js"}} {{js "js/device-detail.js"}}
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script> <script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
{{js "js/load-map.js"}} {{js "js/load-map.js"}}
{{/if}}
{{/zone}} {{/zone}}

@ -17,7 +17,7 @@
*/ */
function onRequest(context) { function onRequest(context) {
var log = new Log("view.js"); // var log = new Log("view.js");
var deviceType = context.uriParams.deviceType; var deviceType = context.uriParams.deviceType;
var deviceId = request.getParameter("id"); var deviceId = request.getParameter("id");
var deviceData = {}; var deviceData = {};
@ -26,6 +26,8 @@ function onRequest(context) {
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"]; var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
var response = deviceModule.viewDevice(deviceType, deviceId); var response = deviceModule.viewDevice(deviceType, deviceId);
if (response["status"] == "success") { if (response["status"] == "success") {
deviceData["isAuthorized"] = true;
var device = response["content"]; var device = response["content"];
var viewModel = {}; var viewModel = {};
var deviceInfo = device["properties"]["DEVICE_INFO"]; var deviceInfo = device["properties"]["DEVICE_INFO"];
@ -54,8 +56,7 @@ function onRequest(context) {
viewModel["vendor"] = device["properties"]["VENDOR"]; viewModel["vendor"] = device["properties"]["VENDOR"];
var osBuildDate = device["properties"]["OS_BUILD_DATE"]; var osBuildDate = device["properties"]["OS_BUILD_DATE"];
if (osBuildDate != null && osBuildDate != "0") { if (osBuildDate != null && osBuildDate != "0") {
var formattedDate = new Date(osBuildDate * 1000); viewModel["os_build_date"] = new Date(osBuildDate * 1000);
viewModel["os_build_date"] = formattedDate;
} }
viewModel["internal_memory"] = {}; viewModel["internal_memory"] = {};
viewModel["external_memory"] = {}; viewModel["external_memory"] = {};
@ -96,6 +97,8 @@ function onRequest(context) {
device["viewModel"] = viewModel; device["viewModel"] = viewModel;
} }
deviceData["device"] = device; deviceData["device"] = device;
} else if (response["status"] == "unauthorized") {
deviceData["isAuthorized"] = false;
} }
return deviceData; return deviceData;
} }

Loading…
Cancel
Save