Files
netdisco/Netdisco/views/ajax/device/ports.tt
2012-01-15 19:07:12 +00:00

128 lines
4.7 KiB
Plaintext

<table class="bordered-table condensed-table zebra-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 notice">b</span>
[% ELSIF row.is_free(params.age_num, params.age_unit) %]
<span class="label success">f</span>
[% ELSIF row.up_admin == 'up' AND row.up == 'down' %]
<span class="label warning">d</span>
[% END %]
</td>
[% IF params.c_port %]
<td>
[% row.port | html_entity %]
</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.get_column('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="/search?tab=vlan&q=[% row.vlan | uri %]">[% row.vlan | html_entity %]</a>
</td>
[% END %]
[% IF params.c_vmember %]
<td>
[%# this is really ugly because for some reason
I could not get size/max to work on row.tagged_vlans.all %]
[% SET output = '' %]
[% SET count = 0 %]
[% FOREACH vlan IN row.tagged_vlans %]
[% SET output = output _
'<a href="/search?tab=vlan&q=' _ vlan.vlan _ '">' _ vlan.vlan _ '</a>' %]
[% SET output = output _ ', ' IF NOT loop.last %]
[% SET count = count + 1 %]
[% END %]
[% IF count > 10 %]
[% SET output = '<div class="vlan_total">(' _ count _ ')</div><a href="#" class="nd_linkcell nd_collapse_vlans">'
_ 'Show VLANs</a><div class="nd_collapse_pre_hidden">' _ output %]
[% SET output = output _ '</div>' %]
[% END %]
[% output %]
</td>
[% END %]
[% IF params.c_connected %]
<td>
[% IF row.remote_ip %]
[% IF row.neighbor %]
<a href="/device?tab=ports&ip=[% row.neighbor.ip | uri %]&q=[% row.remote_port | uri %]">
[% row.neighbor.dns.remove(settings.domain_suffix) || row.neighbor.ip %]
([% row.remote_port | html_entity %])</a>
[% ELSE %]
<span class="label important">n</span>
<a href="/search?tab=node&q=[% row.remote_ip | uri %]">[% row.remote_ip %] ([% row.remote_port %])
<br/>&nbsp; ([% row.remote_type %]) / ([% row.remote_id %])</a>
[% END %]
[% END %]
[% FOREACH node IN row.get_nodes(params.n_archived) %]
[% '<br/>' IF row.remote_ip OR NOT loop.first %]
[% '<span class="label warning">a</span> &nbsp;' IF NOT node.active %]
<a href="/search?tab=node&q=[% node.mac | uri %]">[% node.mac %]</a>
[% ' (' _ 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 ip.active %]
[% SET dns = ip.dns %]
[% IF dns %]
<a href="/search?tab=node&q=[% ip.ip | uri %]">[% ip.dns %] ([% ip.ip %])</a>
[% ELSE %]
<a href="/search?tab=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>