Skip to content
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

Leverage HTMX to simplify rendering of complex form fields #11891

Closed
jeremystretch opened this issue Mar 2, 2023 · 10 comments
Closed

Leverage HTMX to simplify rendering of complex form fields #11891

jeremystretch opened this issue Mar 2, 2023 · 10 comments
Labels
type: feature Introduction of new functionality to the application

Comments

@jeremystretch
Copy link
Member

NetBox version

v3.4.5

Feature type

Change to existing functionality

Proposed functionality

#11625 introduced the ability to dynamically render object edit forms in response to changing field selections. We can leverage this new ability to simplify forms which have fields that can reference different types of related objects.

For example, the circuit termination edit form allows the user to select either a site or a provider network as the "attached" object:

Screenshot 2023-03-02 at 13-34-09 Editing circuit termination 1002840283 Termination Z NetBox

When the "site" tab is selected, the three relevant fields (region, group, and site) are displayed. When the "provider network" tab is selected, these are replaced with two different fields (provider and provider network). All five of these fields are declared on the form, and the values of all five are sent when the form is submitted. This can be confusing to the user, especially when field validation error messages end up on a hidden tab (as in #11816, for instance).

We can change the tabs to a dropdown selection field that triggers the form to re-render automatically in response to the related object type changing, and return only the relevant fields.

Use case

This change will simplify the appearance of forms within the UI, obviating the need to hide some fields behind tabs. It will also eliminate the need for many of our custom form templates.

Database changes

No response

External dependencies

No response

@jeremystretch jeremystretch added type: feature Introduction of new functionality to the application status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Mar 2, 2023
@jeremystretch jeremystretch changed the title Leverage HTMX to simpify rendering of complex form fields Leverage HTMX to simplify rendering of complex form fields Mar 10, 2023
@jeremystretch jeremystretch added status: accepted This issue has been accepted for implementation and removed status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Mar 10, 2023
@jeremystretch jeremystretch added this to the v3.5 milestone Mar 10, 2023
@jeremystretch jeremystretch self-assigned this Mar 10, 2023
@jeremystretch jeremystretch removed this from the v3.5 milestone Mar 28, 2023
@jeremystretch jeremystretch removed their assignment Apr 3, 2023
@jeremystretch jeremystretch added status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation and removed status: accepted This issue has been accepted for implementation labels Apr 3, 2023
@dhenschen
Copy link
Contributor

I would like to take ownership of this issue please.

@abhi1693 abhi1693 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 May 9, 2023
@arthanson
Copy link
Collaborator

@dhenschen I'm working on something related to this for cabling, so let me know any progress you get on this and I will let you know what I come up with.

@dhenschen
Copy link
Contributor

@arthanson, Are these the HTMX changes you were referencing: #12491

@arthanson
Copy link
Collaborator

@dhenschen not that one, it was for cable terminations - I am still working on it in the background so no PR yet.

@dhenschen
Copy link
Contributor

dhenschen commented May 22, 2023

@jeremystretch, I've identified the following templates that follow the same pattern as circuit termination and could potentially benefit from HTMX improvements:

  • circuittermination_edit.html
  • inventoryitem_edit.html
  • l2vpntermination_edit.html
  • service_edit.html
  • vlan_edit.html
  • ipaddress_edit.html
  • Adding a custom field

To clarify the scope of this issue, would you like all forms that follow the same model as circuit termination to be updated as part of this issue? If so, would you prefer separate pull requests for each form to facilitate the review process?

@dhenschen
Copy link
Contributor

dhenschen commented May 22, 2023

@arthanson, I've made progress on this issue and created a pull request at #12675.

Regarding the implementation, I'm considering adding another database field to facilitate this UI change. It appears to be the cleanest approach so far, and it may enable us to perform additional validation on this and similar forms if desired. I would appreciate your input and guidance on whether this approach aligns with our objectives.

Please review the pull request and let me know your thoughts.

dhenschen added a commit to dhenschen/netbox that referenced this issue May 26, 2023
dhenschen added a commit to dhenschen/netbox that referenced this issue May 26, 2023
dhenschen added a commit to dhenschen/netbox that referenced this issue Jun 2, 2023
@DanSheps DanSheps removed the status: accepted This issue has been accepted for implementation label Aug 11, 2023
@DanSheps DanSheps added the status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation label Aug 11, 2023
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Do not attempt to circumvent this process by "bumping" the issue; doing so will result in its immediate closure and you may be barred from participating in any future discussions. Please see our contributing guide.

@github-actions github-actions bot added the pending closure Requires immediate attention to avoid being closed for inactivity label Nov 10, 2023
Copy link
Contributor

This issue has been automatically closed due to lack of activity. In an effort to reduce noise, please do not comment any further. Note that the core maintainers may elect to reopen this issue at a later date if deemed necessary.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 10, 2023
@DanSheps DanSheps added needs milestone Awaiting prioritization for inclusion with a future NetBox release and removed status: needs owner This issue is tentatively accepted pending a volunteer committed to its implementation pending closure Requires immediate attention to avoid being closed for inactivity labels Dec 13, 2023
@DanSheps DanSheps reopened this Dec 13, 2023
@DanSheps
Copy link
Member

Re-opening this as I believe it was closed in error. @jeremystretch do we still want to move forward with this?

@jeremystretch
Copy link
Member Author

No; it's too broad. We'll need to open more detailed FRs scoping specific work to move this initiative forward.

@jeremystretch jeremystretch closed this as not planned Won't fix, can't repro, duplicate, stale Dec 13, 2023
@jeremystretch jeremystretch removed the needs milestone Awaiting prioritization for inclusion with a future NetBox release label Dec 13, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: feature Introduction of new functionality to the application
Projects
None yet
Development

No branches or pull requests

5 participants