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 d594af0766..d74cce8f99 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 @@ -70,7 +70,7 @@ $(document).ready(function () { deviceListing = $("#device-listing"); currentUser = deviceListing.data("current-user"); - + groupId = getParameterByName("groupId"); /* Adding selected class for selected devices */ @@ -80,11 +80,11 @@ $(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(); + } + }); }); /* @@ -247,7 +247,7 @@ function loadDevices(searchType, searchParam) { class: 'remove-padding icon-only content-fill viewEnabledIcon', render: function (data, type, row, meta) { return '
'; + + getDeviceTypeThumb(row.deviceType) + '"/>'; } }, { @@ -325,47 +325,47 @@ function loadDevices(searchType, searchParam) { if (analyticsEnabled(row.deviceType)) { html += '' + - '' + - ''; + deviceIdentifier + '&deviceName=' + row.name + '" ' + 'data-click-event="remove-form"' + + ' class="btn padding-reduce-on-grid-view" data-placement="top" data-toggle="tooltip" data-original-title="Analytics">' + + '' + + ''; } if (!groupId && groupingEnabled(row.deviceType)) { html += - '' + - '' + - ''; + '' + + '' + + ''; } -// html += -// '' -// + '' -// + '' -// + ''; + html += + '' + + '' + + '' + + ''; var groupOwner = $('#group_owner').text(); if (groupId && groupOwner != "wso2.system.user") { html += - '' - + '' - + '' - + ''; + '' + + '' + + '' + + ''; } else { html += - '' - + '' - + '' - + ''; + '' + + '' + + '' + + ''; } } return html; @@ -417,7 +417,7 @@ function loadDevices(searchType, searchParam) { }); }; - function htmlspecialchars(text){ + function htmlspecialchars(text) { return jQuery('
').text(text).html(); } @@ -427,16 +427,16 @@ function loadDevices(searchType, searchParam) { $(data.devices).each(function (index) { objects.push( - { - model: getPropertyValue(data.devices[index].properties, "DEVICE_MODEL"), - vendor: getPropertyValue(data.devices[index].properties, "VENDOR"), - user: data.devices[index].enrolmentInfo.owner, - status: data.devices[index].enrolmentInfo.status, - ownership: data.devices[index].enrolmentInfo.ownership, - deviceType: data.devices[index].type, - deviceIdentifier: data.devices[index].deviceIdentifier, - name: data.devices[index].name - } + { + model: getPropertyValue(data.devices[index].properties, "DEVICE_MODEL"), + vendor: getPropertyValue(data.devices[index].properties, "VENDOR"), + user: data.devices[index].enrolmentInfo.owner, + status: data.devices[index].enrolmentInfo.status, + ownership: data.devices[index].enrolmentInfo.ownership, + deviceType: data.devices[index].type, + deviceIdentifier: data.devices[index].deviceIdentifier, + name: data.devices[index].name + } ); }); @@ -449,28 +449,28 @@ function loadDevices(searchType, searchParam) { }; $('#device-grid').datatables_extended_serverside_paging( - null, - serviceURL, - dataFilter, - columns, - fnCreatedRow, - function () { - $(".icon .text").res_text(0.2); - $('#device-grid').removeClass('hidden'); - $("#loading-content").remove(); - attachDeviceEvents(); - - - if($('.advance-search').length < 1){ - $(this).closest('.dataTables_wrapper').find('div[id$=_filter] input') - .after('Advance Search'); - } - - }, { - "placeholder": "Search By Device Name", - "searchKey": "name" + null, + serviceURL, + dataFilter, + columns, + fnCreatedRow, + function () { + $(".icon .text").res_text(0.2); + $('#device-grid').removeClass('hidden'); + $("#loading-content").remove(); + attachDeviceEvents(); + + + if ($('.advance-search').length < 1) { + $(this).closest('.dataTables_wrapper').find('div[id$=_filter] input') + .after('Advance Search'); } + + }, { + "placeholder": "Search By Device Name", + "searchKey": "name" + } ); $(deviceCheckbox).click(function () { @@ -507,11 +507,11 @@ $(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(); + } + }); /* for data tables*/ $('[data-toggle="tooltip"]').tooltip(); @@ -519,17 +519,17 @@ $(document).ready(function () { $("[data-toggle=popover]").popover(); $(".ctrl-filter-type-switcher").popover({ - html: true, - content: function () { - return $('#content-filter-types').html(); - } - }); + html: true, + content: function () { + return $('#content-filter-types').html(); + } + }); $('#nav').affix({ - offset: { - top: $('header').height() - } - }); + offset: { + top: $('header').height() + } + }); }); @@ -583,9 +583,9 @@ function markAlreadyAssignedGroups(deviceId, deviceType) { }; invokerUtil.get("/api/device-mgt/v1.0/groups/device?deviceId=" + deviceId + "&deviceType=" + deviceType, - successCallback, function (message) { - displayErrors(message); - }); + successCallback, function (message) { + displayErrors(message); + }); } /** @@ -604,7 +604,7 @@ function attachDeviceEvents() { var deviceType = $(this).data("devicetype"); $(modalPopupContent).html($('#group-device-modal-content').html()); $('#user-groups').html( - '
'); + '
'); $("a#group-device-update-link").hide(); showPopup(); @@ -629,9 +629,9 @@ function attachDeviceEvents() { } if (hasGroups) { html = '

Please select device group(s)


' + - '
' + - '
'; + '
' + + '
'; markAlreadyAssignedGroups(deviceId, deviceType); $("a#group-device-update-link").show(); $("a#group-add-link").hide(); @@ -642,8 +642,8 @@ function attachDeviceEvents() { } $('#user-groups').html(html); $("select.select2[multiple=multiple]").select2({ - tags: false - }); + tags: false + }); $("a#group-device-update-link").click(function () { var deviceIdentifier = {"id": deviceId, "type": deviceType}; var deviceGroupIds = $("#groups").val(); @@ -787,7 +787,7 @@ function attachDeviceEvents() { $(modalPopupContent).html($('#group-device-modal-content').html()); $('#user-groups').html( - '
'); + '
'); $("a#group-device-add-link").hide(); showPopup(); @@ -806,13 +806,13 @@ function attachDeviceEvents() { for (var i = 0; i < groups.deviceGroups.length; i++) { if (groups.deviceGroups[i].owner != "wso2.system.user") { html += ''; + groups.deviceGroups[i].name + ''; hasGroups = true; } } if (hasGroups) { html = '
'; + html + ''; $("a#group-add-link").hide(); $("a#group-device-add-link").show(); } else { @@ -898,7 +898,7 @@ function displayDeviceErrors(jqXHR) { function getParameterByName(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), - results = regex.exec(location.search); + results = regex.exec(location.search); return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); } @@ -911,10 +911,10 @@ function getSelectedDevices() { thisTable.api().rows().every(function () { if ($(this.node()).hasClass('DTTT_selected')) { deviceList.push( - { - "id": $(thisTable.api().row(this).node()).data('deviceid'), - "type": $(thisTable.api().row(this).node()).data('devicetype') - } + { + "id": $(thisTable.api().row(this).node()).data('deviceid'), + "type": $(thisTable.api().row(this).node()).data('devicetype') + } ); } });