Преглед изворни кода

#10038 & #10039: Changelog & replicate for VM interfaces

jeremystretch пре 3 година
родитељ
комит
32615befd5

+ 3 - 1
docs/release-notes/version-3.3.md

@@ -8,7 +8,9 @@
 * [#9935](https://github.com/netbox-community/netbox/issues/9935) - Add 802.11ay and "other" wireless interface types
 * [#9935](https://github.com/netbox-community/netbox/issues/9935) - Add 802.11ay and "other" wireless interface types
 * [#10031](https://github.com/netbox-community/netbox/issues/10031) - Enforce `application/json` content type for REST API requests
 * [#10031](https://github.com/netbox-community/netbox/issues/10031) - Enforce `application/json` content type for REST API requests
 * [#10033](https://github.com/netbox-community/netbox/issues/10033) - Disable "add termination" button for point-to-point L2VPNs with two terminations
 * [#10033](https://github.com/netbox-community/netbox/issues/10033) - Disable "add termination" button for point-to-point L2VPNs with two terminations
-* [#10037](https://github.com/netbox-community/netbox/issues/10037) - Add link to create child interface to interface context menu
+* [#10037](https://github.com/netbox-community/netbox/issues/10037) - Add "child interface" option to actions dropdown in interfaces list
+* [#10038](https://github.com/netbox-community/netbox/issues/10038) - Add "L2VPN termination" option to actions dropdown in interfaces list
+* [#10039](https://github.com/netbox-community/netbox/issues/10039) - Add "assign FHRP group" option to actions dropdown in interfaces list
 * [#10061](https://github.com/netbox-community/netbox/issues/10061) - Replicate type when cloning L2VPN instances
 * [#10061](https://github.com/netbox-community/netbox/issues/10061) - Replicate type when cloning L2VPN instances
 * [#10066](https://github.com/netbox-community/netbox/issues/10066) - Use fixed column widths for custom field values in UI
 * [#10066](https://github.com/netbox-community/netbox/issues/10066) - Use fixed column widths for custom field values in UI
 * [#10133](https://github.com/netbox-community/netbox/issues/10133) - Enable nullifying device location during bulk edit
 * [#10133](https://github.com/netbox-community/netbox/issues/10133) - Enable nullifying device location during bulk edit

+ 1 - 1
netbox/dcim/tables/template_code.py

@@ -226,7 +226,7 @@ POWEROUTLET_BUTTONS = """
 """
 """
 
 
 INTERFACE_BUTTONS = """
 INTERFACE_BUTTONS = """
-{% if perms.ipam.add_ipaddress or perms.dcim.add_inventoryitem %}
+{% if perms.dcim.edit_interface %}
   <span class="dropdown">
   <span class="dropdown">
     <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Add">
     <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Add">
       <span class="mdi mdi-plus-thick" aria-hidden="true"></span>
       <span class="mdi mdi-plus-thick" aria-hidden="true"></span>

+ 17 - 4
netbox/virtualization/tables/virtualmachines.py

@@ -12,10 +12,23 @@ __all__ = (
 )
 )
 
 
 VMINTERFACE_BUTTONS = """
 VMINTERFACE_BUTTONS = """
-{% if perms.ipam.add_ipaddress %}
-    <a href="{% url 'ipam:ipaddress_add' %}?vminterface={{ record.pk }}&return_url={% url 'virtualization:virtualmachine_interfaces' pk=object.pk %}" class="btn btn-sm btn-success" title="Add IP Address">
-        <i class="mdi mdi-plus-thick" aria-hidden="true"></i>
-    </a>
+{% if perms.virtualization.edit_vminterface %}
+  <span class="dropdown">
+    <button type="button" class="btn btn-primary btn-sm dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="Add">
+      <span class="mdi mdi-plus-thick" aria-hidden="true"></span>
+    </button>
+    <ul class="dropdown-menu dropdown-menu-end">
+      {% if perms.ipam.add_ipaddress %}
+        <li><a class="dropdown-item" href="{% url 'ipam:ipaddress_add' %}?vminterface={{ record.pk }}&return_url={% url 'virtualization:virtualmachine_interfaces' pk=object.pk %}">IP Address</a></li>
+      {% endif %}
+      {% if perms.ipam.add_l2vpntermination %}
+        <li><a class="dropdown-item" href="{% url 'ipam:l2vpntermination_add' %}?virtual_machine={{ object.pk }}&vminterface={{ record.pk }}&return_url={% url 'virtualization:virtualmachine_interfaces' pk=object.pk %}">L2VPN Termination</a></li>
+      {% endif %}
+      {% if perms.ipam.add_fhrpgroupassignment %}
+        <li><a class="dropdown-item" href="{% url 'ipam:fhrpgroupassignment_add' %}?interface_type={{ record|content_type_id }}&interface_id={{ record.pk }}&return_url={% url 'virtualization:virtualmachine_interfaces' pk=object.pk %}">Assign FHRP Group</a></li>
+      {% endif %}
+    </ul>
+  </span>
 {% endif %}
 {% endif %}
 """
 """