2012-04-10 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/ajax/reporting.ajax.php godmode/reporting/reporting_builder.list_items.php godmode/reporting/graph_builder.main.php godmode/reporting/reporting_builder.php godmode/reporting/reporting_builder.item_editor.php: Several fixes in metaconsole reports. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5926 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
672f4681ee
commit
8fb04851c4
|
@ -1,3 +1,12 @@
|
|||
2012-04-10 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||
|
||||
* include/ajax/reporting.ajax.php
|
||||
godmode/reporting/reporting_builder.list_items.php
|
||||
godmode/reporting/graph_builder.main.php
|
||||
godmode/reporting/reporting_builder.php
|
||||
godmode/reporting/reporting_builder.item_editor.php: Several fixes
|
||||
in metaconsole reports.
|
||||
|
||||
2012-04-10 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_agents.php: Fixed an error when try
|
||||
|
|
|
@ -127,8 +127,6 @@ echo "<td class='datos2'>";
|
|||
echo "<b>".__('Height')."</b></td>";
|
||||
echo "<td class='datos2'>";
|
||||
echo "<input type='text' name='height' value='$height' size=6></td></tr>";
|
||||
|
||||
$period_label = $periods[$period];
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td class='datos'>";
|
||||
|
|
|
@ -497,7 +497,30 @@ html_print_input_hidden('id_item', $idItem);
|
|||
<?php
|
||||
if($idAgent) {
|
||||
$sql = "SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE id_agente = " . $idAgent . " AND delete_pending = 0";
|
||||
html_print_select_from_sql($sql, 'id_agent_module', $idAgentModule, '', '', '0');
|
||||
|
||||
if ($config['metaconsole'] == 1) {
|
||||
$connection = metaconsole_get_connection($server_name);
|
||||
|
||||
if (metaconsole_load_external_db($connection)) {
|
||||
$agent_name_temp = db_get_all_rows_sql($sql);
|
||||
|
||||
if ($agent_name_temp === false)
|
||||
$agent_name_temp = array();
|
||||
|
||||
$result_select = array();
|
||||
foreach ($agent_name_temp as $module_element) {
|
||||
$result_select[$module_element['id_agente_modulo']] = $module_element['nombre'];
|
||||
}
|
||||
|
||||
html_print_select($result_select, 'id_agent_module', $idAgentModule, '', '', '0');
|
||||
}
|
||||
|
||||
//Restore db connection
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
else {
|
||||
html_print_select_from_sql($sql, 'id_agent_module', $idAgentModule, '', '', '0');
|
||||
}
|
||||
}
|
||||
else {
|
||||
?>
|
||||
|
@ -552,6 +575,8 @@ html_print_input_hidden('id_item', $idItem);
|
|||
if ($config['metaconsole'] == 1) {
|
||||
$graphs = array();
|
||||
$graphs = metaconsole_get_custom_graphs();
|
||||
$value_selected = $idCustomGraph . '|' . $server_name;
|
||||
html_print_select($graphs, 'id_custom_graph', $value_selected, 'change_custom_graph();', __('None'), 0);
|
||||
}
|
||||
else {
|
||||
switch ($config["dbtype"]) {
|
||||
|
@ -563,14 +588,37 @@ html_print_input_hidden('id_item', $idItem);
|
|||
$query_sql = 'SELECT id_graph, name FROM tgraph WHERE private = 0 OR (private = 1 AND id_user = \''.$config["id_user"].'\')';
|
||||
break;
|
||||
}
|
||||
html_print_select_from_sql($query_sql, 'id_custom_graph', $idCustomGraph, 'change_custom_graph();', __('None'), 0);
|
||||
}
|
||||
html_print_select_from_sql($query_sql, 'id_custom_graph', $idCustomGraph, 'change_custom_graph();', '--', 0);
|
||||
|
||||
$style_button_create_custom_graph = 'style="display: none;"';
|
||||
$style_button_edit_custom_graph = '';
|
||||
if (empty($idCustomGraph)) {
|
||||
$style_button_create_custom_graph = '';
|
||||
$style_button_edit_custom_graph = 'style="display: none;"';
|
||||
// Select the target server
|
||||
if ($config['metaconsole'] == 1) {
|
||||
$metaconsole_connections = enterprise_hook('metaconsole_get_connection_names');
|
||||
if ($metaconsole_connections === false) {
|
||||
$metaconsole_connections = array();
|
||||
}
|
||||
$result_servers = array();
|
||||
foreach ($metaconsole_connections as $metaconsole_element){
|
||||
$connection_data = enterprise_hook('metaconsole_get_connection', array($metaconsole_element));
|
||||
$result_servers[$connection_data['server_name']] = $connection_data['server_name'];
|
||||
}
|
||||
// Print select combo with metaconsole servers
|
||||
if (!empty($result_servers)) {
|
||||
echo '<div id="meta_target_servers" style="display:none;">';
|
||||
echo ' ' . __('Target server') . ' ';
|
||||
html_print_select($result_servers, 'meta_servers', '', '', __('None'), 0);
|
||||
echo '</div>';
|
||||
}
|
||||
else {
|
||||
// If there are not metaconsole servers don't allow to create new custom graphs
|
||||
$style_button_create_custom_graph = 'style="display: none;"';
|
||||
}
|
||||
}
|
||||
}
|
||||
echo " ";
|
||||
html_print_button(__("Create"), 'create_graph', false,
|
||||
|
@ -926,21 +974,137 @@ $(document).ready (function () {
|
|||
});
|
||||
|
||||
function create_custom_graph() {
|
||||
window.location.href = "index.php?sec=greporting&sec2=godmode/reporting/graph_builder&create=Create graph";
|
||||
<?php
|
||||
global $config;
|
||||
|
||||
// Metaconsole activated
|
||||
if ($config['metaconsole'] == 1) {
|
||||
?>
|
||||
var target_server = $("#meta_servers").val();
|
||||
// If target server is not selected
|
||||
if (target_server == 0) {
|
||||
$("#meta_target_servers").fadeOut ('normal');
|
||||
$("#meta_target_servers").fadeIn ('normal');
|
||||
$("#meta_target_servers").css('display', 'inline');
|
||||
}
|
||||
else {
|
||||
|
||||
var hash_data;
|
||||
var params1 = [];
|
||||
params1.push("get_metaconsole_hash_data=1");
|
||||
params1.push("server_name=" + target_server);
|
||||
params1.push("page=include/ajax/reporting.ajax");
|
||||
jQuery.ajax ({
|
||||
data: params1.join ("&"),
|
||||
type: 'POST',
|
||||
url: action="ajax.php",
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
success: function (data) {
|
||||
hash_data = data;
|
||||
}
|
||||
});
|
||||
|
||||
var server_url;
|
||||
var params1 = [];
|
||||
params1.push("get_metaconsole_server_url=1");
|
||||
params1.push("server_name=" + target_server);
|
||||
params1.push("page=include/ajax/reporting.ajax");
|
||||
jQuery.ajax ({
|
||||
data: params1.join ("&"),
|
||||
type: 'POST',
|
||||
url: action="ajax.php",
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
success: function (data) {
|
||||
server_url = data;
|
||||
}
|
||||
});
|
||||
|
||||
window.location.href = server_url + "/index.php?sec=reporting&sec2=godmode/reporting/graph_builder&create=Create graph" + hash_data;
|
||||
}
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
?>
|
||||
window.location.href = "index.php?sec=reporting&sec2=godmode/reporting/graph_builder&create=Create graph";
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
}
|
||||
|
||||
function edit_custom_graph() {
|
||||
var id_graph = $("#id_custom_graph").val();
|
||||
window.location.href = "index.php?sec=greporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id=" + id_graph;
|
||||
<?php
|
||||
global $config;
|
||||
|
||||
// Metaconsole activated
|
||||
if ($config['metaconsole'] == 1) {
|
||||
?>
|
||||
var agent_server_temp;
|
||||
var id_element_graph;
|
||||
var id_server;
|
||||
|
||||
if (id_graph.indexOf("|") != -1){
|
||||
agent_server_temp = id_graph.split('|');
|
||||
id_element_graph = agent_server_temp[0];
|
||||
id_server = agent_server_temp[1];
|
||||
}
|
||||
|
||||
var hash_data;
|
||||
var params1 = [];
|
||||
params1.push("get_metaconsole_hash_data=1");
|
||||
params1.push("server_name=" + id_server);
|
||||
params1.push("page=include/ajax/reporting.ajax");
|
||||
jQuery.ajax ({
|
||||
data: params1.join ("&"),
|
||||
type: 'POST',
|
||||
url: action="ajax.php",
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
success: function (data) {
|
||||
hash_data = data;
|
||||
}
|
||||
});
|
||||
|
||||
var server_url;
|
||||
var params1 = [];
|
||||
params1.push("get_metaconsole_server_url=1");
|
||||
params1.push("server_name=" + id_server);
|
||||
params1.push("page=include/ajax/reporting.ajax");
|
||||
jQuery.ajax ({
|
||||
data: params1.join ("&"),
|
||||
type: 'POST',
|
||||
url: action="ajax.php",
|
||||
async: false,
|
||||
timeout: 10000,
|
||||
success: function (data) {
|
||||
server_url = data;
|
||||
}
|
||||
});
|
||||
|
||||
window.location.href = server_url + "/index.php?sec=greporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id=" + id_element_graph + hash_data;
|
||||
<?php
|
||||
}
|
||||
else {
|
||||
?>
|
||||
window.location.href = "index.php?sec=greporting&sec2=godmode/reporting/graph_builder&edit_graph=1&id=" + id_graph;
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
}
|
||||
|
||||
function change_custom_graph() {
|
||||
//Hidden the button create or edit custom graph
|
||||
if ($("#id_custom_graph").val() != "0") {
|
||||
$("#meta_servers").val(0);
|
||||
$("#meta_target_servers").css('display', 'none');
|
||||
$("#button-create_graph").css("display", "none");
|
||||
$("#button-edit_graph").css("display", "");
|
||||
}
|
||||
else {
|
||||
$("#meta_servers").val(0);
|
||||
$("#meta_target_servers").css('display', 'none');
|
||||
$("#button-create_graph").css("display", "");
|
||||
$("#button-edit_graph").css("display", "none");
|
||||
}
|
||||
|
|
|
@ -320,7 +320,7 @@ foreach ($items as $item) {
|
|||
}
|
||||
$row[6] .= '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=edit&id_report=' . $idReport . '&id_item=' . $item['id_rc'] . '">' . html_print_image("images/wrench_orange.png", true, array("title" => __('Edit'))) . '</a>';
|
||||
$row[6] .= ' ';
|
||||
$row[6] .= '<a href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=delete&id_report=' . $idReport . '&id_item=' . $item['id_rc'] . $urlFilter . '">' . html_print_image("images/cross.png", true, array("title" => __('Delete'))) .'</a>';
|
||||
$row[6] .= '<a onClick="if (!confirm (\'Are you sure?\')) return false" href="index.php?sec=greporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=delete&id_report=' . $idReport . '&id_item=' . $item['id_rc'] . $urlFilter . '">' . html_print_image("images/cross.png", true, array("title" => __('Delete'))) .'</a>';
|
||||
|
||||
$table->data[] = $row;
|
||||
$count++;
|
||||
|
|
|
@ -427,7 +427,10 @@ switch ($action) {
|
|||
|
||||
$values['id_agent'] = get_parameter('id_agent');
|
||||
$values['id_gs'] = get_parameter('id_custom_graph');
|
||||
$values['id_agent_module'] = get_parameter('id_agent_module');
|
||||
if (($type == 'alert_report_agent') or ($type == 'event_report_agent'))
|
||||
$values['id_agent_module'] = '';
|
||||
else
|
||||
$values['id_agent_module'] = get_parameter('id_agent_module');
|
||||
$values['only_display_wrong'] = get_parameter('checkbox_only_display_wrong');
|
||||
$values['monday'] = get_parameter('monday', 0);
|
||||
$values['tuesday'] = get_parameter('tuesday', 0);
|
||||
|
@ -550,7 +553,10 @@ switch ($action) {
|
|||
|
||||
$values['id_agent'] = get_parameter('id_agent');
|
||||
$values['id_gs'] = get_parameter('id_custom_graph');
|
||||
$values['id_agent_module'] = get_parameter('id_agent_module');
|
||||
if (($values['type'] == 'alert_report_agent') or ($values['type'] == 'event_report_agent'))
|
||||
$values['id_agent_module'] = '';
|
||||
else
|
||||
$values['id_agent_module'] = get_parameter('id_agent_module');
|
||||
switch ($config['dbtype']) {
|
||||
case "mysql":
|
||||
case "postgresql":
|
||||
|
|
|
@ -33,6 +33,8 @@ $add_sla = get_parameter('add_sla', 0);
|
|||
$add_general = get_parameter('add_general', 0);
|
||||
$id = get_parameter('id', 0);
|
||||
$truncate_text = get_parameter ('truncate_text', 0);
|
||||
$get_metaconsole_hash_data = get_parameter('get_metaconsole_hash_data', 0);
|
||||
$get_metaconsole_server_url = get_parameter('get_metaconsole_server_url', 0);
|
||||
|
||||
if ($delete_sla_item) {
|
||||
$result = db_process_sql_delete('treport_content_sla_combined', array('id' => (int)$id));
|
||||
|
@ -138,4 +140,33 @@ if ($truncate_text) {
|
|||
return ui_print_truncate_text ($text, 20, true, false);
|
||||
}
|
||||
|
||||
?>
|
||||
if ($get_metaconsole_hash_data) {
|
||||
$server_name = get_parameter('server_name');
|
||||
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
|
||||
$server = enterprise_hook('metaconsole_get_connection', array($server_name));
|
||||
|
||||
$pwd = $server["auth_token"]; // Create HASH login info
|
||||
$user = $config["id_user"];
|
||||
$hashdata = $user.$pwd;
|
||||
$hashdata = md5($hashdata);
|
||||
$url_hash = "&loginhash=auto&loginhash_data=$hashdata&loginhash_user=$user";
|
||||
|
||||
echo $url_hash;
|
||||
return;
|
||||
}
|
||||
|
||||
if ($get_metaconsole_server_url) {
|
||||
$server_name = get_parameter('server_name');
|
||||
|
||||
enterprise_include_once('include/functions_metaconsole.php');
|
||||
|
||||
$server = enterprise_hook('metaconsole_get_connection', array($server_name));
|
||||
|
||||
echo $server["server_url"];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue