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

99 lines
3.3 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>[% row.connected | html_entity %]</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>