fixed bug in meta alert view: action field (other than default) not showing

This commit is contained in:
alejandro-campos 2018-07-19 13:55:16 +02:00
parent 75a38fadc2
commit b5c378d589
2 changed files with 18 additions and 10 deletions

View File

@ -1305,13 +1305,25 @@ function alerts_delete_alert_agent_module_action ($id_alert_agent_module_action)
*
* @return mixed Actions associated or false if something goes wrong.
*/
function alerts_get_alert_agent_module_actions ($id_alert_agent_module, $fields = false) {
function alerts_get_alert_agent_module_actions ($id_alert_agent_module, $fields = false, $server_id = -1) {
if (empty ($id_alert_agent_module))
return false;
$actions = db_get_all_rows_filter ('talert_template_module_actions',
array ('id_alert_template_module' => $id_alert_agent_module),
$fields);
if (defined('METACONSOLE')) {
$server = db_get_row ('tmetaconsole_setup', 'id', $server_id);
if (metaconsole_connect($server) == NOERR) {
$actions = db_get_all_rows_filter ('talert_template_module_actions',
array ('id_alert_template_module' => $id_alert_agent_module),
$fields);
metaconsole_restore_db ();
}
} else {
$actions = db_get_all_rows_filter ('talert_template_module_actions',
array ('id_alert_template_module' => $id_alert_agent_module),
$fields);
}
if ($actions === false)
return array ();

View File

@ -823,10 +823,6 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
else
return array ("", "", "", "", "", "", "");
}
// Get agent id
$id_agent = modules_get_agentmodule_agent ($alert['id_agent_module']);
$agente = db_get_row ('tagente', 'id_agente', $id_agent);
$template = alerts_get_alert_template ($alert['id_alert_template']);
$description = io_safe_output($template['name']);
@ -917,7 +913,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
ui_print_truncate_text (io_safe_output($description), 'description', false, true, true, '[…]', 'font-size: 7.1pt') .
$disabledHtmlEnd;
$actions = alerts_get_alert_agent_module_actions ($alert['id'], false);
$actions = alerts_get_alert_agent_module_actions ($alert['id'], false, $alert['server_data']['id']);
if (!empty($actions)) {
$actionText = '<div><ul class="action_list">';