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

Overhaul UI and upgrade to Bootstrap 5 #5893

Closed
jeremystretch opened this issue Feb 27, 2021 · 11 comments
Closed

Overhaul UI and upgrade to Bootstrap 5 #5893

jeremystretch opened this issue Feb 27, 2021 · 11 comments
Assignees
Labels
status: accepted This issue has been accepted for implementation type: housekeeping Changes to the application which do not directly impact the end user
Milestone

Comments

@jeremystretch
Copy link
Member

Proposed Changes

NetBox currently uses the outdated Bootstrap 3 CSS/JS framework for its user interface. Bootstrap 5 is currently in late beta and should be released in the near future. This issue proposes adopting BS5, and in the process giving the entire UI a substantial refresh.

However, as @checktheroads notes in a recent discussion, it's worth noting that BS5 explicitly drops support for Internet Explorer (in favor of Edge). If the community is opposed to this, we can consider adopting BS4 instead.

If accepted, I am willing to take the lead on this initiative. I've already been experimenting with some layouts and templates offline, and am encouraged by my progress thus far.

Justification

  • Modernizes the UI
  • BS5 introduces a suite of utility classes that allows for more flexible customization
@jeremystretch jeremystretch added type: housekeeping Changes to the application which do not directly impact the end user status: under review Further discussion is needed to determine this issue's scope and/or implementation labels Feb 27, 2021
@ryanmerolle
Copy link
Contributor

I say death to IE, but seriously most people using NetBox have other means of browsers these days. Nearly all shops allow Chrome.

A drop for internet explorer may not even kill the entire usability but just greatly hamper the new functionality. Which might not be the end of the world.

@jeremystretch
Copy link
Member Author

I also have to think that organizations stuck on Internet Explorer probably aren't running the latest and greatest NetBox release right away either.

@thatmattlove
Copy link
Contributor

To add some clarity, the list of browsers Bootstrap 5 supports is here. TL;DR: Everything except IE. It's worth noting that I (re)built hyperglass with React and several other dependencies, and inadvertently dropped IE support. I've yet to hear a word from any users that this has been a problem (and this is an app meant to be end-user facing!). Additionally, my organization's website has been IE-free for over a year with nary a complaint.

It's also worth noting that one of the other major CSS frameworks out there — Tailwind — also no longer supports IE. I tend to agree with both @jeremystretch & @ryanmerolle — it's likely that either Netbox users are already using a modern browser, or if not, they're probably not running modern Netbox.

I would also be willing to contribute heavily to this. Something else to note with Bootstrap 5 is that jQuery is no longer a dependency. I think this is excellent - I'm very much in favor of jQuery dying a firey death. However, I'm sure much of the Javascript written for NetBox would need to be refactored to vanilla JS in order to drop the jQuery dependency. I'd be happy to help with this as well.

@ryanmerolle
Copy link
Contributor

@checktheroads I never heard of hyperglass, but you got me intrigued.

@jeremystretch
Copy link
Member Author

I would also be willing to contribute heavily to this.

Awesome!

I'm sure much of the Javascript written for NetBox would need to be refactored to vanilla JS in order to drop the jQuery dependency.

I think the biggest hurdle is going to be Select2, which I think relies jQuery. I haven't started digging into it yet though.

@thatmattlove
Copy link
Contributor

Choices.JS seems to be the defacto jQuery-free solution. I've not played with it, but the API looks reasonable enough. As long as we can get the styling right, it should do the job.

@jeremystretch
Copy link
Member Author

Well I'm pumped to knock this out. Let's sync up sometime next week and see if we can come up with a plan of attack.

@sdktr
Copy link
Contributor

sdktr commented Mar 1, 2021

Before rebuilding the UI and putting significant work into it I want to raise the following point:
Shouldn't the Netbox UI be an API-client of the Netbox REST API? With a correctly documented OpenAPI spec a good frontend framework would be able to pick up the hard work of CRUD action generation.
It would save some work on the duplicate code parts that cause divergent behaviour between Netbox UI and Netbox API every now and then.

I'm not stating implementing a complete new UI method is a small task (at all!), just that work on an upgraded bootstrap might be redundant if this path would be desired in the long run.

Example frontend generator code for OpenAPI spec'd backend

@jeremystretch
Copy link
Member Author

jeremystretch commented Mar 1, 2021

Shouldn't the Netbox UI be an API-client of the Netbox REST API?

Ideally, yes, and we've discussed this a good deal, but the practical challenges of implementing this are enormous. Until we can secure the resources necessary for such an endeavor, we should stick with cosmetic changes, which need to be done anyway.

Edit: The migration to a fully API-backed UI will likely effect "NetBox v3.0" and will require substantial changes to the REST API. To avoid confusion, it should be undertaken as its own separate initiative, and not bundled with the more routine features and data model changes that we see implemented in 2.x releases.

@jeremystretch
Copy link
Member Author

I spoke with @checktheroads @DanSheps and @ryanmerolle about this initiative in detail today. We've identified a few key areas of improvement:

  • Restructure the existing Django templates to reduce redundancy and cruft
  • Adopt a bundling framework (e.g. Webpack or Rollup) to improve bundling of JS and CSS resources
  • Eliminate our dependency on jQuery and jQuery-UI
  • Change the layout to a dashboard style and adopt a more custom look

Obviously, nothing is set in stone at this point, but I feel like we have a solid plan of attack, and a real shot at getting this done as part of the v2.11 release. I'm going to start on cleaning up the templates this week, and @checktheroads will start on adopting a bundling framework and determining our options for replace jQuery. We won't be pursuing an API-backed frontend for this release, however this work should make doing so in the future (e.g. for v3.0) much more attainable.

@jeremystretch
Copy link
Member Author

After speaking with @checktheroads and the other maintainers, we've decided to push the UI work back to v2.12 to avoid jamming too much change into a single release. This decision allows us to release v2.11 much sooner than anticipated, and ensures that the UI overhaul isn't rushed.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 2, 2021
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: housekeeping Changes to the application which do not directly impact the end user
Projects
None yet
Development

No branches or pull requests

4 participants