frontend support for port poe enable/disable

This commit is contained in:
Oliver Gorwits
2012-12-10 21:07:39 +00:00
parent 4dd6080a84
commit 3b90e28843
8 changed files with 100 additions and 6 deletions

View File

@@ -137,6 +137,17 @@ __PACKAGE__->belongs_to( neighbor_alias => 'Netdisco::DB::Result::DeviceIp',
{ join_type => 'LEFT' },
);
=head2 power
Returns a row from the C<device_port_power> table if one refers to this
device port.
=cut
__PACKAGE__->might_have( power => 'Netdisco::DB::Result::DevicePortPower', {
'foreign.ip' => 'self.ip', 'foreign.port' => 'self.port',
});
=head2 port_vlans_tagged
Returns a set of rows from the C<device_port_vlan> table relating to this

View File

@@ -31,6 +31,16 @@ __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:sHcdItRUFUOAtIZQjdWbcg
=head1 RELATIONSHIPS
=head2 port
Returns the entry from the C<port> table for which this Power entry applies.
=cut
__PACKAGE__->belongs_to( port => 'Netdisco::DB::Result::DevicePort', {
'foreign.ip' => 'self.ip', 'foreign.port' => 'self.port',
});
# You can replace this text with custom code or comments, and it will be preserved on regeneration
1;

View File

@@ -21,7 +21,8 @@ hook 'before' => sub {
{ name => 'c_mac', label => 'Port MAC', default => '' },
{ name => 'c_mtu', label => 'MTU', default => '' },
{ name => 'c_vlan', label => 'Native VLAN', default => 'on' },
{ name => 'c_vmember', label => 'VLAN Membership', default => 'on' },
{ name => 'c_vmember', label => 'Tagged VLANs', default => 'on' },
{ name => 'c_power', label => 'PoE', 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

@@ -17,10 +17,11 @@ ajax '/ajax/portcontrol' => sub {
'c_port' => 'portcontrol',
'c_name' => 'portname',
'c_vlan' => 'vlan',
'c_power' => 'power',
);
my $action = $action_map{ param('field') };
my $subaction = ($action eq 'portcontrol'
my $subaction = ($action =~ m/^(?:power|portcontrol)/
? (param('action') ."-other")
: param('value'));