diff --git a/jams-server/src/main/java/net/jami/jams/server/servlets/api/auth/device/DevicesServlet.java b/jams-server/src/main/java/net/jami/jams/server/servlets/api/auth/device/DevicesServlet.java index 46bbbc7de38e66596b6bb75ad0a66c84d227b64a..56e535032591eeb752024cfc7a8c7519be879360 100644 --- a/jams-server/src/main/java/net/jami/jams/server/servlets/api/auth/device/DevicesServlet.java +++ b/jams-server/src/main/java/net/jami/jams/server/servlets/api/auth/device/DevicesServlet.java @@ -73,6 +73,7 @@ public class DevicesServlet extends HttpServlet { devices.forEach(device -> device.setRevoked(false)); } resp.getOutputStream().write(JsonStream.serialize(devices).getBytes()); + resp.setStatus(200); } diff --git a/jams-server/src/main/resources/webapp/js/api.js b/jams-server/src/main/resources/webapp/js/api.js index 7bb5d697ed8783c637e2debbcf22e0374ef827e8..e478fa83e21b01f374ae7881693ccdd999bbf4e4 100644 --- a/jams-server/src/main/resources/webapp/js/api.js +++ b/jams-server/src/main/resources/webapp/js/api.js @@ -83,7 +83,8 @@ function ajaxApiCall(api_path, request_type, data, credentials, callBackFunction // pass data in the header if (data) { if (api_path == api_path_get_user_directory_search || api_path == api_path_get_auth_user_search || - (api_path == api_path_post_create_user && request_type == 'POST') || api_path == api_path_post_update_user) + (api_path == api_path_post_create_user && request_type == 'POST') || api_path == api_path_post_update_user + || api_path == api_path_get_auth_devices) isSearch = true; // search dataType diff --git a/jams-server/src/main/resources/webapp/js/user.js b/jams-server/src/main/resources/webapp/js/user.js index dfea830a73332e4b808a5d679392c5c2c3812bbe..069391f6812584bd76a11093b3f99e8be24b5551 100644 --- a/jams-server/src/main/resources/webapp/js/user.js +++ b/jams-server/src/main/resources/webapp/js/user.js @@ -296,16 +296,17 @@ function setUserExtendedData(data, statusCode, jqXHR) { } } -function setUserDevices(data, statusCode, jqXHR) { - if (jqXHR.status == 200) { - var resultSet = data; +function setUserDevices(data) { + if (data.status == 200) { + var resultSet = data.responseText; + resultSet = resultSet.replace(/\s+/g, ' ').trim(); + resultSet = JSON.parse(resultSet); var deviceRow = ''; // build table row for User device items if (resultSet.length > 0) { for (i = 0; i < resultSet.length; i++) { var status = ''; var disabled = ''; - var date = resultSet[i].activationDate; // determine User status if (!(resultSet[i].revoked)) { status = 'Active'; @@ -316,8 +317,7 @@ function setUserDevices(data, statusCode, jqXHR) { } deviceRow += '<tr data-device-id="' + resultSet[i].deviceId + '"><td class="mobile">Device ID</td><td>' + resultSet[i].deviceId + - '</td><td class="mobile">Device Name</td><td class="device-name">' + resultSet[i].deviceName + - '</td><td class="mobile">Creation Date</td><td>' + date + + '</td><td class="mobile">Device Name</td><td class="device-name">' + resultSet[i].displayName + '</td><td class="mobile">Status</td><td id="device-status" data-device-id="' + resultSet[i].deviceId + '">' + status + '</td><td class="mobile">Actions</td><td><button class="edit-device-name" data-device-id="' + resultSet[i].deviceId + '"><i class="fa fa-edit"></i></button>' + '<button class="btn-danger de-activate-device" data-device-id="' + resultSet[i].deviceId + '"' + disabled + '><i class="fa fa-trash"></i></button>' + @@ -399,7 +399,7 @@ function handleUserUpdate(){ setTimeout(function() { ajaxApiCall(api_path_get_user_directory_search, 'GET', searchData, null, setUserInfoDataSource); ajaxApiCall(api_path_get_user_directory_search, 'GET', searchData, null, setUserExtendedData); - }, 700); + }, 1000); } function handleFileSelect(evt) { diff --git a/jams-server/src/main/resources/webapp/templates/devices.html b/jams-server/src/main/resources/webapp/templates/devices.html index 12a03f70896074b0a1757ada50560255e07c911b..732cabe2b8ad2b78082f52a31cec38395d7f4905 100644 --- a/jams-server/src/main/resources/webapp/templates/devices.html +++ b/jams-server/src/main/resources/webapp/templates/devices.html @@ -74,7 +74,6 @@ <tr> <th>Device ID</th> <th>Device Name</th> - <th>Creation Date</th> <th>Status</th> <th>Actions</th> </tr> diff --git a/jams-server/src/main/resources/webapp/templates/user.html b/jams-server/src/main/resources/webapp/templates/user.html index 020738151c04a9b123370d597ba061053cffe894..5b16dce15a8f5d7f459e5b8777ad009e943f88ca 100644 --- a/jams-server/src/main/resources/webapp/templates/user.html +++ b/jams-server/src/main/resources/webapp/templates/user.html @@ -66,7 +66,6 @@ <tr> <th>Device ID</th> <th>Device Name</th> - <th>Creation Date</th> <th>Status</th> <th>Actions</th> </tr>