Title: [opsview] [9950] Removed parenthostgroupid and just use hostgroupid to list all hosts below
Revision
9950
Author
tvoon
Date
2012-09-05 15:29:54 +0100 (Wed, 05 Sep 2012)

Log Message

Removed parenthostgroupid and just use hostgroupid to list all hosts below

Modified Paths

Modified: trunk/opsview-core/lib/Runtime/ResultSet/OpsviewTopologyMap.pm
===================================================================
--- trunk/opsview-core/lib/Runtime/ResultSet/OpsviewTopologyMap.pm	2012-09-05 14:26:21 UTC (rev 9949)
+++ trunk/opsview-core/lib/Runtime/ResultSet/OpsviewTopologyMap.pm	2012-09-05 14:29:54 UTC (rev 9950)
@@ -26,42 +26,6 @@
     if ( exists $filters->{hostgroupid} ) {
         @hostgroupids = @{ convert_to_arrayref( $filters->{hostgroupid} ) };
     }
-    if ( exists $filters->{hostgroupname} ) {
-        my $hostgroupnames = convert_to_arrayref( $filters->{hostgroupname} );
-        my $hg_rs =
-          $self->result_source->schema->resultset( "OpsviewHostgroups" );
-        foreach my $hgname (@$hostgroupnames) {
-            my @found =
-              map { $_->id } ( $hg_rs->search( { name => $hostgroupnames } ) );
-            if (@found) {
-                push @hostgroupids, @found;
-            }
-        }
-    }
-
-    # parent hostgroup id - fetch all descendants
-    if ( my $parenthostgroupid = $filters->{parenthostgroupid} ) {
-        my $hg_rs =
-          $self->result_source->schema->resultset( "OpsviewHostgroups" );
-        my $parentgroup = $hg_rs->find(
-            { id      => $parenthostgroupid },
-            { columns => ['matpathid'] },
-        );
-        if ($parentgroup) {
-            my @found = map { $_->id } (
-                $hg_rs->search(
-                    {
-                        matpathid =>
-                          { '-like' => $parentgroup->matpathid . "%" }
-                    },
-                    { 'columns' => ['id'], }
-                )
-            );
-            if (@found) {
-                push @hostgroupids, @found;
-            }
-        }
-    }
     if (@hostgroupids) {
         $self = $self->search(
             { "hostgroups.hostgroup_id" => \@hostgroupids },

Modified: trunk/opsview-web/t/tests/Test/Opsview/Web/REST/Runtime.pm
===================================================================
--- trunk/opsview-web/t/tests/Test/Opsview/Web/REST/Runtime.pm	2012-09-05 14:26:21 UTC (rev 9949)
+++ trunk/opsview-web/t/tests/Test/Opsview/Web/REST/Runtime.pm	2012-09-05 14:29:54 UTC (rev 9950)
@@ -275,7 +275,7 @@
     subtest 'Filter by parent host group' => sub {
         plan tests => 2;
 
-        $url      = ""
+        $url      = ""
         $expected = [
             {
                 'name'     => 'opsview',

_______________________________________________
Opsview-checkins mailing list
[email protected]
http://lists.opsview.org/lists/listinfo/opsview-checkins

Reply via email to