Files
netdisco/Netdisco/views/ajax/device/ports.tt
2012-08-28 00:37:45 +01:00

130 lines
4.9 KiB
Plaintext

<table class="table-bordered table-condensed table-striped">
<thead>
<tr>
<th></th>
[% FOREACH item IN vars.port_columns %]
[% NEXT UNLESS params.${item.name} %]
<th[% ' class="center_cell"' IF NOT loop.first %]>[% item.label %]</th>
[% END %]
</tr>
</thead>
</tbody>
[% FOREACH row IN results %]
<tr>
<td>
[% IF row.up_admin == 'down' %]
<span class="label">S</span>
[% ELSIF row.stp == 'blocking' %]
<span class="label label-info">B</span>
[% ELSIF params.free OR row.is_free %]
<span class="label label-success">F</span>
[% ELSIF row.up_admin == 'up' AND row.up == 'down' %]
<span class="label label-warning">D</span>
[% END %]
</td>
[% IF params.c_port %]
<td><a class="nd_linkcell" href="[% uri_for('/device',
vars.self_options) %]&q=[% params.q | uri %]&f=[% row.port | uri %]">
[% row.port | html_entity %]
</a></td>
[% END %]
[% IF params.c_descr %]
<td class="center_cell">[% row.descr | html_entity %]</td>
[% END %]
[% IF params.c_type %]
<td class="center_cell">[% row.type | html_entity %]</td>
[% END %]
[% IF params.c_duplex %]
<td class="center_cell">
[% IF row.up == 'up' AND row.duplex %]
[% row.duplex_admin | html_entity %] / [% row.duplex | html_entity %]
[% END %]
</td>
[% END %]
[% IF params.c_lastchange %]
<td class="center_cell">[% row.lastchange_stamp | html_entity %]</td>
[% END %]
[% IF params.c_name %]
<td class="center_cell">[% row.name | html_entity %]</td>
[% END %]
[% IF params.c_speed %]
<td class="center_cell">[% row.speed | html_entity %]</td>
[% END %]
[% IF params.c_mac %]
<td class="center_cell">[% row.mac | html_entity %]</td>
[% END %]
[% IF params.c_mtu %]
<td class="center_cell">[% row.mtu | html_entity %]</td>
[% END %]
[% IF params.c_vlan %]
<td class="center_cell">
<a class="nd_linkcell"
href="[% uri_for('/search') %]?tab=vlan&q=[% row.vlan | uri %]">[% row.vlan | html_entity %]</a>
</td>
[% END %]
[% IF params.c_vmember %]
<td>
[% IF row.tagged_vlans_count %]
[% SET output = '' %]
[% FOREACH vlan IN row.tagged_vlans %]
[% SET output = output _
'<a href="' _ uri_for('/search') _ '?tab=vlan&q=' _ vlan.vlan _ '">' _ vlan.vlan _ '</a>' %]
[% SET output = output _ ', ' IF NOT loop.last %]
[% END %]
[% IF row.tagged_vlans_count > 10 %] [%# FIXME make this a settable variable %]
[% SET output = '<div class="vlan_total">(' _ row.tagged_vlans_count
_ ')</div><a href="#" class="nd_linkcell nd_collapse_vlans"><div class="cell-arrow-up"></div>'
_ 'Show VLANs</a><div class="nd_collapsing nd_collapse_pre_hidden">' _ output %]
[% SET output = output _ '</div>' %]
[% END %]
[% output %]
[% END %]
</td>
[% END %]
[% IF params.c_connected %]
<td>
[% IF row.remote_ip %]
[% IF row.neighbor %]
<a href="[% uri_for('/device',
vars.self_options) %]&q=[% row.neighbor.ip | uri %]&f=[% row.remote_port | uri %]">
[% row.neighbor.dns.remove(settings.domain_suffix) || row.neighbor.ip %]
([% row.remote_port | html_entity %])</a>
[% ELSE %]
<span class="label label-important">N</span>
<a href="[% vars.search_node %]&q=[% row.remote_ip | uri %]">
[% row.remote_ip %] (port: [% row.remote_port %]
id: [% (row.remote_type _ ' / ') IF row.remote_type %][% row.remote_id %])</a>
[% END %]
[% END %]
[% FOREACH node IN row.$nodes %]
[% '<br/>' IF row.remote_ip OR NOT loop.first %]
[% '<span class="label label-warning">A</span> &nbsp;' IF NOT node.active %]
<a href="[% vars.search_node %]&q=[% node.mac | uri %]">[% node.mac %]</a>
[% ' (' _ node.time_last_age _ ')' IF params.n_age %]
[% IF params.n_ip %]
[% FOREACH ip IN node.ips %]
<br/>&nbsp; [% '<span class="label label-warning">A</span> &nbsp;' IF NOT ip.active %]
[% SET dns = ip.dns %]
[% IF dns %]
<a href="[% vars.search_node %]&q=[% ip.ip | uri %]">[% dns %] ([% ip.ip %])</a>
[% ELSE %]
<a href="[% vars.search_node %]&q=[% ip.ip | uri %]">[% ip.ip %]</a>
[% END %]
[% END %]
[% END %]
[% END %]
</td>
[% END %]
[% IF params.c_stp %]
<td class="center_cell">[% row.stp | html_entity %]</td>
[% END %]
[% IF params.c_up %]
<td class="center_cell">
[% row.up_admin | html_entity %] / [% row.up | html_entity %]
</td>
[% END %]
</tr>
[% END %]
</tbody>
</table>