@ -16,6 +16,18 @@
* under the License .
* under the License .
* /
* /
/ * *
* Checks if provided input is valid against RegEx input .
*
* @ param regExp Regular expression
* @ param inputString Input string to check
* @ returns { boolean } Returns true if input matches RegEx
* /
function inputIsValid ( regExp , inputString ) {
regExp = new RegExp ( regExp ) ;
return regExp . test ( inputString ) ;
}
$ ( function ( ) {
$ ( function ( ) {
var sortableElem = '.wr-sortable' ;
var sortableElem = '.wr-sortable' ;
$ ( sortableElem ) . sortable ( {
$ ( sortableElem ) . sortable ( {
@ -116,9 +128,8 @@ $("a.invite-user-link").click(function () {
* when a user clicks on "Remove" link
* when a user clicks on "Remove" link
* on User Listing page in WSO2 MDM Console .
* on User Listing page in WSO2 MDM Console .
* /
* /
function removeUser ( uname , uid ) {
function removeUser ( uname ) {
var username = uname ;
var username = uname ;
var userid = uid ;
var removeUserAPI = apiBasePath + "/users/" + username ;
var removeUserAPI = apiBasePath + "/users/" + username ;
$ ( modalPopupContent ) . html ( $ ( '#remove-user-modal-content' ) . html ( ) ) ;
$ ( modalPopupContent ) . html ( $ ( '#remove-user-modal-content' ) . html ( ) ) ;
showPopup ( ) ;
showPopup ( ) ;
@ -127,7 +138,7 @@ function removeUser(uname, uid) {
invokerUtil . delete (
invokerUtil . delete (
removeUserAPI ,
removeUserAPI ,
function ( ) {
function ( ) {
$ ( "# " + userid ) . remove ( ) ;
$ ( "# role-" + username ) . remove ( ) ;
// get new user-list-count
// get new user-list-count
var newUserListCount = $ ( ".user-list > span" ) . length ;
var newUserListCount = $ ( ".user-list > span" ) . length ;
// update user-listing-status-msg with new user-count
// update user-listing-status-msg with new user-count
@ -264,12 +275,12 @@ function loadUsers(searchParam) {
} ;
} ;
return JSON . stringify ( json ) ;
return JSON . stringify ( json ) ;
} ;
}
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" ] ) ;
} ;
}
var columns = [
var columns = [
{
{
@ -302,19 +313,19 @@ 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 s /edit-user ?username=' + data . username + '" data-username="' + data . username +
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" class="btn padding-reduce-on-grid-view edit-user-link"> ' +
'<span class="fw-stack"> <i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-edit fw-stack-1x"></i>' +
'<span class="fw-stack"> <i class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-edit fw-stack-1x"></i>' +
' </span> <span class="hidden-xs hidden-on-grid-view">Edit</span> </a>' +
' </span> <span class="hidden-xs hidden-on-grid-view">Edit</span> </a>' +
'<a href="#" data-username="' + data . username + '" data-userid=' + data . username +
'<a href="#" data-username="' + data . filter + '" data-userid=' + data . filter +
' data-click-event="remove-form" onclick="javascript:removeUser(\'' + data . username + '\', \' ' +
' data-click-event="remove-form" onclick="javascript:removeUser(\'' + data . filter + '\')" ' +
data . username + ' \')" 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 class="fw fw-ring fw-stack-2x"></i> <i class="fw fw-delete fw-stack-1x">' +
'</i> </span> <span class="hidden-xs hidden-on-grid-view">Remove</span> </a>' +
'</i> </span> <span class="hidden-xs hidden-on-grid-view">Remove</span> </a>' +
'<a href="#" data-username="' + data . username + '" data-userid="' + data . username +
'<a href="#" data-username="' + data . filter + '" data-userid="' + data . filter +
'" data-click-event="edit-form" onclick="javascript:resetPassword(\'' + data . username +
'" 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">' +
'\')" 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 class="fw-stack fw-move-right fw-move-bottom"> <i class="fw fw-circle fw-stack-2x fw-stroke fw-inverse"><' +
'</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"><' +
'/i> <i class="fw fw-circle fw-stack-2x"></i> <i class="fw fw-refresh fw-stack-1x fw-inverse">' +
'/i> <i class="fw fw-circle fw-stack-2x"></i> <i class="fw fw-refresh fw-stack-1x fw-inverse">' +