diff --git a/Netdisco/Changes b/Netdisco/Changes index 4f09890e..23558c86 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -5,6 +5,10 @@ * User Reports via config, without requiring HTML or Perl * Add netdisco-rancid-export script + [ENHANCEMENTS] + + * Option to display Port SSID in Device Ports view + 2.024001 - 2014-02-25 [BUG FIXES] diff --git a/Netdisco/lib/App/Netdisco/DB/Result/DevicePort.pm b/Netdisco/lib/App/Netdisco/DB/Result/DevicePort.pm index 69c62c32..38c65523 100644 --- a/Netdisco/lib/App/Netdisco/DB/Result/DevicePort.pm +++ b/Netdisco/lib/App/Netdisco/DB/Result/DevicePort.pm @@ -169,6 +169,20 @@ __PACKAGE__->might_have( power => 'App::Netdisco::DB::Result::DevicePortPower', 'foreign.ip' => 'self.ip', 'foreign.port' => 'self.port', }); +=head2 ssid + +Returns a row from the C table if one refers to this +device port. + +=cut + +__PACKAGE__->might_have( + ssid => 'App::Netdisco::DB::Result::DevicePortSsid', + { 'foreign.ip' => 'self.ip', + 'foreign.port' => 'self.port', + } +); + =head2 wireless Returns a row from the C table if one refers to this diff --git a/Netdisco/lib/App/Netdisco/DB/Result/DevicePortSsid.pm b/Netdisco/lib/App/Netdisco/DB/Result/DevicePortSsid.pm index 2155d3d1..ce54c924 100644 --- a/Netdisco/lib/App/Netdisco/DB/Result/DevicePortSsid.pm +++ b/Netdisco/lib/App/Netdisco/DB/Result/DevicePortSsid.pm @@ -11,9 +11,9 @@ use base 'DBIx::Class::Core'; __PACKAGE__->table("device_port_ssid"); __PACKAGE__->add_columns( "ip", - { data_type => "inet", is_nullable => 1 }, + { data_type => "inet", is_nullable => 0 }, "port", - { data_type => "text", is_nullable => 1 }, + { data_type => "text", is_nullable => 0 }, "ssid", { data_type => "text", is_nullable => 1 }, "broadcast", @@ -22,6 +22,7 @@ __PACKAGE__->add_columns( { data_type => "macaddr", is_nullable => 1 }, ); +__PACKAGE__->set_primary_key("port", "ip"); # Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 # DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zvgylKzUQtizJZCe1rEdUg diff --git a/Netdisco/lib/App/Netdisco/Web/Device.pm b/Netdisco/lib/App/Netdisco/Web/Device.pm index 34b0f84a..9ab1badf 100644 --- a/Netdisco/lib/App/Netdisco/Web/Device.pm +++ b/Netdisco/lib/App/Netdisco/Web/Device.pm @@ -24,6 +24,7 @@ hook 'before' => sub { { name => 'c_pvid', label => 'Native VLAN', default => 'on' }, { name => 'c_vmember', label => 'VLAN Membership', default => 'on' }, { name => 'c_power', label => 'PoE', default => '' }, + { name => 'c_ssid', label => 'SSID', default => '' }, { name => 'c_nodes', label => 'Connected Nodes', default => '' }, { name => 'c_neighbors', label => 'Connected Devices', default => 'on' }, { name => 'c_stp', label => 'Spanning Tree', default => '' }, diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm index 914f87be..3d044f85 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm @@ -149,6 +149,9 @@ get '/ajax/content/device/ports' => require_login sub { $set = $set->search_rs({}, { prefetch => [{$nodes_name => 'oui'}] }) if param('c_nodes') && param('n_vendor'); + # retrieve SSID, if asked for + $set = $set->search({}, { prefetch => 'ssid' }) if param('c_ssid'); + # retrieve neighbor devices, if asked for $set = $set->search_rs({}, { prefetch => [{neighbor_alias => 'device'}] }) if param('c_neighbors'); diff --git a/Netdisco/share/views/ajax/device/ports.tt b/Netdisco/share/views/ajax/device/ports.tt index 2e985bf5..f24da989 100644 --- a/Netdisco/share/views/ajax/device/ports.tt +++ b/Netdisco/share/views/ajax/device/ports.tt @@ -187,6 +187,10 @@ [% END %] + [% IF params.c_ssid %] + [% row.ssid.ssid | html_entity %] + [% END %] + [% IF params.c_power %] [% IF row.power %] [% IF row.power.admin == 'true' %]