-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds generic object children template (#13388)
* adds generic tab view template #12110 * Rename view_tab.html and move to generic/ * Fix console ports template * Move bulk operations view resolution to template * Avoid setting default template_name on ObjectChildrenView * Move base_template and table_config context vars to base context * removed bulk_delete_control from templates * refactored bulk_controls view * fixed table_config * renamed object_tab.html to objectchildren_list.html * removed unused import * Refactor template blocks for bulk operation buttons * Rename object children generic template * Move disconnect bulk action into a separate template for device components * Fix cluster devices & VM interfaces views * minor button label change --------- Co-authored-by: Jeremy Stretch <jstretch@netboxlabs.com>
- Loading branch information
1 parent
f5a1f83
commit 545769a
Showing
32 changed files
with
331 additions
and
1,003 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{% extends 'generic/object_children.html' %} | ||
{% load helpers %} | ||
|
||
{% block bulk_edit_controls %} | ||
{{ block.super }} | ||
{% with bulk_rename_view=child_model|validated_viewname:"bulk_rename" %} | ||
{% if 'bulk_rename' in actions and bulk_rename_view %} | ||
<button type="submit" name="_rename" | ||
formaction="{% url bulk_rename_view %}?return_url={{ return_url }}" | ||
class="btn btn-outline-warning btn-sm"> | ||
<i class="mdi mdi-pencil-outline" aria-hidden="true"></i> Rename | ||
</button> | ||
{% endif %} | ||
{% endwith %} | ||
{% endblock bulk_edit_controls %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,27 @@ | ||
{% extends 'dcim/device/base.html' %} | ||
{% load render_table from django_tables2 %} | ||
{% extends 'dcim/device/components_base.html' %} | ||
{% load helpers %} | ||
{% load static %} | ||
|
||
{% block content %} | ||
{% include 'inc/table_controls_htmx.html' with table_modal="DeviceConsolePortTable_config" %} | ||
|
||
<form method="post"> | ||
{% csrf_token %} | ||
|
||
<div class="card"> | ||
<div class="card-body htmx-container table-responsive" id="object_list"> | ||
{% include 'htmx/table.html' %} | ||
</div> | ||
</div> | ||
|
||
<div class="noprint bulk-buttons"> | ||
<div class="bulk-button-group"> | ||
{% if 'bulk_edit' in actions %} | ||
<div class="btn-group" role="group"> | ||
<button type="submit" name="_edit" formaction="{% url 'dcim:consoleport_bulk_edit' %}?device={{ object.pk }}&return_url={% url 'dcim:device_consoleports' pk=object.pk %}" class="btn btn-warning btn-sm"> | ||
<i class="mdi mdi-pencil" aria-hidden="true"></i> Edit | ||
{% block bulk_delete_controls %} | ||
{{ block.super }} | ||
{% with bulk_disconnect_view=child_model|validated_viewname:"bulk_disconnect" %} | ||
{% if 'bulk_disconnect' in actions and bulk_disconnect_view %} | ||
<button type="submit" name="_disconnect" | ||
formaction="{% url bulk_disconnect_view %}?return_url={{ return_url }}" | ||
class="btn btn-outline-danger btn-sm"> | ||
<span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect | ||
</button> | ||
<button type="submit" name="_rename" formaction="{% url 'dcim:consoleport_bulk_rename' %}?return_url={% url 'dcim:device_consoleports' pk=object.pk %}" class="btn btn-outline-warning btn-sm"> | ||
<i class="mdi mdi-pencil-outline" aria-hidden="true"></i> Rename | ||
</button> | ||
</div> | ||
{% endif %} | ||
<div class="btn-group" role="group"> | ||
{% if 'bulk_delete' in actions %} | ||
<button type="submit" name="_delete" formaction="{% url 'dcim:consoleport_bulk_delete' %}?return_url={% url 'dcim:device_consoleports' pk=object.pk %}" class="btn btn-danger btn-sm"> | ||
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> Delete | ||
</button> | ||
{% endif %} | ||
{% if 'bulk_edit' in actions %} | ||
<button type="submit" name="_disconnect" formaction="{% url 'dcim:consoleport_bulk_disconnect' %}?return_url={% url 'dcim:device_consoleports' pk=object.pk %}" class="btn btn-outline-danger btn-sm"> | ||
<span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect | ||
</button> | ||
{% endif %} | ||
</div> | ||
</div> | ||
{% if perms.dcim.add_consoleport %} | ||
{% endwith %} | ||
{% endblock bulk_delete_controls %} | ||
|
||
{% block bulk_extra_controls %} | ||
{{ block.super }} | ||
{% if perms.dcim.add_consoleport %} | ||
<div class="bulk-button-group"> | ||
<a href="{% url 'dcim:consoleport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_consoleports' pk=object.pk %}" class="btn btn-sm btn-primary"> | ||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add Console Port | ||
</a> | ||
<a href="{% url 'dcim:consoleport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_consoleports' pk=object.pk %}" | ||
class="btn btn-primary btn-sm"> | ||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add Console Ports | ||
</a> | ||
</div> | ||
{% endif %} | ||
</div> | ||
</form> | ||
{% endblock %} | ||
|
||
{% block modals %} | ||
{{ block.super }} | ||
{% table_config_form table %} | ||
{% endblock modals %} | ||
{% endif %} | ||
{% endblock bulk_extra_controls %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,27 @@ | ||
{% extends 'dcim/device/base.html' %} | ||
{% load render_table from django_tables2 %} | ||
{% extends 'dcim/device/components_base.html' %} | ||
{% load helpers %} | ||
{% load static %} | ||
|
||
{% block content %} | ||
{% include 'inc/table_controls_htmx.html' with table_modal="DeviceConsoleServerPortTable_config" %} | ||
|
||
<form method="post"> | ||
{% csrf_token %} | ||
|
||
<div class="card"> | ||
<div class="card-body htmx-container table-responsive" id="object_list"> | ||
{% include 'htmx/table.html' %} | ||
</div> | ||
</div> | ||
|
||
<div class="noprint bulk-buttons"> | ||
<div class="bulk-button-group"> | ||
{% if 'bulk_edit' in actions %} | ||
<div class="btn-group" role="group"> | ||
<button type="submit" name="_edit" formaction="{% url 'dcim:consoleserverport_bulk_edit' %}?device={{ object.pk }}&return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}" class="btn btn-warning btn-sm"> | ||
<i class="mdi mdi-pencil" aria-hidden="true"></i> Edit | ||
{% block bulk_delete_controls %} | ||
{{ block.super }} | ||
{% with bulk_disconnect_view=child_model|validated_viewname:"bulk_disconnect" %} | ||
{% if 'bulk_disconnect' in actions and bulk_disconnect_view %} | ||
<button type="submit" name="_disconnect" | ||
formaction="{% url bulk_disconnect_view %}?return_url={{ return_url }}" | ||
class="btn btn-outline-danger btn-sm"> | ||
<span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect | ||
</button> | ||
<button type="submit" name="_rename" formaction="{% url 'dcim:consoleserverport_bulk_rename' %}?return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}" class="btn btn-outline-warning btn-sm"> | ||
<i class="mdi mdi-pencil-outline" aria-hidden="true"></i> Rename | ||
</button> | ||
</div> | ||
{% endif %} | ||
<div class="btn-group" role="group"> | ||
{% if 'bulk_delete' in actions %} | ||
<button type="submit" formaction="{% url 'dcim:consoleserverport_bulk_delete' %}?return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}" class="btn btn-danger btn-sm"> | ||
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> Delete | ||
</button> | ||
{% endif %} | ||
{% if 'bulk_edit' in actions %} | ||
<button type="submit" name="_disconnect" formaction="{% url 'dcim:consoleserverport_bulk_disconnect' %}?return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}" class="btn btn-outline-danger btn-sm"> | ||
<span class="mdi mdi-ethernet-cable-off" aria-hidden="true"></span> Disconnect | ||
</button> | ||
{% endif %} | ||
</div> | ||
</div> | ||
{% if perms.dcim.add_consoleserverport %} | ||
{% endwith %} | ||
{% endblock bulk_delete_controls %} | ||
|
||
{% block bulk_extra_controls %} | ||
{{ block.super }} | ||
{% if perms.dcim.add_consoleserverport %} | ||
<div class="bulk-button-group"> | ||
<a href="{% url 'dcim:consoleserverport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}" class="btn btn-primary btn-sm"> | ||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add Console Server Ports | ||
</a> | ||
<a href="{% url 'dcim:consoleserverport_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_consoleserverports' pk=object.pk %}" | ||
class="btn btn-primary btn-sm"> | ||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add Console Server Ports | ||
</a> | ||
</div> | ||
{% endif %} | ||
</div> | ||
</form> | ||
{% endblock %} | ||
|
||
{% block modals %} | ||
{{ block.super }} | ||
{% table_config_form table %} | ||
{% endblock modals %} | ||
{% endif %} | ||
{% endblock bulk_extra_controls %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,13 @@ | ||
{% extends 'dcim/device/base.html' %} | ||
{% load render_table from django_tables2 %} | ||
{% load helpers %} | ||
{% load static %} | ||
{% extends 'dcim/device/components_base.html' %} | ||
|
||
{% block content %} | ||
{% include 'inc/table_controls_htmx.html' with table_modal="DeviceDeviceBayTable_config" %} | ||
|
||
<form method="post"> | ||
{% csrf_token %} | ||
|
||
<div class="card"> | ||
<div class="card-body htmx-container table-responsive" id="object_list"> | ||
{% include 'htmx/table.html' %} | ||
</div> | ||
</div> | ||
|
||
<div class="noprint bulk-buttons"> | ||
<div class="bulk-button-group"> | ||
{% if 'bulk_edit' in actions %} | ||
<div class="btn-group" role="group"> | ||
<button type="submit" name="_edit" formaction="{% url 'dcim:devicebay_bulk_edit' %}?device={{ object.pk }}&return_url={% url 'dcim:device_devicebays' pk=object.pk %}" class="btn btn-warning btn-sm"> | ||
<i class="mdi mdi-pencil" aria-hidden="true"></i> Edit | ||
</button> | ||
<button type="submit" name="_rename" formaction="{% url 'dcim:devicebay_bulk_rename' %}?return_url={% url 'dcim:device_devicebays' pk=object.pk %}" class="btn btn-outline-warning btn-sm"> | ||
<i class="mdi mdi-pencil-outline" aria-hidden="true"></i> Rename | ||
</button> | ||
</div> | ||
{% endif %} | ||
{% if 'bulk_delete' in actions %} | ||
<button type="submit" name="_delete" formaction="{% url 'dcim:devicebay_bulk_delete' %}?return_url={% url 'dcim:device_devicebays' pk=object.pk %}" class="btn btn-danger btn-sm"> | ||
<i class="mdi mdi-trash-can-outline" aria-hidden="true"></i> Delete | ||
</button> | ||
{% endif %} | ||
</div> | ||
{% if perms.dcim.add_devicebay %} | ||
{% block bulk_extra_controls %} | ||
{{ block.super }} | ||
{% if perms.dcim.add_devicebay %} | ||
<div class="bulk-button-group"> | ||
<a href="{% url 'dcim:devicebay_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_devicebays' pk=object.pk %}" class="btn btn-primary btn-sm"> | ||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add Device Bays | ||
</a> | ||
<a href="{% url 'dcim:devicebay_add' %}?device={{ object.pk }}&return_url={% url 'dcim:device_devicebays' pk=object.pk %}" | ||
class="btn btn-primary btn-sm"> | ||
<i class="mdi mdi-plus-thick" aria-hidden="true"></i> Add Device Bays | ||
</a> | ||
</div> | ||
{% endif %} | ||
</div> | ||
</form> | ||
{% endblock %} | ||
|
||
{% block modals %} | ||
{{ block.super }} | ||
{% table_config_form table %} | ||
{% endblock modals %} | ||
{% endif %} | ||
{% endblock bulk_extra_controls %} |
Oops, something went wrong.