CABLETERMINATION = """
{% if value %}
{{ value.parent }}
{{ value }}
{% else %}
—
{% endif %}
"""
CABLE_LENGTH = """
{% if record.length %}{{ record.length }} {{ record.get_length_unit_display }}{% else %}—{% endif %}
"""
CABLE_TERMINATION_PARENT = """
{% if value.device %}
{{ value.device }}
{% elif value.circuit %}
{{ value.circuit }}
{% elif value.power_panel %}
{{ value.power_panel }}
{% endif %}
"""
DEVICE_LINK = """
{{ record.name|default:'Unnamed device' }}
"""
DEVICEBAY_STATUS = """
{% if record.installed_device_id %}
{{ record.installed_device.get_status_display }}
{% else %}
Vacant
{% endif %}
"""
INTERFACE_IPADDRESSES = """
{% for ip in record.ip_addresses.all %}
{{ ip }}
{% endfor %}
"""
INTERFACE_TAGGED_VLANS = """
{% if record.mode == 'tagged' %}
{% for vlan in record.tagged_vlans.all %}
{{ vlan }}
{% endfor %}
{% elif record.mode == 'tagged-all' %}
All
{% else %}
—
{% endif %}
"""
MPTT_LINK = """
{% for i in record.get_ancestors %}
{% endfor %}
{{ record.name }}
"""
POWERFEED_CABLE = """
{{ value }}
"""
POWERFEED_CABLETERMINATION = """
{{ value.parent }}
{{ value }}
"""
RACKGROUP_ELEVATIONS = """
"""
UTILIZATION_GRAPH = """
{% load helpers %}
{% utilization_graph value %}
"""
#
# Device component buttons
#
CONSOLEPORT_BUTTONS = """
{% if record.cable %}
{% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %}
{% if perms.dcim.delete_cable %}
{% endif %}
{% elif perms.dcim.add_cable %}
{% endif %}
"""
CONSOLESERVERPORT_BUTTONS = """
{% if record.cable %}
{% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %}
{% if perms.dcim.delete_cable %}
{% endif %}
{% elif perms.dcim.add_cable %}
{% endif %}
"""
POWERPORT_BUTTONS = """
{% if record.cable %}
{% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %}
{% if perms.dcim.delete_cable %}
{% endif %}
{% elif perms.dcim.add_cable %}
{% endif %}
"""
POWEROUTLET_BUTTONS = """
{% if record.cable %}
{% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %}
{% if perms.dcim.delete_cable %}
{% endif %}
{% elif perms.dcim.add_cable %}
{% endif %}
"""
INTERFACE_BUTTONS = """
{% if perms.ipam.add_ipaddress %}
{% endif %}
{% if record.cable %}
{% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %}
{% if perms.dcim.delete_cable %}
{% endif %}
{% elif record.is_connectable and perms.dcim.add_cable %}
{% endif %}
"""
FRONTPORT_BUTTONS = """
{% if record.cable %}
{% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %}
{% if perms.dcim.delete_cable %}
{% endif %}
{% elif perms.dcim.add_cable %}
{% endif %}
"""
REARPORT_BUTTONS = """
{% if record.cable %}
{% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %}
{% if perms.dcim.delete_cable %}
{% endif %}
{% elif perms.dcim.add_cable %}
{% endif %}
"""
DEVICEBAY_BUTTONS = """
{% if perms.dcim.change_devicebay %}
{% if record.installed_device %}
{% else %}
{% endif %}
{% endif %}
"""