From 07bb1885a7112e661c0d647987fd4e9675dc1eda Mon Sep 17 00:00:00 2001 From: Andrew Ruthven Date: Thu, 20 Dec 2007 09:48:51 +1300 Subject: [PATCH] Insert header line in group summary view Now you can specify a group with a name of "break";. When this group shows up depending on the group view you're using it does several things. In the HTML mode, it displays the header bar again. This allows you to cleanly breakup some different groups in either the brief or standard group summary views. This group is skipped in the full view. In text mode it does a simialr thing, but just prints a blank line instead of repeating the header lines. An example of what to put in your spong.groups file is: 'group 1' =>; { ... }, '----' => { name => 'break' }, 'completely different group' => { ... } --- src/lib/Spong/HostGroups.pm | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/lib/Spong/HostGroups.pm b/src/lib/Spong/HostGroups.pm index ef1121c..c5d7e93 100755 --- a/src/lib/Spong/HostGroups.pm +++ b/src/lib/Spong/HostGroups.pm @@ -166,6 +166,11 @@ sub display_text { # Now go through each host, and fill in the table. foreach $group ( $self->groups() ) { + if ($main::GROUPS{$group->name()}->{'name'} eq 'break') { + print "\n"; + next; + } + print substr( $group->name(), 0, 29 ); print " "x(30-length(substr($group->name(), 0, 29))); @@ -225,6 +230,11 @@ sub display_text { # Now go through each host, and fill in the table. foreach $group ( $self->groups() ) { + if ($main::GROUPS{$group->name()}->{'name'} eq 'break') { + print "\n"; + next; + } + print substr( $group->name(), 0, 29 ); print " "x(30-length(substr($group->name(), 0, 29))); @@ -260,6 +270,8 @@ sub display_text { # Now go through each host, and fill in the table. foreach $group ( $self->groups() ) { + next if ($main::GROUPS{$group->name()}->{'name'} eq 'break'); + print "-"x30, "-"x(($#names+1)*3), "\n"; print "Group: " . substr( $group->name(), 0, 29 ) . "\n"; @@ -298,6 +310,14 @@ sub display_html { my $name = $group->name(); my $grname = $main::GROUPS{$name}->{'name'}; + if ($grname eq "break") { + print " \n"; + print " Host Group\n"; + print " Status\n"; + print " \n"; + next; + } + print " \n"; print " $grname\n"; @@ -358,6 +378,19 @@ sub display_html { foreach $group ( $self->groups() ) { my $name = $group->name(); my $grname = $main::GROUPS{$name}->{'name'}; + + if ($grname eq "break") { + print " "; + print " Host Group\n"; + foreach $service ( @names ) { + print " \n"; + print ""; + print "$service\n"; + } + + print " \n\n"; + next; + } print " \n"; print " \n"; @@ -405,6 +438,8 @@ sub display_html { my $name = $group->name(); my $grname = $main::GROUPS{$name}->{'name'}; + next if ($grname eq "break"); + # Display the host group table # print ""; print "\n
Group - $grname

\n"; -- 2.30.2