From: ivan Date: Wed, 26 Oct 2011 02:44:16 +0000 (+0000) Subject: fix ports with dashes (-) not showing their monitoring status, RT#14926 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=b490e791cc60013989d908041f174467e362a1ea fix ports with dashes (-) not showing their monitoring status, RT#14926 --- diff --git a/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm b/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm index 6b89090f8..04a6b2954 100644 --- a/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm +++ b/FS/FS/NetworkMonitoringSystem/Torrus_Internal.pm @@ -176,6 +176,7 @@ sub add_router { sub add_interface { my($self, $router_ip, $interface, $serviceid ) = @_; + #false laziness w/torrus/perllib/Torrus/Renderer.pm iface_underscore, update both $interface =~ s(\/)(_)g; #slashes become underscores $interface =~ s(\.)(_)g; #periods too, huh $interface =~ s(\-)(_)g; #yup, and dashes diff --git a/torrus/perllib/Torrus/Renderer/HTML.pm b/torrus/perllib/Torrus/Renderer/HTML.pm index 6eec86d21..70cfda847 100644 --- a/torrus/perllib/Torrus/Renderer/HTML.pm +++ b/torrus/perllib/Torrus/Renderer/HTML.pm @@ -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.14 2011-03-01 00:09:39 ivan Exp $ +# $Id: HTML.pm,v 1.15 2011-10-26 02:44:16 ivan Exp $ # Stanislav Sinyagin package Torrus::Renderer::HTML; @@ -120,7 +120,10 @@ sub render_html 'freesideComponent' => sub { return $self->freesideComponent(@_); }, 'uri_escape' => sub { return uri_escape(@_); }, 'matches' => sub { return $_[0] =~ $_[1]; }, - 'iface_underscore' => sub { $_[0] =~ s/[\/\.]/_/g; return $_[0]; }, + + #false laziness w/Torrus_Internal::add_interface, update both + 'iface_underscore' => sub { $_[0] =~ s/[\/\.\-]/_/g; return $_[0]; }, + 'load_nms' => sub { return $self->load_nms; }, 'get_serviceids' => sub { my $nms = shift; my $router = shift; @@ -131,13 +134,15 @@ sub render_html if($type eq 'nms-add_iface.html') { my $host = shift; - my $iface = shift; + my $interface = shift; my $nms = shift; my $serviceids = shift; - if ( $serviceids && $serviceids->{$iface} ) { + if ( $serviceids && $serviceids->{$interface} ) { + + my $serviceid = $serviceids->{$interface}; - my $svc_port = $nms->find_svc($serviceids->{$iface}); + my $svc_port = $nms->find_svc($serviceid); if ($svc_port) { my $url = $Torrus::Freeside::FSURL. @@ -145,13 +150,13 @@ sub render_html return "View Service"; } else { my $component = - $nms->find_torrus_srvderive_component($serviceids->{$iface}); + $nms->find_torrus_srvderive_component($serviceid); if ($component) { - return $serviceids->{$iface}. ' combined into '. + return "$serviceid combined into ". $component->torrus_srvderive->serviceid; } else { - return 'Monitored as '. $serviceids->{$iface}. + return "Monitored as $serviceid". '; not yet provisioned or combined'; } } @@ -161,7 +166,7 @@ sub render_html return $self->freesideComponent('/elements/popup_link.html', 'action' => "/freeside/misc/". - $type."?host=$host;iface=$iface", + $type."?host=$host;iface=$interface", 'label' => 'Monitor for billing', 'actionlabel' => 'Monitor interface', );