This commit is contained in:
cesar991 2016-07-21 15:44:14 +02:00
commit cce5e23d30
6 changed files with 169 additions and 76 deletions

View File

@ -124,6 +124,7 @@ switch ($action) {
$sql = null;
$show_in_two_columns = 0;
$show_in_landscape = 0;
$hide_notinit_agents = 0;
$server_name = '';
$server_id = 0;
break;
@ -156,6 +157,7 @@ switch ($action) {
$sql = null;
$show_in_two_columns = 0;
$show_in_landscape = 0;
$hide_notinit_agents = 0;
$server_name = '';
$server_id = 0;
$get_data_editor = false;
@ -177,8 +179,10 @@ switch ($action) {
}
$style = json_decode(io_safe_output($item['style']), true);
$show_in_two_columns = $style['show_in_two_columns'];
$show_in_landscape = $style['show_in_landscape'];
$hide_notinit_agents = $style['hide_notinit_agents'];
$type = $item['type'];
$name = $item['name'];
@ -1302,6 +1306,16 @@ $class = 'databox filters';
</td>
</tr>
<tr id="row_hide_notinit_agents" style="" class="datos">
<td style="font-weight:bold;"><?php echo __('Hide not init agents');?></td>
<td>
<?php
html_print_checkbox('hide_notinit_agents', 1,
$hide_notinit_agents, false, false);
?>
</td>
</tr>
<tr id="row_filter_search" style="" class="datos">
@ -1395,6 +1409,7 @@ function print_SLA_list($width, $action, $idItem = null) {
'tagente_modulo',
array('id_agente_modulo' => $item['id_agent_module']));
$nameAgent = agents_get_name ($idAgent);
$nameModule = db_get_value_filter('nombre',
'tagente_modulo',
array('id_agente_modulo' => $item['id_agent_module']));
@ -2139,7 +2154,7 @@ function addGeneralRow() {
params.push("id_module=" + idModule);
params.push("id_server=" + serverId);
params.push("operation=" + operation);
params.push("id_agent=" + idAgent);
params.push("page=include/ajax/reporting.ajax");
jQuery.ajax ({
data: params.join ("&"),
@ -2212,6 +2227,7 @@ function chooseType() {
$("#row_exception_condition").hide();
$("#row_show_in_two_columns").hide();
$("#row_show_in_landscape").hide();
$('#row_hide_notinit_agents').hide();
$("#row_module_group").hide();
$("#row_servers").hide();
$("#row_sort").hide();
@ -2313,6 +2329,7 @@ function chooseType() {
$("#row_show_graph").show();
$("#row_show_in_two_columns").show();
$("#row_sort").show();
$('#row_hide_notinit_agents').show();
break;
case 'SLA_monthly':
@ -2564,6 +2581,7 @@ function chooseType() {
$("#row_show_in_two_columns").show();
$("#row_show_resume").show();
$("#row_working_time").show();
$('#row_hide_notinit_agents').show();
break;
case 'group_report':

View File

@ -1101,6 +1101,7 @@ switch ($action) {
$style = array();
$style['show_in_two_columns'] = get_parameter('show_in_two_columns', 0);
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
$style['hide_notinit_agents'] = get_parameter('hide_notinit_agents', 0);
switch ($values['type']) {
case 'event_report_agent':
@ -1362,6 +1363,7 @@ switch ($action) {
$style = array();
$style['show_in_two_columns'] = get_parameter('show_in_two_columns', 0);
$style['show_in_landscape'] = get_parameter('show_in_landscape', 0);
$style['hide_notinit_agents'] = get_parameter('hide_notinit_agents', 0);
switch ($values['type']) {
case 'event_report_agent':

View File

@ -1068,13 +1068,13 @@ function hiddenFields(item) {
enterprise_hiddenFields(item);
}
var code_control = tinyMCE.activeEditor.controlManager.controls['text-label_code'];
if (item == 'label') {
code_control.setDisabled(false);
}
else {
code_control.setDisabled(true);
}
//~ var code_control = tinyMCE.activeEditor.controlManager.controls['text-label_code'];
//~ if (item == 'label') {
//~ code_control.setDisabled(false);
//~ }
//~ else {
//~ code_control.setDisabled(true);
//~ }
}
function cleanFields(item) {

View File

@ -208,7 +208,7 @@ ui_require_javascript_file ('encode_decode_base64');
width: "400",
height: "200",
nowrap: true,
plugins : "noneditable",
plugins : "bbcode",
inline_styles : true,
valid_children : "+body[style]",
element_format : "html",

View File

@ -484,6 +484,7 @@ function reporting_SLA($report, $content, $type = 'dinamic',
$height = $force_height_chart;
}
$return["id_rc"] = $content['id_rc'];
$edge_interval = 10;
@ -3749,7 +3750,6 @@ function reporting_sql($report, $content) {
}
function reporting_availability($report, $content) {
global $config;
$return = array();
@ -3767,6 +3767,8 @@ function reporting_availability($report, $content) {
$report,
$content);
$return['id_rc'] = $content['id_rc'];
if ($content['show_graph']) {
$return['kind_availability'] = "address";
}

View File

@ -281,6 +281,11 @@ function reporting_html_print_report($report, $mini = false) {
}
function reporting_html_SLA($table, $item, $mini) {
$style = db_get_value('style', 'treport_content', 'id_rc', $item['id_rc']);
$style = json_decode(io_safe_output($style), true);
$hide_notinit_agent = $style['hide_notinit_agents'];
$same_agent_in_resume = "";
if ($mini) {
$font_size = '1.5';
}
@ -331,6 +336,8 @@ function reporting_html_SLA($table, $item, $mini) {
$table1->headstyle[5] = 'text-align: right';
foreach ($item['data'] as $sla) {
$the_first_men_time = get_agent_first_time(io_safe_output($sla['agent']));
if (!$hide_notinit_agent) {
$row = array();
$row[] = $sla['agent'];
$row[] = $sla['module'];
@ -355,6 +362,35 @@ function reporting_html_SLA($table, $item, $mini) {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">' .
__('Fail') . '</span>';
}
}
else {
if ($item['date']['to'] > $the_first_men_time) {
$row = array();
$row[] = $sla['agent'];
$row[] = $sla['module'];
$row[] = $sla['max'] . " / " . $sla['min'];
$row[] = round($sla['sla_limit'], 2) . "%";
if ($sla['sla_value_unknown']) {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
__('N/A') . '</span>';
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_UNKNOWN.';">' .
__('Unknown') . '</span>';
}
elseif ($sla['sla_status']) {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
round($sla['sla_value'], 2) . "%" . '</span>';
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_NORMAL.';">' .
__('OK') . '</span>';
}
else {
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">' .
round($sla['sla_value'], 2) . "%" . '</span>';
$row[] = '<span style="font: bold '.$font_size.'em Arial, Sans-serif; color: '.COL_CRITICAL.';">' .
__('Fail') . '</span>';
}
}
}
$table1->data[] = $row;
}
@ -1639,6 +1675,10 @@ function reporting_html_text(&$table, $item) {
}
function reporting_html_availability(&$table, $item) {
$style = db_get_value('style', 'treport_content', 'id_rc', $item['id_rc']);
$style = json_decode(io_safe_output($style), true);
$hide_notinit_agent = $style['hide_notinit_agents'];
$same_agent_in_resume = "";
if (!empty($item["data"])) {
$table1 = new stdClass();
@ -1680,6 +1720,9 @@ function reporting_html_availability(&$table, $item) {
$table1->style[7] = 'text-align: right';
foreach ($item['data'] as $row) {
$the_first_men_time = get_agent_first_time(io_safe_output($row['agent']));
if (!$hide_notinit_agent) {
$table_row = array();
$table_row[] = $row['agent'];
$table_row[] = $row['availability_item'];
@ -1689,6 +1732,23 @@ function reporting_html_availability(&$table, $item) {
$table_row[] = $row['poling_time'];
$table_row[] = $row['time_unavaliable'];
$table_row[] = $row['ok'];
}
else {
if ($item['date']['to'] > $the_first_men_time) {
$table_row = array();
$table_row[] = $row['agent'];
$table_row[] = $row['availability_item'];
$table_row[] = $row['checks'];
$table_row[] = $row['failed'];
$table_row[] = $row['fail'];
$table_row[] = $row['poling_time'];
$table_row[] = $row['time_unavaliable'];
$table_row[] = $row['ok'];
}
else {
$same_agent_in_resume = $row['agent'];
}
}
$table1->data[] = $table_row;
}
@ -1708,8 +1768,7 @@ function reporting_html_availability(&$table, $item) {
$table1->width = '99%';
$table1->data = array ();
if (($same_agent_in_resume == "") && (strpos($item['resume']['min_text'], $same_agent_in_resume) === false)) {
$table1->head = array ();
$table1->head['min_text'] = __('Agent max');
$table1->head['min'] = __('Min Value');
@ -1746,6 +1805,18 @@ function reporting_html_availability(&$table, $item) {
array_push ($table->data, $data);
}
}
}
function get_agent_first_time ($agent_name) {
$id = agents_get_agent_id($agent_name, true);
$utimestamp = db_get_all_rows_sql("SELECT utimestamp FROM tagente_datos WHERE id_agente_modulo IN
(SELECT id_agente_modulo FROM tagente_modulo WHERE id_agente = " . $id . ")
ORDER BY utimestamp ASC LIMIT 1");
$utimestamp = $utimestamp[0]['utimestamp'];
return $utimestamp;
}
function reporting_html_general(&$table, $item) {