bug fixes for port connected node list

This commit is contained in:
Oliver Gorwits
2012-01-13 20:01:49 +00:00
parent 9d335ee663
commit 2b4c6d26e9
7 changed files with 14 additions and 11 deletions

View File

@@ -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',

View File

@@ -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;

View File

@@ -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',
},
);

View File

@@ -9,7 +9,7 @@
</tr>
</thead>
</tbody>
[% FOREACH row in results %]
[% FOREACH row IN results %]
<tr>
<td>
[% IF row.up_admin == 'down' %]
@@ -101,7 +101,7 @@
[% ' (' _ node.time_last _ ')' IF params.n_age %]
[% IF params.n_ip %]
[% FOREACH ip IN node.ips %]
<br/>&nbsp; [% '<span class="label warning">a</span> &nbsp;' IF NOT node.active %]
<br/>&nbsp; [% '<span class="label warning">a</span> &nbsp;' IF NOT ip.active %]
[% SET dns = ip.dns %]
[% IF dns %]
<a href="/search?tab=node&q=[% ip.ip | uri %]">[% ip.dns %] ([% ip.ip %])</a>

View File

@@ -1,4 +1,5 @@
<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>

View File

@@ -1,4 +1,5 @@
<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>

View File

@@ -1,4 +1,5 @@
<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>