[% PROCESS 'externallinks.tt' -%]
[% SET user_can_port_control = user_has_role('port_control', d) %]
<table class="table table-condensed table-striped">
<tbody>
<tr>
<td>System Name</td>
<td>[% d.name | html_entity %]</td>
</tr>
<tr>
<td>Canonical IP</td>
<td>[% d.ip | html_entity %]</td>
</tr>
<tr>
<td>Location
[% IF user_can_port_control %]
<i class="icon-edit nd_edit-icon nd_device-details-edit"></i>
[% END %]
</td>
[% IF user_can_port_control %]
<td class="nd_editable-cell" contenteditable="true"
data-field="location" data-for-device="[% d.ip | html_entity %]">
[% d.location | html_entity %]
</td>
[% ELSE %]
<td>
<a rel="tooltip" data-placement="top" data-offset="5" data-title="Find Similar Devices"
href="[% search_device | none %]&q=[% d.location | uri %]&location=[% d.location | uri %]">[% d.location | html_entity %]</a>
</td>
[% END %]
</tr>
<tr>
<td>Contact
[% IF user_can_port_control %]
<i class="icon-edit nd_edit-icon nd_device-details-edit"></i>
[% END %]
</td>
[% IF user_can_port_control %]
<td class="nd_editable-cell" contenteditable="true"
data-field="contact" data-for-device="[% d.ip | html_entity %]">
[% d.contact | html_entity %]
</td>
[% ELSE %]
<td>[% d.contact | html_entity %]</td>
[% END %]
</tr>
<tr>
<td>Vendor / Model</td>
<td>
<a rel="tooltip" data-placement="top" data-offset="5" data-title="Find Similar Devices"
href="[% search_device | none %]&q=[% d.vendor | uri %]&vendor=[% d.vendor | uri %]">[% d.vendor | html_entity %]</a>
/
<a rel="tooltip" data-placement="top" data-offset="5" data-title="Find Similar Devices"
href="[% search_device | none %]&q=[% d.model | uri %]&model=[% d.model | uri %]">[% d.model | html_entity %]</a>
</td>
</tr>
<tr>
<td>OS / Version</td>
<td>
<a rel="tooltip" data-placement="top" data-offset="5" data-title="Find Similar Devices"
href="[% search_device | none %]&q=[% d.os | uri %]&os=[% d.os | uri %]">[% d.os | html_entity %]</a>
/
<a rel="tooltip" data-placement="top" data-offset="5" data-title="Find Similar Devices"
href="[% search_device | none %]&q=[% d.os_ver | uri %]&os_ver=[% d.os_ver | uri %]">[% d.os_ver | html_entity %]</a>
</td>
</tr>
<tr>
<td>Serial Number(s)</td>
<td>
[% FOREACH s IN serials %]
<a href="[% uri_for('/report/moduleinventory') | none %]?class=chassis&matchall=on&serial=[% s | uri %]">[% s | html_entity %]</a>
[% ' (primary)' IF s == d.serial AND serials.size > 1 %]<br />
[% END %]
</td>
</tr>
<tr>
<td>Chassis ID</td>
<td>[% d.chassis_id | html_entity %]</td>
</tr>
<tr>
<td>Description</td>
<td>[% d.description | html_entity | html_line_break %]</td>
</tr>
<tr>
<td>Tags</td>
<td>
[% FOREACH t IN filtered_tags %]
<span class="badge badge-success">[% t | html_entity %]</span>
[% END %]
</td>
</tr>
[% IF settings._extra_device_details.size %]
[% FOREACH config IN settings._extra_device_details %]
[% NEXT UNLESS permitted_by_acl(d, config) %]
<tr>
<td>
[% config.label | html_entity %]
[% IF config.editable AND user_can_port_control %]
<i class="icon-edit nd_edit-icon nd_device-details-edit"></i>
[% END %]
</td>
[% TRY %]
<td>
[% INCLUDE "plugin/${config.name}/device_details.tt" %]
</td>
[% CATCH %]
[% CLEAR %]
[% IF config.editable AND user_can_port_control %]
<td class="nd_editable-cell" contenteditable="true"
data-field="[% config.field | html_entity %]" data-for-device="[% d.ip | html_entity %]">
[% ELSE %]
<td>
[% END %]
[% FOREACH record IN d.${config.field} %]
[% record | html_entity %]
[% '<br />' IF loop.size > 1 %]
[% END %]
</td>
[% END %]
</tr>
[% END %]
[% END %]
<tr>
<td>External Links</td>
<td>
<a href="ssh://[% d.ip | uri %]" target="_blank">
<span class="label label-info"><i class="icon-keyboard"></i> SSH</span></a>
<a href="telnet://[% d.ip | uri %]" target="_blank">
<span class="label label-info"><i class="icon-keyboard"></i> Telnet</span></a>
<a href="https://[% d.ip | uri %]/" target="_blank">
<span class="label label-info"><i class="icon-external-link"></i> Web</span></a>
[% INCLUDE external_device_links item = d %]
</td>
</tr>
<tr>
<td>SNMP Class</td>
</tr>
<tr>
<td>Uptime</td>
<td>[% d.uptime_age | html_entity %][% ' at last poll' IF d.uptime_age %]</td>
</tr>
<tr>
<td>Layers</td>
<td>
[% (d.layers.substr(7,1) ? '<span class="badge badge-success">1</span>' : '<span class="badge"> </span>') | none %]
[% (d.layers.substr(6,1) ? '<span class="badge badge-success">2</span>' : '<span class="badge"> </span>') | none %]
[% (d.layers.substr(5,1) ? '<span class="badge badge-success">3</span>' : '<span class="badge"> </span>') | none %]
[% (d.layers.substr(4,1) ? '<span class="badge badge-success">4</span>' : '<span class="badge"> </span>') | none %]
[% (d.layers.substr(3,1) ? '<span class="badge badge-success">5</span>' : '<span class="badge"> </span>') | none %]
[% (d.layers.substr(2,1) ? '<span class="badge badge-success">6</span>' : '<span class="badge"> </span>') | none %]
[% (d.layers.substr(1,1) ? '<span class="badge badge-success">7</span>' : '<span class="badge"> </span>') | none %]
</td>
</tr>
<tr>
<td>First Discovered</td>
<td>[% d.first_seen_stamp | html_entity %]</td>
</tr>
<tr>
<td>Latest Discover</td>
<td>[% d.last_discover_stamp | html_entity %]</td>
</tr>
<tr>
<td>Latest Arpnip</td>
<td>[% d.last_arpnip_stamp | html_entity %]</td>
</tr>
<tr>
<td>Latest Macsuck</td>
<td>[% d.last_macsuck_stamp | html_entity %]</td>
</tr>
<tr>
<td>NAC / 802.1X</td>
<td>[% IF d.pae_is_enabled %] <i class="icon-ok-sign text-success"></i> Enabled [% END %]</td>
</tr>
<tr>
<td>Hardware Status</td>
<td>Fan: [% d.fan | html_entity %]
<br/>PS1 [[% d.ps1_type | html_entity %]]: [% d.ps1_status | html_entity %]
<br/>PS2 [[% d.ps2_type | html_entity %]]: [% d.ps2_status | html_entity %]</td>
</tr>
[% IF p.size %]
<tr>
<td>PoE Status</td>
<td>
[% FOREACH m IN p %]
[% UNLESS m.module == 1 %]
<br/>
[% END %]
Module [% m.module | html_entity %]: [% m.status | html_entity %], [% m.poe_capable_ports | html_entity %] power-capable ports, [% m.poe_powered_ports | html_entity %] powered ([% m.poe_disabled_ports | html_entity %] admin disabled, [% m.poe_errored_ports | html_entity %] errors), [% m.poe_power_committed | html_entity %]/[% m.power | html_entity %] watts committed.
[% END %]
</td>
</tr>
[% END %]
<tr>
<td>MAC Address</td>
<td>[% d.mac | html_entity %]</td>
</tr>
<tr>
<td>VTP Status</td>
<td>Mode: [% d.vtp_mode.ucfirst || 'n/a' | html_entity %]<br />Domain: [% d.vtp_domain || 'n/a' | html_entity %]</td>
</tr>
[% IF user_has_role('admin') %]
<tr data-for-device="[% d.ip | html_entity %]">
<td>Admin Tasks</td>
<td>
<input type="hidden" data-form="discover" value="[% d.ip | html_entity %]" name="device"/>
<button class="btn btn-info btn-small nd_adminbutton" name="discover">Discover</button>
[% IF d.layers.substr(5,1) %]
<input type="hidden" data-form="arpnip" value="[% d.ip | html_entity %]" name="device"/>
<button class="btn btn-info btn-small nd_adminbutton" name="arpnip">Arpnip</button>
[% ELSE %]
<button class="btn btn-default btn-small disabled">Arpnip</button>
[% END %]
[% IF d.layers.substr(6,1) %]
<input type="hidden" data-form="macsuck" value="[% d.ip | html_entity %]" name="device"/>
<button class="btn btn-info btn-small nd_adminbutton" name="macsuck">Macsuck</button>
[% ELSE %]
<button class="btn btn-default btn-small disabled">Macsuck</button>
[% END %]
<input type="hidden" data-form="nbtstat" value="[% d.ip | html_entity %]" name="device"/>
<button class="btn btn-info btn-small nd_adminbutton" name="nbtstat">NBTstat</button>
<span class="dropdown">
<button class="nd_snap_btn btn [% has_snapshot ? 'btn-success' : 'btn-info' %] btn-small dropdown-toggle" type="button" id="snapshotmenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
Snapshot
<span class="caret"></span>
</button>
<ul class="dropdown-menu" aria-labelledby="snapshotmenu">
[% IF NOT d.is_pseudo %]
<input type="hidden" data-form="snapshot_req" value="[% d.ip | html_entity %]" name="device"/>
<li><a href="#" class="nd_adminbutton" name="snapshot_req"><i class="icon-edit"></i> Create</a></li>
[% END %]
<li class='nd_snap_func [% 'disabled' UNLESS has_snapshot %]'><a href="[% uri_for('/ajax/content/admin/snapshot_get') | none %]?device=[% d.ip | uri %]"><i class="icon-download-alt"></i> Download</a></li>
[% IF NOT d.is_pseudo %]
<input type="hidden" data-form="snapshot_del" value="[% d.ip | html_entity %]" name="device"/>
<li class='nd_snap_func [% 'disabled' UNLESS has_snapshot %]'><a href="#" class="nd_adminbutton" name="snapshot_del"><i class="icon-trash"></i> Delete</a></li>
[% END %]
</ul>
</span>
<button class="btn btn-danger btn-small pull-right"
data-toggle="modal" data-target="#nd_devdel" type="button">Delete</button>
<button class="btn btn-danger btn-small pull-right nd_pull-right-admin-button"
data-toggle="modal" data-target="#nd_devrenumber" type="button">Change IP</button>
<div id="nd_devdel" class="nd_modal nd_deep-horizon modal hide fade" tabindex="-1"
role="dialog" aria-labelledby="nd_devdel-label" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 id="nd_devdel-label">Confirm Delete: [% d.dns || d.ip | html_entity %]</h3>
</div>
<div class="modal-body">
<blockquote>
<ul>
<li><p>A job will be queued to delete the device</p></li>
<li><p>All associated Nodes may be removed from the database</p></li>
</ul>
</blockquote>
<textarea id="nd_devdel-log" class="input-block-level" rows="2" data-form="delete"
placeholder="Enter a log message" name="extra"></textarea>
<label class="checkbox">
<input id="nd_devdel-archive" type="checkbox" data-form="delete" name="port">
<h4 class="nd_unbolden">Archive Nodes</h4>
</label>
<input type="hidden" data-form="delete" value="[% d.ip | html_entity %]" name="device"/>
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button class="btn btn-danger nd_adminbutton" name="delete" data-dismiss="modal">Confirm</button>
</div>
</div>
<div id="nd_devrenumber" class="nd_modal nd_deep-horizon modal hide fade" tabindex="-1"
role="dialog" aria-labelledby="nd_devrenumber-label" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 id="nd_devrenumber-label">Confirm Renumber: [% d.dns || d.ip | html_entity %]</h3>
</div>
<div class="modal-body">
<blockquote>
<ul>
<li><p>This will change the primary IP of a device to support migrations.</p></li>
<li><p>You can to change to an existing interface IP or a new IP</p></li>
<li><p>No check is made as to whether the new IP is reachable</p></li>
<li><p>The change is queued as a backend job</p></li>
</ul>
</blockquote>
<label>Enter new IP address: <input list="interfaces" name="newip" data-form="renumber"/></label>
<datalist id="interfaces">
[% FOREACH i IN interfaces %]
<option value="[% i.alias | html_entity %]">[% i.dns | html_entity %]</option>
[% END %]
</datalist>
<input type="hidden" data-form="renumber" value="[% d.ip | html_entity %]" name="device"/>
</div>
<div class="modal-footer">
<button class="btn btn-success" data-dismiss="modal" aria-hidden="true">Cancel</button>
<button class="btn btn-danger nd_adminbutton" name="renumber" data-dismiss="modal">Confirm</button>
</div>
</div>
</td>
</tr>
[% END %]
</tbody>
</table>