';
+
+ 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();
+ }
+
+ $tableActionButtons[] = '';
+
+ // Edit.
+ if (check_acl($config['id_user'], $id_group, 'LM')) {
+ $tableActionButtons[] = html_print_input_hidden('id_agent_module', $alert['id_agent_module'], true);
+
+ $tableActionButtons[] = '
'.html_print_image(
+ 'images/delete.svg',
+ true,
+ [
+ 'alt' => __('Delete'),
+ 'title' => __('Delete'),
+ 'class' => 'main_menu_icon invert_filter vertical_baseline',
+ ]
+ ).'';
+
+ $tableActionButtons[] = '
'.html_print_image(
+ 'images/plus-black.svg',
+ true,
+ [
+ 'title' => __('Add action'),
+ 'class' => 'invert_filter main_menu_icon',
+ 'style' => 'margin-bottom: 12px;',
+ ]
+ ).'';
+ }
+
+ $data[$index['actions']] = html_print_div(
+ [
+ 'style' => 'padding-top: 8px;',
+ 'content' => implode('', $tableActionButtons),
+ ],
+ true
+ );
+ }
+
+ // Is possible manage actions if have LW permissions in the agent group of the alert module.
+ if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) {
+ if (check_acl($config['id_user'], $template_group, 'LW')) {
+ $own_groups = users_get_groups($config['id_user'], 'LW', true);
+ } else if (check_acl($config['id_user'], $template_group, 'LM')) {
+ $own_groups = users_get_groups($config['id_user'], 'LM', true);
+ }
+
+ $filter_groups = '';
+ $filter_groups = implode(',', array_keys($own_groups));
+ if ($filter_groups != null) {
+ $actions = alerts_get_alert_actions_filter(true, 'id_group IN ('.$filter_groups.')');
+ }
+
+ $data[$index['actions']] .= '
';
+ $data[$index['actions']] .= '
';
+ $data[$index['actions']] .= '
';
+ }
return $data;
}
@@ -3652,6 +3881,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,
@@ -3660,7 +3891,7 @@ function ui_print_datatable(array $parameters)
200,
500,
1000,
- -1,
+ 18446744073709551615,
],
[
$parameters['default_pagination'],
diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css
index 49abe7da3e..4d41d12b8e 100644
--- a/pandora_console/include/styles/pandora.css
+++ b/pandora_console/include/styles/pandora.css
@@ -7303,6 +7303,9 @@ div.graph div.legend table {
.vertical_middle {
vertical-align: middle;
}
+.vertical_baseline {
+ vertical-align: baseline !important;
+}
.mrg_btt_7 {
margin-bottom: 7px;
diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php
index 039b1cdcc0..4db865990f 100755
--- a/pandora_console/operation/agentes/alerts_status.php
+++ b/pandora_console/operation/agentes/alerts_status.php
@@ -312,12 +312,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) {
@@ -466,7 +472,17 @@ if (is_metaconsole() === false) {
}
}
} else {
- html_print_action_buttons('');
+ echo "
';
}
$html_content = ob_get_clean();
@@ -509,97 +525,153 @@ ui_require_jquery_file('cluetip');
+}).change();
+
+function validateAlerts() {
+ var alert_ids = [];
+
+ $('[id^=checkbox-validate]:checked').each(function() {
+ alert_ids.push($(this).val());
+ });
+
+ if (alert_ids.length === 0) {
+ confirmDialog({
+ title: "",
+ message: "",
+ hideCancelButton: true
+ });
+ }
+
+ $.ajax({
+ type: "POST",
+ url: "ajax.php",
+ data: {
+ alert_ids: alert_ids,
+ page: "include/ajax/alert_list.ajax",
+ alert_validate: 1,
+ all_groups: ,
+ },
+ dataType: "json",
+ success: function (data) {
+ $("#menu_tab_frame_view").after(data);
+ var table = $('#alerts_status_datatable').DataTable({
+ ajax: "data.json"
+ });
+
+ table.ajax.reload();
+ },
+ });
+
+}
+
+function show_display_update_action(id_module_action, alert_id, alert_id_agent_module, action_id,id_agent='') {
+ $.each($('[id^="update_action-div"]'), function(){
+ $(this).html('');
+ });
+ var params = [];
+ params.push("show_update_action_menu=1");
+ params.push("id_agent_module=" + alert_id_agent_module);
+ params.push("id_module_action=" + id_module_action);
+ params.push("id_alert=" + alert_id);
+ params.push("id_action=" + action_id);
+ params.push("id_agent=" + id_agent);
+ params.push("page=include/ajax/alert_list.ajax");
+ jQuery.ajax ({
+ data: params.join ("&"),
+ type: 'POST',
+ url: action="",
+ success: function (data) {
+ $('#update_action-div-'+alert_id).html(data);
+ $('#update_action-div-'+alert_id).dialog ({
+ resizable: true,
+ draggable: true,
+ title: '',
+ modal: true,
+ overlay: {
+ opacity: 0.5,
+ background: "black"
+ },
+ open: function() {
+ $('#action_select_ajax-'+alert_id).select2();
+ },
+ onclose: function() {
+ $('#update_action-div-'+alert_id).html("");
+ },
+ width: 600,
+ height: 350,
+ })
+ .show ();
+ }
+ });
+}
+
+function show_add_action(id_alert) {
+ $("#add_action-div-" + id_alert).hide ()
+ .dialog ({
+ resizable: true,
+ draggable: true,
+ modal: true,
+ width: 700,
+ title: '',
+ modal: true,
+ overlay: {
+ opacity: 0.5,
+ background: "black"
+ }
+ })
+ .show ();
+}
+
\ No newline at end of file
diff --git a/pandora_console/operation/agentes/estado_agente.php b/pandora_console/operation/agentes/estado_agente.php
index 3a130c1d76..84779427d0 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 b79fbc4115..9bda55e947 100644
--- a/pandora_console/operation/agentes/ver_agente.php
+++ b/pandora_console/operation/agentes/ver_agente.php
@@ -942,7 +942,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);
}