From: Stephen L Johnson Date: Thu, 4 May 2000 21:05:42 +0000 (+0000) Subject: added brief view to html grp-summary by Andrew Ruthven X-Git-Tag: spong-2_7-alpha6^0 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e6bddf65dfce20708710845c54fe2f196fdf3af;p=spong.git added brief view to html grp-summary by Andrew Ruthven --- diff --git a/src/lib/Spong/HostGroups.pm b/src/lib/Spong/HostGroups.pm index 2bd13f2..f13328e 100755 --- a/src/lib/Spong/HostGroups.pm +++ b/src/lib/Spong/HostGroups.pm @@ -23,6 +23,8 @@ use Spong::HostList; package Spong::HostGroups; +my %COLORS = ( 'blue', 4, 'red', 5, 'yellow', 3, 'green', 1, 'purple', 2 ); + # This constructor expects one of four different types of options. Either an # empty string specifying that no actual hostlist will be loaded, the string # "ALL" to load all the host grups, the string containing a group name that @@ -183,7 +185,71 @@ sub display_text { sub display_html { my( $self, $format ) = @_; - if( $format eq "standard" ) { + if( $format eq "brief" ) { + my (%services, $group, $serivce, @names ); + foreach $service ( sort keys %main::SERVICES ) { + push( @names, $service ); + } + + # Print the header of the table. + + print "\n \n"; + print " \n"; + print " \n"; + print " \n"; + + # Now for each group, go through and find out overall status of that + # host. + + foreach $group ( $self->groups() ) { + my $name = $group->name(); + my $grname = $main::GROUPS{$name}->{'name'}; + + print " \n"; + print " \n"; + + my ($color); + foreach $service ( @names ) { + my ($servicecolor) = $group->services_color( $service ); + $color = $servicecolor if ($COLORS{$servicecolor} > $COLORS{$color}); + } + + if( $color ) { + if( $main::WWW_USE_IMAGES == 1 ) { + print " \n"; + } else { + if( $main::WWW_USE_IMAGES == 1 ) { + print " \n"; + } else { + print " \n"; + } + } + print " \n"; + } + print "
Host GroupStatus
$grname"; + my $alt = ""; + print "\"$alt\""; + print ""; + } else { + print " "; + print ""; + print "___"; + } + print " -  
\n"; + + } elsif( $format eq "standard" ) { my( %services, $group, $service, @names ); # Compute the total list of services running on the various hosts, and @@ -214,7 +280,7 @@ sub display_html { my $grname = $main::GROUPS{$name}->{'name'}; print "\n"; - print "$grname\n"; + print "$grname\n"; foreach $service ( @names ) { my $color = $group->services_color( $service );