mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 09:16:10 -06:00
Merge branch 'netbox-community:develop' into develop
This commit is contained in:
commit
a9081d0cda
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
### Enhancements
|
### Enhancements
|
||||||
|
|
||||||
|
* [#9876](https://github.com/netbox-community/netbox/issues/9876) - Improve support for matching tags in conditional rules
|
||||||
|
* [#12015](https://github.com/netbox-community/netbox/issues/12015) - Add device type & role filters for device components
|
||||||
* [#12470](https://github.com/netbox-community/netbox/issues/12470) - Collapse context data by default when viewing a rendered device configuration
|
* [#12470](https://github.com/netbox-community/netbox/issues/12470) - Collapse context data by default when viewing a rendered device configuration
|
||||||
* [#12562](https://github.com/netbox-community/netbox/issues/12562) - Record client IP address when logging authentication failures
|
* [#12562](https://github.com/netbox-community/netbox/issues/12562) - Record client IP address when logging authentication failures
|
||||||
* [#12597](https://github.com/netbox-community/netbox/issues/12597) - Add an option to hide custom fields only if unset
|
* [#12597](https://github.com/netbox-community/netbox/issues/12597) - Add an option to hide custom fields only if unset
|
||||||
@ -11,13 +13,17 @@
|
|||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#7503](https://github.com/netbox-community/netbox/issues/7503) - Improve rack space validation when creating multiple devices via REST API
|
||||||
* [#11539](https://github.com/netbox-community/netbox/issues/11539) - Fix exception when applying "empty" filter lookup with invalid value
|
* [#11539](https://github.com/netbox-community/netbox/issues/11539) - Fix exception when applying "empty" filter lookup with invalid value
|
||||||
* [#11934](https://github.com/netbox-community/netbox/issues/11934) - Prevent reassignment of an IP address designated as primary for its parent object
|
* [#11934](https://github.com/netbox-community/netbox/issues/11934) - Prevent reassignment of an IP address designated as primary for its parent object
|
||||||
* [#12730](https://github.com/netbox-community/netbox/issues/12730) - Fix extraneous contacts listed in object contact assignments view
|
* [#12538](https://github.com/netbox-community/netbox/issues/12538) - Redirect user to originating view after editing/deleting an image attachment
|
||||||
* [#12627](https://github.com/netbox-community/netbox/issues/12627) - Restore hover preview for embedded image attachment tables
|
* [#12627](https://github.com/netbox-community/netbox/issues/12627) - Restore hover preview for embedded image attachment tables
|
||||||
* [#12694](https://github.com/netbox-community/netbox/issues/12694) - Strip leading & trailing whitespace from custom link URL & text
|
* [#12694](https://github.com/netbox-community/netbox/issues/12694) - Strip leading & trailing whitespace from custom link URL & text
|
||||||
|
* [#12702](https://github.com/netbox-community/netbox/issues/12702) - Fix sizing of rear port selection widget on front port template creation form
|
||||||
* [#12715](https://github.com/netbox-community/netbox/issues/12715) - Use contact assignments table to display the contacts assigned to an object
|
* [#12715](https://github.com/netbox-community/netbox/issues/12715) - Use contact assignments table to display the contacts assigned to an object
|
||||||
|
* [#12730](https://github.com/netbox-community/netbox/issues/12730) - Fix extraneous contacts listed in object contact assignments view
|
||||||
* [#12742](https://github.com/netbox-community/netbox/issues/12742) - Object counts dashboard widget should support URL-compatible query filters
|
* [#12742](https://github.com/netbox-community/netbox/issues/12742) - Object counts dashboard widget should support URL-compatible query filters
|
||||||
|
* [#12762](https://github.com/netbox-community/netbox/issues/12762) - Fix GraphiQL UI by reverting graphene-django to earlier version
|
||||||
* [#12745](https://github.com/netbox-community/netbox/issues/12745) - Escape display text in API-backed selection widgets
|
* [#12745](https://github.com/netbox-community/netbox/issues/12745) - Escape display text in API-backed selection widgets
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -65,8 +65,14 @@ class Condition:
|
|||||||
"""
|
"""
|
||||||
Evaluate the provided data to determine whether it matches the condition.
|
Evaluate the provided data to determine whether it matches the condition.
|
||||||
"""
|
"""
|
||||||
|
def _get(obj, key):
|
||||||
|
if isinstance(obj, list):
|
||||||
|
return [dict.get(i, key) for i in obj]
|
||||||
|
|
||||||
|
return dict.get(obj, key)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
value = functools.reduce(dict.get, self.attr.split('.'), data)
|
value = functools.reduce(_get, self.attr.split('.'), data)
|
||||||
except TypeError:
|
except TypeError:
|
||||||
# Invalid key path
|
# Invalid key path
|
||||||
value = None
|
value = None
|
||||||
|
@ -234,8 +234,12 @@ class ActionsColumn(tables.Column):
|
|||||||
return ''
|
return ''
|
||||||
|
|
||||||
model = table.Meta.model
|
model = table.Meta.model
|
||||||
request = getattr(table, 'context', {}).get('request')
|
if request := getattr(table, 'context', {}).get('request'):
|
||||||
url_appendix = f'?return_url={quote(request.get_full_path())}' if request else ''
|
return_url = request.GET.get('return_url', request.get_full_path())
|
||||||
|
url_appendix = f'?return_url={quote(return_url)}'
|
||||||
|
else:
|
||||||
|
url_appendix = ''
|
||||||
|
|
||||||
html = ''
|
html = ''
|
||||||
|
|
||||||
# Compile actions menu
|
# Compile actions menu
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
{% load helpers %}
|
{% load helpers %}
|
||||||
|
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<h5 class="card-header">
|
<h5 class="card-header">Images</h5>
|
||||||
Images
|
{% htmx_table 'extras:imageattachment_list' content_type_id=object|content_type_id object_id=object.pk %}
|
||||||
</h5>
|
|
||||||
<div class="card-body htmx-container table-responsive"
|
|
||||||
hx-get="{% url 'extras:imageattachment_list' %}?content_type_id={{ object|content_type_id }}&object_id={{ object.pk }}"
|
|
||||||
hx-trigger="load"></div>
|
|
||||||
{% if perms.extras.add_imageattachment %}
|
{% if perms.extras.add_imageattachment %}
|
||||||
<div class="card-footer text-end noprint">
|
<div class="card-footer text-end noprint">
|
||||||
<a href="{% url 'extras:imageattachment_add' %}?content_type={{ object|content_type_id }}&object_id={{ object.pk }}" class="btn btn-primary btn-sm">
|
<a href="{% url 'extras:imageattachment_add' %}?content_type={{ object|content_type_id }}&object_id={{ object.pk }}" class="btn btn-primary btn-sm">
|
||||||
|
4
netbox/utilities/templates/builtins/htmx_table.html
Normal file
4
netbox/utilities/templates/builtins/htmx_table.html
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<div class="card-body htmx-container table-responsive"
|
||||||
|
hx-get="{% url viewname %}{% if url_params %}?{{ url_params.urlencode }}{% endif %}"
|
||||||
|
hx-trigger="load"
|
||||||
|
></div>
|
@ -1,4 +1,5 @@
|
|||||||
from django import template
|
from django import template
|
||||||
|
from django.http import QueryDict
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'badge',
|
'badge',
|
||||||
@ -74,3 +75,22 @@ def checkmark(value, show_false=True, true='Yes', false='No'):
|
|||||||
'true_label': true,
|
'true_label': true,
|
||||||
'false_label': false,
|
'false_label': false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@register.inclusion_tag('builtins/htmx_table.html', takes_context=True)
|
||||||
|
def htmx_table(context, viewname, return_url=None, **kwargs):
|
||||||
|
"""
|
||||||
|
Embed an object list table retrieved using HTMX. Any extra keyword arguments are passed as URL query parameters.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
context: The current request context
|
||||||
|
viewname: The name of the view to use for the HTMX request (e.g. `dcim:site_list`)
|
||||||
|
return_url: The URL to pass as the `return_url`. If not provided, the current request's path will be used.
|
||||||
|
"""
|
||||||
|
url_params = QueryDict(mutable=True)
|
||||||
|
url_params.update(kwargs)
|
||||||
|
url_params['return_url'] = return_url or context['request'].path
|
||||||
|
return {
|
||||||
|
'viewname': viewname,
|
||||||
|
'url_params': url_params,
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user