torrus virtual ports, RT#10574
authorivan <ivan>
Sun, 27 Feb 2011 19:20:37 +0000 (19:20 +0000)
committerivan <ivan>
Sun, 27 Feb 2011 19:20:37 +0000 (19:20 +0000)
FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm
FS/FS/torrus_srvderive_component.pm
torrus/perllib/Torrus/Renderer/HTML.pm

index b55d0aa..1cc5d2a 100644 (file)
@@ -7,8 +7,9 @@ use IO::File;
 use File::Slurp qw(slurp);
 use Date::Format;
 use XML::Simple;
+use FS::Record qw(qsearch qsearchs dbh);
 use FS::svc_port;
-use FS::Record qw(qsearch dbh);
+use FS::torrus_srvderive_component;
 use Torrus::ConfigTree;
 
 #$DEBUG = 0;
@@ -94,6 +95,14 @@ sub find_svc {
     return $svc_port[0];
 }
 
+sub find_torrus_srvderive_component {
+    my $self = shift;
+    my $serviceid = shift;
+    return '' unless $serviceid =~ /^[0-9A-Za-z_\-.\\\/ ]+$/;
+  
+    qsearchs('torrus_srvderive_component', { 'serviceid' => $serviceid });
+}
+
 sub report {
   my $self = shift;
 
index 046b674..b244d06 100644 (file)
@@ -3,6 +3,7 @@ package FS::torrus_srvderive_component;
 use strict;
 use base qw( FS::Record );
 use FS::Record qw( qsearch qsearchs );
+use FS::torrus_srvderive;
 
 =head1 NAME
 
@@ -113,6 +114,11 @@ sub check {
   $self->SUPER::check;
 }
 
+sub torrus_srvderive {
+  my $self = shift;
+  qsearchs('torrus_srvderive', { 'derivenum' => $self->derivenum } );
+}
+
 =back
 
 =head1 BUGS
index 875033a..df0c65b 100644 (file)
@@ -14,7 +14,7 @@
 #  along with this program; if not, write to the Free Software
 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
 
-# $Id: HTML.pm,v 1.12 2011-02-27 19:14:47 ivan Exp $
+# $Id: HTML.pm,v 1.13 2011-02-27 19:20:37 ivan Exp $
 # Stanislav Sinyagin <ssinyagin@yahoo.com>
 
 package Torrus::Renderer::HTML;
@@ -144,8 +144,16 @@ sub render_html
                              "/view/svc_port.cgi?". $svc_port->svcnum;
                    return "<A HREF='$url'>View Service</A>";
                 } else {
-                   return 'Monitored as '. $serviceids->{$iface}.
-                          '; customer service not yet provisioned';
+                  my $component =
+                   $nms->find_torrus_srvderive_component($serviceids->{$iface});
+                  
+                  if ($component) {
+                     return $serviceids->{$iface}. ' combined into '.
+                            $component->torrus_srvderive->serviceid;
+                  } else {
+                     return 'Monitored as '. $serviceids->{$iface}.
+                            '; not yet provisioned or combined';
+                  }
                 }
 
               } else {