#10119 Fixed alerts table
This commit is contained in:
parent
f8e3353836
commit
b4d54fb729
|
@ -915,7 +915,6 @@ if ($get_agent_alerts_datatable === true) {
|
|||
$data[] = ui_format_alert_row($alert, true, $url, 'font-size: 7pt;');
|
||||
}
|
||||
|
||||
|
||||
$data = array_reduce(
|
||||
$data,
|
||||
function ($carry, $row) {
|
||||
|
@ -923,17 +922,29 @@ if ($get_agent_alerts_datatable === true) {
|
|||
// of objects, making a post-process of certain fields.
|
||||
$tmp = new stdClass();
|
||||
|
||||
// Standby.
|
||||
$tmp->policy = $row[0];
|
||||
$tmp->standby = $row[1];
|
||||
$tmp->force = $row[2];
|
||||
$tmp->agent_name = $row[3];
|
||||
$tmp->agent_module_name = $row[4];
|
||||
$tmp->template_name = $row[5];
|
||||
$tmp->action = $row[6];
|
||||
$tmp->last_fired = $row[7];
|
||||
$tmp->status = $row[8];
|
||||
$tmp->validate = $row[9];
|
||||
if (enterprise_installed() === true) {
|
||||
$tmp->policy = $row[0];
|
||||
$tmp->standby = $row[1];
|
||||
$tmp->force = $row[2];
|
||||
$tmp->agent_name = $row[3];
|
||||
$tmp->agent_module_name = $row[4];
|
||||
$tmp->template_name = $row[5];
|
||||
$tmp->action = $row[6];
|
||||
$tmp->last_fired = $row[7];
|
||||
$tmp->status = $row[8];
|
||||
$tmp->validate = $row[9];
|
||||
} else {
|
||||
// Open.
|
||||
$tmp->standby = $row[0];
|
||||
$tmp->force = $row[1];
|
||||
$tmp->agent_name = $row[2];
|
||||
$tmp->agent_module_name = $row[3];
|
||||
$tmp->template_name = $row[4];
|
||||
$tmp->action = $row[5];
|
||||
$tmp->last_fired = $row[6];
|
||||
$tmp->status = $row[7];
|
||||
$tmp->validate = $row[8];
|
||||
}
|
||||
|
||||
$carry[] = $tmp;
|
||||
return $carry;
|
||||
|
|
|
@ -227,245 +227,252 @@ if ($free_search != '') {
|
|||
$url .= '&free_search='.$free_search;
|
||||
}
|
||||
|
||||
$columns = ['standby'];
|
||||
$column_names = [
|
||||
[
|
||||
'title' => 'Standby',
|
||||
'text' => 'S.',
|
||||
],
|
||||
];
|
||||
|
||||
|
||||
$columns = ['standby'];
|
||||
if (enterprise_installed() === true) {
|
||||
array_unshift(
|
||||
$column_names,
|
||||
[
|
||||
'title' => 'Policy',
|
||||
'text' => 'P.',
|
||||
]
|
||||
);
|
||||
|
||||
$column_names = [
|
||||
$columns = array_merge(
|
||||
['policy'],
|
||||
$columns
|
||||
);
|
||||
}
|
||||
|
||||
if (is_metaconsole() === false) {
|
||||
if (check_acl($config['id_user'], $id_group, 'LW') || check_acl($config['id_user'], $id_group, 'LM')) {
|
||||
array_unshift(
|
||||
$column_names,
|
||||
[
|
||||
'title' => 'Standby',
|
||||
'text' => 'S.',
|
||||
],
|
||||
];
|
||||
'title' => 'Validate',
|
||||
'text' => html_print_checkbox('all_validate', 0, false, true, false),
|
||||
'class' => 'dt-left',
|
||||
]
|
||||
);
|
||||
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
array_unshift(
|
||||
$column_names,
|
||||
[
|
||||
'title' => 'Policy',
|
||||
'text' => 'P.',
|
||||
]
|
||||
);
|
||||
|
||||
$columns = array_merge(
|
||||
['policy'],
|
||||
$columns
|
||||
);
|
||||
}
|
||||
|
||||
if (is_metaconsole() === false) {
|
||||
if (check_acl($config['id_user'], $id_group, 'LW') || check_acl($config['id_user'], $id_group, 'LM')) {
|
||||
array_unshift(
|
||||
$column_names,
|
||||
[
|
||||
'title' => 'Validate',
|
||||
'text' => html_print_checkbox('all_validate', 0, false, true, false),
|
||||
'class' => 'dt-left',
|
||||
]
|
||||
);
|
||||
|
||||
$columns = array_merge(
|
||||
['validate'],
|
||||
$columns
|
||||
);
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
|
||||
array_push(
|
||||
$column_names,
|
||||
[
|
||||
'title' => 'Force execution',
|
||||
'text' => 'F.',
|
||||
]
|
||||
);
|
||||
|
||||
$columns = array_merge(
|
||||
$columns,
|
||||
['force']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($print_agent === true) {
|
||||
array_push(
|
||||
$column_names,
|
||||
['text' => 'Agent']
|
||||
);
|
||||
|
||||
$columns = array_merge(
|
||||
$columns,
|
||||
['agent_name']
|
||||
);
|
||||
}
|
||||
$columns = array_merge(
|
||||
['validate'],
|
||||
$columns
|
||||
);
|
||||
}
|
||||
|
||||
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
|
||||
array_push(
|
||||
$column_names,
|
||||
['text' => 'Module'],
|
||||
['text' => 'Template'],
|
||||
['text' => 'Action'],
|
||||
['text' => 'Last fired'],
|
||||
['text' => 'Status']
|
||||
[
|
||||
'title' => 'Force execution',
|
||||
'text' => 'F.',
|
||||
]
|
||||
);
|
||||
|
||||
$columns = array_merge(
|
||||
$columns,
|
||||
['agent_module_name'],
|
||||
['template_name'],
|
||||
['action'],
|
||||
['last_fired'],
|
||||
['status']
|
||||
['force']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($print_agent === true) {
|
||||
array_push(
|
||||
$column_names,
|
||||
['text' => 'Agent']
|
||||
);
|
||||
|
||||
$columns = array_merge(
|
||||
$columns,
|
||||
['agent_name']
|
||||
);
|
||||
}
|
||||
|
||||
array_push(
|
||||
$column_names,
|
||||
['text' => 'Module'],
|
||||
['text' => 'Template'],
|
||||
['text' => 'Action'],
|
||||
['text' => 'Last fired'],
|
||||
['text' => 'Status']
|
||||
);
|
||||
|
||||
$columns = array_merge(
|
||||
$columns,
|
||||
['agent_module_name'],
|
||||
['template_name'],
|
||||
['action'],
|
||||
['last_fired'],
|
||||
['status']
|
||||
);
|
||||
|
||||
|
||||
|
||||
if (is_metaconsole() === true) {
|
||||
$no_sortable_columns = [
|
||||
0,
|
||||
1,
|
||||
5,
|
||||
];
|
||||
} else {
|
||||
$no_sortable_columns = [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
7,
|
||||
];
|
||||
}
|
||||
if (is_metaconsole() === true) {
|
||||
$no_sortable_columns = [
|
||||
0,
|
||||
1,
|
||||
5,
|
||||
];
|
||||
} else {
|
||||
if (enterprise_installed() === true) {
|
||||
$no_sortable_columns = [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3,
|
||||
7,
|
||||
];
|
||||
} else {
|
||||
$no_sortable_columns = [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
6,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$alert_action = empty(alerts_get_alert_actions_filter()) === false
|
||||
? alerts_get_alert_actions_filter()
|
||||
: ['' => __('No actions')];
|
||||
$alert_action = empty(alerts_get_alert_actions_filter()) === false
|
||||
? alerts_get_alert_actions_filter()
|
||||
: ['' => __('No actions')];
|
||||
|
||||
|
||||
ob_start();
|
||||
ob_start();
|
||||
|
||||
if ($agent_view_page === true) {
|
||||
ui_print_datatable(
|
||||
[
|
||||
'id' => 'alerts_status_datatable',
|
||||
'class' => 'info_table',
|
||||
'style' => 'width: 100%',
|
||||
'columns' => $columns,
|
||||
'column_names' => $column_names,
|
||||
'no_sortable_columns' => $no_sortable_columns,
|
||||
'ajax_url' => 'include/ajax/alert_list.ajax',
|
||||
'ajax_data' => [
|
||||
'get_agent_alerts_datatable' => 1,
|
||||
'id_agent' => $idAgent,
|
||||
'url' => $url,
|
||||
'agent_view_page' => true,
|
||||
'all_groups' => $all_groups,
|
||||
],
|
||||
'drawCallback' => 'alerts_table_controls()',
|
||||
'order' => [
|
||||
'field' => 'agent_module_name',
|
||||
'direction' => 'asc',
|
||||
],
|
||||
'zeroRecords' => __('No alerts found'),
|
||||
'emptyTable' => __('No alerts found'),
|
||||
'search_button_class' => 'sub filter float-right',
|
||||
'form' => [
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => __('Free text for search (*):').ui_print_help_tip(
|
||||
__('Filter by module name, template name or action name'),
|
||||
true
|
||||
),
|
||||
'type' => 'text',
|
||||
'name' => 'free_search_alert',
|
||||
'value' => $free_search,
|
||||
'size' => 20,
|
||||
'maxlength' => 100,
|
||||
],
|
||||
],
|
||||
'no_toggle' => true,
|
||||
],
|
||||
]
|
||||
);
|
||||
} else {
|
||||
ui_print_datatable(
|
||||
[
|
||||
'id' => 'alerts_status_datatable',
|
||||
'class' => 'info_table',
|
||||
'style' => 'width: 100%',
|
||||
'columns' => $columns,
|
||||
'column_names' => $column_names,
|
||||
'no_sortable_columns' => $no_sortable_columns,
|
||||
'ajax_url' => 'include/ajax/alert_list.ajax',
|
||||
'ajax_data' => [
|
||||
'get_agent_alerts_datatable' => 1,
|
||||
'id_agent' => $idAgent,
|
||||
'url' => $url,
|
||||
],
|
||||
'drawCallback' => 'alerts_table_controls()',
|
||||
'order' => [
|
||||
'field' => 'agent_module_name',
|
||||
'direction' => 'asc',
|
||||
],
|
||||
'zeroRecords' => __('No alerts found'),
|
||||
'emptyTable' => __('No alerts found'),
|
||||
'search_button_class' => 'sub filter float-right',
|
||||
'form' => [
|
||||
'html' => printFormFilterAlert(
|
||||
$id_group,
|
||||
$filter,
|
||||
$free_search,
|
||||
$url,
|
||||
$filter_standby,
|
||||
$tag_filter,
|
||||
true,
|
||||
true,
|
||||
$strict_user
|
||||
if ($agent_view_page === true) {
|
||||
ui_print_datatable(
|
||||
[
|
||||
'id' => 'alerts_status_datatable',
|
||||
'class' => 'info_table',
|
||||
'style' => 'width: 100%',
|
||||
'columns' => $columns,
|
||||
'column_names' => $column_names,
|
||||
'no_sortable_columns' => $no_sortable_columns,
|
||||
'ajax_url' => 'include/ajax/alert_list.ajax',
|
||||
'ajax_data' => [
|
||||
'get_agent_alerts_datatable' => 1,
|
||||
'id_agent' => $idAgent,
|
||||
'url' => $url,
|
||||
'agent_view_page' => true,
|
||||
'all_groups' => $all_groups,
|
||||
],
|
||||
'drawCallback' => 'alerts_table_controls()',
|
||||
'order' => [
|
||||
'field' => 'agent_module_name',
|
||||
'direction' => 'asc',
|
||||
],
|
||||
'zeroRecords' => __('No alerts found'),
|
||||
'emptyTable' => __('No alerts found'),
|
||||
'search_button_class' => 'sub filter float-right',
|
||||
'form' => [
|
||||
'inputs' => [
|
||||
[
|
||||
'label' => __('Free text for search (*):').ui_print_help_tip(
|
||||
__('Filter by module name, template name or action name'),
|
||||
true
|
||||
),
|
||||
'type' => 'text',
|
||||
'name' => 'free_search_alert',
|
||||
'value' => $free_search,
|
||||
'size' => 20,
|
||||
'maxlength' => 100,
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
],
|
||||
'no_toggle' => true,
|
||||
],
|
||||
]
|
||||
);
|
||||
} else {
|
||||
ui_print_datatable(
|
||||
[
|
||||
'id' => 'alerts_status_datatable',
|
||||
'class' => 'info_table',
|
||||
'style' => 'width: 100%',
|
||||
'columns' => $columns,
|
||||
'column_names' => $column_names,
|
||||
'no_sortable_columns' => $no_sortable_columns,
|
||||
'ajax_url' => 'include/ajax/alert_list.ajax',
|
||||
'ajax_data' => [
|
||||
'get_agent_alerts_datatable' => 1,
|
||||
'id_agent' => $idAgent,
|
||||
'url' => $url,
|
||||
],
|
||||
'drawCallback' => 'alerts_table_controls()',
|
||||
'order' => [
|
||||
'field' => 'agent_module_name',
|
||||
'direction' => 'asc',
|
||||
],
|
||||
'zeroRecords' => __('No alerts found'),
|
||||
'emptyTable' => __('No alerts found'),
|
||||
'search_button_class' => 'sub filter float-right',
|
||||
'form' => [
|
||||
'html' => printFormFilterAlert(
|
||||
$id_group,
|
||||
$filter,
|
||||
$free_search,
|
||||
$url,
|
||||
$filter_standby,
|
||||
$tag_filter,
|
||||
true,
|
||||
true,
|
||||
$strict_user
|
||||
),
|
||||
],
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
if (!is_metaconsole()) {
|
||||
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.';">';
|
||||
html_print_submit_button(__('Validate'), 'alert_validate', false, 'class="sub ok"', false);
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$html_content = ob_get_clean();
|
||||
|
||||
if ($agent_view_page === true) {
|
||||
// Create controlled toggle content.
|
||||
ui_toggle(
|
||||
$html_content,
|
||||
__('Full list of alerts'),
|
||||
'status_monitor_agent',
|
||||
!$alerts_defined,
|
||||
false,
|
||||
'',
|
||||
'white_table_graph_content no-padding-imp',
|
||||
'white_table_graph_content'
|
||||
);
|
||||
} else {
|
||||
// Dump entire content.
|
||||
echo $html_content;
|
||||
}
|
||||
|
||||
// Strict user hidden.
|
||||
echo '<div id="strict_hidden" class="invisible">';
|
||||
html_print_input_text('strict_user_hidden', $strict_user);
|
||||
|
||||
html_print_input_text('is_meta_hidden', (int) is_metaconsole());
|
||||
if (!is_metaconsole()) {
|
||||
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
|
||||
echo '<div class="action-buttons" style="width: '.$table->width.';">';
|
||||
html_print_submit_button(__('Validate'), 'alert_validate', false, 'class="sub ok"', false);
|
||||
echo '</div>';
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ui_require_css_file('cluetip', 'include/styles/js/');
|
||||
ui_require_jquery_file('cluetip');
|
||||
?>
|
||||
$html_content = ob_get_clean();
|
||||
|
||||
if ($agent_view_page === true) {
|
||||
// Create controlled toggle content.
|
||||
ui_toggle(
|
||||
$html_content,
|
||||
__('Full list of alerts'),
|
||||
'status_monitor_agent',
|
||||
!$alerts_defined,
|
||||
false,
|
||||
'',
|
||||
'white_table_graph_content no-padding-imp',
|
||||
'white_table_graph_content'
|
||||
);
|
||||
} else {
|
||||
// Dump entire content.
|
||||
echo $html_content;
|
||||
}
|
||||
|
||||
// Strict user hidden.
|
||||
echo '<div id="strict_hidden" class="invisible">';
|
||||
html_print_input_text('strict_user_hidden', $strict_user);
|
||||
|
||||
html_print_input_text('is_meta_hidden', (int) is_metaconsole());
|
||||
echo '</div>';
|
||||
|
||||
enterprise_hook('close_meta_frame');
|
||||
|
||||
|
||||
ui_require_css_file('cluetip', 'include/styles/js/');
|
||||
ui_require_jquery_file('cluetip');
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
|
|
Loading…
Reference in New Issue