Add alert correlation wizard

This commit is contained in:
Daniel Barbero Martin 2019-11-12 13:16:25 +01:00
parent 0213bc675e
commit 9d3c9febad
4 changed files with 134 additions and 2 deletions

View File

@ -1618,6 +1618,89 @@ function html_print_input_email(array $settings):string
} }
/**
* Render an input number element.
*
* @param array $settings Array with attributes input.
* only name is necessary.
*
* @return string
*/
function html_print_input_number(array $settings):string
{
// TODO: const.
$valid_attrs = [
'accept',
'disabled',
'maxlength',
'name',
'readonly',
'placeholder',
'size',
'value',
'accesskey',
'class',
'dir',
'id',
'lang',
'style',
'tabindex',
'title',
'xml:lang',
'onfocus',
'onblur',
'onselect',
'onchange',
'onclick',
'ondblclick',
'onmousedown',
'onmouseup',
'onmouseover',
'onmousemove',
'onmouseout',
'onkeypress',
'onkeydown',
'onkeyup',
'required',
'pattern',
'autocomplete',
];
$output = '';
if (isset($settings) === true && is_array($settings) === true) {
// Check Name is necessary.
if (isset($settings['name']) === true) {
$output = '<input type="number" ';
// Check Max length.
if (isset($settings['maxlength']) === false) {
$settings['maxlength'] = 255;
}
// Check Size.
if (isset($settings['size']) === false
|| $settings['size'] === 0
) {
$settings['size'] = 255;
}
foreach ($settings as $attribute => $attr_value) {
// Check valid attribute.
if (in_array($attribute, $valid_attrs) === false) {
continue;
}
$output .= $attribute.'="'.$attr_value.'" ';
}
$output .= $function.'/>';
}
}
return $output;
}
/** /**
* Render an input image element. * Render an input image element.
* *
@ -3309,6 +3392,10 @@ function html_print_input($data, $wrapper='div', $input_only=false)
$output .= html_print_input_email($data); $output .= html_print_input_email($data);
break; break;
case 'number':
$output .= html_print_input_number($data);
break;
case 'hidden': case 'hidden':
$output .= html_print_input_hidden( $output .= html_print_input_hidden(
$data['name'], $data['name'],
@ -3413,7 +3500,8 @@ function html_print_input($data, $wrapper='div', $input_only=false)
break; break;
case 'submit': case 'submit':
$output .= '<'.$wrapper.' class="action-buttons" style="width: 100%">'.html_print_submit_button( $width = (isset($data['width']) === true) ? 'width: '.$data['width'] : 'width: 100%';
$output .= '<'.$wrapper.' class="action-buttons" style="'.$width.'">'.html_print_submit_button(
((isset($data['label']) === true) ? $data['label'] : 'OK'), ((isset($data['label']) === true) ? $data['label'] : 'OK'),
((isset($data['name']) === true) ? $data['name'] : ''), ((isset($data['name']) === true) ? $data['name'] : ''),
((isset($data['disabled']) === true) ? $data['disabled'] : false), ((isset($data['disabled']) === true) ? $data['disabled'] : false),
@ -3498,6 +3586,10 @@ function html_print_input($data, $wrapper='div', $input_only=false)
$output .= html_print_input_email($data); $output .= html_print_input_email($data);
break; break;
case 'multicheck':
$output .= html_print_input_multicheck($data);
break;
default: default:
// Ignore. // Ignore.
break; break;
@ -3514,6 +3606,33 @@ function html_print_input($data, $wrapper='div', $input_only=false)
} }
/**
* Print all checkbox in the same row.
*
* @param array $data Array with attributes input.
* only name is necessary.
*
* @return string
*/
function html_print_input_multicheck(array $data):string
{
$html = '';
if (isset($data['data']) === true && is_array($data['data']) === true) {
foreach ($data['data'] as $key => $value) {
$html .= $value;
$html .= html_print_checkbox(
'days_week_'.$key,
1,
$data['checked'][$key],
true
);
}
}
return $html;
}
/** /**
* Print an autocomplete input filled out with Integria IMS users. * Print an autocomplete input filled out with Integria IMS users.
* *

View File

@ -536,7 +536,7 @@ function menu_add_extras(&$menu)
$menu_extra['galertas']['sub']['godmode/alerts/configure_alert_action']['text'] = __('Manage alert actions'); $menu_extra['galertas']['sub']['godmode/alerts/configure_alert_action']['text'] = __('Manage alert actions');
$menu_extra['galertas']['sub']['godmode/alerts/configure_alert_command']['text'] = __('Manage commands'); $menu_extra['galertas']['sub']['godmode/alerts/configure_alert_command']['text'] = __('Manage commands');
$menu_extra['galertas']['sub']['enterprise/godmode/alerts/alert_events']['text'] = __('Manage event alerts'); $menu_extra['galertas']['sub']['enterprise/godmode/alerts/alert_correlation']['text'] = __('Manage event alerts');
$menu_extra['gservers']['sub']['enterprise/godmode/servers/manage_export_form']['text'] = __('Manage export targets'); $menu_extra['gservers']['sub']['enterprise/godmode/servers/manage_export_form']['text'] = __('Manage export targets');

View File

@ -204,6 +204,7 @@ label {
width: 100%; width: 100%;
} }
li > input[type="number"],
li > input[type="text"], li > input[type="text"],
li > input[type="email"], li > input[type="email"],
li > input[type="password"], li > input[type="password"],

View File

@ -551,6 +551,18 @@ select:-internal-list-box {
align-items: center; align-items: center;
} }
.flex-space-around {
justify-content: space-around;
}
.flex-end {
justify-content: flex-end;
}
.flex-start {
justify-content: flex-start;
}
.nowrap { .nowrap {
flex-wrap: nowrap; flex-wrap: nowrap;
} }