mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 16:44:39 +00:00
System/Diagnostics/Activity: use bootgrid's api to write rows instead of build the table, closes https://github.com/opnsense/core/issues/4681
This commit is contained in:
parent
9ae1359888
commit
d641c00528
@ -40,23 +40,24 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
selection: true,
|
||||
multiSelect: true,
|
||||
};
|
||||
$("#grid-top").bootgrid('destroy');
|
||||
if ($("#grid-top").hasClass('bootgrid-table')) {
|
||||
$("#grid-top").bootgrid('clear');
|
||||
} else {
|
||||
$("#grid-top").bootgrid(gridopt);
|
||||
}
|
||||
ajaxGet("/api/diagnostics/activity/getActivity", {}, function (data, status) {
|
||||
if (status == "success") {
|
||||
let table = [];
|
||||
$("#grid-top > tbody").html('');
|
||||
$.each(data['details'], function (key, value) {
|
||||
var fields = ["PID", "USERNAME", "PRI", "NICE", "SIZE", "RES", "STATE", "C", "TIME", "WCPU", "COMMAND"];
|
||||
let tr_str = '<tr>';
|
||||
let record = {};
|
||||
for (var i = 0; i < fields.length; i++) {
|
||||
if (value[fields[i]] != null) {
|
||||
tr_str += '<td>' + value[fields[i]] + '</td>';
|
||||
} else {
|
||||
tr_str += '<td></td>';
|
||||
}
|
||||
record[fields[i]] = value[fields[i]] != null ? value[fields[i]] : "";
|
||||
}
|
||||
tr_str += '</tr>';
|
||||
$("#grid-top > tbody").append(tr_str);
|
||||
table.push(record);
|
||||
});
|
||||
$("#grid-top").bootgrid('append', table);
|
||||
var header_txt = "";
|
||||
$.each(data['headers'], function (key, value) {
|
||||
header_txt += value;
|
||||
@ -66,7 +67,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
$('#header_data').fadeOut('slow');
|
||||
$('#header_data_show').fadeIn('slow');
|
||||
}
|
||||
$("#grid-top").bootgrid(gridopt);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user