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:
Daniel Rodriguez 2023-01-09 09:26:40 +00:00
commit 5d667f4952
2 changed files with 242 additions and 224 deletions

View File

@ -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,7 +922,7 @@ 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];
@ -934,6 +933,18 @@ if ($get_agent_alerts_datatable === true) {
$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;

View File

@ -227,18 +227,16 @@ if ($free_search != '') {
$url .= '&free_search='.$free_search; $url .= '&free_search='.$free_search;
} }
$columns = ['standby'];
$column_names = [
$columns = ['standby'];
$column_names = [
[ [
'title' => 'Standby', 'title' => 'Standby',
'text' => 'S.', 'text' => 'S.',
], ],
]; ];
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
if (enterprise_installed() === true) {
array_unshift( array_unshift(
$column_names, $column_names,
[ [
@ -251,9 +249,9 @@ if ($free_search != '') {
['policy'], ['policy'],
$columns $columns
); );
} }
if (is_metaconsole() === false) { if (is_metaconsole() === false) {
if (check_acl($config['id_user'], $id_group, 'LW') || check_acl($config['id_user'], $id_group, 'LM')) { if (check_acl($config['id_user'], $id_group, 'LW') || check_acl($config['id_user'], $id_group, 'LM')) {
array_unshift( array_unshift(
$column_names, $column_names,
@ -284,9 +282,9 @@ if ($free_search != '') {
['force'] ['force']
); );
} }
} }
if ($print_agent === true) { if ($print_agent === true) {
array_push( array_push(
$column_names, $column_names,
['text' => 'Agent'] ['text' => 'Agent']
@ -296,35 +294,36 @@ if ($free_search != '') {
$columns, $columns,
['agent_name'] ['agent_name']
); );
} }
array_push( array_push(
$column_names, $column_names,
['text' => 'Module'], ['text' => 'Module'],
['text' => 'Template'], ['text' => 'Template'],
['text' => 'Action'], ['text' => 'Action'],
['text' => 'Last fired'], ['text' => 'Last fired'],
['text' => 'Status'] ['text' => 'Status']
); );
$columns = array_merge( $columns = array_merge(
$columns, $columns,
['agent_module_name'], ['agent_module_name'],
['template_name'], ['template_name'],
['action'], ['action'],
['last_fired'], ['last_fired'],
['status'] ['status']
); );
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
$no_sortable_columns = [ $no_sortable_columns = [
0, 0,
1, 1,
5, 5,
]; ];
} else { } else {
if (enterprise_installed() === true) {
$no_sortable_columns = [ $no_sortable_columns = [
0, 0,
1, 1,
@ -332,17 +331,25 @@ if ($free_search != '') {
3, 3,
7, 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',
@ -385,7 +392,7 @@ if ($free_search != '') {
], ],
] ]
); );
} else { } else {
ui_print_datatable( ui_print_datatable(
[ [
'id' => 'alerts_status_datatable', 'id' => 'alerts_status_datatable',
@ -423,20 +430,20 @@ if ($free_search != '') {
], ],
] ]
); );
} }
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>'; echo '</div>';
} }
} }
$html_content = ob_get_clean(); $html_content = ob_get_clean();
if ($agent_view_page === true) { if ($agent_view_page === true) {
// Create controlled toggle content. // Create controlled toggle content.
ui_toggle( ui_toggle(
$html_content, $html_content,
@ -448,10 +455,10 @@ if ($free_search != '') {
'white_table_graph_content no-padding-imp', 'white_table_graph_content no-padding-imp',
'white_table_graph_content' 'white_table_graph_content'
); );
} else { } else {
// Dump entire content. // Dump entire content.
echo $html_content; echo $html_content;
} }
// Strict user hidden. // Strict user hidden.
echo '<div id="strict_hidden" class="invisible">'; echo '<div id="strict_hidden" class="invisible">';
@ -465,7 +472,7 @@ if ($free_search != '') {
ui_require_css_file('cluetip', 'include/styles/js/'); ui_require_css_file('cluetip', 'include/styles/js/');
ui_require_jquery_file('cluetip'); ui_require_jquery_file('cluetip');
?> ?>
<script type="text/javascript"> <script type="text/javascript">