From 99aca9b90afb74a96105c95a1fdb2134ddb91e73 Mon Sep 17 00:00:00 2001 From: dilanua Date: Sat, 23 Jul 2016 20:23:21 +0530 Subject: [PATCH] Updating user-listing --- .../cdmf.page.users/public/js/listing.js | 43 +++++++++++-------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js index bd965f798e..b2db97ca66 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js @@ -108,7 +108,7 @@ $("a.invite-user-link").click(function () { invokerUtil.post( inviteUserAPI, usernameList, - // The success callback + // success callback function (data, textStatus, jqXHR) { if (jqXHR.status == 200) { $(modalPopupContent).html($('#invite-user-success-content').html()); @@ -117,7 +117,7 @@ $("a.invite-user-link").click(function () { }); } }, - // The error callback + // error callback function (jqXHR) { console.log("error in invite-user API, status code: " + jqXHR.status); $(modalPopupContent).html($('#invite-user-error-content').html()); @@ -212,7 +212,7 @@ function resetPassword(uname) { invokerUtil.post( resetPasswordServiceURL, resetPasswordFormData, - // The success callback + // success callback function (data, textStatus, jqXHR) { if (jqXHR.status == 200) { $(modalPopupContent).html($('#reset-password-success-content').html()); @@ -221,7 +221,7 @@ function resetPassword(uname) { }); } }, - // The error callback + // error callback function (jqXHR) { console.log("error in reset-password API, status code: " + jqXHR.status); var payload = JSON.parse(jqXHR.responseText); @@ -271,14 +271,19 @@ function loadUsers() { var objects = []; - $(data.users).each(function (index) { - objects.push({ - username: data.users[index].username, - firstname: data.users[index].firstname ? data.users[index].firstname: '' , - lastname: data.users[index].lastname ? data.users[index].lastname : '', - emailAddress : data.users[index].emailAddress ? data.users[index].emailAddress: '', - DT_RowId : "user-" + data.users[index].username}) - }); + $(data.users).each( + function (index) { + objects.push( + { + username: data.users[index].username, + firstname: data.users[index].firstname ? data.users[index].firstname: '' , + lastname: data.users[index].lastname ? data.users[index].lastname : '', + emailAddress : data.users[index].emailAddress ? data.users[index].emailAddress: '', + DT_RowId : "user-" + data.users[index].username + } + ) + } + ); var json = { "recordsTotal": data.count, @@ -349,11 +354,11 @@ function loadUsers() { '' + '' + '' + - '' + - ' ' + - '' + - ' ' + - '' + + '' + + ' ' + + '' + + ' ' + + '' + '' + '' + '' + @@ -374,7 +379,9 @@ function loadUsers() { ]; - $("#user-grid").datatables_extended_serverside_paging(null, '/api/device-mgt/v1.0/users', dataFilter, columns, fnCreatedRow, null); + $("#user-grid").datatables_extended_serverside_paging( + null, '/api/device-mgt/v1.0/users', dataFilter, columns, fnCreatedRow, null + ); $("#loading-content").hide(); }