Merge remote-tracking branch 'origin/develop' into ent-9640-agrupacion-de-graficas-en-periodos-de-tiempo

This commit is contained in:
daniel 2023-10-20 10:08:20 +02:00
commit 6ad9b27df8
72 changed files with 701 additions and 492 deletions

View File

@ -1,5 +1,5 @@
package: pandorafms-agent-unix package: pandorafms-agent-unix
Version: 7.0NG.773.3-231018 Version: 7.0NG.773.3-231020
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.773.3-231018" pandora_version="7.0NG.773.3-231020"
echo "Test if you has the tools for to make the packages." echo "Test if you has the tools for to make the packages."
whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null

View File

@ -1031,7 +1031,7 @@ my $Sem = undef;
my $ThreadSem = undef; my $ThreadSem = undef;
use constant AGENT_VERSION => '7.0NG.773.3'; use constant AGENT_VERSION => '7.0NG.773.3';
use constant AGENT_BUILD => '231018'; use constant AGENT_BUILD => '231020';
# Agent log default file size maximum and instances # Agent log default file size maximum and instances
use constant DEFAULT_MAX_LOG_SIZE => 600000; use constant DEFAULT_MAX_LOG_SIZE => 600000;

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.773.3 %define version 7.0NG.773.3
%define release 231018 %define release 231020
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -5,7 +5,7 @@
%define name pandorafms_agent_linux_bin %define name pandorafms_agent_linux_bin
%define source_name pandorafms_agent_linux %define source_name pandorafms_agent_linux
%define version 7.0NG.773.3 %define version 7.0NG.773.3
%define release 231018 %define release 231020
Summary: Pandora FMS Linux agent, binary version Summary: Pandora FMS Linux agent, binary version
Name: %{name} Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_agent_linux %define name pandorafms_agent_linux
%define version 7.0NG.773.3 %define version 7.0NG.773.3
%define release 231018 %define release 231020
Summary: Pandora FMS Linux agent, PERL version Summary: Pandora FMS Linux agent, PERL version
Name: %{name} Name: %{name}

View File

@ -10,7 +10,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.773.3" PI_VERSION="7.0NG.773.3"
PI_BUILD="231018" PI_BUILD="231020"
OS_NAME=`uname -s` OS_NAME=`uname -s`
FORCE=0 FORCE=0

View File

@ -186,7 +186,7 @@ UpgradeApplicationID
{} {}
Version Version
{231018} {231020}
ViewReadme ViewReadme
{Yes} {Yes}

View File

@ -30,7 +30,7 @@ using namespace Pandora;
using namespace Pandora_Strutils; using namespace Pandora_Strutils;
#define PATH_SIZE _MAX_PATH+1 #define PATH_SIZE _MAX_PATH+1
#define PANDORA_VERSION ("7.0NG.773.3 Build 231018") #define PANDORA_VERSION ("7.0NG.773.3 Build 231020")
string pandora_path; string pandora_path;
string pandora_dir; string pandora_dir;

View File

@ -11,7 +11,7 @@ BEGIN
VALUE "LegalCopyright", "Pandora FMS" VALUE "LegalCopyright", "Pandora FMS"
VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "OriginalFilename", "PandoraAgent.exe"
VALUE "ProductName", "Pandora FMS Windows Agent" VALUE "ProductName", "Pandora FMS Windows Agent"
VALUE "ProductVersion", "(7.0NG.773.3(Build 231018))" VALUE "ProductVersion", "(7.0NG.773.3(Build 231020))"
VALUE "FileVersion", "1.0.0.0" VALUE "FileVersion", "1.0.0.0"
END END
END END

View File

@ -1,5 +1,5 @@
package: pandorafms-console package: pandorafms-console
Version: 7.0NG.773.3-231018 Version: 7.0NG.773.3-231020
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.773.3-231018" pandora_version="7.0NG.773.3-231020"
package_pear=0 package_pear=0
package_pandora=1 package_pandora=1

View File

@ -1640,7 +1640,6 @@ if (check_login()) {
// Uncompress. // Uncompress.
try { try {
ob_start();
$dateNow = get_system_time(); $dateNow = get_system_time();
$final = ($dateNow - $period); $final = ($dateNow - $period);
$date = ($dateNow - ($time_all_box * $start)); $date = ($dateNow - ($time_all_box * $start));
@ -1764,31 +1763,11 @@ if (check_login()) {
'recordsFiltered' => $total_box, 'recordsFiltered' => $total_box,
] ]
); );
$response = ob_get_clean();
// Clean output buffer.
while (ob_get_level() !== 0) {
ob_end_clean();
}
} catch (Exception $e) { } catch (Exception $e) {
echo json_encode( echo json_encode(
['error' => $e->getMessage()] ['error' => $e->getMessage()]
); );
} }
// If not valid it will throw an exception.
json_decode($response);
if (json_last_error() === JSON_ERROR_NONE) {
// If valid dump.
echo $response;
} else {
echo json_encode(
['error' => $response]
);
}
return;
} }
if ($get_cluster_module_detail === true) { if ($get_cluster_module_detail === true) {

View File

@ -96,9 +96,6 @@ if ($force_remote_check) {
if ($load_css_cv === true) { if ($load_css_cv === true) {
$uniq = get_parameter('uniq', 0); $uniq = get_parameter('uniq', 0);
$ratio = get_parameter('ratio', 0); $ratio = get_parameter('ratio', 0);
$output = css_label_styles_visual_console($uniq, $ratio);
echo $output;
return; return;
} }

View File

@ -20,7 +20,7 @@
/** /**
* Pandora build version and version * Pandora build version and version
*/ */
$build_version = 'PC231018'; $build_version = 'PC231020';
$pandora_version = 'v7.0NG.773.3'; $pandora_version = 'v7.0NG.773.3';
// Do not overwrite default timezone set if defined. // Do not overwrite default timezone set if defined.

View File

@ -498,7 +498,7 @@ function netflow_get_top_N(
$options = '-o "fmt:%sap,%dap,%ibyt,%bps" -q -n '.$max.' -s record/bytes -t '.date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date); $options = '-o "fmt:%sap,%dap,%ibyt,%bps" -q -n '.$max.' -s record/bytes -t '.date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
$command = netflow_get_command($options, $filter); $command = netflow_get_command($options, $filter, $start_date, $end_date);
// Execute nfdump. // Execute nfdump.
exec($command, $lines); exec($command, $lines);
@ -656,7 +656,10 @@ function netflow_get_data(
$aggregate, $aggregate,
$max, $max,
$absolute, $absolute,
$connection_name $connection_name,
false,
$start_date,
$end_date
); );
foreach ($data as $line) { foreach ($data as $line) {
@ -734,6 +737,8 @@ function netflow_get_data(
* to get troughput. * to get troughput.
* @param string $connection_name Node name when data is get in meta. * @param string $connection_name Node name when data is get in meta.
* @param boolean $address_resolution True to resolve ips to hostnames. * @param boolean $address_resolution True to resolve ips to hostnames.
* @param integer $start_date_fixed Start date for use in command netflow.
* @param integer $end_date_fixed End date for use in command netflow.
* *
* @return array With netflow stats. * @return array With netflow stats.
*/ */
@ -745,7 +750,9 @@ function netflow_get_stats(
$max, $max,
$absolute=true, $absolute=true,
$connection_name='', $connection_name='',
$address_resolution=false $address_resolution=false,
$start_date_fixed=0,
$end_date_fixed=0,
) { ) {
global $config, $nfdump_date_format; global $config, $nfdump_date_format;
@ -757,8 +764,7 @@ function netflow_get_stats(
// Get the command to call nfdump. // Get the command to call nfdump.
$options = "-o csv -q -n $max -s $aggregate/bytes -t ".date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date); $options = "-o csv -q -n $max -s $aggregate/bytes -t ".date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
$command = netflow_get_command($options, $filter); $command = netflow_get_command($options, $filter, $start_date_fixed, $end_date_fixed);
// Execute nfdump. // Execute nfdump.
exec($command, $string); exec($command, $string);
@ -845,7 +851,7 @@ function netflow_get_summary($start_date, $end_date, $filter, $connection_name='
// Get the command to call nfdump. // Get the command to call nfdump.
$options = '-o csv -n 1 -s srcip/bytes -t '.date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date); $options = '-o csv -n 1 -s srcip/bytes -t '.date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
$command = netflow_get_command($options, $filter); $command = netflow_get_command($options, $filter, $start_date, $end_date);
// Execute nfdump. // Execute nfdump.
exec($command, $string); exec($command, $string);
@ -916,7 +922,7 @@ function netflow_get_relationships_raw_data(
// Get the command to call nfdump. // Get the command to call nfdump.
$options = ' -q -o csv -n 10000 -s record/bytes -t '.date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date); $options = ' -q -o csv -n 10000 -s record/bytes -t '.date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
$command = netflow_get_command($options, $filter); $command = netflow_get_command($options, $filter, $start_date, $end_date);
// Execute nfdump. // Execute nfdump.
// $command .= ' -q -o csv -n 10000 -s record/bytes -t '.date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date); // $command .= ' -q -o csv -n 10000 -s record/bytes -t '.date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
@ -1018,7 +1024,7 @@ function netflow_parse_relationships_for_circular_mesh(
* *
* @return string Command to run. * @return string Command to run.
*/ */
function netflow_get_command($options, $filter) function netflow_get_command($options, $filter, $date_init=0, $date_end=0)
{ {
global $config; global $config;
@ -1030,14 +1036,46 @@ function netflow_get_command($options, $filter)
&& isset($config['netflow_name_dir']) && $config['netflow_name_dir'] !== '' && isset($config['netflow_name_dir']) && $config['netflow_name_dir'] !== ''
&& isset($config['general_network_path']) && $config['general_network_path'] !== '' && isset($config['general_network_path']) && $config['general_network_path'] !== ''
) { ) {
$command .= ' -R. -M '.$config['general_network_path'].$config['netflow_name_dir'].':'.$config['sflow_name_dir']; if ($date_init > 0 && $date_end > 0) {
$path = $config['general_network_path'].$config['sflow_name_dir'];
$range_time = find_range_files_time($path, $date_init, $date_end);
if ($range_time[0] === 0 && $range_time[1] === 0) {
$interval_files_sflow = $path;
} else {
$interval_files_sflow = $path.'/'.$range_time[0].':'.$range_time[1];
}
$path = $config['general_network_path'].$config['netflow_name_dir'];
$range_time = find_range_files_time($path, $date_init, $date_end);
if ($range_time[0] === 0 && $range_time[1] === 0) {
$interval_files_netflow = $path;
} else {
$interval_files_netflow = $path.'/'.$range_time[0].':'.$range_time[1];
}
$command .= ' -R '.$interval_files_sflow.' -R '.$interval_files_netflow;
} else {
$command .= ' -R. -M '.$config['general_network_path'].$config['netflow_name_dir'].':'.$config['sflow_name_dir'];
}
} }
} else { } else {
if ($config['activate_sflow']) { if ($config['activate_sflow']) {
if (isset($config['sflow_name_dir']) && $config['sflow_name_dir'] !== '' if (isset($config['sflow_name_dir']) && $config['sflow_name_dir'] !== ''
&& isset($config['general_network_path']) && $config['general_network_path'] !== '' && isset($config['general_network_path']) && $config['general_network_path'] !== ''
) { ) {
$command .= ' -R. -M '.$config['general_network_path'].$config['sflow_name_dir']; if ($date_init > 0 && $date_end > 0) {
$path = $config['general_network_path'].$config['sflow_name_dir'];
$range_time = find_range_files_time($path, $date_init, $date_end);
if ($range_time[0] === 0 && $range_time[1] === 0) {
$interval_files = '.';
} else {
$interval_files = $range_time[0].':'.$range_time[1];
}
} else {
$interval_files = '.';
}
$command .= ' -R '.$interval_files.' -M '.$config['general_network_path'].$config['sflow_name_dir'];
} }
} }
@ -1045,7 +1083,19 @@ function netflow_get_command($options, $filter)
if (isset($config['netflow_name_dir']) && $config['netflow_name_dir'] !== '' if (isset($config['netflow_name_dir']) && $config['netflow_name_dir'] !== ''
&& isset($config['general_network_path']) && $config['general_network_path'] !== '' && isset($config['general_network_path']) && $config['general_network_path'] !== ''
) { ) {
$command .= ' -R. -M '.$config['general_network_path'].$config['netflow_name_dir']; if ($date_init > 0 && $date_end > 0) {
$path = $config['general_network_path'].$config['netflow_name_dir'];
$range_time = find_range_files_time($path, $date_init, $date_end);
if ($range_time[0] === 0 && $range_time[1] === 0) {
$interval_files = '.';
} else {
$interval_files = $range_time[0].':'.$range_time[1];
}
} else {
$interval_files = '.';
}
$command .= ' -R '.$interval_files.' -M '.$config['general_network_path'].$config['netflow_name_dir'];
} }
} }
} }
@ -1059,6 +1109,62 @@ function netflow_get_command($options, $filter)
} }
/**
* Find the two files closest to the time range.
*
* @param string $folder Folder of netflow.
* @param integer $date_init Time init for range.
* @param integer $date_end Time end for range.
*
* @return array
*/
function find_range_files_time($folder, $date_init, $date_end)
{
$closest_init = 0;
$closest_end = 0;
$closest_init_date = 0;
$closest_end_date = 0;
$min_diff_init = PHP_INT_MAX;
$min_diff_end = PHP_INT_MAX;
$files = scandir($folder);
if ($date_init > 0) {
foreach ($files as $file) {
if (preg_match('/^nfcapd\.(\d{12})$/', $file, $matches)) {
$file_date = $matches[1];
$file_date = strtotime(substr($file_date, 0, 4).'-'.substr($file_date, 4, 2).'-'.substr($file_date, 6, 2).' '.substr($file_date, 8, 2).':'.substr($file_date, 10, 2));
$diff_init = abs($file_date - $date_init);
if ($diff_init < $min_diff_init) {
$closest_init_date = $file_date;
$min_diff_init = $diff_init;
$closest_init = $file;
}
$diff_end = abs($file_date - $date_end);
if ($diff_end < $min_diff_end) {
$closest_end_date = $file_date;
$min_diff_end = $diff_end;
$closest_end = $file;
}
}
}
}
if ($closest_end_date < $date_init || $closest_init_date > $date_end) {
return [
0,
0,
];
} else {
return [
$closest_init,
$closest_end,
];
}
}
/** /**
* Returns the nfdump command line arguments that match the given filter. * Returns the nfdump command line arguments that match the given filter.
* *
@ -1336,7 +1442,9 @@ function netflow_draw_item(
$max_aggregates, $max_aggregates,
true, true,
$connection_name, $connection_name,
$address_resolution $address_resolution,
$start_date,
$end_date
); );
if (empty($data_pie) === true) { if (empty($data_pie) === true) {
@ -1451,7 +1559,9 @@ function netflow_draw_item(
$max_aggregates, $max_aggregates,
true, true,
$connection_name, $connection_name,
$address_resolution $address_resolution,
$start_date,
$end_date
); );
if (empty($data_stats) === false) { if (empty($data_stats) === false) {
@ -1572,7 +1682,9 @@ function netflow_get_item_data(
$aggregate, $aggregate,
$max_aggregates, $max_aggregates,
true, true,
$connection_name $connection_name,
$start_date,
$end_date
); );
$data = [ $data = [
@ -1801,7 +1913,7 @@ function netflow_get_top_summary(
} }
$options = "-q -o csv -n $max -s $sort/$order_text -t ".date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date); $options = "-q -o csv -n $max -s $sort/$order_text -t ".date($nfdump_date_format, $start_date).'-'.date($nfdump_date_format, $end_date);
$command = netflow_get_command($options, $netflow_filter); $command = netflow_get_command($options, $netflow_filter, $start_date, $end_date);
exec($command, $result); exec($command, $result);
if (! is_array($result)) { if (! is_array($result)) {
@ -1962,7 +2074,7 @@ function netflow_get_top_data(
date($nfdump_date_format, $start_date), date($nfdump_date_format, $start_date),
date($nfdump_date_format, $end_date) date($nfdump_date_format, $end_date)
); );
$agg_command = netflow_get_command($options, $filter); $agg_command = netflow_get_command($options, $filter, $start_date, $end_date);
// Call nfdump. // Call nfdump.
exec($agg_command, $string); exec($agg_command, $string);

View File

@ -4548,54 +4548,4 @@ function visual_map_load_client_resources()
closedir($dh); closedir($dh);
} }
} }
} }
/**
* Labels styles visual console.
*
* @param string $uniq Uniq str.
* @param integer $ratio Ratio.
*
* @return string Css output.
*/
function css_label_styles_visual_console($uniq, $ratio=1)
{
global $config;
$output = '';
// Horrible trick! due to the use of tinyMCE
// it is necessary to modify specific classes of each
// of the visual consoles.
$output .= '.c-'.$uniq.' a {color: #3f3f3f } ';
$output .= '.c-'.$uniq.' .label p strong span {display: inline-block !important; line-height: normal !important} ';
$output .= '.c-'.$uniq.' *:not(.parent_graph p table tr td span) { font-size: '.(8 * $ratio).'pt; line-height:'.(8 * ($ratio)).'pt; }';
$output .= '.c-'.$uniq.' .visual-console-item-label table tr td { padding: 0; margin: 0; white-space: pre-wrap; }';
$output .= '.c-'.$uniq.' .visual_font_size_4pt, .c-'.$uniq.' .visual_font_size_4pt * { font-size: '.(4 * $ratio).'pt !important; line-height:'.(4 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_6pt, .c-'.$uniq.' .visual_font_size_6pt * { font-size: '.(6 * $ratio).'pt !important; line-height:'.(6 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_8pt, .c-'.$uniq.' .visual_font_size_8pt * { font-size: '.(8 * $ratio).'pt !important; line-height:'.(8 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_10pt, .c-'.$uniq.' .visual_font_size_10pt * { font-size: '.(10 * $ratio).'pt !important; line-height:'.(10 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_12pt, .c-'.$uniq.' .visual_font_size_12pt * { font-size: '.(12 * $ratio).'pt !important; line-height:'.(12 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_14pt, .c-'.$uniq.' .visual_font_size_14pt * { font-size: '.(14 * $ratio).'pt !important; line-height:'.(14 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_18pt, .c-'.$uniq.' .visual_font_size_18pt * { font-size: '.(18 * $ratio).'pt !important; line-height:'.(18 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_24pt, .c-'.$uniq.' .visual_font_size_24pt * { font-size: '.(24 * $ratio).'pt !important; line-height:'.(24 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_28pt, .c-'.$uniq.' .visual_font_size_28pt * { font-size: '.(28 * $ratio).'pt !important; line-height:'.(28 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_36pt, .c-'.$uniq.' .visual_font_size_36pt * { font-size: '.(36 * $ratio).'pt !important; line-height:'.(36 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_48pt, .c-'.$uniq.' .visual_font_size_48pt * { font-size: '.(48 * $ratio).'pt !important; line-height:'.(48 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_60pt, .c-'.$uniq.' .visual_font_size_60pt * { font-size: '.(60 * $ratio).'pt !important; line-height:'.(60 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_72pt, .c-'.$uniq.' .visual_font_size_72pt * { font-size: '.(72 * $ratio).'pt !important; line-height:'.(72 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_84pt, .c-'.$uniq.' .visual_font_size_84pt * { font-size: '.(84 * $ratio).'pt !important; line-height:'.(84 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_96pt, .c-'.$uniq.' .visual_font_size_96pt * { font-size: '.(96 * $ratio).'pt !important; line-height:'.(96 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_116pt, .c-'.$uniq.' .visual_font_size_116pt * { font-size: '.(116 * $ratio).'pt !important; line-height:'.(116 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_128pt, .c-'.$uniq.' .visual_font_size_128pt * { font-size: '.(128 * $ratio).'pt !important; line-height:'.(128 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_140pt, .c-'.$uniq.' .visual_font_size_140pt * { font-size: '.(140 * $ratio).'pt !important; line-height:'.(140 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_154pt, .c-'.$uniq.' .visual_font_size_154pt * { font-size: '.(154 * $ratio).'pt !important; line-height:'.(154 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual_font_size_196pt, .c-'.$uniq.' .visual_font_size_196pt * { font-size: '.(196 * $ratio).'pt !important; line-height:'.(196 * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .flot-text, .c-'.$uniq.' .flot-text * { font-size: '.(($config['font_size'] - 2) * $ratio).'pt !important; line-height:'.(($config['font_size'] - 2) * ($ratio)).'pt !important; }';
$output .= '.c-'.$uniq.' .visual-console-item .digital-clock span.time {font-size: '.(50 * $ratio).'px !important; line-height: '.(50 * $ratio).'px !important;}';
$output .= '.c-'.$uniq.' .visual-console-item .digital-clock span.date {font-size: '.(25 * $ratio).'px !important; line-height: '.(25 * $ratio).'px !important;}';
$output .= '.c-'.$uniq.' .visual-console-item .digital-clock span.timezone {font-size: '.(25 * $ratio).'px !important; line-height: '.(25 * $ratio).'px !important;}';
$output .= '.c-'.$uniq.' .visual-console-item .donut-graph * {font-size: '.(8 * $ratio).'px !important; line-height: '.(8 * $ratio).'px !important;}';
$output .= '.c-'.$uniq.' .visual-console-item .donut-graph g rect {width:'.(25 * $ratio).' !important; height: '.(15 * $ratio).' !important;}';
return $output;
}

View File

@ -1440,22 +1440,56 @@ function openURLTagWindow(url) {
*/ */
function defineTinyMCE(selector) { function defineTinyMCE(selector) {
var defaultToolbar =
"undo redo | blocks | bold italic | code | alignleft aligncenter alignright alignjustify | outdent indent";
tinymce.init({ tinymce.init({
selector: selector, selector: selector,
plugins: "preview, searchreplace, table, nonbreaking, link, image", plugins:
"preview, searchreplace, table, nonbreaking, link, image, code, codesample",
promotion: false, promotion: false,
branding: false branding: false,
codesample_languages: [
{ text: "HTML/XML", value: "markup" },
{ text: "JavaScript", value: "javascript" },
{ text: "CSS", value: "css" },
{ text: "PHP", value: "php" },
{ text: "Ruby", value: "ruby" },
{ text: "Python", value: "python" },
{ text: "Java", value: "java" },
{ text: "C", value: "c" },
{ text: "C#", value: "csharp" },
{ text: "C++", value: "cpp" }
],
toolbar: defaultToolbar
}); });
} }
function defineTinyMCEDark(selector) { function defineTinyMCEDark(selector) {
var defaultToolbar =
"undo redo | blocks | bold italic | code | alignleft aligncenter alignright alignjustify | outdent indent";
tinymce.init({ tinymce.init({
selector: selector, selector: selector,
plugins: "preview, searchreplace, table, nonbreaking, link, image", plugins:
"preview, searchreplace, table, nonbreaking, link, image, code, codesample",
promotion: false, promotion: false,
branding: false, branding: false,
skin: "oxide-dark", skin: "oxide-dark",
content_css: "dark" content_css: "dark",
codesample_languages: [
{ text: "HTML/XML", value: "markup" },
{ text: "JavaScript", value: "javascript" },
{ text: "CSS", value: "css" },
{ text: "PHP", value: "php" },
{ text: "Ruby", value: "ruby" },
{ text: "Python", value: "python" },
{ text: "Java", value: "java" },
{ text: "C", value: "c" },
{ text: "C#", value: "csharp" },
{ text: "C++", value: "cpp" }
],
toolbar: defaultToolbar
}); });
} }

View File

@ -1294,8 +1294,6 @@ function refresh_pagination_callback(
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
function dashboardLoadVC(settings) { function dashboardLoadVC(settings) {
var headerMobileFix = 40;
var container = document.getElementById( var container = document.getElementById(
"visual-console-container-" + settings.cellId "visual-console-container-" + settings.cellId
); );
@ -1307,36 +1305,36 @@ function dashboardLoadVC(settings) {
var beforeUpdate = function(items, visualConsole, props, size) { var beforeUpdate = function(items, visualConsole, props, size) {
var ratio_visualconsole = props.height / props.width; var ratio_visualconsole = props.height / props.width;
var ratio_w = size.width / props.width; var ratio_ajax = size.width / props.width;
var ratio_h = size.height / props.height; // 1.- Pantalla vertical:
var acum_height = props.height; if (size.width < size.height) {
var acum_width = props.width; props.width = size.width;
props.height = size.width * ratio_visualconsole;
props.width = size.width;
props.height = size.width * ratio_visualconsole;
var ratio = ratio_w;
if (settings.mobile != undefined && settings.mobile === true) {
if (props.height < props.width) {
if (props.height > size.height) {
ratio = ratio_h;
props.height = size.height;
props.width = size.height / ratio_visualconsole;
}
} else {
ratio = ratio_w;
var height = (acum_height * size.width) / acum_width;
props.height = height;
props.width = height / ratio_visualconsole;
}
} else { } else {
if (props.height > size.height) { // 2.- Pantalla horizontal:
ratio = ratio_h; // 2.1. - Consola visual es alargada.
props.height = size.height; if (props.width < props.height) {
props.width = size.height / ratio_visualconsole; props.width = size.width;
props.height = size.width * ratio_visualconsole;
} else {
// 2.2. - Consola visual es estrecha.
var aspect_ratio_cv = props.width / props.height;
var aspect_ratio_screen = size.width / size.height;
// 2.2.1 - Consola visual si su aspect ratio es menor al de la pantalla ahustamos al alto.
if (aspect_ratio_cv < aspect_ratio_screen) {
ratio_ajax = size.height / props.height;
var width = props.width * (size.height / props.height);
props.width = width;
props.height = size.height;
} else {
// 2.2.2 - Consola visual si su aspect ratio es mayor al de la pantalla ahustamos al ancho.
props.width = size.width;
props.height = size.width * ratio_visualconsole;
}
} }
} }
props.ratio = ratio_ajax;
$.ajax({ $.ajax({
method: "post", method: "post",
url: settings.baseUrl + "ajax.php", url: settings.baseUrl + "ajax.php",
@ -1355,6 +1353,8 @@ function dashboardLoadVC(settings) {
// Add the datetime when the item was received. // Add the datetime when the item was received.
items.map(function(item) { items.map(function(item) {
item["receivedAt"] = receivedAt; item["receivedAt"] = receivedAt;
item["cellId"] = settings.cellId;
item["ratio"] = ratio_ajax;
return item; return item;
}); });
@ -1383,21 +1383,18 @@ function dashboardLoadVC(settings) {
var regex_hash = /(hash=)[^&]+(&?)/gi; var regex_hash = /(hash=)[^&]+(&?)/gi;
var replacement_hash = "$1" + props.hash + "$2"; var replacement_hash = "$1" + props.hash + "$2";
/*
var regex_width = /(width=)[^&]+(&?)/gi; var regex_width = /(width=)[^&]+(&?)/gi;
var replacement_width = "$1" + size.width + "$2"; var replacement_width = "$1" + size.width + "$2";
var regex_height = /(height=)[^&]+(&?)/gi; var regex_height = /(height=)[^&]+(&?)/gi;
var replacement_height = var replacement_height = "$1" + size.height + "$2";
"$1" + (size.height + headerMobileFix) + "$2";
*/
// Change the URL (if the browser has support). // Change the URL (if the browser has support).
if ("history" in window) { if ("history" in window) {
var href = window.location.href.replace(regex, replacement); var href = window.location.href.replace(regex, replacement);
href = href.replace(regex_hash, replacement_hash); href = href.replace(regex_hash, replacement_hash);
//href = href.replace(regex_width, replacement_width); href = href.replace(regex_width, replacement_width);
//href = href.replace(regex_height, replacement_height); href = href.replace(regex_height, replacement_height);
window.history.replaceState({}, document.title, href); window.history.replaceState({}, document.title, href);
} }
@ -1436,6 +1433,12 @@ function dashboardLoadVC(settings) {
return item; return item;
}); });
var ratio = settings.ratio;
settings.items.map(function(item) {
item["ratio"] = ratio;
return item;
});
var visualConsoleManager = createVisualConsole( var visualConsoleManager = createVisualConsole(
container, container,
settings.props, settings.props,
@ -1457,9 +1460,7 @@ function dashboardLoadVC(settings) {
} }
if (settings.mobile_view_orientation_vc === true) { if (settings.mobile_view_orientation_vc === true) {
$(window).on("orientationchange", function() { $(window).on("orientationchange", function(event) {
$(container).width($(window).height());
$(container).height($(window).width() - headerMobileFix);
//Remove spinner change VC. //Remove spinner change VC.
container.classList.remove("is-updating"); container.classList.remove("is-updating");
container.classList.remove("cv-overflow"); container.classList.remove("cv-overflow");
@ -1484,9 +1485,33 @@ function dashboardLoadVC(settings) {
divParent.appendChild(divSpinner); divParent.appendChild(divSpinner);
container.appendChild(divParent); container.appendChild(divParent);
let width = 0;
let height = 0;
let isMobile = true;
// If it is detected that it is a real mobile not the web inspector
// deducts 45 more for the header and footer of the mobile.
const fixHeader = 45;
if (navigator && navigator.userAgentData != null) {
isMobile = navigator.userAgentData.mobile;
}
if (event.target.screen.orientation.angle === 0) {
width = $(window).height();
if (isMobile) {
width += fixHeader;
}
height = $(window).width();
} else {
width = $(window).height();
height = $(window).width() - fixHeader;
if (isMobile) {
height -= fixHeader;
}
}
var dimensions = { var dimensions = {
width: $(window).height(), width: width,
height: $(window).width() - 40 height: height
}; };
visualConsoleManager.changeDimensionsVc(dimensions, interval); visualConsoleManager.changeDimensionsVc(dimensions, interval);

View File

@ -1497,7 +1497,11 @@ function show_dialog(dialog) {
$(document).ajaxSend(function(event, jqXHR, ajaxOptions) { $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
const requestBody = ajaxOptions.data; const requestBody = ajaxOptions.data;
try { try {
if (requestBody && requestBody.includes("drawConsoleSound=1")) { if (
requestBody &&
typeof requestBody.includes === "function" &&
requestBody.includes("drawConsoleSound=1")
) {
console.log( console.log(
"AJAX request sent with drawConsoleSound=1:", "AJAX request sent with drawConsoleSound=1:",
ajaxOptions.url ajaxOptions.url
@ -1659,7 +1663,11 @@ $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
$(document).ajaxSend(function(event, jqXHR, ajaxOptions) { $(document).ajaxSend(function(event, jqXHR, ajaxOptions) {
const requestBody = ajaxOptions.data; const requestBody = ajaxOptions.data;
try { try {
if (requestBody && requestBody.includes("drawConsoleSound=1")) { if (
requestBody &&
typeof requestBody.includes === "function" &&
requestBody.includes("drawConsoleSound=1")
) {
console.log( console.log(
"AJAX request sent with drawConsoleSound=1:", "AJAX request sent with drawConsoleSound=1:",
ajaxOptions.url ajaxOptions.url

View File

@ -518,6 +518,10 @@ class DataMatrix extends Widget
$column_names = $info_columns['column_names']; $column_names = $info_columns['column_names'];
$columns_sort = $info_columns['columns_sort']; $columns_sort = $info_columns['columns_sort'];
// Public dashboard.
$hash = get_parameter('auth_hash', '');
$id_user = get_parameter('id_user', '');
$tableId = 'dataMatrix_'.$this->dashboardId.'_'.$this->cellId; $tableId = 'dataMatrix_'.$this->dashboardId.'_'.$this->cellId;
// Load datatables user interface. // Load datatables user interface.
ui_print_datatable( ui_print_datatable(
@ -535,6 +539,9 @@ class DataMatrix extends Widget
'slice' => $this->values['slice'], 'slice' => $this->values['slice'],
'formatData' => $this->values['formatData'], 'formatData' => $this->values['formatData'],
'modules' => json_encode($modules), 'modules' => json_encode($modules),
'auth_hash' => $hash,
'auth_class' => 'PandoraFMS\Dashboard\Manager',
'id_user' => $id_user,
], ],
'default_pagination' => $this->values['limit'], 'default_pagination' => $this->values['limit'],
'no_sortable_columns' => $columns_sort, 'no_sortable_columns' => $columns_sort,

View File

@ -383,6 +383,9 @@ class ITSMIncidences extends Widget
$column_names[] = $fields[$field]; $column_names[] = $fields[$field];
} }
$hash = get_parameter('auth_hash', '');
$id_user = get_parameter('id_user', '');
$tableId = 'ITSMIncidence_'.$this->dashboardId.'_'.$this->cellId; $tableId = 'ITSMIncidence_'.$this->dashboardId.'_'.$this->cellId;
try { try {
ui_print_datatable( ui_print_datatable(
@ -396,6 +399,9 @@ class ITSMIncidences extends Widget
'ajax_data' => [ 'ajax_data' => [
'method' => 'getListTickets', 'method' => 'getListTickets',
'customSearch' => $this->values['customSearch'], 'customSearch' => $this->values['customSearch'],
'auth_hash' => $hash,
'auth_class' => 'PandoraFMS\Dashboard\Manager',
'id_user' => $id_user,
], ],
'order' => [ 'order' => [
'field' => 'updateDate', 'field' => 'updateDate',

View File

@ -431,6 +431,8 @@ class ModulesByStatus extends Widget
$info_columns = $this->columns(); $info_columns = $this->columns();
$column_names = $info_columns['column_names']; $column_names = $info_columns['column_names'];
$columns = $info_columns['columns']; $columns = $info_columns['columns'];
$hash = get_parameter('auth_hash', '');
$id_user = get_parameter('id_user', '');
$tableId = 'ModuleByStatus_'.$this->dashboardId.'_'.$this->cellId; $tableId = 'ModuleByStatus_'.$this->dashboardId.'_'.$this->cellId;
// Load datatables user interface. // Load datatables user interface.
@ -449,6 +451,9 @@ class ModulesByStatus extends Widget
'status' => $this->values['status'], 'status' => $this->values['status'],
'nodes' => $this->values['nodes'], 'nodes' => $this->values['nodes'],
'disabled_modules' => $this->values['disabled_modules'], 'disabled_modules' => $this->values['disabled_modules'],
'auth_hash' => $hash,
'auth_class' => 'PandoraFMS\Dashboard\Manager',
'id_user' => $id_user,
], ],
'default_pagination' => $this->values['limit'], 'default_pagination' => $this->values['limit'],
'order' => [ 'order' => [

View File

@ -417,7 +417,7 @@ class MapsMadeByUser extends Widget
$size['width'] = ($size['width'] + 30); $size['width'] = ($size['width'] + 30);
$ratio = $visualConsole->adjustToViewport($size, 'dashboard'); $ratio = $visualConsole->adjustToViewport($size);
$visualConsoleData = $visualConsole->toArray(); $visualConsoleData = $visualConsole->toArray();
$uniq = uniqid(); $uniq = uniqid();
@ -461,10 +461,6 @@ class MapsMadeByUser extends Widget
$ratio $ratio
); );
$output .= '<style id="css_cv_'.$uniq.'" type="text/css">';
$output .= css_label_styles_visual_console($uniq, $ratio);
$output .= '</style>';
$visualConsoleItems = array_reduce( $visualConsoleItems = array_reduce(
$visualConsoleItems, $visualConsoleItems,
function ($carry, $item) { function ($carry, $item) {
@ -486,7 +482,7 @@ class MapsMadeByUser extends Widget
), ),
'ratio' => $ratio, 'ratio' => $ratio,
'size' => $size, 'size' => $size,
'cellId' => $this->cellId, 'cellId' => (string) $this->cellId,
'hash' => User::generatePublicHash(), 'hash' => User::generatePublicHash(),
'id_user' => $config['id_user'], 'id_user' => $config['id_user'],
'page' => 'include/ajax/visual_console.ajax', 'page' => 'include/ajax/visual_console.ajax',

View File

@ -353,7 +353,6 @@ class Manager
} }
} }
} catch (\Exception $e) { } catch (\Exception $e) {
hd($e->getMessage());
$error_upload = $e->getMessage(); $error_upload = $e->getMessage();
} }
@ -1499,7 +1498,6 @@ class Manager
$result = $ITSM->pingItsmtoPandora($path); $result = $ITSM->pingItsmtoPandora($path);
} catch (Throwable $e) { } catch (Throwable $e) {
echo $e->getMessage(); echo $e->getMessage();
hd($e->getMessage(), true);
$result = false; $result = false;
exit; exit;
} }

View File

@ -125,17 +125,14 @@ if ($getVisualConsole === true) {
} }
$size = get_parameter('size', []); $size = get_parameter('size', []);
$width = get_parameter('widthScreen', 0); $width = get_parameter('widthScreen', 0);
$mode = get_parameter('mode', '');
$ratio = 0; $ratio = 0;
if (isset($size) === true if (isset($size) === true
&& is_array($size) === true && is_array($size) === true
&& empty($size) === false && empty($size) === false
) { ) {
$ratio = $visualConsole->adjustToViewport($size, $mode); $ratio = $visualConsole->adjustToViewport($size);
$visualConsoleData = $visualConsole->toArray(); $visualConsoleData = $visualConsole->toArray();
} }

View File

@ -214,52 +214,41 @@ abstract class Model
/** /**
* Calculate ratio for mobile. * Calculate ratio for CV.
* *
* @param array $size Size viewport. * @param array $size Size viewport.
* @param string $mode Mode calculate (dashboard or mobile).
* *
* @return float Ratio. * @return float Ratio.
*/ */
public function adjustToViewport($size, $mode='') public function adjustToViewport(array $size)
{ {
global $config;
$ratio_visualconsole = $this->getRatio(); $ratio_visualconsole = $this->getRatio();
$ratio_w = ($size['width'] / $this->data['width']); $ratio = ($size['width'] / $this->data['width']);
$ratio_h = ($size['height'] / $this->data['height']); // 1.- Pantalla vertical:
$acum_height = $this->data['height']; if ($size['width'] < $size['height']) {
$acum_width = $this->data['width']; $this->data['width'] = $size['width'];
$this->data['height'] = ($size['width'] * $ratio_visualconsole);
$this->data['width'] = $size['width'];
$this->data['height'] = ($size['width'] * $ratio_visualconsole);
$ratio = $ratio_w;
if ($mode === 'mobile') {
if ((bool) $config['mobile_view_orientation_vc'] === true) {
if ($this->data['height'] < $this->data['width']) {
if ($this->data['height'] > $size['height']) {
$ratio = $ratio_h;
$this->data['height'] = $size['height'];
$this->data['width'] = ($size['height'] / $ratio_visualconsole);
}
} else {
$ratio = $ratio_w;
$height = (($acum_height * ($size['width'])) / $acum_width);
$this->data['height'] = $height;
$this->data['width'] = ($height / $ratio_visualconsole);
}
} else {
if ($this->data['height'] > $this->data['width']) {
$ratio = $ratio_h;
$this->data['height'] = $size['height'];
$this->data['width'] = ($size['height'] / $ratio_visualconsole);
}
}
} else { } else {
if ($this->data['height'] > $size['height']) { // 2.- Pantalla horizontal:
$ratio = $ratio_h; // 2.1. - Consola visual es alargada.
$this->data['height'] = $size['height']; if ($this->data['width'] < $this->data['height']) {
$this->data['width'] = ($size['height'] / $ratio_visualconsole); $this->data['width'] = $size['width'];
$this->data['height'] = ($size['width'] * $ratio_visualconsole);
} else {
// 2.2. - Consola visual es estrecha.
$aspect_ratio_cv = ($this->data['width'] / $this->data['height']);
$aspect_ratio_screen = ($size['width'] / $size['height']);
// 2.2.1 - Consola visual si su aspect ratio es menor al de la pantalla ahustamos al alto.
if ($aspect_ratio_cv < $aspect_ratio_screen) {
$ratio = ($size['height'] / $this->data['height']);
$width = ($this->data['width'] * ($size['height'] / $this->data['height']));
$this->data['width'] = $width;
$this->data['height'] = $size['height'];
} else {
// 2.2.2 - Consola visual si su aspect ratio es mayor al de la pantalla ahustamos al ancho.
$this->data['width'] = $size['width'];
$this->data['height'] = ($size['width'] * $ratio_visualconsole);
}
} }
} }

View File

@ -806,13 +806,6 @@ class Item extends CachedModel
$row['link'] = static::buildLink($row); $row['link'] = static::buildLink($row);
} }
if ($ratio != 0) {
$row['width'] = ($row['width'] * $ratio);
$row['height'] = ($row['height'] * $ratio);
$row['pos_x'] = ($row['pos_x'] * $ratio);
$row['pos_y'] = ($row['pos_y'] * $ratio);
}
if ($widthRatio != 0) { if ($widthRatio != 0) {
$row['width'] = ($row['width'] * $widthRatio); $row['width'] = ($row['width'] * $widthRatio);
$row['pos_x'] = ($row['pos_x'] * $widthRatio); $row['pos_x'] = ($row['pos_x'] * $widthRatio);

View File

@ -284,9 +284,6 @@ final class BarsGraph extends Item
} }
} else { } else {
$size = $config['font_size']; $size = $config['font_size'];
if ($ratio != 0) {
$size = ($config['font_size'] * $ratio);
}
$options = [ $options = [
'width' => $width, 'width' => $width,

View File

@ -429,16 +429,10 @@ final class Clock extends Item
// Default values. // Default values.
if ((int) $data['width'] === 0) { if ((int) $data['width'] === 0) {
$data['width'] = 100; $data['width'] = 100;
if ($ratio != 0) {
$data['width'] *= $ratio;
}
} }
if ((int) $data['height'] === 0) { if ((int) $data['height'] === 0) {
$data['height'] = 50; $data['height'] = 50;
if ($ratio != 0) {
$data['height'] *= $ratio;
}
} }
return $data; return $data;

View File

@ -127,11 +127,6 @@ final class EventsHistory extends Item
if ((int) $data['width'] === 0 && (int) $data['height'] === 0) { if ((int) $data['width'] === 0 && (int) $data['height'] === 0) {
$data['width'] = 420; $data['width'] = 420;
$data['height'] = 80; $data['height'] = 80;
if ($ratio != 0) {
$data['width'] = ($data['width'] * $ratio);
$data['height'] = ($data['height'] * $ratio);
}
} }
// $data['height'] = ($data['height'] - 20); // $data['height'] = ($data['height'] - 20);

View File

@ -205,13 +205,6 @@ final class Line extends Model
throw new \Exception('error fetching the data from the DB'); throw new \Exception('error fetching the data from the DB');
} }
if ($ratio != 0) {
$row['width'] = ($row['width'] * $ratio);
$row['height'] = ($row['height'] * $ratio);
$row['pos_x'] = ($row['pos_x'] * $ratio);
$row['pos_y'] = ($row['pos_y'] * $ratio);
}
if ($widthRatio != 0) { if ($widthRatio != 0) {
$row['width'] = ($row['width'] * $widthRatio); $row['width'] = ($row['width'] * $widthRatio);
$row['pos_x'] = ($row['pos_x'] * $widthRatio); $row['pos_x'] = ($row['pos_x'] * $widthRatio);

View File

@ -325,10 +325,6 @@ final class ModuleGraph extends Item
$width = (int) $data['width']; $width = (int) $data['width'];
$height = (int) $data['height']; $height = (int) $data['height'];
if ($height == 0) {
$height = 15;
}
// Custom graph. // Custom graph.
if (empty($customGraphId) === false) { if (empty($customGraphId) === false) {
$customGraph = \db_get_row('tgraph', 'id_graph', $customGraphId); $customGraph = \db_get_row('tgraph', 'id_graph', $customGraphId);
@ -340,7 +336,12 @@ final class ModuleGraph extends Item
'field_order' 'field_order'
); );
$hackLegendHight = (28 * count($sources)); $total_labels = $config['items_combined_charts'];
if (count($sources) < $config['items_combined_charts']) {
$total_labels = count($sources);
}
$hackLegendHight = (25.5 * $total_labels);
// Trick for legend monstruosity. // Trick for legend monstruosity.
if ((int) $customGraph['stacked'] === CUSTOM_GRAPH_STACKED_LINE if ((int) $customGraph['stacked'] === CUSTOM_GRAPH_STACKED_LINE
@ -348,16 +349,20 @@ final class ModuleGraph extends Item
|| (int) $customGraph['stacked'] === CUSTOM_GRAPH_AREA || (int) $customGraph['stacked'] === CUSTOM_GRAPH_AREA
|| (int) $customGraph['stacked'] === CUSTOM_GRAPH_LINE || (int) $customGraph['stacked'] === CUSTOM_GRAPH_LINE
) { ) {
if ($width < 200 || $height < 200) { if (($height - $hackLegendHight) <= 50) {
$showLegend = false; $showLegend = false;
} else { } else {
$height = ($height - 10 - $hackLegendHight); $height = ($height - $hackLegendHight);
$showLegend = true;
} }
} else if ((int) $customGraph['stacked'] === CUSTOM_GRAPH_VBARS) { } else if ((int) $customGraph['stacked'] === CUSTOM_GRAPH_VBARS) {
$height = ($height - 40); $height = ($height - 40);
} }
if ($height <= 0) {
$showLegend = false;
$height = 100;
}
$params = [ $params = [
'period' => $period, 'period' => $period,
'width' => $width, 'width' => $width,
@ -394,11 +399,8 @@ final class ModuleGraph extends Item
} }
// Trick for legend monstruosity. // Trick for legend monstruosity.
if ($width < 200 || $height < 200) { if ((bool) $showLegend === true) {
$showLegend = false; $height -= 30;
} else {
$height = ($height - 30);
$showLegend = true;
} }
$params = [ $params = [

View File

@ -370,13 +370,6 @@ final class NetworkLink extends Model
throw new \Exception('error fetching the data from the DB'); throw new \Exception('error fetching the data from the DB');
} }
if ($ratio != 0) {
$row['width'] = ($row['width'] * $ratio);
$row['height'] = ($row['height'] * $ratio);
$row['pos_x'] = ($row['pos_x'] * $ratio);
$row['pos_y'] = ($row['pos_y'] * $ratio);
}
if ($widthRatio != 0) { if ($widthRatio != 0) {
$row['width'] = ($row['width'] * $widthRatio); $row['width'] = ($row['width'] * $widthRatio);
$row['pos_x'] = ($row['pos_x'] * $widthRatio); $row['pos_x'] = ($row['pos_x'] * $widthRatio);

View File

@ -251,11 +251,6 @@ final class Odometer extends Item
if ((int) $data['width'] === 0 && (int) $data['height'] === 0) { if ((int) $data['width'] === 0 && (int) $data['height'] === 0) {
$data['width'] = 250; $data['width'] = 250;
$data['height'] = 140; $data['height'] = 140;
if ($ratio != 0) {
$data['width'] = ($data['width'] * $ratio);
$data['height'] = ($data['height'] * $ratio);
}
} }
$data['height'] = ($data['height'] - 20); $data['height'] = ($data['height'] - 20);

View File

@ -242,13 +242,8 @@ final class StaticGraph extends Item
if ($width === 0 || $height === 0) { if ($width === 0 || $height === 0) {
if (isset($imagePath) === true && $imagePath !== false) { if (isset($imagePath) === true && $imagePath !== false) {
$sizeImage = getimagesize($config['homedir'].'/'.$imagePath); $sizeImage = getimagesize($config['homedir'].'/'.$imagePath);
if ($ratio != 0) { $data['width'] = $sizeImage[0];
$data['width'] = ($sizeImage[0] * $ratio); $data['height'] = $sizeImage[1];
$data['height'] = ($sizeImage[1] * $ratio);
} else {
$data['width'] = $sizeImage[0];
$data['height'] = $sizeImage[1];
}
} }
} }

View File

@ -51,6 +51,11 @@ h1 {
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
} }
.visual-console-container-dashboard h1 {
font-size: inherit;
margin-bottom: inherit;
}
.container-fluid { .container-fluid {
margin-top: 5px; margin-top: 5px;
} }
@ -580,9 +585,6 @@ div#main_pure {
margin: 0 !important; margin: 0 !important;
padding: 0 !important; padding: 0 !important;
} }
#main_page > .ui-content div.label > p {
margin: 0;
}
form.modal-dashboard ul.wizard li label { form.modal-dashboard ul.wizard li label {
max-width: 30%; max-width: 30%;

View File

@ -12412,10 +12412,12 @@ div.parent_graph > p.legend_background > table > tbody > tr {
margin-top: -2px; margin-top: -2px;
} }
/*
div#visual-console-container * { div#visual-console-container * {
font-size: unset; font-size: unset;
line-height: unset; line-height: unset;
} }
*/
.combo-oid-button { .combo-oid-button {
display: flex !important; display: flex !important;

View File

@ -32,6 +32,10 @@
.visual-console-item * { .visual-console-item * {
overflow: visible; overflow: visible;
font-family: inherit; font-family: inherit;
line-height: inherit;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
} }
.visual-console-item.is-editing { .visual-console-item.is-editing {
@ -734,6 +738,11 @@ div.module-graph .gauge_d3_class {
border: 2px solid #002f33; border: 2px solid #002f33;
} }
p {
margin-block-start: 1em;
margin-block-end: 1em;
}
/* Styles for the solid icons */ /* Styles for the solid icons */
.fa { .fa {

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -131,7 +131,7 @@
<div style='padding-bottom: 50px'> <div style='padding-bottom: 50px'>
<?php <?php
$version = '7.0NG.773.3'; $version = '7.0NG.773.3';
$build = '231018'; $build = '231020';
$banner = "v$version Build $build"; $banner = "v$version Build $build";
error_reporting(0); error_reporting(0);

View File

@ -36,7 +36,7 @@
} }
@font-face { @font-face {
font-family: "lato"; font-family: "Lato";
src: url("../../../fonts/lato.woff2") format("woff"); src: url("../../../fonts/lato.woff2") format("woff");
font-weight: 400; font-weight: 400;
} }
@ -46,7 +46,7 @@
font-size: 12px; font-size: 12px;
} }
body { body:not(.visual-console-container-dashboard) {
background-color: white; background-color: white;
border-style: none; border-style: none;
direction: ltr; direction: ltr;
@ -1522,6 +1522,10 @@ div.nodata_container {
overflow: hidden !important; overflow: hidden !important;
} }
div.container-center div.visual-console-container-dashboard a {
text-decoration: none !important;
}
.visual-console-container-dashboard a:visited { .visual-console-container-dashboard a:visited {
color: inherit !important; color: inherit !important;
} }
@ -2810,11 +2814,11 @@ div#start_date-container
} }
div#graph_content > div.parent_graph { div#graph_content > div.parent_graph {
width: 100% !important; margin: 0 auto;
display: flex; }
flex-direction: column;
flex-wrap: nowrap; div#container {
align-items: center; text-align: left;
} }
.logout-text { .logout-text {
@ -3281,3 +3285,38 @@ table#list_servers tbody td span.data a {
margin-left: 10px !important; margin-left: 10px !important;
} }
} }
div.visual-console-container-dashboard table > tbody > tr:nth-child(even),
table[id^="service-table-"] > tbody > tr:nth-child(even) {
background-color: transparent;
}
.ui-page-theme-a div.visual-console-container-dashboard a,
html .ui-bar-a div.visual-console-container-dashboard a,
html .ui-body-a div.visual-console-container-dashboard a,
html body .ui-group-theme-a div.visual-console-container-dashboard a {
font-weight: inherit;
}
.ui-overlay-a div.visual-console-container-dashboard,
.ui-page-theme-a div.visual-console-container-dashboard,
.ui-page-theme-a .ui-panel-wrapper div.visual-console-container-dashboard {
text-shadow: none;
}
body div.visual-console-container-dashboard {
line-height: 16pt;
}
body div.visual-console-container-dashboard .line {
line-height: 0px;
}
div.visual-console-container-dashboard table,
div.visual-console-container-dashboard fieldset {
padding: 0px !important;
}
.ui-page-theme-a div.visual-console-container-dashboard a {
color: inherit !important;
}

View File

@ -534,7 +534,6 @@ class Ui
<script> <script>
function show_hide_password(e, url) { function show_hide_password(e, url) {
let inputPass = e.target.previousElementSibling.firstChild; let inputPass = e.target.previousElementSibling.firstChild;
console.log(inputPass);
if (inputPass.type === "password") { if (inputPass.type === "password") {
inputPass.type = "text"; inputPass.type = "text";
@ -1035,9 +1034,8 @@ class Ui
dashboardLoadVC(settings); dashboardLoadVC(settings);
if(settings.mobile_view_orientation_vc === false) { if(settings.mobile_view_orientation_vc === false) {
$("#main_page > .ui-content").css("display", "block"); $("#main_page > .ui-content").css("display", "block");
$(".container-center").css("padding", "50% 0"); $(".container-center").css("padding", "50% 0");
$(".container-center").css("height", "100vh"); $(".container-center").css("height", "100vh");
$(".visual-console-container-dashboard").css("display", "block"); $(".visual-console-container-dashboard").css("display", "block");
$(".visual-console-container-dashboard").css("transform-origin", "left top"); $(".visual-console-container-dashboard").css("transform-origin", "left top");
$(".visual-console-container-dashboard").css("transform", "rotate(-90deg) translate(-100%)"); $(".visual-console-container-dashboard").css("transform", "rotate(-90deg) translate(-100%)");
@ -1047,8 +1045,6 @@ class Ui
$(".container-center").css("overflow", "auto"); $(".container-center").css("overflow", "auto");
} }
} }
}); });
</script>' </script>'
); );

View File

@ -28,15 +28,9 @@ class Groups
function __construct() function __construct()
{ {
$system = System::getInstance(); $system = System::getInstance();
if ($system->checkACL($this->acl)) { if ($system->checkACL($this->acl)) {
$this->correct_acl = true; $this->correct_acl = true;
$this->groups = $this->getListGroups(); $this->groups = $this->getListGroups();
// ~ foreach ($this->groups as $key => $group) {
// ~ $this->status[$key] = $group['status'];
// ~ unset($this->groups[$key]['status']);
// ~ }
} else { } else {
$this->correct_acl = false; $this->correct_acl = false;
} }
@ -71,7 +65,6 @@ class Groups
private function show_group() private function show_group()
{ {
$ui = Ui::getInstance(); $ui = Ui::getInstance();
$ui->createPage(); $ui->createPage();
$ui->createDefaultHeader( $ui->createDefaultHeader(
__('Groups'), __('Groups'),
@ -88,10 +81,10 @@ class Groups
$ui->showFooter(false); $ui->showFooter(false);
$ui->beginContent(); $ui->beginContent();
$ui->contentAddHtml('<div class="list_groups" data-role="collapsible-set" data-theme="a" data-content-theme="d">'); $ui->contentAddHtml('<div class="list_groups" data-role="collapsible-set" data-theme="a" data-content-theme="d">');
$count = 0; $count = 0;
$url_agent = 'index.php?page=agents&group=%s&status=%s'; $url_agent = 'index.php?page=agents&group=%s&status=%s';
$url_modules = 'index.php?page=modules&group=%s&status=%s'; $url_modules = 'index.php?page=modules&group=%s&status=%s';
foreach ($this->groups as $group) { foreach ($this->groups as $group) {
// Calculate entire row color. // Calculate entire row color.
@ -157,7 +150,15 @@ class Groups
$agents_counter .= ']'; $agents_counter .= ']';
if ($group['_iconImg_'] !== null) { if ($group['_iconImg_'] !== null) {
$img_group = html_print_image('images/'.$group['_iconImg_'], true, false, false, false, false, true); $img_group = html_print_image(
'images/'.groups_get_icon($group['_id_']),
true,
false,
false,
false,
false,
true
);
} }
$group['_iconImg_'] = ($group['_iconImg_'] == '') ? 'world.png' : $group['_iconImg_']; $group['_iconImg_'] = ($group['_iconImg_'] == '') ? 'world.png' : $group['_iconImg_'];
@ -218,15 +219,7 @@ class Groups
$count++; $count++;
} }
$ui->contentAddHtml('</div>'); $ui->contentAddHtml('</div>');
// $ui->contentAddHtml(ob_get_clean());
// ~ $table = new Table();
// ~ $table->setId('list_groups');
// ~ $table->setClass('group_view');
// ~ $table->importFromHash($this->groups);
// ~ $table->setRowClass($this->status);
// ~ $ui->contentAddHtml($table->getHTML());
$ui->endContent(); $ui->endContent();
$ui->showPage(); $ui->showPage();
} }

View File

@ -276,12 +276,8 @@ class ModuleGraph
$(document).ready(function() { $(document).ready(function() {
function load_graph() { function load_graph() {
$("#loading_graph").show(); $("#loading_graph").show();
var heigth = $(document).width() / 2;
var heigth = $(document).height() var width = $(document).width();
- $(".ui-header").height()
- $(".ui-collapsible").height()
- 55;
var width = $(document).width() - 25;
ajax_get_graph($("#id_module").val(), heigth, width, $("#server_id").val()); ajax_get_graph($("#id_module").val(), heigth, width, $("#server_id").val());
} }

View File

@ -146,8 +146,7 @@ class Visualmap
$ui->retrieveViewPort(); $ui->retrieveViewPort();
} }
// Header. $this->height -= 45;
$this->height -= 40;
$this->visualmap = db_get_row( $this->visualmap = db_get_row(
'tlayout', 'tlayout',
@ -287,7 +286,8 @@ class Visualmap
]; ];
} }
$ratio_t = $visualConsole->adjustToViewport($size, 'mobile'); $ratio_t = $visualConsole->adjustToViewport($size);
$visualConsoleData = $visualConsole->toArray(); $visualConsoleData = $visualConsole->toArray();
$uniq = uniqid(); $uniq = uniqid();
@ -333,10 +333,6 @@ class Visualmap
$ratio_t $ratio_t
); );
$output .= '<style id="css_cv_'.$uniq.'" type="text/css">';
$output .= css_label_styles_visual_console($uniq, $ratio_t);
$output .= '</style>';
$visualConsoleItems = array_reduce( $visualConsoleItems = array_reduce(
$visualConsoleItems, $visualConsoleItems,
function ($carry, $item) { function ($carry, $item) {

View File

@ -354,8 +354,6 @@ if (is_ajax() === true) {
if ($get_events !== 0) { if ($get_events !== 0) {
try { try {
ob_start();
$fields = [ $fields = [
'te.id_evento', 'te.id_evento',
'te.id_agente', 'te.id_agente',
@ -1223,32 +1221,15 @@ if (is_ajax() === true) {
'recordsFiltered' => $count, 'recordsFiltered' => $count,
] ]
); );
$response = ob_get_clean();
// Clean output buffer.
while (ob_get_level() !== 0) {
ob_end_clean();
}
} catch (Exception $e) { } catch (Exception $e) {
echo json_encode( echo json_encode(
['error' => $e->getMessage()] ['error' => $e->getMessage()]
); );
} }
// If not valid it will throw an exception.
json_decode($response);
if (json_last_error() == JSON_ERROR_NONE) {
// If valid dump.
echo $response;
} else {
echo json_encode(
['error' => $response]
);
}
} }
// AJAX section ends. // AJAX section ends.
exit; return;
} }
/* /*

View File

@ -93,6 +93,7 @@ $filter['ip_src'] = get_parameter('ip_src', '');
$filter['dst_port'] = get_parameter('dst_port', ''); $filter['dst_port'] = get_parameter('dst_port', '');
$filter['src_port'] = get_parameter('src_port', ''); $filter['src_port'] = get_parameter('src_port', '');
$filter['advanced_filter'] = get_parameter('advanced_filter', ''); $filter['advanced_filter'] = get_parameter('advanced_filter', '');
$filter['router_ip'] = get_parameter('router_ip');
$filter['netflow_monitoring'] = (bool) get_parameter('netflow_monitoring'); $filter['netflow_monitoring'] = (bool) get_parameter('netflow_monitoring');
$filter['netflow_monitoring_interval'] = (int) get_parameter('netflow_monitoring_interval', 300); $filter['netflow_monitoring_interval'] = (int) get_parameter('netflow_monitoring_interval', 300);
$filter['traffic_max'] = get_parameter('traffic_max', 0); $filter['traffic_max'] = get_parameter('traffic_max', 0);
@ -109,41 +110,64 @@ $interval_length = get_parameter('interval_length', NETFLOW_RES_MEDD);
$address_resolution = (int) get_parameter('address_resolution', ($config['netflow_get_ip_hostname'] ?? '')); $address_resolution = (int) get_parameter('address_resolution', ($config['netflow_get_ip_hostname'] ?? ''));
$filter_selected = (int) get_parameter('filter_selected', 0); $filter_selected = (int) get_parameter('filter_selected', 0);
// Calculate range dates. // Calculate range dates.
$custom_date = get_parameter('custom_date', '0'); $date_end = get_parameter('date_end', 0);
$date = get_parameter('date', SECONDS_1DAY); $time_end = get_parameter('time_end');
$datetime_end = strtotime($date_end.' '.$time_end);
$custom_date = get_parameter('custom_date', 0);
$range = get_parameter('date', SECONDS_1DAY);
$date_text = get_parameter('date_text', SECONDS_1DAY);
$date_init_less = (strtotime(date('Y/m/d')) - SECONDS_1DAY);
$date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less));
$time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less));
$datetime_init = strtotime($date_init.' '.$time_init);
if ($custom_date === '1') { if ($custom_date === '1') {
$date_init = get_parameter('date_init'); if ($datetime_init >= $datetime_end) {
$time_init = get_parameter('time_init'); $datetime_init = $date_init_less;
$date_end = get_parameter('date_end'); }
$time_end = get_parameter('time_end');
$date_from = strtotime($date_init.' '.$time_init); $date_init = date('Y/m/d H:i:s', $datetime_init);
$date_to = strtotime($date_end.' '.$time_end); $date_end = date('Y/m/d H:i:s', $datetime_end);
$period = ($datetime_end - $datetime_init);
} else if ($custom_date === '2') { } else if ($custom_date === '2') {
$date_text = get_parameter('date_text');
$date_units = get_parameter('date_units'); $date_units = get_parameter('date_units');
$period = ($date_text * $date_units); $date_end = date('Y/m/d H:i:s');
$date_to = strtotime(date('Y-m-d H:i:s')); $date_init = date('Y/m/d H:i:s', (strtotime($date_end) - ((int) $date_text * (int) $date_units)));
$date_from = (strtotime($date_to) - $period); $period = (strtotime($date_end) - strtotime($date_init));
} else if (in_array($date, ['this_week', 'this_month', 'past_week', 'past_month'])) { } else if (in_array($range, ['this_week', 'this_month', 'past_week', 'past_month'])) {
if ($date === 'this_week') { if ($range === 'this_week') {
$date_from = strtotime('last monday'); $monday = date('Y/m/d', strtotime('last monday'));
$date_to = strtotime($date_from.' +6 days');
} else if ($date === 'this_month') { $sunday = date('Y/m/d', strtotime($monday.' +6 days'));
$date_from = strtotime('first day of this month'); $period = (strtotime($sunday) - strtotime($monday));
$date_to = strtotime('last day of this month'); $date_init = $monday;
} else if ($date === 'past_month') { $date_end = $sunday;
$date_from = strtotime('first day of previous month'); } else if ($range === 'this_month') {
$date_to = strtotime('last day of previous month'); $date_end = date('Y/m/d', strtotime('last day of this month'));
} else if ($date === 'past_week') { $first_of_month = date('Y/m/d', strtotime('first day of this month'));
$date_from = strtotime('monday', strtotime('last week')); $date_init = $first_of_month;
$date_to = strtotime('sunday', strtotime('last week')); $period = (strtotime($date_end) - strtotime($first_of_month));
} else if ($range === 'past_month') {
$date_end = date('Y/m/d', strtotime('last day of previous month'));
$first_of_month = date('Y/m/d', strtotime('first day of previous month'));
$date_init = $first_of_month;
$period = (strtotime($date_end) - strtotime($first_of_month));
} else if ($range === 'past_week') {
$date_end = date('Y/m/d', strtotime('sunday', strtotime('last week')));
$first_of_week = date('Y/m/d', strtotime('monday', strtotime('last week')));
$date_init = $first_of_week;
$period = (strtotime($date_end) - strtotime($first_of_week));
} }
} else { } else {
$date_to = strtotime(date('Y-m-d H:i:s')); $date_end = date('Y/m/d H:i:s');
$date_from = ($date_to - $date); $date_init = date('Y/m/d H:i:s', (strtotime($date_end) - $range));
$period = (strtotime($date_end) - strtotime($date_init));
} }
$date_from = strtotime($date_init);
$date_to = strtotime($date_end);
// Read buttons. // Read buttons.
$draw = get_parameter('draw_button', ''); $draw = get_parameter('draw_button', '');
$save = get_parameter('save_button', ''); $save = get_parameter('save_button', '');
@ -385,7 +409,7 @@ $radio_buttons .= __('No').'&nbsp;&nbsp;'.html_print_radio_button(
$advanced_toggle .= '<td><b>'.__('IP address resolution').'</b>'.ui_print_help_tip(__('Resolve the IP addresses to get their hostnames.'), true).'</td>'; $advanced_toggle .= '<td><b>'.__('IP address resolution').'</b>'.ui_print_help_tip(__('Resolve the IP addresses to get their hostnames.'), true).'</td>';
$advanced_toggle .= '<td colspan="2">'.$radio_buttons.'</td>'; $advanced_toggle .= '<td colspan="2">'.$radio_buttons.'</td>';
$advanced_toggle .= '<td><b>'.__('Source ip').'</b></td>'; $advanced_toggle .= '<td><b>'.__('Netflow Source ip').'</b></td>';
$advanced_toggle .= '<td colspan="2">'.html_print_input_text('router_ip', $filter['router_ip'], false, 40, 80, true).'</td>'; $advanced_toggle .= '<td colspan="2">'.html_print_input_text('router_ip', $filter['router_ip'], false, 40, 80, true).'</td>';
$advanced_toggle .= '</tr>'; $advanced_toggle .= '</tr>';
@ -891,8 +915,6 @@ ui_include_time_picker();
$(document).ready( function() { $(document).ready( function() {
displayMonitoringFilter(); displayMonitoringFilter();
// Update visibility of controls.
nf_view_click_period();
// Hide update filter button // Hide update filter button
if ($("#filter_id").val() == 0) { if ($("#filter_id").val() == 0) {
$("#submit-update_button").hide(); $("#submit-update_button").hide();
@ -928,11 +950,4 @@ ui_include_time_picker();
$("#text-date, #text-date_lower").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"}); $("#text-date, #text-date_lower").datepicker({dateFormat: "<?php echo DATE_FORMAT_JS; ?>"});
$.datepicker.regional["<?php echo get_user_language(); ?>"]; $.datepicker.regional["<?php echo get_user_language(); ?>"];
function nf_view_click_period() {
var is_period = document.getElementById('checkbox-is_period').checked;
document.getElementById('period_container').style.display = !is_period ? 'none' : 'flex';
document.getElementById('end_date_container').style.display = is_period ? 'none' : 'flex';
}
</script> </script>

View File

@ -59,40 +59,63 @@ ui_include_time_picker();
// Calculate range dates. // Calculate range dates.
$custom_date = get_parameter('custom_date', '0'); $date_end = get_parameter('date_end', 0);
$date = get_parameter('date', SECONDS_1DAY); $time_end = get_parameter('time_end');
$datetime_end = strtotime($date_end.' '.$time_end);
$custom_date = get_parameter('custom_date', 0);
$range = get_parameter('date', SECONDS_1DAY);
$date_text = get_parameter('date_text', SECONDS_1DAY);
$date_init_less = (strtotime(date('Y/m/d')) - SECONDS_1DAY);
$date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less));
$time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less));
$datetime_init = strtotime($date_init.' '.$time_init);
if ($custom_date === '1') { if ($custom_date === '1') {
$date_init = get_parameter('date_init'); if ($datetime_init >= $datetime_end) {
$time_init = get_parameter('time_init'); $datetime_init = $date_init_less;
$date_end = get_parameter('date_end'); }
$time_end = get_parameter('time_end');
$date_from = strtotime($date_init.' '.$time_init); $date_init = date('Y/m/d H:i:s', $datetime_init);
$date_to = strtotime($date_end.' '.$time_end); $date_end = date('Y/m/d H:i:s', $datetime_end);
$period = ($datetime_end - $datetime_init);
} else if ($custom_date === '2') { } else if ($custom_date === '2') {
$date_text = get_parameter('date_text');
$date_units = get_parameter('date_units'); $date_units = get_parameter('date_units');
$period = ($date_text * $date_units); $date_end = date('Y/m/d H:i:s');
$date_to = strtotime(date('Y-m-d H:i:s')); $date_init = date('Y/m/d H:i:s', (strtotime($date_end) - ((int) $date_text * (int) $date_units)));
$date_from = (strtotime($date_to) - $period); $period = (strtotime($date_end) - strtotime($date_init));
} else if (in_array($date, ['this_week', 'this_month', 'past_week', 'past_month'])) { } else if (in_array($range, ['this_week', 'this_month', 'past_week', 'past_month'])) {
if ($date === 'this_week') { if ($range === 'this_week') {
$date_from = strtotime('last monday'); $monday = date('Y/m/d', strtotime('last monday'));
$date_to = strtotime($date_from.' +6 days');
} else if ($date === 'this_month') { $sunday = date('Y/m/d', strtotime($monday.' +6 days'));
$date_from = strtotime('first day of this month'); $period = (strtotime($sunday) - strtotime($monday));
$date_to = strtotime('last day of this month'); $date_init = $monday;
} else if ($date === 'past_month') { $date_end = $sunday;
$date_from = strtotime('first day of previous month'); } else if ($range === 'this_month') {
$date_to = strtotime('last day of previous month'); $date_end = date('Y/m/d', strtotime('last day of this month'));
} else if ($date === 'past_week') { $first_of_month = date('Y/m/d', strtotime('first day of this month'));
$date_from = strtotime('monday', strtotime('last week')); $date_init = $first_of_month;
$date_to = strtotime('sunday', strtotime('last week')); $period = (strtotime($date_end) - strtotime($first_of_month));
} else if ($range === 'past_month') {
$date_end = date('Y/m/d', strtotime('last day of previous month'));
$first_of_month = date('Y/m/d', strtotime('first day of previous month'));
$date_init = $first_of_month;
$period = (strtotime($date_end) - strtotime($first_of_month));
} else if ($range === 'past_week') {
$date_end = date('Y/m/d', strtotime('sunday', strtotime('last week')));
$first_of_week = date('Y/m/d', strtotime('monday', strtotime('last week')));
$date_init = $first_of_week;
$period = (strtotime($date_end) - strtotime($first_of_week));
} }
} else { } else {
$date_to = strtotime(date('Y-m-d H:i:s')); $date_end = date('Y/m/d H:i:s');
$date_from = ($date_to - $date); $date_init = date('Y/m/d H:i:s', (strtotime($date_end) - $range));
$period = (strtotime($date_end) - strtotime($date_init));
} }
$date_from = strtotime($date_init);
$date_to = strtotime($date_end);
$filter_id = (int) get_parameter('filter_id', 0); $filter_id = (int) get_parameter('filter_id', 0);
// Query params and other initializations. // Query params and other initializations.

View File

@ -85,40 +85,63 @@ ui_include_time_picker();
// Query params and other initializations. // Query params and other initializations.
$action = get_parameter('action', 'talkers'); $action = get_parameter('action', 'talkers');
// Calculate range dates. // Calculate range dates.
$custom_date = get_parameter('custom_date', '0'); $date_end = get_parameter('date_end', 0);
$date = get_parameter('date', SECONDS_1DAY); $time_end = get_parameter('time_end');
$datetime_end = strtotime($date_end.' '.$time_end);
$custom_date = get_parameter('custom_date', 0);
$range = get_parameter('date', SECONDS_1DAY);
$date_text = get_parameter('date_text', SECONDS_1DAY);
$date_init_less = (strtotime(date('Y/m/d')) - SECONDS_1DAY);
$date_init = get_parameter('date_init', date(DATE_FORMAT, $date_init_less));
$time_init = get_parameter('time_init', date(TIME_FORMAT, $date_init_less));
$datetime_init = strtotime($date_init.' '.$time_init);
if ($custom_date === '1') { if ($custom_date === '1') {
$date_init = get_parameter('date_init'); if ($datetime_init >= $datetime_end) {
$time_init = get_parameter('time_init'); $datetime_init = $date_init_less;
$date_end = get_parameter('date_end'); }
$time_end = get_parameter('time_end');
$date_from = strtotime($date_init.' '.$time_init); $date_init = date('Y/m/d H:i:s', $datetime_init);
$date_to = strtotime($date_end.' '.$time_end); $date_end = date('Y/m/d H:i:s', $datetime_end);
$period = ($datetime_end - $datetime_init);
} else if ($custom_date === '2') { } else if ($custom_date === '2') {
$date_text = get_parameter('date_text');
$date_units = get_parameter('date_units'); $date_units = get_parameter('date_units');
$period = ($date_text * $date_units); $date_end = date('Y/m/d H:i:s');
$date_to = strtotime(date('Y-m-d H:i:s')); $date_init = date('Y/m/d H:i:s', (strtotime($date_end) - ((int) $date_text * (int) $date_units)));
$date_from = (strtotime($date_to) - $period); $period = (strtotime($date_end) - strtotime($date_init));
} else if (in_array($date, ['this_week', 'this_month', 'past_week', 'past_month'])) { } else if (in_array($range, ['this_week', 'this_month', 'past_week', 'past_month'])) {
if ($date === 'this_week') { if ($range === 'this_week') {
$date_from = strtotime('last monday'); $monday = date('Y/m/d', strtotime('last monday'));
$date_to = strtotime($date_from.' +6 days');
} else if ($date === 'this_month') { $sunday = date('Y/m/d', strtotime($monday.' +6 days'));
$date_from = strtotime('first day of this month'); $period = (strtotime($sunday) - strtotime($monday));
$date_to = strtotime('last day of this month'); $date_init = $monday;
} else if ($date === 'past_month') { $date_end = $sunday;
$date_from = strtotime('first day of previous month'); } else if ($range === 'this_month') {
$date_to = strtotime('last day of previous month'); $date_end = date('Y/m/d', strtotime('last day of this month'));
} else if ($date === 'past_week') { $first_of_month = date('Y/m/d', strtotime('first day of this month'));
$date_from = strtotime('monday', strtotime('last week')); $date_init = $first_of_month;
$date_to = strtotime('sunday', strtotime('last week')); $period = (strtotime($date_end) - strtotime($first_of_month));
} else if ($range === 'past_month') {
$date_end = date('Y/m/d', strtotime('last day of previous month'));
$first_of_month = date('Y/m/d', strtotime('first day of previous month'));
$date_init = $first_of_month;
$period = (strtotime($date_end) - strtotime($first_of_month));
} else if ($range === 'past_week') {
$date_end = date('Y/m/d', strtotime('sunday', strtotime('last week')));
$first_of_week = date('Y/m/d', strtotime('monday', strtotime('last week')));
$date_init = $first_of_week;
$period = (strtotime($date_end) - strtotime($first_of_week));
} }
} else { } else {
$date_to = strtotime(date('Y-m-d H:i:s')); $date_end = date('Y/m/d H:i:s');
$date_from = ($date_to - $date); $date_init = date('Y/m/d H:i:s', (strtotime($date_end) - $range));
$period = (strtotime($date_end) - strtotime($date_init));
} }
$date_from = strtotime($date_init);
$date_to = strtotime($date_end);
$advanced_filter = get_parameter('advanced_filter', ''); $advanced_filter = get_parameter('advanced_filter', '');
$top = (int) get_parameter('top', 10); $top = (int) get_parameter('top', 10);

View File

@ -62,6 +62,12 @@ require_once 'include/functions_visual_map.php';
$hash = (string) get_parameter('hash'); $hash = (string) get_parameter('hash');
// For public link issue.
$force_instant_logout = true;
if (isset($config['id_user']) === true) {
$force_instant_logout = false;
}
// Check input hash. // Check input hash.
// DO NOT move it after of get parameter user id. // DO NOT move it after of get parameter user id.
if (User::validatePublicHash($hash) !== true) { if (User::validatePublicHash($hash) !== true) {
@ -316,3 +322,10 @@ $visualConsoleItems = VisualConsole::getItemsFromDB(
} }
}); });
</script> </script>
<?php
if ($force_instant_logout === true) {
unset($userAccessMaintenance, $config['id_user'], $hash);
session_destroy();
header_remove('Set-Cookie');
setcookie(session_name(), $_COOKIE[session_name()], (time() - 4800), '/');
}

View File

@ -6,7 +6,7 @@
%define debug_package %{nil} %define debug_package %{nil}
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.773.3 %define version 7.0NG.773.3
%define release 231018 %define release 231020
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -6,7 +6,7 @@
%define debug_package %{nil} %define debug_package %{nil}
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.773.3 %define version 7.0NG.773.3
%define release 231018 %define release 231020
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name httpd %define httpd_name httpd

View File

@ -3,7 +3,7 @@
# #
%define name pandorafms_console %define name pandorafms_console
%define version 7.0NG.773.3 %define version 7.0NG.773.3
%define release 231018 %define release 231020
%define httpd_name httpd %define httpd_name httpd
# User and Group under which Apache is running # User and Group under which Apache is running
%define httpd_name apache2 %define httpd_name apache2

View File

@ -1,5 +1,5 @@
package: pandorafms-server package: pandorafms-server
Version: 7.0NG.773.3-231018 Version: 7.0NG.773.3-231020
Architecture: all Architecture: all
Priority: optional Priority: optional
Section: admin Section: admin

View File

@ -14,7 +14,7 @@
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
pandora_version="7.0NG.773.3-231018" pandora_version="7.0NG.773.3-231020"
package_cpan=0 package_cpan=0
package_pandora=1 package_pandora=1

View File

@ -46,7 +46,7 @@ our @EXPORT = qw(
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.773.3"; my $pandora_version = "7.0NG.773.3";
my $pandora_build = "231018"; my $pandora_build = "231020";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
# Setup hash # Setup hash

View File

@ -34,7 +34,7 @@ our @ISA = qw(Exporter);
# version: Defines actual version of Pandora Server for this module only # version: Defines actual version of Pandora Server for this module only
my $pandora_version = "7.0NG.773.3"; my $pandora_version = "7.0NG.773.3";
my $pandora_build = "231018"; my $pandora_build = "231020";
our $VERSION = $pandora_version." ".$pandora_build; our $VERSION = $pandora_version." ".$pandora_build;
our %EXPORT_TAGS = ( 'all' => [ qw() ] ); our %EXPORT_TAGS = ( 'all' => [ qw() ] );

View File

@ -7,7 +7,7 @@
%define debug_package %{nil} %define debug_package %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.773.3 %define version 7.0NG.773.3
%define release 231018 %define release 231020
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -4,7 +4,7 @@
%global __os_install_post %{nil} %global __os_install_post %{nil}
%define name pandorafms_server %define name pandorafms_server
%define version 7.0NG.773.3 %define version 7.0NG.773.3
%define release 231018 %define release 231020
Summary: Pandora FMS Server Summary: Pandora FMS Server
Name: %{name} Name: %{name}

View File

@ -9,7 +9,7 @@
# ********************************************************************** # **********************************************************************
PI_VERSION="7.0NG.773.3" PI_VERSION="7.0NG.773.3"
PI_BUILD="231018" PI_BUILD="231020"
MODE=$1 MODE=$1
if [ $# -gt 1 ]; then if [ $# -gt 1 ]; then

View File

@ -35,7 +35,7 @@ use PandoraFMS::Config;
use PandoraFMS::DB; use PandoraFMS::DB;
# version: define current version # version: define current version
my $version = "7.0NG.773.3 Build 231018"; my $version = "7.0NG.773.3 Build 231020";
# Pandora server configuration # Pandora server configuration
my %conf; my %conf;

View File

@ -36,7 +36,7 @@ use Encode::Locale;
Encode::Locale::decode_argv; Encode::Locale::decode_argv;
# version: define current version # version: define current version
my $version = "7.0NG.773.3 Build 231018"; my $version = "7.0NG.773.3 Build 231020";
# save program name for logging # save program name for logging
my $progname = basename($0); my $progname = basename($0);

View File

@ -19,7 +19,8 @@ import {
addMovementListener, addMovementListener,
debounce, debounce,
addResizementListener, addResizementListener,
t t,
parseFloatOr
} from "./lib"; } from "./lib";
import TypedEvent, { Listener, Disposable } from "./lib/TypedEvent"; import TypedEvent, { Listener, Disposable } from "./lib/TypedEvent";
import { FormContainer, InputGroup } from "./Form"; import { FormContainer, InputGroup } from "./Form";
@ -65,8 +66,9 @@ export interface ItemProps extends Position, Size {
aclGroupId: number | null; aclGroupId: number | null;
cacheExpiration: number | null; cacheExpiration: number | null;
colorStatus: string; colorStatus: string;
cellId: number | null; cellId: string | null;
alertOutline: boolean; alertOutline: boolean;
ratio: number | null;
} }
export interface ItemClickEvent { export interface ItemClickEvent {
@ -143,8 +145,9 @@ export function itemBasePropsDecoder(data: AnyObject): ItemProps | never {
aclGroupId: parseIntOr(data.aclGroupId, null), aclGroupId: parseIntOr(data.aclGroupId, null),
cacheExpiration: parseIntOr(data.cacheExpiration, null), cacheExpiration: parseIntOr(data.cacheExpiration, null),
colorStatus: notEmptyStringOr(data.colorStatus, "#CCC"), colorStatus: notEmptyStringOr(data.colorStatus, "#CCC"),
cellId: parseIntOr(data.cellId, null), cellId: notEmptyStringOr(data.cellId, ""),
alertOutline: parseBoolean(data.alertOutline), alertOutline: parseBoolean(data.alertOutline),
ratio: parseFloatOr(data.ratio, null),
...sizePropsDecoder(data), // Object spread. It will merge the properties of the two objects. ...sizePropsDecoder(data), // Object spread. It will merge the properties of the two objects.
...positionPropsDecoder(data) // Object spread. It will merge the properties of the two objects. ...positionPropsDecoder(data) // Object spread. It will merge the properties of the two objects.
}; };
@ -506,6 +509,7 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
// Resize element. // Resize element.
this.resizeElement(this.itemProps.width, this.itemProps.height); this.resizeElement(this.itemProps.width, this.itemProps.height);
// Set label position. // Set label position.
this.changeLabelPosition(this.itemProps.labelPosition); this.changeLabelPosition(this.itemProps.labelPosition);
} }
@ -533,6 +537,7 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
if (this.props.isOnTop) { if (this.props.isOnTop) {
box.classList.add("is-on-top"); box.classList.add("is-on-top");
} }
box.style.left = `${this.props.x}px`; box.style.left = `${this.props.x}px`;
box.style.top = `${this.props.y}px`; box.style.top = `${this.props.y}px`;
@ -639,26 +644,6 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
table.appendChild(row); table.appendChild(row);
table.appendChild(emptyRow2); table.appendChild(emptyRow2);
table.style.textAlign = "center"; table.style.textAlign = "center";
// Change the table size depending on its position.
switch (this.props.labelPosition) {
case "up":
case "down":
if (this.props.width > 0) {
table.style.width = `${this.props.width}px`;
table.style.height = "";
}
break;
case "left":
case "right":
if (this.props.height > 0) {
table.style.width = "";
table.style.height = `${this.props.height}px`;
}
break;
}
// element.innerHTML = this.props.label;
element.appendChild(table); element.appendChild(table);
} }
@ -822,6 +807,14 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
prevMeta: ItemMeta | null = null prevMeta: ItemMeta | null = null
): void { ): void {
if (prevProps) { if (prevProps) {
if (this.props.ratio !== 1 && this.props.type != ItemType.LINE_ITEM) {
this.elementRef.style.transform = `scale(${
this.props.ratio ? this.props.ratio : 1
})`;
this.elementRef.style.transformOrigin = "left top";
this.elementRef.style.minWidth = "max-content";
this.elementRef.style.minHeight = "max-content";
}
this.updateDomElement(this.childElementRef); this.updateDomElement(this.childElementRef);
} }
// Move box. // Move box.
@ -835,6 +828,7 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
this.updateDomElement(this.childElementRef); this.updateDomElement(this.childElementRef);
} }
} }
// Resize box. // Resize box.
if (!prevProps || this.sizeChanged(prevProps, this.props)) { if (!prevProps || this.sizeChanged(prevProps, this.props)) {
this.resizeElement(this.props.width, this.props.height); this.resizeElement(this.props.width, this.props.height);
@ -852,6 +846,7 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
if (oldLabelHtml !== newLabelHtml) { if (oldLabelHtml !== newLabelHtml) {
this.labelElementRef.innerHTML = newLabelHtml; this.labelElementRef.innerHTML = newLabelHtml;
} }
// Change label position. // Change label position.
if (!prevProps || prevProps.labelPosition !== this.props.labelPosition) { if (!prevProps || prevProps.labelPosition !== this.props.labelPosition) {
this.changeLabelPosition(this.props.labelPosition); this.changeLabelPosition(this.props.labelPosition);
@ -864,6 +859,7 @@ abstract class VisualConsoleItem<Props extends ItemProps> {
this.elementRef.classList.remove("is-on-top"); this.elementRef.classList.remove("is-on-top");
} }
} }
// Change link. // Change link.
if (prevProps && prevProps.isLinkEnabled !== this.props.isLinkEnabled) { if (prevProps && prevProps.isLinkEnabled !== this.props.isLinkEnabled) {
const container = this.createContainerDomElement(); const container = this.createContainerDomElement();

View File

@ -300,11 +300,11 @@ export default class VisualConsole {
item.props.type !== 13 && item.props.type !== 13 &&
item.props.type !== 21 item.props.type !== 21
) { ) {
const movement_x = e.newPosition.x - e.item.props.x; const movementX = e.newPosition.x - e.item.props.x;
const movement_y = e.newPosition.y - e.item.props.y; const movementY = e.newPosition.y - e.item.props.y;
let newX = item.props.x + movement_x; let newX = item.props.x + movementX;
let newY = item.props.y + movement_y; let newY = item.props.y + movementY;
if (newX > this.props.width) { if (newX > this.props.width) {
newX = this.props.width; newX = this.props.width;
@ -682,6 +682,7 @@ export default class VisualConsole {
return; return;
} }
let line = this.elementsById[lineId] as Line; let line = this.elementsById[lineId] as Line;
if (line.props) { if (line.props) {
let startX = line.props.startPosition.x; let startX = line.props.startPosition.x;
let startY = line.props.startPosition.y; let startY = line.props.startPosition.y;
@ -792,7 +793,20 @@ export default class VisualConsole {
*/ */
public addElement(item: AnyObject, context: this = this) { public addElement(item: AnyObject, context: this = this) {
try { try {
if (item.ratio == null) {
item.ratio = 1;
}
item.x *= item.ratio;
item.y *= item.ratio;
if (item.type == ItemType.LINE_ITEM) {
item.startX *= item.ratio;
item.startY *= item.ratio;
item.endX *= item.ratio;
item.endY *= item.ratio;
}
const itemInstance = itemInstanceFrom(item); const itemInstance = itemInstanceFrom(item);
// Add the item to the list. // Add the item to the list.
context.elementsById[itemInstance.props.id] = itemInstance; context.elementsById[itemInstance.props.id] = itemInstance;
context.elementIds.push(itemInstance.props.id); context.elementIds.push(itemInstance.props.id);
@ -815,6 +829,15 @@ export default class VisualConsole {
itemInstance.onResizeFinished(context.handleElementResizementFinished); itemInstance.onResizeFinished(context.handleElementResizementFinished);
} }
if (item.ratio !== 1 && item.type != ItemType.LINE_ITEM) {
itemInstance.elementRef.style.transform = `scale(${
item.ratio ? item.ratio : 1
})`;
itemInstance.elementRef.style.transformOrigin = "left top";
itemInstance.elementRef.style.minWidth = "max-content";
itemInstance.elementRef.style.minHeight = "max-content";
}
// Add the item to the DOM. // Add the item to the DOM.
context.containerRef.append(itemInstance.elementRef); context.containerRef.append(itemInstance.elementRef);
return itemInstance; return itemInstance;
@ -854,6 +877,16 @@ export default class VisualConsole {
} else { } else {
// Update item. // Update item.
try { try {
if (item.ratio != null) {
item.x *= item.ratio;
item.y *= item.ratio;
if (item.type == ItemType.LINE_ITEM) {
item.startX *= item.ratio;
item.startY *= item.ratio;
item.endX *= item.ratio;
item.endY *= item.ratio;
}
}
this.elementsById[item.id].props = decodeProps(item); this.elementsById[item.id].props = decodeProps(item);
} catch (error) { } catch (error) {
console.error( console.error(
@ -1103,8 +1136,14 @@ export default class VisualConsole {
position: Position, position: Position,
element: Item<ItemProps> element: Item<ItemProps>
): Position { ): Position {
let x = position.x + element.elementRef.clientWidth / 2; let ratio = 1;
let y = position.y + element.elementRef.clientHeight / 2; if (element.props.ratio != null) {
ratio = element.props.ratio;
}
let x = position.x + (element.elementRef.clientWidth / 2) * ratio;
let y = position.y + (element.elementRef.clientHeight / 2) * ratio;
if ( if (
typeof element.props.label !== "undefined" || typeof element.props.label !== "undefined" ||
element.props.label !== "" || element.props.label !== "" ||
@ -1114,33 +1153,38 @@ export default class VisualConsole {
case "up": case "up":
y = y =
position.y + position.y +
(element.elementRef.clientHeight + ((element.elementRef.clientHeight +
element.labelElementRef.clientHeight) / element.labelElementRef.clientHeight) /
2; 2) *
ratio;
break; break;
case "down": case "down":
y = y =
position.y + position.y +
(element.elementRef.clientHeight - ((element.elementRef.clientHeight -
element.labelElementRef.clientHeight) / element.labelElementRef.clientHeight) /
2; 2) *
ratio;
break; break;
case "right": case "right":
x = x =
position.x + position.x +
(element.elementRef.clientWidth - ((element.elementRef.clientWidth -
element.labelElementRef.clientWidth) / element.labelElementRef.clientWidth) /
2; 2) *
ratio;
break; break;
case "left": case "left":
x = x =
position.x + position.x +
(element.elementRef.clientWidth + ((element.elementRef.clientWidth +
element.labelElementRef.clientWidth) / element.labelElementRef.clientWidth) /
2; 2) *
ratio;
break; break;
} }
} }
return { x, y }; return { x, y };
} }
@ -1196,12 +1240,14 @@ export default class VisualConsole {
width: 0, width: 0,
height: 0, height: 0,
lineWidth: this.props.relationLineWidth, lineWidth: this.props.relationLineWidth,
color: notEmptyStringOr(child.props.colorStatus, "#CCC") color: notEmptyStringOr(child.props.colorStatus, "#CCC"),
ratio: parent.props.ratio
}), }),
itemMetaDecoder({ itemMetaDecoder({
receivedAt: new Date() receivedAt: new Date()
}) })
); );
// Save a reference to the line item. // Save a reference to the line item.
this.relations[identifier] = line; this.relations[identifier] = line;

View File

@ -71,7 +71,7 @@ export default class BasicChart extends Item<BasicChartProps> {
let value = ""; let value = "";
if (this.props.value !== null) { if (this.props.value !== null) {
value = this.number_format(this.props.value, false, "", 2, 1000); value = this.numberFormat(this.props.value, false, "", 2, 1000);
} }
const moduleValue = document.createElement("h2"); const moduleValue = document.createElement("h2");
@ -131,7 +131,7 @@ export default class BasicChart extends Item<BasicChartProps> {
let value = ""; let value = "";
if (this.props.value !== null) { if (this.props.value !== null) {
value = this.number_format(this.props.value, false, "", 2, 1000); value = this.numberFormat(this.props.value, false, "", 2, 1000);
} }
const moduleValue = document.createElement("h2"); const moduleValue = document.createElement("h2");
@ -164,31 +164,31 @@ export default class BasicChart extends Item<BasicChartProps> {
} }
} }
protected number_format( protected numberFormat(
number: number, number: number,
force_integer: boolean, forceInteger: boolean,
unit: string, unit: string,
short_data: number, shortData: number,
divisor: number divisor: number
) { ) {
divisor = typeof divisor !== "undefined" ? divisor : 1000; divisor = typeof divisor !== "undefined" ? divisor : 1000;
var decimals = 2; var decimals = 2;
// Set maximum decimal precision to 99 in case short_data is not set. // Set maximum decimal precision to 99 in case shortData is not set.
if (!short_data) { if (!shortData) {
short_data = 99; shortData = 99;
} }
if (force_integer) { if (forceInteger) {
if (Math.round(number) != number) { if (Math.round(number) != number) {
return ""; return "";
} }
} else { } else {
short_data++; shortData++;
const aux_decimals = this.pad("1", short_data, 0); const auxDecimals = this.pad("1", shortData, 0);
number = number =
Math.round(number * Number.parseInt(aux_decimals)) / Math.round(number * Number.parseInt(auxDecimals)) /
Number.parseInt(aux_decimals); Number.parseInt(auxDecimals);
} }
var shorts = ["", "K", "M", "G", "T", "P", "E", "Z", "Y"]; var shorts = ["", "K", "M", "G", "T", "P", "E", "Z", "Y"];

View File

@ -100,6 +100,11 @@ export default class NetworkLink extends Line {
); );
protected updateDomElement(element: HTMLElement): void { protected updateDomElement(element: HTMLElement): void {
if (this.itemProps.ratio != null) {
this.itemProps.x /= this.itemProps.ratio;
this.itemProps.y /= this.itemProps.ratio;
}
super.updateDomElement(element); super.updateDomElement(element);
let { let {
@ -119,6 +124,11 @@ export default class NetworkLink extends Line {
labelStartHeight labelStartHeight
} = this.props; } = this.props;
if (this.itemProps.ratio != null) {
this.itemProps.x *= this.itemProps.ratio;
this.itemProps.y *= this.itemProps.ratio;
}
const svgs = element.getElementsByTagName("svg"); const svgs = element.getElementsByTagName("svg");
let line; let line;
let svg; let svg;

View File

@ -226,8 +226,8 @@ export default class Odometer extends Item<OdometerProps> {
script.onload = () => { script.onload = () => {
odometerB.style.transform = `rotate(${rotate}turn)`; odometerB.style.transform = `rotate(${rotate}turn)`;
}; };
var url_pandora = window.location.pathname.split("/")[1]; var urlPandora = window.location.pathname.split("/")[1];
script.src = `${document.dir}/${url_pandora}/include/javascript/pandora_alerts.js`; script.src = `${document.dir}/${urlPandora}/include/javascript/pandora_alerts.js`;
odometerA.appendChild(h1); odometerA.appendChild(h1);
odometerA.appendChild(h2); odometerA.appendChild(h2);
odometerContainer.appendChild(odometerB); odometerContainer.appendChild(odometerB);
@ -277,7 +277,7 @@ export default class Odometer extends Item<OdometerProps> {
/** /**
* To update the content element. * To update the content element.
* @override Item.updateDomElement * @override resize
*/ */
public resize(width: number): void { public resize(width: number): void {
this.resizeElement(this.props.width); this.resizeElement(this.props.width);

View File

@ -286,7 +286,7 @@ export default class Percentile extends Item<PercentileProps> {
/** /**
* To update the content element. * To update the content element.
* @override Item.updateDomElement * @override resizeElement
*/ */
public resizeElement(width: number, height: number): void { public resizeElement(width: number, height: number): void {
if (this.props.percentileType === "progress-bar") { if (this.props.percentileType === "progress-bar") {
@ -298,7 +298,7 @@ export default class Percentile extends Item<PercentileProps> {
/** /**
* To update the content element. * To update the content element.
* @override Item.updateDomElement * @override resize
*/ */
public resize(width: number): void { public resize(width: number): void {
this.resizeElement(width, width); this.resizeElement(width, width);

View File

@ -32,6 +32,10 @@
.visual-console-item * { .visual-console-item * {
overflow: visible; overflow: visible;
font-family: inherit; font-family: inherit;
line-height: inherit;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
} }
.visual-console-item.is-editing { .visual-console-item.is-editing {
@ -733,3 +737,8 @@ div.module-graph .gauge_d3_class {
height: 0px; height: 0px;
border: 2px solid #002f33; border: 2px solid #002f33;
} }
p {
margin-block-start: 1em;
margin-block-end: 1em;
}