Commit Graph

1512 Commits

Author SHA1 Message Date
jeremystretch
16919cc1d9 Closes #10761: Enable associating an export template with multiple object types 2022-10-26 13:30:45 -04:00
Jeremy Stretch
9628dead07
Closes #10560: New global search (#10676)
* Initial work on new search backend

* Clean up search backends

* Return only the most relevant result per object

* Clear any pre-existing cached entries on cache()

* #6003: Implement global search functionality for custom field values

* Tweak field weights & document guidance

* Extend search() to accept a lookup type

* Move get_registry() out of SearchBackend

* Enforce object permissions when returning search results

* Add indexers for remaining models

* Avoid calling remove() on non-cacheable objects

* Use new search backend by default

* Extend search backend to filter by object type

* Clean up search view form

* Enable specifying lookup logic

* Add indexes for value field

* Remove object type selector from search bar

* Introduce SearchTable and enable HTMX for results

* Enable pagination

* Remove legacy search backend

* Cleanup

* Use a UUID for CachedValue primary key

* Refactoring search methods

* Define max search results limit

* Extend reindex command to support specifying particular models

* Add clear() and size to SearchBackend

* Optimize bulk caching performance

* Highlight matched portion of field value

* Performance improvements for reindexing

* Started on search tests

* Cleanup & docs

* Documentation updates

* Clean up SearchIndex

* Flatten search registry to register by app_label.model_name

* Clean up search backend classes

* Clean up RestrictedGenericForeignKey and RestrictedPrefetch

* Resolve migrations conflict
2022-10-21 13:16:16 -04:00
Arthur Hanson
9ca4c7315b
10595 extend graphql relationships (#10603)
* 9817 add graphql l2vpntermination assigned_object

* 9817 add graphql ipaddressassignment assigned_object

* 9817 ipan graphql gfk

* 9817 dcim graphql gfk

* 9817 dcim graphql gfk

* 9817 fix tests

* 10595 cable a_terminations to graphql

* 10595 add contacts to graphql

* 10595 move contacts to Provider
2022-10-11 12:26:18 -04:00
Arthur Hanson
ffce5d968d
8927 plugin search (#10489)
* #7016 base search classes

* 7016 add search indexes

* 7016 add search indexes

* 7016 add search indexes

* 7016 add search indexes

* 7016 add search indexes

* 7016 add search indexes

* 8927 refactor search

* 8927 refactor search

* 8927 refactor search

* 8927 refactor search

* 8927 get search choices working

* 8927 cleanup - optimize

* 8927 use backend search function

* 8927 fix for plugin search

* 8927 add docs

* Move search app to a module under netbox/

* Utilize global registry to register model search classes

* Build search form options from registry

* Determine search categories from model app by default

* Enable dynamic search registration for plugins

* Update docs & improve plugin support

* Clean up search backend class

* Docs for #8927

Co-authored-by: jeremystretch <jstretch@ns1.com>
2022-10-10 14:00:59 -04:00
jeremystretch
656f0b7d82 #9072: Add hide_if_empty argument to ViewTab 2022-10-10 08:11:29 -04:00
jeremystretch
b0ba9bd83d Closes #10608: Register all core model views using register_model_view() 2022-10-07 17:17:58 -04:00
Jeremy Stretch
a3dbf4023c
Merge pull request #10597 from netbox-community/9072-plugin-view-tabs
#9072: Custom model view tabs for plugins
2022-10-07 15:22:04 -04:00
jeremystretch
053c97b7a8 Docs and test for #9072 2022-10-07 15:03:52 -04:00
jeremystretch
1fc8de85a3 Add device NAPALM view tabs 2022-10-07 14:17:18 -04:00
jeremystretch
5e1a0733e4 Replace active_tab context for object views 2022-10-07 12:14:19 -04:00
jeremystretch
bfe26b46a6 Wrap model detail views with register_model_view() 2022-10-07 11:36:14 -04:00
jeremystretch
4c999daacd Introduce ViewTab 2022-10-07 10:54:34 -04:00
Arthur Hanson
10bb8fa10a
9478 link peers to GraphQL (#10574)
* 9468 add link_peer to GraphQL

* 9478 add class_type

* 9478 fix tests

* 9478 fix tests

* 9478 fix tests
2022-10-06 16:50:53 -04:00
jeremystretch
0d7851ed9d #9072: Implement a mechanism for dynamically registering model detail views 2022-10-06 16:20:35 -04:00
Arthur Hanson
24ba840be7
10472 graphene 3 (#10473)
* update to Graphene 3.0.0

* 10472 exempt view permissions on tests

* 10472 exempt permission check on graphql tests
2022-10-05 15:50:17 -04:00
jeremystretch
10352ff5ad Merge branch 'develop' into feature 2022-09-30 17:17:18 -04:00
Arthur Hanson
204c10c053
9654 device weight (#10448)
* 9654 add weight fields to devices

* 9654 changes from code review

* 9654 change _abs_weight to grams

* Resolve migrations conflict

* 9654 code-review changes

* 9654 total weight on devices

* Misc cleanup

Co-authored-by: Jeremy Stretch <jstretch@ns1.com>
2022-09-30 16:31:04 -04:00
Arthur Hanson
af8bb0c4b9
10348 add decimal custom field (#10422)
* 10348 add decimal custom field

* 10348 fix tests

* 10348 add documentation

* Rearrange custom fields to be ordered consistently

* Rename number_field to integer_field for clarity

* Clean up validation logic

* Apply suggested changes from PR

* Store decimal custom field values natively

* Fix filter test

* Update custom field model migrations to use new encoder

Co-authored-by: jeremystretch <jstretch@ns1.com>
2022-09-30 16:03:24 -04:00
jeremystretch
ada5c58acf Closes #10529: Run validation on each value of a multi-value filter 2022-09-30 15:05:13 -04:00
Jeremy Stretch
c95ad5b208
Merge pull request #10441 from netbox-community/9071-plugin-menu
9071 add header to plugin menu
2022-09-28 17:08:10 -04:00
jeremystretch
00d2dcda68 Refactor navigation resources and menu 2022-09-28 15:56:09 -04:00
Arthur Hanson
20e3fdc782
#9045 #9046 - remove legacy fields from Provider (#10377)
* #9045 - remove legacy fields from Provider

* Add safegaurd for legacy data to migration

* 9045 remove fields from forms and tables

* Update unrelated tests to use ASN model instead of Provider

* Fix migrations collision

Co-authored-by: jeremystretch <jstretch@ns1.com>
2022-09-28 15:22:19 -04:00
jeremystretch
a0b17887fd Fixes #10445: Avoid rounding virtual machine memory values 2022-09-26 15:45:58 -04:00
Jeremy Stretch
c4b7ab067a
Fixes #10247: Allow changing selected device/VM when creating a new component (#10312)
* Initial work on #10247

* Continued work on #10247

* Clean up component creation tests

* Move valdiation of replicated field to form

* Clean up ordering of fields in component creation forms

* Omit fieldset header if none

* Clean up ordering of fields in component template creation forms

* View tests should not move component templates to new device type

* Define replication_fields on VMInterfaceCreateForm

* Clean up expandable field help texts

* Update comments

* Update component bulk update forms & views to support new replication fields

* Fix ModularDeviceComponentForm parent class

* Fix bulk creation of VM interfaces (thanks @kkthxbye-code!)
2022-09-15 10:10:32 -04:00
Daniel Sheppard
25a474f9f7
Fix PEP8 errors 2022-09-02 14:05:38 -05:00
Daniel Sheppard
c42f7ab6d3
Fixes #9823 - Make validation error from NumericArrayField more verbose. 2022-09-02 13:48:15 -05:00
Andreas Nieß
cd6911f83c Replace custom JSONField inspector with the one from drf_yasg 2022-08-29 07:52:29 +02:00
kkthxbye-code
e75e189933 Render "Set Null" button for custom fields 2022-08-26 14:32:17 +02:00
Arthur
41499b189c #10094 fix Contact AddAnother 2022-08-22 16:33:50 -07:00
jeremystretch
c14a5973c7 Fixes #10089: linkify template filter should escape object representation 2022-08-22 11:14:36 -04:00
jeremystretch
e4bbebf87a Merge branch 'develop' into feature 2022-08-12 10:18:57 -04:00
jeremystretch
a9aaa8939c Closes #9161: Pretty print JSON custom field data when editing 2022-08-10 16:12:04 -04:00
jeremystretch
1b88b36820 Merge branch 'develop' into feature 2022-08-08 15:39:03 -04:00
jeremystretch
90317adae7 Clean up usages of mark_safe() 2022-08-08 10:47:07 -04:00
jeremystretch
29a611c729 Closes #9896: Discontinue arbitrary use of OrderedDict 2022-08-01 16:51:44 -04:00
jeremystretch
562769fb89 Merge branch 'develop' into feature 2022-08-01 14:42:09 -04:00
jeremystretch
ff3fcb8134 #9871: Tweak display of utilization graph value 2022-08-01 12:38:12 -04:00
jeremystretch
d4d73674fc Fixes #9871: Fix utilization graph value alignments 2022-08-01 11:54:39 -04:00
jeremystretch
1bbf5d214b Closes #9881: Increase granularity in utilization graph values 2022-08-01 10:23:18 -04:00
jeremystretch
9fe5f09742 Fixes #9891: Ensure consistent ordering for tags during object serialization 2022-08-01 09:32:52 -04:00
jeremystretch
04fb0bd51c Closes #9858: ChangeLoggedModelFilterSet cleanup 2022-07-28 15:41:10 -04:00
jeremystretch
466931d2fb Fixes #9829: Arrange custom fields by group when editing objects 2022-07-26 12:41:51 -04:00
jeremystretch
d442f8fd60 Fixes #9843: Fix rendering of custom field values (regression from #9647) 2022-07-26 11:09:51 -04:00
jeremystretch
abf11fbcb8 Merge branch 'develop' into feature 2022-07-20 12:20:33 -04:00
jeremystretch
a7a20ad2ea Fixes #9775: Fix exception when viewing a report with no descripton 2022-07-19 13:01:21 -04:00
jeremystretch
3eb6b6c07f Clean up core API imports 2022-07-13 16:18:55 -04:00
jeremystretch
a57398b0d6 Closes #9647: Introduce customfield_value template tag 2022-07-01 14:45:22 -04:00
jeremystretch
c11af40a06 prepare_cloned_fields() should always return a QueryDict 2022-07-01 13:52:37 -04:00
jeremystretch
12c138b341 Closes #9074: Enable referencing the current user when evaluating permission constraints 2022-07-01 13:34:10 -04:00
jeremystretch
c6dfdf10e5 Introduce qs_filter_from_constraints() for constructing object permission QS filters 2022-07-01 11:49:36 -04:00
jeremystretch
3a6f46bf38 Closes #9075: Introduce AbortRequest exception for cleanly interrupting object mutations 2022-06-30 15:15:07 -04:00
jeremystretch
779969f150 Closes #9070: Hide navigation menu items based on user permissions 2022-06-29 16:36:10 -04:00
jeremystretch
cd3111ca8d Merge branch 'develop' into feature 2022-06-28 16:55:49 -04:00
jeremystretch
4315c4697c Ignore default field values which reference ConfigItems when calculating migrations 2022-06-23 17:44:19 -04:00
jeremystretch
f9d81fd362 Closes #9414: Add clone() method to NetBoxModel for copying instance attributes 2022-06-23 15:21:10 -04:00
jeremystretch
3c15419bd0 Introduce IPNetworkSerializer to serialize allowed token IPs 2022-06-22 21:51:43 -04:00
jeremystretch
a38a880e67 Refactor source IP resolution logic 2022-06-22 17:01:07 -04:00
jeremystretch
9c214622a1 Closes #4350: Illustrate reservations vertically alongside rack elevations 2022-06-21 16:30:27 -04:00
jeremystretch
84f0561712 Initial work on half-height RUs 2022-06-20 12:05:06 -04:00
jeremystretch
ba12db3019 Merge branch 'develop' into feature 2022-06-20 11:50:23 -04:00
kkthxbye-code
7c79c90cd2 Sanitize HTML after rendering markdown 2022-06-17 23:16:57 +02:00
Jeremy Stretch
723954f0d9
Merge pull request #9547 from kkthxbye-code/fix-9533
Fixes #9533 - Move markdown documentation to docs
2022-06-17 13:14:44 -04:00
kkthxbye-code
cf76d5c46a Move markdown documentation to docs 2022-06-16 22:26:37 +02:00
kkthxbye-code
d1aa820856 Add configuration option JINJA2_FILTERS 2022-06-10 23:13:49 +02:00
jeremystretch
32322e95b6 Merge branch 'develop' into feature 2022-05-31 15:50:23 -04:00
jeremystretch
b0a56a71bb Fixes #9291: Improve data validation for MultiObjectVar script fields 2022-05-31 13:37:14 -04:00
kkthxbye-code
6d3cded579 Make sure initial data is passed as array for DynamicModelChoiceFields 2022-05-27 20:41:50 +02:00
jeremystretch
db42589cca Closes #5303: A virtual machine may be assigned to a site and/or cluster 2022-05-26 14:59:49 -04:00
jeremystretch
b331f047af Closes #8222: Enable the assignment of a VM to a specific host device within a cluster 2022-05-25 16:01:10 -04:00
jeremystretch
e208404e3a Merge branch 'develop' into feature 2022-05-12 14:16:01 -04:00
jeremystretch
ad12ad4a77 Closes #9221: Add definition list support for Markdown 2022-05-12 11:05:34 -04:00
jeremystretch
37903776fd Fixes #9296: Improve Markdown link sanitization 2022-05-12 10:41:29 -04:00
jeremystretch
4fac10ac4a Merge branch 'develop' into feature 2022-04-15 12:09:28 -04:00
jeremystretch
27a9313396 #9096: Correct getattr() call 2022-04-12 08:13:08 -04:00
jeremystretch
517d0158b6 Fixes #9096: Remove duplicate filter tag when filtering by "none" 2022-04-11 08:51:11 -04:00
jeremystretch
03535ce50b Closes #8995: Enable arbitrary ordering of REST API results 2022-04-08 16:00:33 -04:00
jeremystretch
830b56ac9e Check that ChoiceSet CHOICES is mutable if key is set 2022-04-05 08:40:30 -04:00
jeremystretch
22908a12e9 Merge branch 'develop' into feature 2022-03-25 10:38:44 -04:00
jeremystretch
dde4495e20 #8232: Cleanup & test fix 2022-03-25 09:59:58 -04:00
tranthang2404
1278429518
Closes #8232: Add color show full 100% utilization (#8816)
* Closes #8232: Add color show full 100% utilization

* change rounding

* change rounding

* fix hard code html

* format
2022-03-25 09:52:13 -04:00
jeremystretch
a5820e27a6 Fixes #8905: Disable ordering by assigned tags to prevent erroneous results 2022-03-24 11:56:18 -04:00
jeremystretch
8d682041a4 Extend linkify() to accept an attr name for the link text 2022-03-22 15:17:34 -04:00
jeremystretch
75dae5fbe8 Introduce linkify template filter 2022-03-22 14:51:20 -04:00
jeremystretch
3dc671395e Introduce local ChoiceField and MultipleChoiceField classes 2022-03-21 15:08:05 -04:00
jeremystretch
15005209d1 Merge branch 'develop' into feature 2022-03-18 13:34:31 -04:00
PieterL75
0da04232f3
Fixes #8813 Retain search value after submitting (#8907)
* Fixes #8813 Retain search value after submitting

* remove autofocus from searchbar

Co-authored-by: Pieter Lambrecht <pieter.lambrecht@sentia.com>
2022-03-18 13:23:39 -04:00
jeremystretch
76445bd19c Move bulk edit/delete buttons to template tags 2022-03-10 16:27:53 -05:00
jeremystretch
5a3e99626d Simplify add/import/export button invocation 2022-03-10 15:56:09 -05:00
jeremystretch
655bc49fad Clean up form select widgets 2022-03-07 15:11:57 -05:00
jeremystretch
cd29293dd6 Merge v3.1.9 2022-03-07 10:55:30 -05:00
Jeremy Stretch
bffe63a233
Merge pull request #8793 from seros1521/fix_8715
Fixes #8715: eliminates duplicates when used in many-to-many field constraints
2022-03-07 09:27:14 -05:00
jeremystretch
6423b386d2 Closes #8758: Allow empty string substitution when renaming objects in bulk 2022-03-04 13:30:32 -05:00
seros1521
90257e9dee Fixes #8715: eliminates duplicates when used in many-to-many field constraints
When using permissions that use tags, a user may receive multiple permissions
of the same type if multiple tags are assigned to the device. This causes the
RestrictedQuerySet class to generate a query similar to this:

>>> dcim.models.Device.objects.filter(Q(tags__name='tag1')|Q(tags__name='tag2'))
<ConfigContextModelQuerySet [<Device: device1>, <Device: device1>]>

This query returns the same object twice if both tags are assigned to it. This
is due to the use of the django-taggit library. The library's documentation
describes this behavior as expected and suggests using an explicit distinct()
call in queries to avoid duplicates.

However, the use of DISTINCT in queries has a global side effect -
deduplication of responses, which may or may not be acceptable behavior
(depending on further use). Since it is not known how RestrictedQuerySet will
be used in the rest of the code, it was decided to dedupe using a subquery.
2022-03-04 14:37:05 +07:00
jeremystretch
21e3159711 Hide table checkboxes when no bulk actions are enabled 2022-03-02 16:13:59 -05:00
jeremystretch
5f8af6ad66 Closes #8779: Enable the use of ChoiceSet by plugins 2022-03-02 11:43:28 -05:00
Peter Eckel
4dc428d75b Closes #8764: Correct the endpoint for plugin API view names 2022-03-01 13:11:49 +01:00
jeremystretch
d6c272cfd6 Fixes #8764: Correct view name resolution for dynamic form fields 2022-02-28 15:17:49 -05:00
jeremystretch
6604ebfd01 Fix tag background color 2022-02-22 13:10:04 -05:00
jeremystretch
d9696ae34c Fixes #8714: Remove label from comments form field 2022-02-22 10:47:02 -05:00
jeremystretch
aa85ae89c1 Merge v3.1.8 2022-02-15 10:05:07 -05:00