wip reports alert actions

This commit is contained in:
Daniel Barbero Martin 2021-12-02 13:34:28 +01:00
parent b781215b4e
commit 9b79fb826d
3 changed files with 48 additions and 24 deletions

View File

@ -187,11 +187,13 @@ $graph_render = (empty($config['type_mode_graph']) === true) ? 0 : $config['type
$valuesGroupBy = [0 => __('None')];
$valuesGroupByDefaultAlertActions = [
'agent' => __('Agent'),
'module' => __('Module'),
'group' => __('Group'),
'template' => __('Template'),
'agent' => __('Agent'),
'module' => __('Module'),
'group' => __('Group'),
];
if (is_metaconsole() === false) {
$valuesGroupByDefaultAlertActions['template'] = __('Template');
}
switch ($action) {
case 'new':
@ -789,16 +791,21 @@ switch ($action) {
$group_by = $es['group_by'];
$valuesGroupBy = [
'agent' => __('Agent'),
'module' => __('Module'),
'group' => __('Group'),
'template' => __('Template'),
];
$period = $item['period'];
$lapse = $item['lapse'];
// Set values.
$valuesGroupBy = [
'agent' => __('Agent'),
'module' => __('Module'),
'group' => __('Group'),
];
if (is_metaconsole() === false) {
$valuesGroupBy['template'] = __('Template');
}
$lapse_calc = 1;
break;
@ -5695,6 +5702,7 @@ function addGeneralRow() {
}
function chooseType() {
var meta = '<?php echo (is_metaconsole() === true) ? 1 : 0; ?>';
type = $("#type").val();
$("#row_description").hide();
$("#row_label").hide();
@ -6116,7 +6124,9 @@ function chooseType() {
$("#select_agent_modules").show();
$("#agents_modules_row").show();
$("#modules_row").show();
$("#row_alert_templates").show();
if(meta == 0){
$("#row_alert_templates").show();
}
$("#row_alert_actions").show();
$("#row_period").show();
$("#row_lapse").show();
@ -6133,7 +6143,8 @@ function chooseType() {
});
$("#lapse_select").attr('disabled', false);
$("#lapse_select").val(0).trigger('change');
$("#lapse_select").val('0').trigger('change');
$("#hidden-lapse").val('0');
}
break;

View File

@ -2688,11 +2688,30 @@ function reporting_alert_report_actions($report, $content)
$return['data'] = [];
$es = json_decode($content['external_source'], true);
if (isset($report['id_template']) === true
&& empty($resport['id_template']) === false
) {
$modules = json_decode(
io_safe_output(base64_decode($es['module'])),
true
);
$agents = json_decode(
io_safe_output(base64_decode($es['id_agents'])),
true
);
} else {
if (is_metaconsole() === true) {
$server_id = metaconsole_get_id_server($content['server_name']);
$modules = [$server_id.'|'.$content['id_agent_module']];
$agents = [$server_id.'|'.$content['id_agent']];
} else {
$modules = [$content['id_agent_module']];
$agents = [$content['id_agent']];
}
}
$period = $content['period'];
$id_group = $content['id_group'];
$modules = $es['module'];
$agents = $es['id_agents'];
$templates = $es['templates'];
$actions = $es['actions'];
$show_summary = $es['show_summary'];
@ -2701,14 +2720,8 @@ function reporting_alert_report_actions($report, $content)
$filters = [
'group' => $id_group,
'agents' => json_decode(
io_safe_output(base64_decode($agents)),
true
),
'modules' => json_decode(
io_safe_output(base64_decode($modules)),
true
),
'agents' => $agents,
'modules' => $modules,
'templates' => $templates,
'actions' => $actions,
'period' => $period,

View File

@ -329,7 +329,7 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t
if (!$no_close_bool) {
// Use the no_meta parameter because this image is only in
// the base console.
$output .= '<a href="javascript: close_info_box(\''.$id.'\')">'.html_print_image('images/blade.png', true, false, false, true).'</a>';
$output .= '<a href="javascript: close_info_box(\''.$id.'\')">'.html_print_image('images/blade.png', true, false, false, false).'</a>';
}
$output .= '</td>