Merge branch 'ent-5140-Añadir-summary-al-availability-graph' into 'develop'

add summary report availability graph

See merge request artica/pandorafms!3709
This commit is contained in:
Daniel Rodriguez 2021-03-09 16:32:12 +00:00
commit 950b7bcdfd
7 changed files with 89 additions and 20 deletions

View File

@ -1,5 +1,8 @@
START TRANSACTION;
ALTER TABLE `treport_content` ADD COLUMN `summary` tinyint(1) DEFAULT 0;
ALTER TABLE `treport_content_template` ADD COLUMN `summary` tinyint(1) DEFAULT 0;
ALTER TABLE `tinventory_alert` ADD COLUMN `alert_groups` TEXT NOT NULL;
UPDATE `tinventory_alert` t1 INNER JOIN `tinventory_alert` t2 ON t1.id = t2.id SET t1.alert_groups = t2.id_group;

View File

@ -865,6 +865,7 @@ ALTER TABLE `treport_content_template` ADD COLUMN `agent_min_value` TINYINT(1) D
ALTER TABLE `treport_content_template` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `failover_type` tinyint(1) DEFAULT '1';
ALTER TABLE `treport_content_template` ADD COLUMN `summary` tinyint(1) DEFAULT 0;
ALTER TABLE `treport_content_template` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '0';
ALTER TABLE `treport_content_template` MODIFY COLUMN `historical_db` tinyint(1) unsigned NOT NULL DEFAULT '0',
MODIFY COLUMN `lapse_calc` tinyint(1) unsigned NOT NULL DEFAULT '0',
@ -1725,6 +1726,7 @@ ALTER TABLE `treport_content` ADD COLUMN `agent_min_value` TINYINT(1) DEFAULT '1
ALTER TABLE `treport_content` ADD COLUMN `current_month` TINYINT(1) DEFAULT '1';
ALTER TABLE `treport_content` ADD COLUMN `failover_mode` tinyint(1) DEFAULT '0';
ALTER TABLE `treport_content` ADD COLUMN `failover_type` tinyint(1) DEFAULT '0';
ALTER TABLE `treport_content` ADD COLUMN `summary` tinyint(1) DEFAULT 0;
ALTER table `treport_content` MODIFY COLUMN `name` varchar(300) NULL;
ALTER TABLE `treport_content` ADD COLUMN `uncompressed_module` TINYINT DEFAULT '0';
ALTER TABLE `treport_content` MODIFY COLUMN `historical_db` tinyint(1) unsigned NOT NULL DEFAULT '0',

View File

@ -185,6 +185,7 @@ switch ($action) {
$dyn_height = 230;
$landscape = false;
$pagebreak = false;
$summary = 0;
break;
case 'save':
@ -314,11 +315,12 @@ switch ($action) {
$idCustomGraph = $item['id_gs'];
break;
case 'availability_graph':
$summary = $item['summary'];
case 'SLA':
case 'SLA_weekly':
case 'SLA_monthly':
case 'SLA_hourly':
case 'availability_graph':
$description = $item['description'];
$only_display_wrong = $item['only_display_wrong'];
$monday = $item['monday'];
@ -2750,6 +2752,27 @@ $class = 'databox filters';
</td>
</tr>
<tr id="row_summary" style="" class="datos">
<td style="font-weight:bold;">
<?php
echo __('Summary');
?>
</td>
<td style="">
<?php
html_print_checkbox_switch(
'summary',
1,
$summary,
false,
false,
'',
false
);
?>
</td>
</tr>
<tr id="row_filter_search" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Include filter'); ?></td>
<td>
@ -5116,6 +5139,7 @@ function chooseType() {
$("#row_current_month").hide();
$("#row_failover_mode").hide();
$("#row_failover_type").hide();
$("#row_summary").hide();
$("#row_working_time").hide();
$("#row_working_time_compare").hide();
$("#row_only_display_wrong").hide();
@ -5310,6 +5334,7 @@ function chooseType() {
if(failover_checked){
$("#row_failover_type").show();
}
$("#row_summary").show();
break;
case 'module_histogram_graph':

View File

@ -1518,12 +1518,16 @@ switch ($action) {
$values['text'] = $intervals;
break;
case 'availability_graph':
$values['summary'] = get_parameter(
'summary',
0
);
case 'SLA_monthly':
case 'SLA_weekly':
case 'SLA_hourly':
case 'SLA_services':
case 'SLA':
case 'availability_graph':
$values['period'] = get_parameter('period');
$values['top_n'] = get_parameter(
'combo_sla_sort_options',
@ -2570,6 +2574,11 @@ switch ($action) {
REPORT_FAILOVER_TYPE_NORMAL
);
$values['summary'] = get_parameter(
'summary',
0
);
$style = [];
$style['show_in_same_row'] = get_parameter(
'show_in_same_row',

View File

@ -7551,6 +7551,7 @@ function reporting_availability_graph(
$return['pagebreak'] = $content['pagebreak'];
$return['description'] = $content['description'];
$return['failover_type'] = $content['failover_type'];
$return['summary'] = $content['summary'];
$return['date'] = reporting_get_date_text($report, $content);
// Get chart.
@ -7669,24 +7670,22 @@ function reporting_availability_graph(
}
foreach ($sla_failover as $k_sla => $v_sla) {
if ($content['failover_type'] == REPORT_FAILOVER_TYPE_NORMAL) {
$sla_array = data_compare_24x7(
$v_sla,
$content,
$report['datetime'],
$slice
);
$sla_array = data_compare_24x7(
$v_sla,
$content,
$report['datetime'],
$slice
);
$return = prepare_data_for_paint(
$v_sla,
$sla_array,
$content,
$report['datetime'],
$return,
$k_sla,
$pdf
);
}
$return = prepare_data_for_paint(
$v_sla,
$sla_array,
$content,
$report['datetime'],
$return,
$k_sla,
$pdf
);
if (isset($v_sla['compare']) === true
&& empty($v_sla['compare']) === false

View File

@ -3835,6 +3835,10 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
$tables_chart = '';
$total_values = 0;
$count_total_charts = 0;
if (isset($item['failed']) === true && empty($item['failed']) === false) {
$tables_chart .= $item['failed'];
} else {
@ -3896,6 +3900,8 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
$table1->data[$k_chart][0] .= ' (24 x 7)';
}
$total_values += $sla_value;
$count_total_charts++;
$table1->data[$k_chart][1] = $chart['chart'];
$table1->data[$k_chart][2] = "<span style = 'font-weight: bold; font-size: ".$font_size.'; color: '.$color."'>".$sla_value.'</span><br/>';
@ -3922,7 +3928,7 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
|| $item['data'][$k_chart]['compare'] === 1)
) {
$table1 = new stdClass();
$table1->width = '99%';
$table1->width = '100%';
$table1->data = [];
$table1->size = [];
$table1->size[0] = '10%';
@ -3971,6 +3977,8 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
case 'result':
default:
$total_values += $sla_value;
$count_total_charts++;
$title = '<b>'.__('Result').'</b>';
$sla_value_text = "<span style = 'font-weight: bold; font-size: ".$font_size.' !important; color: '.$color."'>".$sla_value.'</span>';
$checks_resume_text = '<span style = "font-size: '.$font_mini.';">';
@ -3996,6 +4004,27 @@ function reporting_html_availability_graph($table, $item, $pdf=0)
}
}
if ((bool) $item['summary'] === true) {
$table_summary = new stdClass();
$table_summary->width = '20%';
$table_summary->size = [];
$table_summary->size[0] = '50%';
$table_summary->size[1] = '50%';
$table_summary->data = [];
$table_summary->data[0][0] = '<b>'.__('Summary').'</b>';
$table_summary->data[0][1] = '<span style = "font-weight: bold; font-size: '.$font_size.' !important;">';
$table_summary->data[0][1] .= sla_truncate($total_values / $count_total_charts);
$table_summary->data[0][1] .= ' %';
$table_summary->data[0][1] .= '</span>';
$tables_chart .= html_print_table(
$table_summary,
true
);
}
if ($item['type'] == 'availability_graph') {
// Table_legend_graphs.
$table2 = new stdClass();

View File

@ -1560,6 +1560,7 @@ CREATE TABLE IF NOT EXISTS `treport_content` (
`failover_mode` tinyint(1) DEFAULT '1',
`failover_type` tinyint(1) DEFAULT '1',
`uncompressed_module` TINYINT DEFAULT '0',
`summary` tinyint(1) DEFAULT 0,
`landscape` tinyint(1) UNSIGNED NOT NULL default 0,
`pagebreak` tinyint(1) UNSIGNED NOT NULL default 0,
`compare_work_time` tinyint(1) UNSIGNED NOT NULL default 0,
@ -3163,6 +3164,7 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` (
`current_month` TINYINT(1) DEFAULT '1',
`failover_mode` tinyint(1) DEFAULT '1',
`failover_type` tinyint(1) DEFAULT '1',
`summary` tinyint(1) DEFAULT 0,
`uncompressed_module` TINYINT DEFAULT '0',
`landscape` tinyint(1) UNSIGNED NOT NULL default 0,
`pagebreak` tinyint(1) UNSIGNED NOT NULL default 0,