-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closes #8423: Allow assigning Service to FHRP Group, in addition to Device and VirtualMachine #19005
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
Conversation
26e36df
to
87cb4b7
Compare
FHRP Group details view should show the related services, either as related objects or a sub-table. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also - not sure if we want to change from tabbed interface for selection of assignment to dropdown - see discussion in maintainers channel chat.
netbox/ipam/migrations/0078_service_parent_object_id_service_parent_object_type.py
Outdated
Show resolved
Hide resolved
netbox/ipam/migrations/0081_service_ipam_servic_parent__563d2b_idx.py
Outdated
Show resolved
Hide resolved
Fixed |
@jnovinger test failing, not sure why: netbox/ipam/views.py:1435:9: SyntaxError: Cannot use |
@arthanson see #19112 |
Ah, this is actually a linting thing. I guess this is what the PR from Jeremy re: ruff and 3.10 python target is all about. |
Just realized I also missed updating the CSV import form for Services. Working on that now. |
@arthanson , this is ready for re-review now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple minor issues - also needs docs in docs/models/ipam/service.md add in the parent field, can look at scope on vlan group for template.
netbox/ipam/forms/bulk_import.py
Outdated
self.cleaned_data['parent'] = parent | ||
else: | ||
# If a parent object type is passed and we've made it to here, then raise a validation | ||
# error since an associated parent object or parent object id has nto be passed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type "nto be passed" -> "not been passed"
@@ -21,7 +21,7 @@ | |||
from utilities.forms.utils import get_field_value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you set parent type without the associated device, VM, FHRP Group and try to save there is no error given, should be a "Cannot set parent type without an associated object" message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Phew, this only took forever to figure out. After a fair amount of debugging compiled .ts, reading bootstrap docs, and finally understanding how those in-page "This field is required." messages get displayed, I discovered this is because of #18916.
The tl;dr is that the APISelector
's template changes the DOM tree structure just enough to break the way Bootstrap display's invalid feedback for fields. See my comment on the issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the work-around for this one is to just use Django's built in Select
widget, since with the HTMXSelect
widget on the parent_object_type
form field, the form is being rendered and a queryset attached to the parent
form field select, we don't necessarily need the APISelect
widget functionality.
The downside is that means no object selector modal for the parent
form field for the time being.
Alternatively, we solve #18916 real quick.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After discussing this in the maintainers call, we decided to move forward with this work as is re: the lack of validation messaging working in the DynamicModelChoiceField
. #18916 will be a follow up in a future patch release.
fa20cf6
to
385749c
Compare
@arthanson , please note that the migrations have changed, for a couple of reasons:
You'll need at least wind back the previous IPAM |
- fixes up ServiceSerializer to support write operations - fixes up GraphQL components: ServiceType and ServiceFilter - fixes broken tests - cleans up lint issues
a la ScopedForm
… nullable This changes an existing (within the branch) migration, so if you're testing this you'll need to back up migrations and re-run.
385749c
to
96a5b90
Compare
Closes: #8423
Service.clean()
, now enforced by the GFK and in model formsServiceImportForm
to work with the newService.parent
GFK