Option to display Port SSID in Device Ports view

This commit is contained in:
Oliver Gorwits
2014-02-27 17:35:13 +00:00
parent 5cce95f49e
commit 6b342dc1cb
6 changed files with 29 additions and 2 deletions

View File

@@ -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]

View File

@@ -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<device_port_ssid> 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<device_port_wireless> table if one refers to this

View File

@@ -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

View File

@@ -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 => '' },

View File

@@ -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');

View File

@@ -187,6 +187,10 @@
</td>
[% END %]
[% IF params.c_ssid %]
<td>[% row.ssid.ssid | html_entity %]</td>
[% END %]
[% IF params.c_power %]
[% IF row.power %]
[% IF row.power.admin == 'true' %]