diff options
author | Tobias Oetiker <tobi@oetiker.ch> | 2022-02-14 11:25:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-14 11:25:16 +0100 |
commit | ec2cc3585ae5fbc03d28b801d75178e36c18ae33 (patch) | |
tree | 79241193a90c2629e5563dbdef2aae493eb9baef | |
parent | ddd95b5219e90bd01bcb6b7cfb2242d8f473db10 (diff) | |
parent | d4a5ac779f8d31d9f1093297dcbe3bf772bd1838 (diff) | |
download | smokeping-ec2cc3585ae5fbc03d28b801d75178e36c18ae33.tar.gz |
Merge branch 'master' into master
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | etc/basepage.html.dist | 4 | ||||
-rw-r--r-- | htdocs/css/smokeping-screen.css | 12 | ||||
-rw-r--r-- | lib/Smokeping.pm | 58 | ||||
-rw-r--r-- | lib/Smokeping/Graphs.pm | 32 |
5 files changed, 91 insertions, 17 deletions
@@ -2,6 +2,8 @@ - add "Home"-Link to basepage.html @rezzorix - remove --insecure from curl (wget does not have it!) in configure.ac @Gunni - add fix for curl feature checking introduced in curl 7.74 and later @matellis + - enhancement to extend color handling, making dark templates easier to do @matellis + - enhancement to remove more borders with graphborders set to no @matellis 2021-08-13 08:12:06 +0200 Tobias Oetiker <tobi@oetiker.ch> diff --git a/etc/basepage.html.dist b/etc/basepage.html.dist index ab2318c..8471715 100644 --- a/etc/basepage.html.dist +++ b/etc/basepage.html.dist @@ -1,6 +1,7 @@ <!DOCTYPE html> <html> <head> + <link href="data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH1gQSFA8qQC+y8wAAAB10RVh0Q29tbWVudABDcmVhdGVkIHdpdGggVGhlIEdJTVDvZCVuAAABd0lEQVQoz5WSy07CQBSGTzuF6Y1buQSiCYSgYli7MC54AZc+gC/CE7kzrPQBjDsNIdF4I8oCwr1gO51OOy4aAbGS+K/OTM6X85/5R2g0GvAfSesHjPyj3LyasrIKxch3fXHiSN0Fvv4wbCZuAobsnld7Scw4wIhEhiSCEc/IbgqzZicTMuG0NEpi9jhRLzuZOUXBJRK4ITOfr1yIy6oYIwDQ7KSX3QDgcWFgR9ZtrwCLIQAoJ8j2pVG9Xg8qDsJe0j5MWcW4g5FvMUQ8cRvQXeAplXY0mlfpftI+zpu1tBURed/CHhdCAADoWfiml3gxlYUraZKXVdxKwq6lPx8mqvM97QcQaEalV1O57cffTGVXdzKKa8isNdI3l/6tzly+eM4BQDlOQl4pVEECLDSHUowUNCqsdedVelYZAEB7rIUkfVKYHaQs4okTIjEuJKJePMoCY1fvRghwN9R9gIJKs4orCtxm6Gmq3I/01lDnob+1PdbWR/+lL5mtm+fskIeBAAAAAElFTkSuQmCC" rel="icon" type="image/x-icon" /> <meta name="viewport" content="width=device-width, initial-scale=1"> <META http-equiv="Refresh" content="<##step##>"> <title>SmokePing Latency Page for <##title##></title> @@ -17,6 +18,9 @@ </div> <div class="sidebar-menu"> + <br><br> + <ul class="menu"> + <li class="menuitem"><a class="menulink" href="/"><B>HOME</B></a></li></ul> <##menu##> <div class="logo"> <##rrdlogo##> diff --git a/htdocs/css/smokeping-screen.css b/htdocs/css/smokeping-screen.css index f9a72ca..a66f8a4 100644 --- a/htdocs/css/smokeping-screen.css +++ b/htdocs/css/smokeping-screen.css @@ -181,12 +181,15 @@ a#menu-button:hover { display: inline-block; } +.main .panel, .main .panel-no-border { + margin: 5px; + display: inline-block; +} + .main .panel { border: 1px solid #d4d4d4; box-shadow: 0 2px 1px -1px rgba(0,0,0,0.1); background: #fff; - margin: 5px; - display: inline-block; } .main .panel-heading { @@ -195,7 +198,10 @@ a#menu-button:hover { box-shadow: inset 0 0 1px 1px #fff; } -.main .panel-heading h2 { +.panel-heading-no-border { +} + +.main .panel-heading h2, .main .panel-heading-no-border h2 { margin: 0; padding-left: 10px; line-height: 30px; diff --git a/lib/Smokeping.pm b/lib/Smokeping.pm index b1b8b84..7ca576d 100644 --- a/lib/Smokeping.pm +++ b/lib/Smokeping.pm @@ -297,6 +297,22 @@ sub sendsnpp ($$){ } } +sub panel_class { + if ($cfg->{Presentation}{graphborders} eq 'no') { + return 'panel-no-border'; + } else { + return 'panel'; + } +} + +sub panel_heading_class { + if ($cfg->{Presentation}{graphborders} eq 'no') { + return 'panel-heading-no-border'; + } else { + return 'panel-heading'; + } +} + sub min ($$) { my ($a, $b) = @_; return $a < $b ? $a : $b; @@ -998,8 +1014,8 @@ sub get_overview ($$$$){ "COMMENT:$ProbeDesc", "COMMENT:$date\\j"); my $ERROR = RRDs::error(); - $page .= "<div class=\"panel\">"; - $page .= "<div class=\"panel-heading\"><h2>".$phys_tree->{title}."</h2></div>" + $page .= "<div class=\"".panel_class()."\">"; + $page .= "<div class=\"".panel_heading_class()."\"><h2>".$phys_tree->{title}."</h2></div>" if $cfg->{Presentation}{htmltitle} eq 'yes'; $page .= "<div class=\"panel-body\">"; if (defined $ERROR) { @@ -1493,10 +1509,10 @@ sub get_detail ($$$$;$){ return undef; } elsif ($mode eq 'n'){ # navigator mode - $page .= "<div class=\"panel\">"; + $page .= "<div class=\"".panel_class()."\">"; if ($cfg->{Presentation}{htmltitle} eq 'yes') { # TODO we generate this above to, maybe share code or store variable ? - $page .= "<div class=\"panel-heading\"><h2>$desc</h2></div>"; + $page .= "<div class=\"".panel_heading_class()."\"><h2>$desc</h2></div>"; } $page .= "<div class=\"panel-body\">"; $page .= qq|<IMG alt="" id="zoom" width="$xs{''}" height="$ys{''}" SRC="${imghref}_${end}_${start}.png">| ; @@ -1521,13 +1537,13 @@ sub get_detail ($$$$;$){ $t =~ s/$xssBadRx/_/g; for my $slave (@slaves){ my $s = $slave ? "~$slave" : ""; - $page .= "<div class=\"panel\">"; + $page .= "<div class=\"".panel_class()."\">"; # $page .= (time-$timer_start)."<br/>"; # $page .= join " ",map {"'$_'"} @task; if ($cfg->{Presentation}{htmltitle} eq 'yes') { # TODO we generate this above to, maybe share code or store variable ? my $title = "$desc from " . ($s ? $cfg->{Slaves}{$slave}{display_name}: $cfg->{General}{display_name} || hostname); - $page .= "<div class=\"panel-heading\"><h2>$title</h2></div>"; + $page .= "<div class=\"".panel_heading_class()."\"><h2>$title</h2></div>"; } $page .= "<div class=\"panel-body\">"; $page .= ( qq{<a href="}.cgiurl($q,$cfg)."?".hierarchy($q).qq{displaymode=n;start=$startstr;end=now;}."target=".$t.$s.'">' @@ -1563,8 +1579,8 @@ sub get_charts ($$$){ } if (not defined $open->[1]){ for my $chart ( keys %charts ){ - $page .= "<div class=\"panel\">"; - $page .= "<div class=\"panel-heading\"><h2>$cfg->{Presentation}{charts}{$chart}{title}</h2></div>\n"; + $page .= "<div class=\"".panel_class()."\">"; + $page .= "<div class=\"".panel_heading_class()."\"><h2>$cfg->{Presentation}{charts}{$chart}{title}</h2></div>\n"; if (not defined $charts{$chart}[0]){ $page .= "<p>No targets returned by the sorter.</p>" } else { @@ -1597,7 +1613,7 @@ sub get_charts ($$$){ last unless ref $tree->{$host} eq 'HASH'; $tree = $tree->{$host}; } - $page .= "<div class=\"panel\">"; + $page .= "<div class=\"".panel_class()."\">"; $page .= "<div class=\"panel-heading\"><h2>$rank."; $page .= " ".sprintf($cfg->{Presentation}{charts}{$chart}{format},$chartentry->{value}) if ($cfg->{Presentation}{charts}{$chart}{format}); @@ -3226,7 +3242,7 @@ Defines how the SmokePing data should be presented. DOC _sections => [ qw(overview detail charts multihost hierarchies) ], _mandatory => [ qw(overview template detail) ], - _vars => [ qw (template charset htmltitle graphborders) ], + _vars => [ qw (template charset htmltitle graphborders colortext colorbackground colorborder) ], template => { _doc => <<DOC, @@ -3266,6 +3282,28 @@ DOC _re => '(yes|no)', _re_error =>"this must either be 'yes' or 'no'", }, + colortext => { + _doc => <<DOC, +DOC + _re => '[0-9a-f]{6}', + _re_error => 'use rrggbb for color', + }, + colorborder => { + _doc => <<DOC, +By default, SmokePing will render the border gray, which may be overridden +here with your own RGB value +DOC + _re => '[0-9a-f]{6}', + _re_error => 'use rrggbb for color', + }, + colorbackground => { + _doc => <<DOC, +By default, SmokePing will render the background light gray, which may be +overridden here with your own RGB value +DOC + _re => '[0-9a-f]{6}', + _re_error => 'use rrggbb for color', + }, charts => { _doc => <<DOC, The SmokePing Charts feature allow you to have Top X lists created according diff --git a/lib/Smokeping/Graphs.pm b/lib/Smokeping/Graphs.pm index 1adc78b..3c53543 100644 --- a/lib/Smokeping/Graphs.pm +++ b/lib/Smokeping/Graphs.pm @@ -24,15 +24,39 @@ the graphs shown in the overview page, except for the size. sub get_colors ($){ my $cfg = shift; + my @colorList = (); + my $colorText = $cfg->{Presentation}{colortext}; + my $colorBorder = $cfg->{Presentation}{colorborder}; + my $colorBackground = $cfg->{Presentation}{colorbackground}; - if ($cfg->{Presentation}{graphborders} eq 'no') { + # If graphborders set to no, and no color override, then return default colors as before + if (($cfg->{Presentation}{graphborders} eq 'no') && !($colorText||$colorBorder||$colorBackground)) { return '--border', '0', '--color', 'BACK#ffffff00', '--color', 'CANVAS#ffffff00'; - } + }; - # Use rrdtool defaults - return; + # If there are any overrides, use them + if ($cfg->{Presentation}{graphborders} eq 'no') { + push(@colorList, '--border', '0'); + }; + if ($colorText) { + push(@colorList, '--color', "FONT#${colorText}"); + }; + if ($colorBorder) { + push(@colorList, '--color', "FRAME#${colorBorder}"); + }; + if ($colorBackground) { + push(@colorList, '--color', "SHADEA#${colorBackground}"); + push(@colorList, '--color', "SHADEB#${colorBackground}"); + push(@colorList, '--color', "BACK#${colorBackground}"); + push(@colorList, '--color', "CANVAS#${colorBackground}"); + }; + + if (@colorList) { return @colorList[0..$#colorList] }; + + # Otherwise use rrdtool defaults + return } sub get_multi_detail ($$$$;$){ |