template_code.py 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. CABLETERMINATION = """
  2. {% if value %}
  3. <a href="{{ value.parent.get_absolute_url }}">{{ value.parent }}</a>
  4. <i class="fa fa-caret-right"></i>
  5. <a href="{{ value.get_absolute_url }}">{{ value }}</a>
  6. {% else %}
  7. &mdash;
  8. {% endif %}
  9. """
  10. CABLE_LENGTH = """
  11. {% if record.length %}{{ record.length }} {{ record.get_length_unit_display }}{% else %}&mdash;{% endif %}
  12. """
  13. CABLE_TERMINATION_PARENT = """
  14. {% if value.device %}
  15. <a href="{{ value.device.get_absolute_url }}">{{ value.device }}</a>
  16. {% elif value.circuit %}
  17. <a href="{{ value.circuit.get_absolute_url }}">{{ value.circuit }}</a>
  18. {% elif value.power_panel %}
  19. <a href="{{ value.power_panel.get_absolute_url }}">{{ value.power_panel }}</a>
  20. {% endif %}
  21. """
  22. DEVICE_LINK = """
  23. <a href="{% url 'dcim:device' pk=record.pk %}">
  24. {{ record.name|default:'<span class="label label-info">Unnamed device</span>' }}
  25. </a>
  26. """
  27. INTERFACE_IPADDRESSES = """
  28. {% for ip in record.ip_addresses.unrestricted %}
  29. <a href="{{ ip.get_absolute_url }}">{{ ip }}</a><br />
  30. {% endfor %}
  31. """
  32. INTERFACE_TAGGED_VLANS = """
  33. {% for vlan in record.tagged_vlans.unrestricted %}
  34. <a href="{{ vlan.get_absolute_url }}">{{ vlan }}</a><br />
  35. {% endfor %}
  36. """
  37. MPTT_LINK = """
  38. {% if record.get_children %}
  39. <span style="padding-left: {{ record.get_ancestors|length }}0px "><i class="fa fa-caret-right"></i>
  40. {% else %}
  41. <span style="padding-left: {{ record.get_ancestors|length }}9px">
  42. {% endif %}
  43. <a href="{{ record.get_absolute_url }}">{{ record.name }}</a>
  44. </span>
  45. """
  46. POWERFEED_CABLE = """
  47. <a href="{{ value.get_absolute_url }}">{{ value }}</a>
  48. <a href="{% url 'dcim:powerfeed_trace' pk=record.pk %}" class="btn btn-primary btn-xs" title="Trace">
  49. <i class="fa fa-share-alt" aria-hidden="true"></i>
  50. </a>
  51. """
  52. POWERFEED_CABLETERMINATION = """
  53. <a href="{{ value.parent.get_absolute_url }}">{{ value.parent }}</a>
  54. <i class="fa fa-caret-right"></i>
  55. <a href="{{ value.get_absolute_url }}">{{ value }}</a>
  56. """
  57. RACKGROUP_ELEVATIONS = """
  58. <a href="{% url 'dcim:rack_elevation_list' %}?site={{ record.site.slug }}&group_id={{ record.pk }}" class="btn btn-xs btn-primary" title="View elevations">
  59. <i class="fa fa-eye"></i>
  60. </a>
  61. """
  62. UTILIZATION_GRAPH = """
  63. {% load helpers %}
  64. {% utilization_graph value %}
  65. """
  66. #
  67. # Device component buttons
  68. #
  69. CONSOLEPORT_BUTTONS = """
  70. {% if record.cable %}
  71. {% include 'dcim/inc/cable_toggle_buttons.html' with cable=record.cable %}
  72. {% elif perms.dcim.add_cable %}
  73. <span class="dropdown">
  74. <button type="button" class="btn btn-success btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
  75. <span class="glyphicon glyphicon-resize-small" aria-hidden="true"></span>
  76. </button>
  77. <ul class="dropdown-menu dropdown-menu-right">
  78. <li><a href="{% url 'dcim:consoleport_connect' termination_a_id=record.pk termination_b_type='console-server-port' %}?return_url={{ device.get_absolute_url }}">Console Server Port</a></li>
  79. <li><a href="{% url 'dcim:consoleport_connect' termination_a_id=record.pk termination_b_type='front-port' %}?return_url={{ device.get_absolute_url }}">Front Port</a></li>
  80. <li><a href="{% url 'dcim:consoleport_connect' termination_a_id=record.pk termination_b_type='rear-port' %}?return_url={{ device.get_absolute_url }}">Rear Port</a></li>
  81. </ul>
  82. </span>
  83. {% endif %}
  84. """