diff --git a/Netdisco/lib/Netdisco/DB/Result/DevicePort.pm b/Netdisco/lib/Netdisco/DB/Result/DevicePort.pm index d71a2231..194e8d6c 100644 --- a/Netdisco/lib/Netdisco/DB/Result/DevicePort.pm +++ b/Netdisco/lib/Netdisco/DB/Result/DevicePort.pm @@ -73,7 +73,7 @@ __PACKAGE__->has_many( nodes => 'Netdisco::DB::Result::Node', prefetch => 'ips', order_by => 'me.mac', '+select' => [ - \"replace(age(me.time_last, me.time_recent)::text, 'mon', 'month')", + \"replace(age(me.time_last)::text, 'mon', 'month')", ], '+as' => [ 'me.time_last', @@ -83,7 +83,10 @@ __PACKAGE__->has_many( nodes => 'Netdisco::DB::Result::Node', sub get_nodes { my ($row, $archive) = @_; - return $row->nodes({ ($archive ? () : ('me.active' => 1, 'ips.active' => 1)) }); + return $row->nodes({ + ($archive ? (-or => [{'me.active' => 1}, {'me.active' => 0}]) + : ('me.active' => 1)) + }); } __PACKAGE__->belongs_to( neighbor_alias => 'Netdisco::DB::Result::DeviceIp', diff --git a/Netdisco/lib/Netdisco/DB/Result/Node.pm b/Netdisco/lib/Netdisco/DB/Result/Node.pm index 680720cb..bf34d51a 100644 --- a/Netdisco/lib/Netdisco/DB/Result/Node.pm +++ b/Netdisco/lib/Netdisco/DB/Result/Node.pm @@ -53,6 +53,6 @@ __PACKAGE__->belongs_to( device => 'Netdisco::DB::Result::Device', __PACKAGE__->belongs_to( device_port => 'Netdisco::DB::Result::DevicePort', { 'foreign.ip' => 'self.switch', 'foreign.port' => 'self.port' }, { join_type => 'LEFT' } ); __PACKAGE__->has_many( ips => 'Netdisco::DB::Result::NodeIp', - { 'foreign.mac' => 'self.mac' } ); + { 'foreign.mac' => 'self.mac', 'foreign.active' => 'self.active' } ); 1; diff --git a/Netdisco/lib/Netdisco/DB/ResultSet/DevicePort.pm b/Netdisco/lib/Netdisco/DB/ResultSet/DevicePort.pm index d8a0ffbe..862ffc72 100644 --- a/Netdisco/lib/Netdisco/DB/ResultSet/DevicePort.pm +++ b/Netdisco/lib/Netdisco/DB/ResultSet/DevicePort.pm @@ -55,7 +55,6 @@ sub by_name { }, { order_by => [qw/ me.ip me.port /], - columns => [qw/ ip port descr name vlan device.dns /], join => 'device', }, ); @@ -72,7 +71,6 @@ sub by_vlan { }, { order_by => [qw/ me.ip me.port /], - columns => [qw/ ip port descr name vlan device.dns /], join => 'device', }, ); @@ -88,7 +86,6 @@ sub by_port { }, { order_by => [qw/ me.ip me.port /], - columns => [qw/ ip port descr name vlan device.dns /], join => 'device', }, ); diff --git a/Netdisco/views/ajax/device/ports.tt b/Netdisco/views/ajax/device/ports.tt index 29bdd202..0e750016 100644 --- a/Netdisco/views/ajax/device/ports.tt +++ b/Netdisco/views/ajax/device/ports.tt @@ -9,7 +9,7 @@ - [% FOREACH row in results %] + [% FOREACH row IN results %]