mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
Merge branch 'ent-10119-vista-de-alertas-fallo-en-la-version-open' into 'develop'
Ent 10119 vista de alertas fallo en la version open See merge request artica/pandorafms!5381
This commit is contained in:
commit
5d667f4952
@ -915,7 +915,6 @@ if ($get_agent_alerts_datatable === true) {
|
|||||||
$data[] = ui_format_alert_row($alert, true, $url, 'font-size: 7pt;');
|
$data[] = ui_format_alert_row($alert, true, $url, 'font-size: 7pt;');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$data = array_reduce(
|
$data = array_reduce(
|
||||||
$data,
|
$data,
|
||||||
function ($carry, $row) {
|
function ($carry, $row) {
|
||||||
@ -923,17 +922,29 @@ if ($get_agent_alerts_datatable === true) {
|
|||||||
// of objects, making a post-process of certain fields.
|
// of objects, making a post-process of certain fields.
|
||||||
$tmp = new stdClass();
|
$tmp = new stdClass();
|
||||||
|
|
||||||
// Standby.
|
if (enterprise_installed() === true) {
|
||||||
$tmp->policy = $row[0];
|
$tmp->policy = $row[0];
|
||||||
$tmp->standby = $row[1];
|
$tmp->standby = $row[1];
|
||||||
$tmp->force = $row[2];
|
$tmp->force = $row[2];
|
||||||
$tmp->agent_name = $row[3];
|
$tmp->agent_name = $row[3];
|
||||||
$tmp->agent_module_name = $row[4];
|
$tmp->agent_module_name = $row[4];
|
||||||
$tmp->template_name = $row[5];
|
$tmp->template_name = $row[5];
|
||||||
$tmp->action = $row[6];
|
$tmp->action = $row[6];
|
||||||
$tmp->last_fired = $row[7];
|
$tmp->last_fired = $row[7];
|
||||||
$tmp->status = $row[8];
|
$tmp->status = $row[8];
|
||||||
$tmp->validate = $row[9];
|
$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;
|
$carry[] = $tmp;
|
||||||
return $carry;
|
return $carry;
|
||||||
|
@ -227,245 +227,252 @@ if ($free_search != '') {
|
|||||||
$url .= '&free_search='.$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',
|
'title' => 'Validate',
|
||||||
'text' => 'S.',
|
'text' => html_print_checkbox('all_validate', 0, false, true, false),
|
||||||
],
|
'class' => 'dt-left',
|
||||||
];
|
]
|
||||||
|
);
|
||||||
|
|
||||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
$columns = array_merge(
|
||||||
array_unshift(
|
['validate'],
|
||||||
$column_names,
|
$columns
|
||||||
[
|
);
|
||||||
'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']
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
|
||||||
array_push(
|
array_push(
|
||||||
$column_names,
|
$column_names,
|
||||||
['text' => 'Module'],
|
[
|
||||||
['text' => 'Template'],
|
'title' => 'Force execution',
|
||||||
['text' => 'Action'],
|
'text' => 'F.',
|
||||||
['text' => 'Last fired'],
|
]
|
||||||
['text' => 'Status']
|
|
||||||
);
|
);
|
||||||
|
|
||||||
$columns = array_merge(
|
$columns = array_merge(
|
||||||
$columns,
|
$columns,
|
||||||
['agent_module_name'],
|
['force']
|
||||||
['template_name'],
|
|
||||||
['action'],
|
|
||||||
['last_fired'],
|
|
||||||
['status']
|
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
if (is_metaconsole() === true) {
|
||||||
$no_sortable_columns = [
|
$no_sortable_columns = [
|
||||||
0,
|
0,
|
||||||
1,
|
1,
|
||||||
5,
|
5,
|
||||||
];
|
];
|
||||||
} else {
|
} else {
|
||||||
$no_sortable_columns = [
|
if (enterprise_installed() === true) {
|
||||||
0,
|
$no_sortable_columns = [
|
||||||
1,
|
0,
|
||||||
2,
|
1,
|
||||||
3,
|
2,
|
||||||
7,
|
3,
|
||||||
];
|
7,
|
||||||
}
|
];
|
||||||
|
} else {
|
||||||
|
$no_sortable_columns = [
|
||||||
|
0,
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
6,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$alert_action = empty(alerts_get_alert_actions_filter()) === false
|
$alert_action = empty(alerts_get_alert_actions_filter()) === false
|
||||||
? alerts_get_alert_actions_filter()
|
? alerts_get_alert_actions_filter()
|
||||||
: ['' => __('No actions')];
|
: ['' => __('No actions')];
|
||||||
|
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
||||||
if ($agent_view_page === true) {
|
if ($agent_view_page === true) {
|
||||||
ui_print_datatable(
|
ui_print_datatable(
|
||||||
[
|
[
|
||||||
'id' => 'alerts_status_datatable',
|
'id' => 'alerts_status_datatable',
|
||||||
'class' => 'info_table',
|
'class' => 'info_table',
|
||||||
'style' => 'width: 100%',
|
'style' => 'width: 100%',
|
||||||
'columns' => $columns,
|
'columns' => $columns,
|
||||||
'column_names' => $column_names,
|
'column_names' => $column_names,
|
||||||
'no_sortable_columns' => $no_sortable_columns,
|
'no_sortable_columns' => $no_sortable_columns,
|
||||||
'ajax_url' => 'include/ajax/alert_list.ajax',
|
'ajax_url' => 'include/ajax/alert_list.ajax',
|
||||||
'ajax_data' => [
|
'ajax_data' => [
|
||||||
'get_agent_alerts_datatable' => 1,
|
'get_agent_alerts_datatable' => 1,
|
||||||
'id_agent' => $idAgent,
|
'id_agent' => $idAgent,
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
'agent_view_page' => true,
|
'agent_view_page' => true,
|
||||||
'all_groups' => $all_groups,
|
'all_groups' => $all_groups,
|
||||||
],
|
],
|
||||||
'drawCallback' => 'alerts_table_controls()',
|
'drawCallback' => 'alerts_table_controls()',
|
||||||
'order' => [
|
'order' => [
|
||||||
'field' => 'agent_module_name',
|
'field' => 'agent_module_name',
|
||||||
'direction' => 'asc',
|
'direction' => 'asc',
|
||||||
],
|
],
|
||||||
'zeroRecords' => __('No alerts found'),
|
'zeroRecords' => __('No alerts found'),
|
||||||
'emptyTable' => __('No alerts found'),
|
'emptyTable' => __('No alerts found'),
|
||||||
'search_button_class' => 'sub filter float-right',
|
'search_button_class' => 'sub filter float-right',
|
||||||
'form' => [
|
'form' => [
|
||||||
'inputs' => [
|
'inputs' => [
|
||||||
[
|
[
|
||||||
'label' => __('Free text for search (*):').ui_print_help_tip(
|
'label' => __('Free text for search (*):').ui_print_help_tip(
|
||||||
__('Filter by module name, template name or action name'),
|
__('Filter by module name, template name or action name'),
|
||||||
true
|
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
|
|
||||||
),
|
),
|
||||||
|
'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 (!is_metaconsole()) {
|
||||||
if (check_acl($config['id_user'], $id_group, 'AW') || check_acl($config['id_user'], $id_group, 'LM')) {
|
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.';">';
|
echo '<div class="action-buttons" style="width: '.$table->width.';">';
|
||||||
html_print_submit_button(__('Validate'), 'alert_validate', false, 'class="sub ok"', false);
|
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());
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
}
|
||||||
enterprise_hook('close_meta_frame');
|
}
|
||||||
|
|
||||||
|
|
||||||
ui_require_css_file('cluetip', 'include/styles/js/');
|
$html_content = ob_get_clean();
|
||||||
ui_require_jquery_file('cluetip');
|
|
||||||
?>
|
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">
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user