fixed bug: hide not init agents not working in report item creation

This commit is contained in:
alejandro-campos 2018-09-10 13:01:48 +02:00
parent 6511f67600
commit 3c25125713
1 changed files with 23 additions and 15 deletions

View File

@ -381,7 +381,7 @@ function reporting_html_SLA($table, $item, $mini) {
}
}
if(isset($item['data'])){
if(!(!isset($item['data']) && $hide_notinit_agent == 1)) {
$table1 = new stdClass();
$table1->width = '99%';
@ -471,20 +471,23 @@ function reporting_html_SLA($table, $item, $mini) {
foreach ($item['data'] as $sla) {
if(isset($sla)){
$the_first_men_time = get_agent_first_time(io_safe_output($sla['agent']));
if (!$hide_notinit_agent) {
//first_table
$row = array();
$row[] = $sla['agent'];
$row[] = $sla['module'];
if(is_numeric($sla['dinamic_text'])){
$row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " .
sla_truncate($sla['min'], $config['graph_precision']);
}
else{
$row[] = $sla['dinamic_text'];
}
$row[] = round($sla['sla_limit'], 2) . "%";
//first_table
$row = array();
$row[] = $sla['agent'];
$row[] = $sla['module'];
if(is_numeric($sla['dinamic_text'])){
$row[] = sla_truncate($sla['max'], $config['graph_precision']) . " / " .
sla_truncate($sla['min'], $config['graph_precision']);
}
else{
$row[] = $sla['dinamic_text'];
}
$row[] = round($sla['sla_limit'], 2) . "%";
if (!$hide_notinit_agent) {
if (reporting_sla_is_not_init_from_array($sla)) {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NOTINIT.';">' .
@ -646,6 +649,11 @@ function reporting_html_SLA($table, $item, $mini) {
$table->colspan['checks_global']['cell'] = 2;
$table->data['checks_global']['cell'] = html_print_table($table3, true);
}
else {
$table->colspan['error']['cell'] = 3;
$table->data['error']['cell'] =
__('There are no Agent/Modules defined');
}
if (!empty($item['charts'])) {
$table1 = new stdClass();
@ -2313,7 +2321,7 @@ function reporting_html_availability(&$table, $item) {
global $config;
if (!empty($item["data"])) {
if (!empty($item["data"]) || ($hide_notinit_agent !=1 && ($item['type'] == "availability" || $item['type'] == "sla"))) {
$table1 = new stdClass();
$table1->width = '99%';
$table1->data = array ();