From e6623a6ca8cf305830e8c217994f80fc45ec3245 Mon Sep 17 00:00:00 2001 From: kobayashi Date: Fri, 27 Dec 2019 16:17:17 -0500 Subject: [PATCH 1/3] implement 3788 --- docs/release-notes/version-2.6.md | 1 + netbox/dcim/filters.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 5d5eb00df..595dd1c14 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -3,6 +3,7 @@ ## Enhancements * [#3705](https://github.com/netbox-community/netbox/issues/3705) - Provide request context when executing custom scripts +* [#3788](https://github.com/netbox-community/netbox/issues/3788) - Enabled partial search for inventory items ## Bug Fixes diff --git a/netbox/dcim/filters.py b/netbox/dcim/filters.py index cea279ddd..111469d98 100644 --- a/netbox/dcim/filters.py +++ b/netbox/dcim/filters.py @@ -868,8 +868,8 @@ class InventoryItemFilter(DeviceComponentFilterSet): qs_filter = ( Q(name__icontains=value) | Q(part_id__icontains=value) | - Q(serial__iexact=value) | - Q(asset_tag__iexact=value) | + Q(serial__icontains=value) | + Q(asset_tag__icontains=value) | Q(description__icontains=value) ) return queryset.filter(qs_filter) From 2f2e193cf9fd69af664ef3cfe60bce09d829577e Mon Sep 17 00:00:00 2001 From: Saria Hajjar Date: Sun, 29 Dec 2019 21:20:02 +0000 Subject: [PATCH 2/3] Account for the header when hash-scrolling --- netbox/project-static/js/forms.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/netbox/project-static/js/forms.js b/netbox/project-static/js/forms.js index ae3501cae..55e004c54 100644 --- a/netbox/project-static/js/forms.js +++ b/netbox/project-static/js/forms.js @@ -353,4 +353,19 @@ $(document).ready(function() { }); $('select#id_mode').trigger('change'); } + + // Scroll up an offset equal to the first nav element if a hash is present + // Cannot use '#navbar' because it is not always visible, like in small windows + function headerOffsetScroll() { + if (window.location.hash) { + // Short wait needed to allow the page to scroll to the element + setTimeout(function() { + window.scrollBy(0, -$('nav').height()) + }, 10); + } + } + + // Account for the header height when hash-scrolling + window.addEventListener('load', headerOffsetScroll); + window.addEventListener('hashchange', headerOffsetScroll); }); From 405320d8ab08a6c52fe409b4629725292900600b Mon Sep 17 00:00:00 2001 From: Saria Hajjar Date: Sun, 29 Dec 2019 21:22:14 +0000 Subject: [PATCH 3/3] Changelog --- docs/release-notes/version-2.6.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 5d5eb00df..6d37136ec 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -7,6 +7,7 @@ ## Bug Fixes * [#3695](https://github.com/netbox-community/netbox/issues/3695) - Include A/Z termination sites for circuits in global search +* [#3712](https://github.com/netbox-community/netbox/issues/3712) - Scrolling to target (hash) did not account for the header size * [#3780](https://github.com/netbox-community/netbox/issues/3780) - Fix AttributeError exception in API docs ---