diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js index 571d8085ad..820b183646 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js @@ -87,21 +87,21 @@ $(document).ready(function () { /* for device list sorting drop down */ $(".ctrl-filter-type-switcher").popover({ - html : true, - content : function () { - return $("#content-filter-types").html(); - } - }); + html: true, + content: function () { + return $("#content-filter-types").html(); + } + }); - $(".ast-container").on("click", ".claim-btn", function(e){ + $(".ast-container").on("click", ".claim-btn", function (e) { e.stopPropagation(); var deviceId = $(this).data("deviceid"); var serviceURL = "/temp-controller-agent/enrollment/claim?username=" + currentUser; var deviceIdentifier = {id: deviceId, type: "TemperatureController"}; - invokerUtil.put(serviceURL, deviceIdentifier, function(message){ + invokerUtil.put(serviceURL, deviceIdentifier, function (message) { console.log(message); - }, function(message){ - console.log(message.content); + }, function (message) { + console.log(message.content); }); }); }); @@ -166,15 +166,15 @@ function toTitleCase(str) { }); } -function loadDevices(searchType, searchParam){ +function loadDevices(searchType, searchParam) { var serviceURL; if (groupName && groupOwner && $.hasPermission("LIST_OWN_DEVICES")) { - serviceURL = "/devicemgt_admin/groups/owner/" + groupOwner + "/name/" + groupName + "/devices"; + serviceURL = "/api/device-mgt/v1.0/groups/owner/" + groupOwner + "/name/" + groupName + "/devices"; } else if ($.hasPermission("LIST_DEVICES")) { - serviceURL = "/devicemgt_admin/devices"; + serviceURL = "/api/device-mgt/v1.0/devices"; } else if ($.hasPermission("LIST_OWN_DEVICES")) { //Get authenticated users devices - serviceURL = "/devicemgt_admin/users/devices?username=" + currentUser; + serviceURL = "/api/device-mgt/v1.0/users/devices?username=" + currentUser; } else { $("#loading-content").remove(); $('#device-table').addClass('hidden'); @@ -197,10 +197,10 @@ function loadDevices(searchType, searchParam){ return {}; } - function getDeviceTypeLabel(type){ + function getDeviceTypeLabel(type) { var deviceTypes = deviceListing.data("deviceTypes"); - for (var i = 0; i < deviceTypes.length; i++){ - if (deviceTypes[i].type == type){ + for (var i = 0; i < deviceTypes.length; i++) { + if (deviceTypes[i].type == type) { return deviceTypes[i].label; } } @@ -227,29 +227,21 @@ function loadDevices(searchType, searchParam){ return type; } - $('#device-grid').datatables_extended ({ - serverSide: true, - processing: false, - searching: true, - ordering: false, - filter: false, - pageLength : 16, - ajax: { url : '/devicemgt/api/devices', data : {url : serviceURL}, - dataSrc: function ( json ) { - $('#device-grid').removeClass('hidden'); - $("#loading-content").remove(); - var $list = $("#device-table :input[type='search']"); - $list.each(function(){ - $(this).addClass("hidden"); - }); - return json.data; - } + var columns = [ + { + targets: 0, + data: 'name', + class: 'remove-padding icon-only content-fill', + render: function (data, type, row, meta) { + return '
'; + } }, - columnDefs: [ - { targets: 0, data: 'name', className: 'remove-padding icon-only content-fill' , render: function ( data, type, row, meta ) { - return ''; - }}, - { targets: 1, data: 'name', className: 'fade-edge' , render: function ( name, type, row, meta ) { + { + targets: 1, + data: 'name', + class: 'fade-edge', + render: function (name, type, row, meta) { var model = getPropertyValue(row.properties, 'DEVICE_MODEL'); var vendor = getPropertyValue(row.properties, 'VENDOR'); var html = '