Skip to content

Phase 5b3: live choice lists and a live widget preview - #51

Merged
cerebrate merged 2 commits into
masterfrom
feature/phase5b3-live-choices
Oct 17, 2026
Merged

cerebrate merged 2 commits into
masterfrom
feature/phase5b3-live-choices

Conversation

@cerebrate

Copy link
Copy Markdown
Member

Summary

From the 5b2 soak: the Kuma widget's monitor was typed as an ID, and the link dialog's preview didn't show widgets.

Choice lists

  • Integrations publish named choice lists through IIntegration.GetChoicesAsync (listKey, ConnectionContext). A list is a ChoiceList of OptionChoices, each with an optional Group.
  • An option offers values from a list with SchemaOption.ChoicesFrom, and keeps its own type and checks. Stored data doesn't change, so there's no migration and no backup version bump.
  • A list belongs to the integration, so several widget kinds (and later panels) share it.
  • Uptime Kuma publishes monitors: groups first, then the rest, each listed as name (#id). The monitor widget's monitorId uses it.
  • ChoiceListReader reads a list through the integration's first connection. The Editor's Choices handler serves it, answering 200 with a message when it can't be read and 404 for no such list.
  • In the dialog, option-fields.js shows a grouped dropdown with Another value…, which reveals the option's own field (that's the one posted).
    • While the list loads, or if it can't be read, the field shows alone, with the reason.
    • Each list is read once per opening of the dialog. The widget list names values by their labels.

Live preview

  • The dialog's tile preview shows the link's widgets, saved or not, including the one being edited once its fields are valid.
    • They render with cached results only. Pending ones carry data-widget-preview, so widgets.js never polls them.
    • link-dialog.js then reads each through the new WidgetPreview handler.
  • The widget form shows the edited widget's description, such as "Jellyfin is down: 42 ms, 97.3% uptime over 1 day." This is its test, so there's no separate Test button.
  • Widget cache keys now hash the settings without the widget ID, so a preview's read is reused by the saved widget.

The link's own monitor picker and the infrastructure group dialog keep monitor-picker.js until 5c and 5d.

Test plan

  • 15 new tests in LiveChoiceTests:
    • choice lists: grouping, every failure message, an integration that throws, unknown lists
    • the preview: placeholders, live reads, sharing results with saved widgets, refusals
  • Full suite passes: 605 tests. The Release build with ContinuousIntegrationBuild=true is clean, and jb cleanupcode was applied.
  • Browser trial against a fake Kuma on a scratch DB:
    • the dropdown lists the groups and monitors
    • picking one updates the preview pill and the result line
    • Another value… with an unknown ID shows Kuma's reason
    • Save shows the result on the tile at once
    • reopening the dialog preselects the monitor
    • with Kuma stopped, the field falls back to typing and shows "Couldn't reach Uptime Kuma."
  • Soak against the real Kuma.

🤖 Generated with Claude Code

cerebrate and others added 2 commits October 16, 2026 23:11
Integrations publish named choice lists (IIntegration.GetChoicesAsync),
and options point at one with SchemaOption.ChoicesFrom, keeping their
own type and checks. Uptime Kuma publishes its monitors, so the monitor
widget picks its monitor by name, with "Another value..." to type an ID
and a fallback to the plain field when Kuma can't be read.

The link dialog's preview now shows the link's widgets, saved or not,
including the one being edited: rendered with cached results, the rest
read one by one, never holding up the tile. The widget form shows what
the edited widget reads, which is its test. Widget cache keys no longer
include the widget ID, so a preview's read is shared with the saved
widget.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cerebrate
cerebrate merged commit cbbf0e1 into master Oct 17, 2026
7 checks passed
@cerebrate
cerebrate deleted the feature/phase5b3-live-choices branch October 18, 2026 02:07
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