refactor(ui/design): replace JSON inputs with structured editors

Two new shared components in Components/Shared:
  - ParameterListEditor: table of rows (name + type + item type + required + remove)
  - ReturnTypeEditor: single type (+ item type when List)

Both round-trip the same JSON shape already stored on the entity:
  parameters: [{"name":"x","type":"String","required":true},...]
  return:     {"type":"List","itemType":"Integer"} | null

Type set follows the Inbound API validator (Boolean, Integer, Float,
String, Object, List). Legacy values normalize on read — Int32 / int64
/ Double / Decimal / lowercase string / etc all coalesce to the new
set so existing rows render correctly. Re-saving persists the
normalized form.

Applied to:
  - SharedScriptForm
  - TemplateEdit Add Script form (also surfaces ParameterDefinitions
    + ReturnDefinition which the entity supported but the form was
    never wiring through)
  - ApiMethodForm

Graceful degradation: invalid JSON is shown with a "Start fresh"
escape hatch instead of crashing the form.
This commit is contained in:
Joseph Doherty
2026-05-12 04:22:58 -04:00
parent eb1d6872ef
commit 1b98d37919
5 changed files with 343 additions and 25 deletions
@@ -29,14 +29,12 @@
<input type="number" class="form-control" @bind="_timeoutSeconds" min="1" />
</div>
<div class="mb-3">
<label class="form-label">Params (JSON)</label>
<input type="text" class="form-control" @bind="_params"
placeholder='[{"name":"id","type":"Int32"}]' />
<label class="form-label">Parameters</label>
<ParameterListEditor Json="@_params" JsonChanged="@(v => _params = v)" />
</div>
<div class="mb-3">
<label class="form-label">Returns (JSON)</label>
<input type="text" class="form-control" @bind="_returns"
placeholder='{"type":"Boolean"}' />
<label class="form-label">Return value</label>
<ReturnTypeEditor Json="@_returns" JsonChanged="@(v => _returns = v)" />
</div>
<div class="mb-3">
<label class="form-label">Script</label>