9555-Features and styles fixes

This commit is contained in:
Pablo Aragon 2023-04-17 15:14:51 +02:00
parent 3a80923de9
commit 6cb74f18cd
8 changed files with 183 additions and 81 deletions

View File

@ -13302,32 +13302,32 @@ function reporting_tiny_stats(
if ($modern === true) {
$out .= '<div id="bullets_modules">';
if (isset($fired_count) && $fired_count > 0) {
$out .= '<div><div id="fired_count_'.$uniq_id.'" class="forced_title bullet_modules orange_background"></div>';
$out .= '<div><div id="fired_count_'.$uniq_id.'" class="forced_title color-orange"></div>';
$out .= '<span class="font_12pt">'.$fired_count.'</span></div>';
}
if (isset($critical_count) && $critical_count > 0) {
$out .= '<div><div id="critical_count_'.$uniq_id.'" class="forced_title bullet_modules red_background"></div>';
$out .= '<div><div id="critical_count_'.$uniq_id.'" class="forced_title color-red"></div>';
$out .= '<span class="font_12pt">'.$critical_count.'</span></div>';
}
if (isset($warning_count) && $warning_count > 0) {
$out .= '<div><div id="warning_count_'.$uniq_id.'" class="forced_title bullet_modules yellow_background"></div>';
$out .= '<div><div id="warning_count_'.$uniq_id.'" class="forced_title color-yellow"></div>';
$out .= '<span class="font_12pt">'.$warning_count.'</span></div>';
}
if (isset($unknown_count) && $unknown_count > 0) {
$out .= '<div><div id="unknown_count_'.$uniq_id.'" class="forced_title bullet_modules grey_background"></div>';
$out .= '<div><div id="unknown_count_'.$uniq_id.'" class="forced_title color-grey"></div>';
$out .= '<span class="font_12pt">'.$unknown_count.'</span></div>';
}
if (isset($not_init_count) && $not_init_count > 0) {
$out .= '<div><div id="not_init_count_'.$uniq_id.'" class="forced_title bullet_modules blue_background"></div>';
$out .= '<div><div id="not_init_count_'.$uniq_id.'" class="forced_title color-blue"></div>';
$out .= '<span class="font_12pt">'.$not_init_count.'</span></div>';
}
if (isset($normal_count) && $normal_count > 0) {
$out .= '<div><div id="normal_count_'.$uniq_id.'" class="forced_title bullet_modules green_background"></div>';
$out .= '<div><div id="normal_count_'.$uniq_id.'" class="forced_title color-green"></div>';
$out .= '<span class="font_12pt">'.$normal_count.'</span></div>';
}
@ -13336,27 +13336,27 @@ function reporting_tiny_stats(
// Classic ones.
$out .= '<b><span id="total_count_'.$uniq_id.'" class="forced_title" >'.$total_count.'</span>';
if (isset($fired_count) && $fired_count > 0) {
$out .= ' '.$separator.' <span class="orange forced_title" id="fired_count_'.$uniq_id.'" >'.$fired_count.'</span>';
$out .= ' '.$separator.' <span class="color-orange forced_title" id="fired_count_'.$uniq_id.'" >'.$fired_count.'</span>';
}
if (isset($critical_count) && $critical_count > 0) {
$out .= ' '.$separator.' <span class="red forced_title" id="critical_count_'.$uniq_id.'" >'.$critical_count.'</span>';
$out .= ' '.$separator.' <span class="color-red forced_title" id="critical_count_'.$uniq_id.'" >'.$critical_count.'</span>';
}
if (isset($warning_count) && $warning_count > 0) {
$out .= ' '.$separator.' <span class="yellow forced_title" id="warning_count_'.$uniq_id.'" >'.$warning_count.'</span>';
$out .= ' '.$separator.' <span class="color-yellow forced_title" id="warning_count_'.$uniq_id.'" >'.$warning_count.'</span>';
}
if (isset($unknown_count) && $unknown_count > 0) {
$out .= ' '.$separator.' <span class="grey forced_title" id="unknown_count_'.$uniq_id.'" >'.$unknown_count.'</span>';
$out .= ' '.$separator.' <span class="color-grey forced_title" id="unknown_count_'.$uniq_id.'" >'.$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.'" >'.$not_init_count.'</span>';
$out .= ' '.$separator.' <span class="color-blue forced_title" id="not_init_count_'.$uniq_id.'" >'.$not_init_count.'</span>';
}
if (isset($normal_count) && $normal_count > 0) {
$out .= ' '.$separator.' <span class="green forced_title" id="normal_count_'.$uniq_id.'" >'.$normal_count.'</span>';
$out .= ' '.$separator.' <span class="color-green forced_title" id="normal_count_'.$uniq_id.'" >'.$normal_count.'</span>';
}
$out .= '</b>';

View File

@ -66,6 +66,18 @@ body {
display: none;
}
.flex {
display: flex;
}
.align-items-center {
align-items: center;
}
.space-between {
justify-content: space-between;
}
.ui-header .ui-title {
font-size: 14px !important;
min-height: 1.1em;
@ -534,7 +546,7 @@ table.event_details td.cell_event_name {
color: #4a83f3 !important;
}
.green,
/* .green,
.orange,
.yellow,
.red,
@ -544,11 +556,11 @@ table.event_details td.cell_event_name {
color: white !important;
padding: 1px 3px;
border-radius: 2px;
}
} */
.agents_tiny_stats span {
/* .agents_tiny_stats span {
background: #222;
}
} */
.agent_details {
padding: 10px 0px 10px 0px;
@ -677,7 +689,8 @@ table.event_details td.cell_event_name {
#list_agents .cell_1,
#list_agents .cell_2,
#list_agents .cell_3,
#list_agents .cell_4 {
#list_agents .cell_4,
#list_agents .cell_7 {
display: none !important;
}
@ -942,8 +955,8 @@ table[id^="service-table-"] td.cell_0 {
#list_Modules td,
#list_agent_Modules td {
height: 35px;
padding-top: 20px;
height: 25px;
vertical-align: middle;
}
#list_agent_Modules td.cell_0 > span.tiny {
@ -952,6 +965,7 @@ table[id^="service-table-"] td.cell_0 {
#list_Modules .cell_5 img {
float: left;
margin-left: 5px;
}
#user_logged {
@ -1012,10 +1026,10 @@ li.ui-btn {
border-bottom: 0px solid white !important;
}
.cell_0 {
/* .cell_0 {
border-top: solid 1px #666;
margin-top: 0px;
}
} */
#list_events .cell_0 {
border: 0px;
@ -1423,9 +1437,9 @@ span.nobold * {
}
.status_rounded_rectangles.forced_title {
width: 1em;
height: 1em;
border-radius: 50%;
width: 30px;
height: 15px;
border-radius: 4px;
}
.status_small_rectangles {
@ -1827,8 +1841,9 @@ table[id^="service-table-"] {
width: 100%;
}
table > tbody > tr:nth-child(even),
table[id^="service-table-"] > tbody > tr:nth-child(even) {
background-color: #ebebeb;
background-color: #e5e9ed;
}
table[id^="service-table-"] a strong {
@ -1839,3 +1854,12 @@ table[id^="service-table-"] a strong {
margin-top: 15px;
margin-bottom: 15px;
}
.ml5px {
margin-left: 5px;
}
.close-button-dialog {
padding: 2px 7px !important;
margin-right: 5px !important;
}

View File

@ -782,6 +782,10 @@ class Ui
$dialogHtml .= "</div>\n";
$dialogHtml .= "</div>\n";
if ($options['return_html_dialog'] === true) {
return $dialogHtml;
}
$this->dialogs[$type][] = $dialogHtml;
}

View File

@ -191,10 +191,7 @@ class Agent
$address = $this->agent['direccion'];
$ip .= (empty($address) === true) ? '<em>'.__('N/A').'</em>' : $address;
$last_contact = '<b>'.__('Last contact').'</b>:&nbsp;';
$last_contact .= ui_print_timestamp(
$this->agent['ultimo_contacto'],
true
);
$last_contact .= human_time_comparation($this->agent['ultimo_contacto'], 'tiny');
if (empty($agent['comentarios']) === true) {
$description .= '<i>'.__('N/A').'</i>';
@ -213,7 +210,7 @@ class Agent
false,
false,
false,
['class' => 'invert_filter os-big-icon'],
['class' => 'invert_filter main_menu_icon'],
false
).'</div>';
$html .= '<div class="agent_list_ips">';

View File

@ -97,6 +97,7 @@ class Agents
$agent[6] = '<b class="ui-table-cell-label">'.__('Status').'</b>'.$agent[6];
$agent[7] = '<b class="ui-table-cell-label">'.__('Alerts').'</b>'.$agent[7];
$agent[8] = '<b class="ui-table-cell-label">'.__('Last contact').'</b>'.$agent[8];
$agent[9] = '<b class="ui-table-cell-label">'.__('Last status change').'</b>'.$agent[9];
$agents[$key] = $agent;
}
@ -406,12 +407,12 @@ class Agents
$row[5] = $row[__('Status')] = '<span class="show_collapside align-none-10p">'.__('S.').' </span>'.$img_status;
$row[6] = $row[__('Alerts')] = '<span class="show_collapside align-none-10p">&nbsp;&nbsp;'.__('A.').' </span>'.$img_alert;
$row[7] = $row[__('Modules')] = '<span class="show_collapside align-none-0p">'.__('Modules').' </span>'.'<span class="agents_tiny_stats">'.reporting_tiny_stats($agent, true, 'agent', '&nbsp;').' </span>';
$row[7] = $row[__('Modules')] = '<span class="agents_tiny_stats">'.reporting_tiny_stats($agent, true, 'agent', ':').' </span>';
$last_time = time_w_fixed_tz($agent['ultimo_contacto']);
$now = get_system_time();
$diferencia = ($now - $last_time);
$time = ui_print_timestamp($last_time, true, ['style' => 'font-size: 12px; margin-left: 20px;', 'units' => 'tiny']);
$time = human_time_comparation($agent['ultimo_contacto'], 'tiny');
$style = '';
if ($diferencia > ($agent['intervalo'] * 2)) {
$row[8] = $row[__('Last contact')] = '<b><span class="color_ff0">'.$time.'</span></b>';
@ -419,7 +420,10 @@ class Agents
$row[8] = $row[__('Last contact')] = $time;
}
$row[8] = $row[__('Last contact')] = '<span class="show_collapside align-none-0p">'.__('Last contact').' </span>'.'<span class="agents_last_contact">'.$row[__('Last contact')].'</span>';
$row[8] = $row[__('Last contact')] = '<span class="agents_last_contact">'.$row[__('Last contact')].'</span>';
$last_status_change = human_time_comparation(agents_get_last_status_change($agent['id_agente']), 'tiny');
$row[9] = $row[__('Last status change')] = '<span class="agents_last_contact">'.$last_status_change.'</span>';
if (!$ajax) {
unset($row[0]);
@ -431,6 +435,7 @@ class Agents
unset($row[6]);
unset($row[7]);
unset($row[8]);
unset($row[9]);
}
$agents[$agent['id_agente']] = $row;
@ -513,6 +518,7 @@ class Agents
\"<td class='cell_4'>\" + agent[6] + \"</td>\" +
\"<td class='cell_5'>\" + agent[7] + \"</td>\" +
\"<td class='cell_6'>\" + agent[8] + \"</td>\" +
\"<td class='cell_7'>\" + agent[9] + \"</td>\" +
\"</tr>\");
});

View File

@ -345,7 +345,7 @@ class Alerts
);
$row[__('Last Fired')] = sprintf(
$disabled_style,
ui_print_timestamp($alert['last_fired'], true)
human_time_comparation($alert['last_fired'], 'tiny')
);
$row[__('Status')] = ui_print_status_image($status, $title, true);

View File

@ -326,10 +326,7 @@ class Events
$event['clean_tags'] = events_clean_tags(
$event['tags']
);
$event['timestamp'] = date(
$system->getConfig('date_format'),
$event['utimestamp']
);
$event['timestamp'] = human_time_comparation($event['utimestamp'], 'tiny');
if (empty($event['owner_user']) === true) {
$event['owner_user'] = '<i>'.__('N/A').'</i>';
} else {
@ -380,30 +377,30 @@ class Events
switch ($event['criticity']) {
default:
case 0:
$img_sev = 'images/status_sets/default/severity_maintenance.png';
$img_sev = 'images/status_sets/default/severity_maintenance_rounded.png';
break;
case 1:
$img_sev = 'images/status_sets/default/severity_informational.png';
$img_sev = 'images/status_sets/default/severity_informational_rounded.png';
break;
case 2:
$img_sev = 'images/status_sets/default/severity_normal.png';
$img_sev = 'images/status_sets/default/severity_normal_rounded.png';
break;
case 3:
$img_sev = 'images/status_sets/default/severity_warning.png';
$img_sev = 'images/status_sets/default/severity_warning_rounded.png';
break;
case 4:
$img_sev = 'images/status_sets/default/severity_critical.png';
$img_sev = 'images/status_sets/default/severity_critical_rounded.png';
break;
case 5:
$img_sev = 'images/status_sets/default/severity_minor.png';
$img_sev = 'images/status_sets/default/severity_minor_rounded.png';
break;
case 6:
$img_sev = 'images/status_sets/default/severity_major.png';
$img_sev = 'images/status_sets/default/severity_major_rounded.png';
break;
}
@ -412,9 +409,8 @@ class Events
$img_sev,
true,
[
'class' => 'image_status',
'width' => 12,
'height' => 12,
'width' => 30,
'height' => 15,
'title' => $event_criticity,
],
false,
@ -879,7 +875,7 @@ class Events
$options['content_text'] .= '<div id="validate_button_fail" class="invisible center">
<h3 class="color_ff0">'.__('Fail validate').'</h3></div>';
$options['button_close'] = false;
$options['button_close'] = true;
return $options;
}
@ -1209,8 +1205,6 @@ class Events
if (data.correct) {
event = data.event;
//Fill the dialog
$("#detail_event_dialog h1.dialog_title")
.html(event["evento"]);
$("#detail_event_dialog .cell_event_name")
.html(event["evento"]);
$("#detail_event_dialog .cell_event_id")
@ -1256,6 +1250,12 @@ class Events
$("#validate_button_correct").hide();
$.mobile.loading( "hide" );
$("#detail_event_dialog_hook").click();
$("#detail_event_dialog-button_close").html("X");
$("#detail_event_dialog-button_close").addClass("close-button-dialog");
$(".dialog_title").addClass("ml5px");
$(".dialog_title").parent().addClass("flex align-items-center space-between");
$(".dialog_title").parent().append($("#detail_event_dialog-button_close"));
}
else {
$.mobile.loading( "hide" );

View File

@ -591,7 +591,18 @@ class Modules
}
}
$row[0] = $row[__('Module name')] = '<span class="tiny mrgn_right_5px">'.$image_status.'</span>'.'<span class="data module_name">'.ui_print_truncate_text($module['module_name'], 30, false).'</span>';
$script = '';
if ($system->getRequest('page') === 'modules') {
if ($system->getConfig('metaconsole')) {
$script = 'onclick="openDialog('.$module['id_agente_modulo'].', '.$this->id_agent.' ,'.$module['server_id'].');"';
} else {
$script = 'onclick="openDialog('.$module['id_agente_modulo'].', '.$this->id_agent.', \'node\');"';
}
$row[0] = $row[__('Module name')] = '<span '.$script.'><span class="tiny mrgn_right_5px">'.$image_status.'</span>'.'<span class="data module_name">'.ui_print_truncate_text($module['module_name'], 30, false).'</span></span>';
} else {
$row[0] = $row[__('Module name')] = '<span class="tiny mrgn_right_5px">'.$image_status.'</span>'.'<span class="data module_name">'.ui_print_truncate_text($module['module_name'], 30, false).'</span>';
}
if ($this->columns['agent']) {
$row[1] = $row[__('Agent name')] = '<span class="data"><span class="show_collapside bolder invisible">'.__('Agent').' </span>'.ui_print_truncate_text($module['agent_alias'], 50, false).'</span>';
@ -658,7 +669,7 @@ class Modules
$row[4] = $row[__('Interval')] = '<span class="data"><span class="show_collapside bolder invisible">'.__('Interval.').' </span>'.$row[__('Interval')].'</span>';
$row[6] = $row[__('Timestamp')] = '<span class="data"><span class="show_collapside bolder invisible">'.__('Last update.').' </span>'.ui_print_timestamp($module['utimestamp'], true, ['units' => 'tiny']).'</span>';
$row[6] = $row[__('Timestamp')] = '<span class="data"><span class="show_collapside bolder invisible">'.__('Last update.').' </span>'.human_time_comparation($module['utimestamp'], 'tiny').'</span>';
if (is_numeric($module['datos'])) {
$output = format_numeric($module['datos']);
@ -712,29 +723,50 @@ class Modules
);
// Row 7.
$row[__('Data')] = ui_get_snapshot_image($link, $is_snapshot).'&nbsp;&nbsp;';
$row[7] = $row[__('Data')] = ui_get_snapshot_image($link, $is_snapshot).'&nbsp;&nbsp;';
} else {
if ($system->getConfig('metaconsole')) {
$row[__('Data')] = '<span class="nowrap">';
$row[__('Data')] .= '<span class="show_collapside invisible">';
$row[__('Data')] .= $row[__('Status')].'&nbsp;&nbsp;</span>';
$row[__('Data')] .= '<a data-ajax="false" class="ui-link" ';
$row[__('Data')] .= 'href="index.php?page=module_graph&id='.$module['id_agente_modulo'];
$row[__('Data')] .= '&server_id='.$module['server_id'];
$row[__('Data')] .= '&id_agent='.$this->id_agent.'">';
$row[__('Data')] .= $output.'</a></span>';
// Row 7.
$row[__('Data')];
if ($system->getRequest('page') === 'modules') {
if ($system->getConfig('metaconsole')) {
$row[7] = $row[__('Data')] = '<span class="nowrap">';
$row[7] = $row[__('Data')] .= '<span class="show_collapside invisible">';
$row[7] = $row[__('Data')] .= $row[__('Status')].'&nbsp;&nbsp;</span>';
$row[7] = $row[__('Data')] .= '<a data-ajax="false" class="ui-link" ';
$row[7] = $row[__('Data')] .= 'href="#">';
$row[7] = $row[__('Data')] .= $output.'</a></span>';
// Row 7.
$row[7] = $row[__('Data')];
} else {
// Row 7.
$row[7] = $row[__('Data')] = '<span class="nowrap">';
$row[7] = $row[__('Data')] .= '<span class="show_collapside invisible">';
$row[7] = $row[__('Data')] .= $row[__('Status')].'&nbsp;&nbsp;</span>';
$row[7] = $row[__('Data')] .= '<a data-ajax="false" class="ui-link" ';
$row[7] = $row[__('Data')] .= 'href="#">';
$row[7] = $row[__('Data')] .= $output.'</a></span>';
}
} else {
// Row 7.
$row[__('Data')] = '<span class="nowrap">';
$row[__('Data')] .= '<span class="show_collapside invisible">';
$row[__('Data')] .= $row[__('Status')].'&nbsp;&nbsp;</span>';
$row[__('Data')] .= '<a data-ajax="false" class="ui-link" ';
$row[__('Data')] .= 'href="index.php?page=module_graph&id=';
$row[__('Data')] .= $module['id_agente_modulo'];
$row[__('Data')] .= '&id_agent='.$this->id_agent.'">';
$row[__('Data')] .= $output.'</a></span>';
if ($system->getConfig('metaconsole')) {
$row[__('Data')] = '<span class="nowrap">';
$row[__('Data')] .= '<span class="show_collapside invisible">';
$row[__('Data')] .= $row[__('Status')].'&nbsp;&nbsp;</span>';
$row[__('Data')] .= '<a data-ajax="false" class="ui-link" ';
$row[__('Data')] .= 'href="index.php?page=module_graph&id='.$module['id_agente_modulo'];
$row[__('Data')] .= '&server_id='.$module['server_id'];
$row[__('Data')] .= '&id_agent='.$this->id_agent.'">';
$row[__('Data')] .= $output.'</a></span>';
// Row 7.
$row[__('Data')];
} else {
// Row 7.
$row[__('Data')] = '<span class="nowrap">';
$row[__('Data')] .= '<span class="show_collapside invisible">';
$row[__('Data')] .= $row[__('Status')].'&nbsp;&nbsp;</span>';
$row[__('Data')] .= '<a data-ajax="false" class="ui-link" ';
$row[__('Data')] .= 'href="index.php?page=module_graph&id=';
$row[__('Data')] .= $module['id_agente_modulo'];
$row[__('Data')] .= '&id_agent='.$this->id_agent.'">';
$row[__('Data')] .= $output.'</a></span>';
}
}
}
@ -804,6 +836,30 @@ class Modules
}
}
$ui->contentAddHtml(
'<a id="module-dialog-button" href="#module-dialog" data-rel="popup" data-position-to="window"
data-transition="pop" class="ui-btn ui-corner-all ui-btn-inline ui-icon-delete ui-btn-icon-left ui-btn-b">
</a>
<div data-role="popup" id="module-dialog" data-overlay-theme="b" data-dismissible="false" style="max-width:100%; width: 100%;">
<div data-role="header" data-theme="a">
<h1 style="margin-left: 10px;"> '.__('Choose option').'</h1>
</div>
<div role="main" class="ui-content">
<a href="#" class="ui-btn ui-corner-all ui-btn-inline ui-btn-b" data-rel="back">'.__('Cancel').'</a>
<a id="graph-option" href="#" class="ui-btn ui-corner-all ui-btn-inline ui-btn-b">
'.__('Graph').'
</a>
<a id="historical-option" href="#" class="ui-btn ui-corner-all ui-btn-inline ui-btn-b" data-rel="back" data-transition="flow">
'.__('Historical data').'
</a>
</div>
</div>'
);
$ui->contentAddLinkListener('list_Modules');
}
@ -850,8 +906,8 @@ class Modules
\"<td class='cell_2'><b class='ui-table-cell-label'>".__('Status')."</b>\" + module[5] + \"</td>\" +
\"<td class='cell_3'><b class='ui-table-cell-label'>".__('Interval')."</b>\" + module[4] + \"</td>\" +
\"<td class='cell_4'><b class='ui-table-cell-label'>".__('Timestamp')."</b>\" + module[6] + \"</td>\" +
\"<td class='cell_5'><b class='ui-table-cell-label'>".__('Data').'</b>" + module[7] + "</td>" +
"</tr>");
\"<td class='cell_5'><b class='ui-table-cell-label'>".__('Data')."</b>\" + module[7] + \"</td>\" +
\"</tr>\");
});
load_more_rows = 1;
@ -860,21 +916,36 @@ class Modules
},
"json");
\"json\");
}
}
}
function openDialog(moduleId, agentId, serverId) {
console.log(1);
var graph = '';
var historical = '';
if (serverId === 'node') {
graph = 'index.php?page=module_graph&id='+moduleId+'&id_agent='+agentId;
} else {
graph = 'index.php?page=module_graph&id='+moduleId+'&id_agent='+agentId+'&server_id='+serverId;
}
$('#graph-option').attr('href', graph);
$('#module-dialog-button').click();
}
$(document).ready(function() {
$(window).bind("scroll", function () {
$(window).bind(\"scroll\", function () {
custom_scroll();
});
$(window).on("touchmove", function(event) {
$(window).on(\"touchmove\", function(event) {
custom_scroll();
});
});
</script>'
});
</script>"
);
}