';
$data .= '';
@@ -571,6 +594,11 @@ if ($show_update_action_menu) {
true
);
$data .= '';
+ if (is_metaconsole()) {
+ // Restore db connection.
+ metaconsole_restore_db();
+ }
+
echo $data;
return;
}
@@ -933,6 +961,7 @@ if ($get_agent_alerts_datatable === true) {
$tmp->last_fired = $row[7];
$tmp->status = $row[8];
$tmp->validate = $row[9];
+ $tmp->actions = $row[10];
} else {
// Open.
$tmp->standby = $row[0];
diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php
index 4dcf94edf1..62999b53b3 100755
--- a/pandora_console/include/functions_ui.php
+++ b/pandora_console/include/functions_ui.php
@@ -1139,6 +1139,7 @@ function ui_format_alert_row(
'last_fired' => 7,
'status' => 8,
'validate' => 9,
+ 'actions' => 10,
];
} else {
$index = [
@@ -1458,6 +1459,69 @@ function ui_format_alert_row(
}
$data[$index['status']] = ui_print_status_image($status, $title, true);
+ $data[$index['status']] .= ' ';
+
+ if (is_metaconsole()) {
+ if (enterprise_include_once('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) {
+ $connection = metaconsole_get_connection($agente['server_name']);
+ if (metaconsole_load_external_db($connection) !== NOERR) {
+ echo json_encode(false);
+ // Restore db connection.
+ metaconsole_restore_db();
+ return;
+ }
+ }
+
+ $action = db_get_all_rows_filter(
+ 'talert_template_module_actions',
+ ['id_alert_template_module' => $alert['id']],
+ 'id'
+ )[0];
+
+ if (is_metaconsole()) {
+ // Restore db connection.
+ metaconsole_restore_db();
+ }
+
+ // Edit.
+ $tableActionButtons[] = html_print_input_image(
+ 'update_action',
+ '/images/edit.svg',
+ 1,
+ 'padding:0px;',
+ true,
+ [
+ 'title' => __('Update action'),
+ 'class' => 'main_menu_icon invert_filter',
+ 'onclick' => 'show_display_update_action(\''.$action['id'].'\',\''.$alert['id'].'\',\''.$alert['id_agent_module'].'\',\''.$action['id'].'\',\''.$alert['agent_name'].'\')',
+ ]
+ );
+ $tableActionButtons[] = html_print_input_hidden('id_agent_module', $alert['id_agent_module'], true);
+ $tableActionButtons[] = '';
+
+ $data[$index['actions']] = html_print_div(
+ [
+ 'style' => 'padding-top: 8px;',
+ 'content' => implode('', $tableActionButtons),
+ ],
+ true
+ );
+ }
return $data;
}
@@ -3626,6 +3690,8 @@ function ui_print_datatable(array $parameters)
} else {
$pagination_options = [
[
+ // There is a limit of (2^32)^2 (18446744073709551615) rows in a MyISAM table, show for show all use max nrows.
+ // -1 Retun error or only 1 row.
$parameters['default_pagination'],
5,
10,
@@ -3634,7 +3700,7 @@ function ui_print_datatable(array $parameters)
200,
500,
1000,
- -1,
+ 18446744073709551615,
],
[
$parameters['default_pagination'],
diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php
index 4139d30342..8bece360b1 100755
--- a/pandora_console/operation/agentes/alerts_status.php
+++ b/pandora_console/operation/agentes/alerts_status.php
@@ -314,12 +314,18 @@ if (is_metaconsole() === false) {
}
}
+if (is_metaconsole()) {
+ array_push($column_names, ['text' => 'actions']);
+ array_push($columns, 'actions');
+}
+
if (is_metaconsole() === true) {
$no_sortable_columns = [
0,
1,
2,
5,
+ -1,
];
} else {
if (enterprise_installed() === true) {
@@ -468,7 +474,17 @@ if (is_metaconsole() === false) {
}
}
} else {
- html_print_action_buttons('');
+ echo "';
}
$html_content = ob_get_clean();
@@ -510,97 +526,136 @@ ui_require_jquery_file('cluetip');
diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php
index 6fffdb00ae..9e809b55dd 100644
--- a/pandora_console/operation/agentes/estado_agente.php
+++ b/pandora_console/operation/agentes/estado_agente.php
@@ -94,6 +94,19 @@ if (is_ajax() === true) {
}
if ($get_agent_module_last_value === true) {
+ if (is_metaconsole()) {
+ if (enterprise_include_once('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) {
+ $server_name = explode(' ', io_safe_output(get_parameter('server_name')))[0];
+ $connection = metaconsole_get_connection($server_name);
+ if (metaconsole_load_external_db($connection) !== NOERR) {
+ echo json_encode(false);
+ // Restore db connection.
+ metaconsole_restore_db();
+ return;
+ }
+ }
+ }
+
$id_module = (int) get_parameter('id_agent_module');
$id_agent = (int) modules_get_agentmodule_agent((int) $id_module);
if (! check_acl_one_of_groups($config['id_user'], agents_get_all_groups_agent($id_agent), 'AR')) {
@@ -132,6 +145,11 @@ if (is_ajax() === true) {
}
}
+ if (is_metaconsole()) {
+ // Restore db connection.
+ metaconsole_restore_db();
+ }
+
echo json_encode($value);
return;
}
diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php
index 2e2ee2e37a..d701815a58 100644
--- a/pandora_console/operation/agentes/ver_agente.php
+++ b/pandora_console/operation/agentes/ver_agente.php
@@ -929,7 +929,12 @@ if (is_ajax()) {
if (is_metaconsole() && !$force_local_modules) {
if (enterprise_include_once('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) {
+ if (empty($server_name)) {
+ $server_name = explode(' ', io_safe_output($agentName))[0];
+ }
+
$connection = metaconsole_get_connection($server_name);
+
if ($server_id > 0) {
$connection = metaconsole_get_connection_by_id($server_id);
}
|