bug fixes for port connected node list
This commit is contained in:
		| @@ -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', | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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', | ||||
|       }, | ||||
|     ); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user