Skip to content

feat(console): dynamic form dropdowns via x-cozystack-options (DynamicOptionsWidget)#30

Merged
Aleksei Sviridkin (lexfrei) merged 11 commits into
mainfrom
feat/dynamic-options-dropdowns
Jun 2, 2026
Merged

feat(console): dynamic form dropdowns via x-cozystack-options (DynamicOptionsWidget)#30
Aleksei Sviridkin (lexfrei) merged 11 commits into
mainfrom
feat/dynamic-options-dropdowns

Conversation

@kvaps
Copy link
Copy Markdown
Member

@kvaps Andrei Kvapil (kvaps) commented Jun 1, 2026

What

  • Adds a generic DynamicOptionsWidget + a SchemaForm walker (lib/dynamic-options.ts) that turns any schema field carrying x-cozystack-options into a dropdown populated at runtime from the Option resource (core.cozystack.io) in the current namespace, with free-text fallback when a source is unavailable.
  • Replaces the bespoke StorageClassWidget / VMDiskWidget / BackupClassWidget with the single generic mechanism.
  • Migrates the backup create forms (Backup / BackupJob / BackupPlan / RestoreJob) to x-cozystack-options.

Depends on

Screenshots

To add: dropdowns on VM/Kubernetes/VMDisk/Bucket/Backup create forms.

Summary by CodeRabbit

  • Refactor
    • Streamlined form dropdown system by consolidating multiple specialized option widgets into a unified generic dropdown component that automatically binds to schema fields marked with dynamic option sources.
    • Updated form schema processing pipeline to apply widget bindings recursively across nested objects, array items, and additional properties.

Andrei Kvapil (kvaps) and others added 2 commits June 2, 2026 01:13
Add a single generic DynamicOptionsWidget that renders any string field
carrying the x-cozystack-options schema keyword as a <select>, populated
from the cozystack-api Option resource (one source per dropdown). A
shared addDynamicOptionWidgets walker binds the widget across nested
properties, array items and additionalProperties (so vm-instance
disks[].name and kubernetes nodeGroups.* are covered); the
AdditionalPropertiesField passes it through to its nested forms.

Replaces the bespoke StorageClassWidget, VMDiskWidget and
BackupClassWidget (default-StorageClass preselect and disk-size labels
are preserved via the server-provided item.default flag and labels), so
every form dropdown now uses one mechanism.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <andrei.kvapil@aenix.io>
The standalone backup-resource create pages (Plan, BackupJob, Backup,
RestoreJob) maintained a parallel client-side dropdown mechanism: they
fetched BackupClasses / Plans / Backups / application kinds and injected
them into the CRD schema as static enum arrays via enumMap. The CRD
schemas now carry the x-cozystack-options keyword on these fields, so
DynamicOptionsWidget renders them automatically from the cozystack-api
Option resource.

Drop the now-redundant enumMap entries and their backing useK8sList
fetches for backupClassName, planRef.name, backupRef.name and
applicationRef.kind / targetApplicationRef.kind. Keep applicationRef.name
and targetApplicationRef.name on enumMap: they depend on the sibling
kind field, a context the Option contract cannot express.

Add unit coverage for the addDynamicOptionWidgets walker over the
nested backup CRD shape.

Co-Authored-By: Claude <noreply@anthropic.com>
Signed-off-by: Andrei Kvapil <andrei.kvapil@aenix.io>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR replaces three field-name-based dropdown widgets with a single schema-keyword-driven DynamicOptionsWidget that reads the x-cozystack-options.source keyword to fetch Kubernetes Option resources, introducing recursive schema binding helpers and streamlining form-component and page-level enum injection logic across backup and restore creation workflows.

Changes

Widget System Refactor: Schema-Keyword-Based Dynamic Options

Layer / File(s) Summary
DynamicOptionsWidget component and tests
apps/console/src/components/DynamicOptionsWidget.tsx, apps/console/src/components/DynamicOptionsWidget.test.tsx
New generic dropdown widget that reads x-cozystack-options.source, fetches tenant-scoped Option resources via useK8sList, auto-selects server defaults once on initial load using a ref latch, preserves committed values during async loading, and emits undefined when clearing optional fields. Tests cover default auto-selection, placeholder rendering, option filtering, and clearing behavior.
addDynamicOptionWidgets schema walker and tests
apps/console/src/lib/dynamic-options.ts, apps/console/src/lib/dynamic-options.test.ts
Recursive schema traversal that binds any field carrying x-cozystack-options to DynamicOptionsWidget in the UI schema, recursing through properties, array items, and additionalProperties, while preserving pre-existing UI schema entries. Tests verify correct binding at multiple nesting levels and immutability guarantees.
SchemaForm UI schema augmentation refactor
apps/console/src/components/SchemaForm.tsx
Removes the local addVMDiskWidgets helper and updates the uiSchema memo to call addDynamicOptionWidgets before addAdditionalPropertiesWidgets, replacing field-name-based attachment of StorageClassWidget, BackupClassWidget, and VMDiskWidget with schema-keyword binding.
RJSF customWidgets registry update
apps/console/src/components/rjsf-templates.tsx
Imports and registers DynamicOptionsWidget in the customWidgets export, removing registrations for StorageClassWidget, BackupClassWidget, and VMDiskWidget.
AdditionalPropertiesField dynamic options support
apps/console/src/components/AdditionalPropertiesField.tsx
Memoizes itemUiSchema by applying addDynamicOptionWidgets to nested schema properties, enabling dynamic option widget bindings within nested additional-properties forms.
BackupCreatePage enum injection cleanup
apps/console/src/routes/BackupCreatePage.tsx
Removes client-side population of applicationRef.kind enum from appDefs, retaining only applicationRef.name injection from instances, with simplified useMemo dependency list.
BackupJobCreatePage enum injection cleanup
apps/console/src/routes/BackupJobCreatePage.tsx
Narrows enum injection to only applicationRef.name from instances, removing prior client-side injection of applicationRef.kind, backupClassName, and planRef.name; updated comments explain CRD-driven dynamic dropdown behavior.
BackupPlanCreatePage enum injection cleanup
apps/console/src/routes/BackupPlanCreatePage.tsx
Derives instances in schema memo and populates only applicationRef.name enum when API group and kind are resolved; removes enum injection for backup class and application kind; updated comments clarify the CRD-driven dropdown model.
BackupRestoreJobCreatePage enum injection cleanup
apps/console/src/routes/BackupRestoreJobCreatePage.tsx
Focuses enum injection on targetApplicationRef.name from instances; removes client-side population of backupRef.name and targetApplicationRef.kind; updates comments and useMemo dependencies to match instance-based resolution.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • cozystack/cozystack-ui#11: Modifies the same SchemaForm.tsx widget-binding logic that this PR refactors more comprehensively, replacing field-name-based widget attachment.
  • cozystack/cozystack-ui#27: Touches the same additionalProperties and items UI-schema binding recursion that this PR extends with dynamic option widget injection.
  • cozystack/cozystack-ui#6: Modifies SchemaForm.tsx UI schema augmentation pipeline around immutable-path disabling logic that this PR reorders relative to the new dynamic-options binding phase.

Suggested reviewers

  • lexfrei
  • kitsunoff
  • myasnikovdaniil

🐰 A widget's born from schema keywords, dancing free,
No more field names—just x-cozystack-options decree!
K8s Option lists sing their song of truth,
Auto-defaults spring forth in their youth.
Three become one—simpler, cleaner, supreme! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main feature: introducing dynamic form dropdowns via a new x-cozystack-options keyword and DynamicOptionsWidget, which is the primary change throughout the codebase.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/dynamic-options-dropdowns

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added area/console Issues or PRs related to apps/console — routes, detail pages, marketplace, command palette kind/feature Categorizes issue or PR as related to a new feature size/XXL This PR changes 1000+ lines, ignoring generated files labels Jun 1, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request consolidates several field-specific widgets (such as StorageClassWidget, VMDiskWidget, and BackupClassWidget) into a single, generic DynamicOptionsWidget driven by the x-cozystack-options schema keyword. It introduces utility functions to recursively apply this widget across forms and simplifies multiple creation pages by offloading option resolution to the cluster. The review feedback identifies a logic inversion bug in the auto-defaulting behavior of DynamicOptionsWidget that prevents users from clearing the field, suggests adding a free-text fallback input when no options are available, and recommends sanitizing the ui parameter in buildUi for improved robustness.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +75 to +102
return (
<select
value={currentValue}
onChange={(e) => {
if (!e.target.value) hasAutoDefaulted.current = false
onChange(e.target.value || undefined)
}}
disabled={disabled || readonly}
required={required}
className="w-full rounded-lg border border-slate-300 bg-white pl-3 pr-8 py-2 text-sm text-slate-900 outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-400 disabled:opacity-50 disabled:cursor-not-allowed"
>
{/* Explicit placeholder so a value-less required select shows it instead
of silently displaying the first option. */}
<option value="" disabled={required}>
{placeholder}
</option>
{/* Keep the committed value visible even before the list loads, so an
async re-render never drops the parent's selection. */}
{currentValue && !hasCurrentInList && (
<option value={currentValue}>{currentValue}</option>
)}
{items.map((it) => (
<option key={it.value} value={it.value} title={it.description}>
{it.label || it.value}
</option>
))}
</select>
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This change addresses two key issues in the dropdown widget:

  1. Logic Inversion Bug in Auto-Defaulting: The current implementation resets hasAutoDefaulted.current = false when the user clears the field (i.e., when !e.target.value is true). This causes the useEffect to immediately re-trigger and re-apply the default value, making it impossible for the user to deliberately clear the field or select -- None --. Removing this reset ensures the default is only applied once on initial load.
  2. Missing Free-Text Fallback: The PR description mentions a "free-text fallback when a source is unavailable". However, the widget currently only renders a <select> element. If the Option resource is missing or empty, the user is left with an empty dropdown and cannot proceed. Falling back to a standard <input type="text"> when loading is complete and items is empty solves this issue.
  if (!isLoading && items.length === 0) {
    return (
      <input
        type="text"
        value={currentValue}
        onChange={(e) => onChange(e.target.value || undefined)}
        disabled={disabled || readonly}
        required={required}
        placeholder={placeholder}
        className="w-full rounded-lg border border-slate-300 bg-white px-3 py-2 text-sm text-slate-900 outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-400 disabled:opacity-50 disabled:cursor-not-allowed"
      />
    )
  }

  return (
    <select
      value={currentValue}
      onChange={(e) => onChange(e.target.value || undefined)}
      disabled={disabled || readonly}
      required={required}
      className="w-full rounded-lg border border-slate-300 bg-white pl-3 pr-8 py-2 text-sm text-slate-900 outline-none focus:border-blue-400 focus:ring-1 focus:ring-blue-400 disabled:opacity-50 disabled:cursor-not-allowed"
    >
      {/* Explicit placeholder so a value-less required select shows it instead
          of silently displaying the first option. */}
      <option value="" disabled={required}>
        {placeholder}
      </option>
      {/* Keep the committed value visible even before the list loads, so an
          async re-render never drops the parent's selection. */}
      {currentValue && !hasCurrentInList && (
        <option value={currentValue}>{currentValue}</option>
      )}
      {items.map((it) => (
        <option key={it.value} value={it.value} title={it.description}>
          {it.label || it.value}
        </option>
      ))}
    </select>
  )

Comment on lines +14 to +17
function buildUi(node: unknown, ui: Record<string, unknown> = {}): Record<string, unknown> {
if (!node || typeof node !== "object") return ui
const n = node as Record<string, unknown>
const result = { ...ui }
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To enforce defensive programming and ensure robustness, we should sanitize the ui parameter before spreading it. If ui is passed as a non-object (such as a string or null), { ...ui } can lead to unexpected behavior or runtime errors. Ensuring safeUi is a plain object prevents these issues.

Suggested change
function buildUi(node: unknown, ui: Record<string, unknown> = {}): Record<string, unknown> {
if (!node || typeof node !== "object") return ui
const n = node as Record<string, unknown>
const result = { ...ui }
function buildUi(node: unknown, ui: unknown = {}): Record<string, unknown> {
const safeUi = ui && typeof ui === "object" && !Array.isArray(ui) ? (ui as Record<string, unknown>) : {}
if (!node || typeof node !== "object") return safeUi
const n = node as Record<string, unknown>
const result = { ...safeUi }

@kvaps Andrei Kvapil (kvaps) marked this pull request as ready for review June 2, 2026 01:08
The migration to the generic widget removed the StorageClass/VMDisk/BackupClass
widget test suites, dropping coverage of behavior that absorbed several prior
bug fixes. Pin it on DynamicOptionsWidget: auto-selecting the server-marked
default once, showing an explicit placeholder for a required empty select
instead of the first option, keeping a committed value visible while the list
loads, emitting undefined (not "") on clear, and resolving items only from the
Option whose name matches the field's source.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
…roperties branches

The walker recurses into array items and additionalProperties maps — the whole
reason it exists over inlining (vm-instance disks[].name, kubernetes
nodeGroups.*.instanceType) — but only the properties path was tested. Add cases
for both recursion branches.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
…down

The applicationRef.kind field now resolves through the appkind option source, so
it renders as a dropdown for every apiGroup — it is no longer gated to
apps.cozystack.io. Only the applicationRef.name enum remains gated (it is served
client-side and depends on the chosen kind). Update the comments that still
described the old free-text-fallback behavior for the kind field.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
…eline

The forms pipeline section still listed the removed StorageClass/BackupClass/
VMDisk field-name widgets and framed binding as a field-name convention. Update
it to describe addDynamicOptionWidgets binding any field carrying
x-cozystack-options to DynamicOptionsWidget, recursing into properties, array
items and additionalProperties.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
Two comments still pointed at entities this migration removed: the backup-class
access hook claimed the dropdown is powered by a tenant list on backupclasses
(it is now served by the Option resource), and the SchemaForm default-emit
comment cited plansData/backupClassesData as the async-sibling example (both
deleted). Correct both to match the code.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
The walker recurses into properties/items/additionalProperties but not the
composition keywords, mirroring the same intentional limitation in
addSensitiveStringWidgets. Pin it with a FIXME so the gap is documented rather
than silent.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
The generic widget auto-selects only the server-marked default item, so a
default-less source (vmdisk) must not auto-commit on load — the invariant the
old VMDiskWidget enforced to avoid dropping the user's disk on a fast submit.
Also pin that the Option resource is listed namespaced to the active tenant
(querying it cluster-wide would return nothing).

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
…put uiSchema

The pipeline contract (and the sibling sensitive-fields walker) requires the
binders to return a new object and leave the input untouched. Pin it for
addDynamicOptionWidgets: a nested input uiSchema stays byte-identical and the
result's touched sub-objects are fresh references.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
…plying the default

The select onChange reset the auto-default guard whenever the field was cleared,
which re-armed the effect: for an optional field with a server-marked default,
clearing emitted undefined, the effect then saw no value and re-selected the
default, so the field could never be cleared. Latch the guard after the first
auto-default and never reset it — clearing now sticks, matching the comment's
stated intent. Required fields were unaffected (their empty option is disabled).

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
@lexfrei Aleksei Sviridkin (lexfrei) added the do-not-merge/hold Indicates that a PR should not merge because someone has issued /hold label Jun 2, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/console/src/components/DynamicOptionsWidget.tsx`:
- Around line 62-68: The effect currently only sets hasAutoDefaulted inside the
branch that applies the default, so fields that mount with a pre-filled value
never arm the latch and will snap back if cleared later; change the useEffect
for hasAutoDefaulted so it arms as soon as loading settles: inside the effect,
if (!hasAutoDefaulted.current && !isLoading) set hasAutoDefaulted.current =
true, and separately (only when !value && defaultItem) call
onChange(defaultItem.value); keep the same dependencies and preserve the
existing guards for applying the default (value, defaultItem, isLoading,
onChange).
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: da084961-8f5d-4425-acbf-5ca5fadcfd1a

📥 Commits

Reviewing files that changed from the base of the PR and between 27e9b1b and 2503e36.

📒 Files selected for processing (19)
  • CLAUDE.md
  • apps/console/src/components/AdditionalPropertiesField.tsx
  • apps/console/src/components/BackupClassWidget.test.tsx
  • apps/console/src/components/BackupClassWidget.tsx
  • apps/console/src/components/DynamicOptionsWidget.test.tsx
  • apps/console/src/components/DynamicOptionsWidget.tsx
  • apps/console/src/components/SchemaForm.tsx
  • apps/console/src/components/StorageClassWidget.test.tsx
  • apps/console/src/components/StorageClassWidget.tsx
  • apps/console/src/components/VMDiskWidget.test.tsx
  • apps/console/src/components/VMDiskWidget.tsx
  • apps/console/src/components/rjsf-templates.tsx
  • apps/console/src/hooks/useBackupClassAdminAccess.ts
  • apps/console/src/lib/dynamic-options.test.ts
  • apps/console/src/lib/dynamic-options.ts
  • apps/console/src/routes/BackupCreatePage.tsx
  • apps/console/src/routes/BackupJobCreatePage.tsx
  • apps/console/src/routes/BackupPlanCreatePage.tsx
  • apps/console/src/routes/BackupRestoreJobCreatePage.tsx
💤 Files with no reviewable changes (6)
  • apps/console/src/components/StorageClassWidget.test.tsx
  • apps/console/src/components/BackupClassWidget.test.tsx
  • apps/console/src/components/VMDiskWidget.tsx
  • apps/console/src/components/VMDiskWidget.test.tsx
  • apps/console/src/components/BackupClassWidget.tsx
  • apps/console/src/components/StorageClassWidget.tsx

Comment on lines +62 to +68
const hasAutoDefaulted = useRef(false)
useEffect(() => {
if (!hasAutoDefaulted.current && !value && defaultItem && !isLoading) {
hasAutoDefaulted.current = true
onChange(defaultItem.value)
}
}, [value, defaultItem, isLoading, onChange])
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Auto-default re-arms when the field mounts with a pre-existing value.

The latch is only set inside the apply branch, so it stays false whenever the field mounts with a committed value (the !value guard skips). If the user later clears that field, the effect now sees !hasAutoDefaulted.current && !value && defaultItem && !isLoading and re-applies the default — making a pre-filled optional field impossible to clear. This is the exact snap-back the latch is meant to prevent, but it only holds for fields that start empty. Arm the latch once loading settles, independent of whether a default was applied:

🐛 Proposed fix
   const hasAutoDefaulted = useRef(false)
   useEffect(() => {
-    if (!hasAutoDefaulted.current && !value && defaultItem && !isLoading) {
-      hasAutoDefaulted.current = true
-      onChange(defaultItem.value)
-    }
+    if (hasAutoDefaulted.current || isLoading) return
+    // Latch on the first settled render so a later clear never re-arms the
+    // default, even when the field loaded with a pre-existing value.
+    hasAutoDefaulted.current = true
+    if (!value && defaultItem) onChange(defaultItem.value)
   }, [value, defaultItem, isLoading, onChange])

A matching test (mount with a value + server default, clear, assert no snap-back) would lock this in.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const hasAutoDefaulted = useRef(false)
useEffect(() => {
if (!hasAutoDefaulted.current && !value && defaultItem && !isLoading) {
hasAutoDefaulted.current = true
onChange(defaultItem.value)
}
}, [value, defaultItem, isLoading, onChange])
const hasAutoDefaulted = useRef(false)
useEffect(() => {
if (hasAutoDefaulted.current || isLoading) return
// Latch on the first settled render so a later clear never re-arms the
// default, even when the field loaded with a pre-existing value.
hasAutoDefaulted.current = true
if (!value && defaultItem) onChange(defaultItem.value)
}, [value, defaultItem, isLoading, onChange])
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/console/src/components/DynamicOptionsWidget.tsx` around lines 62 - 68,
The effect currently only sets hasAutoDefaulted inside the branch that applies
the default, so fields that mount with a pre-filled value never arm the latch
and will snap back if cleared later; change the useEffect for hasAutoDefaulted
so it arms as soon as loading settles: inside the effect, if
(!hasAutoDefaulted.current && !isLoading) set hasAutoDefaulted.current = true,
and separately (only when !value && defaultItem) call
onChange(defaultItem.value); keep the same dependencies and preserve the
existing guards for applying the default (value, defaultItem, isLoading,
onChange).

@lexfrei Aleksei Sviridkin (lexfrei) removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued /hold label Jun 2, 2026
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generic DynamicOptionsWidget driven by the x-cozystack-options schema keyword, replacing the three field-name-bound widgets (StorageClass/BackupClass/VMDisk) and the per-page client-side enum builders. The backend contract it depends on has landed (Option resource + x-cozystack-options annotations), so the dropdowns are live rather than degrading to free-text. typecheck and the full vitest suite pass; behavior parity with the removed widgets is pinned by tests (auto-default-once, VMDisk no-auto-default, required placeholder, committed-value-visible-while-loading, clear-sticks-without-snapback, namespaced Option query), and the walker's properties/items/additionalProperties recursion, no-mutation invariant, and intentional oneOf/anyOf/allOf gap are all covered. Verified the integration with current main is clean (306 tests green on the merged tree). LGTM.

@lexfrei Aleksei Sviridkin (lexfrei) merged commit 1d9d26b into main Jun 2, 2026
6 checks passed
@lexfrei Aleksei Sviridkin (lexfrei) deleted the feat/dynamic-options-dropdowns branch June 2, 2026 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/console Issues or PRs related to apps/console — routes, detail pages, marketplace, command palette kind/feature Categorizes issue or PR as related to a new feature size/XXL This PR changes 1000+ lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants