Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES 2010-08-05 03:26:36 UTC (rev 4785)
+++ trunk/CHANGES 2010-08-05 14:32:55 UTC (rev 4786)
@@ -39,6 +39,7 @@
Note: rsyslog needs to have '$RepeatedMsgReduction on' set to enable repeated message reduction
Fixed possible vulnerability with invalid cookie values
Fixed bad contact notifications tab when only one notification method is active (OPS-1255)
+ Fixed viewport summary keyword list so that only keywords with a service on are listed
NOTICES:
Modified: trunk/opsview-core/t/var/opsview.test.db
===================================================================
--- trunk/opsview-core/t/var/opsview.test.db 2010-08-05 03:26:36 UTC (rev 4785)
+++ trunk/opsview-core/t/var/opsview.test.db 2010-08-05 14:32:55 UTC (rev 4786)
@@ -1154,7 +1154,7 @@
INSERT INTO `keywords` VALUES (3,'cisco_gp1','cisco devices, group 1',1,'group_by_host',0,0,0);
INSERT INTO `keywords` VALUES (4,'cisco_gp2','',1,'group_by_host',0,0,0);
INSERT INTO `keywords` VALUES (5,'disabled',NULL,0,NULL,0,0,0);
-INSERT INTO `keywords` VALUES (6,'alphaearly',NULL,0,NULL,0,0,0);
+INSERT INTO `keywords` VALUES (6,'alphaearly','Should not display in list of keywords on viewport summary',1,'group_by_host',0,0,1);
INSERT INTO `keywords` VALUES (7,'allhosts',NULL,0,NULL,1,0,1);
INSERT INTO `keywords` VALUES (8,'allservicechecks',NULL,0,NULL,0,1,1);
/*!40000 ALTER TABLE `keywords` ENABLE KEYS */;
Modified: trunk/opsview-web/lib/Opsview/Web/Controller/Viewport.pm
===================================================================
--- trunk/opsview-web/lib/Opsview/Web/Controller/Viewport.pm 2010-08-05 03:26:36 UTC (rev 4785)
+++ trunk/opsview-web/lib/Opsview/Web/Controller/Viewport.pm 2010-08-05 14:32:55 UTC (rev 4786)
@@ -90,14 +90,22 @@
push( @{ $c->stash->{extra_javascript} }, "jquery", "jquery.noConflict", "prototypextensions", "viewports" );
# get list of all live keywords
- my @keyword_rs = $c->model("OpsviewSchema::Keywords")->search(
+ my @active_viewports = $c->model("OpsviewSchema::Keywords")->search(
{ enabled => 1 },
{ order_by => \'name',
- columns => ['name']
+ columns => ['name'],
}
);
my @keywords = ();
- foreach (@keyword_rs) { push( @keywords, $_->name ); }
+ my %keywords_with_services = map { ( $_->keyword => 1 ) } (
+ $c->model("RuntimeSchema::OpsviewViewports")->search(
+ {},
+ { columns => ["keyword"],
+ distinct => 1,
+ }
+ )
+ );
+ foreach (@active_viewports) { push( @keywords, $_->name ) if $keywords_with_services{ $_->name }; }
# info for all multiselects in filter options
my $filter_columns = [
Modified: trunk/opsview-web/t/840viewports.t
===================================================================
--- trunk/opsview-web/t/840viewports.t 2010-08-05 03:26:36 UTC (rev 4785)
+++ trunk/opsview-web/t/840viewports.t 2010-08-05 14:32:55 UTC (rev 4786)
@@ -71,6 +71,8 @@
#is( $num, 4, "Four rows found: 1 header + 3 data" );
like( $_, qr/Loading.../, "Has a loading page" );
+$ua->content_lacks( "alphaearly", "This keyword should not be listed as there are no services associated to this viewport" );
+
my $expected = {
'ResultSet' => {
'summary' => {