Updating User Listing UI

revert-70aa11f8
dilanua 8 years ago
parent 687efa97b1
commit 677385920e

@ -69,24 +69,12 @@ function hidePopup() {
$(modalPopup).hide();
}
/*
* Function to get selected usernames.
*/
function getSelectedUsernames() {
var usernameList = [];
var userList = $("#user-grid").find('tr.DTTT_selected');
userList.each(function () {
usernameList.push($(this).data('username'));
});
return usernameList;
}
/**
* Following click function would execute
* when a user clicks on "Invite" link
* on User Management page in WSO2 MDM Console.
*/
$("a.invite-user-link").click(function () {
$("a#invite-user-link").click(function () {
var usernameList = getSelectedUsernames();
var inviteUserAPI = apiBasePath + "/users/send-invitation";
@ -122,42 +110,16 @@ $("a.invite-user-link").click(function () {
});
});
/**
* Following click function would execute
* when a user clicks on "Remove" link
* on User Listing page in WSO2 MDM Console.
/*
* Function to get selected usernames.
*/
function removeUser(uname) {
var username = uname;
var removeUserAPI = apiBasePath + "/users/" + username;
$(modalPopupContent).html($('#remove-user-modal-content').html());
showPopup();
$("a#remove-user-yes-link").click(function () {
invokerUtil.delete(
removeUserAPI,
function (data, textStatus, jqXHR) {
if (jqXHR.status == 200) {
$("#user-" + username).remove();
// update modal-content with success message
$(modalPopupContent).html($('#remove-user-success-content').html());
$("a#remove-user-success-link").click(function () {
hidePopup();
});
}
},
function () {
$(modalPopupContent).html($('#remove-user-error-content').html());
$("a#remove-user-error-link").click(function () {
hidePopup();
});
}
);
});
$("a#remove-user-cancel-link").click(function () {
hidePopup();
function getSelectedUsernames() {
var usernameList = [];
var userList = $("#user-grid").find("tr.DTTT_selected");
userList.each(function () {
usernameList.push($(this).data('username'));
});
return usernameList;
}
/**
@ -165,15 +127,13 @@ function removeUser(uname) {
* when a user clicks on "Reset Password" link
* on User Listing page in WSO2 MDM Console.
*/
function resetPassword(uname) {
function resetPassword(username) {
$(modalPopupContent).html($('#reset-password-window').html());
showPopup();
$("a#reset-password-yes-link").click(function () {
var newPassword = $("#new-password").val();
var confirmedPassword = $("#confirmed-password").val();
var user = uname;
var errorMsgWrapper = "#notification-error-msg";
var errorMsg = "#notification-error-msg span";
@ -191,10 +151,9 @@ function resetPassword(uname) {
$(errorMsgWrapper).removeClass("hidden");
} else {
var resetPasswordFormData = {};
//resetPasswordFormData.username = user;
resetPasswordFormData.newPassword = unescape(confirmedPassword);
var resetPasswordServiceURL = apiBasePath + "/admin/users/"+ user +"/credentials";
var resetPasswordServiceURL = apiBasePath + "/admin/users/"+ username +"/credentials";
invokerUtil.post(
resetPasswordServiceURL,
@ -223,6 +182,43 @@ function resetPassword(uname) {
});
}
/**
* Following click function would execute
* when a user clicks on "Remove" link
* on User Listing page in WSO2 MDM Console.
*/
function removeUser(username) {
var removeUserAPI = apiBasePath + "/users/" + username;
$(modalPopupContent).html($('#remove-user-modal-content').html());
showPopup();
$("a#remove-user-yes-link").click(function () {
invokerUtil.delete(
removeUserAPI,
function (data, textStatus, jqXHR) {
if (jqXHR.status == 200) {
$("#user-" + username).remove();
// update modal-content with success message
$(modalPopupContent).html($('#remove-user-success-content').html());
$("a#remove-user-success-link").click(function () {
hidePopup();
});
}
},
function () {
$(modalPopupContent).html($('#remove-user-error-content').html());
$("a#remove-user-error-link").click(function () {
hidePopup();
});
}
);
});
$("a#remove-user-cancel-link").click(function () {
hidePopup();
});
}
/**
* Following function would execute
* when a user clicks on the list item

@ -77,10 +77,10 @@
<th>By Username</th>
</tr>
<tr class="bulk-action-row">
<th colspan="5">
<th colspan="3">
<ul class="tiles">
<li class="square">
<a href="#" data-click-event="remove-form" class="btn square-element invite-user-link"
<a id="invite-user-link" href="#" data-click-event="remove-form" class="btn square-element"
data-toggle="modal" data-target="#modalDemo">
<span class="icon fw-stack">
<i class="fw fw-invitation fw-stack-2x"></i>
@ -92,8 +92,7 @@
</th>
</tr>
</thead>
<tbody id="ast-container">
</tbody>
<tbody id="ast-container"></tbody>
</table>
</div>

Loading…
Cancel
Save