Visual changes PDFs slicebar

This commit is contained in:
Jonathan 2023-03-14 13:26:21 +01:00
parent fcdd585042
commit 00ba02e23e
6 changed files with 54 additions and 29 deletions

View File

@ -27,8 +27,6 @@
*/ */
// Begin. // Begin.
require_once 'config.php';
require_once __DIR__.'/config.php'; require_once __DIR__.'/config.php';
require_once __DIR__.'/functions.php'; require_once __DIR__.'/functions.php';
require_once __DIR__.'/functions_db.php'; require_once __DIR__.'/functions_db.php';
@ -87,7 +85,7 @@ if (check_login(false) === false) {
</head> </head>
<body> <body>
<h1>Access is not granted</h1> <h1>Access is not granted</h1>
<div id="container-chart-generator-item" style="display:none; margin:0px;"> <div id="container-chart-generator-item" style="display:none; margin:0px;width:100px;height:100px;">
</body> </body>
</html> </html>
@ -246,6 +244,9 @@ if (file_exists('languages/'.$user_language.'.mo') === true) {
break; break;
case 'slicebar': case 'slicebar':
// TO-DO Cambiar esto para que se pase por POST, NO SE PUEDE PASAR POR GET.
$params['graph_data'] = json_decode(io_safe_output($config[$params['tokem_config']]), true);
delete_config_token($params['tokem_config']);
echo flot_slicesbar_graph( echo flot_slicesbar_graph(
$params['graph_data'], $params['graph_data'],
$params['period'], $params['period'],

View File

@ -3548,6 +3548,18 @@ function update_config_token($cfgtoken, $cfgvalue)
} }
function delete_config_token($cfgtoken)
{
$delete = db_process_sql(sprintf('DELETE FROM tconfig WHERE token = "%s"', $cfgtoken));
if ($delete) {
return true;
} else {
return false;
}
}
function get_number_of_mr($package, $ent, $offline) function get_number_of_mr($package, $ent, $offline)
{ {
global $config; global $config;
@ -4275,6 +4287,7 @@ function generator_chart_to_pdf(
]; ];
} }
unset($data['data']['graph_data']);
// If not install chromium avoid 500 convert tu images no data to show. // If not install chromium avoid 500 convert tu images no data to show.
$chromium_dir = io_safe_output($config['chromium_path']); $chromium_dir = io_safe_output($config['chromium_path']);
$result_ejecution = exec($chromium_dir.' --version'); $result_ejecution = exec($chromium_dir.' --version');

View File

@ -2668,7 +2668,7 @@ function events_print_type_img(
switch ($type) { switch ($type) {
case 'alert_recovered': case 'alert_recovered':
$icon = 'images/alert@svg.svg'; $style .= ' alert_module_background_state icon_background_normal ';
break; break;
case 'alert_manual_validation': case 'alert_manual_validation':

View File

@ -1053,17 +1053,17 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
$table1->head = []; $table1->head = [];
if ($item['show_summary_group']) { if ($item['show_summary_group']) {
$table1->head[0] = __('Status'); $table1->head[0] = __('Status');
$table1->head[1] = __('Count'); $table1->head[1] = __('Type');
$table1->head[2] = __('Name'); $table1->head[2] = __('Count');
$table1->head[3] = __('Type'); $table1->head[3] = __('Name');
$table1->head[4] = __('Agent'); $table1->head[4] = __('Agent');
$table1->head[5] = __('Severity'); $table1->head[5] = __('Severity');
$table1->head[6] = __('Val. by'); $table1->head[6] = __('Val. by');
$table1->head[7] = __('Timestamp'); $table1->head[7] = __('Timestamp');
} else { } else {
$table1->head[0] = __('Status'); $table1->head[0] = __('Status');
$table1->head[1] = __('Name'); $table1->head[1] = __('Type');
$table1->head[2] = __('Type'); $table1->head[2] = __('Name');
$table1->head[3] = __('Agent'); $table1->head[3] = __('Agent');
$table1->head[4] = __('Severity'); $table1->head[4] = __('Severity');
$table1->head[5] = __('Val. by'); $table1->head[5] = __('Val. by');
@ -1077,15 +1077,15 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
foreach ($item['data'] as $k => $event) { foreach ($item['data'] as $k => $event) {
// First pass along the class of this row. // First pass along the class of this row.
if ($item['show_summary_group']) { if ($item['show_summary_group']) {
$table1->cellclass[$k][1] = get_priority_class($event['criticity']);
$table1->cellclass[$k][2] = get_priority_class($event['criticity']); $table1->cellclass[$k][2] = get_priority_class($event['criticity']);
$table1->cellclass[$k][3] = get_priority_class($event['criticity']);
$table1->cellclass[$k][4] = get_priority_class($event['criticity']); $table1->cellclass[$k][4] = get_priority_class($event['criticity']);
$table1->cellclass[$k][5] = get_priority_class($event['criticity']); $table1->cellclass[$k][5] = get_priority_class($event['criticity']);
$table1->cellclass[$k][6] = get_priority_class($event['criticity']); $table1->cellclass[$k][6] = get_priority_class($event['criticity']);
$table1->cellclass[$k][7] = get_priority_class($event['criticity']); $table1->cellclass[$k][7] = get_priority_class($event['criticity']);
$table1->cellclass[$k][8] = get_priority_class($event['criticity']); $table1->cellclass[$k][8] = get_priority_class($event['criticity']);
} else { } else {
$table1->cellclass[$k][1] = get_priority_class($event['criticity']); $table1->cellclass[$k][2] = get_priority_class($event['criticity']);
$table1->cellclass[$k][3] = get_priority_class($event['criticity']); $table1->cellclass[$k][3] = get_priority_class($event['criticity']);
$table1->cellclass[$k][4] = get_priority_class($event['criticity']); $table1->cellclass[$k][4] = get_priority_class($event['criticity']);
$table1->cellclass[$k][5] = get_priority_class($event['criticity']); $table1->cellclass[$k][5] = get_priority_class($event['criticity']);
@ -1125,6 +1125,8 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
] ]
); );
$data[] = events_print_type_img($event['event_type'], true);
if ($item['show_summary_group']) { if ($item['show_summary_group']) {
$data[] = $event['event_rep']; $data[] = $event['event_rep'];
} }
@ -1136,8 +1138,6 @@ function reporting_html_event_report_group($table, $item, $pdf=0)
true true
); );
$data[] = events_print_type_img($event['event_type'], true);
if (empty($event['alias']) === false) { if (empty($event['alias']) === false) {
$alias = $event['alias']; $alias = $event['alias'];
if (is_metaconsole() === true) { if (is_metaconsole() === true) {
@ -1313,20 +1313,20 @@ function reporting_html_event_report_module($table, $item, $pdf=0)
$table1->class = 'info_table'; $table1->class = 'info_table';
$table1->data = []; $table1->data = [];
$table1->head = []; $table1->head = [];
$table1->align = []; $table1->align = 'left';
$table1->align[2] = 'center';
if ($show_summary_group) { if ($show_summary_group) {
$table1->head[0] = __('Status'); $table1->head[0] = __('Status');
$table1->head[1] = __('Event name'); $table1->head[1] = __('Type');
$table1->head[2] = __('Type'); $table1->head[2] = __('Event name');
$table1->head[3] = __('Severity'); $table1->head[3] = __('Severity');
$table1->head[4] = __('Count'); $table1->head[4] = __('Count');
$table1->head[5] = __('Timestamp'); $table1->head[5] = __('Timestamp');
$table1->style[0] = 'text-align: center;'; $table1->style[0] = 'text-align: center;';
} else { } else {
$table1->head[0] = __('Status'); $table1->head[0] = __('Status');
$table1->head[1] = __('Event name'); $table1->head[1] = __('Type');
$table1->head[2] = __('Type'); $table1->head[2] = __('Event name');
$table1->head[3] = __('Severity'); $table1->head[3] = __('Severity');
$table1->head[4] = __('Timestamp'); $table1->head[4] = __('Timestamp');
$table1->style[0] = 'text-align: center;'; $table1->style[0] = 'text-align: center;';
@ -1344,14 +1344,13 @@ function reporting_html_event_report_module($table, $item, $pdf=0)
foreach ($item_data as $i => $event) { foreach ($item_data as $i => $event) {
$data = []; $data = [];
if ($show_summary_group) { if ($show_summary_group) {
$table1->cellclass[$i][1] = get_priority_class($event['criticity']);
$table1->cellclass[$i][2] = get_priority_class($event['criticity']); $table1->cellclass[$i][2] = get_priority_class($event['criticity']);
$table1->cellclass[$i][3] = get_priority_class($event['criticity']); $table1->cellclass[$i][3] = get_priority_class($event['criticity']);
$table1->cellclass[$i][4] = get_priority_class($event['criticity']); $table1->cellclass[$i][4] = get_priority_class($event['criticity']);
$table1->cellclass[$i][5] = get_priority_class($event['criticity']); $table1->cellclass[$i][5] = get_priority_class($event['criticity']);
$table1->cellclass[$i][6] = get_priority_class($event['criticity']); $table1->cellclass[$i][6] = get_priority_class($event['criticity']);
} else { } else {
$table1->cellclass[$i][1] = get_priority_class($event['criticity']); $table1->cellclass[$i][2] = get_priority_class($event['criticity']);
$table1->cellclass[$i][3] = get_priority_class($event['criticity']); $table1->cellclass[$i][3] = get_priority_class($event['criticity']);
$table1->cellclass[$i][4] = get_priority_class($event['criticity']); $table1->cellclass[$i][4] = get_priority_class($event['criticity']);
$table1->cellclass[$i][6] = get_priority_class($event['criticity']); $table1->cellclass[$i][6] = get_priority_class($event['criticity']);
@ -1386,8 +1385,9 @@ function reporting_html_event_report_module($table, $item, $pdf=0)
'id' => 'status_img_'.$event['id_evento'], 'id' => 'status_img_'.$event['id_evento'],
] ]
); );
$data[1] = io_safe_output($event['evento']);
$data[2] = events_print_type_img($event['event_type'], true); $data[1] = events_print_type_img($event['event_type'], true);
$data[2] = io_safe_output($event['evento']);
$data[3] = get_priority_name($event['criticity']); $data[3] = get_priority_name($event['criticity']);
if ($show_summary_group) { if ($show_summary_group) {
$data[4] = $event['event_rep']; $data[4] = $event['event_rep'];
@ -2657,12 +2657,12 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
$table1->head = []; $table1->head = [];
$table1->head[0] = __('Status'); $table1->head[0] = __('Status');
$table1->head[3] = __('Type');
if ($item['show_summary_group']) { if ($item['show_summary_group']) {
$table1->head[1] = __('Count'); $table1->head[1] = __('Count');
} }
$table1->head[2] = __('Name'); $table1->head[2] = __('Name');
$table1->head[3] = __('Type');
$table1->head[4] = __('Severity'); $table1->head[4] = __('Severity');
$table1->head[5] = __('Val. by'); $table1->head[5] = __('Val. by');
$table1->head[6] = __('Timestamp'); $table1->head[6] = __('Timestamp');
@ -2672,14 +2672,14 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
foreach ($item['data'] as $i => $event) { foreach ($item['data'] as $i => $event) {
if ($item['show_summary_group']) { if ($item['show_summary_group']) {
$table1->cellclass[$i][1] = get_priority_class($event['criticity']);
$table1->cellclass[$i][2] = get_priority_class($event['criticity']); $table1->cellclass[$i][2] = get_priority_class($event['criticity']);
$table1->cellclass[$i][3] = get_priority_class($event['criticity']);
$table1->cellclass[$i][4] = get_priority_class($event['criticity']); $table1->cellclass[$i][4] = get_priority_class($event['criticity']);
$table1->cellclass[$i][5] = get_priority_class($event['criticity']); $table1->cellclass[$i][5] = get_priority_class($event['criticity']);
$table1->cellclass[$i][6] = get_priority_class($event['criticity']); $table1->cellclass[$i][6] = get_priority_class($event['criticity']);
$table1->cellclass[$i][7] = get_priority_class($event['criticity']); $table1->cellclass[$i][7] = get_priority_class($event['criticity']);
} else { } else {
$table1->cellclass[$i][1] = get_priority_class($event['criticity']); $table1->cellclass[$i][2] = get_priority_class($event['criticity']);
$table1->cellclass[$i][3] = get_priority_class($event['criticity']); $table1->cellclass[$i][3] = get_priority_class($event['criticity']);
$table1->cellclass[$i][4] = get_priority_class($event['criticity']); $table1->cellclass[$i][4] = get_priority_class($event['criticity']);
$table1->cellclass[$i][5] = get_priority_class($event['criticity']); $table1->cellclass[$i][5] = get_priority_class($event['criticity']);
@ -2716,6 +2716,8 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
] ]
); );
$data[] = events_print_type_img($event['type'], true);
if ($item['show_summary_group']) { if ($item['show_summary_group']) {
$data[] = $event['count']; $data[] = $event['count'];
} }
@ -2727,8 +2729,6 @@ function reporting_html_event_report_agent($table, $item, $pdf=0)
true true
); );
$data[] = events_print_type_img($event['type'], true);
$data[] = get_priority_name($event['criticity']); $data[] = get_priority_name($event['criticity']);
if (empty($event['validated_by']) && $event['status'] == EVENT_VALIDATE) { if (empty($event['validated_by']) && $event['status'] == EVENT_VALIDATE) {
$data[] = '<i>'.__('System').'</i>'; $data[] = '<i>'.__('System').'</i>';
@ -3919,6 +3919,8 @@ function reporting_html_value(
if ($item['visual_format'] != 2) { if ($item['visual_format'] != 2) {
$table1 = new stdClass(); $table1 = new stdClass();
$table1->width = '100%'; $table1->width = '100%';
$table1->headstyle[0] = 'text-align:left';
$table1->headstyle[1] = 'text-align:left';
switch ($item['type']) { switch ($item['type']) {
case 'max_value': case 'max_value':
$table1->head = [ $table1->head = [

View File

@ -730,8 +730,9 @@ function flot_slicesbar_graph(
global $config; global $config;
if ($ttl == 2) { if ($ttl == 2) {
$tokem_config = uniqid('slicebar');
$params = [ $params = [
'graph_data' => $graph_data, 'tokem_config' => $tokem_config,
'period' => $period, 'period' => $period,
'width' => $width, 'width' => $width,
'height' => $height, 'height' => $height,
@ -752,7 +753,10 @@ function flot_slicesbar_graph(
'return_img_base_64' => true, 'return_img_base_64' => true,
'date_to' => $date_to, 'date_to' => $date_to,
'server_id' => $server_id, 'server_id' => $server_id,
'backgroundColor' => '#f6f7fb',
]; ];
// TO-DO Cambiar esto para que se pase por POST, NO SE PUEDE PASAR POR GET.
update_config_token($tokem_config, json_encode($graph_data));
$graph = '<img src="data:image/png;base64,'; $graph = '<img src="data:image/png;base64,';
$graph .= generator_chart_to_pdf('slicebar', $params); $graph .= generator_chart_to_pdf('slicebar', $params);

View File

@ -482,6 +482,11 @@ div.multi-response-buttons {
-webkit-mask: url(../../images/modules@svg.svg) no-repeat center / contain; -webkit-mask: url(../../images/modules@svg.svg) no-repeat center / contain;
} }
.alert_module_background_state {
mask: url(../../images/alert@svg.svg) no-repeat center / contain;
-webkit-mask: url(../../images/alert@svg.svg) no-repeat center / contain;
}
.icon_background_critical { .icon_background_critical {
background-color: #e63c52; background-color: #e63c52;
} }