This commit is contained in:
Pablo Aragon 2023-03-07 08:28:10 +01:00
parent f77f635b8d
commit 5aac1a6152
9 changed files with 929 additions and 676 deletions

View File

@ -230,11 +230,11 @@ $url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_actions&search_string='
// Filter table.
$table_filter = new stdClass();
$table_filter->width = '100%';
$table_filter->class = 'databox filters';
$table_filter->class = 'databox filters filter-table-adv';
$table_filter->style = [];
$table_filter->style[0] = 'font-weight: bold';
$table_filter->style[2] = 'font-weight: bold';
$table_filter->style[4] = 'font-weight: bold';
$table_filter->style[0] = 'width: 33%';
$table_filter->style[2] = 'width: 33%';
$table_filter->style[4] = 'width: 33%';
$table_filter->data = [];
$table_filter->data[0][0] = __('Search');
@ -246,6 +246,17 @@ $table_filter->data[0][1] = html_print_input_text(
255,
true
);
$table_filter->data[0][0] = html_print_label_input_block(
__('Search'),
html_print_input_text(
'search_string',
$search_string,
'',
25,
255,
true
)
);
$return_all_group = false;
@ -464,8 +475,9 @@ if (isset($data)) {
if (is_management_allowed() === true) {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'&offset='.$offset.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
$button = html_print_submit_button(__('Create'), 'create', false, ['icon' => 'wand'], true);
html_print_input_hidden('create_alert', 1);
html_print_action_buttons($button);
echo '</form>';
echo '</div>';
}

View File

@ -32,29 +32,16 @@ $pure = get_parameter('pure', 0);
$table = new stdClass();
$table->id = 'add_alert_table';
$table->class = 'databox filters';
$table->class = 'databox filters filter-table-adv';
$table->width = '100%';
$table->head = [];
$table->data = [];
$table->size = [];
$table->size = [];
$table->style[0] = 'font-weight: bold;';
$table->style[1] = 'font-weight: bold;display: flex;align-items: baseline;';
$table->style[2] = 'font-weight: bold;';
$table->style[3] = 'font-weight: bold;';
// This is because if this view is reused after list alert view then
// styles in the previous view can affect this table.
$table->rowstyle[0] = '';
$table->rowstyle[1] = '';
$table->rowstyle[2] = '';
$table->rowstyle[3] = '';
$table->style[0] = 'width: 50%';
$table->style[1] = 'width: 50%';
// Add an agent selector
if (! $id_agente) {
$table->data['agent'][0] = __('Agent');
$params = [];
$params['return'] = true;
$params['show_helptip'] = true;
@ -64,36 +51,37 @@ if (! $id_agente) {
$params['metaconsole_enabled'] = false;
$params['use_hidden_input_idagent'] = true;
$params['print_hidden_input_idagent'] = true;
$table->data['agent'][1] = ui_print_agent_autocomplete_input($params);
$table->data[0][0] = html_print_label_input_block(
__('Agent'),
ui_print_agent_autocomplete_input($params)
);
}
$table->data[0][0] = __('Module');
$modules = [];
if ($id_agente) {
$modules = agents_get_modules($id_agente, false, ['delete_pending' => 0]);
}
$table->data[0][1] = html_print_select(
$modules,
'id_agent_module',
0,
true,
__('Select'),
0,
true,
false,
true,
'',
($id_agente == 0),
'min-width: 250px;margin-right: 0.5em;'
$table->data[0][1] = html_print_label_input_block(
__('Module'),
html_print_select(
$modules,
'id_agent_module',
0,
true,
__('Select'),
0,
true,
false,
true,
'w100p',
($id_agente == 0),
'width: 100%;'
).'<span id="latest_value" class="invisible">'.__('Latest value').':
<span id="value">&nbsp;</span></span>
<span id="module_loading" class="invisible">'.html_print_image('images/spinner.gif', true).'</span>'
);
$table->data[0][1] .= ' <span id="latest_value" class="invisible">'.__('Latest value').': ';
$table->data[0][1] .= '<span id="value">&nbsp;</span></span>';
$table->data[0][1] .= ' <span id="module_loading" class="invisible">';
$table->data[0][1] .= html_print_image('images/spinner.gif', true).'</span>';
$table->data[1][0] = __('Actions');
$groups_user = users_get_groups($config['id_user']);
if (!empty($groups_user)) {
@ -109,40 +97,36 @@ if (!empty($groups_user)) {
$actions = db_get_all_rows_sql($sql);
}
$table->data[1][1] = html_print_select(
index_array($actions, 'id', 'name'),
'action_select',
'',
'',
__('Default action'),
'0',
true,
false,
true,
'',
false,
'width: 250px;'
);
$table->data[1][1] .= '<span id="advanced_action" class="advanced_actions invisible"><br>';
$table->data[1][1] .= __('Number of alerts match from').' ';
$table->data[1][1] .= html_print_input_text('fires_min', '', '', 4, 10, true);
$table->data[1][1] .= ' '.__('to').' ';
$table->data[1][1] .= html_print_input_text('fires_max', '', '', 4, 10, true);
$table->data[1][1] .= '</span>';
if ((bool) check_acl($config['id_user'], 0, 'LM') === true) {
$table->data[1][1] .= html_print_button(
$create_action = html_print_button(
__('Create Action'),
'',
false,
'window.location.assign(\'index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'\')',
'window.location.assign("index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&pure='.$pure.'")',
[ 'mode' => 'link' ],
true
);
}
$table->data[2][0] = __('Template');
$own_info = get_user_info($config['id_user']);
$table->data[1][0] = html_print_label_input_block(
__('Actions'),
html_print_select(
index_array($actions, 'id', 'name'),
'action_select',
'',
'',
__('Default action'),
'0',
true,
false,
true,
'w100p',
false,
'width: 100%;'
).'<span id="advanced_action" class="advanced_actions invisible"><br>'.__('Number of alerts match from').' '.html_print_input_text('fires_min', '', '', 4, 10, true).' '.__('to').' '.html_print_input_text('fires_max', '', '', 4, 10, true).'</span>'.$create_action
);
$own_info = get_user_info($config['id_user']);
if ($own_info['is_admin']) {
$templates = alerts_get_alert_templates(false, ['id', 'name']);
} else {
@ -152,7 +136,20 @@ if ($own_info['is_admin']) {
$templates = alerts_get_alert_templates(['id_group IN ('.$filter_groups.')'], ['id', 'name']);
}
$table->data[2][1] = html_print_select(
if ((bool) check_acl($config['id_user'], 0, 'LM') === true) {
$create_template = html_print_button(
__('Create Template'),
'',
false,
'window.location.assign("index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'")',
[ 'mode' => 'link' ],
true
);
}
$table->data[1][1] = html_print_label_input_block(
__('Template'),
html_print_select(
index_array($templates, 'id', 'name'),
'template',
'',
@ -162,24 +159,15 @@ if ($own_info['is_admin']) {
true,
false,
true,
'',
'w100p',
false,
'width: 250px;'
);
$table->data[2][1] .= ' <a class="template_details invisible" href="#">'.html_print_image('images/zoom.png', true, ['class' => 'img_help']).'</a>';
if ((bool) check_acl($config['id_user'], 0, 'LM') === true) {
$table->data[2][1] .= html_print_button(
__('Create Template'),
'',
false,
'window.location.assign(\'index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'\')',
[ 'mode' => 'link' ],
true
);
}
'width: 100%;'
).' <a class="template_details invisible" href="#">'.html_print_image('images/zoom.png', true, ['class' => 'img_help']).'</a>'.$create_template
);
$table->data[3][0] = __('Threshold');
$table->data[3][1] = html_print_extended_select_for_time(
$table->data[2][0] = html_print_label_input_block(
__('Threshold'),
html_print_extended_select_for_time(
'module_action_threshold',
0,
'',
@ -189,62 +177,58 @@ if ($own_info['is_admin']) {
true,
false,
true,
'',
'w100p',
false,
false,
'',
false,
true
);
)
);
if (isset($step) === false) {
echo '<form class="add_alert_form" method="post">';
html_print_table($table);
}
if (isset($step) === false) {
echo '<form class="add_alert_form max_floating_element_size" method="post">';
html_print_table($table);
}
if (isset($step) === false) {
$output = '';
if (isset($step) === false) {
$output = '';
if ($id_cluster) {
$output .= html_print_button(
__('Finish and view cluster'),
'store',
false,
'window.location.replace(\"index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id=".$id_cluster."\");',
[
'icon' => 'update',
'mode' => 'secondary mini',
],
true
);
}
$output .= html_print_submit_button(
__('Add alert'),
'add',
if ($id_cluster) {
$actionButtons .= html_print_button(
__('Finish and view cluster'),
'store',
false,
[ 'icon' => 'wand' ],
'window.location.replace(\"index.php?sec=reporting&sec2=enterprise/godmode/reporting/cluster_view&id=".$id_cluster."\");',
[
'icon' => 'update',
'mode' => 'secondary',
],
true
);
html_print_div(
[
'class' => 'action-buttons',
'content' => $output,
]
);
html_print_input_hidden('create_alert', 1);
echo '</form>';
}
ui_require_css_file('cluetip', 'include/styles/js/');
ui_require_jquery_file('validate');
ui_require_jquery_file('cluetip');
ui_require_jquery_file('pandora.controls');
ui_require_jquery_file('bgiframe');
$actionButtons .= html_print_submit_button(
__('Add alert'),
'add',
false,
[ 'icon' => 'wand' ],
true
);
?>
html_print_action_buttons($actionButtons, ['right_content' => $pagination]);
html_print_input_hidden('create_alert', 1);
echo '</form>';
}
ui_require_css_file('cluetip', 'include/styles/js/');
ui_require_jquery_file('validate');
ui_require_jquery_file('cluetip');
ui_require_jquery_file('pandora.controls');
ui_require_jquery_file('bgiframe');
?>
<script type="text/javascript">
/* <![CDATA[ */
$(document).ready (function () {

View File

@ -61,11 +61,13 @@ if ($id_agente) {
// Table for filter controls.
$form_filter = '<form method="post" action="index.php?sec='.$sec.'&amp;sec2='.$sec2.'&amp;refr='.((int) get_parameter('refr', 0)).'&amp;pure='.$config['pure'].'">';
$form_filter .= "<input type='hidden' name='search' value='1' />";
$form_filter .= '<table cellpadding="0" cellspacing="0" class="databox filters w100p">';
$form_filter .= '<table cellpadding="0" cellspacing="0" class="databox filters w100p filter-table-adv">';
$form_filter .= '<tr>';
$form_filter .= "<td class='bolder''>".__('Template name').'</td><td>';
$form_filter .= html_print_input_text('template_name', $templateName, '', 12, 255, true);
$form_filter .= '</td>';
$form_filter .= '<td class="w33p">'.html_print_label_input_block(
__('Template name'),
html_print_input_text('template_name', $templateName, '', 12, 255, true)
).'</td>';
$temp = agents_get_agents();
$arrayAgents = [];
@ -76,8 +78,6 @@ if ($temp !== false) {
}
}
$form_filter .= "<td class='bolder''>".__('Agents').'</td><td>';
$params = [];
$params['return'] = true;
$params['show_helptip'] = true;
@ -91,14 +91,19 @@ $params['hidden_input_idagent_id'] = 'hidden-autocomplete_id_agent';
$params['hidden_input_idagent_name'] = 'agent_id';
$params['hidden_input_idagent_value'] = $agent_id;
$form_filter .= ui_print_agent_autocomplete_input($params);
$form_filter .= '</td>';
$form_filter .= '<td class="w33p">'.html_print_label_input_block(
__('Agents'),
ui_print_agent_autocomplete_input($params)
).'</td>';
$form_filter .= "<td class='bolder''>".__('Module name').'</td><td>';
$form_filter .= html_print_input_text('module_name', $moduleName, '', 12, 255, true);
$form_filter .= '</td>';
$form_filter .= '<td class="w33p">'.html_print_label_input_block(
__('Module name'),
html_print_input_text('module_name', $moduleName, '', 12, 255, true)
).'</td>';
$form_filter .= '</tr>';
$all_groups = db_get_value('is_admin', 'tusuario', 'id_user', $config['id_user']);
@ -127,19 +132,37 @@ if (is_array($temp) === true) {
}
}
$form_filter .= "<td class='bolder''>".__('Actions').'</td><td>';
$form_filter .= html_print_select($arrayActions, 'action_id', $actionID, '', __('All'), -1, true, false, true, '', false, 'width:95%');
$form_filter .= '</td>';
$form_filter .= "<td class='bolder''>".__('Field content').'</td><td>';
$form_filter .= html_print_input_text('field_content', $fieldContent, '', 12, 255, true);
$form_filter .= '</td>';
$form_filter .= "<td class='bolder''>".__('Priority').'</td><td>';
$form_filter .= html_print_select(get_priorities(), 'priority', $priority, '', __('All'), -1, true);
$form_filter .= "</td class='bolder''>";
$form_filter .= '<td class="w33p">'.html_print_label_input_block(
__('Actions'),
html_print_select($arrayActions, 'action_id', $actionID, '', __('All'), -1, true, false, true, '', false, 'width:95%')
).'</td>';
$form_filter .= '<td class="w33p">'.html_print_label_input_block(
__('Field content'),
html_print_input_text('field_content', $fieldContent, '', 12, 255, true)
).'</td>';
$form_filter .= '<td class="w33p">'.html_print_label_input_block(
__('Priority'),
html_print_select(
get_priorities(),
'priority',
$priority,
'',
__('All'),
-1,
true,
false,
true,
'w100p',
false,
'width: 100%;'
)
).'</td>';
$form_filter .= '</tr>';
$form_filter .= '<tr>';
$form_filter .= "<td class='bolder'>".__('Status').'</td><td>';
$ed_list = [];
$alert_status_filter = [];
$alert_status_filter['all_enabled'] = __('All (Enabled)');
@ -147,14 +170,45 @@ $alert_status_filter['all'] = __('All');
$alert_status_filter['fired'] = __('Fired');
$alert_status_filter['notfired'] = __('Not fired');
$alert_status_filter['disabled'] = __('Disabled');
$form_filter .= html_print_select($alert_status_filter, 'status_alert', $status_alert, '', '', '', true);
$form_filter .= "</td><td class='bolder'>".__('Standby').'</td><td>';
$form_filter .= '<td class="w33p">'.html_print_label_input_block(
__('Status'),
html_print_select(
$alert_status_filter,
'status_alert',
$status_alert,
'',
'',
'',
true,
false,
true,
'w100p',
false,
'width: 100%;'
)
).'</td>';
$sb_list = [];
$sb_list[1] = __('Standby on');
$sb_list[0] = __('Standby off');
$form_filter .= html_print_select($sb_list, 'standby', $standby, '', __('All'), -1, true);
$form_filter .= '</td>';
$form_filter .= "</td><td class='bolder''>".__('Group').'</td><td>';
$form_filter .= '<td class="w33p">'.html_print_label_input_block(
__('Standby'),
html_print_select(
$sb_list,
'standby',
$standby,
'',
__('All'),
-1,
true,
false,
true,
'w100p',
false,
'width: 100%;'
)
).'</td>';
$own_info = get_user_info($config['id_user']);
if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_acl($config['id_user'], 0, 'AW')) {
$return_all_group = false;
@ -162,8 +216,12 @@ if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_
$return_all_group = true;
}
$form_filter .= html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, '', '', 0, true, false, true, '', false);
$form_filter .= '</td></tr>';
$form_filter .= '<td class="w33p">'.html_print_label_input_block(
__('Group'),
html_print_select_groups(false, 'AR', $return_all_group, 'ag_group', $ag_group, '', '', 0, true, false, true, '', false)
).'</td>';
$form_filter .= '</tr>';
$updateButton = html_print_submit_button(
__('Update'),
@ -196,7 +254,17 @@ if (is_metaconsole() === true) {
}
if (!$id_cluster) {
ui_toggle($form_filter, __('Alert control filter'), __('Toggle filter(s)'));
ui_toggle(
$form_filter,
'<span class="subsection_header_title">'.__('Alert control filter').'</span>',
__('Toggle filter(s)'),
'update',
true,
false,
'',
'white-box-content no_border',
'filter-datatable-main box-flat white_table_graph fixed_filter_bar '
);
} else {
unset($form_filter);
}
@ -438,12 +506,6 @@ switch ($sortField) {
$form_params = '&template_name='.$templateName.'&agent_name='.$agentName.'&module_name='.$moduleName.'&action_id='.$actionID.'&field_content='.$fieldContent.'&priority='.$priority.'&enabledisable='.$enabledisable.'&standby='.$standby.'&ag_group='.$ag_group.'&status_alert='.$status_alert;
$sort_params = '&sort_field='.$sortField.'&sort='.$sort;
if ($id_agente) {
ui_pagination($total, 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.$form_params.$sort_params);
} else {
ui_pagination($total, 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list'.$form_params.$sort_params);
}
$offset = (int) get_parameter('offset');
$simple_alerts = agents_get_alerts_simple(
(empty($agent_id) === false) ? ['0' => $agent_id] : $id_agents,
@ -525,8 +587,7 @@ $table_alert_list->cellstyle = [];
$table_alert_list->data = [];
$url .= $sort_params;
// $url .= $sort_params;
$rowPair = true;
$iterator = 0;
@ -591,7 +652,7 @@ foreach ($simple_alerts as $alert) {
}
$module_name = modules_get_agentmodule_name($alert['id_agent_module']);
$data[0] .= ui_print_truncate_text($module_name, 'module_medium', false, true, true, '[&hellip;]', 'display:block;font-weight:normal;').'<br>';
$data[0] .= ui_print_truncate_text($module_name, 'module_medium', false, true, true, '[&hellip;]', 'display:block;font-weight:normal;');
$data[1] = ui_print_status_image($status, $title, true);
@ -690,7 +751,7 @@ foreach ($simple_alerts as $alert) {
$data[3] .= '<form method="post" action="'.$url.'" class="delete_link display_in">';
$data[3] .= html_print_input_image(
'delete',
'images/cross.png',
'images/delete.svg',
1,
'padding:0px; margin-left:5px; margin-right:5px;',
true,
@ -742,67 +803,73 @@ foreach ($simple_alerts as $alert) {
$data[3] .= '<div id="add_action-div-'.$alert['id'].'" class="invisible">';
$data[3] .= '<form id="add_action_form-'.$alert['id'].'" method="post" style="height:85%;">';
$data[3] .= '<table class="w100p bg_color222">';
$data[3] .= '<table class="w100p bg_color222 filter-table-adv">';
$data[3] .= html_print_input_hidden('add_action', 1, true);
$data[3] .= html_print_input_hidden('id_alert_module', $alert['id'], true);
if (! $id_agente) {
$data[3] .= '<tr class="datos2">';
$data[3] .= '<td class="datos2 bolder pdd_6px font_10pt">';
$data[3] .= __('Agent');
$data[3] .= '</td>';
$data[3] .= '<td class="datos">';
$data[3] .= ui_print_truncate_text($alias, 'agent_small', false, true, true, '[&hellip;]');
$data[3] .= '</td>';
$data[3] .= '<td class="w50p">'.html_print_label_input_block(
__('Agent'),
ui_print_truncate_text($alias, 'agent_small', false, true, true, '[&hellip;]')
).'</td>';
$data[3] .= '<td class="w50p">'.html_print_label_input_block(
__('Module'),
ui_print_truncate_text($module_name, 'module_small', false, true, true, '[&hellip;]')
).'</td>';
$data[3] .= '</tr>';
}
$data[3] .= '<tr class="datos">';
$data[3] .= '<td class="datos bolder pdd_6px font_10pt">';
$data[3] .= __('Module');
$data[3] .= '</td>';
$data[3] .= '<td class="datos">';
$data[3] .= ui_print_truncate_text($module_name, 'module_small', false, true, true, '[&hellip;]');
$data[3] .= '</td>';
$data[3] .= '</tr>';
$data[3] .= '<tr class="datos2">';
$data[3] .= '<td class="datos2 bolder pdd_6px font_10pt">';
$data[3] .= __('Action');
$data[3] .= '</td>';
$data[3] .= '<td class="datos2">';
$data[3] .= html_print_select($actions, 'action_select', '', '', __('None'), 0, true, false, true, '', false, 'width:95%');
$data[3] .= '</td>';
$data[3] .= '</tr>';
$data[3] .= '<tr class="datos">';
$data[3] .= '<td class="datos bolder pdd_6px font_10pt">';
$data[3] .= __('Number of alerts match from');
$data[3] .= '</td>';
$data[3] .= '<td class="datos">';
$data[3] .= html_print_input_text(
$data[3] .= '<td class="w50p">'.html_print_label_input_block(
__('Action'),
html_print_select(
$actions,
'action_select',
'',
'',
__('None'),
0,
true,
false,
true,
'',
false,
'width:100%'
)
).'</td>';
$data[3] .= '<td class="w50p">'.html_print_label_input_block(
__('Number of alerts match from'),
'<div class="inline">'.html_print_input_text(
'fires_min',
0,
'',
4,
10,
true
);
$data[3] .= ' '.__('to').' ';
$data[3] .= html_print_input_text(
true,
false,
false,
'',
'w40p'
).' '.__('to').' '.html_print_input_text(
'fires_max',
0,
'',
4,
10,
true
);
$data[3] .= '</td>';
true,
false,
false,
'',
'w40p'
).'</div>'
).'</td>';
$data[3] .= '</tr>';
$data[3] .= '<tr class="datos2">';
$data[3] .= '<td class="datos2 bolder pdd_6px font_10pt">';
$data[3] .= __('Threshold');
$data[3] .= '</td>';
$data[3] .= '<td class="datos2">';
$data[3] .= html_print_extended_select_for_time(
$data[3] .= '<td class="w50p">'.html_print_label_input_block(
__('Threshold'),
html_print_extended_select_for_time(
'module_action_threshold',
0,
'',
@ -818,15 +885,18 @@ foreach ($simple_alerts as $alert) {
'',
false,
true
);
$data[3] .= '</td>';
)
).'</td>';
$data[3] .= '</tr>';
$data[3] .= '</table>';
$data[3] .= html_print_submit_button(
__('Add'),
'addbutton',
false,
['icon' => 'next'],
[
'icon' => 'next',
'class' => 'mini float-right',
],
true
);
$data[3] .= '</form>';
@ -845,7 +915,7 @@ foreach ($simple_alerts as $alert) {
1,
'padding:0px',
true,
['class' => 'filter_none']
['class' => 'filter_none main_menu_icon']
);
$data[4] .= html_print_input_hidden('enable_alert', 1, true);
} else {
@ -854,7 +924,8 @@ foreach ($simple_alerts as $alert) {
'images/lightbulb.png',
1,
'padding:0px;',
true
true,
['class' => 'main_menu_icon']
);
$data[4] .= html_print_input_hidden('disable_alert', 1, true);
}
@ -872,7 +943,7 @@ foreach ($simple_alerts as $alert) {
1,
'padding:0px;',
true,
['class' => 'invert_filter']
['class' => 'invert_filter main_menu_icon']
);
$data[4] .= html_print_input_hidden('standbyon_alert', 1, true);
} else {
@ -882,7 +953,7 @@ foreach ($simple_alerts as $alert) {
1,
'padding:0px;',
true,
['class' => 'invert_filter']
['class' => 'invert_filter main_menu_icon']
);
$data[4] .= html_print_input_hidden('standbyoff_alert', 1, true);
}
@ -922,19 +993,37 @@ foreach ($simple_alerts as $alert) {
true,
[
'title' => __('Add action'),
'class' => 'invert_filter',
'class' => 'invert_filter main_menu_icon',
]
);
} else {
if ((int) $alert['id_policy_alerts'] === 0 || $module_linked === '0') {
$data[4] .= '<a href="javascript:show_add_action(\''.$alert['id'].'\');">';
$data[4] .= html_print_image('images/add.png', true, ['title' => __('Add action'), 'class' => 'invert_filter']);
$data[4] .= html_print_image(
'images/plus-black.svg',
true,
[
'title' => __('Add action'),
'class' => 'invert_filter main_menu_icon',
'style' => 'margin-bottom: 12px;',
]
);
$data[4] .= '</a>';
}
}
}
$data[4] .= html_print_input_image('delete', 'images/cross.png', 1, '', true, ['title' => __('Delete'), 'class' => 'invert_filter']);
$data[4] .= html_print_input_image(
'delete',
'images/delete.svg',
1,
'',
true,
[
'title' => __('Delete'),
'class' => 'invert_filter main_menu_icon',
]
);
$data[4] .= html_print_input_hidden('delete_alert', 1, true);
$data[4] .= html_print_input_hidden('id_alert', $alert['id'], true);
$data[4] .= '</form>';
@ -942,7 +1031,17 @@ foreach ($simple_alerts as $alert) {
if ($is_cluster) {
$data[4] .= '<form class="view_alert_form display_in" method="post">';
$data[4] .= html_print_input_image('update', 'images/builder.png', 1, '', true, ['title' => __('Update'), 'class' => 'invert_filter']);
$data[4] .= html_print_input_image(
'update',
'images/builder.png',
1,
'',
true,
[
'title' => __('Update'),
'class' => 'invert_filter main_menu_icon',
]
);
$data[4] .= html_print_input_hidden('upd_alert', 1, true);
$data[4] .= html_print_input_hidden('id_alert', $alert['id'], true);
@ -952,7 +1051,17 @@ foreach ($simple_alerts as $alert) {
if (check_acl_one_of_groups($config['id_user'], $all_groups, 'LM')) {
$data[4] .= '<form class="view_alert_form display_in" method="post" action="index.php?sec=galertas&sec2=godmode/alerts/alert_view">';
$data[4] .= html_print_input_image('view_alert', 'images/operation.png', 1, '', true, ['title' => __('View alert advanced details'), 'class' => 'invert_filter']);
$data[4] .= html_print_input_image(
'view_alert',
'images/operation.png',
1,
'',
true,
[
'title' => __('View alert advanced details'),
'class' => 'invert_filter main_menu_icon',
]
);
$data[4] .= html_print_input_hidden('id_alert', $alert['id'], true);
$data[4] .= '</form>';
}
@ -960,12 +1069,13 @@ foreach ($simple_alerts as $alert) {
array_push($table_alert_list->data, $data);
}
$pagination = '';
if (isset($data)) {
html_print_table($table_alert_list);
if ($id_agente) {
ui_pagination($total, 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.$form_params.$sort_params, 0, 0, false, 'offset', true, 'pagination-bottom');
$pagination .= ui_pagination($total, 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.$form_params.$sort_params, 0, 0, true, 'offset', false, '');
} else {
ui_pagination($total, 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list'.$form_params.$sort_params, 0, 0, false, 'offset', true, 'pagination-bottom');
$pagination .= ui_pagination($total, 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list'.$form_params.$sort_params, 0, 0, true, 'offset', false, '');
}
} else {
ui_print_info_message(['no_close' => true, 'message' => __('No alerts defined') ]);
@ -982,18 +1092,14 @@ if (isset($dont_display_alert_create_bttn)) {
if ($display_create && (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], $template_group, 'LM')) && !$id_cluster) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">';
html_print_div(
[
'class' => 'action-buttons',
'content' => html_print_submit_button(
__('Create'),
'crtbtn',
false,
['icon' => 'next'],
true
),
]
$actionButtons = html_print_submit_button(
__('Create'),
'crtbtn',
false,
['icon' => 'next'],
true
);
html_print_action_buttons($actionButtons, ['right_content' => $pagination]);
echo '</form>';
}
@ -1174,7 +1280,7 @@ function show_add_action(id_alert) {
dropdownParent: $("#add_action-div-" + id_alert)
});
},
width: 600,
width: 665,
height: 300
})
.show ();

View File

@ -476,6 +476,70 @@ if ($standbyoff_alert) {
);
}
$searchFlag = true;
if (!is_metaconsole()) {
// The tabs will be shown only with manage alerts permissions
if (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], 0, 'LM')) {
$buttons = [
'list' => [
'active' => false,
'text' => '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=list&pure='.$pure.'">'.html_print_image('images/list.png', true, ['title' => __('List alerts'), 'class' => 'invert_filter']).'</a>',
],
'builder' => [
'active' => false,
'text' => '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">'.html_print_image('images/pencil.png', true, ['title' => __('Builder alert'), 'class' => 'invert_filter']).'</a>',
],
];
$buttons[$tab]['active'] = true;
} else {
$buttons = '';
}
if ($tab == 'list') {
ui_print_standard_header(
__('Alerts'),
'images/gm_alerts.png',
false,
'',
true,
$buttons,
[
[
'link' => '',
'label' => __('Manage alerts'),
],
[
'link' => '',
'label' => __('List'),
],
]
);
} else {
ui_print_standard_header(
__('Alerts'),
'images/gm_alerts.png',
false,
'',
true,
$buttons,
[
[
'link' => '',
'label' => __('Manage alerts'),
],
[
'link' => '',
'label' => __('Create'),
],
]
);
}
} else {
alerts_meta_print_header();
}
if ($id_agente) {
$agents = [$id_agente => agents_get_name($id_agente)];
@ -494,64 +558,35 @@ if ($id_agente) {
}
return;
} else {
$searchFlag = true;
if (!is_metaconsole()) {
// The tabs will be shown only with manage alerts permissions
if (check_acl($config['id_user'], 0, 'LW') || check_acl($config['id_user'], 0, 'LM')) {
$buttons = [
'list' => [
'active' => false,
'text' => '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=list&pure='.$pure.'">'.html_print_image('images/list.png', true, ['title' => __('List alerts'), 'class' => 'invert_filter']).'</a>',
],
'builder' => [
'active' => false,
'text' => '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=builder&pure='.$pure.'">'.html_print_image('images/pencil.png', true, ['title' => __('Builder alert'), 'class' => 'invert_filter']).'</a>',
],
];
$buttons[$tab]['active'] = true;
} else {
$buttons = '';
}
if ($tab == 'list') {
ui_print_page_header(__('Alerts').' &raquo; '.__('Manage alerts').' &raquo; '.__('List'), 'images/gm_alerts.png', false, '', true, $buttons);
} else {
ui_print_page_header(__('Alerts').' &raquo; '.__('Manage alerts').' &raquo; '.__('Create'), 'images/gm_alerts.png', false, '', true, $buttons);
}
} else {
alerts_meta_print_header();
}
echo $messageAction;
switch ($tab) {
case 'list':
if ($group == 0) {
$groups = users_get_groups();
} else {
$groups = [0 => __('All')];
}
$agents = agents_get_group_agents(array_keys($groups), false, 'none', true);
include_once $config['homedir'].'/godmode/alerts/alert_list.list.php';
return;
break;
case 'builder':
if ($group == 0) {
$groups = users_get_groups();
} else {
$groups = [0 => __('All')];
}
include_once $config['homedir'].'/godmode/alerts/alert_list.builder.php';
return;
break;
}
}
echo $messageAction;
switch ($tab) {
case 'list':
if ($group == 0) {
$groups = users_get_groups();
} else {
$groups = [0 => __('All')];
}
$agents = agents_get_group_agents(array_keys($groups), false, 'none', true);
include_once $config['homedir'].'/godmode/alerts/alert_list.list.php';
return;
break;
case 'builder':
if ($group == 0) {
$groups = users_get_groups();
} else {
$groups = [0 => __('All')];
}
include_once $config['homedir'].'/godmode/alerts/alert_list.builder.php';
return;
break;
}

View File

@ -125,12 +125,19 @@ if (!$delete_template) {
if (is_metaconsole() === true) {
alerts_meta_print_header();
} else {
ui_print_page_header(
__('Alerts').' &raquo; '.__('Alert templates'),
ui_print_standard_header(
__('Alerts'),
'images/gm_alerts.png',
false,
'',
true
true,
[],
[
[
'link' => '',
'label' => __('Alert templates'),
],
]
);
}
}
@ -283,7 +290,7 @@ $url = ui_get_url_refresh(
$table = new stdClass();
$table->width = '100%';
$table->class = 'databox filters';
$table->class = 'databox filters filter-table-adv';
if (is_metaconsole() === true) {
$table->cellspacing = 0;
$table->cellpadding = 0;
@ -293,51 +300,70 @@ $table->data = [];
$table->head = [];
$table->style = [];
$table->style[0] = 'font-weight: bold';
$table->style[2] = 'font-weight: bold';
$table->style[0] = 'width: 50%;';
$table->style[1] = 'width: 50%;';
$table->data[0][0] = html_print_label_input_block(
__('Type'),
html_print_select(
alerts_get_alert_templates_types(),
'search_type',
$search_type,
'',
__('All'),
'',
true,
false,
false,
'w100p',
false,
'width: 100%;'
)
);
$table->data[0][0] = __('Type');
$table->data[0][1] = html_print_select(
alerts_get_alert_templates_types(),
'search_type',
$search_type,
'',
__('All'),
'',
true,
false,
false
$table->data[0][1] = html_print_label_input_block(
__('Search'),
html_print_input_text(
'search_string',
$search_string,
'',
25,
255,
true,
false,
false,
'',
'w100p'
)
);
$table->data[0][2] = __('Search');
$table->data[0][3] = html_print_input_text(
'search_string',
$search_string,
'',
25,
255,
true
);
$table->data[0][4] = '<div class="action-buttons">';
$table->data[0][4] .= html_print_submit_button(
$table->data[1][0] = '&nbsp;';
$table->data[1][1] = html_print_submit_button(
__('Search'),
'',
false,
'class="sub search"',
[
'class' => 'float-right',
'icon' => 'search',
],
true
);
$table->data[0][4] .= '</div>';
if (is_metaconsole() === true) {
$filter = '<form class="" method="post" action="'.$url.'">';
$filter .= html_print_table($table, true);
$filter .= '</form>';
ui_toggle($filter, __('Show Options'));
} else {
echo '<form method="post" action="'.$url.'">';
html_print_table($table);
echo '</form>';
}
$filter = '<form class="" method="post" action="'.$url.'">';
$filter .= html_print_table($table, true);
$filter .= '</form>';
ui_toggle(
$filter,
'<span class="subsection_header_title">'.__('Show Options').'</span>',
__('Show Options'),
'update',
true,
false,
'',
'white-box-content no_border',
'filter-datatable-main box-flat white_table_graph fixed_filter_bar '
);
unset($table);
@ -428,7 +454,10 @@ foreach ($templates as $template) {
1,
'',
true,
['title' => __('Duplicate')]
[
'title' => __('Duplicate'),
'class' => 'main_menu_icon',
]
);
$data[4] .= '</form> ';
@ -438,11 +467,14 @@ foreach ($templates as $template) {
$data[4] .= html_print_input_hidden('id', $template['id'], true);
$data[4] .= html_print_input_image(
'del',
'images/cross.png',
'images/delete.svg',
1,
'',
true,
['title' => __('Delete')]
[
'title' => __('Delete'),
'class' => 'main_menu_icon',
]
);
$data[4] .= '</form> ';
}
@ -453,18 +485,18 @@ foreach ($templates as $template) {
array_push($table->data, $data);
}
ui_pagination($total_templates, $url);
$pagination = '';
if (isset($data) === true) {
html_print_table($table);
ui_pagination(
$pagination = ui_pagination(
$total_templates,
$url,
0,
0,
false,
'offset',
true,
'pagination-bottom'
'offset',
false,
''
);
} else {
ui_print_info_message(
@ -475,11 +507,15 @@ if (isset($data) === true) {
);
}
$buttons = '';
if (is_management_allowed() === true) {
echo '<div class="action-buttons" style="width: '.$table->width.'">';
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/configure_alert_template&pure='.$pure.'">';
html_print_submit_button(__('Create'), 'create', false, 'class="sub next"');
html_print_input_hidden('create_alert', 1);
$buttons = html_print_submit_button(__('Create'), 'create', false, ['icon' => 'wand'], true);
$buttons .= html_print_input_hidden('create_alert', 1);
html_print_action_buttons($buttons, ['right_content' => $pagination]);
echo '</form>';
echo '</div>';
} else {
html_print_action_buttons($buttons, ['right_content' => $pagination]);
}

View File

@ -91,12 +91,19 @@ if ($a_template !== false) {
$help_header = '';
}
ui_print_page_header(
__('Alerts').' &raquo; '.__('Configure alert template'),
'',
ui_print_standard_header(
__('Alerts'),
'images/gm_alerts.png',
false,
$help_header,
true
true,
[],
[
[
'link' => '',
'label' => __('Configure alert template'),
],
]
);
}
} else {
@ -115,12 +122,19 @@ if ($a_template !== false) {
if (is_metaconsole() === true) {
alerts_meta_print_header();
} else {
ui_print_page_header(
__('Alerts').' &raquo; '.__('Configure alert template'),
ui_print_standard_header(
__('Alerts'),
'images/gm_alerts.png',
false,
'conf_alert_template',
true
true,
[],
[
[
'link' => '',
'label' => __('Configure alert template'),
],
]
);
}
} else {
@ -147,12 +161,19 @@ if ($a_template !== false) {
$help_header = '';
}
ui_print_page_header(
__('Alerts').' &raquo; '.__('Configure alert template'),
ui_print_standard_header(
__('Alerts'),
'images/gm_alerts.png',
false,
$help_header,
true
true,
[],
[
[
'link' => '',
'label' => __('Configure alert template'),
],
]
);
}
}
@ -598,27 +619,22 @@ print_alert_template_steps($step, $id);
$table = new stdClass();
$table->id = 'template';
$table->width = '100%';
$table->class = 'databox filters';
if (is_metaconsole() === true) {
$table->head[0] = __('Create Template');
$table->head_colspan[0] = 4;
$table->headstyle[0] = 'text-align: center';
}
$table->class = 'databox filters w100p filter-table-adv';
$table->style = [];
$table->style[0] = 'font-weight: bold;';
$table->style[2] = 'font-weight: bold;';
$table->size = [];
$table->size[0] = '20%';
$table->size[2] = '20%';
$table->size[0] = '50%';
$table->size[2] = '50%';
$table->colspan = [];
$table->colspan[1][0] = 2;
if ($step == 2) {
if (!isset($show_matches)) {
$show_matches = false;
}
$table->data[0][0] = __('Use special days list');
$data_special_days = Calendar::calendars(
// Fields.
[ '`talert_calendar`.*' ],
@ -637,121 +653,154 @@ if ($step == 2) {
// Reduce to a select.
true
);
$table->data[0][1] = html_print_select(
$data_special_days,
'special_day',
$special_day,
'',
__('None'),
0,
true,
false,
false,
'',
(!$is_management_allowed | $disabled)
$table->data[0][0] = html_print_label_input_block(
__('Use special days list'),
html_print_select(
$data_special_days,
'special_day',
$special_day,
'',
__('None'),
0,
true,
false,
false,
'w100p',
(!$is_management_allowed | $disabled),
'width: 100%'
)
);
$table->data[0][1] = '&nbsp;';
// Firing conditions and events.
$table->colspan = [];
$table->data[1][0] = __('Schedule');
$table->colspan[1][1] = 3;
$table->data[1][1] = ui_print_warning_message(
[
'message' => __('No alert has been scheduled yet'),
'force_style' => 'display:none;',
'force_class' => 'alert_schedule',
],
'',
true
);
$table->data[1][1] .= '<div id="calendar_map" style="width: 90%;"></div>';
$table->data[1][1] .= html_print_input_hidden('schedule', $schedule, true);
$table->colspan['threshold'][1] = 3;
$table->data['threshold'][0] = __('Time threshold');
$table->data['threshold'][1] = html_print_extended_select_for_time(
'threshold',
$threshold,
'',
'',
'',
false,
true,
false,
true,
'',
(!$is_management_allowed | $disabled)
$table->data[1][0] = html_print_label_input_block(
__('Schedule'),
ui_print_warning_message(
[
'message' => __('No alert has been scheduled yet'),
'force_style' => 'display:none;',
'force_class' => 'alert_schedule',
],
'',
true
).'<div id="calendar_map" style="width: 90%;"></div>'.html_print_input_hidden('schedule', $schedule, true)
);
$table->data[4][0] = __('Min. number of alerts');
$table->data[4][1] = html_print_input_text(
'min_alerts',
$min_alerts,
'',
5,
7,
true,
false,
false,
'',
'',
'',
'',
false,
'',
'',
'',
(!$is_management_allowed | $disabled)
$table->data[2][0] = html_print_label_input_block(
__('Time threshold'),
html_print_extended_select_for_time(
'threshold',
$threshold,
'',
'',
'',
false,
true,
false,
true,
'w100p',
(!$is_management_allowed | $disabled)
)
);
$table->data[4][2] = __('Reset counter for non-sustained alerts');
$table->data[4][2] .= ui_print_help_tip(
__('Enable this option if you want the counter to be reset when the alert is not being fired consecutively, even if it\'s within the time threshold'),
true
);
$table->data[4][3] = html_print_checkbox(
'min_alerts_reset_counter',
1,
$min_alerts_reset_counter,
true,
(!$is_management_allowed | $disabled),
'',
false,
($create_template == 1) ? 'checked=checked' : ''
$table->data[2][1] = html_print_label_input_block(
__('Default action').ui_print_help_tip(
__('Unless they\'re left blank, the fields from the action will override those set on the template.'),
true
),
html_print_select_from_sql(
$sql_query,
'default_action',
$default_action,
'',
__('None'),
0,
true,
false,
false,
(!$is_management_allowed | $disabled),
false,
false,
0,
'w100p'
)
);
$table->data[5][0] = __('Max. number of alerts');
$table->data[5][1] = html_print_input_text(
'max_alerts',
$max_alerts,
'',
5,
7,
true,
false,
false,
'',
'',
'',
'',
false,
'',
'',
'',
(!$is_management_allowed | $disabled)
$table->data[3][0] = html_print_label_input_block(
__('Min. number of alerts'),
html_print_input_text(
'min_alerts',
$min_alerts,
'',
5,
7,
true,
false,
false,
'',
'w100p',
'',
'',
false,
'',
'',
'',
(!$is_management_allowed | $disabled)
)
);
$table->data[5][2] = __('Disable event');
$table->data[5][3] = html_print_checkbox(
'disable_event',
1,
$disable_event,
true,
(!$is_management_allowed | $disabled)
$table->data[3][1] = html_print_label_input_block(
__('Reset counter for non-sustained alerts').ui_print_help_tip(
__('Enable this option if you want the counter to be reset when the alert is not being fired consecutively, even if it\'s within the time threshold'),
true
),
html_print_checkbox(
'min_alerts_reset_counter',
1,
$min_alerts_reset_counter,
true,
(!$is_management_allowed | $disabled),
'',
false,
($create_template == 1) ? 'checked=checked' : ''
)
);
$table->data[4][0] = html_print_label_input_block(
__('Max. number of alerts'),
html_print_input_text(
'max_alerts',
$max_alerts,
'',
5,
7,
true,
false,
false,
'',
'w100p',
'',
'',
false,
'',
'',
'',
(!$is_management_allowed | $disabled)
)
);
$table->data[4][1] = html_print_label_input_block(
__('Disable event'),
html_print_checkbox(
'disable_event',
1,
$disable_event,
true,
(!$is_management_allowed | $disabled)
)
);
$table->data[6][0] = __('Default action');
$usr_groups = implode(
',',
array_keys(users_get_groups($config['id_user'], 'LM', true))
@ -765,123 +814,98 @@ if ($step == 2) {
$usr_groups
);
$table->data[6][1] = html_print_select_from_sql(
$sql_query,
'default_action',
$default_action,
'',
__('None'),
0,
true,
false,
false,
(!$is_management_allowed | $disabled),
false,
false,
0
);
$table->data[6][1] .= ui_print_help_tip(
__('Unless they\'re left blank, the fields from the action will override those set on the template.'),
true
$table->data[5][0] = html_print_label_input_block(
__('Condition type'),
html_print_select(
alerts_get_alert_templates_types(),
'type',
$type,
'',
__('None'),
0,
true,
false,
false,
'w100p',
(!$is_management_allowed | $disabled)
).'<span id="matches_value" '.(($show_matches) ? '' : 'class="invisible"').'>'.'&nbsp;'.html_print_checkbox('matches_value', 1, $matches, true).html_print_label(
__('Trigger when matches the value'),
'checkbox-matches_value',
true
).'</span>'
);
$table->data[7][0] = __('Condition type');
$table->data[7][1] = html_print_select(
alerts_get_alert_templates_types(),
'type',
$type,
'',
__('None'),
0,
true,
false,
false,
'',
(!$is_management_allowed | $disabled)
$table->data['value'][1] = html_print_label_input_block(
__('Value'),
html_print_input_text(
'value',
$value,
'',
35,
255,
true
).'&nbsp;<span id="regex_ok">'.html_print_image(
'images/suc.png',
true,
[
'style' => 'display:none',
'id' => 'regex_good',
'title' => __('The regular expression is valid'),
'width' => '20px',
]
).html_print_image(
'images/err.png',
true,
[
'style' => 'display:none',
'id' => 'regex_bad',
'title' => __('The regular expression is not valid'),
'width' => '20px',
]
).'</span>'
);
$table->data[7][1] .= '<span id="matches_value" '.(($show_matches) ? '' : 'class="invisible"').'>';
$table->data[7][1] .= '&nbsp;'.html_print_checkbox('matches_value', 1, $matches, true);
$table->data[7][1] .= html_print_label(
__('Trigger when matches the value'),
'checkbox-matches_value',
true
);
$table->data[7][1] .= '</span>';
$table->colspan[7][1] = 3;
$table->data['value'][0] = __('Value');
$table->data['value'][1] = html_print_input_text(
'value',
$value,
'',
35,
255,
true
);
$table->data['value'][1] .= '&nbsp;<span id="regex_ok">';
$table->data['value'][1] .= html_print_image(
'images/suc.png',
true,
[
'style' => 'display:none',
'id' => 'regex_good',
'title' => __('The regular expression is valid'),
'width' => '20px',
]
);
$table->data['value'][1] .= html_print_image(
'images/err.png',
true,
[
'style' => 'display:none',
'id' => 'regex_bad',
'title' => __('The regular expression is not valid'),
'width' => '20px',
]
);
$table->data['value'][1] .= '</span>';
$table->colspan['value'][1] = 3;
// Min first, then max, that's more logical.
$table->data['min'][0] = __('Min.');
$table->data['min'][1] = html_print_input_text(
'min',
$min,
'',
5,
255,
true,
$disabled
$table->data['min'][0] = html_print_label_input_block(
__('Min.'),
html_print_input_text(
'min',
$min,
'',
5,
255,
true,
$disabled
)
);
$table->colspan['min'][1] = 3;
$table->data['max'][0] = __('Max.');
$table->data['max'][1] = html_print_input_text(
'max',
$max,
'',
5,
255,
true,
$disabled
$table->data['max'][1] = html_print_label_input_block(
__('Max.'),
html_print_input_text(
'max',
$max,
'',
5,
255,
true,
$disabled
)
);
$table->colspan['max'][1] = 3;
$table->data['example'][1] = ui_print_alert_template_example(
$table->data['example'][0] = ui_print_alert_template_example(
$id,
true,
false
);
$table->colspan['example'][1] = 4;
} else if ($step == 3) {
$table->style[0] = 'font-weight: bold; vertical-align: middle';
$table->style[1] = 'font-weight: bold; vertical-align: top';
$table->style[2] = 'font-weight: bold; vertical-align: top';
$table->style[1] = 'font-weight: bold; vertical-align: top;';
$table->style[2] = 'font-weight: bold; vertical-align: top;';
$table->size = [];
$table->size[0] = '10%';
$table->size[1] = '45%';
$table->size[2] = '45%';
$table->size[1] = '50%';
$table->size[2] = '50%';
$table->colspan[0][0] = 2;
$table->class = 'databox filters w100p filter-table-adv alert-template-fields';
// Alert recover.
if (! $recovery_notify) {
$table->cellstyle['label_fields'][2] = 'display:none;';
@ -890,29 +914,29 @@ if ($step == 2) {
}
}
$table->data[0][0] = __('Alert recovery');
$values = [
false => __('Disabled'),
true => __('Enabled'),
];
$table->data[0][1] = html_print_select(
$values,
'recovery_notify',
$recovery_notify,
'',
'',
'',
true,
false,
false,
'',
(!$is_management_allowed | $disabled)
$table->data[0][0] = html_print_label_input_block(
__('Alert recovery'),
html_print_select(
$values,
'recovery_notify',
$recovery_notify,
'',
'',
'',
true,
false,
false,
'w25p',
(!$is_management_allowed | $disabled)
)
);
$table->colspan[0][1] = 2;
$table->data['label_fields'][0] = '';
$table->data['label_fields'][1] = __('Firing fields');
$table->data['label_fields'][2] = __('Recovery fields');
$table->data['label_fields'][1] = '<span class"center">'.__('Firing fields').'</span>';
$table->data['label_fields'][2] = '<span class"center">'.__('Recovery fields').'</span>';
for ($i = 1; $i <= $config['max_macro_fields']; $i++) {
if (isset($template[$name]) === true) {
@ -921,13 +945,13 @@ if ($step == 2) {
$value = '';
}
$table->data['field'.$i][0] = sprintf(__('Field %s'), $i);
// $table->data['field'.$i][0] = sprintf(__('Field %s'), $i);
// TinyMCE.
// triggering fields.
// Basic.
$table->data['field'.$i][1] = '<div id="command_div"><b><small>';
$table->data['field'.$i][1] .= __('Basic').'&nbsp;&nbsp;';
$table->data['field'.$i][1] .= html_print_radio_button_extended(
$col1 = '<div id="command_div"><b><small>';
$col1 .= __('Basic').'&nbsp;&nbsp;';
$col1 .= html_print_radio_button_extended(
'editor_type_value_'.$i,
0,
'',
@ -938,9 +962,9 @@ if ($step == 2) {
true
);
// Advanced.
$table->data['field'.$i][1] .= '&nbsp;&nbsp;&nbsp;&nbsp;';
$table->data['field'.$i][1] .= __('Advanced').'&nbsp;&nbsp;';
$table->data['field'.$i][1] .= html_print_radio_button_extended(
$col1 .= '&nbsp;&nbsp;&nbsp;&nbsp;';
$col1 .= __('Advanced').'&nbsp;&nbsp;';
$col1 .= html_print_radio_button_extended(
'editor_type_value_'.$i,
0,
'',
@ -950,10 +974,10 @@ if ($step == 2) {
'style="height: 15px !important;"',
true
);
$table->data['field'.$i][1] .= '</small></b></div>';
$col1 .= '</small></b></div>';
// Texarea.
$table->data['field'.$i][1] .= html_print_textarea(
$col1 .= html_print_textarea(
'field'.$i,
1,
1,
@ -963,12 +987,16 @@ if ($step == 2) {
'',
(!$is_management_allowed | $disabled)
);
$table->data['field'.$i][1] = html_print_label_input_block(
sprintf(__('Field %s'), $i),
$col1
);
// Recovery.
// Basic.
$table->data['field'.$i][2] = '<div id="command_div"><b><small>';
$table->data['field'.$i][2] .= __('Basic').'&nbsp;&nbsp;';
$table->data['field'.$i][2] .= html_print_radio_button_extended(
$col2 = '<div id="command_div"><b><small>';
$col2 .= __('Basic').'&nbsp;&nbsp;';
$col2 .= html_print_radio_button_extended(
'editor_type_recovery_value_'.$i,
0,
'',
@ -979,9 +1007,9 @@ if ($step == 2) {
true
);
// Advanced.
$table->data['field'.$i][2] .= '&nbsp;&nbsp;&nbsp;&nbsp;';
$table->data['field'.$i][2] .= __('Advanced').'&nbsp;&nbsp;';
$table->data['field'.$i][2] .= html_print_radio_button_extended(
$col2 .= '&nbsp;&nbsp;&nbsp;&nbsp;';
$col2 .= __('Advanced').'&nbsp;&nbsp;';
$col2 .= html_print_radio_button_extended(
'editor_type_recovery_value_'.$i,
0,
'',
@ -991,10 +1019,10 @@ if ($step == 2) {
'style="height: 15px !important;"',
true
);
$table->data['field'.$i][2] .= '</small></b></div>';
$col2 .= '</small></b></div>';
// Texarea.
$table->data['field'.$i][2] .= html_print_textarea(
$col2 .= html_print_textarea(
'field'.$i.'_recovery',
1,
1,
@ -1004,16 +1032,19 @@ if ($step == 2) {
'',
(!$is_management_allowed | $disabled)
);
$table->data['field'.$i][2] = html_print_label_input_block(
'&nbsp;',
$col2
);
}
} else {
// Step 1 by default.
$table->size = [];
$table->size[0] = '20%';
$table->size[0] = '50%';
$table->size[1] = '50%';
$table->colspan = [];
$table->colspan[1][0] = 2;
$table->data = [];
$table->rowstyle = [];
$table->rowstyle['value'] = 'display: none';
$table->rowstyle['max'] = 'display: none';
$table->rowstyle['min'] = 'display: none';
$show_matches = false;
switch ($type) {
@ -1045,29 +1076,29 @@ if ($step == 2) {
break;
}
$table->data[0][0] = __('Name');
$table->data[0][1] = html_print_input_text(
'name',
$name,
'',
35,
255,
true,
false,
false,
'',
'',
'',
'',
false,
'',
'',
'',
(!$is_management_allowed | $disabled)
$table->data[0][0] = html_print_label_input_block(
__('Name'),
html_print_input_text(
'name',
$name,
'',
35,
255,
true,
false,
false,
'',
'',
'',
'',
false,
'',
'',
'',
(!$is_management_allowed | $disabled)
)
);
$table->data[0][1] .= '&nbsp;&nbsp;'.__('Group');
$groups = users_get_groups();
$own_info = get_user_info($config['id_user']);
@ -1081,59 +1112,76 @@ if ($step == 2) {
}
}
$table->data[0][1] .= '&nbsp;';
$table->data[0][1] .= '<div class="w250px inline">'.html_print_select_groups(
false,
'AR',
$return_all_group,
'id_group',
$id_group,
'',
'',
0,
true,
false,
true,
'',
(!$is_management_allowed | $disabled)
).'</div>';
$table->data[1][0] = __('Description');
$table->data[1][1] = html_print_textarea(
'description',
10,
30,
$description,
'',
true,
'',
(!$is_management_allowed | $disabled)
$table->data[0][1] = html_print_label_input_block(
__('Group'),
html_print_select_groups(
false,
'AR',
$return_all_group,
'id_group',
$id_group,
'',
'',
0,
true,
false,
true,
'',
(!$is_management_allowed | $disabled)
)
);
$table->data[2][0] = __('Priority');
$table->data[2][1] = html_print_select(
get_priorities(),
'priority',
$priority,
'',
0,
0,
true,
false,
false,
'',
(!$is_management_allowed | $disabled)
$table->data[1][0] = html_print_label_input_block(
__('Description'),
html_print_textarea(
'description',
10,
30,
$description,
'',
true,
'',
(!$is_management_allowed | $disabled)
)
);
$table->data[2][0] = html_print_label_input_block(
__('Priority'),
html_print_select(
get_priorities(),
'priority',
$priority,
'',
0,
0,
true,
false,
false,
'',
(!$is_management_allowed | $disabled)
)
);
if (is_metaconsole() === true) {
$table->data[3][0] = __('Wizard level');
$wizard_levels = [
'nowizard' => __('No wizard'),
'basic' => __('Basic'),
'advanced' => __('Advanced'),
];
$table->data[3][1] = html_print_select($wizard_levels, 'wizard_level', $wizard_level, '', '', -1, true, false, false);
$table->data[2][1] = html_print_label_input_block(
__('Wizard level'),
html_print_select(
$wizard_levels,
'wizard_level',
$wizard_level,
'',
'',
-1,
true,
false,
false
)
);
} else {
$table->data[2][1] .= html_print_input_hidden('wizard_level', $wizard_level, true);
}
@ -1146,9 +1194,9 @@ if ($step == 2) {
$offset = (int) get_parameter('offset');
// If it's the last step it will redirect to template lists.
if ($step >= LAST_STEP) {
echo '<form method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_templates&pure='.$pure.'&offset='.$offset.'">';
echo '<form class="max_floating_element_size" method="post" action="index.php?sec='.$sec.'&sec2=godmode/alerts/alert_templates&pure='.$pure.'&offset='.$offset.'">';
} else {
echo '<form method="post">';
echo '<form class="max_floating_element_size" method="post">';
}
html_print_table($table);
@ -1168,7 +1216,7 @@ if (!$disabled) {
__('Finish'),
'finish',
false,
'class="submitButton"',
['icon' => 'wand'],
true
);
} else {
@ -1179,7 +1227,11 @@ if (!$disabled) {
__('Next'),
'next',
false,
'class="submitButton" onclick="return check_fields_step2();"',
[
'class' => 'submitButton',
'onclick' => 'return check_fields_step2();',
'icon' => 'next',
],
true
);
} else {
@ -1187,7 +1239,7 @@ if (!$disabled) {
__('Next'),
'next',
false,
'class="submitButton"',
['icon' => 'next'],
true
);
}

View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 27.2.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 20 20" style="enable-background:new 0 0 20 20;" xml:space="preserve">
<style type="text/css">
.st0{fill:none;}
.st1{fill:#000000;}
</style>
<g>
<circle class="st0" cx="10" cy="10" r="10"/>
</g>
<path class="st1" d="M15.6,11.4H4.4C3.6,11.4,3,10.8,3,10v0c0-0.8,0.6-1.4,1.4-1.4h11.1c0.8,0,1.4,0.6,1.4,1.4v0
C17,10.8,16.4,11.4,15.6,11.4z"/>
<path class="st1" d="M8.6,15.6V4.4C8.6,3.6,9.2,3,10,3h0c0.8,0,1.4,0.6,1.4,1.4v11.1c0,0.8-0.6,1.4-1.4,1.4h0
C9.2,17,8.6,16.4,8.6,15.6z"/>
</svg>

After

Width:  |  Height:  |  Size: 776 B

View File

@ -2361,10 +2361,10 @@ div.pager input {
/* Steps style */
ol.steps {
margin-bottom: 70px;
padding: 0;
list-style-type: none;
list-style-position: outside;
margin-top: 0px;
}
ol.steps li {
@ -9273,7 +9273,7 @@ div.stat-win-spinner img {
}
.fc-col-header-cell-cushion {
color: #fff;
color: #000;
}
.stat_win_histogram {
@ -11482,7 +11482,7 @@ div[role="dialog"] {
color: #161628;
text-align: left;
margin-bottom: 10px;
font-weight: bold;
/* font-weight: bold; */
}
.preimage_container span {
@ -11508,3 +11508,15 @@ input[type="text"]:has(+ .inputbuton) {
.notzindex {
z-index: 0;
}
table.alert-template-fields > tbody > tr > td > div > label {
margin-bottom: 0px;
}
table.alert-template-fields > tbody > tr > td > div > textarea {
margin-bottom: 15px;
}
table.alert-template-fields > tbody > tr > td[id^="template-label_fields"] {
text-align: center;
}

View File

@ -194,7 +194,7 @@
-webkit-border-radius: 0px;
border-radius: 0px;
/*border: none;*/
border-bottom: 1px solid #c0ccdc;
/* border-bottom: 1px solid #c0ccdc; */
padding: 7px 3px;
/*
padding-left: 0px;