Merge branch '1827-Graficas_TIP_eje_x_no_mantiene_ratio' into 'develop'

1827 graficas tip eje x no mantiene ratio

See merge request artica/pandorafms!1542
This commit is contained in:
nramon 2018-06-18 10:48:34 +02:00
commit 72f9bc754c
5 changed files with 50 additions and 40 deletions

View File

@ -39,16 +39,12 @@ check_login();
global $config;
/*
$params_json = base64_decode((string) get_parameter('params'));
$params = json_decode($params_json, true);
$params = json_decode($_GET['data'], true);
// Metaconsole connection to the node
$server_id = (int) (isset($params['server']) ? $params['server'] : 0);
$server_id = $params['server_id'];
if ($config["metaconsole"] && !empty($server_id)) {
$server = metaconsole_get_connection_by_id($server_id);
// Error connecting
if (metaconsole_connect($server) !== NOERR) {
echo "<html>";
@ -59,7 +55,7 @@ if ($config["metaconsole"] && !empty($server_id)) {
exit;
}
}
*/
$user_language = get_user_language($config['id_user']);
if (file_exists ('languages/'.$user_language.'.mo')) {
@ -98,7 +94,7 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
<body bgcolor="#ffffff" style='background:#ffffff;'>
<?php
$params = json_decode($_GET['data'], true);
$params['only_image'] = false;
$params['width'] = '1048';
$params['menu'] = false;

View File

@ -3237,19 +3237,19 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
$session_id = session_id();
$result = exec(
io_safe_output($config['phantomjs_bin']) . DIRECTORY_SEPARATOR ."phantomjs " . $file_js . " " .
$url . " '" .
$type_graph_pdf . "' '" .
$params_encode_json . "' '" .
$params_combined . "' '" .
$module_list . "' " .
$img_path . " " .
$width_img . " " .
$height_img . " '" .
$session_id . "' " .
$params['return_img_base_64']
);
$cmd = '"' . io_safe_output($config['phantomjs_bin']) . DIRECTORY_SEPARATOR . 'phantomjs" "' . $file_js . '" '
. ' "' . $url . '"'
. ' "' . $type_graph_pdf . '"'
. ' "' . $params_encode_json . '"'
. ' "' . $params_combined . '"'
. ' "' . $module_list . '"'
. ' "' . $img_path . '"'
. ' "' . $width_img . '"'
. ' "' . $height_img . '"'
. ' "' . $session_id . '"'
. ' "' . $params['return_img_base_64'] . '"';
$result = exec($cmd);
if($params['return_img_base_64']){
return $result;

View File

@ -864,7 +864,7 @@ function config_process_config () {
if (!isset ($config['phantomjs_bin'])) {
if ($is_windows){
$default = 'C:\\PandoraFMS\\Pandora_Server\\data_in';
$default = 'C:\\PandoraFMS\\phantomjs';
}
else{
$default = '/usr/bin';
@ -2195,7 +2195,7 @@ function config_check () {
if(!isset($result_ejecution) || $result_ejecution == ''){
set_pandora_error_for_header(
__('To be able to create images of the graphs for PDFs, please install the phantom.js extension. For that, it is necessary to follow these steps:') .
'<a src="">Click here</a>',
'<a target="blank" href="https://wiki.pandorafms.com/index.php?title=Pandora:Documentation_es:Configuracion#Phantomjs">Click here</a>',
__("phantomjs is not installed"));
}
}

View File

@ -701,7 +701,8 @@ function grafico_modulo_sparse_data(
'return_img_base_64' => false,
'image_treshold' => false,
'graph_combined' => false,
'zoom' => 1
'zoom' => 1,
'server_id' => null
);
*/
function grafico_modulo_sparse ($params) {

View File

@ -2776,7 +2776,8 @@ function reporting_network_interfaces_report($report, $content, $type = 'dinamic
$content,
$report,
$fullscale,
$pdf
$pdf,
$id_meta
);
}
@ -2785,7 +2786,7 @@ function reporting_network_interfaces_report($report, $content, $type = 'dinamic
function agents_get_network_interfaces_array(
$network_interfaces_by_agents, $return,
$type, $content, $report, $fullscale, $pdf
$type, $content, $report, $fullscale, $pdf, $id_meta
){
if (empty($network_interfaces_by_agents)) {
$return['failed'] =
@ -2816,7 +2817,8 @@ function agents_get_network_interfaces_array(
'date' => $report["datetime"],
'only_image'=> $pdf,
'homeurl' => $config['homeurl'],
'fullscale' => $fullscale
'fullscale' => $fullscale,
'server_id' => $id_meta
);
$params_combined = array(
@ -3528,7 +3530,8 @@ function reporting_simple_baseline_graph($report, $content,
'only_image' => $only_image,
'homeurl' => ui_get_full_url(false, false, false, false),
'ttl' => $ttl,
'array_data_create' => $baseline_data
'array_data_create' => $baseline_data,
'server_id' => $id_meta
);
$return['chart'] = grafico_modulo_sparse ($params);
@ -3638,7 +3641,8 @@ function reporting_projection_graph($report, $content,
'unit' => '',
'only_image' => $pdf,
'homeurl' => ui_get_full_url(false, false, false, false) . '/',
'ttl' => $ttl
'ttl' => $ttl,
'server_id' => $id_meta
);
$params_combined = array(
@ -3899,7 +3903,8 @@ function reporting_value($report, $content, $type,$pdf) {
'homeurl' => ui_get_full_url(false, false, false, false),
'ttl' => 1,///2
'type_graph' => $config['type_module_charts'],
'time_interval' => $content['lapse']
'time_interval' => $content['lapse'],
'server_id' => $id_meta
);
$value = '
@ -6275,6 +6280,12 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
require_once ($config["homedir"] . '/include/functions_graph.php');
if ($config['metaconsole']) {
$id_meta = metaconsole_get_id_server($content["server_name"]);
$server = metaconsole_get_connection_by_id ($id_meta);
metaconsole_connect($server);
}
$graph = db_get_row ("tgraph", "id_graph", $content['id_gs']);
$return = array();
$return['type'] = 'custom_graph';
@ -6307,15 +6318,16 @@ function reporting_custom_graph($report, $content, $type = 'dinamic',
case 'static':
$params =array(
'period' => $content['period'],
'width' => $width,
'height' => $height,
'date' => $report["datetime"],
'only_image' => $pdf,
'homeurl' => ui_get_full_url(false, false, false, false),
'ttl' => $ttl,
'percentil' => $graphs[0]["percentil"],
'fullscale' => $graphs[0]["fullscale"],
'period' => $content['period'],
'width' => $width,
'height' => $height,
'date' => $report["datetime"],
'only_image' => $pdf,
'homeurl' => ui_get_full_url(false, false, false, false),
'ttl' => $ttl,
'percentil' => $graphs[0]["percentil"],
'fullscale' => $graphs[0]["fullscale"],
'server_id' => $id_meta
);
$params_combined = array(
@ -6419,7 +6431,8 @@ function reporting_simple_graph($report, $content, $type = 'dinamic',
'compare' => $time_compare_overlapped,
'show_unknown' => true,
'percentil' => ($content['style']['percentil'] == 1) ? $config['percentil'] : null,
'fullscale' => $fullscale
'fullscale' => $fullscale,
'server_id' => $id_meta
);
$return['chart'] = grafico_modulo_sparse($params);