feat(ui): add control template editing and creation support#159
Open
lan17 wants to merge 6 commits intolev/controltemplatesfrom
Open
feat(ui): add control template editing and creation support#159lan17 wants to merge 6 commits intolev/controltemplatesfrom
lan17 wants to merge 6 commits intolev/controltemplatesfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
bb8601a to
7b3bbed
Compare
- Add template-backed control detection and "Template" badge in controls list - Add TemplateEditContent with parameter form, read-only summary, and Parameters/Full JSON mode toggle for editing template-backed controls - Add TemplateParamForm component that auto-generates form inputs from template parameter definitions (string, string_list, enum, boolean, regex_re2) - Add TemplatePreview component with debounced render endpoint calls that strips template metadata from the preview output - Wire enable/disable toggle to use PATCH for template-backed controls (avoids 409 from PUT /data on template-backed controls) - Template-backed controls can be created via "From JSON" by pasting a TemplateControlInput payload - Add template types and render API method to client (manual until OpenAPI types are regenerated) - Add 13 Playwright tests covering template badge, parameter form editing, JSON toggle, preview stripping, and raw control regression
- Fix import sort order in template-param-form.tsx
- Fix jsx-no-leaked-render in template-preview.tsx (use ternary)
- Fix set-state-in-effect in template-edit-content.tsx by removing the
useEffect sync and using key={control.id} to remount on control change
87eb82d to
e192acd
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this does
Adds UI support for creating and editing template-backed controls. This PR targets the
lev/controltemplatesbranch which implements the server-side template rendering and API changes.video:
Screen.Recording.2026-04-01.at.4.34.22.PM.mov
How it works
Creating template-backed controls: Users paste a
TemplateControlInputJSON via the existing "From JSON" flow. The server discriminates template payloads from raw payloads and handles rendering transparently — no separate UI flow needed.Editing template-backed controls: When a user opens a template-backed control, the edit modal detects template metadata and shows a dedicated editor with:
TemplateControlInputJSON for power usersControls list: Template-backed controls show a "Template" badge. The enable/disable toggle uses PATCH (not PUT /data) to avoid the 409 that the server returns when sending a raw
ControlDefinitionto a template-backed control.New components
TemplateParamFormTemplatePreviewPOST /control-templates/renderand stripstemplate/template_valuesfrom the output so users see what the engine seesTemplateEditContentTemplateControlInputpayloaduseRenderTemplateTest plan
13 Playwright tests covering:
All 123 tests pass (110 existing + 13 new), 0 regressions.
Notes
types.tsuntilnpm run fetch-api-typesis run against the updated server. They can be replaced with generated types after.CreateFromTemplatemodal component is included but not wired up (we decided to use "From JSON" instead of a separate creation flow). It can be removed or repurposed later.