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',
|
prefetch => 'ips',
|
||||||
order_by => 'me.mac',
|
order_by => 'me.mac',
|
||||||
'+select' => [
|
'+select' => [
|
||||||
\"replace(age(me.time_last, me.time_recent)::text, 'mon', 'month')",
|
\"replace(age(me.time_last)::text, 'mon', 'month')",
|
||||||
],
|
],
|
||||||
'+as' => [
|
'+as' => [
|
||||||
'me.time_last',
|
'me.time_last',
|
||||||
@@ -83,7 +83,10 @@ __PACKAGE__->has_many( nodes => 'Netdisco::DB::Result::Node',
|
|||||||
|
|
||||||
sub get_nodes {
|
sub get_nodes {
|
||||||
my ($row, $archive) = @_;
|
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',
|
__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',
|
__PACKAGE__->belongs_to( device_port => 'Netdisco::DB::Result::DevicePort',
|
||||||
{ 'foreign.ip' => 'self.switch', 'foreign.port' => 'self.port' }, { join_type => 'LEFT' } );
|
{ 'foreign.ip' => 'self.switch', 'foreign.port' => 'self.port' }, { join_type => 'LEFT' } );
|
||||||
__PACKAGE__->has_many( ips => 'Netdisco::DB::Result::NodeIp',
|
__PACKAGE__->has_many( ips => 'Netdisco::DB::Result::NodeIp',
|
||||||
{ 'foreign.mac' => 'self.mac' } );
|
{ 'foreign.mac' => 'self.mac', 'foreign.active' => 'self.active' } );
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|||||||
@@ -55,7 +55,6 @@ sub by_name {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
order_by => [qw/ me.ip me.port /],
|
order_by => [qw/ me.ip me.port /],
|
||||||
columns => [qw/ ip port descr name vlan device.dns /],
|
|
||||||
join => 'device',
|
join => 'device',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -72,7 +71,6 @@ sub by_vlan {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
order_by => [qw/ me.ip me.port /],
|
order_by => [qw/ me.ip me.port /],
|
||||||
columns => [qw/ ip port descr name vlan device.dns /],
|
|
||||||
join => 'device',
|
join => 'device',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -88,7 +86,6 @@ sub by_port {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
order_by => [qw/ me.ip me.port /],
|
order_by => [qw/ me.ip me.port /],
|
||||||
columns => [qw/ ip port descr name vlan device.dns /],
|
|
||||||
join => 'device',
|
join => 'device',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
</tbody>
|
</tbody>
|
||||||
[% FOREACH row in results %]
|
[% FOREACH row IN results %]
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
[% IF row.up_admin == 'down' %]
|
[% IF row.up_admin == 'down' %]
|
||||||
@@ -101,7 +101,7 @@
|
|||||||
[% ' (' _ node.time_last _ ')' IF params.n_age %]
|
[% ' (' _ node.time_last _ ')' IF params.n_age %]
|
||||||
[% IF params.n_ip %]
|
[% IF params.n_ip %]
|
||||||
[% FOREACH ip IN node.ips %]
|
[% FOREACH ip IN node.ips %]
|
||||||
<br/> [% '<span class="label warning">a</span> ' IF NOT node.active %]
|
<br/> [% '<span class="label warning">a</span> ' IF NOT ip.active %]
|
||||||
[% SET dns = ip.dns %]
|
[% SET dns = ip.dns %]
|
||||||
[% IF dns %]
|
[% IF dns %]
|
||||||
<a href="/search?tab=node&q=[% ip.ip | uri %]">[% ip.dns %] ([% ip.ip %])</a>
|
<a href="/search?tab=node&q=[% ip.ip | uri %]">[% ip.dns %] ([% ip.ip %])</a>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
<form id="[% tab.id %]_form" class="nd_sidesearchform form-stacked" method="get" action="/device">
|
<form id="[% tab.id %]_form" class="nd_sidesearchform form-stacked" method="get" action="/device">
|
||||||
<input name="ip" value="[% d.ip %]" type="hidden"/>
|
<input name="ip" value="[% params.ip %]" type="hidden"/>
|
||||||
|
<input name="q" value="[% params.q %]" type="hidden"/>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
<form id="[% tab.id %]_form" class="nd_sidesearchform form-stacked" method="get" action="/device">
|
<form id="[% tab.id %]_form" class="nd_sidesearchform form-stacked" method="get" action="/device">
|
||||||
<input name="ip" value="[% d.ip %]" type="hidden"/>
|
<input name="ip" value="[% params.ip %]" type="hidden"/>
|
||||||
|
<input name="q" value="[% params.q %]" type="hidden"/>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
|
|
||||||
<form id="[% tab.id %]_form" class="nd_sidesearchform form-stacked" method="get" action="/device">
|
<form id="[% tab.id %]_form" class="nd_sidesearchform form-stacked" method="get" action="/device">
|
||||||
<input name="ip" value="[% d.ip %]" type="hidden"/>
|
<input name="ip" value="[% params.ip %]" type="hidden"/>
|
||||||
|
<input name="q" value="[% params.q %]" type="hidden"/>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
Reference in New Issue
Block a user