Skip to content

Commit

Permalink
Fix not to display stats history in proxy mode unless there is data c…
Browse files Browse the repository at this point in the history
  • Loading branch information
iliajie committed Oct 22, 2024
1 parent 8e3fbcc commit 31ad1ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion authentic-lib.pl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
$current_theme, $root_directory, $config_directory, $var_directory,

%theme_text, %module_text_full, %theme_config, $theme_info, $get_user_level, $theme_webprefix, $http_x_url,
$has_virtualmin, $has_cloudmin,
$has_virtualmin, $has_cloudmin, $theme_server_webprefix,
$has_usermin, $has_usermin_version, $has_usermin_root_dir, $has_usermin_conf_dir, $has_usermin_var_dir);

init_type();
Expand Down Expand Up @@ -238,6 +238,7 @@ sub get_extended_sysinfo
if (&webmin_user_is_admin() &&
$theme_config{'settings_sysinfo_hidden_panels_user'} !~ /\'live_stats\'/ &&
$theme_config{'settings_sysinfo_real_time_status'} ne '0' &&
(!$theme_server_webprefix || $theme_server_webprefix && -r get_stats_history_file()) &&
(acl_system_status('cpu') || acl_system_status('mem') || acl_system_status('load')))
{
my $data = '<div data-charts-loader class="text-muted loading-dots flex-center">
Expand Down
8 changes: 6 additions & 2 deletions stats-lib-funcs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,15 @@ sub get_stats_now
return \%data;
}

sub get_stats_history_file
{
return "$var_directory/modules/$current_theme/real-time-monitoring.json";
}

sub get_stats_history
{
my ($noempty) = @_;
my $file = "$var_directory/modules/$current_theme".
"/real-time-monitoring.json";
my $file = get_stats_history_file();
my $graphs = jsonify(read_file_contents($file));
# No data yet
if (!keys %{$graphs}) {
Expand Down

0 comments on commit 31ad1ce

Please sign in to comment.