-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add usage of letters for rendering FP SVG. #79
Conversation
I like this idea. Let's do it! |
I had mentioned that we should consider having a generator for the increment #8 (comment) |
The latest commit is to support letters in the tile form. @itdependsnetworks I am fine with implementing generator if @joewesch allows more time. |
I like the idea, but I think what we have so far will be a good start as I believe it covers at least 80% of use cases. Let's count this as incremental progress toward the eventual goal and not mark this as closing/resolving the issue. |
I am still thinking if keeping x/y grid setting per object will give good user experience? Maybe it should be a global plugin setting, which is selected only once? |
Yes, a plugin setting default would be great, but still allow for grid specific override. Our client uses different grid patterns per Location. |
What is the changelog in the CI? I am not sure why it fails? |
This repo uses towncrier and requires a changelog fragment file: https://docs.nautobot.com/projects/floor-plan/en/latest/dev/contributing/#creating-changelog-fragments |
Thanks. Looks like my branch was checked out beginning of February and it didn't have |
Patryk, something isn't working right with the edit form. If I set one (or both) of the labels to letters and then edit the floor plan, the form field defaults back to numbers. |
Let me check that. |
Looks like it stopped working after changing form field to CharField. |
nautobot_floor_plan/templates/nautobot_floor_plan/floorplan_retrieve.html
Outdated
Show resolved
Hide resolved
nautobot_floor_plan/templates/nautobot_floor_plan/floorplan_retrieve.html
Outdated
Show resolved
Hide resolved
Update from code review Co-authored-by: Joe Wesch <10467633+joewesch@users.noreply.github.com>
@joewesch I have added unittests for the |
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.
Looks and works great now, thanks Patryk!
@glennmatthews would you mind giving this a once over? |
if self.letter_validator(field_name, value, axis) is not True: | ||
return 0 # required to pass model clean() method |
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.
Can you elaborate on this? I'd think that if the validator fails we should fail model clean?
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 was thinking to raise ValidationError
in here and I was expecting that it will stop here, but what happens is that ValidationError
exception is raised silently and it still goes to the model .clean() method, where it causes exception on the >
operator TypeError: '>' not supported between instances of 'str' and 'int'
, what results with an exception page in the UI.
This draft adds only SVG rendering options to use letters or numbers for the grid numbering axis labels.
Selecting letters for the X axis will make the FP look like a chessboard.
The downside is that for adding tiles it still uses numbers, because
FloorPlanTile
modelx_origin
andy_origin
fields are nowPositiveSmallIntegerField
.Potentially form could be changed to present numbers or letters for tile origins, and under clean() it could be covered back to numbers.