Closes #19735: Implement reuable bulk operations classes (#19774)

* Initial work on #19735

* Work in progress

* Remove ClusterRemoveDevicesView (anti-pattern)

* Misc cleanup

* Fix has_bulk_actions

* Fix has_bulk_actions for ObjectChildrenView

* Restore clone button

* Misc cleanup

* Clean up custom bulk actions

* Rename individual object actions

* Collapse into a single template tag

* Fix support for legacy action dicts

* Rename bulk attr to multi

* clone_button tag should fail silently if view name is invalid

* Clean up action buttons

* Fix export button label

* Replace clone_button with an ObjectAction

* Create object actions for adding device/VM components

* Move core_sync.html to core app

* Remove extra_bulk_buttons from template doc
This commit is contained in:
Jeremy Stretch
2025-06-30 13:03:07 -04:00
committed by GitHub
parent 71e6ea5785
commit 601a77ac73
56 changed files with 567 additions and 973 deletions

View File

@@ -1,6 +1,3 @@
{% if url %}
{% load i18n %}
<a href="{{ url }}" type="button" class="btn btn-primary">
<i class="mdi mdi-plus-thick"></i> {% trans "Add" %}
</a>
{% endif %}
<a href="{{ url }}" class="btn btn-primary" role="button">
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> {{ label }}
</a>

View File

@@ -1,6 +1,3 @@
{% load i18n %}
{% if url %}
<button type="submit" name="_delete" {% formaction %}="{{ url }}" class="btn btn-red">
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> {% trans "Delete Selected" %}
</button>
{% endif %}
<button type="submit" name="_delete" {% formaction %}="{{ url }}" class="btn btn-red">
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> {{ label }}
</button>

View File

@@ -1,6 +1,3 @@
{% load i18n %}
{% if url %}
<button type="submit" name="_edit" {% formaction %}="{{ url }}" class="btn btn-yellow">
<i class="mdi mdi-pencil" aria-hidden="true"></i> {% trans "Edit Selected" %}
</button>
{% endif %}
<button type="submit" name="_edit" {% formaction %}="{{ url }}" class="btn btn-yellow">
<i class="mdi mdi-pencil" aria-hidden="true"></i> {{ label }}
</button>

View File

@@ -0,0 +1,3 @@
<button type="submit" name="_rename" {% formaction %}="{{ url }}" class="btn btn-yellow">
<i class="mdi mdi-pencil" aria-hidden="true"></i> {{ label }}
</button>

View File

@@ -1,12 +1,12 @@
{% load i18n %}
<a href="#"
hx-get="{{ url }}"
hx-target="#htmx-modal-content"
hx-swap="innerHTML"
hx-select="form"
class="btn btn-red"
role="button"
data-bs-toggle="modal"
data-bs-target="#htmx-modal"
>
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> {% trans "Delete" %}
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> {{ label }}
</a>

View File

@@ -1,4 +1,3 @@
{% load i18n %}
<a href="{{ url }}" class="btn btn-yellow" role="button">
<i class="mdi mdi-pencil" aria-hidden="true"></i> {% trans "Edit" %}
<i class="mdi mdi-pencil" aria-hidden="true"></i> {{ label }}
</a>

View File

@@ -1,7 +1,7 @@
{% load i18n %}
<div class="dropdown">
<button type="button" class="btn btn-purple dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="mdi mdi-download"></i> {% trans "Export" %}
<i class="mdi mdi-download" aria-hidden="true"></i> {{ label }}
</button>
<ul class="dropdown-menu dropdown-menu-end">
<li><a id="export_current_view" class="dropdown-item" href="?{% if url_params %}{{ url_params }}&{% endif %}export=table">{% trans "Current View" %}</a></li>

View File

@@ -1,6 +1,3 @@
{% load i18n %}
{% if url %}
<a href="{{ url }}" type="button" class="btn btn-cyan">
<i class="mdi mdi-upload"></i> {% trans "Import" %}
</a>
{% endif %}
<a href="{{ url }}" class="btn btn-cyan" role="button">
<i class="mdi mdi-upload" aria-hidden="true"></i> {{ label }}
</a>

View File

@@ -1,7 +1,6 @@
{% load i18n %}
<form action="{{ url }}" method="post">
{% csrf_token %}
<button type="submit" class="btn btn-primary">
<i class="mdi mdi-sync" aria-hidden="true"></i> {% trans "Sync" %}
<i class="mdi mdi-sync" aria-hidden="true"></i> {{ label }}
</button>
</form>