[09/19] ovpnclients.dat: Display a notice if there are no entries.

Message ID 20200413074550.2735-9-stefan.schantl@ipfire.org
State Accepted
Commit c7d55d7fbda744ba8c187585f1aa271829648695
Headers
Series [01/19] openvpn: Add WUI page for client usage statistics |

Commit Message

Stefan Schantl April 13, 2020, 7:45 a.m. UTC
  Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
 html/cgi-bin/logs.cgi/ovpnclients.dat | 7 ++++++-
 langs/en/cgi-bin/en.pl                | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)
  

Patch

diff --git a/html/cgi-bin/logs.cgi/ovpnclients.dat b/html/cgi-bin/logs.cgi/ovpnclients.dat
index cf3e0e7bc..b84c2b8d7 100755
--- a/html/cgi-bin/logs.cgi/ovpnclients.dat
+++ b/html/cgi-bin/logs.cgi/ovpnclients.dat
@@ -293,8 +293,13 @@  while(my @row = $statement_handle->fetchrow_array()) {
 
 	# Increase lines count.
 	$lines++;
+}
 
-	}
+# If nothing has been fetched, the amount of lines is still zero.
+# In this case display a hint about no data.
+unless ($lines) {
+	print "<tr><td bgcolor='$color{'color22'}' colspan='5' align='center'>$Lang::tr{'no entries'}</td></tr>\n";
+}
 
 print "</table><br>\n";
 
diff --git a/langs/en/cgi-bin/en.pl b/langs/en/cgi-bin/en.pl
index 1d3b87649..171d24937 100644
--- a/langs/en/cgi-bin/en.pl
+++ b/langs/en/cgi-bin/en.pl
@@ -1800,6 +1800,7 @@ 
 'no alcatelusb firmware' => 'No Alcatel USB firmware. Please upload.',
 'no cfg upload' => 'No data was uploaded',
 'no dhcp lease' => 'No DHCP lease has been acquired',
+'no entries' => 'No entries at the moment.',
 'no eciadsl synch.bin file' => 'No ECI ADSL synch.bin file. Please upload.',
 'no filter pass' => 'Enter the standard class for non-filtered packets.',
 'no fritzdsl driver' => 'No Fritz!DSL driver.  Please upload.',