Title: [opsview] [10305] Always order topology call by importance
Revision
10305
Author
tvoon
Date
2012-10-05 15:30:15 +0100 (Fri, 05 Oct 2012)

Log Message

Always order topology call by importance

Modified Paths


Modified: trunk/opsview-core/lib/Runtime/ResultSet/OpsviewTopologyMap.pm
===================================================================
--- trunk/opsview-core/lib/Runtime/ResultSet/OpsviewTopologyMap.pm	2012-10-05 14:28:55 UTC (rev 10304)
+++ trunk/opsview-core/lib/Runtime/ResultSet/OpsviewTopologyMap.pm	2012-10-05 14:30:15 UTC (rev 10305)
@@ -62,10 +62,6 @@
           )->all;
         $self = $self->search(
             { 'matpaths.matpath' => { '-like' => [ uniq(@matpaths) ] } },
-            {
-                join => { host => 'matpaths' },
-                order_by => [ "matpaths.depth", "me.id" ],
-            }
         );
         $num_filters++;
     }
@@ -151,12 +147,15 @@
         }
     )->count;
 
+    # We order by matpath.depth to get the list in some sort of "importance order"
+    # This is needed for Dashboard's network map
     my $opts = {
         result_class => "DBIx::Class::ResultClass::HashRefInflator",
         columns      => [
             qw( opsview_host_id name parent_id parent_name child_id child_name )
         ],
-        order_by => ["me.id"],
+        join => { host => "matpaths" },
+        order_by => [ "matpaths.depth", "me.id" ],
     };
     $self = $self->search( {}, $opts, );
 

Modified: trunk/opsview-web/t/tests/Test/Opsview/Web/REST/Runtime.pm
===================================================================
--- trunk/opsview-web/t/tests/Test/Opsview/Web/REST/Runtime.pm	2012-10-05 14:28:55 UTC (rev 10304)
+++ trunk/opsview-web/t/tests/Test/Opsview/Web/REST/Runtime.pm	2012-10-05 14:30:15 UTC (rev 10305)
@@ -63,11 +63,6 @@
                     'parents'  => ['opsview']
                 },
                 {
-                    'name'     => 'monitored_by_slave',
-                    'children' => [],
-                    'parents'  => [ 'cisco', 'cisco3' ]
-                },
-                {
                     'name'     => 'resolved_services',
                     'children' => [],
                     'parents'  => ['opsview']
@@ -88,11 +83,6 @@
                     'parents'  => ['opsview']
                 },
                 {
-                    'name'     => 'cisco4',
-                    'children' => ['fake_ipv6'],
-                    'parents'  => ['cisco']
-                },
-                {
                     'name'     => 'toclone',
                     'children' => [],
                     'parents'  => ['opsview']
@@ -118,11 +108,6 @@
                     'parents'  => ['opsview']
                 },
                 {
-                    'name'     => 'fake_ipv6',
-                    'children' => [],
-                    'parents'  => ['cisco4']
-                },
-                {
                     'name'     => 'opsviewdev46',
                     'children' => [],
                     'parents'  => ['opsview']
@@ -136,6 +121,21 @@
                     'name'     => 'PassiveNode',
                     'children' => [],
                     'parents'  => ['opsview']
+                },
+                {
+                    'name'     => 'monitored_by_slave',
+                    'children' => [],
+                    'parents'  => [ 'cisco', 'cisco3' ]
+                },
+                {
+                    'name'     => 'cisco4',
+                    'children' => ['fake_ipv6'],
+                    'parents'  => ['cisco']
+                },
+                {
+                    'name'     => 'fake_ipv6',
+                    'children' => [],
+                    'parents'  => ['cisco4']
                 }
             ]
         };
@@ -226,11 +226,6 @@
                     'parents'  => ['opsview']
                 },
                 {
-                    'name'     => 'cisco4',
-                    'children' => ['fake_ipv6'],
-                    'parents'  => ['cisco']
-                },
-                {
                     'name'     => 'host_locally_monitored_v3',
                     'children' => [],
                     'parents'  => ['opsview']
@@ -246,6 +241,11 @@
                     'parents'  => ['opsview']
                 },
                 {
+                    'name'     => 'cisco4',
+                    'children' => ['fake_ipv6'],
+                    'parents'  => ['cisco']
+                },
+                {
                     'name'     => 'fake_ipv6',
                     'children' => [],
                     'parents'  => ['cisco4']
@@ -344,11 +344,6 @@
                     'parents'  => ['opsview']
                 },
                 {
-                    'name'     => 'cisco4',
-                    'children' => ['fake_ipv6'],
-                    'parents'  => ['cisco']
-                },
-                {
                     'name'     => 'host_locally_monitored_v3',
                     'children' => [],
                     'parents'  => ['opsview']
@@ -364,14 +359,19 @@
                     'parents'  => ['opsview']
                 },
                 {
-                    'name'     => 'fake_ipv6',
+                    'name'     => 'opsviewdev46',
                     'children' => [],
-                    'parents'  => ['cisco4']
+                    'parents'  => ['opsview']
                 },
                 {
-                    'name'     => 'opsviewdev46',
+                    'name'     => 'cisco4',
+                    'children' => ['fake_ipv6'],
+                    'parents'  => ['cisco']
+                },
+                {
+                    'name'     => 'fake_ipv6',
                     'children' => [],
-                    'parents'  => ['opsview']
+                    'parents'  => ['cisco4']
                 }
             ]
         };

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

Reply via email to