-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Limit tags to specific object types #11541
Comments
I think this makes sense. With regard to associating tags to object types, we would need to employ validation to check for any existing assignments to objects of non-specified types, but that should be fairly straightforward. |
I'd be interested to know how custom fields deal with this case today: you create a custom field, link it to object type A, create some data on objects of that type, then unlink the custom field from that object type. Experimentally: the custom field data is quietly deleted. For tags, that might be a bit drastic, because you are going from the current open situation (allow this tag on all object types) to a more restricted option, and there's a risk of accidentally deleting tags. I guess you could give the user a choice:
Or maybe just do the second option (the safe thing) automatically. If the user wants to manually remove all the tags X from those objects, then remove those object types from the tag, they can do so. |
@candlerb unfortunately such functionality would require a wizard-like input. A validation error could be raised instead which would require a manual intervention to achieve either of the above... What do you think? |
A validation error would be fine, as long as it listed all the object types which had this tag but were not included in the set, and returned to the same populated form. Then the user could add them by hand to the set of enabled object types for that tag. As for "wizard" I don't think it needs to be that complex:
|
NetBox version
v3.4.2
Feature type
Data model extension
Proposed functionality
Currently, once you've created a tag, it can be assigned to any object of any type.
I propose that tags can be optionally linked to a set of object types, in the same way that custom fields are linked to object types. Then, when editing a particular object, you'd only be able to select and add tags bound to that object's type.
Tags which are not bound to any object type would be continue to be applicable to all object types.
Use case
There are a wide range of uses for tags: classifying devices, interfaces, IP addresses etc. However, many tags are only meaningful to specific object types.
Being able to restrict them in this way would:
Database changes
There would need to be a new many-to-many join between tag and content type, just like custom fields:
External dependencies
None
The text was updated successfully, but these errors were encountered: