Skip to content

Build installation configuration forms from the app's schema - #159

Open
vitramir wants to merge 10 commits into
mainfrom
app-configuration-schema
Open

vitramir wants to merge 10 commits into
mainfrom
app-configuration-schema

Conversation

@vitramir

Copy link
Copy Markdown
Contributor

Installing an app becomes answering labelled questions rather than composing a JSON document against documentation held in another tab. See Console — Configuration Forms.

Depends on agynio/api#197.

What changes

  • lib/configurationSchema.ts — reads the reported schema, validates in-form, decides what to submit
  • ConfigurationForm — one field per property, used by install, update, and (read-only) installation detail
  • Entity pickers for x-agyn-ref: an agent reference is a dropdown of agents in the organization, not a field to paste a UUID into. A stored value that is no longer in the list says so, rather than rendering blank — a deleted target would otherwise look identical to "never set".
  • format: password renders obscured with an eye toggle inside the field
  • Deprecated properties are hidden until the installation carries a value, then shown as deprecated and clearable — clearing is what eventually lets the app drop the property
  • JSON editor fallback when the app has reported no schema, or when stored configuration does not match the current schema
  • App detail shows the reported schema and when it was reported

Worth knowing

The install and update dialogs now keep their header and footer in place while the fields scroll. DialogContent is a grid with overflow-y-auto, so a long form scrolled the title and the submit button out of view. Left as an override on these two dialogs rather than a change to the base component, which cannot know which child is the scrollable body.

A format: password value is not withheld by the platform — it is stored and returned in plain text like any other. The masking keeps a token off a screen share and claims nothing more; the form does not pretend otherwise.

Installing an app is answering labelled questions rather than composing a JSON
document against documentation held in another tab. An app that has reported no
schema still gets the JSON editor — the only honest option when nothing
describes what belongs in the configuration.

A reference property becomes a picker over that entity kind in the
organization, which is most of the difference between this and pasting a UUID.
A secret reads as Set with a Replace action and is never sent to the browser;
leaving it untouched omits it from the write so the stored value survives.

A deprecated property is hidden until the installation carries a value for it,
then shown as deprecated and clearable — clearing it is what eventually lets
the app drop the property.
The update dialog resolves the app's schema and renders the same generated form
as install, populated with the installation's stored values. A secret reads as
Set with a Replace action; leaving it untouched omits it from the write, so the
stored credential survives an edit to an unrelated field.

Stored configuration the current schema does not accept falls back to the JSON
editor with the offending properties named. A schema cannot stop accepting what
it already accepted, so this is never a deploy catching up with an
installation: it is configuration written before the app reported a schema, or
a reference whose target has since been deleted.
Installation detail renders the generated form read-only over the stored
values, so the configuration is legible without opening the dialog. When the
stored configuration no longer satisfies the schema it falls back to the key
count and names the offending properties, which is the state the Configure
dialog then repairs through the JSON editor.

App detail shows the schema the app reported and when. An app that has reported
none says so rather than showing an empty box: it reports at startup, so the
absence means it has not run yet.
google.protobuf.Struct fields are generated as plain JsonObject in protobuf-es
v2, so there is no toJson() to call. Calling it threw on every render of the
install and update dialogs, installation detail, and app detail — the feature
was broken in the browser.

An `as JsonObject` cast around the call is what let it compile. The cast is
gone; the types line up on their own now.

The dialog test that existed mocked only updateInstallation, so the schema path
never ran. The new test renders the generated form against the shape the API
actually returns, and covers every field kind, the Set/Replace secret, the
resolved reference name, deprecated visibility, and both JSON-editor fallbacks.
The platform stores and returns these values in plain text, so the Console
cannot claim to be withholding one. x-agyn-secret now does what it honestly
can: the field renders masked, with Show/Hide, so a token stays off a screen
share without anyone pretending it is protected.

Set/Replace is gone with the server-side redaction behind it, along with the
secretKeysSet plumbing and the rule that let a required secret pass validation
because the installation "already held" it.
The keyword is the right name for a property that names a Secret, which does
not exist yet. Keeping it as a display hint would mean migrating every app that
adopted it once it comes to mean something real, so it is rejected at report
time with an error naming the alternative.

format: password is standard JSON Schema and says only how to draw the field.
It is the one honored format that validates nothing, so gaining it on an
existing property is a compatible change where gaining uuid or email is not.
The Show/Hide button sat beside the input and crowded the row. The control now
lives inside the field, as an eye icon, with padding so a long token does not
run underneath it.

The icon carries no text, so the button is named by aria-label — and named for
the action rather than the state, which is what a reader expects from a
control. aria-pressed carries the state.
DialogContent is a grid with overflow-y-auto, so a long form scrolled the
title and the Install button out of view along with it — and with twenty
fields there is no way back to the action without scrolling past everything.

The two configuration dialogs become a column that clips: header and footer
hold, the field list takes the remaining height and scrolls. min-h-0 is what
makes that work — without it the flex child refuses to shrink and grows the
dialog past its max height instead of scrolling.

Left as an override on these two rather than a change to DialogContent: the
base component cannot know which child is the scrollable body, so making it
clip globally would leave every other dialog overflowing with nothing to
scroll.
Dockerfile.localtest builds against protos generated on the host, because the
api module carrying them is not published yet. It is a stopgap for testing on
the local VM, not something the repo should ship.
validateConfiguration lost its secretKeysSet parameter when the server stopped
redacting, and this call site kept passing an empty array.

It survived local checking because the repo's root tsconfig sets files: [] and
defers to project references, so tsc --noEmit at the root checks nothing at all
and exits clean. The script that actually checks this project is
`npm run typecheck`.
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.

1 participant