Skip to content

Custom fields with default values appear as applied filters in object list views #8314

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jasonyates opened this issue Jan 11, 2022 · 8 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@jasonyates
Copy link

NetBox version

3.1.2

Python version

3.8

Steps to Reproduce

Create a 'Selection' custom field with no default value applied to DCIM -> Sites
Visit /dcim/sites

Filter tab aways shows [1] filter applied. No filter shows applied on the table view itself

Screenshot 2022-01-11 at 16 00 11

Apply an actual filter, i.e. Status: Active
2 filters show applied. The one actually applied + the phantom custom field with an empty value

Screenshot 2022-01-11 at 16 02 29

Expected Behavior

Custom field filter should not be applied by default?

Observed Behavior

Filter tab aways shows [1] filter applied. No filter shows applied on the table view itself

@jasonyates jasonyates added the type: bug A confirmed report of unexpected behavior in the application label Jan 11, 2022
@jeremystretch
Copy link
Member

Create a 'Selection' custom field with no default value applied to DCIM -> Sites

What name are you assigning to the field?

@jeremystretch jeremystretch added the status: revisions needed This issue requires additional information to be actionable label Jan 11, 2022
@jasonyates
Copy link
Author

It's a pretty basic custom field with no validation rules and 5 selection options configured as below. Name is 'SD-WAN Deployment Type'

Screenshot 2022-01-11 at 18 57 40

@jeremystretch jeremystretch removed the status: revisions needed This issue requires additional information to be actionable label Jan 11, 2022
@jeremystretch
Copy link
Member

Name is 'SD-WAN Deployment Type'

This name should fail validation when attempting to save the custom field, as only alphanumeric characters and underscores are permitted as of v3.1.1 (see #8030).

At any rate, I'm not able to reproduce this on v3.1.5, even using the same exact field name (by bypassing validation).

@jasonyates
Copy link
Author

This name should fail validation when attempting to save the custom field, as only alphanumeric characters and underscores are permitted as of v3.1.1 (see #8030).

At any rate, I'm not able to reproduce this on v3.1.5, even using the same exact field name (by bypassing validation).

Are there any debug logs worth collecting before I try and re-save the custom field without the - in the name? I'm able to replicate the behaviour across user accounts and browsers.

Even hitting 'Clear All' still results in Filter [1] showing in the tab.

@jeremystretch
Copy link
Member

See if you can reproduce it on the demo instance (which is running v3.1.5): https://demo.netbox.dev/

@jasonyates
Copy link
Author

See if you can reproduce it on the demo instance (which is running v3.1.5): https://demo.netbox.dev/

I can immediately replicate this on the demo instance once I add the same custom field, even once complying with the new name requirements.

Screenshot 2022-01-11 at 19 36 34

@jeremystretch
Copy link
Member

Looks like this only occurs when you've defined a default value for the custom field. Again, this is why it's so important to note every step taken to reproduce the issue when opening a bug report: It saves a lot of time.

@jeremystretch jeremystretch added the status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation label Jan 11, 2022
@jasonyates
Copy link
Author

Looks like this only occurs when you've defined a default value for the custom field. Again, this is why it's so important to note every step taken to reproduce the issue when opening a bug report: It saves a lot of time.

My mistake. When I looked at the custom field when creating the report, I assumed N/A meant no default value as opposed to the fact I'd actually set it to N/A.

@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation labels Jan 11, 2022
@jeremystretch jeremystretch self-assigned this Jan 11, 2022
@jeremystretch jeremystretch changed the title DCIM Sites table applies custom field as filter Custom fields with default values appear as applied filters in object list views Jan 11, 2022
larsks pushed a commit to larsks/netbox that referenced this issue Mar 8, 2022
…s from appearing as applied filters erroneously
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

2 participants