implement addresses pane for device

This commit is contained in:
Oliver Gorwits
2012-01-13 20:59:51 +00:00
parent f1d3bb9fd9
commit 60d8e6de76
4 changed files with 42 additions and 1 deletions

View File

@@ -35,5 +35,7 @@ __PACKAGE__->set_primary_key("ip", "alias");
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/ugGtBSGyrJ7s6yqJ9bclQ
__PACKAGE__->belongs_to( device => 'Netdisco::DB::Result::Device', 'ip' );
__PACKAGE__->belongs_to( device_port => 'Netdisco::DB::Result::DevicePort',
{ 'foreign.port' => 'self.port', 'foreign.ip' => 'self.ip' } );
1;

View File

@@ -88,6 +88,20 @@ ajax '/ajax/content/device/:thing' => sub {
return "<p>Hello, this is where the ". param('thing') ." content goes.</p>";
};
# device interface addresses
ajax '/ajax/content/device/addresses' => sub {
my $ip = param('ip');
return unless $ip;
my $set = schema('netdisco')->resultset('DeviceIp')->search({ip => $ip}, { order_by => 'alias' });
return unless $set->count;
content_type('text/html');
template 'ajax/device/addresses.tt', {
results => $set,
}, { layout => undef };
};
# device ports with a description (er, name) matching
ajax '/ajax/content/device/ports' => sub {
my $ip = param('ip');