Working in the avaliability item in report.

This commit is contained in:
mdtrooper 2015-04-01 15:51:19 +02:00
parent 4345ec6fa3
commit 5864d846ba
3 changed files with 117 additions and 28 deletions

View File

@ -420,6 +420,12 @@ switch ($action) {
$period = $item['period']; $period = $item['period'];
$order_uptodown = $item['order_uptodown']; $order_uptodown = $item['order_uptodown'];
$show_resume = $item['show_resume']; $show_resume = $item['show_resume'];
break;
case 'availability':
$description = $item['description'];
$period = $item['period'];
$order_uptodown = $item['order_uptodown'];
$show_resume = $item['show_resume'];
// HACK it is saved in show_graph field. // HACK it is saved in show_graph field.
// Show interfaces instead the modules // Show interfaces instead the modules
$show_address_agent = $item['show_graph']; $show_address_agent = $item['show_graph'];
@ -501,7 +507,8 @@ switch ($action) {
break; break;
} }
$urlForm = $config['homeurl'] . 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=' . $actionParameter . '&id_report=' . $idReport; $urlForm = $config['homeurl'] .
'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=' . $actionParameter . '&id_report=' . $idReport;
echo '<form action="' . $urlForm . '" method="post">'; echo '<form action="' . $urlForm . '" method="post">';
html_print_input_hidden('id_item', $idItem); html_print_input_hidden('id_item', $idItem);
@ -538,8 +545,8 @@ html_print_input_hidden('id_item', $idItem);
</tr> </tr>
<tr id="row_netflow_filter" style="" class="datos"> <tr id="row_netflow_filter" style="" class="datos">
<td><?php echo __('Filter');?></td> <td><?php echo __('Filter');?></td>
<td><?php <td>
<?php
$own_info = get_user_info ($config['id_user']); $own_info = get_user_info ($config['id_user']);
// Get group list that user has access // Get group list that user has access
@ -1147,7 +1154,7 @@ html_print_input_hidden('id_item', $idItem);
</table> </table>
<?php <?php
print_SLA_list('95%', $action, $idItem); print_SLA_list('95%', $action, $idItem);
print_General_list('95%', $action, $idItem); print_General_list('95%', $action, $idItem, $type);
echo '<div class="action-buttons" style="width: 95%">'; echo '<div class="action-buttons" style="width: 95%">';
if ($action == 'new') { if ($action == 'new') {
html_print_submit_button(__('Create item'), 'create_item', false, 'class="sub wand"'); html_print_submit_button(__('Create item'), 'create_item', false, 'class="sub wand"');
@ -1173,7 +1180,8 @@ function print_SLA_list($width, $action, $idItem = null) {
global $config; global $config;
global $meta; global $meta;
$report_item_type = db_get_value ('type', 'treport_content', 'id_rc', $idItem); $report_item_type = db_get_value('type', 'treport_content', 'id_rc',
$idItem);
?> ?>
<table class="databox" id="sla_list" border="0" cellpadding="4" cellspacing="4" width="98%"> <table class="databox" id="sla_list" border="0" cellpadding="4" cellspacing="4" width="98%">
<thead> <thead>
@ -1325,9 +1333,10 @@ function print_SLA_list($width, $action, $idItem = null) {
<?php <?php
} }
function print_General_list($width, $action, $idItem = null) { function print_General_list($width, $action, $idItem = null, $type = 'general') {
global $config; global $config;
global $meta; global $meta;
if (!isset($meta)) if (!isset($meta))
$meta = false; $meta = false;
@ -1335,19 +1344,31 @@ function print_General_list($width, $action, $idItem = null) {
'avg' => __('rate'), 'avg' => __('rate'),
'max' => __('max'), 'max' => __('max'),
'min' => __('min'), 'min' => __('min'),
'sum' => __('sum'), 'sum' => __('sum'));
'ava' => __('Avail'));
include_once($config['homedir'] . '/include/functions_html.php'); include_once($config['homedir'] . '/include/functions_html.php');
?> ?>
<table class="databox" id="general_list" border="0" cellpadding="4" cellspacing="4" width="98%"> <table class="databox" id="general_list" border="0" cellpadding="4" cellspacing="4" width="98%">
<thead> <thead>
<tr> <tr>
<?php
if ($type == "availability") {
?>
<th class="header" scope="col"><?php echo __('Agent');?></th>
<th class="header" scope="col"><?php echo __('Module');?></th>
<th class="header" scope="col"><?php echo __('Action');?></th>
<?php
}
else {
?>
<th class="header" scope="col"><?php echo __('Agent');?></th> <th class="header" scope="col"><?php echo __('Agent');?></th>
<th class="header" scope="col"><?php echo __('Module');?></th> <th class="header" scope="col"><?php echo __('Module');?></th>
<th class="header" scope="col"><?php echo __('Operation') . <th class="header" scope="col"><?php echo __('Operation') .
ui_print_help_tip(__("Please be careful, when the module have diferent intervals in their life, the summatory maybe get bad result."), true);?></th> ui_print_help_tip(__("Please be careful, when the module have diferent intervals in their life, the summatory maybe get bad result."), true);?></th>
<th class="header" scope="col"><?php echo __('Action');?></th> <th class="header" scope="col"><?php echo __('Action');?></th>
<?php
}
?>
</tr> </tr>
</thead> </thead>
<?php <?php
@ -1363,10 +1384,13 @@ function print_General_list($width, $action, $idItem = null) {
case 'update': case 'update':
case 'edit': case 'edit':
echo '<tbody id="list_general">'; echo '<tbody id="list_general">';
$itemsGeneral = db_get_all_rows_filter('treport_content_item', array('id_report_content' => $idItem)); $itemsGeneral = db_get_all_rows_filter(
'treport_content_item',
array('id_report_content' => $idItem));
if ($itemsGeneral === false) { if ($itemsGeneral === false) {
$itemsGeneral = array(); $itemsGeneral = array();
} }
foreach ($itemsGeneral as $item) { foreach ($itemsGeneral as $item) {
$server_name = $item ['server_name']; $server_name = $item ['server_name'];
// Metaconsole db connection // Metaconsole db connection
@ -1377,7 +1401,10 @@ function print_General_list($width, $action, $idItem = null) {
continue; continue;
} }
} }
$idAgent = db_get_value_filter('id_agente', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])); $idAgent = db_get_value_filter(
'id_agente', 'tagente_modulo',
array('id_agente_modulo' => $item['id_agent_module']));
$nameAgent = agents_get_name ($idAgent); $nameAgent = agents_get_name ($idAgent);
$nameModule = db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module'])); $nameModule = db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
@ -1385,14 +1412,30 @@ function print_General_list($width, $action, $idItem = null) {
if ($meta && $server_name != '') if ($meta && $server_name != '')
$server_name_element .= ' (' . $server_name . ')'; $server_name_element .= ' (' . $server_name . ')';
if ($type == "availability") {
echo '<tr id="general_' . $item['id'] . '" style="" class="datos"> echo '<tr id="general_' . $item['id'] . '" style="" class="datos">
<td>' . printSmallFont($nameAgent) . $server_name_element . '</td> <td>' . printSmallFont($nameAgent) . $server_name_element . '</td>
<td>' . printSmallFont($nameModule) . '</td> <td>' . printSmallFont($nameModule) . '</td>
<td>' . printSmallFont($operation[$item['operation']]) . '</td>
<td style="text-align: center;"> <td style="text-align: center;">
<a href="javascript: deleteGeneralRow(' . $item['id'] . ');">' . html_print_image("images/cross.png", true) . '</a> <a href="javascript: deleteGeneralRow(' . $item['id'] . ');">' . html_print_image("images/cross.png", true) . '</a>
</td> </td>
</tr>'; </tr>';
}
else {
echo '<tr id="general_' . $item['id'] . '" style="" class="datos">
<td>' . printSmallFont($nameAgent) . $server_name_element . '</td>
<td>' . printSmallFont($nameModule) . '</td>
<td>' .
printSmallFont($operation[$item['operation']]) .
'</td>
<td style="text-align: center;">
<a href="javascript: deleteGeneralRow(' . $item['id'] . ');">' . html_print_image("images/cross.png", true) . '</a>
</td>
</tr>';
}
if ($meta) { if ($meta) {
//Restore db connection //Restore db connection
metaconsole_restore_db(); metaconsole_restore_db();
@ -1404,7 +1447,13 @@ function print_General_list($width, $action, $idItem = null) {
<tr id="row" style="display: none;" class="datos"> <tr id="row" style="display: none;" class="datos">
<td class="agent_name"></td> <td class="agent_name"></td>
<td class="module_name"></td> <td class="module_name"></td>
<?php
if ($type != "availability") {
?>
<td class="operation_name"></td> <td class="operation_name"></td>
<?php
}
?>
<td style="text-align: center;"><a class="delete_button" href="javascript: deleteGeneralRow(0);"><?php html_print_image("images/cross.png", false); ?></a></td> <td style="text-align: center;"><a class="delete_button" href="javascript: deleteGeneralRow(0);"><?php html_print_image("images/cross.png", false); ?></a></td>
</tr> </tr>
</tbody> </tbody>
@ -1431,8 +1480,25 @@ function print_General_list($width, $action, $idItem = null) {
ui_print_agent_autocomplete_input($params); ui_print_agent_autocomplete_input($params);
?> ?>
</td> </td>
<td><select id="id_agent_module_general" name="id_agente_modulo_general" disabled="disabled" style="max-width: 180px"><option value="0"><?php echo __('Select an Agent first'); ?></option></select></td> <td>
<td><?php html_print_select ($operation, 'id_operation_module_general', 0, false, '', '', false, false, true, 'width: 200px', false); ?></td> <select id="id_agent_module_general" name="id_agente_modulo_general" disabled="disabled" style="max-width: 180px">
<option value="0"><?php echo __('Select an Agent first'); ?></option>
</select>
</td>
<?php
if ($type !== "availability") {
?>
<td>
<?php
html_print_select($operation,
'id_operation_module_general', 0,
false, '', '', false, false, true,
'width: 200px', false);
?>
</td>
<?php
}
?>
<td style="text-align: center;"><a href="javascript: addGeneralRow();"><?php html_print_image("images/disk.png", false); ?></a></td> <td style="text-align: center;"><a href="javascript: addGeneralRow();"><?php html_print_image("images/disk.png", false); ?></a></td>
</tr> </tr>
</tbody> </tbody>
@ -1805,7 +1871,13 @@ function addGeneralRow() {
var idAgent = $("input[name=id_agent_general]").val(); var idAgent = $("input[name=id_agent_general]").val();
var serverId = $("input[name=id_server]").val(); var serverId = $("input[name=id_server]").val();
var idModule = $("#id_agent_module_general").val(); var idModule = $("#id_agent_module_general").val();
var operation = $("#id_operation_module_general").val(); var operation;
if ($("#id_operation_module_general").length) {
operation = $("#id_operation_module_general").val();
}
else {
operation = "";
}
var nameModule = $("#id_agent_module_general :selected").text(); var nameModule = $("#id_agent_module_general :selected").text();
var nameOperation = $("#id_operation_module_general :selected").text(); var nameOperation = $("#id_operation_module_general :selected").text();
@ -1840,6 +1912,7 @@ function addGeneralRow() {
nameModule = data; nameModule = data;
} }
}); });
//Truncate nameOperation //Truncate nameOperation
var params = []; var params = [];
params.push("truncate_text=1"); params.push("truncate_text=1");
@ -1855,6 +1928,7 @@ function addGeneralRow() {
nameOperation = data; nameOperation = data;
} }
}); });
var params = []; var params = [];
params.push("add_general=1"); params.push("add_general=1");
params.push("id=" + $("input[name=id_item]").val()); params.push("id=" + $("input[name=id_item]").val());
@ -2205,7 +2279,6 @@ function chooseType() {
$("#general_list").show(); $("#general_list").show();
$("#row_order_uptodown").show(); $("#row_order_uptodown").show();
$("#row_show_resume").show(); $("#row_show_resume").show();
$("#row_show_address_agent").show();
$("#row_show_in_two_columns").show(); $("#row_show_in_two_columns").show();
$("#row_last_value").show(); $("#row_last_value").show();
@ -2214,6 +2287,14 @@ function chooseType() {
$("input[name='last_value']").prop("checked", true); $("input[name='last_value']").prop("checked", true);
} }
break; break;
case 'availability':
$("#row_description").show();
$("#row_period").show();
$("#general_list").show();
$("#row_order_uptodown").show();
$("#row_show_address_agent").show();
$("#row_show_in_two_columns").show();
break;
case 'group_report': case 'group_report':
$("#row_group").show(); $("#row_group").show();
$("#row_servers").show(); $("#row_servers").show();

View File

@ -776,7 +776,8 @@ switch ($action) {
break; break;
case 'item_editor': case 'item_editor':
$resultOperationDB = null; $resultOperationDB = null;
$report = db_get_row_filter('treport', array('id_report' => $idReport)); $report = db_get_row_filter('treport',
array('id_report' => $idReport));
$reportName = $report['name']; $reportName = $report['name'];
$idGroupReport = $report['id_group']; $idGroupReport = $report['id_group'];
@ -849,11 +850,19 @@ switch ($action) {
$values['top_n_value'] = get_parameter('max_values'); $values['top_n_value'] = get_parameter('max_values');
$good_format = true; $good_format = true;
break; break;
case 'availability':
$good_format = true;
// HACK it is saved in show_graph field.
// Show interfaces instead the modules
$values['show_graph'] =
get_parameter('checkbox_show_address_agent');
break;
default: default:
$values['period'] = get_parameter('period'); $values['period'] = get_parameter('period');
$values['top_n'] = get_parameter('radiobutton_max_min_avg',0); $values['top_n'] = get_parameter('radiobutton_max_min_avg',0);
$values['top_n_value'] = get_parameter('quantity'); $values['top_n_value'] = get_parameter('quantity');
$values['text'] = get_parameter('text'); $values['text'] = get_parameter('text');
$values['show_graph'] = get_parameter('combo_graph_options');
$good_format = true; $good_format = true;
} }
@ -885,7 +894,6 @@ switch ($action) {
$values['order_uptodown'] = get_parameter ('radiobutton_order_uptodown'); $values['order_uptodown'] = get_parameter ('radiobutton_order_uptodown');
$values['exception_condition'] = (int)get_parameter('exception_condition', 0); $values['exception_condition'] = (int)get_parameter('exception_condition', 0);
$values['exception_condition_value'] = get_parameter('exception_condition_value'); $values['exception_condition_value'] = get_parameter('exception_condition_value');
$values['show_graph'] = get_parameter('combo_graph_options');
$values['id_module_group'] = get_parameter('combo_modulegroup'); $values['id_module_group'] = get_parameter('combo_modulegroup');
$values['id_group'] = get_parameter ('combo_group'); $values['id_group'] = get_parameter ('combo_group');
$values['server_name'] = get_parameter ('server_name'); $values['server_name'] = get_parameter ('server_name');

View File

@ -383,15 +383,15 @@ foreach ($contents as $content) {
$data["module"] = io_safe_output_xml (db_get_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module'])); $data["module"] = io_safe_output_xml (db_get_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']));
$data["agent"] = io_safe_output_xml (modules_get_agentmodule_agent_name ($content['id_agent_module'])); $data["agent"] = io_safe_output_xml (modules_get_agentmodule_agent_name ($content['id_agent_module']));
html_debug_print($content, true);
$graph = db_get_row ("tgraph", "id_graph", $content['id_gs']); $graph = db_get_row ("tgraph", "id_graph", $content['id_gs']);
$data["title"] = __('Custom graph'); $data["title"] = __('Custom graph');
$data["objdata"] = array(); $data["objdata"] = array();
html_debug_print($graph, true);
$result = db_get_all_rows_field_filter ("tgraph_source","id_graph",$content['id_gs']); $result = db_get_all_rows_field_filter ("tgraph_source","id_graph",$content['id_gs']);
$modules = array (); $modules = array ();
$weights = array (); $weights = array ();
html_debug_print($result, true);
if ($result === false) { if ($result === false) {
$result = array(); $result = array();
} }