enable role filtering in device cloud

revert-70aa11f8
kamidu 8 years ago
parent 73ab0a38bf
commit 1f572998f8

@ -102,38 +102,19 @@ function loadRoles() {
var objects = []; var objects = [];
var count = 0; var count = 0;
$(data.roles).each(function (index) { $(data.roles).each(function (index) {
if (isCloud && data.roles[index].startsWith("devicemgt")) { objects.push(
count++; {
objects.push( name: htmlspecialchars(data.roles[index]),
{ DT_RowId: "role-" + htmlspecialchars(data.roles[index])
name: htmlspecialchars(data.roles[index]), }
DT_RowId: "role-" + htmlspecialchars(data.roles[index]) )
}
)
} else if (!isCloud) {
objects.push(
{
name: htmlspecialchars(data.roles[index]),
DT_RowId: "role-" + htmlspecialchars(data.roles[index])
}
)
}
}); });
var json = {}; var json = {
if (isCloud) { "recordsTotal": data.count,
json = { "recordsFiltered": data.count,
"recordsTotal": count, "data": objects
"recordsFiltered": count, };
"data": objects
};
} else {
json = {
"recordsTotal": data.count,
"recordsFiltered": data.count,
"data": objects
};
}
return JSON.stringify(json); return JSON.stringify(json);
}; };
@ -225,8 +206,12 @@ function loadRoles() {
var settings = { var settings = {
"sorting": false "sorting": false
}; };
var roleApiUrl = '/api/device-mgt/v1.0/roles?user-store=all';
if (isCloud) {
roleApiUrl = '/api/device-mgt/v1.0/roles/filter/devicemgt?user-store=all';
}
$('#role-grid').datatables_extended_serverside_paging(settings, '/api/device-mgt/v1.0/roles?user-store=all', dataFilter, columns, fnCreatedRow, null, options); $('#role-grid').datatables_extended_serverside_paging(settings, roleApiUrl, dataFilter, columns, fnCreatedRow, null, options);
loadingContent.hide(); loadingContent.hide();
} }

Loading…
Cancel
Save