virtualchassis_edit.html 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. {% extends 'generic/object_edit.html' %}
  2. {% load helpers %}
  3. {% load form_helpers %}
  4. {% load i18n %}
  5. {% block title %}
  6. {% blocktrans trimmed with name=vc_form.instance %}
  7. Editing Virtual Chassis {{ name }}
  8. {% endblocktrans %}
  9. {% endblock %}
  10. {% block content %}
  11. <div class="tab-pane show active" id="edit-form" role="tabpanel" aria-labelledby="object-list-tab">
  12. <form action="" method="post" enctype="multipart/form-data" class="object-edit">
  13. {% render_errors vc_form %}
  14. {% for form in formset %}
  15. {% render_errors form %}
  16. {% endfor %}
  17. {% csrf_token %}
  18. {% for field in vc_form.hidden_fields %}
  19. {{ field }}
  20. {% endfor %}
  21. {{ pk_form.pk }}
  22. {{ formset.management_form }}
  23. <div class="field-group my-5">
  24. <div class="row">
  25. <h2 class="col-9 offset-3">{% trans "Virtual Chassis" %}</h2>
  26. </div>
  27. {% render_field vc_form.name %}
  28. {% render_field vc_form.domain %}
  29. {% render_field vc_form.description %}
  30. {% render_field vc_form.master %}
  31. {% render_field vc_form.tags %}
  32. </div>
  33. <div class="field-group my-5">
  34. {% render_field vc_form.comments %}
  35. </div>
  36. {% if vc_form.custom_fields %}
  37. <div class="field-group mb-5">
  38. <div class="row">
  39. <h2 class="col-9 offset-3">{% trans "Custom Fields" %}</h2>
  40. </div>
  41. {% render_custom_fields vc_form %}
  42. </div>
  43. {% endif %}
  44. <div class="field-group mb-5">
  45. <h2 class="text-center">{% trans "Members" %}</h2>
  46. <table class="table">
  47. <thead>
  48. <tr>
  49. <th>{% trans "Device" %}</th>
  50. <th>{% trans "ID" %}</th>
  51. <th>{% trans "Rack/Unit" %}</th>
  52. <th>{% trans "Serial" %}</th>
  53. <th>{% trans "Position" %}</th>
  54. <th>{% trans "Priority" %}</th>
  55. <th></th>
  56. </tr>
  57. </thead>
  58. <tbody>
  59. {% for form in formset %}
  60. {% for field in form.hidden_fields %}
  61. {{ field }}
  62. {% endfor %}
  63. {% with device=form.instance virtual_chassis=vc_form.instance %}
  64. <tr>
  65. <td>{{ device|linkify }}</td>
  66. <td>{{ device.pk }}</td>
  67. <td>
  68. {% if device.rack %}
  69. {{ device.rack }} / {{ device.position|floatformat }}
  70. {% else %}
  71. {{ ''|placeholder }}
  72. {% endif %}
  73. </td>
  74. <td>{{ device.serial|placeholder }}</td>
  75. <td>
  76. {{ form.vc_position }}
  77. {% if form.vc_position.errors %}
  78. <small class="text-danger">{{ form.vc_position.errors.0 }}</small>
  79. {% endif %}
  80. </td>
  81. <td>
  82. {{ form.vc_priority }}
  83. {% if form.vc_priority.errors %}
  84. <small class="text-danger">{{ form.vc_priority.errors.0 }}</small>
  85. {% endif %}
  86. </td>
  87. <td>
  88. {% if virtual_chassis.pk %}
  89. <a href="{% url 'dcim:virtualchassis_remove_member' pk=device.pk %}?return_url={% url 'dcim:virtualchassis_edit' pk=virtual_chassis.pk %}" class="btn btn-danger{% if virtual_chassis.master == device %} disabled{% endif %}">
  90. <span class="mdi mdi-trash-can-outline" aria-hidden="true"></span>
  91. </a>
  92. {% endif %}
  93. </td>
  94. </tr>
  95. {% endwith %}
  96. {% endfor %}
  97. </tbody>
  98. </table>
  99. <div class="bg-primary-subtle border border-primary rounded-1 pt-3 px-3 mb-3">
  100. {% render_field vc_form.changelog_message %}
  101. </div>
  102. </div>
  103. <div class="text-end">
  104. <a href="{{ return_url }}" class="btn btn-outline-secondary">{% trans "Cancel" %}</a>
  105. {% if vc_form.instance.pk %}
  106. <button type="submit" name="_update" class="btn btn-primary">{% trans "Save" %}</button>
  107. {% else %}
  108. <button type="submit" name="_create" class="btn btn-primary">{% trans "Create" %}</button>
  109. {% endif %}
  110. </div>
  111. </form>
  112. </div>
  113. {% endblock content %}