Skip to content

Fix polygon footprint preview (#133)#135

Merged
sfoale merged 2 commits into
masterfrom
fix-polygon-preview
Jul 3, 2026
Merged

Fix polygon footprint preview (#133)#135
sfoale merged 2 commits into
masterfrom
fix-polygon-preview

Conversation

@sfoale

@sfoale sfoale commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

Fixes #133

  • Parse polygon preview input with parse_multi_polygon instead of json.loads so the [(x,y)...]#[...] format renders.
  • Surface back end errors in the front end instead of silently failing to plot.
  • Show a login-specific message for 401/403 on instrument submit from the website.
  • Add tests.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes polygon footprint preview rendering in the UI by aligning polygon parsing with the backend’s footprint parser, improving error surfacing to the frontend, and adding FastAPI tests for polygon preview behavior.

Changes:

  • Update /ajax_preview_footprint to parse polygon input via parse_multi_polygon (supporting [(x,y)...]#[...] and newline-separated formats) and return parse errors to the client.
  • Improve Plotly polygon rendering semantics (mode="lines", fill="toself") for footprint previews.
  • Frontend: surface backend { error } preview responses as exceptions, and show a login-specific message on 401/403 instrument submit failures; add UI preview tests for polygon cases.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
tests/fastapi/test_ui.py Adds test coverage for single/multi/invalid polygon preview responses.
server/routes/ui/preview_footprint.py Switches polygon preview parsing to parse_multi_polygon, returns parsing errors, and adjusts Plotly trace fill behavior.
frontend/src/lib/services/instrumentService.ts Improves error handling for preview responses and adds clearer 401/403 messaging for instrument submission.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread server/routes/ui/preview_footprint.py Outdated
Comment thread frontend/src/lib/services/instrumentService.ts Outdated

@swyatt7 swyatt7 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moira and I tested this. Works as expected :)

thanks

@moira-andrews moira-andrews left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and was able to preview footprint successfully

@sfoale
sfoale merged commit 2095043 into master Jul 3, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to preview polygon footprints

4 participants