fixed only free ports in device ports view (showing free ports TODO)

This commit is contained in:
Oliver Gorwits
2019-08-20 11:13:52 +01:00
parent 22302114cb
commit d45745dd1d
3 changed files with 66 additions and 28 deletions

View File

@@ -250,24 +250,13 @@ The JOIN is of type "LEFT" in case there isn't any such node.
=cut
__PACKAGE__->belongs_to( last_node => 'App::Netdisco::DB::Result::Node',
sub {
my $args = shift;
return {
"$args->{foreign_alias}.mac" => { '=' =>
$args->{self_resultsource}->schema->resultset('Node')->search({
switch => { -ident => "$args->{self_alias}.ip"},
port => { -ident => "$args->{self_alias}.port"}
},{
rows => 1,
order_by => { -desc => ['time_last'] },
columns => 'mac',
alias => 'lastnodesub'
})->as_query
}
};
},
{ join_type => 'LEFT' },
__PACKAGE__->belongs_to(
last_node => 'App::Netdisco::DB::Result::Virtual::LastNode', {
'foreign.switch' => 'self.ip',
'foreign.port' => 'self.port',
}, {
join_type => 'LEFT',
}
);
=head2 vlans