Updating User Listing UI

revert-70aa11f8
dilanua 8 years ago
parent 54807b99ee
commit 32fc58c917

@ -228,11 +228,11 @@ function resetPassword(uname) {
* when a user type on the search field on User Listing page in * when a user type on the search field on User Listing page in
* WSO2 MDM Console then click on the search button. * WSO2 MDM Console then click on the search button.
*/ */
$("#search-btn").click(function () { //$("#search-btn").click(function () {
var searchQuery = $("#search-by-username").val(); // var searchQuery = $("#search-by-username").val();
$("#ast-container").empty(); // $("#ast-container").empty();
loadUsers(searchQuery); // loadUsers(searchQuery);
}); //});
/** /**
* Following function would execute * Following function would execute
@ -248,11 +248,9 @@ function InitiateViewOption() {
} }
} }
function loadUsers(searchParam) { function loadUsers() {
var loadingContentView = "#loading-content";
$(loadingContentView).show();
$("#loading-content").show();
var dataFilter = function (data) { var dataFilter = function (data) {
data = JSON.parse(data); data = JSON.parse(data);
@ -265,28 +263,32 @@ function loadUsers(searchParam) {
firstname: data.users[index].firstname ? data.users[index].firstname : '' , firstname: data.users[index].firstname ? data.users[index].firstname : '' ,
lastname: data.users[index].lastname ? data.users[index].lastname : '', lastname: data.users[index].lastname ? data.users[index].lastname : '',
emailAddress : data.users[index].emailAddress ? data.users[index].emailAddress : '', emailAddress : data.users[index].emailAddress ? data.users[index].emailAddress : '',
DT_RowId : "role-" + data.users[index].username}) DT_RowId : "user-" + data.users[index].username})
}); });
json = { var 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);
} };
//noinspection JSUnusedLocalSymbols
var fnCreatedRow = function (nRow, aData, iDataIndex) { var fnCreatedRow = function (nRow, aData, iDataIndex) {
$(nRow).attr('data-type', 'selectable'); $(nRow).attr('data-type', 'selectable');
$(nRow).attr('data-username', aData["filter"]); $(nRow).attr('data-username', aData["filter"]);
} };
//noinspection JSUnusedLocalSymbols
var columns = [ var columns = [
{ {
class: "remove-padding icon-only content-fill", class: "remove-padding icon-only content-fill",
data: null, data: null,
defaultContent: '<div class="thumbnail icon"> <i class="square-element text fw fw-user" style="font-size: 30px;"></i> </div>' defaultContent: '<div class="thumbnail icon">' +
'<i class="square-element text fw fw-user" style="font-size: 30px;"></i>' +
'</div>'
}, },
{ {
class: "fade-edge", class: "fade-edge",
@ -313,29 +315,46 @@ function loadUsers(searchParam) {
class: "text-right content-fill text-left-on-grid-view no-wrap", class: "text-right content-fill text-left-on-grid-view no-wrap",
data: null, data: null,
render: function (data, type, row, meta) { render: function (data, type, row, meta) {
return '<a href="/emm/user/edit?username=' + data.filter + '" data-username="' + data.filter + return '<a href="/emm/user/edit?username=' + data.filter + '" data-username="' + data.filter + '" ' +
'" data-click-event="edit-form" class="btn padding-reduce-on-grid-view edit-user-link"> ' + 'data-click-event="edit-form" ' +
'<span class="fw-stack"> <i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-edit fw-stack-1x"></i>' + 'class="btn padding-reduce-on-grid-view edit-user-link"> ' +
' </span> <span class="hidden-xs hidden-on-grid-view">Edit</span> </a>' + '<span class="fw-stack"> ' +
'<i class="fw fw-ring fw-stack-2x"></i>' +
'<a href="#" data-username="' + data.filter + '" data-userid=' + data.filter + '<i class="fw fw-edit fw-stack-1x"></i>' +
' data-click-event="remove-form" onclick="javascript:removeUser(\'' + data.filter + '\')" ' + '</span>' +
'<span class="hidden-xs hidden-on-grid-view">' +
'&nbsp;&nbsp;Edit' +
'</span>' +
'</a>' +
'<a href="#" data-username="' + data.filter + '" data-userid="' + data.filter + '" ' +
'data-click-event="edit-form" ' +
'onclick="javascript:resetPassword(\'' + data.filter + '\')" ' +
'class="btn padding-reduce-on-grid-view remove-user-link">' +
'<span class="fw-stack">' +
'<i class="fw fw-ring fw-stack-2x"></i>' +
'<i class="fw fw-key fw-stack-1x"></i>' +
'</span>' +
'<span class="hidden-xs hidden-on-grid-view">' +
'&nbsp;&nbsp;Reset Password' +
'</span>' +
'</a>' +
'<a href="#" data-username="' + data.filter + '" data-userid="' + data.filter + '" ' +
'data-click-event="remove-form" ' +
'onclick="javascript:removeUser(\'' + data.filter + '\')" ' +
'class="btn padding-reduce-on-grid-view remove-user-link">' + 'class="btn padding-reduce-on-grid-view remove-user-link">' +
'<span class="fw-stack"> <i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-delete fw-stack-1x">' + '<span class="fw-stack">' +
'</i> </span> <span class="hidden-xs hidden-on-grid-view">Remove</span> </a>' + '<i class="fw fw-ring fw-stack-2x"></i>' +
'<i class="fw fw-delete fw-stack-1x"></i>' +
'<a href="#" data-username="' + data.filter + '" data-userid="' + data.filter + '</span>' +
'" data-click-event="edit-form" onclick="javascript:resetPassword(\'' + data.filter + '<span class="hidden-xs hidden-on-grid-view">' +
'\')" class="btn padding-reduce-on-grid-view remove-user-link"> <span class="fw-stack"> <i class="fw fw-ring fw-stack-2x">' + '&nbsp;&nbsp;Remove' +
'</i> <i class="fw fw-key fw-stack-1x"></i> <span class="fw-stack fw-move-right fw-move-bottom"> <i class="fw fw-circle fw-stack-2x fw-stroke fw-inverse"><' + '</span>' +
'/i> <i class="fw fw-circle fw-stack-2x"></i> <i class="fw fw-refresh fw-stack-1x fw-inverse">' + '</a>';
'</i> </span> </span> <span class="hidden-xs hidden-on-grid-view">Reset</span> </a>'
} }
} }
]; ];
var options = { var options = {
"placeholder": "Search By Username", "placeholder": "Search By Username",
"searchKey" : "filter" "searchKey" : "filter"
@ -347,7 +366,6 @@ function loadUsers(searchParam) {
$("#loading-content").hide(); $("#loading-content").hide();
// $("#loading-content").show(); // $("#loading-content").show();
// var userListing = $("#user-listing"); // var userListing = $("#user-listing");
// var userListingSrc = userListing.attr("src"); // var userListingSrc = userListing.attr("src");
@ -410,7 +428,6 @@ function loadUsers(searchParam) {
$(document).ready(function () { $(document).ready(function () {
loadUsers(); loadUsers();
$(".viewEnabledIcon").click(function () { $(".viewEnabledIcon").click(function () {
InitiateViewOption(); InitiateViewOption();
}); });

Loading…
Cancel
Save