kamidu 8 years ago
commit 958d8004a2

@ -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}}

@ -261,378 +261,388 @@
</div> </div>
<div id="remove-policy-modal-content" class="hide"> <div id="remove-policy-modal-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> Do you really want to remove the selected policy(s)?
<h3>Do you really want to remove the selected policy(s)?</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<div class="buttons"> </div>
<a href="#" id="remove-policy-yes-link" class="btn-operations"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
Remove
</a>
<a href="#" id="remove-policy-cancel-link" class="btn-operations"> </div>
Cancel <div class="modal-footer">
</a> <div class="buttons">
</div> <a href="#" id="remove-policy-yes-link" class="btn-operations">Remove</a>
</div> <a href="#" id="remove-policy-cancel-link" class="btn-operations">Cancel</a>
</div> </div>
</div> </div>
</div> </div>
<div id="remove-policy-success-content" class="hide"> <div id="remove-policy-success-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> Done. Selected policy was successfully removed.
<h3>Done. Selected policy was successfully removed.</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<div class="buttons"> </div>
<a href="#" id="remove-policy-success-link" class="btn-operations"> <div class="modal-footer">
Ok <div class="buttons">
</a> <a href="#" id="remove-policy-success-link" class="btn-operations">Ok</a>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<div id="remove-policy-error-content" class="hide"> <div id="remove-policy-error-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> An unexpected error occurred. Please try again later
<h3>An unexpected error occurred. Please try again later.</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<div class="buttons"> </div>
<a href="#" id="remove-policy-error-link" class="btn-operations"> <div class="modal-footer">
Ok <div class="buttons">
</a> <a href="#" id="remove-policy-error-link" class="btn-operations">Ok</a>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<div id="remove-active-policy-error-content" class="hide"> <div id="remove-active-policy-error-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> Please Try again.
<h3> </h3>
You cannot remove policies that have been already applied to devices. <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
Please deselect active policies from your selection and try again. </div>
</h3> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>You cannot remove policies that have been already applied to devices.
<div class="buttons"> Please deselect active policies from your selection and try again.</h4>
<a href="#" id="remove-active-policy-error-link" class="btn-operations"> </div>
Ok <div class="modal-footer">
</a> <div class="buttons">
</div> <a href="#" id="remove-active-policy-error-link" class="btn-operations">Ok</a>
</div>
</div> </div>
</div> </div>
</div> </div>
<div id="publish-policy-modal-content" class="hide"> <div id="publish-policy-modal-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> Do you really want to publish the selected policy(s)?
<h3>Do you really want to publish the selected policy(s)?</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<div class="buttons"> </div>
<a href="#" id="publish-policy-yes-link" class="btn-operations">Yes</a> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<a href="#" id="publish-policy-cancel-link" class="btn-operations">No</a> </div>
</div> <div class="modal-footer">
</div> <div class="buttons">
<a href="#" id="publish-policy-yes-link" class="btn-operations">Yes</a>
<a href="#" id="publish-policy-cancel-link" class="btn-operations">No</a>
</div> </div>
</div> </div>
</div> </div>
<div id="publish-policy-success-content" class="hide"> <div id="publish-policy-success-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> Done. Selected policy was successfully published.
<h3>Done. Selected policy was successfully published.</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<div class="buttons"> </div>
<a href="#" id="publish-policy-success-link" class="btn-operations"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
Ok </div>
</a> <div class="modal-footer">
</div> <div class="buttons">
</div> <a href="#" id="publish-policy-success-link" class="btn-operations">
Ok
</a>
</div> </div>
</div> </div>
</div> </div>
<div id="publish-policy-error-content" class="hide"> <div id="publish-policy-error-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> An unexpected error occurred. Please try again later.
<h3>An unexpected error occurred. Please try again later.</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<div class="buttons"> </div>
<a href="#" id="publish-policy-error-link" class="btn-operations"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
Ok </div>
</a> <div class="modal-footer">
</div> <div class="buttons">
</div> <a href="#" id="publish-policy-error-link" class="btn-operations">
Ok
</a>
</div> </div>
</div> </div>
</div> </div>
<div id="unpublish-policy-modal-content" class="hide"> <div id="unpublish-policy-modal-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> Do you really want to unpublish the selected policy(s)?
<h3>Do you really want to unpublish the selected policy(s)?</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<div class="buttons"> </div>
<a href="#" id="unpublish-policy-yes-link" class="btn-operations"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
Yes </div>
</a> <div class="modal-footer">
<div class="buttons">
<a href="#" id="unpublish-policy-yes-link" class="btn-operations">
Yes
</a>
<a href="#" id="unpublish-policy-cancel-link" class="btn-operations"> <a href="#" id="unpublish-policy-cancel-link" class="btn-operations">
No No
</a> </a>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<div id="unpublish-policy-success-content" class="hide"> <div id="unpublish-policy-success-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> Done. Selected policy was successfully unpublished.
<h3>Done. Selected policy was successfully unpublished.</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<div class="buttons"> </div>
<a href="#" id="unpublish-policy-success-link" class="btn-operations"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
Ok </div>
</a> <div class="modal-footer">
</div> <div class="buttons">
</div> <a href="#" id="unpublish-policy-success-link" class="btn-operations">
Ok
</a>
</div> </div>
</div> </div>
</div> </div>
<div id="unpublish-policy-error-content" class="hide"> <div id="unpublish-policy-error-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> An unexpected error occurred. Please try again later.
<h3>An unexpected error occurred. Please try again later.</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<div class="buttons"> </div>
<a href="#" id="unpublish-policy-error-link" class="btn-operations"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
Ok </div>
</a> <div class="modal-footer">
</div> <div class="buttons">
</div> <a href="#" id="unpublish-policy-error-link" class="btn-operations">
Ok
</a>
</div> </div>
</div> </div>
</div> </div>
<div id="save-policy-priorities-success-content" class="hide"> <div id="save-policy-priorities-success-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> Done. New Policy priorities were successfully updated.
<h3>Done. New Policy priorities were successfully updated.</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<div class="buttons"> </div>
<a href="#" id="save-policy-priorities-success-link" class="btn-operations"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
Ok </div>
</a> <div class="modal-footer">
</div> <div class="buttons">
</div> <a href="#" id="save-policy-priorities-success-link" class="btn-operations">
Ok
</a>
</div> </div>
</div> </div>
</div> </div>
<div id="save-policy-priorities-error-content" class="hide"> <div id="save-policy-priorities-error-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> An unexpected error occurred. Please try again later.
<h3>An unexpected error occurred. Please try again later.</h3> </h3>
<h4 class="message-from-server"></h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
</div>
<div class="buttons"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<a href="#" id="save-policy-priorities-error-link" class="btn-operations"> </div>
Ok <div class="modal-footer">
</a> <div class="buttons">
</div> <a href="#" id="save-policy-priorities-error-link" class="btn-operations">
</div> Ok
</a>
</div> </div>
</div> </div>
</div> </div>
<div id="change-policy-modal-content" class="hide"> <div id="change-policy-modal-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> Do you really want to apply changes to all policies?
<h3>Do you really want to apply changes to all policies?</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<div class="buttons"> </div>
<a href="#" id="change-policy-yes-link" class="btn-operations"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
Yes </div>
</a> <div class="modal-footer">
<div class="buttons">
<a href="#" id="change-policy-yes-link" class="btn-operations">
Yes
</a>
<a href="#" id="change-policy-cancel-link" class="btn-operations"> <a href="#" id="change-policy-cancel-link" class="btn-operations">
No No
</a> </a>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<div id="change-policy-success-content" class="hide"> <div id="change-policy-success-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> Done. Changes applied successfully.
<h3>Done. Changes applied successfully.</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<div class="buttons"> </div>
<a href="#" id="change-policy-success-link" class="btn-operations"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
Ok </div>
</a> <div class="modal-footer">
</div> <div class="buttons">
</div> <a href="#" id="change-policy-success-link" class="btn-operations">
Ok
</a>
</div> </div>
</div> </div>
</div> </div>
<div id="change-policy-error-content" class="hide"> <div id="change-policy-error-content" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> An unexpected error occurred. Please try again later.
<h3>An unexpected error occurred. Please try again later.</h3> </h3>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
<div class="buttons"> </div>
<a href="#" id="change-policy-error-link" class="btn-operations"> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
Ok </div>
</a> <div class="modal-footer">
</div> <div class="buttons">
</div> <a href="#" id="change-policy-error-link" class="btn-operations">
Ok
</a>
</div> </div>
</div> </div>
</div> </div>
<div id="errorPolicyUnPublish" class="hide"> <div id="errorPolicyUnPublish" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> <span class="fw-stack">
<h3>
<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-error fw-stack-1x"></i> <i class="fw fw-error fw-stack-1x"></i>
</span> </span>
Action cannot be performed ! Action cannot be performed !
</h3> </h3>
<h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
Please select a policy or a list of policies to un-publish. </div>
</h4> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>Please select a policy or a list of policies to un-publish.</h4>
<div class="buttons"> </div>
<a href="javascript:hidePopup()" class="btn-operations"> <div class="modal-footer">
Ok <div class="buttons">
</a> <a href="javascript:hidePopup()" class="btn-operations">
</div> Ok
</div> </a>
</div> </div>
</div> </div>
</div> </div>
<div id="errorPolicyUnPublishSelection" class="hide"> <div id="errorPolicyUnPublishSelection" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> <span class="fw-stack">
<h3>
<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-error fw-stack-1x"></i> <i class="fw fw-error fw-stack-1x"></i>
</span> </span>
Action cannot be performed ! Action cannot be performed !
</h3> </h3>
<h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
You cannot select already inactive policies to be unpublished. </div>
Please deselect inactive policies and try again. <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
</h4> <h4>You cannot select already inactive policies to be unpublished.
Please deselect inactive policies and try again.</h4>
<div class="buttons"> </div>
<a href="javascript:hidePopup()" class="btn-operations"> <div class="modal-footer">
Ok <div class="buttons">
</a> <a href="javascript:hidePopup()" class="btn-operations">
</div> Ok
</div> </a>
</div> </div>
</div> </div>
</div> </div>
<div id="active-policy-selection-error" class="hide"> <div id="active-policy-selection-error" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> <span class="fw-stack">
<h3>
<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-error fw-stack-1x"></i> <i class="fw fw-error fw-stack-1x"></i>
</span> </span>
Action cannot be performed ! Action cannot be performed !
</h3> </h3>
<h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
You cannot select already active policies. Please deselect active policies and try again. </div>
</h4> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>You cannot select already active policies. Please deselect active policies and try again.</h4>
<div class="buttons"> </div>
<a href="javascript:hidePopup()" class="btn-operations"> <div class="modal-footer">
Ok <div class="buttons">
</a> <a href="javascript:hidePopup()" class="btn-operations">
</div> Ok
</div> </a>
</div> </div>
</div> </div>
</div> </div>
<div id="policy-publish-error" class="hide"> <div id="policy-publish-error" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> <span class="fw-stack">
<h3>
<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-error fw-stack-1x"></i> <i class="fw fw-error fw-stack-1x"></i>
</span> </span>
Action cannot be performed ! Action cannot be performed !
</h3> </h3>
<h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
Please select a policy or a list of policies to publish. </div>
</h4> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>Please select a policy or a list of policies to publish.</h4>
<div class="buttons"> </div>
<a href="javascript:hidePopup()" class="btn-operations"> <div class="modal-footer">
Ok <div class="buttons">
</a> <a href="javascript:hidePopup()" class="btn-operations">
</div> Ok
</div> </a>
</div> </div>
</div> </div>
</div> </div>
<div id="policy-remove-error" class="hide"> <div id="policy-remove-error" class="hide">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> <span class="fw-stack">
<h3>
<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-error fw-stack-1x"></i> <i class="fw fw-error fw-stack-1x"></i>
</span> </span>
Action cannot be performed ! Action cannot be performed !
</h3> </h3>
<h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
Please select a policy or a list of policies to remove. </div>
</h4> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h4>Please select a policy or a list of policies to remove.</h4>
<div class="buttons"> </div>
<a href="javascript:hidePopup()" class="btn-operations"> <div class="modal-footer">
Ok <div class="buttons">
</a> <a href="javascript:hidePopup()" class="btn-operations">
</div> Ok
</div> </a>
</div> </div>
</div> </div>
</div> </div>

@ -82,7 +82,6 @@ function setPopupMaxHeight() {
*/ */
function showPopup() { function showPopup() {
$(modalPopup).modal('show'); $(modalPopup).modal('show');
//setPopupMaxHeight();
} }
/* /*

@ -115,8 +115,8 @@ var operationModule = function () {
var featureMap = { var featureMap = {
"DEVICE_LOCK": "lock", "DEVICE_LOCK": "lock",
"VPN": "vpn", "VPN": "vpn",
"PER_APP_VPN": "perappvpn", "PER_APP_VPN": "per-app-vpn",
"APP_TO_PER_APP_VPN_MAPPING": "apptoperappvpnmapping", "APP_TO_PER_APP_VPN_MAPPING": "app-to-per-app-vpn-mapping",
"RING": "ring", "RING": "ring",
"LOCATION": "location", "LOCATION": "location",
"NOTIFICATION": "notification", "NOTIFICATION": "notification",
@ -124,12 +124,12 @@ var operationModule = function () {
"RESTRICTION": "restriction", "RESTRICTION": "restriction",
"CELLULAR": "cellular", "CELLULAR": "cellular",
"WIFI": "wifi", "WIFI": "wifi",
"INSTALL_STORE_APPLICATION": "storeapplication", "INSTALL_STORE_APPLICATION": "store-application",
"INSTALL_ENTERPRISE_APPLICATION": "enterpriseapplication", "INSTALL_ENTERPRISE_APPLICATION": "enterprise-application",
"REMOVE_APPLICATION": "removeapplication", "REMOVE_APPLICATION": "remove-application",
"ENTERPRISE_WIPE": "enterprisewipe" "ENTERPRISE_WIPE": "enterprise-wipe"
}; };
return "/ios/operation/" + featureMap[operationCode]; return "/api/device-mgt/ios/v1.0/admin/devices/" + featureMap[operationCode];
}; };
/** /**

@ -17,20 +17,27 @@
}} }}
{{#zone "content"}} {{#zone "content"}}
<div id="qr-code-modal" data-enrollment-url="{{enrollmentURL}}" class="hidden"> <div id="qr-code-modal" data-enrollment-url="{{enrollmentURL}}" class="hidden">
<div class="content"> <div class="modal-header">
<div class="row"> <h3 class="pull-left modal-title">
<div class="col-lg-5 col-md-6 col-centered"> Scan QR code to start enrollment
<h3>Scan QR code to start enrollment</h3> </h3>
<h4> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="fw fw-cancel"></i></button>
Please scan the QR code using your mobile device to retrieve enrollment URL. </div>
</h4> <div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<div class="panel panel-default"> <div>
<div class="panel-body col-centered text-center"> <h4>
<div class="qr-code"></div> Please scan the QR code using your mobile device to retrieve enrollment URL.
</div> </h4>
<div class="panel panel-default">
<div class="panel-body col-centered text-center">
<div class="qr-code"></div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="modal-footer">
<div class="buttons">
</div>
</div>
</div> </div>
{{/zone}} {{/zone}}

@ -50,49 +50,61 @@ var InitiateViewOption = null;
); );
} }
$(".media.tab-responsive [data-toggle=tab]").on("shown.bs.tab", function (e) { $(".media.tab-responsive [data-toggle=tab]").on("shown.bs.tab", function (e) {
var activeTabPane = $(e.target).attr("href"), var activeTabPane = $(e.target).attr("href");
activeCollapsePane = $(activeTabPane).find("[data-toggle=collapse]").data("target"), var activeListGroupItem = $(".media .list-group-item.active");
activeCollapsePaneSiblings = $(activeTabPane).siblings().find("[data-toggle=collapse]").data("target"),
activeListGroupItem = $(".media .list-group-item.active");
$(activeCollapsePaneSiblings).collapse("hide"); $(activeTabPane).removeClass("visible-xs-block");
$(activeCollapsePane).collapse("show"); $(activeTabPane).siblings().not(".arrow-left").addClass("visible-xs-block");
positionArrow(activeListGroupItem); positionArrow(activeListGroupItem);
$(".panel-heading .caret-updown").removeClass("fw-sort-down");
$(".panel-heading.collapsed .caret-updown").addClass("fw-sort-up");
}); });
$(".media.tab-responsive .tab-content").on("shown.bs.collapse", function (e) { $(".media.tab-responsive .tab-content").on("shown.bs.collapse", function (e) {
var activeTabPane = $(e.target).parent().attr("id"); var thisParent = $(e.target).parent();
$(".media.tab-responsive [data-toggle=tab][href=#" + activeTabPane + "]").tab("show"); var activeTabPaneCaret = thisParent.find('.caret-updown');
$(".panel-heading .caret-updown").removeClass("fw-sort-up"); var activeTabPaneCaretSiblings = thisParent.siblings().find('.caret-updown');
$(".panel-heading.collapsed .caret-updown").addClass("fw-sort-down");
activeTabPaneCaret.removeClass("fw-up").addClass("fw-down");
activeTabPaneCaretSiblings.removeClass("fw-down").addClass("fw-up");
});
$('.media.tab-responsive a[data-toggle="collapse"]').on('click',function(){
var clickedPanel = $(this).attr('href');
if($(clickedPanel).hasClass('in')){
$(clickedPanel).collapse('hide');
}else{
$(clickedPanel).collapse('show');
}
}); });
function positionArrow(selectedTab) { function positionArrow(selectedTab) {
var selectedTabHeight = $(selectedTab).outerHeight(); var selectedTabHeight = $(selectedTab).innerHeight();
var arrowPosition = 0; var arrowPosition = 0;
var totalHeight = 0; var totalHeight = 0;
var arrow = $(".media .panel-group.tab-content .arrow-left"); var arrow = $(".media .panel-group.tab-content .arrow-left");
var parentHeight = $(arrow).parent().outerHeight(); var parentHeight = $(arrow).parent().innerHeight();
// if($(selectedTab).prev().length){
// $(selectedTab).prevAll().each(function() { if($(selectedTab).prev().length){
// totalHeight += $(this).outerHeight(); $(selectedTab).prevAll().each(function() {
// }); totalHeight += $(this).innerHeight();
// arrowPosition = totalHeight + (selectedTabHeight / 2); });
// }else{ arrowPosition = totalHeight + (selectedTabHeight / 2);
// arrowPosition = selectedTabHeight / 2; }else{
// } arrowPosition = selectedTabHeight / 2;
}
if(arrowPosition >= parentHeight){ if(arrowPosition >= parentHeight){
parentHeight = arrowPosition + 10; parentHeight = arrowPosition + 50;
$(arrow).parent().height(parentHeight); $(arrow).siblings(".panel.active").height(parentHeight);
}else{ }else{
$(arrow).parent().removeAttr("style"); $(arrow).parent().removeAttr("style");
} }
$(arrow).css("top", arrowPosition - 10); $(arrow).css("top", arrowPosition - 10);
} }
@ -228,8 +240,8 @@ var InitiateViewOption = null;
$("#applications-list-container").html(content); $("#applications-list-container").html(content);
} else { } else {
$("#applications-list-container"). $("#applications-list-container").
html("<div class='panel-body'><br><p class='fw-warning'>&nbsp;No applications found. " + html("<div class='message message-info'><h4><i class='icon fw fw-info'></i>No applications found.</h4>" +
"please try refreshing the list in a while.<p></div>"); "<p>Please try refreshing the list in a while.</p></div>");
} }
} }
}, },
@ -315,4 +327,5 @@ var InitiateViewOption = null;
} }
); );
} }
}()); }());

@ -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">
@ -366,8 +369,16 @@
{{/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>
@ -380,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;
} }

@ -47,7 +47,6 @@ function setPopupMaxHeight() {
*/ */
function showPopup() { function showPopup() {
$(modalPopup).modal('show'); $(modalPopup).modal('show');
//setPopupMaxHeight();
} }
/* /*
@ -74,8 +73,8 @@ function generateQRCode(qrCodeClass) {
} }
function toggleEnrollment() { function toggleEnrollment() {
$(".modal-body").html($("#qr-code-modal").html()); $(".modal-content").html($("#qr-code-modal").html());
generateQRCode(".modal-body .qr-code"); generateQRCode(".modal-content .qr-code");
showPopup(); showPopup();
} }

@ -18,6 +18,7 @@
package org.wso2.carbon.device.mgt.mobile.windows.api.services; package org.wso2.carbon.device.mgt.mobile.windows.api.services;
import org.wso2.carbon.apimgt.annotations.api.Permission;
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException; import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsDeviceEnrolmentException;
import javax.ws.rs.*; import javax.ws.rs.*;
@ -35,26 +36,31 @@ public interface DeviceManagementAdminService {
@POST @POST
@Path("/lock-devices") @Path("/lock-devices")
@Permission(name = "Lock Device", permission = "/device-mgt/devices/owning/operations/windows/lock")
Response lock(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws Response lock(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws
WindowsDeviceEnrolmentException; WindowsDeviceEnrolmentException;
@POST @POST
@Path("/disenroll-devices") @Path("/disenroll-devices")
@Permission(name = "Disenroll Device", permission = "/device-mgt/devices/disenroll/windows")
Response disenroll(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws Response disenroll(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws
WindowsDeviceEnrolmentException; WindowsDeviceEnrolmentException;
@POST @POST
@Path("/wipe-devices") @Path("/wipe-devices")
@Permission(name = "Wipe Device", permission = "/device-mgt/devices/owning/operations/windows/wipe")
Response wipe(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws Response wipe(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws
WindowsDeviceEnrolmentException; WindowsDeviceEnrolmentException;
@POST @POST
@Path("/ring-devices") @Path("/ring-devices")
@Permission(name = "Ring Device", permission = "/device-mgt/devices/owning/operations/windows/ring")
Response ring(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws Response ring(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws
WindowsDeviceEnrolmentException; WindowsDeviceEnrolmentException;
@POST @POST
@Path("/lockreset-devices") @Path("/lockreset-devices")
@Permission(name = "Lock-Reset Device", permission = "/device-mgt/devices/owning/operations/windows/lockreset")
Response lockReset(@HeaderParam("Accept") String acceptHeader, List<String> deviceIds) Response lockReset(@HeaderParam("Accept") String acceptHeader, List<String> deviceIds)
throws WindowsDeviceEnrolmentException; throws WindowsDeviceEnrolmentException;
} }

Loading…
Cancel
Save