Merge branch 'develop' of https://github.com/pandorafms/pandorafms into develop
This commit is contained in:
commit
e6be7e7143
|
@ -568,8 +568,25 @@ html_print_input_hidden('id_item', $idItem);
|
|||
<td style="">
|
||||
<?php
|
||||
html_print_extended_select_for_time ('period', $period, '', '', '0', 10);
|
||||
?></td>
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_last_value" style="" class="datos">
|
||||
<td style="vertical-align: top;" class="datos">
|
||||
<?php
|
||||
echo __('Last value');
|
||||
ui_print_help_tip(__('Warning: period 0 reports cannot be used to show information back in time. Information contained in this kind of reports will be always reporting the most recent information'));
|
||||
?>
|
||||
</td>
|
||||
<td style="">
|
||||
<?php
|
||||
html_print_checkbox('last_value', '1',
|
||||
($period === 0), false, false, 'set_last_value_period();');
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr id="row_resolution" style="" class="datos">
|
||||
<td style="vertical-align: top;">
|
||||
<?php
|
||||
|
@ -1186,17 +1203,17 @@ function print_SLA_list($width, $action, $idItem = null) {
|
|||
$server_name_element = '';
|
||||
if ($meta && $server_name != '')
|
||||
$server_name_element .= ' (' . $server_name . ')';
|
||||
|
||||
|
||||
echo '<tr id="sla_' . $item['id'] . '" style="" class="datos">';
|
||||
echo '<td class="sla_list_agent_col">' . printSmallFont($nameAgent) . $server_name_element . '</td>';
|
||||
echo '<td class="sla_list_module_col">' . printSmallFont($nameModule) . '</td>';
|
||||
|
||||
|
||||
if (enterprise_installed() && $report_item_type == 'SLA_services') {
|
||||
enterprise_include_once("include/functions_services.php");
|
||||
$nameService = enterprise_hook('services_get_name', array($item['id_agent_module']));
|
||||
echo '<td class="sla_list_service_col">' . printSmallFont($nameService) . '</th>';
|
||||
}
|
||||
|
||||
|
||||
echo '<td class="sla_list_sla_min_col">' . $item['sla_min'] . '</td>';
|
||||
echo '<td class="sla_list_sla_max_col">' . $item['sla_max'] . '</td>';
|
||||
echo '<td class="sla_list_sla_limit_col">' . $item['sla_limit'] . '</td>';
|
||||
|
@ -1424,7 +1441,8 @@ $(document).ready (function () {
|
|||
minuteText: '<?php echo __('Minute');?>',
|
||||
secondText: '<?php echo __('Second');?>',
|
||||
currentText: '<?php echo __('Now');?>',
|
||||
closeText: '<?php echo __('Close');?>'});
|
||||
closeText: '<?php echo __('Close');?>'
|
||||
});
|
||||
});
|
||||
|
||||
function create_custom_graph() {
|
||||
|
@ -1451,7 +1469,11 @@ function create_custom_graph() {
|
|||
jQuery.ajax ({
|
||||
data: params1.join ("&"),
|
||||
type: 'POST',
|
||||
url: action= <?php echo '"' . ui_get_full_url(false, false, false, false) . '"'; ?> + "/ajax.php",
|
||||
url: action= <?php
|
||||
echo '"' .
|
||||
ui_get_full_url(false, false, false, false) .
|
||||
'"';
|
||||
?> + "/ajax.php",
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
success: function (data) {
|
||||
|
@ -1659,13 +1681,13 @@ function addSLARow() {
|
|||
var slaMin = $("input[name=sla_min]").val();
|
||||
var slaMax = $("input[name=sla_max]").val();
|
||||
var slaLimit = $("input[name=sla_limit]").val();
|
||||
|
||||
|
||||
var serviceId = $("select#id_service>option:selected").val();
|
||||
var serviceName = $("select#id_service>option:selected").text();
|
||||
|
||||
if (((idAgent != '') && (slaMin != '') && (slaMax != '')
|
||||
&& (slaLimit != '')) || serviceId != '') {
|
||||
|
||||
|
||||
if (nameAgent != '') {
|
||||
//Truncate nameAgent
|
||||
var params = [];
|
||||
|
@ -1682,7 +1704,7 @@ function addSLARow() {
|
|||
nameAgent = data;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//Truncate nameModule
|
||||
var params = [];
|
||||
params.push("truncate_text=1");
|
||||
|
@ -1708,7 +1730,7 @@ function addSLARow() {
|
|||
params.push("sla_max=" + slaMax);
|
||||
params.push("sla_limit=" + slaLimit);
|
||||
params.push("server_id=" + serverId);
|
||||
|
||||
|
||||
if (serviceId != '') {
|
||||
params.push("id_service=" + serviceId);
|
||||
}
|
||||
|
@ -1899,7 +1921,8 @@ function chooseType() {
|
|||
$("#row_netflow_filter").hide();
|
||||
$("#row_max_values").hide();
|
||||
$("#row_resolution").hide();
|
||||
|
||||
$("#row_last_value").hide();
|
||||
|
||||
// SLA list default state
|
||||
$("#sla_list").hide();
|
||||
$(".sla_list_agent_col").show();
|
||||
|
@ -1983,7 +2006,7 @@ function chooseType() {
|
|||
$("#row_only_display_wrong").show();
|
||||
$("#row_working_time").show();
|
||||
$("#row_sort").show();
|
||||
|
||||
|
||||
$(".sla_list_agent_col").hide();
|
||||
$(".sla_list_module_col").hide();
|
||||
$(".sla_list_service_col").show();
|
||||
|
@ -2137,7 +2160,7 @@ function chooseType() {
|
|||
$("#row_event_filter").show();
|
||||
$("#row_event_graphs").show();
|
||||
$("#row_event_graph_by_agent").hide();
|
||||
|
||||
|
||||
$('#agent_autocomplete').hide();
|
||||
$('#agent_autocomplete_events').show();
|
||||
break;
|
||||
|
@ -2159,6 +2182,12 @@ function chooseType() {
|
|||
$("#row_order_uptodown").show();
|
||||
$("#row_show_resume").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
|
||||
$("#row_last_value").show();
|
||||
if ($("#hidden-period").val() == 0) {
|
||||
$("#row_period").hide();
|
||||
$("input[name='last_value']").prop("checked", true);
|
||||
}
|
||||
break;
|
||||
case 'group_report':
|
||||
$("#row_group").show();
|
||||
|
@ -2191,6 +2220,12 @@ function chooseType() {
|
|||
$("#row_show_resume").show();
|
||||
$("#row_show_graph").show();
|
||||
$("#row_show_in_two_columns").show();
|
||||
|
||||
$("#row_last_value").show();
|
||||
if ($("#hidden-period").val() == 0) {
|
||||
$("#row_period").hide();
|
||||
$("input[name='last_value']").prop("checked", true);
|
||||
}
|
||||
break;
|
||||
case 'agent_module':
|
||||
$("#row_description").show();
|
||||
|
@ -2292,4 +2327,19 @@ function chooseType() {
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function set_last_value_period() {
|
||||
var checked = $("input[name='last_value']").prop("checked");
|
||||
|
||||
if (checked) {
|
||||
$("#row_period").hide();
|
||||
period_set_value($("#hidden-period").attr('class'), 0);
|
||||
alert("<?php
|
||||
echo __('Warning: period 0 reports cannot be used to show information back in time. Information contained in this kind of reports will be always reporting the most recent information');
|
||||
?>");
|
||||
}
|
||||
else {
|
||||
$("#row_period").show();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -71,8 +71,16 @@ if ($get_module_detail) {
|
|||
ui_include_time_picker();
|
||||
ui_require_jquery_file("ui.datepicker-" . get_user_language(), "include/javascript/i18n/");
|
||||
|
||||
$module_id = (int) get_parameter('id_module');
|
||||
$period = (int) get_parameter("period", SECONDS_1DAY);
|
||||
$module_id = (int)get_parameter('id_module');
|
||||
$period = get_parameter("period", SECONDS_1DAY);
|
||||
if ($period === 'undefined') {
|
||||
$period = SECONDS_1DAY;
|
||||
}
|
||||
else {
|
||||
$period = (int)$period;
|
||||
}
|
||||
|
||||
|
||||
$group = agents_get_agentmodule_group ($module_id);
|
||||
$agentId = (int) get_parameter("id_agent");
|
||||
$server_name = (string) get_parameter('server_name');
|
||||
|
|
|
@ -748,7 +748,13 @@ function html_print_extended_select_for_time ($name, $selected = '',
|
|||
echo '<div id="'.$uniq_name.'_default" style="width:100%;display:inline;">';
|
||||
html_print_select ($fields, $uniq_name . '_select', $selected,"" . $script,
|
||||
$nothing, $nothing_value, false, false, false, '', false, 'font-size: xx-small;'.$select_style);
|
||||
echo ' <a href="javascript:">'.html_print_image('images/pencil.png',true,array('class' => $uniq_name . '_toggler', 'alt' => __('Custom'), 'title' => __('Custom'), 'style' => 'width: 18px;')).'</a>';
|
||||
echo ' <a href="javascript:">' .
|
||||
html_print_image('images/pencil.png', true,
|
||||
array('class' => $uniq_name . '_toggler',
|
||||
'alt' => __('Custom'),
|
||||
'title' => __('Custom'),
|
||||
'style' => 'width: 18px;')) .
|
||||
'</a>';
|
||||
echo '</div>';
|
||||
|
||||
echo '<div id="'.$uniq_name.'_manual" style="width:100%;display:inline;">';
|
||||
|
@ -757,7 +763,12 @@ function html_print_extended_select_for_time ($name, $selected = '',
|
|||
html_print_input_hidden ($name, $selected, false, $uniq_name);
|
||||
html_print_select ($units, $uniq_name . '_units', 1, "" . $script,
|
||||
$nothing, $nothing_value, false, false, false, '', false, 'font-size: xx-small;'.$select_style);
|
||||
echo ' <a href="javascript:">'.html_print_image('images/default_list.png',true,array('class' => $uniq_name . '_toggler', 'alt' => __('List'), 'title' => __('List'), 'style' => 'width: 18px;')).'</a>';
|
||||
echo ' <a href="javascript:">' .
|
||||
html_print_image('images/default_list.png', true,
|
||||
array('class' => $uniq_name . '_toggler',
|
||||
'alt' => __('List'),
|
||||
'title' => __('List'), 'style' => 'width: 18px;')) .
|
||||
'</a>';
|
||||
echo '</div>';
|
||||
echo "<script type='text/javascript'>
|
||||
$(document).ready (function () {
|
||||
|
|
|
@ -52,7 +52,7 @@ function reporting_get_agentmodule_data_average ($id_agent_module, $period=0, $d
|
|||
// Initialize variables
|
||||
if (empty ($date)) $date = get_system_time ();
|
||||
$datelimit = $date - $period;
|
||||
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
$id_module_type = modules_get_agentmodule_type ($id_agent_module);
|
||||
|
@ -157,9 +157,9 @@ function reporting_get_agentmodule_data_max ($id_agent_module, $period=0, $date
|
|||
// Initialize variables
|
||||
if (empty ($date)) $date = get_system_time ();
|
||||
$datelimit = $date - $period;
|
||||
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
|
||||
$id_module_type = modules_get_agentmodule_type ($id_agent_module);
|
||||
$module_type = modules_get_moduletype_name ($id_module_type);
|
||||
$uncompressed_module = is_module_uncompressed ($module_type);
|
||||
|
@ -308,16 +308,21 @@ function reporting_get_agentmodule_data_min ($id_agent_module, $period=0, $date
|
|||
*
|
||||
* @return float The sumatory of the module values in the interval.
|
||||
*/
|
||||
function reporting_get_agentmodule_data_sum ($id_agent_module, $period=0, $date = 0) {
|
||||
function reporting_get_agentmodule_data_sum ($id_agent_module,
|
||||
$period = 0, $date = 0) {
|
||||
|
||||
global $config;
|
||||
|
||||
// Initialize variables
|
||||
if (empty ($date)) $date = get_system_time ();
|
||||
$datelimit = $date - $period;
|
||||
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
$id_module_type = db_get_value ('id_tipo_modulo', 'tagente_modulo','id_agente_modulo', $id_agent_module);
|
||||
$module_name = db_get_value ('nombre', 'ttipo_modulo', 'id_tipo', $id_module_type);
|
||||
$id_module_type = db_get_value ('id_tipo_modulo', 'tagente_modulo',
|
||||
'id_agente_modulo', $id_agent_module);
|
||||
$module_name = db_get_value ('nombre', 'ttipo_modulo', 'id_tipo',
|
||||
$id_module_type);
|
||||
$module_interval = modules_get_interval ($id_agent_module);
|
||||
$uncompressed_module = is_module_uncompressed ($module_name);
|
||||
|
||||
|
@ -330,11 +335,12 @@ function reporting_get_agentmodule_data_sum ($id_agent_module, $period=0, $date
|
|||
$module_inc = is_module_inc ($module_name);
|
||||
|
||||
// Get module data
|
||||
$interval_data = db_get_all_rows_sql ('SELECT * FROM tagente_datos
|
||||
WHERE id_agente_modulo = ' . (int) $id_agent_module .
|
||||
' AND utimestamp > ' . (int) $datelimit .
|
||||
' AND utimestamp < ' . (int) $date .
|
||||
' ORDER BY utimestamp ASC', $search_in_history_db);
|
||||
$interval_data = db_get_all_rows_sql('
|
||||
SELECT * FROM tagente_datos
|
||||
WHERE id_agente_modulo = ' . (int) $id_agent_module . '
|
||||
AND utimestamp > ' . (int) $datelimit . '
|
||||
AND utimestamp < ' . (int) $date . '
|
||||
ORDER BY utimestamp ASC', $search_in_history_db);
|
||||
if ($interval_data === false) $interval_data = array ();
|
||||
|
||||
// Uncompressed module data
|
||||
|
@ -412,7 +418,7 @@ function reporting_get_agentmodule_data_sum ($id_agent_module, $period=0, $date
|
|||
*/
|
||||
function reporting_get_agentmodule_sla ($id_agent_module, $period = 0, $min_value = 1, $max_value = false, $date = 0, $daysWeek = null, $timeFrom = null, $timeTo = null) {
|
||||
global $config;
|
||||
|
||||
|
||||
if (empty($id_agent_module))
|
||||
return false;
|
||||
|
||||
|
@ -425,7 +431,7 @@ function reporting_get_agentmodule_sla ($id_agent_module, $period = 0, $min_valu
|
|||
}
|
||||
// Limit date to start searching data
|
||||
$datelimit = $date - $period;
|
||||
|
||||
|
||||
$search_in_history_db = db_search_in_history_db($datelimit);
|
||||
|
||||
// Get interval data
|
||||
|
@ -581,7 +587,7 @@ function reporting_get_agentmodule_sla ($id_agent_module, $period = 0, $min_valu
|
|||
*/
|
||||
function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $min_value = 1, $max_value = false, $date = 0, $daysWeek = null, $timeFrom = null, $timeTo = null) {
|
||||
global $config;
|
||||
|
||||
|
||||
if (empty($id_agent_module))
|
||||
return false;
|
||||
|
||||
|
@ -681,15 +687,15 @@ function reporting_get_agentmodule_sla_array ($id_agent_module, $period = 0, $mi
|
|||
// Add unknown periods to data
|
||||
for ($i = 0; isset($events_unknown[$i]); $i++) {
|
||||
$eu = $events_unknown[$i];
|
||||
|
||||
|
||||
if ($eu['event_type'] == 'going_unknown') {
|
||||
$interval_data_indexed[$eu['utimestamp']]['data'] = 0;
|
||||
$interval_data_indexed[$eu['utimestamp']]['status'] = 4;
|
||||
|
||||
|
||||
// Search the corresponding recovery event.
|
||||
for ($j = $i+1; isset($events_unknown[$j]); $j++) {
|
||||
$eu = $events_unknown[$j];
|
||||
|
||||
|
||||
if ($eu['event_type'] != 'going_unknown' && substr ($eu['event_type'], 0, 5) == 'going') {
|
||||
$interval_data_indexed[$eu['utimestamp']]['data'] = 0;
|
||||
$interval_data_indexed[$eu['utimestamp']]['status'] = 6;
|
||||
|
@ -5389,28 +5395,34 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$mod_name = modules_get_agentmodule_name ($row['id_agent_module']);
|
||||
$ag_name = modules_get_agentmodule_agent_name ($row['id_agent_module']);
|
||||
|
||||
switch ($row['operation']) {
|
||||
case 'sum':
|
||||
$data_res[$key] =
|
||||
reporting_get_agentmodule_data_sum(
|
||||
$row['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
break;
|
||||
case 'max':
|
||||
$data_res[$key] =
|
||||
reporting_get_agentmodule_data_max(
|
||||
$row['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'min':
|
||||
$data_res[$key] =
|
||||
reporting_get_agentmodule_data_min(
|
||||
$row['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'avg':
|
||||
default:
|
||||
$data_res[$key] =
|
||||
reporting_get_agentmodule_data_average(
|
||||
$row['id_agent_module'], $content['period']);
|
||||
break;
|
||||
if ($content['period'] == 0) {
|
||||
$data_res[$key] =
|
||||
modules_get_last_value($row['id_agent_module']);
|
||||
}
|
||||
else {
|
||||
switch ($row['operation']) {
|
||||
case 'sum':
|
||||
$data_res[$key] =
|
||||
reporting_get_agentmodule_data_sum(
|
||||
$row['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
break;
|
||||
case 'max':
|
||||
$data_res[$key] =
|
||||
reporting_get_agentmodule_data_max(
|
||||
$row['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'min':
|
||||
$data_res[$key] =
|
||||
reporting_get_agentmodule_data_min(
|
||||
$row['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'avg':
|
||||
default:
|
||||
$data_res[$key] =
|
||||
reporting_get_agentmodule_data_average(
|
||||
$row['id_agent_module'], $content['period']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$unit = db_get_value('unit', 'tagente_modulo',
|
||||
|
@ -5621,20 +5633,27 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$found = false;
|
||||
if (strcmp($a, $agent_name) == 0
|
||||
&& strcmp($m, $module_name . ' (' . $g['operation'] . ')') == 0) {
|
||||
switch ($g['operation']) {
|
||||
case 'sum':
|
||||
$value_res = reporting_get_agentmodule_data_sum ($g['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
break;
|
||||
case 'max':
|
||||
$value_res = reporting_get_agentmodule_data_max ($g['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'min':
|
||||
$value_res = reporting_get_agentmodule_data_min ($g['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'avg':
|
||||
default:
|
||||
$value_res = reporting_get_agentmodule_data_average ($g['id_agent_module'], $content['period']);
|
||||
break;
|
||||
|
||||
if ($content['period'] == 0) {
|
||||
$value_res =
|
||||
modules_get_last_value($g['id_agent_module']);
|
||||
}
|
||||
else {
|
||||
switch ($g['operation']) {
|
||||
case 'sum':
|
||||
$value_res = reporting_get_agentmodule_data_sum ($g['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
break;
|
||||
case 'max':
|
||||
$value_res = reporting_get_agentmodule_data_max ($g['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'min':
|
||||
$value_res = reporting_get_agentmodule_data_min ($g['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'avg':
|
||||
default:
|
||||
$value_res = reporting_get_agentmodule_data_average ($g['id_agent_module'], $content['period']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($value_res === false) {
|
||||
|
@ -5695,20 +5714,27 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
continue;
|
||||
}
|
||||
}
|
||||
switch ($generals[$i]['operation']) {
|
||||
case 'sum':
|
||||
$min = reporting_get_agentmodule_data_sum ($generals[$i]['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
break;
|
||||
case 'max':
|
||||
$min = reporting_get_agentmodule_data_max ($generals[$i]['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'min':
|
||||
$min = reporting_get_agentmodule_data_min ($generals[$i]['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'avg':
|
||||
default:
|
||||
$min = reporting_get_agentmodule_data_average ($generals[$i]['id_agent_module'], $content['period']);
|
||||
break;
|
||||
|
||||
if ($content['period'] == 0) {
|
||||
$min =
|
||||
modules_get_last_value($generals[$i]['id_agent_module']);
|
||||
}
|
||||
else {
|
||||
switch ($generals[$i]['operation']) {
|
||||
case 'sum':
|
||||
$min = reporting_get_agentmodule_data_sum ($generals[$i]['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
break;
|
||||
case 'max':
|
||||
$min = reporting_get_agentmodule_data_max ($generals[$i]['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'min':
|
||||
$min = reporting_get_agentmodule_data_min ($generals[$i]['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'avg':
|
||||
default:
|
||||
$min = reporting_get_agentmodule_data_average ($generals[$i]['id_agent_module'], $content['period']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
|
||||
|
@ -5747,20 +5773,27 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
continue;
|
||||
}
|
||||
}
|
||||
switch ($g['operation']) {
|
||||
case 'sum':
|
||||
$value = reporting_get_agentmodule_data_sum ($g['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
break;
|
||||
case 'max':
|
||||
$value = reporting_get_agentmodule_data_max ($g['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'min':
|
||||
$value = reporting_get_agentmodule_data_min ($g['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'avg':
|
||||
default:
|
||||
$value = reporting_get_agentmodule_data_average ($g['id_agent_module'], $content['period']);
|
||||
break;
|
||||
|
||||
if ($content['period'] == 0) {
|
||||
$value =
|
||||
modules_get_last_value($g['id_agent_module']);
|
||||
}
|
||||
else {
|
||||
switch ($g['operation']) {
|
||||
case 'sum':
|
||||
$value = reporting_get_agentmodule_data_sum ($g['id_agent_module'], $content['period'], $report["datetime"]);
|
||||
break;
|
||||
case 'max':
|
||||
$value = reporting_get_agentmodule_data_max ($g['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'min':
|
||||
$value = reporting_get_agentmodule_data_min ($g['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'avg':
|
||||
default:
|
||||
$value = reporting_get_agentmodule_data_average ($g['id_agent_module'], $content['period']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($value !== false) {
|
||||
|
@ -6276,16 +6309,25 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
}
|
||||
}
|
||||
|
||||
switch ($exceptions[$i]['operation']) {
|
||||
case 'avg':
|
||||
$min = reporting_get_agentmodule_data_average($exceptions[$i]['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'max':
|
||||
$min = reporting_get_agentmodule_data_max($exceptions[$i]['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'min':
|
||||
$min = reporting_get_agentmodule_data_min($exceptions[$i]['id_agent_module'], $content['period']);
|
||||
break;
|
||||
if ($content['period'] == 0) {
|
||||
$min =
|
||||
modules_get_last_value($exceptions[$i]['id_agent_module']);
|
||||
}
|
||||
else {
|
||||
switch ($exceptions[$i]['operation']) {
|
||||
case 'avg':
|
||||
$min = reporting_get_agentmodule_data_average(
|
||||
$exceptions[$i]['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'max':
|
||||
$min = reporting_get_agentmodule_data_max(
|
||||
$exceptions[$i]['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'min':
|
||||
$min = reporting_get_agentmodule_data_min(
|
||||
$exceptions[$i]['id_agent_module'], $content['period']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$i++;
|
||||
|
||||
|
@ -6315,16 +6357,22 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
$unit = db_get_value('unit', 'tagente_modulo',
|
||||
'id_agente_modulo', $exc['id_agent_module']);
|
||||
|
||||
switch ($exc['operation']) {
|
||||
case 'avg':
|
||||
$value = reporting_get_agentmodule_data_average ($exc['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'max':
|
||||
$value = reporting_get_agentmodule_data_max ($exc['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'min':
|
||||
$value = reporting_get_agentmodule_data_min ($exc['id_agent_module'], $content['period']);
|
||||
break;
|
||||
if ($content['period'] == 0) {
|
||||
$value =
|
||||
modules_get_last_value($exceptions[$i]['id_agent_module']);
|
||||
}
|
||||
else {
|
||||
switch ($exc['operation']) {
|
||||
case 'avg':
|
||||
$value = reporting_get_agentmodule_data_average ($exc['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'max':
|
||||
$value = reporting_get_agentmodule_data_max ($exc['id_agent_module'], $content['period']);
|
||||
break;
|
||||
case 'min':
|
||||
$value = reporting_get_agentmodule_data_min ($exc['id_agent_module'], $content['period']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($value !== false) {
|
||||
|
@ -6505,7 +6553,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
|
|||
|
||||
$table->colspan[3][0] = 3;
|
||||
$table->cellstyle[3][0] = 'text-align: center;';
|
||||
|
||||
|
||||
$data = array();
|
||||
if ($show_graph == 1 || $show_graph == 2) {
|
||||
$data[0] = pie3d_graph(false, $data_pie_graph,
|
||||
|
|
|
@ -565,25 +565,27 @@ function post_process_select_events(name) {
|
|||
*/
|
||||
function period_select_init(name) {
|
||||
// Manual mode is hidden by default
|
||||
$('#'+name+'_manual').hide();
|
||||
$('#'+name+'_default').show();
|
||||
$('#' + name + '_manual').hide();
|
||||
$('#' + name + '_default').show();
|
||||
|
||||
// If the text input is empty, we put on it 5 minutes by default
|
||||
if($('#text-'+name+'_text').val() == '') {
|
||||
$('#text-'+name+'_text').val(300);
|
||||
if ($('#text-' + name + '_text').val() == '') {
|
||||
$('#text-' + name + '_text').val(300);
|
||||
// Set the value in the hidden field too
|
||||
$('.'+name).val(300);
|
||||
if($('#'+name+'_select option:eq(0)').val() == 0) {
|
||||
$('#'+name+'_select option:eq(2)').attr('selected', 'selected');
|
||||
$('.' + name).val(300);
|
||||
if ($('#' + name + '_select option:eq(0)').val() == 0) {
|
||||
$('#' + name + '_select option:eq(2)')
|
||||
.attr('selected', 'selected');
|
||||
}
|
||||
else {
|
||||
$('#'+name+'_select option:eq(1)').attr('selected', 'selected');
|
||||
$('#' + name + '_select option:eq(1)')
|
||||
.attr('selected', 'selected');
|
||||
}
|
||||
}
|
||||
else if($('#text-'+name+'_text').val() == 0) {
|
||||
$('#'+name+'_units option:last').removeAttr('selected');
|
||||
$('#'+name+'_manual').show();
|
||||
$('#'+name+'_default').hide();
|
||||
else if ($('#text-' + name + '_text').val() == 0) {
|
||||
$('#' + name + '_units option:last').removeAttr('selected');
|
||||
$('#' + name + '_manual').show();
|
||||
$('#' + name + '_default').hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -596,58 +598,66 @@ function period_select_init(name) {
|
|||
* @param name string with the name of the select for time
|
||||
*/
|
||||
function period_select_events(name) {
|
||||
$('.'+name+'_toggler').click(function() {
|
||||
$('.' + name + '_toggler').click(function() {
|
||||
toggleBoth(name);
|
||||
$('#text-'+name+'_text').focus();
|
||||
$('#text-' + name + '_text').focus();
|
||||
});
|
||||
|
||||
adjustTextUnits(name);
|
||||
|
||||
// When select a default period, is setted in seconds
|
||||
$('#'+name+'_select').change(function() {
|
||||
var value = $('#'+name+'_select').val();
|
||||
$('#' + name + '_select').change(function() {
|
||||
var value = $('#' + name + '_select').val();
|
||||
|
||||
if(value == -1) {
|
||||
if (value == -1) {
|
||||
value = 300;
|
||||
toggleBoth(name);
|
||||
$('#text-'+name+'_text').focus();
|
||||
$('#text-' + name + '_text').focus();
|
||||
}
|
||||
|
||||
$('.'+name).val(value);
|
||||
$('#text-'+name+'_text').val(value);
|
||||
$('.' + name).val(value);
|
||||
$('#text-' + name + '_text').val(value);
|
||||
adjustTextUnits(name);
|
||||
});
|
||||
|
||||
// When select a custom units, the default period changes to 'custom' and
|
||||
// the time in seconds is calculated into hidden input
|
||||
$('#'+name+'_units').change(function() {
|
||||
// When select a custom units, the default period changes to
|
||||
// 'custom' and the time in seconds is calculated into hidden input
|
||||
$('#' + name + '_units').change(function() {
|
||||
selectFirst(name);
|
||||
calculateSeconds(name);
|
||||
});
|
||||
|
||||
// When write any character into custom input, it check to convert it to
|
||||
// integer and calculate in seconds into hidden input
|
||||
$('#text-'+name+'_text').keyup (function () {
|
||||
var cleanValue = parseInt($('#text-'+name+'_text').val());
|
||||
if(isNaN(cleanValue)) {
|
||||
// When write any character into custom input, it check to convert
|
||||
// it to integer and calculate in seconds into hidden input
|
||||
$('#text-' + name + '_text').keyup (function () {
|
||||
var cleanValue = parseInt($('#text-' + name + '_text').val());
|
||||
if (isNaN(cleanValue)) {
|
||||
cleanValue = '';
|
||||
}
|
||||
|
||||
$('#text-'+name+'_text').val(cleanValue);
|
||||
$('#text-' + name + '_text').val(cleanValue);
|
||||
|
||||
selectFirst(name+'_select');
|
||||
selectFirst(name + '_select');
|
||||
calculateSeconds(name);
|
||||
});
|
||||
}
|
||||
|
||||
function period_set_value(name, value) {
|
||||
$("#text-" + name + "_text").val(value);
|
||||
adjustTextUnits(name);
|
||||
calculateSeconds(name);
|
||||
selectFirst(name + '_select');
|
||||
$("#" + name + "_manual").hide();
|
||||
$("#" + name + "_default").show();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Select first option of a select if is not value=0
|
||||
*
|
||||
*/
|
||||
|
||||
function selectFirst(name) {
|
||||
if($('#'+name+' option:eq(0)').val() == 0) {
|
||||
if ($('#'+name+' option:eq(0)').val() == 0) {
|
||||
$('#'+name+' option:eq(1)').attr('selected', 'selected');
|
||||
}
|
||||
else {
|
||||
|
@ -662,16 +672,15 @@ function selectFirst(name) {
|
|||
* work properly when the divs are into a hiden div
|
||||
*
|
||||
*/
|
||||
|
||||
function toggleBoth(name) {
|
||||
if($('#'+name+'_default').css('display') == 'none') {
|
||||
if ($('#'+name+'_default').css('display') == 'none') {
|
||||
$('#'+name+'_default').css('display','inline');
|
||||
}
|
||||
else {
|
||||
$('#'+name+'_default').css('display','none');
|
||||
}
|
||||
|
||||
if($('#'+name+'_manual').css('display') == 'none') {
|
||||
if ($('#'+name+'_manual').css('display') == 'none') {
|
||||
$('#'+name+'_manual').css('display','inline');
|
||||
}
|
||||
else {
|
||||
|
@ -685,9 +694,10 @@ function toggleBoth(name) {
|
|||
*
|
||||
*/
|
||||
function calculateSeconds(name) {
|
||||
var calculated = $('#text-'+name+'_text').val()*$('#'+name+'_units').val();
|
||||
var calculated =
|
||||
$('#text-' + name + '_text').val() * $('#' + name + '_units').val();
|
||||
|
||||
$('.'+name).val(calculated);
|
||||
$('.' + name).val(calculated);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -696,11 +706,11 @@ function calculateSeconds(name) {
|
|||
*
|
||||
*/
|
||||
function period_select_update(name, seconds) {
|
||||
$('#text-'+name+'_text').val(seconds);
|
||||
$('#text-' + name + '_text').val(seconds);
|
||||
adjustTextUnits(name);
|
||||
calculateSeconds(name);
|
||||
$('#'+name+'_manual').show();
|
||||
$('#'+name+'_default').hide();
|
||||
$('#' + name + '_manual').show();
|
||||
$('#' + name + '_default').hide();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue