review styles agent view

This commit is contained in:
fbsanchez 2019-05-27 22:36:55 +02:00
parent f1499082fa
commit f57915285f
9 changed files with 166 additions and 49 deletions

View File

@ -717,9 +717,15 @@ if ($table_events) {
'event_condition',
'AND'
);
echo '<div id="div_all_events_24h">';
echo '<label><b>'.__('Show all Events 24h').'</b></label>';
echo html_print_checkbox('all_events_24h', $all_events_24h, $all_events_24h, true, false, '', true);
echo '<div style="display: flex;" id="div_all_events_24h">';
echo '<label style="margin-right: 1em;"><b>'.__('Show all Events 24h').'</b></label>';
echo html_print_switch(
[
'name' => 'all_events_24h',
'value' => $all_events_24h,
'id' => 'checkbox-all_events_24h',
]
);
echo '</div>';
$date_subtract_day = (time() - (24 * 60 * 60));

View File

@ -997,7 +997,7 @@ function events_print_event_table(
$table->cellpadding = 0;
$table->cellspacing = 0;
$table->width = $width;
$table->class = 'databox data';
$table->class = 'info_table';
if (!$tactical_view) {
$table->title = __('Latest events');
}

View File

@ -2989,6 +2989,7 @@ function html_print_switch($attributes=[])
'class',
'name',
'onclick',
'onchange',
];
foreach ($valid_attrs as $va) {
if (!isset($attributes[$va])) {
@ -2998,7 +2999,11 @@ function html_print_switch($attributes=[])
$html_expand .= ' '.$va.'="'.$attributes[$va].'"';
}
return "<label class='p-switch'>
if (!isset($attributes['style'])) {
$attributes['style'] = '';
}
return "<label class='p-switch' style='".$attributes['style']."'>
<input type='checkbox' $html_expand>
<span class='p-slider'></span>
</label>";

View File

@ -9500,13 +9500,23 @@ function reporting_get_agent_module_info($id_agent)
/**
* Print tiny statistics of the status of one agent, group, etc.
*
* @param mixed Array with the counts of the total modules, normal modules, critical modules, warning modules, unknown modules and fired alerts
* @param bool return or echo flag
* @param mixed $counts_info Array with the counts of the total modules,
* normal modules, critical modules, warning modules, unknown modules and
* fired alerts.
* @param boolean $return Return or echo flag.
* @param string $type agent or modules or ??.
* @param string $separator Sepearator (classic view).
* @param boolean $modern Use modern interfaces or old one.
*
* @return string html formatted tiny stats of modules/alerts of an agent
* @return string HTML formatted tiny stats of modules/alerts of an agent.
*/
function reporting_tiny_stats($counts_info, $return=false, $type='agent', $separator=':', $strict_user=false)
{
function reporting_tiny_stats(
$counts_info,
$return=false,
$type='agent',
$separator=':',
$modern=false
) {
global $config;
$out = '';
@ -9623,44 +9633,74 @@ function reporting_tiny_stats($counts_info, $return=false, $type='agent', $separ
$out .= html_print_div($params, true);
}
// If total count is less than 0, is an error. Never show negative numbers
// If total count is less than 0, is an error. Never show negative numbers.
if ($total_count < 0) {
$total_count = 0;
}
$out .= '<div id="bullets_modules">';
// $out .='<span id="total_count_'.$uniq_id.'" class="forced_title" style="font-size: 13pt">'.$total_count.$separator.'</span>';
if (isset($fired_count) && $fired_count > 0) {
$out .= '<div><div class="bullet_modules orange_background"></div>';
$out .= '<span class="forced_title" id="fired_count_'.$uniq_id.'" style="font-size: 12pt">'.$fired_count.'</span></div>';
}
if ($modern === true) {
$out .= '<div id="bullets_modules">';
// $out .='<span id="total_count_'.$uniq_id.'" class="forced_title" style="font-size: 13pt">'.$total_count.$separator.'</span>';
if (isset($fired_count) && $fired_count > 0) {
$out .= '<div><div class="bullet_modules orange_background"></div>';
$out .= '<span class="forced_title" id="fired_count_'.$uniq_id.'" style="font-size: 12pt">'.$fired_count.'</span></div>';
}
if (isset($critical_count) && $critical_count > 0) {
$out .= '<div><div class="bullet_modules red_background"></div>';
$out .= '<span class="forced_title" id="critical_count_'.$uniq_id.'" style="font-size: 12pt">'.$critical_count.'</span></div>';
}
if (isset($critical_count) && $critical_count > 0) {
$out .= '<div><div class="bullet_modules red_background"></div>';
$out .= '<span class="forced_title" id="critical_count_'.$uniq_id.'" style="font-size: 12pt">'.$critical_count.'</span></div>';
}
if (isset($warning_count) && $warning_count > 0) {
$out .= '<div><div class="bullet_modules yellow_background"></div>';
$out .= '<span class="forced_title" id="warning_count_'.$uniq_id.'" style="font-size: 12pt">'.$warning_count.'</span></div>';
}
if (isset($warning_count) && $warning_count > 0) {
$out .= '<div><div class="bullet_modules yellow_background"></div>';
$out .= '<span class="forced_title" id="warning_count_'.$uniq_id.'" style="font-size: 12pt">'.$warning_count.'</span></div>';
}
if (isset($unknown_count) && $unknown_count > 0) {
$out .= '<div><div class="bullet_modules grey_background"></div>';
$out .= '<span class="forced_title" id="unknown_count_'.$uniq_id.'" style="font-size: 12pt">'.$unknown_count.'</span></div>';
}
if (isset($unknown_count) && $unknown_count > 0) {
$out .= '<div><div class="bullet_modules grey_background"></div>';
$out .= '<span class="forced_title" id="unknown_count_'.$uniq_id.'" style="font-size: 12pt">'.$unknown_count.'</span></div>';
}
if (isset($not_init_count) && $not_init_count > 0) {
$out .= '<div><div class="bullet_modules blue_background"></div>';
$out .= '<span class="forced_title" id="not_init_count_'.$uniq_id.'" style="font-size: 12pt">'.$not_init_count.'</span></div>';
}
if (isset($not_init_count) && $not_init_count > 0) {
$out .= '<div><div class="bullet_modules blue_background"></div>';
$out .= '<span class="forced_title" id="not_init_count_'.$uniq_id.'" style="font-size: 12pt">'.$not_init_count.'</span></div>';
}
if (isset($normal_count) && $normal_count > 0) {
$out .= '<div><div class="bullet_modules green_background"></div>';
$out .= '<span class="forced_title" id="normal_count_'.$uniq_id.'" style="font-size: 12pt">'.$normal_count.'</span></div>';
}
if (isset($normal_count) && $normal_count > 0) {
$out .= '<div><div class="bullet_modules green_background"></div>';
$out .= '<span class="forced_title" id="normal_count_'.$uniq_id.'" style="font-size: 12pt">'.$normal_count.'</span></div>';
}
$out .= '</div>';
$out .= '</div>';
} else {
// Classic ones.
$out .= '<b>'.'<span id="total_count_'.$uniq_id.'" class="forced_title" style="font-size: 7pt">'.$total_count.'</span>';
if (isset($fired_count) && $fired_count > 0) {
$out .= ' '.$separator.' <span class="orange forced_title" id="fired_count_'.$uniq_id.'" style="font-size: 7pt">'.$fired_count.'</span>';
}
if (isset($critical_count) && $critical_count > 0) {
$out .= ' '.$separator.' <span class="red forced_title" id="critical_count_'.$uniq_id.'" style="font-size: 7pt">'.$critical_count.'</span>';
}
if (isset($warning_count) && $warning_count > 0) {
$out .= ' '.$separator.' <span class="yellow forced_title" id="warning_count_'.$uniq_id.'" style="font-size: 7pt">'.$warning_count.'</span>';
}
if (isset($unknown_count) && $unknown_count > 0) {
$out .= ' '.$separator.' <span class="grey forced_title" id="unknown_count_'.$uniq_id.'" style="font-size: 7pt">'.$unknown_count.'</span>';
}
if (isset($not_init_count) && $not_init_count > 0) {
$out .= ' '.$separator.' <span class="blue forced_title" id="not_init_count_'.$uniq_id.'" style="font-size: 7pt">'.$not_init_count.'</span>';
}
if (isset($normal_count) && $normal_count > 0) {
$out .= ' '.$separator.' <span class="green forced_title" id="normal_count_'.$uniq_id.'" style="font-size: 7pt">'.$normal_count.'</span>';
}
$out .= '</b>';
}
if ($return) {
return $out;

View File

@ -2473,7 +2473,7 @@ function ui_print_status_image($type, $title='', $return=false, $options=false,
function ui_progress(
$progress,
$width='100%',
$height='2em',
$height='2.5em',
$color='#80ba27',
$return=true
) {
@ -2490,7 +2490,7 @@ function ui_progress(
}
ui_require_css_file('progress');
$output .= '<div class="progress_main">';
$output .= '<div class="progress_main" style="width: '.$width.'; height: '.$height.';">';
$output .= '<span class="progress_text">'.$progress.'%</span>';
$output .= '<div class="progress" style="width: '.$progress.'%;"></div>';
$output .= '</div>';

View File

@ -6001,6 +6001,10 @@ div#bullets_modules div {
min-width: 500px;
}
.agent_details_col.agent_details_col_left {
width: 50%;
}
.agent_details_content .agent_details_bullets {
position: relative;
left: -20%;
@ -6012,6 +6016,10 @@ div#bullets_modules div {
min-width: 670px;
}
.agent_details_col.agent_details_col_right {
width: 50%;
}
.buttons_agent_view {
display: flex;
justify-content: flex-end;

View File

@ -2,6 +2,7 @@ span.progress_text {
position: absolute;
font-family: "lato-bolder", "Open Sans", sans-serif;
font-size: 2em;
margin-left: -0.5em;
}
div.progress_main {

View File

@ -213,7 +213,15 @@ $table_agent_description .= '<span style="vertical-align:top; display: inline-bl
$table_agent_description .= empty($agent['comentarios']) ? '<em>'.__('N/A').'</em>' : $agent['comentarios'];
$table_agent_description .= '</span></p>';
$table_agent_count_modules = reporting_tiny_stats($agent, true);
$table_agent_count_modules = reporting_tiny_stats(
$agent,
true,
'agent',
// Useless.
':',
true
);
// $table_agent_count_modules .= ui_print_help_tip(__('Agent statuses are re-calculated by the server, they are not shown in real time.'), true);
$table_agent = '<div class="agent_details_header">'.$table_agent_header.'</div>
<div class="agent_details_content">
@ -280,7 +288,7 @@ $table_contact->data[] = $data;
$data = [];
$table_contact->colspan[3][0] = 2;
$data[0] = ui_progress($progress);
$data[0] = ui_progress($progress, '80%');
if ($progress > 100) {
$data[0] .= clippy_context_help('agent_out_of_limits');

View File

@ -139,7 +139,13 @@ echo ui_print_help_tip(
true
);
echo '<span>'.__('Full list of monitors').'</span>';
echo reporting_tiny_stats($agent, true, 'modules');
echo reporting_tiny_stats(
$agent,
true,
'modules',
':',
true
);
$modules_not_init = agents_monitor_notinit($id_agente);
if (!empty($modules_not_init)) {
@ -207,6 +213,7 @@ ui_toggle(
$("#status_module_group").enable();
$("#status_filter_monitor").enable();
}
filter_modules();
}
function order_module_list(sort_field_param, sort_rows_param) {
@ -495,7 +502,17 @@ function print_form_filter_monitors(
$table->data[0][3] = html_print_input_text('status_text_monitor', $status_text_monitor, '', 30, 100, true);
$table->data[0][4] = __('Module group');
$rows = db_get_all_rows_sql("SELECT * FROM tmodule_group where id_mg in (SELECT id_module_group from tagente_modulo where id_agente = $id_agent ) ORDER BY name");
$rows = db_get_all_rows_sql(
sprintf(
'SELECT *
FROM tmodule_group
WHERE id_mg IN (SELECT id_module_group
FROM tagente_modulo
WHERE id_agente = %d )
ORDER BY name',
$id_agent
)
);
$rows_select[-1] = __('All');
if (!empty($rows)) {
@ -504,11 +521,43 @@ function print_form_filter_monitors(
}
}
$table->data[0][5] = html_print_select($rows_select, 'status_module_group', $status_module_group, '', '', 0, true);
$table->data[0][6] = __('Show in hierachy mode');
$table->data[0][6] .= html_print_checkbox('status_hierachy_mode', '', false, true, false, 'onChange=change_module_filter();');
$table->data[0][7] = html_print_button(__('Filter'), 'filter', false, 'filter_modules();', 'class="sub search"', true);
$table->data[0][8] = '&nbsp;'.html_print_button(__('Reset'), 'filter', false, 'reset_filter_modules();', 'class="sub upd" style="margin-top:0px;"', true);
$table->data[0][5] = html_print_select(
$rows_select,
'status_module_group',
$status_module_group,
'',
'',
0,
true
);
$table->data[0][6] = '<div style="display: flex;align-content: center;">';
$table->data[0][6] .= __('Show in hierachy mode');
$table->data[0][6] .= html_print_switch(
[
'name' => 'status_hierachy_mode',
'value' => $all_events_24h,
'onchange' => 'change_module_filter()',
'id' => 'checkbox-status_hierachy_mode',
'style' => 'margin-left: 1em;',
]
);
$table->data[0][6] .= '</div>';
$table->data[0][7] = html_print_button(
__('Filter'),
'filter',
false,
'filter_modules();',
'class="sub search"',
true
);
$table->data[0][8] = '&nbsp;'.html_print_button(
__('Reset'),
'filter',
false,
'reset_filter_modules();',
'class="sub upd" style="margin-top:0px;"',
true
);
$form_text .= html_print_table($table, true);
$filter_hidden = false;