Edit Floorplan Screen Enhancements and Bug Fixes
Update for v2: Removed pagination/table sorting fixes from PR and removed version update. Pagination fixes are being fixed in: https://github.com/netbox-community/netbox-floorplan-plugin/pull/85
Hi,
I wanted to submit a number of enhancements/bug fixes to the plugin I have made over the past few months for our team and what we are using in our team’s Netbox environment. I think the community would benefit from these changes.
For these changes I have updated the version of the plugin to 0.9.0 to meet your versioning requirements
All of the changes affect the Edit Floorplan screen:
Here’s an example of what the Edit Floorplan Screen would look like after the changes:
The big difference in behavior has to do with the new “Simple Rack” and “Advanced Rack” button options, which are described below. There are similar ones for devices
Enhancements Made:
-
Created "Advanced Rack/Advanced Device" objects/buttons that will have additional information added (status + rack role (only applies to racks) + tenant assignment). These advanced objects also have the following capabilities:
- Default fill color of rack added to topology will match the rack role color it is assigned to . Fixes: https://github.com/netbox-community/netbox-floorplan-plugin/issues/29
- Dynamic text sizing and line spacing so rack/device information doesn't go outside of the rack rectangle
- Default Text Color of Black (#000000)
- Ability to change the text color using a new
Text Colorpicker. - Ability to hide/show the status, role, tenant information using the
Rack/Device Display Optionscheckboxes
-
Added "Simple Rack/Simple Devices" buttons, which is added for backwards compatibility purposes. This adds a rack or device to the topology with the original add_floorplan_object() function that existed in the version of the plugin before these changes were made. This is so people upgrading to this version of the plugin don’t have their racks messed up. The function was renamed to add_floorplan_object_simple()
-
Added
Rack Rolecolumn (named role) to rack table which is helpful to easily determine the role for a rack -
Added
Text Colorpicker which allows you to change the text color -
Change default color for Labels to Black (#000000)
Bug Fixes:
- Fixes an issue where a rack rectangle is not drawn when a rack role hasn't been assigned
- Fixes an issue where selecting multiple rack or device objects and trying to edit attributes (such as rack fill color) did not work
- Fixes an issue where selecting a rack didn't update the
Set Colorpicker to show the current color - Fixes an issue where some hex colors were not properly defined as 6 digit RGB colors (Example: #FFFF instead of #FFFFFF)
Testing:
Here’s a demo showing the new behavior in action, which has also been added to the README:
Tested this using Netbox 4.3.x and Netbox 4.4.x using netbox_docker project
I don’t have a public PyPi package repo I can share the new version of the plugin on, so you would need to have that setup in your environment if you want to test drive the changes. I have gotten the lint test in your repo to pass.
It seems that when changing the page or page-size, the url of the whole page changes which leads me to believe that the table isn't embedded correctly. Check out #85 for a fix. Feel free to steal it
@musique88 thank you for this comment and your fix!
I also noticed the url for the embedded table changed for the table when changing the page size and when sorting as well, by looking at the browser inspector
Looking at your changes, it looks a lot simpler than the fix I implemented in my PR related to the HTMX calls. I will integrate your changes, and remove mine from my development environment and then test to see if the issue is still fixed. I can let you know my results. If they are still successful, I will update this PR to remove my own changes.
Thanks both, I'm going to look through musiques PR first, but will keep eyes on this
Also - I'm going to update docs to remove the updating the version; thats something we will look to do
Ok sounds good, thank you. I will remove the version update from my PR when I update it
@musique88 just wanted to let you know I tested your fix in my dev environment, instead of my fix, and all was good. I'll go ahead and remove my code I added in this PR and just bring in your final fixes once it's merged into main. I didn't run into any merge conflicts putting your code in, so my code should still merge in cleanly
Have gone ahead and removed the pagination fixes and version number update from my PR