Merge pull request #401 from madawas/modal-refactor

Refactoring pages to use new modal unit
revert-70aa11f8
Kamidu Sachith Punchihewa 8 years ago committed by GitHub
commit 02d3adf51e

@ -16,6 +16,7 @@
under the License. under the License.
}} }}
{{unit "cdmf.unit.ui.title" pageTitle="Add Certificate"}} {{unit "cdmf.unit.ui.title" pageTitle="Add Certificate"}}
{{unit "cdmf.unit.ui.modal"}}
{{#zone "breadcrumbs"}} {{#zone "breadcrumbs"}}
<li> <li>
@ -110,73 +111,6 @@
<a href="#">By Serial Number</a> <a href="#">By Serial Number</a>
</div> </div>
</div> </div>
<div id="remove-certificate-modal-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Do you really want to remove this certificate ?</h3>
<div class="buttons">
<a href="#" id="remove-certificate-yes-link" class="btn-operations">
Remove
</a>
<a href="#" id="remove-certificate-cancel-link" class="btn-operations btn-default">
Cancel
</a>
</div>
</div>
</div>
</div>
</div>
<div id="remove-certificate-success-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Done. Certificate was successfully removed.</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>
<div class="modal-footer">
<div class="buttons">
</div>
</div>
</div>
<div id="remove-certificate-error-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">An unexpected error occurred. Please try again later.</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>
<div class="modal-footer">
<div class="buttons">
</div>
</div>
</div>
<div id="errorCertificateView" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Unauthorized action!
</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>
<div class="modal-footer">
<div class="buttons">
</div>
</div>
</div>
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}

@ -54,8 +54,11 @@ function hidePopup() {
*/ */
function removeCertificate(serialNumber) { function removeCertificate(serialNumber) {
var serviceUrl = base_api_url + "/admin/certificates/" + serialNumber; var serviceUrl = base_api_url + "/admin/certificates/" + serialNumber;
$(modalPopupContent).html($('#remove-certificate-modal-content').html()); modalDialog.header('Do you really want to remove this certificate ?');
showPopup(); modalDialog.footer('<div class="buttons"><a href="#" id="remove-certificate-yes-link" class="btn-operations">' +
'Remove</a><a href="#" id="remove-certificate-cancel-link" class="btn-operations btn-default">Cancel</a>' +
'</div>');
modalDialog.show();
$("a#remove-certificate-yes-link").click(function () { $("a#remove-certificate-yes-link").click(function () {
invokerUtil.delete( invokerUtil.delete(
@ -63,23 +66,29 @@ function removeCertificate(serialNumber) {
function () { function () {
$("#" + serialNumber).remove(); $("#" + serialNumber).remove();
var newCertificateListCount = $(".user-list > span").length; var newCertificateListCount = $(".user-list > span").length;
$("#certificate-listing-status-msg").text("Total number of Certificates found : " + newCertificateListCount); $("#certificate-listing-status-msg").text("Total number of Certificates found : " +
$(modalPopupContent).html($('#remove-certificate-success-content').html()); newCertificateListCount);
modalDialog.header('Done. Certificate was successfully removed.');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-certificate-success-link" ' +
'class="btn-operations">Ok</a></div>');
$("a#remove-certificate-success-link").click(function () { $("a#remove-certificate-success-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
}, },
function () { function () {
$(modalPopupContent).html($('#remove-certificate-error-content').html()); modalDialog.header('An unexpected error occurred. Please try again later.');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-certificate-error-link" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#remove-certificate-error-link").click(function () { $("a#remove-certificate-error-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} }
); );
}); });
$("a#remove-certificate-cancel-link").click(function () { $("a#remove-certificate-cancel-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} }
@ -103,8 +112,9 @@ function InitiateViewOption() {
if ($("#can-view").val()) { if ($("#can-view").val()) {
$(location).attr('href', $(this).data("url")); $(location).attr('href', $(this).data("url"));
} else { } else {
$(modalPopupContent).html($('#errorCertificateView').html()); modalDialog.header('Unauthorized action!');
showPopup(); modalDialog.content('You do not have permission to view this certificate.');
modalDialog.showAsAWarning();
} }
} }

@ -1,4 +1,5 @@
{{unit "cdmf.unit.ui.title" pageTitle="Group Management"}} {{unit "cdmf.unit.ui.title" pageTitle="Group Management"}}
{{unit "cdmf.unit.ui.modal"}}
{{#zone "breadcrumbs"}} {{#zone "breadcrumbs"}}
<li> <li>
@ -55,22 +56,6 @@
</div> </div>
</div> </div>
</div> </div>
<div id="group-error-content" class="hide">
<div class="modal-content">
<div class="row">
<div class="col-md-7 col-centered center-container">
<h4 id="error-msg">Unexpected error occurred!</h4>
<br/>
<div class="buttons">
<a href="#" id="group-unexpected-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
</div>
</div>
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
{{js "js/group-add.js"}} {{js "js/group-add.js"}}

@ -71,10 +71,13 @@ $(function () {
}); });
function displayErrors(message) { function displayErrors(message) {
showPopup();
$('#error-msg').html(message.responseText); $('#error-msg').html(message.responseText);
$(modalPopupContent).html($('#group-error-content').html()); modalDialog.header('Unexpected error occurred!');
modalDialog.content('<h4 id="error-msg"></h4>');
modalDialog.footer('<div class="buttons"><a href="#" id="group-unexpected-error-link" class="btn-operations">Ok' +
'</a></div>');
modalDialog.showAsError();
$("a#group-unexpected-error-link").click(function () { $("a#group-unexpected-error-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} }

@ -17,8 +17,8 @@
}} }}
{{unit "cdmf.unit.ui.title" pageTitle="Group Management"}} {{unit "cdmf.unit.ui.title" pageTitle="Group Management"}}
{{unit "cdmf.unit.ui.content.title" pageHeader="Groups"}} {{unit "cdmf.unit.ui.content.title" pageHeader="Groups"}}
{{unit "cdmf.unit.lib.data-table"}} {{unit "cdmf.unit.lib.data-table"}}
{{unit "cdmf.unit.ui.modal"}}
{{#zone "breadcrumbs"}} {{#zone "breadcrumbs"}}
<li> <li>
@ -93,213 +93,6 @@
</div> </div>
</div> </div>
{{/if}} {{/if}}
<div id="share-group-w1-modal-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Enter user name to manage group sharing</h3>
<div id="user-names">
<br />
<input type="text" id="share-user-selector" style="color:#3f3f3f;padding:5px;width:250px;">
</input>
</div>
<div class="buttons">
<a href="#" id="share-group-next-link" class="btn-operations">
Next
</a>
<a href="#" id="share-group-w1-cancel-link" class="btn-operations btn-default">
Cancel
</a>
</div>
</div>
</div>
</div>
</div>
<div id="share-group-w2-modal-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Select sharing roles</h3>
<br/>
<div id="user-roles">Loading...</div>
<div class="buttons">
<a href="#" id="share-group-yes-link" class="btn-operations">
OK
</a>
<a href="#" id="share-group-w2-cancel-link" class="btn-operations btn-default">
Cancel
</a>
</div>
</div>
</div>
</div>
</div>
<div id="share-group-200-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Group sharing updated successfully.</h3>
</div>
</div>
</div>
</div>
<div id="remove-group-modal-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Do you really want to remove this group from your Group List?</h3>
<div class="buttons">
<a href="#" id="remove-group-yes-link" class="btn-operations">
Yes
</a>
<a href="#" id="remove-group-cancel-link" class="btn-operations btn-default">
Cancel
</a>
</div>
</div>
</div>
</div>
</div>
<div id="remove-group-200-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Group was successfully removed.</h3>
</div>
</div>
</div>
</div>
<div id="edit-group-modal-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Please enter new name and description for the group</h3>
<br/>
<div>
<input id="edit-group-name" style="color:#3f3f3f;padding:5px" type="text"
value=""
placeholder="Group Name" size="60">
</div>
<br/>
<div>
<input id="edit-group-description" style="color:#3f3f3f;padding:5px" type="text"
value=""
placeholder="Group Description" size="60">
</div>
<div class="buttons">
<a href="#" id="edit-group-yes-link" class="btn-operations">
Update
</a>
<a href="#" id="edit-group-cancel-link" class="btn-operations btn-default">
Cancel
</a>
</div>
</div>
</div>
</div>
</div>
<div id="edit-group-200-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Group was successfully updated.</h3>
</div>
</div>
</div>
</div>
<div id="group-400-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3 id="error-msg">Bad Request. Please contact your administrator.</h3>
<div class="buttons">
<a href="#" id="group-400-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
</div>
</div>
<div id="group-403-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Operation not permitted.</h3>
<div class="buttons">
<a href="#" id="group-403-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
</div>
</div>
<div id="group-404-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3 id="group-404-message">Not found.</h3>
<div class="buttons">
<a href="#" id="group-404-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
</div>
</div>
<div id="group-409-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Group does not exist.</h3>
<div class="buttons">
<a href="#" id="group-409-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
</div>
</div>
<div id="group-unexpected-error-content" class="hide">
<div class="content">
<div class="row">
<div class="col-lg-5 col-md-6 col-centered">
<h3>Unexpected error occurred!</h3>
<div class="buttons">
<a href="#" id="group-unexpected-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>

@ -295,9 +295,13 @@ function attachEvents() {
$("a.share-group-link").click(function () { $("a.share-group-link").click(function () {
var groupName = $(this).data("group-name"); var groupName = $(this).data("group-name");
var groupOwner = $(this).data("group-owner"); var groupOwner = $(this).data("group-owner");
$(modalPopupContent).html($('#share-group-w1-modal-content').html()); modalDialog.header('Enter user name to manage group sharing');
modalDialog.content('<input type="text" id="share-user-selector" ' +
'style="color:#3f3f3f;padding:5px;width:250px;" />');
modalDialog.footer('<div class="buttons"><a href="#" id="share-group-next-link" class="btn-operations">Next' +
'</a><a href="#" id="share-group-w1-cancel-link" class="btn-operations btn-default">Cancel</a></div>');
$("a#share-group-next-link").show(); $("a#share-group-next-link").show();
showPopup(); modalDialog.show();
$("a#share-group-next-link").click(function () { $("a#share-group-next-link").click(function () {
var selectedUser = $('#share-user-selector').val(); var selectedUser = $('#share-user-selector').val();
if (selectedUser == $("#group-listing").data("current-user")) { if (selectedUser == $("#group-listing").data("current-user")) {
@ -308,7 +312,7 @@ function attachEvents() {
} }
}); });
$("a#share-group-w1-cancel-link").click(function () { $("a#share-group-w1-cancel-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
}); });
@ -321,16 +325,18 @@ function attachEvents() {
var groupName = $(this).data("group-name"); var groupName = $(this).data("group-name");
var groupOwner = $(this).data("group-owner"); var groupOwner = $(this).data("group-owner");
$(modalPopupContent).html($('#remove-group-modal-content').html()); modalDialog.header('Do you really want to remove this group from your Group List?');
showPopup(); modalDialog.footer('<div class="buttons"><a href="#" id="remove-group-yes-link" class="btn-operations">Yes' +
'</a><a href="#" id="remove-group-cancel-link" class="btn-operations btn-default">Cancel</a></div>');
modalDialog.show();
$("a#remove-group-yes-link").click(function () { $("a#remove-group-yes-link").click(function () {
var successCallback = function (data, textStatus, xhr) { var successCallback = function (data, textStatus, xhr) {
data = JSON.parse(data); data = JSON.parse(data);
if (xhr.status == 200) { if (xhr.status == 200) {
$(modalPopupContent).html($('#remove-group-200-content').html()); modalDialog.header('Group was successfully removed.');
setTimeout(function () { setTimeout(function () {
hidePopup(); modalDialog.hide();
location.reload(false); location.reload(false);
}, 2000); }, 2000);
} else { } else {
@ -345,7 +351,7 @@ function attachEvents() {
}); });
$("a#remove-group-cancel-link").click(function () { $("a#remove-group-cancel-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
}); });
@ -360,10 +366,15 @@ function attachEvents() {
var groupOwner = $(this).data("group-owner"); var groupOwner = $(this).data("group-owner");
var groupDescription = $(this).data("group-description"); var groupDescription = $(this).data("group-description");
$(modalPopupContent).html($('#edit-group-modal-content').html()); modalDialog.header('Please enter new name and description for the group.');
modalDialog.content('<div><input id="edit-group-name" style="color:#3f3f3f;padding:5px" type="text" value="" ' +
'placeholder="Group Name" size="60"></div><br/><div><input id="edit-group-description" ' +
'style="color:#3f3f3f;padding:5px" type="text" value="" placeholder="Group Description" size="60"></div>');
modalDialog.footer('<div class="buttons"><a href="#" id="edit-group-yes-link" class="btn-operations">Update' +
'</a><a href="#" id="edit-group-cancel-link" class="btn-operations btn-default">Cancel</a></div>');
$('#edit-group-name').val(groupName); $('#edit-group-name').val(groupName);
$('#edit-group-description').val(groupDescription); $('#edit-group-description').val(groupDescription);
showPopup(); modalDialog.show();
$("a#edit-group-yes-link").click(function () { $("a#edit-group-yes-link").click(function () {
var newGroupName = $('#edit-group-name').val(); var newGroupName = $('#edit-group-name').val();
@ -373,8 +384,11 @@ function attachEvents() {
var successCallback = function (data, textStatus, xhr) { var successCallback = function (data, textStatus, xhr) {
data = JSON.parse(data); data = JSON.parse(data);
if (xhr.status == 200) { if (xhr.status == 200) {
modalDialog.hide();
modalDialog.header('Group was successfully updated.');
modalDialog.show();
setTimeout(function () { setTimeout(function () {
hidePopup(); modalDialog.hide();
location.reload(false); location.reload(false);
}, 2000); }, 2000);
} else { } else {
@ -389,14 +403,19 @@ function attachEvents() {
}); });
$("a#edit-group-cancel-link").click(function () { $("a#edit-group-cancel-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
}); });
} }
function getAllRoles(groupName, groupOwner, selectedUser) { function getAllRoles(groupName, groupOwner, selectedUser) {
$(modalPopupContent).html($('#share-group-w2-modal-content').html()); modalDialog.header('Select sharing roles');
$('#user-roles').html('<div style="height:100px" data-state="loading" data-loading-text="Loading..." data-loading-style="icon-only" data-loading-inverse="true"></div>'); modalDialog.content('<div id="user-roles">Loading...</div>');
modalDialog.footer('<div class="buttons"><a href="#" id="share-group-yes-link" class="btn-operations">OK</a><a ' +
'href="#" id="share-group-w2-cancel-link" class="btn-operations btn-default">Cancel</a></div>');
modalDialog.show();
$('#user-roles').html('<div style="height:100px" data-state="loading" data-loading-text="Loading..." ' +
'data-loading-style="icon-only" data-loading-inverse="true"></div>');
$("a#share-group-yes-link").hide(); $("a#share-group-yes-link").hide();
var successCallback = function (data, textStatus, xhr) { var successCallback = function (data, textStatus, xhr) {
data = JSON.parse(data); data = JSON.parse(data);
@ -417,7 +436,7 @@ function getAllRoles(groupName, groupOwner, selectedUser) {
}); });
$("a#share-group-w2-cancel-link").click(function () { $("a#share-group-w2-cancel-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} }
@ -463,15 +482,17 @@ function generateRoleMap(groupName, groupOwner, selectedUser, allRoles) {
}); });
$("a#share-group-w2-cancel-link").click(function () { $("a#share-group-w2-cancel-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} }
function updateGroupShare(groupName, groupOwner, selectedUser, roles) { function updateGroupShare(groupName, groupOwner, selectedUser, roles) {
var successCallback = function (data) { var successCallback = function (data) {
$(modalPopupContent).html($('#share-group-200-content').html()); // $(modalPopupContent).html($('#share-group-200-content').html());
modalDialog.header('Group sharing updated successfully.');
modalDialog.show();
setTimeout(function () { setTimeout(function () {
hidePopup(); modalDialog.hide();
location.reload(false); location.reload(false);
}, 2000); }, 2000);
}; };
@ -483,35 +504,44 @@ function updateGroupShare(groupName, groupOwner, selectedUser, roles) {
} }
function displayErrors(jqXHR) { function displayErrors(jqXHR) {
showPopup();
if (jqXHR.status == 400) { if (jqXHR.status == 400) {
$(modalPopupContent).html($('#group-400-content').html()); modalDialog.header('<h3 id="error-msg">Bad Request. Please contact your administrator.</h3>');
modalDialog.footer('<div class="buttons"><a href="#" id="group-400-link" class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
if (jqXHR.responseText) { if (jqXHR.responseText) {
$('#error-msg').html(jqXHR.responseText.replace(new RegExp("\"", 'g'), "")); $('#error-msg').html(jqXHR.responseText.replace(new RegExp("\"", 'g'), ""));
} }
$("a#group-400-link").click(function () { $("a#group-400-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} else if (jqXHR.status == 403) { } else if (jqXHR.status == 403) {
$(modalPopupContent).html($('#group-403-content').html()); modalDialog.header('Operation not permitted.');
modalDialog.footer('<div class="buttons"><a href="#" id="group-403-link" class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#group-403-link").click(function () { $("a#group-403-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} else if (jqXHR.status == 404) { } else if (jqXHR.status == 404) {
$(modalPopupContent).html($('#group-404-content').html()); modalDialog.header('<h3 id="group-404-message">Not found.</h3>');
modalDialog.footer('<div class="buttons"><a href="#" id="group-404-link" class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("#group-404-message").html(jqXHR.responseText); $("#group-404-message").html(jqXHR.responseText);
$("a#group-404-link").click(function () { $("a#group-404-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} else if (jqXHR.status == 409) { } else if (jqXHR.status == 409) {
$(modalPopupContent).html($('#group-409-content').html()); modalDialog.header('Group does not exist..');
modalDialog.footer('<div class="buttons"><a href="#" id="group-409-link" class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#group-409-link").click(function () { $("a#group-409-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} else { } else {
$(modalPopupContent).html($('#group-unexpected-error-content').html()); modalDialog.header('Unexpected error occurred!');
modalDialog.footer('<div class="buttons"><a href="#" id="group-unexpected-error-link" class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#group-unexpected-error-link").click(function () { $("a#group-unexpected-error-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
console.log("Error code: " + jqXHR.status); console.log("Error code: " + jqXHR.status);
} }

@ -17,6 +17,7 @@
}} }}
{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}} {{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}}
{{unit "cdmf.unit.data-tables-extended"}} {{unit "cdmf.unit.data-tables-extended"}}
{{unit "cdmf.unit.ui.modal"}}
{{#zone "topCss"}} {{#zone "topCss"}}
<style> <style>
@ -254,384 +255,6 @@
<a href="#">By Status</a> <a href="#">By Status</a>
</div> </div>
</div> </div>
<div id="remove-policy-modal-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Do you really want to remove the selected policy(s)?</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>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="remove-policy-yes-link" class="btn-operations">
Remove
</a>
<a href="#" id="remove-policy-cancel-link" class="btn-operations btn-default">
Cancel
</a>
</div>
</div>
</div>
<div id="remove-policy-success-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Done. Selected policy was successfully removed.</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>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="remove-policy-success-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="remove-policy-error-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">An unexpected error occurred. Please try again later.</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>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="remove-policy-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="remove-policy-error-devices" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Cannot Remove Policies.</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">
<h4>You cannot remove policies that are already applied to devices. Please deselect
them and try
again.</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="remove-policy-error-devices" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="publish-policy-modal-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Do you really want to publish the selected policy(s)?</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>
<div class="modal-footer">
<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 btn-default">No</a>
</div>
</div>
</div>
<div id="publish-policy-success-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Done. Selected policy was successfully published.</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>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="publish-policy-success-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="publish-policy-error-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">An unexpected error occurred. Please try again later.</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>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="publish-policy-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="unpublish-policy-modal-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Do you really want to unpublish the selected policy(s)?</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>
<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 btn-default">
No
</a>
</div>
</div>
</div>
<div id="unpublish-policy-success-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Done. Selected policy was successfully unpublished.</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>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="unpublish-policy-success-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="unpublish-policy-error-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">An unexpected error occurred. Please try again later.</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>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="unpublish-policy-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="save-policy-priorities-success-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Done. New Policy priorities were successfully updated.</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>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="save-policy-priorities-success-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="save-policy-priorities-error-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">An unexpected error occurred. Please try again later.</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>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="save-policy-priorities-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="change-policy-modal-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Do you really want to apply changes to all policies?</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>
<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 btn-default">
No
</a>
</div>
</div>
</div>
<div id="change-policy-success-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Done. Changes applied successfully.</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>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="change-policy-success-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="change-policy-error-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">An unexpected error occurred. Please try again later.</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>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="change-policy-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="errorPolicyUnPublish" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Operation cannot be performed !
</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">
<h4>Please select a policy or a list of policies to unpublish.</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="errorPolicyUnPublishSelection" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Operation cannot be performed !
</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">
<h4>You cannot select already inactive policies. Please deselect inactive policies
and try again.</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="errorPolicyPublishSelection" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Operation cannot be performed !
</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">
<h4>You cannot select already active policies. Please deselect active policies and
try again.</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="errorPolicyPublish" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Operation cannot be performed !
</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">
<h4>Please select a policy or a list of policies to publish.</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="errorPolicy" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-error fw-stack-1x"></i>
</span>
Operation cannot be performed !
</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">
<h4>Please select a policy or a list of policies to remove.</h4>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:hidePopup()" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}

@ -154,8 +154,10 @@ $(document).ready(function () {
$("#appbar-btn-apply-changes").click(function () { $("#appbar-btn-apply-changes").click(function () {
var applyPolicyChangesAPI = "/devicemgt_admin/policies/apply-changes"; var applyPolicyChangesAPI = "/devicemgt_admin/policies/apply-changes";
$(modalPopupContent).html($('#change-policy-modal-content').html()); modalDialog.header('Do you really want to apply changes to all policies?');
showPopup(); modalDialog.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 btn-default">No</a></div>');
modalDialog.show();
$("a#change-policy-yes-link").click(function () { $("a#change-policy-yes-link").click(function () {
invokerUtil.put( invokerUtil.put(
@ -163,26 +165,29 @@ $(document).ready(function () {
null, null,
// on success // on success
function () { function () {
$(modalPopupContent).html($('#change-policy-success-content').html()); modalDialog.header('Done. Changes applied successfully.');
showPopup(); modalDialog.footer('<div class="buttons"><a href="#" id="change-policy-success-link" ' +
'class="btn-operations">Ok</a></div>');
$("a#change-policy-success-link").click(function () { $("a#change-policy-success-link").click(function () {
hidePopup(); modalDialog.hide();
location.reload(); location.reload();
}); });
}, },
// on error // on error
function () { function () {
$(modalPopupContent).html($('#change-policy-error-content').html()); modalDialog.header('An unexpected error occurred. Please try again later.');
showPopup(); modalDialog.footer('<div class="buttons"><a href="#" id="change-policy-error-link" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#change-policy-error-link").click(function () { $("a#change-policy-error-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} }
); );
}); });
$("a#change-policy-cancel-link").click(function () { $("a#change-policy-cancel-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
}); });
@ -204,19 +209,22 @@ $(document).ready(function () {
updatePolicyAPI, updatePolicyAPI,
newPolicyPriorityList, newPolicyPriorityList,
function () { function () {
$(modalPopupContent).html($('#save-policy-priorities-success-content').html()); modalDialog.header('Done. New Policy priorities were successfully updated.');
showPopup(); modalDialog.footer('<a href="#" id="save-policy-priorities-success-link" class="btn-operations">Ok' +
'</a>');
modalDialog.show();
$("a#save-policy-priorities-success-link").click(function () { $("a#save-policy-priorities-success-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
}, },
function () { function () {
$("#save-policy-priorities-error-content").find(".message-from-server").html( modalDialog.header('An unexpected error occurred. Please try again later.');
"Message From Server : " + data["statusText"]); modalDialog.content(html("Message From Server : " + data["statusText"]));
$(modalPopupContent).html($('#save-policy-priorities-error-content').html()); modalDialog.footer('<div class="buttons"><a href="#" id="save-policy-priorities-error-link" ' +
showPopup(); 'class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#save-policy-priorities-error-link").click(function () { $("a#save-policy-priorities-error-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} }
); );
@ -227,16 +235,27 @@ $(document).ready(function () {
var policyList = getSelectedPolicies(); var policyList = getSelectedPolicies();
var statusList = getSelectedPolicyStates(); var statusList = getSelectedPolicyStates();
if (($.inArray('Inactive/Updated', statusList) > -1) || ($.inArray('Inactive', statusList) > -1)) { if (($.inArray('Inactive/Updated', statusList) > -1) || ($.inArray('Inactive', statusList) > -1)) {
$(modalPopupContent).html($("#errorPolicyUnPublishSelection").html()); modalDialog.header('Operation cannot be performed !');
showPopup(); modalDialog.content('You cannot select already inactive policies. Please deselect inactive policies and ' +
'try again.');
modalDialog.footer('<div class="buttons"><a href="javascript:modalDialog.hide()" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsAWarning();
} else { } else {
var serviceURL = "/devicemgt_admin/policies/inactivate"; var serviceURL = "/devicemgt_admin/policies/inactivate";
if (policyList == 0) { if (policyList == 0) {
$(modalPopupContent).html($("#errorPolicyUnPublish").html()); modalDialog.header('Operation cannot be performed !');
modalDialog.content('Please select a policy or a list of policies to unpublish.');
modalDialog.footer('<div class="buttons"><a href="javascript:modalDialog.hide()" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsAWarning();
} else { } else {
$(modalPopupContent).html($('#unpublish-policy-modal-content').html()); modalDialog.header('Do you really want to unpublish the selected policy(s)?');
modalDialog.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 btn-default">No</a></div>');
modalDialog.show();
} }
showPopup();
$("a#unpublish-policy-yes-link").click(function () { $("a#unpublish-policy-yes-link").click(function () {
invokerUtil.put( invokerUtil.put(
@ -244,24 +263,29 @@ $(document).ready(function () {
policyList, policyList,
// on success // on success
function () { function () {
$(modalPopupContent).html($('#unpublish-policy-success-content').html()); modalDialog.header('Done. Selected policy was successfully unpublished.');
modalDialog.footer('<div class="buttons"><a href="#" id="unpublish-policy-success-link" ' +
'class="btn-operations">Ok</a></div>');
$("a#unpublish-policy-success-link").click(function () { $("a#unpublish-policy-success-link").click(function () {
hidePopup(); modalDialog.hide();
location.reload(); location.reload();
}); });
}, },
// on error // on error
function () { function () {
$(modalPopupContent).html($('#unpublish-policy-error-content').html()); modalDialog.header('An unexpected error occurred. Please try again later.');
modalDialog.footer('<div class="buttons"><a href="#" id="unpublish-policy-error-link" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#unpublish-policy-error-link").click(function () { $("a#unpublish-policy-error-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} }
); );
}); });
$("a#unpublish-policy-cancel-link").click(function () { $("a#unpublish-policy-cancel-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} }
}); });
@ -271,16 +295,27 @@ $(document).ready(function () {
var policyList = getSelectedPolicies(); var policyList = getSelectedPolicies();
var statusList = getSelectedPolicyStates(); var statusList = getSelectedPolicyStates();
if (($.inArray('Active/Updated', statusList) > -1) || ($.inArray('Active', statusList) > -1)) { if (($.inArray('Active/Updated', statusList) > -1) || ($.inArray('Active', statusList) > -1)) {
$(modalPopupContent).html($("#errorPolicyPublishSelection").html()); modalDialog.header('Operation cannot be performed !');
showPopup(); modalDialog.content('You cannot select already active policies. Please deselect active policies and try ' +
'again.');
modalDialog.footer('<div class="buttons"><a href="javascript:modalDialog.hide()" class="btn-operations">' +
'Ok</a></div>');
modalDialog.showAsAWarning();
} else { } else {
var serviceURL = "/devicemgt_admin/policies/activate"; var serviceURL = "/devicemgt_admin/policies/activate";
if (policyList == 0) { if (policyList == 0) {
$(modalPopupContent).html($("#errorPolicyPublish").html()); modalDialog.header('Operation cannot be performed !');
modalDialog.content('Please select a policy or a list of policies to publish.');
modalDialog.footer('<div class="buttons"><a href="javascript:modalDialog.hide()" class="btn-operations">' +
'Ok</a></div>');
modalDialog.showAsAWarning();
} else { } else {
$(modalPopupContent).html($('#publish-policy-modal-content').html()); modalDialog.header('Do you really want to publish the selected policy(s)?');
modalDialog.footer('<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 btn-default">No</a></div>');
modalDialog.show();
} }
showPopup();
$("a#publish-policy-yes-link").click(function () { $("a#publish-policy-yes-link").click(function () {
invokerUtil.put( invokerUtil.put(
@ -288,24 +323,29 @@ $(document).ready(function () {
policyList, policyList,
// on success // on success
function () { function () {
$(modalPopupContent).html($('#publish-policy-success-content').html()); modalDialog.header('Done. Selected policy was successfully published.');
modalDialog.footer('<div class="buttons"><a href="#" id="publish-policy-success-link" ' +
'class="btn-operations">Ok</a></div>');
$("a#publish-policy-success-link").click(function () { $("a#publish-policy-success-link").click(function () {
hidePopup(); modalDialog.hide();
location.reload(); location.reload();
}); });
}, },
// on error // on error
function () { function () {
$(modalPopupContent).html($('#publish-policy-error-content').html()); modalDialog.header('An unexpected error occurred. Please try again later.');
modalDialog.footer('<div class="buttons"><a href="#" id="publish-policy-error-link" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#publish-policy-error-link").click(function () { $("a#publish-policy-error-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} }
); );
}); });
$("a#publish-policy-cancel-link").click(function () { $("a#publish-policy-cancel-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} }
}); });
@ -314,11 +354,18 @@ $(document).ready(function () {
var policyList = getSelectedPolicies(); var policyList = getSelectedPolicies();
var deletePolicyAPI = "/devicemgt_admin/policies/bulk-remove"; var deletePolicyAPI = "/devicemgt_admin/policies/bulk-remove";
if (policyList == 0) { if (policyList == 0) {
$(modalPopupContent).html($("#errorPolicy").html()); modalDialog.header('Operation cannot be performed !');
modalDialog.content('Please select a policy or a list of policies to remove.');
modalDialog.footer('<div class="buttons"><a href="javascript:modalDialog.hide()" class="btn-operations">' +
'Ok</a></div>');
modalDialog.showAsAWarning();
} else { } else {
$(modalPopupContent).html($('#remove-policy-modal-content').html()); modalDialog.header('Do you really want to remove the selected policy(s)?');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-policy-yes-link" class=' +
'"btn-operations">Remove</a> <a href="#" id="remove-policy-cancel-link" ' +
'class="btn-operations btn-default">Cancel</a></div>');
modalDialog.show();
} }
showPopup();
$("a#remove-policy-yes-link").click(function () { $("a#remove-policy-yes-link").click(function () {
invokerUtil.post( invokerUtil.post(
@ -328,30 +375,41 @@ $(document).ready(function () {
function (data) { function (data) {
data = JSON.parse(data); data = JSON.parse(data);
if (data.errorMessage) { if (data.errorMessage) {
$(modalPopupContent).html($('#remove-policy-error-devices').html()); modalDialog.header('Cannot Remove Policies.');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-policy-error-devices" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#remove-policy-error-devices").click(function () { $("a#remove-policy-error-devices").click(function () {
hidePopup(); modalDialog.hide();
}); });
} else { } else {
$(modalPopupContent).html($('#remove-policy-success-content').html()); modalDialog.header('Done. Selected policy was successfully removed.');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-policy-success-link" ' +
'class="btn-operations">Ok</a></div>');
$("a#remove-policy-success-link").click(function () { $("a#remove-policy-success-link").click(function () {
var thisTable = $(".DTTT_selected").closest('.dataTables_wrapper').find('.dataTable').dataTable(); var thisTable = $(".DTTT_selected").closest('.dataTables_wrapper').find('.dataTable').dataTable();
thisTable.api().rows('.DTTT_selected').remove().draw(false); thisTable.api().rows('.DTTT_selected').remove().draw(false);
hidePopup(); modalDialog.hide();
}); });
} }
}, },
// on error // on error
function (data) { function (data) {
if (JSON.parse(data.responseText).errorMessage) { if (JSON.parse(data.responseText).errorMessage) {
$(modalPopupContent).html($('#remove-policy-error-devices').html()); modalDialog.header('Cannot Remove Policies.');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-policy-error-devices" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#remove-policy-error-devices").click(function () { $("a#remove-policy-error-devices").click(function () {
hidePopup(); modalDialog.hide();
}); });
} else { } else {
$(modalPopupContent).html($('#remove-policy-error-content').html()); modalDialog.header('An unexpected error occurred. Please try again later.');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-policy-error-link" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#remove-policy-error-link").click(function () { $("a#remove-policy-error-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} }
} }
@ -359,7 +417,7 @@ $(document).ready(function () {
}); });
$("a#remove-policy-cancel-link").click(function () { $("a#remove-policy-cancel-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
}); });
$("#loading-content").remove(); $("#loading-content").remove();

@ -210,8 +210,10 @@ $("#role-grid").on("click", ".remove-role-link", function () {
if (userStore) { if (userStore) {
removeRoleAPI += "?user-store=" + encodeURIComponent(userStore); removeRoleAPI += "?user-store=" + encodeURIComponent(userStore);
} }
$(modalPopupContent).html($('#remove-role-modal-content').html()); modalDialog.header('Do you really want to remove this role ?');
showPopup(); modalDialog.footer('<div class="buttons"><a href="#" id="remove-role-yes-link" class="btn-operations">Remove</a>' +
'<a href="#" id="remove-role-cancel-link" class="btn-operations btn-default">Cancel</a></div>');
modalDialog.show();
$("a#remove-role-yes-link").click(function () { $("a#remove-role-yes-link").click(function () {
invokerUtil.delete( invokerUtil.delete(
@ -221,22 +223,28 @@ $("#role-grid").on("click", ".remove-role-link", function () {
role = userStore + '/' + role; role = userStore + '/' + role;
} }
$('[id="role-' + role + '"]').remove(); $('[id="role-' + role + '"]').remove();
$(modalPopupContent).html($('#remove-role-success-content').html()); modalDialog.header('Done. Role was successfully removed.');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-role-success-link" ' +
'class="btn-operations">Ok</a></div>');
$("a#remove-role-success-link").click(function () { $("a#remove-role-success-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
}, },
function () { function () {
$(modalPopupContent).html($('#remove-role-error-content').html()); // $(modalPopupContent).html($('#remove-role-error-content').html());
modalDialog.header('An unexpected error occurred. Please try again later.');
modalDialog.footer('<div class="buttons"><a href="#" id="remove-role-error-link" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#remove-role-error-link").click(function () { $("a#remove-role-error-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} }
); );
}); });
$("a#remove-role-cancel-link").click(function () { $("a#remove-role-cancel-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
}); });

@ -18,6 +18,7 @@
{{unit "cdmf.unit.ui.title" pageTitle="Role Management"}} {{unit "cdmf.unit.ui.title" pageTitle="Role Management"}}
{{unit "cdmf.unit.data-tables-extended"}} {{unit "cdmf.unit.data-tables-extended"}}
{{unit "cdmf.unit.ui.modal"}}
{{#zone "breadcrumbs"}} {{#zone "breadcrumbs"}}
<li> <li>
@ -80,58 +81,6 @@
<th>By Role name</th> <th>By Role name</th>
</div> </div>
</div> </div>
<div id="remove-role-modal-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Do you really want to remove this role ?</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>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="remove-role-yes-link" class="btn-operations">
Remove
</a>
<a href="#" id="remove-role-cancel-link" class="btn-operations btn-default">
Cancel
</a>
</div>
</div>
</div>
<div id="remove-role-success-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">Done. Role was successfully removed.</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>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="remove-role-success-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="remove-role-error-content" class="hide">
<div class="modal-header">
<h3 class="pull-left modal-title">An unexpected error occurred. Please try again later.</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>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="remove-role-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}

@ -16,6 +16,8 @@
under the License. under the License.
}} }}
{{unit "cdmf.unit.ui.modal"}}
<div class="row wr-device-board"> <div class="row wr-device-board">
<div class="col-lg-12 wr-secondary-bar"> <div class="col-lg-12 wr-secondary-bar">
<span class="page-sub-title"> <span class="page-sub-title">
@ -88,111 +90,6 @@
{{/equal}} {{/equal}}
</div> </div>
</div> </div>
<div id="apply-changes-modal-content" class="hide">
<div class="modal-header">
<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">
<h3>Do you really want to apply changes to all policies?</h3>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:void(0)" id="apply-changes-yes-link" class="btn-operations">
Yes
</a>
<a href="javascript:void(0)" id="apply-changes-cancel-link" class="btn-operations">
No
</a>
</div>
</div>
</div>
<div id="apply-changes-success-content" class="hide">
<div class="modal-header">
<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">
<h3>Done. Changes applied successfully.</h3>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:void(0)" id="apply-changes-success-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="apply-changes-error-content" class="hide">
<div class="modal-header">
<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">
<h3>An unexpected error occurred. Please try again later.</h3>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:void(0)" id="apply-changes-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="remove-policy-error-content" class="hide">
<div class="modal-header">
<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">
<h3>An unexpected error occurred. Please try again later.</h3>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:void(0)" id="remove-policy-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="save-policy-priorities-success-content" class="hide">
<div class="modal-header">
<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">
<h3>Done. New Policy priorities were successfully updated.</h3>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:void(0)" id="save-policy-priorities-success-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<div id="save-policy-priorities-error-content" class="hide">
<div class="modal-header">
<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">
<h3>An unexpected error occurred. Please try again later.</h3>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="javascript:void(0)" id="save-policy-priorities-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
</div> </div>
{{#zone "bottomJs"}} {{#zone "bottomJs"}}

@ -87,10 +87,12 @@ $(document).ready(function () {
// on success // on success
function (data, textStatus, jqXHR) { function (data, textStatus, jqXHR) {
if (jqXHR.status == 200) { if (jqXHR.status == 200) {
$(modalPopupContent).html($('#save-policy-priorities-success-content').html()); modalDialog.header('Done. New Policy priorities were successfully updated.');
showPopup(); modalDialog.footer('<div class="buttons"><a href="javascript:void(0)" ' +
'id="save-policy-priorities-success-link" class="btn-operations">Ok</a></div>');
modalDialog.show();
$("a#save-policy-priorities-success-link").click(function () { $("a#save-policy-priorities-success-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
$(applyChangesBtn).prop("disabled", false); $(applyChangesBtn).prop("disabled", false);
} }
@ -98,10 +100,12 @@ $(document).ready(function () {
// on error // on error
function (jqXHR) { function (jqXHR) {
if (jqXHR.status == 400 || jqXHR.status == 500) { if (jqXHR.status == 400 || jqXHR.status == 500) {
$(modalPopupContent).html($("#save-policy-priorities-error-content").html()); modalDialog.header('An unexpected error occurred. Please try again later.');
showPopup(); modalDialog.footer('<div class="buttons"><a href="javascript:void(0)" ' +
'id="save-policy-priorities-error-link" class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#save-policy-priorities-error-link").click(function () { $("a#save-policy-priorities-error-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} }
} }
@ -110,8 +114,11 @@ $(document).ready(function () {
$(applyChangesBtn).click(function () { $(applyChangesBtn).click(function () {
var applyPolicyChangesAPI = "/api/device-mgt/v1.0/policies/apply-changes"; var applyPolicyChangesAPI = "/api/device-mgt/v1.0/policies/apply-changes";
$(modalPopupContent).html($("#apply-changes-modal-content").html()); modalDialog.header('Do you really want to apply changes to all policies?');
showPopup(); modalDialog.footer('<div class="buttons"><a href="javascript:void(0)" id="apply-changes-yes-link" ' +
'class="btn-operations">Yes</a><a href="javascript:void(0)" id="apply-changes-cancel-link" ' +
'class="btn-operations">No</a></div>');
modalDialog.show();
$("a#apply-changes-yes-link").click(function () { $("a#apply-changes-yes-link").click(function () {
invokerUtil.put( invokerUtil.put(
@ -120,20 +127,24 @@ $(document).ready(function () {
// on success // on success
function (data, textStatus, jqXHR) { function (data, textStatus, jqXHR) {
if (jqXHR.status == 200) { if (jqXHR.status == 200) {
$(modalPopupContent).html($("#apply-changes-success-content").html()); modalDialog.header('Done. Changes applied successfully.');
showPopup(); modalDialog.footer('<div class="buttons"><a href="javascript:void(0)" ' +
'id="apply-changes-success-link" class="btn-operations">Ok</a></div>');
modalDialog.show();
$("a#apply-changes-success-link").click(function () { $("a#apply-changes-success-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} }
}, },
// on error // on error
function (jqXHR) { function (jqXHR) {
if (jqXHR.status == 500) { if (jqXHR.status == 500) {
$(modalPopupContent).html($("#apply-changes-error-content").html()); modalDialog.header('An unexpected error occurred. Please try again later.');
showPopup(); modalDialog.footer('<div class="buttons"><a href="javascript:void(0)" ' +
'id="apply-changes-error-link" class="btn-operations">Ok</a></div>');
modalDialog.showAsError();
$("a#apply-changes-error-link").click(function () { $("a#apply-changes-error-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
} }
} }
@ -141,7 +152,7 @@ $(document).ready(function () {
}); });
$("a#apply-changes-cancel-link").click(function () { $("a#apply-changes-cancel-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
}); });

@ -16,6 +16,9 @@
under the License. under the License.
}} }}
<!-- content/body --> <!-- content/body -->
{{unit "cdmf.unit.ui.modal"}}
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<!-- content --> <!-- content -->
@ -81,22 +84,6 @@
</a> </a>
</div> </div>
</div> </div>
<div id="child-deselect-error-content" class="hide">
<div class="modal-header">
<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">
<h3>Can't deselect child permissions when parent permission is selected.</h3>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="child-deselect-error-link" class="btn-operations">
Ok
</a>
</div>
</div>
</div>
<!-- /content --> <!-- /content -->
</div> </div>
</div> </div>

@ -132,10 +132,14 @@ $(document).ready(function () {
$("#permissionList li input").click(function(){ $("#permissionList li input").click(function(){
var parentInput = $(this).parents("ul:eq(1) > li").find('input:eq(0)'); var parentInput = $(this).parents("ul:eq(1) > li").find('input:eq(0)');
if(parentInput && parentInput.is(':checked')){ if(parentInput && parentInput.is(':checked')){
$(modalPopupContent).html($('#child-deselect-error-content').html()); modalDialog.header('');
showPopup(); modalDialog.content('Can\'t deselect child permissions when parent permission is ' +
'selected.');
modalDialog.footer('<div class="buttons"><a href="#" id="child-deselect-error-link" ' +
'class="btn-operations">Ok</a></div>');
modalDialog.showAsAWarning();
$("a#child-deselect-error-link").click(function () { $("a#child-deselect-error-link").click(function () {
hidePopup(); modalDialog.hide();
}); });
return false; return false;
} }

Loading…
Cancel
Save