fix(ui): preserve visibility selection when editing entities#3402
fix(ui): preserve visibility selection when editing entities#3402crivetimihai merged 5 commits intoIBM:mainfrom
Conversation
…ss edits Signed-off-by: Oriol Morros Vilaseca <OM368@student.aru.ac.uk>
The handleEditA2AAgentFormSubmit handler was missing the
formData.append("visibility", ...) call that all other edit
and create handlers have. This ensures visibility is preserved
when editing A2A agents, matching the pattern in the other five
edit handlers.
Closes IBM#3391
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Cover all six edit form submit handlers to verify that the visibility field selected by the user is included in the submitted FormData: tool, prompt, gateway, server, resource, and A2A agent. Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Review & Rebase SummaryRebased onto What's in this PRThe original fix adds Changes added during review
Verification
No security, performance, or regression issues found. |
crivetimihai
left a comment
There was a problem hiding this comment.
LGTM — verified via unit tests, curl API tests, and Playwright E2E. Added missing A2A handler fix and test coverage for all 6 edit handlers.
crivetimihai
left a comment
There was a problem hiding this comment.
LGTM — verified via unit tests, curl API tests, and Playwright E2E. Added missing A2A handler fix and test coverage for all 6 edit handlers.
2eb3b16 to
82390c7
Compare
…visibility entries
formData.append() creates a second visibility key in the submitted
FormData. Since Starlette's ImmutableMultiDict resolves duplicate
keys to the last value, this introduces ordering-dependent behavior.
Replace all 12 append("visibility", ...) calls (6 create + 6 edit
handlers) with set(), which replaces the existing entry instead of
duplicating it. Also strengthen tests to assert exactly one
visibility entry (toEqual([value]) instead of toContain(value)),
so they now fail if duplicates are reintroduced.
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
* fix: append visibility in edit form handlers to retain selection across edits
Signed-off-by: Oriol Morros Vilaseca <OM368@student.aru.ac.uk>
* fix(ui): add visibility append to A2A edit handler for consistency
The handleEditA2AAgentFormSubmit handler was missing the
formData.append("visibility", ...) call that all other edit
and create handlers have. This ensures visibility is preserved
when editing A2A agents, matching the pattern in the other five
edit handlers.
Closes #3391
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
* test(ui): add tests for visibility preservation in edit form handlers
Cover all six edit form submit handlers to verify that the
visibility field selected by the user is included in the
submitted FormData: tool, prompt, gateway, server, resource,
and A2A agent.
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
* fix(ui): use formData.set() instead of append() to prevent duplicate visibility entries
formData.append() creates a second visibility key in the submitted
FormData. Since Starlette's ImmutableMultiDict resolves duplicate
keys to the last value, this introduces ordering-dependent behavior.
Replace all 12 append("visibility", ...) calls (6 create + 6 edit
handlers) with set(), which replaces the existing entry instead of
duplicating it. Also strengthen tests to assert exactly one
visibility entry (toEqual([value]) instead of toContain(value)),
so they now fail if duplicates are reintroduced.
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
* chore: fix trailing whitespace in sandbox.rs tests
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
---------
Signed-off-by: Oriol Morros Vilaseca <OM368@student.aru.ac.uk>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
* fix: append visibility in edit form handlers to retain selection across edits
Signed-off-by: Oriol Morros Vilaseca <OM368@student.aru.ac.uk>
* fix(ui): add visibility append to A2A edit handler for consistency
The handleEditA2AAgentFormSubmit handler was missing the
formData.append("visibility", ...) call that all other edit
and create handlers have. This ensures visibility is preserved
when editing A2A agents, matching the pattern in the other five
edit handlers.
Closes #3391
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
* test(ui): add tests for visibility preservation in edit form handlers
Cover all six edit form submit handlers to verify that the
visibility field selected by the user is included in the
submitted FormData: tool, prompt, gateway, server, resource,
and A2A agent.
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
* fix(ui): use formData.set() instead of append() to prevent duplicate visibility entries
formData.append() creates a second visibility key in the submitted
FormData. Since Starlette's ImmutableMultiDict resolves duplicate
keys to the last value, this introduces ordering-dependent behavior.
Replace all 12 append("visibility", ...) calls (6 create + 6 edit
handlers) with set(), which replaces the existing entry instead of
duplicating it. Also strengthen tests to assert exactly one
visibility entry (toEqual([value]) instead of toContain(value)),
so they now fail if duplicates are reintroduced.
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
* chore: fix trailing whitespace in sandbox.rs tests
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
---------
Signed-off-by: Oriol Morros Vilaseca <OM368@student.aru.ac.uk>
Signed-off-by: Mihai Criveti <crivetimihai@gmail.com>
Co-authored-by: Mihai Criveti <crivetimihai@gmail.com>
Signed-off-by: Yosief Eyob <yosiefogbazion@gmail.com>
🔗 Related Issue
Closes #3391
📝 Summary
Edit form submit handlers (
handleEditServerFormSubmit,handleEditToolFormSubmit,handleEditGatewayFormSubmit,handleEditResFormSubmit,handleEditPromptFormSubmit) were not appendingthe
visibilityfield to FormData before submission. This caused the backend to default to"private",silently overwriting the user's original visibility selection on every edit. This PR adds
formData.append("visibility", formData.get("visibility"))to all five edit handlers, matching the patternalready used in the corresponding create handlers.
🏷️ Type of Change
🧪 Verification
make lintmake testmake coverage✅ Checklist
make black isort pre-commit)📓 Notes (optional)
The change is minimal, one line added to each of the five edit form submit handlers in
mcpgateway/static/admin.js. The create handlers already had this pattern; the edit handlers were simplymissing it. The
team_idfield is already handled via hidden inputs injected by the respectiveedit*()functions, so no changes were needed there (except for
handleEditPromptFormSubmitwhich already appendedteam_id).