Fix for EMM-1185 , EMM- 1619

revert-70aa11f8
kamidu 8 years ago
parent 9687d554a6
commit 3223e29df9

@ -226,13 +226,14 @@ deviceModule = function () {
publicMethods.getDevices = function (userName) { publicMethods.getDevices = function (userName) {
var url = devicemgtProps["httpsURL"] + var url = devicemgtProps["httpsURL"] +
devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/devices/user/" + userName; devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/devices";
return serviceInvokers.XMLHttp.get( return serviceInvokers.XMLHttp.get(
url, function (responsePayload) { url, function (responsePayload) {
for (var i = 0; i < responsePayload.length; i++) { var devices = JSON.parse(responsePayload.responseText).devices;
responsePayload[i].thumb = utility.getDeviceThumb(responsePayload[i].type); for (var i = 0; i < devices.length; i++) {
devices[i].thumb = utility.getDeviceThumb(devices[i].type);
} }
return responsePayload; return devices;
}, },
function (responsePayload) { function (responsePayload) {
log.error(responsePayload); log.error(responsePayload);

@ -20,7 +20,10 @@
var sortUpdateBtn = "#sortUpdateBtn"; var sortUpdateBtn = "#sortUpdateBtn";
var sortedIDs; var sortedIDs;
var dataTableSelection = '.DTTT_selected'; var dataTableSelection = '.DTTT_selected';
$('#policy-grid').datatables_extended(); var settings = {
"sorting": false
};
$('#policy-grid').datatables_extended(settings);
$(".icon .text").res_text(0.2); $(".icon .text").res_text(0.2);
var saveNewPrioritiesButton = "#save-new-priorities-button"; var saveNewPrioritiesButton = "#save-new-priorities-button";

@ -184,8 +184,11 @@ function loadRoles() {
"placeholder": "Search By Role Name", "placeholder": "Search By Role Name",
"searchKey": "filter" "searchKey": "filter"
}; };
var settings = {
"sorting": false
};
$('#role-grid').datatables_extended_serverside_paging(null, '/api/device-mgt/v1.0/roles', dataFilter, columns, fnCreatedRow, null, options); $('#role-grid').datatables_extended_serverside_paging(settings, '/api/device-mgt/v1.0/roles', dataFilter, columns, fnCreatedRow, null, options);
loadingContent.hide(); loadingContent.hide();
} }

@ -276,7 +276,8 @@ function loadUsers() {
firstname: data.users[index].firstname ? data.users[index].firstname : "", firstname: data.users[index].firstname ? data.users[index].firstname : "",
lastname: data.users[index].lastname ? data.users[index].lastname : "", lastname: data.users[index].lastname ? data.users[index].lastname : "",
emailAddress: data.users[index].emailAddress ? data.users[index].emailAddress : "", emailAddress: data.users[index].emailAddress ? data.users[index].emailAddress : "",
DT_RowId : "user-" + data.users[index].username}) DT_RowId: "user-" + data.users[index].username
})
}); });
var json = { var json = {
@ -398,7 +399,11 @@ function loadUsers() {
"searchKey": "filter" "searchKey": "filter"
}; };
$('#user-grid').datatables_extended_serverside_paging(null, '/api/device-mgt/v1.0/users', dataFilter, columns, fnCreatedRow, null, options); var settings = {
"sorting": false
};
$('#user-grid').datatables_extended_serverside_paging(settings, '/api/device-mgt/v1.0/users', dataFilter, columns, fnCreatedRow, null, options);
$(loadingContentView).hide(); $(loadingContentView).hide();
} }

@ -37,6 +37,7 @@ $.fn.datatables_extended_serverside_paging = function (settings , url, dataFilte
if (InitiateViewOption) { if (InitiateViewOption) {
$(document).on('click', '.viewEnabledIcon', InitiateViewOption); $(document).on('click', '.viewEnabledIcon', InitiateViewOption);
} }
//--- End of EMM related codes
/* /*
* Work around for accessing settings params inside datatable functions * Work around for accessing settings params inside datatable functions
@ -193,24 +194,42 @@ $.fn.datatables_extended_serverside_paging = function (settings , url, dataFilte
/** /**
* create sorting dropdown menu for list table advance operations * create sorting dropdown menu for list table advance operations
*/ */
var table = this;
if (table.hasClass('sorting-enabled')) {
var dropdownmenu = $('<ul class="dropdown-menu arrow arrow-top-right dark sort-list add-margin-top-2x"><li class="dropdown-header">Sort by</li></ul>'); var dropdownmenu = $('<ul class="dropdown-menu arrow arrow-top-right dark sort-list add-margin-top-2x"><li class="dropdown-header">Sort by</li></ul>');
$('.sort-row th', elem).each(function () { $('.sort-row th', elem).each(function () {
if (!$(this).hasClass('no-sort')) { if (!$(this).hasClass('no-sort')) {
dropdownmenu.append('<li><a href="#' + $(this).html() + '" data-column="' + $(this).index() + '">' + $(this).html() + '</a></li>'); dropdownmenu.append('<li><a href="#' + $(this).html() + '" data-column="' + $(this).index() + '">' + $(this).html() + '</a></li>');
} }
}); });
}
/** function getAdvanceToolBar() {
* append advance operations to list table toolbar if (table.hasClass('sorting-enabled')) {
*/ return '<ul class="nav nav-pills navbar-right remove-margin" role="tablist">' +
$('.dataTable.list-table').closest('.dataTables_wrapper').find('.dataTablesTop .dataTables_toolbar').html('' +
'<ul class="nav nav-pills navbar-right remove-margin" role="tablist">' +
'<li><button data-click-event="toggle-selectable" class="btn btn-default btn-primary select-enable-btn">Select</li>' + '<li><button data-click-event="toggle-selectable" class="btn btn-default btn-primary select-enable-btn">Select</li>' +
'<li><button data-click-event="toggle-selected" id="dt-select-all" class="btn btn-default btn-primary disabled">Select All</li>' + '<li><button data-click-event="toggle-selected" id="dt-select-all" class="btn btn-default btn-primary disabled">Select All</li>' +
'<li><button data-click-event="toggle-list-view" data-view="grid" class="btn btn-default"><i class="fw fw-grid"></i></button></li>' + '<li><button data-click-event="toggle-list-view" data-view="grid" class="btn btn-default"><i class="fw fw-grid"></i></button></li>' +
'<li><button data-click-event="toggle-list-view" data-view="list" class="btn btn-default"><i class="fw fw-list"></i></button></li>' + '<li><button data-click-event="toggle-list-view" data-view="list" class="btn btn-default"><i class="fw fw-list"></i></button></li>' +
'<li><button class="btn btn-default" data-toggle="dropdown"><i class="fw fw-sort"></i></button>' + dropdownmenu[0].outerHTML + '</li>' + '<li><button class="btn btn-default" data-toggle="dropdown"><i class="fw fw-sort"></i></button>' + dropdownmenu[0].outerHTML + '</li>' +
'</ul>' '</ul>'
} else {
return '<ul class="nav nav-pills navbar-right remove-margin" role="tablist">' +
'<li><button data-click-event="toggle-selectable" class="btn btn-default btn-primary select-enable-btn">Select</li>' +
'<li><button data-click-event="toggle-selected" id="dt-select-all" class="btn btn-default btn-primary disabled">Select All</li>' +
'<li><button data-click-event="toggle-list-view" data-view="grid" class="btn btn-default"><i class="fw fw-grid"></i></button></li>' +
'<li><button data-click-event="toggle-list-view" data-view="list" class="btn btn-default"><i class="fw fw-list"></i></button></li>' +
'</ul>'
}
;
}
/**
* append advance operations to list table toolbar
*/
$('.dataTable.list-table').closest('.dataTables_wrapper').find('.dataTablesTop .dataTables_toolbar').html(
getAdvanceToolBar()
); );
/** /**

@ -47,8 +47,11 @@ function loadNotifications() {
viewModel["appContext"] = context; viewModel["appContext"] = context;
var content = template(viewModel); var content = template(viewModel);
$("#ast-container").html(content); $("#ast-container").html(content);
$("#unread-notifications").datatables_extended(); var settings = {
$("#all-notifications").datatables_extended(); "sorting" : false
};
$("#unread-notifications").datatables_extended(settings);
$("#all-notifications").datatables_extended(settings);
} }
} }
}, },

Loading…
Cancel
Save