Individual column selections for connected nodes and devices
This commit is contained in:
1
Changes
1
Changes
@@ -7,6 +7,7 @@
|
|||||||
* Show device name on device details views (closes #30)
|
* Show device name on device details views (closes #30)
|
||||||
* Migrated to Font Awesome for a wider range of icon fonts
|
* Migrated to Font Awesome for a wider range of icon fonts
|
||||||
* Simple network map showing *some* links between devices
|
* Simple network map showing *some* links between devices
|
||||||
|
* Individual column selections for connected nodes and devices
|
||||||
|
|
||||||
[ENHANCEMENTS]
|
[ENHANCEMENTS]
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ hook 'before' => sub {
|
|||||||
{ name => 'c_mtu', label => 'MTU', default => '' },
|
{ name => 'c_mtu', label => 'MTU', default => '' },
|
||||||
{ name => 'c_vlan', label => 'Native VLAN', default => 'on' },
|
{ name => 'c_vlan', label => 'Native VLAN', default => 'on' },
|
||||||
{ name => 'c_vmember', label => 'VLAN Membership', default => 'on' },
|
{ name => 'c_vmember', label => 'VLAN Membership', default => 'on' },
|
||||||
{ name => 'c_connected', label => 'Connected Devices', default => '' },
|
{ name => 'c_nodes', label => 'Connected Nodes', default => '' },
|
||||||
|
{ name => 'c_neighbors', label => 'Connected Devices', default => 'on' },
|
||||||
{ name => 'c_stp', label => 'Spanning Tree', default => '' },
|
{ name => 'c_stp', label => 'Spanning Tree', default => '' },
|
||||||
{ name => 'c_up', label => 'Status', default => '' },
|
{ name => 'c_up', label => 'Status', default => '' },
|
||||||
]);
|
]);
|
||||||
@@ -206,12 +207,15 @@ ajax '/ajax/content/device/ports' => sub {
|
|||||||
|
|
||||||
# what kind of nodes are we interested in?
|
# what kind of nodes are we interested in?
|
||||||
my $nodes_name = (param('n_archived') ? 'nodes' : 'active_nodes');
|
my $nodes_name = (param('n_archived') ? 'nodes' : 'active_nodes');
|
||||||
$nodes_name .= '_with_age' if param('c_connected') and param('n_age');
|
$nodes_name .= '_with_age' if param('c_nodes') and param('n_age');
|
||||||
|
|
||||||
# retrieve active/all connected nodes, and device, if asked for
|
# retrieve active/all connected nodes, if asked for
|
||||||
$set = $set->search_rs({}, {
|
$set = $set->search_rs({}, { prefetch => [{$nodes_name => 'ips'}] })
|
||||||
prefetch => [{$nodes_name => 'ips'}, {neighbor_alias => 'device'}],
|
if param('c_nodes');
|
||||||
}) if param('c_connected');
|
|
||||||
|
# retrieve neighbor devices, if asked for
|
||||||
|
$set = $set->search_rs({}, { prefetch => [{neighbor_alias => 'device'}] })
|
||||||
|
if param('c_neighbors');
|
||||||
|
|
||||||
# sort ports (empty set would be a 'no records' msg)
|
# sort ports (empty set would be a 'no records' msg)
|
||||||
my $results = [ sort { &Netdisco::Util::sort_port($a->port, $b->port) } $set->all ];
|
my $results = [ sort { &Netdisco::Util::sort_port($a->port, $b->port) } $set->all ];
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<th></th>
|
<th></th>
|
||||||
[% FOREACH item IN vars.port_columns %]
|
[% FOREACH item IN vars.port_columns %]
|
||||||
[% NEXT IF item.name == 'c_admin' %]
|
[% NEXT IF item.name == 'c_admin' %]
|
||||||
|
[% NEXT IF item.name == 'c_nodes' AND params.c_nodes AND params.c_neighbors %]
|
||||||
[% NEXT UNLESS params.${item.name} %]
|
[% NEXT UNLESS params.${item.name} %]
|
||||||
<th[% ' class="center_cell"' IF NOT loop.first %]>[% item.label %]</th>
|
<th[% ' class="center_cell"' IF NOT loop.first %]>[% item.label %]</th>
|
||||||
[% END %]
|
[% END %]
|
||||||
@@ -134,9 +135,9 @@
|
|||||||
</td>
|
</td>
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
||||||
[% IF params.c_connected %]
|
[% IF params.c_nodes OR params.c_neighbors %]
|
||||||
<td>
|
<td>
|
||||||
[% IF row.remote_ip %]
|
[% IF params.c_neighbors AND row.remote_ip %]
|
||||||
[% IF row.neighbor %]
|
[% IF row.neighbor %]
|
||||||
<a href="[% uri_for('/device',
|
<a href="[% uri_for('/device',
|
||||||
vars.self_options) %]&q=[% row.neighbor.ip | uri %]&f=[% row.remote_port | uri %]">
|
vars.self_options) %]&q=[% row.neighbor.ip | uri %]&f=[% row.remote_port | uri %]">
|
||||||
@@ -149,6 +150,7 @@
|
|||||||
id: [% (row.remote_type _ ' / ') IF row.remote_type %][% row.remote_id %])</a>
|
id: [% (row.remote_type _ ' / ') IF row.remote_type %][% row.remote_id %])</a>
|
||||||
[% END %]
|
[% END %]
|
||||||
[% END %]
|
[% END %]
|
||||||
|
[% IF params.c_nodes %]
|
||||||
[% FOREACH node IN row.$nodes %]
|
[% FOREACH node IN row.$nodes %]
|
||||||
[% '<br/>' IF row.remote_ip OR NOT loop.first %]
|
[% '<br/>' IF row.remote_ip OR NOT loop.first %]
|
||||||
[% '<span class="label label-warning">A</span> ' IF NOT node.active %]
|
[% '<span class="label label-warning">A</span> ' IF NOT node.active %]
|
||||||
@@ -166,6 +168,7 @@
|
|||||||
[% END %]
|
[% END %]
|
||||||
[% END %]
|
[% END %]
|
||||||
[% END %]
|
[% END %]
|
||||||
|
[% END %]
|
||||||
</td>
|
</td>
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user