mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 01:48:38 -06:00
#11517: Standardize display of contact assignments
This commit is contained in:
parent
157bf89e89
commit
2669068429
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
### Enhancements
|
### Enhancements
|
||||||
|
|
||||||
|
* [#11517](https://github.com/netbox-community/netbox/issues/11517) - Standardize the inclusion of related objects across the entire UI
|
||||||
* [#11584](https://github.com/netbox-community/netbox/issues/11584) - Add a list view for contact assignments
|
* [#11584](https://github.com/netbox-community/netbox/issues/11584) - Add a list view for contact assignments
|
||||||
* [#11254](https://github.com/netbox-community/netbox/issues/11254) - Introduce the `X-Request-ID` HTTP header to annotate the unique ID of each request for change logging
|
* [#11254](https://github.com/netbox-community/netbox/issues/11254) - Introduce the `X-Request-ID` HTTP header to annotate the unique ID of each request for change logging
|
||||||
* [#11440](https://github.com/netbox-community/netbox/issues/11440) - Add an `enabled` field for device type interfaces
|
* [#11440](https://github.com/netbox-community/netbox/issues/11440) - Add an `enabled` field for device type interfaces
|
||||||
|
@ -67,19 +67,15 @@
|
|||||||
<th scope="row">Description</th>
|
<th scope="row">Description</th>
|
||||||
<td>{{ object.description|placeholder }}</td>
|
<td>{{ object.description|placeholder }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<th scope="row">Assignments</th>
|
|
||||||
<td>{{ assignment_count }}</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% include 'inc/panels/comments.html' %}
|
{% include 'inc/panels/tags.html' %}
|
||||||
{% plugin_left_page object %}
|
{% plugin_left_page object %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col col-md-5">
|
<div class="col col-md-5">
|
||||||
|
{% include 'inc/panels/comments.html' %}
|
||||||
{% include 'inc/panels/custom_fields.html' %}
|
{% include 'inc/panels/custom_fields.html' %}
|
||||||
{% include 'inc/panels/tags.html' %}
|
|
||||||
{% plugin_right_page object %}
|
{% plugin_right_page object %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -87,10 +83,10 @@
|
|||||||
<div class="col col-md-12">
|
<div class="col col-md-12">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<h5 class="card-header">Assignments</h5>
|
<h5 class="card-header">Assignments</h5>
|
||||||
<div class="card-body table-responsive">
|
<div class="card-body htmx-container table-responsive"
|
||||||
{% render_table assignments_table 'inc/table.html' %}
|
hx-get="{% url 'tenancy:contactassignment_list' %}?contact_id={{ object.pk }}"
|
||||||
{% include 'inc/paginator.html' with paginator=assignments_table.paginator page=assignments_table.page %}
|
hx-trigger="load"
|
||||||
</div>
|
></div>
|
||||||
</div>
|
</div>
|
||||||
{% plugin_full_width_page object %}
|
{% plugin_full_width_page object %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,12 +22,6 @@
|
|||||||
<th scope="row">Description</th>
|
<th scope="row">Description</th>
|
||||||
<td>{{ object.description|placeholder }}</td>
|
<td>{{ object.description|placeholder }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<th scope="row">Assignments</th>
|
|
||||||
<td>
|
|
||||||
{{ assignment_count }}
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -35,19 +29,13 @@
|
|||||||
{% plugin_left_page object %}
|
{% plugin_left_page object %}
|
||||||
</div>
|
</div>
|
||||||
<div class="col col-md-6">
|
<div class="col col-md-6">
|
||||||
|
{% include 'inc/panels/related_objects.html' %}
|
||||||
{% include 'inc/panels/custom_fields.html' %}
|
{% include 'inc/panels/custom_fields.html' %}
|
||||||
{% plugin_right_page object %}
|
{% plugin_right_page object %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col col-md-12">
|
<div class="col col-md-12">
|
||||||
<div class="card">
|
|
||||||
<h5 class="card-header">Assigned Contacts</h5>
|
|
||||||
<div class="card-body table-responsive">
|
|
||||||
{% render_table contacts_table 'inc/table.html' %}
|
|
||||||
{% include 'inc/paginator.html' with paginator=contacts_table.paginator page=contacts_table.page %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% plugin_full_width_page object %}
|
{% plugin_full_width_page object %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -255,16 +255,12 @@ class ContactRoleView(generic.ObjectView):
|
|||||||
queryset = ContactRole.objects.all()
|
queryset = ContactRole.objects.all()
|
||||||
|
|
||||||
def get_extra_context(self, request, instance):
|
def get_extra_context(self, request, instance):
|
||||||
contact_assignments = ContactAssignment.objects.restrict(request.user, 'view').filter(
|
related_models = (
|
||||||
role=instance
|
(ContactAssignment.objects.restrict(request.user, 'view').filter(role=instance), 'role_id'),
|
||||||
)
|
)
|
||||||
contacts_table = tables.ContactAssignmentTable(contact_assignments, user=request.user)
|
|
||||||
contacts_table.columns.hide('role')
|
|
||||||
contacts_table.configure(request)
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'contacts_table': contacts_table,
|
'related_models': related_models,
|
||||||
'assignment_count': ContactAssignment.objects.filter(role=instance).count(),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -314,19 +310,6 @@ class ContactListView(generic.ObjectListView):
|
|||||||
class ContactView(generic.ObjectView):
|
class ContactView(generic.ObjectView):
|
||||||
queryset = Contact.objects.all()
|
queryset = Contact.objects.all()
|
||||||
|
|
||||||
def get_extra_context(self, request, instance):
|
|
||||||
contact_assignments = ContactAssignment.objects.restrict(request.user, 'view').filter(
|
|
||||||
contact=instance
|
|
||||||
)
|
|
||||||
assignments_table = tables.ContactAssignmentTable(contact_assignments, user=request.user)
|
|
||||||
assignments_table.columns.hide('contact')
|
|
||||||
assignments_table.configure(request)
|
|
||||||
|
|
||||||
return {
|
|
||||||
'assignments_table': assignments_table,
|
|
||||||
'assignment_count': ContactAssignment.objects.filter(contact=instance).count(),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@register_model_view(Contact, 'edit')
|
@register_model_view(Contact, 'edit')
|
||||||
class ContactEditView(generic.ObjectEditView):
|
class ContactEditView(generic.ObjectEditView):
|
||||||
|
Loading…
Reference in New Issue
Block a user