Fix meta alert datatable order

This commit is contained in:
Calvo 2022-09-19 14:02:50 +02:00
parent c177ee2e2e
commit bc5f1d0dce
3 changed files with 6 additions and 6 deletions

View File

@ -900,13 +900,13 @@ if ($get_agent_alerts_datatable === true) {
return function ($a, $b) use ($sort, $sortField) { return function ($a, $b) use ($sort, $sortField) {
if ($sort === 'asc') { if ($sort === 'asc') {
if (is_string($a[$sortField]) === true) { if (is_string($a[$sortField]) === true) {
return strcmp($a[$sortField], $b[$sortField]); return strnatcasecmp($a[$sortField], $b[$sortField]);
} else { } else {
return ($a[$sortField] - $b[$sortField]); return ($a[$sortField] - $b[$sortField]);
} }
} else { } else {
if (is_string($a[$sortField]) === true) { if (is_string($a[$sortField]) === true) {
return strcmp($b[$sortField], $a[$sortField]); return strnatcasecmp($b[$sortField], $a[$sortField]);
} else { } else {
return ($a[$sortField] + $b[$sortField]); return ($a[$sortField] + $b[$sortField]);
} }
@ -916,7 +916,7 @@ if ($get_agent_alerts_datatable === true) {
usort($alerts['alerts_simple'], arrayOutputSorting($sort, $sortField)); usort($alerts['alerts_simple'], arrayOutputSorting($sort, $sortField));
$data = array_slice($alerts['alerts_simple'], $start, $length); $alerts['alerts_simple'] = array_slice($alerts['alerts_simple'], $start, $length);
} }
$data = []; $data = [];

View File

@ -1075,7 +1075,7 @@ function ui_format_alert_row(
} }
} }
if (is_metaconsole() === true) { if (is_metaconsole() === true && (int) $server_id !== 0) {
$server = db_get_row('tmetaconsole_setup', 'id', $alert['server_data']['id']); $server = db_get_row('tmetaconsole_setup', 'id', $alert['server_data']['id']);
if (metaconsole_connect($server) == NOERR) { if (metaconsole_connect($server) == NOERR) {

View File

@ -359,7 +359,7 @@ if ($free_search != '') {
], ],
'drawCallback' => 'alerts_table_controls()', 'drawCallback' => 'alerts_table_controls()',
'order' => [ 'order' => [
'field' => 'module_name', 'field' => 'agent_module_name',
'direction' => 'asc', 'direction' => 'asc',
], ],
'zeroRecords' => __('No alerts found'), 'zeroRecords' => __('No alerts found'),
@ -400,7 +400,7 @@ if ($free_search != '') {
], ],
'drawCallback' => 'alerts_table_controls()', 'drawCallback' => 'alerts_table_controls()',
'order' => [ 'order' => [
'field' => 'module', 'field' => 'agent_module_name',
'direction' => 'asc', 'direction' => 'asc',
], ],
'zeroRecords' => __('No alerts found'), 'zeroRecords' => __('No alerts found'),