mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
ading role filtering and ui fixes
This commit is contained in:
parent
968913f135
commit
e6333438b9
@ -43,7 +43,8 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<!-- content -->
|
<!-- content -->
|
||||||
<div id="role-create-form" class="container col-centered wr-content">
|
<div id="role-create-form" data-cloud={{isCloud}} class="container col-centered wr-content
|
||||||
|
">
|
||||||
<div class="wr-form">
|
<div class="wr-form">
|
||||||
<p class="page-sub-title">Add Role</p>
|
<p class="page-sub-title">Add Role</p>
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|||||||
@ -38,6 +38,7 @@ function onRequest(context) {
|
|||||||
if (userModule.isAuthorized("/permission/admin/device-mgt/users/view")) {
|
if (userModule.isAuthorized("/permission/admin/device-mgt/users/view")) {
|
||||||
displayData.canViewUsers = true;
|
displayData.canViewUsers = true;
|
||||||
}
|
}
|
||||||
|
displayData.isCloud = deviceMgtProps.isCloud;
|
||||||
|
|
||||||
return displayData;
|
return displayData;
|
||||||
}
|
}
|
||||||
@ -33,6 +33,8 @@ var clearInline = {};
|
|||||||
|
|
||||||
var apiBasePath = "/api/device-mgt/v1.0";
|
var apiBasePath = "/api/device-mgt/v1.0";
|
||||||
var domain = $("#domain").val();
|
var domain = $("#domain").val();
|
||||||
|
var isCloud = $("#role-create-form").data("cloud");
|
||||||
|
|
||||||
|
|
||||||
var enableInlineError = function (inputField, errorMsg, errorSign) {
|
var enableInlineError = function (inputField, errorMsg, errorSign) {
|
||||||
var fieldIdentifier = "#" + inputField;
|
var fieldIdentifier = "#" + inputField;
|
||||||
@ -114,6 +116,8 @@ function formatRepoSelection (user) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
isCloud = $("#role-create-form").data("cloud");
|
||||||
|
|
||||||
var appContext = $("#app-context").data("app-context");
|
var appContext = $("#app-context").data("app-context");
|
||||||
$("#users").select2({
|
$("#users").select2({
|
||||||
multiple: true,
|
multiple: true,
|
||||||
@ -151,7 +155,9 @@ $(document).ready(function () {
|
|||||||
},
|
},
|
||||||
cache: true
|
cache: true
|
||||||
},
|
},
|
||||||
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
|
escapeMarkup: function (markup) {
|
||||||
|
return markup;
|
||||||
|
}, // let our custom formatter work
|
||||||
minimumInputLength: 1,
|
minimumInputLength: 1,
|
||||||
templateResult: formatRepo, // omitted for brevity, see the source of this page
|
templateResult: formatRepo, // omitted for brevity, see the source of this page
|
||||||
templateSelection: formatRepoSelection // omitted for brevity, see the source of this page
|
templateSelection: formatRepoSelection // omitted for brevity, see the source of this page
|
||||||
@ -163,6 +169,7 @@ $(document).ready(function () {
|
|||||||
* on Add Role page in WSO2 MDM Console.
|
* on Add Role page in WSO2 MDM Console.
|
||||||
*/
|
*/
|
||||||
$("button#add-role-btn").click(function () {
|
$("button#add-role-btn").click(function () {
|
||||||
|
|
||||||
var domain = $("#domain").val();
|
var domain = $("#domain").val();
|
||||||
var roleNameInput = $("input#roleName");
|
var roleNameInput = $("input#roleName");
|
||||||
var roleName = roleNameInput.val();
|
var roleName = roleNameInput.val();
|
||||||
@ -185,7 +192,11 @@ $(document).ready(function () {
|
|||||||
$(errorMsgWrapper).removeClass("hidden");
|
$(errorMsgWrapper).removeClass("hidden");
|
||||||
} else {
|
} else {
|
||||||
var addRoleFormData = {};
|
var addRoleFormData = {};
|
||||||
|
if (isCloud) {
|
||||||
|
addRoleFormData.roleName = "devicemgt" + roleName;
|
||||||
|
} else {
|
||||||
addRoleFormData.roleName = roleName;
|
addRoleFormData.roleName = roleName;
|
||||||
|
}
|
||||||
if (domain != "PRIMARY") {
|
if (domain != "PRIMARY") {
|
||||||
addRoleFormData.roleName = domain + "/" + roleName;
|
addRoleFormData.roleName = domain + "/" + roleName;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -37,6 +37,7 @@ var modalPopupContainer = modalPopup + " .modal-content";
|
|||||||
var modalPopupContent = modalPopup + " .modal-content";
|
var modalPopupContent = modalPopup + " .modal-content";
|
||||||
var body = "body";
|
var body = "body";
|
||||||
var isInit = true;
|
var isInit = true;
|
||||||
|
var isCloud = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -91,6 +92,7 @@ function htmlspecialchars(text){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function loadRoles() {
|
function loadRoles() {
|
||||||
|
isCloud = $("#role-table").data("cloud");
|
||||||
var loadingContent = $("#loading-content");
|
var loadingContent = $("#loading-content");
|
||||||
loadingContent.show();
|
loadingContent.show();
|
||||||
|
|
||||||
@ -98,21 +100,40 @@ function loadRoles() {
|
|||||||
data = JSON.parse(data);
|
data = JSON.parse(data);
|
||||||
|
|
||||||
var objects = [];
|
var objects = [];
|
||||||
|
var count = 0;
|
||||||
$(data.roles).each(function (index) {
|
$(data.roles).each(function (index) {
|
||||||
|
if (isCloud && data.roles[index].startsWith("devicemgt")) {
|
||||||
|
count++;
|
||||||
objects.push(
|
objects.push(
|
||||||
{
|
{
|
||||||
name: htmlspecialchars(data.roles[index]),
|
name: htmlspecialchars(data.roles[index]),
|
||||||
DT_RowId: "role-" + htmlspecialchars(data.roles[index])
|
DT_RowId: "role-" + htmlspecialchars(data.roles[index])
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
} else if (!isCloud) {
|
||||||
|
objects.push(
|
||||||
|
{
|
||||||
|
name: htmlspecialchars(data.roles[index]),
|
||||||
|
DT_RowId: "role-" + htmlspecialchars(data.roles[index])
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
var json = {
|
var json = {};
|
||||||
|
if (isCloud) {
|
||||||
|
json = {
|
||||||
|
"recordsTotal": count,
|
||||||
|
"recordsFiltered": count,
|
||||||
|
"data": objects
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
json = {
|
||||||
"recordsTotal": data.count,
|
"recordsTotal": data.count,
|
||||||
"recordsFiltered": data.count,
|
"recordsFiltered": data.count,
|
||||||
"data": objects
|
"data": objects
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return JSON.stringify(json);
|
return JSON.stringify(json);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -67,8 +67,9 @@
|
|||||||
<br>
|
<br>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="role-table" data-role={{adminRole}}>
|
<div id="role-table" data-cloud={{isCloud}} data-role={{adminRole}}>
|
||||||
<table class="table table-striped table-hover list-table display responsive nowrap data-table grid-view" id="role-grid">
|
<table class="table table-striped table-hover list-table display responsive nowrap data-table grid-view"
|
||||||
|
id="role-grid">
|
||||||
<thead>
|
<thead>
|
||||||
<tr class="sort-row">
|
<tr class="sort-row">
|
||||||
<th>By Role Name</th>
|
<th>By Role Name</th>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user